1
2
3
4
5 package org.andromda.metafacades.uml14;
6
7 import java.util.Collection;
8 import org.andromda.core.metafacade.MetafacadeBase;
9 import org.andromda.core.metafacade.ModelValidationMessage;
10 import org.andromda.metafacades.uml.ExtensionPointFacade;
11 import org.andromda.metafacades.uml.UseCaseFacade;
12 import org.apache.log4j.Logger;
13 import org.omg.uml.behavioralelements.usecases.ExtensionPoint;
14
15
16
17
18
19
20
21
22 public abstract class ExtensionPointFacadeLogic
23 extends ModelElementFacadeLogicImpl
24 implements ExtensionPointFacade
25 {
26
27
28
29
30 protected ExtensionPoint metaObject;
31
32
33
34
35
36 protected ExtensionPointFacadeLogic(ExtensionPoint metaObjectIn, String context)
37 {
38 super(metaObjectIn, getContext(context));
39 this.metaObject = metaObjectIn;
40 }
41
42
43
44
45 private static final Logger logger = Logger.getLogger(ExtensionPointFacadeLogic.class);
46
47
48
49
50
51
52 private static String getContext(String context)
53 {
54 if (context == null)
55 {
56 context = "org.andromda.metafacades.uml.ExtensionPointFacade";
57 }
58 return context;
59 }
60
61
62
63
64 @Override
65 public void resetMetafacadeContext(String context)
66 {
67 if (!this.contextRoot)
68 {
69 context = getContext(context);
70 setMetafacadeContext (context);
71 }
72 }
73
74
75
76
77
78 public boolean isExtensionPointFacadeMetaType()
79 {
80 return true;
81 }
82
83
84
85 private UseCaseFacade __getUseCase1r;
86 private boolean __getUseCase1rSet = false;
87
88
89
90
91
92 public final UseCaseFacade getUseCase()
93 {
94 UseCaseFacade getUseCase1r = this.__getUseCase1r;
95 if (!this.__getUseCase1rSet)
96 {
97
98 Object result = handleGetUseCase();
99 MetafacadeBase shieldedResult = this.shieldedElement(result);
100 try
101 {
102 getUseCase1r = (UseCaseFacade)shieldedResult;
103 }
104 catch (ClassCastException ex)
105 {
106
107 ExtensionPointFacadeLogic.logger.warn("incorrect metafacade cast for ExtensionPointFacadeLogic.getUseCase UseCaseFacade " + result + ": " + shieldedResult);
108 }
109
110 this.__getUseCase1r = getUseCase1r;
111 if (isMetafacadePropertyCachingEnabled())
112 {
113 this.__getUseCase1rSet = true;
114 }
115 }
116 return getUseCase1r;
117 }
118
119
120
121
122
123 protected abstract Object handleGetUseCase();
124
125
126
127
128
129 @Override
130 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
131 {
132 super.validateInvariants(validationMessages);
133 }
134 }