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.IncludeFacade;
11 import org.andromda.metafacades.uml.UseCaseFacade;
12 import org.apache.log4j.Logger;
13 import org.omg.uml.behavioralelements.usecases.Include;
14
15
16
17
18
19
20
21
22 public abstract class IncludeFacadeLogic
23 extends ModelElementFacadeLogicImpl
24 implements IncludeFacade
25 {
26
27
28
29
30 protected Include metaObject;
31
32
33
34
35
36 protected IncludeFacadeLogic(Include 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(IncludeFacadeLogic.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.IncludeFacade";
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 isIncludeFacadeMetaType()
79 {
80 return true;
81 }
82
83
84
85
86
87
88
89
90 public final UseCaseFacade getAddition()
91 {
92 UseCaseFacade getAddition1r = null;
93
94 Object result = handleGetAddition();
95 MetafacadeBase shieldedResult = this.shieldedElement(result);
96 try
97 {
98 getAddition1r = (UseCaseFacade)shieldedResult;
99 }
100 catch (ClassCastException ex)
101 {
102
103 IncludeFacadeLogic.logger.warn("incorrect metafacade cast for IncludeFacadeLogic.getAddition UseCaseFacade " + result + ": " + shieldedResult);
104 }
105
106 return getAddition1r;
107 }
108
109
110
111
112
113 protected abstract Object handleGetAddition();
114
115
116
117
118
119 public final UseCaseFacade getBase()
120 {
121 UseCaseFacade getBase2r = null;
122
123 Object result = handleGetBase();
124 MetafacadeBase shieldedResult = this.shieldedElement(result);
125 try
126 {
127 getBase2r = (UseCaseFacade)shieldedResult;
128 }
129 catch (ClassCastException ex)
130 {
131
132 IncludeFacadeLogic.logger.warn("incorrect metafacade cast for IncludeFacadeLogic.getBase UseCaseFacade " + result + ": " + shieldedResult);
133 }
134
135 return getBase2r;
136 }
137
138
139
140
141
142 protected abstract Object handleGetBase();
143
144
145
146
147
148 @Override
149 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
150 {
151 super.validateInvariants(validationMessages);
152 }
153 }