1
2
3
4
5 package org.andromda.metafacades.uml14;
6
7 import java.util.Collection;
8 import java.util.List;
9 import org.andromda.core.metafacade.MetafacadeBase;
10 import org.andromda.core.metafacade.ModelValidationMessage;
11 import org.andromda.metafacades.uml.ActivityGraphFacade;
12 import org.andromda.metafacades.uml.PartitionFacade;
13 import org.andromda.metafacades.uml.StateVertexFacade;
14 import org.apache.log4j.Logger;
15 import org.omg.uml.behavioralelements.activitygraphs.Partition;
16
17
18
19
20
21
22
23
24 public abstract class PartitionFacadeLogic
25 extends ModelElementFacadeLogicImpl
26 implements PartitionFacade
27 {
28
29
30
31
32 protected Partition metaObject;
33
34
35
36
37
38 protected PartitionFacadeLogic(Partition metaObjectIn, String context)
39 {
40 super(metaObjectIn, getContext(context));
41 this.metaObject = metaObjectIn;
42 }
43
44
45
46
47 private static final Logger logger = Logger.getLogger(PartitionFacadeLogic.class);
48
49
50
51
52
53
54 private static String getContext(String context)
55 {
56 if (context == null)
57 {
58 context = "org.andromda.metafacades.uml.PartitionFacade";
59 }
60 return context;
61 }
62
63
64
65
66 @Override
67 public void resetMetafacadeContext(String context)
68 {
69 if (!this.contextRoot)
70 {
71 context = getContext(context);
72 setMetafacadeContext (context);
73 }
74 }
75
76
77
78
79
80 public boolean isPartitionFacadeMetaType()
81 {
82 return true;
83 }
84
85
86
87 private Collection<StateVertexFacade> __getVertices1r;
88 private boolean __getVertices1rSet = false;
89
90
91
92
93
94 public final Collection<StateVertexFacade> getVertices()
95 {
96 Collection<StateVertexFacade> getVertices1r = this.__getVertices1r;
97 if (!this.__getVertices1rSet)
98 {
99
100 Collection result = handleGetVertices();
101 List shieldedResult = this.shieldedElements(result);
102 try
103 {
104 getVertices1r = (Collection<StateVertexFacade>)shieldedResult;
105 }
106 catch (ClassCastException ex)
107 {
108
109 PartitionFacadeLogic.logger.warn("incorrect metafacade cast for PartitionFacadeLogic.getVertices Collection<StateVertexFacade> " + result + ": " + shieldedResult);
110 }
111
112 this.__getVertices1r = getVertices1r;
113 if (isMetafacadePropertyCachingEnabled())
114 {
115 this.__getVertices1rSet = true;
116 }
117 }
118 return getVertices1r;
119 }
120
121
122
123
124
125 protected abstract Collection handleGetVertices();
126
127
128
129
130
131
132 public final ActivityGraphFacade getActivityGraph()
133 {
134 ActivityGraphFacade getActivityGraph2r = null;
135
136 Object result = handleGetActivityGraph();
137 MetafacadeBase shieldedResult = this.shieldedElement(result);
138 try
139 {
140 getActivityGraph2r = (ActivityGraphFacade)shieldedResult;
141 }
142 catch (ClassCastException ex)
143 {
144
145 PartitionFacadeLogic.logger.warn("incorrect metafacade cast for PartitionFacadeLogic.getActivityGraph ActivityGraphFacade " + result + ": " + shieldedResult);
146 }
147
148 return getActivityGraph2r;
149 }
150
151
152
153
154
155 protected abstract Object handleGetActivityGraph();
156
157
158
159
160
161 @Override
162 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
163 {
164 super.validateInvariants(validationMessages);
165 }
166 }