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.ModelValidationMessage;
10 import org.andromda.metafacades.uml.ModelElementFacade;
11 import org.andromda.metafacades.uml.NamespaceFacade;
12 import org.apache.log4j.Logger;
13 import org.omg.uml.foundation.core.Classifier;
14
15
16
17
18
19
20
21 public abstract class NamespaceFacadeLogic
22 extends ClassifierFacadeLogicImpl
23 implements NamespaceFacade
24 {
25
26
27
28
29 protected Object metaObject;
30
31
32
33
34
35 protected NamespaceFacadeLogic(Object metaObjectIn, String context)
36 {
37 super((Classifier)metaObjectIn, getContext(context));
38 this.metaObject = metaObjectIn;
39 }
40
41
42
43
44 private static final Logger logger = Logger.getLogger(NamespaceFacadeLogic.class);
45
46
47
48
49
50
51 private static String getContext(String context)
52 {
53 if (context == null)
54 {
55 context = "org.andromda.metafacades.uml.NamespaceFacade";
56 }
57 return context;
58 }
59
60
61
62
63 @Override
64 public void resetMetafacadeContext(String context)
65 {
66 if (!this.contextRoot)
67 {
68 context = getContext(context);
69 setMetafacadeContext (context);
70 }
71 }
72
73
74
75
76
77 public boolean isNamespaceFacadeMetaType()
78 {
79 return true;
80 }
81
82
83
84
85
86
87
88 public final Collection<ModelElementFacade> getOwnedElements()
89 {
90 Collection<ModelElementFacade> getOwnedElements1r = null;
91
92 Collection result = handleGetOwnedElements();
93 List shieldedResult = this.shieldedElements(result);
94 try
95 {
96 getOwnedElements1r = (Collection<ModelElementFacade>)shieldedResult;
97 }
98 catch (ClassCastException ex)
99 {
100
101 NamespaceFacadeLogic.logger.warn("incorrect metafacade cast for NamespaceFacadeLogic.getOwnedElements Collection<ModelElementFacade> " + result + ": " + shieldedResult);
102 }
103
104 return getOwnedElements1r;
105 }
106
107
108
109
110
111 protected abstract Collection handleGetOwnedElements();
112
113
114
115
116
117 @Override
118 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
119 {
120 super.validateInvariants(validationMessages);
121 }
122 }