1 // license-header java merge-point
2 //
3 // Attention: generated code (by MetafacadeLogic.vsl) - do not modify!
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.LinkEndFacade;
11 import org.andromda.metafacades.uml.LinkFacade;
12 import org.apache.log4j.Logger;
13 import org.omg.uml.behavioralelements.commonbehavior.Link;
14
15 /**
16 * A representation of the model object 'Instance Specification'. Represents an instance in a
17 * modeled system. Has the capability of being a deployment target in a deployment relationship, in
18 * the case that it is an instance of a node. Has the capability of being a deployed artifact, if it
19 * is an instance of an artifact.
20 * MetafacadeLogic for LinkFacade
21 *
22 * @see LinkFacade
23 */
24 public abstract class LinkFacadeLogic
25 extends ModelElementFacadeLogicImpl
26 implements LinkFacade
27 {
28 /**
29 * The underlying UML object
30 * @see Link
31 */
32 protected Link metaObject;
33
34 /** Create Metafacade implementation instance using the MetafacadeFactory from the context
35 * @param metaObjectIn
36 * @param context
37 */
38 protected LinkFacadeLogic(Link metaObjectIn, String context)
39 {
40 super(metaObjectIn, getContext(context));
41 this.metaObject = metaObjectIn;
42 }
43
44 /**
45 * The logger instance.
46 */
47 private static final Logger logger = Logger.getLogger(LinkFacadeLogic.class);
48
49 /**
50 * Gets the context for this metafacade logic instance.
51 * @param context String. Set to LinkFacade if null
52 * @return context String
53 */
54 private static String getContext(String context)
55 {
56 if (context == null)
57 {
58 context = "org.andromda.metafacades.uml.LinkFacade";
59 }
60 return context;
61 }
62
63 /** Reset context only for non-root metafacades
64 * @param context
65 */
66 @Override
67 public void resetMetafacadeContext(String context)
68 {
69 if (!this.contextRoot) // reset context only for non-root metafacades
70 {
71 context = getContext(context); // to have same value as in original constructor call
72 setMetafacadeContext (context);
73 }
74 }
75
76 /**
77 * @return boolean true always
78 * @see LinkFacade
79 */
80 public boolean isLinkFacadeMetaType()
81 {
82 return true;
83 }
84
85 // ------------- associations ------------------
86
87 private Collection<LinkEndFacade> __getLinkEnds1r;
88 private boolean __getLinkEnds1rSet = false;
89
90 /**
91 * The link owning this link end.
92 * @return (Collection<LinkEndFacade>)handleGetLinkEnds()
93 */
94 public final Collection<LinkEndFacade> getLinkEnds()
95 {
96 Collection<LinkEndFacade> getLinkEnds1r = this.__getLinkEnds1r;
97 if (!this.__getLinkEnds1rSet)
98 {
99 // link has no pre constraints
100 Collection result = handleGetLinkEnds();
101 List shieldedResult = this.shieldedElements(result);
102 try
103 {
104 getLinkEnds1r = (Collection<LinkEndFacade>)shieldedResult;
105 }
106 catch (ClassCastException ex)
107 {
108 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
109 LinkFacadeLogic.logger.warn("incorrect metafacade cast for LinkFacadeLogic.getLinkEnds Collection<LinkEndFacade> " + result + ": " + shieldedResult);
110 }
111 // link has no post constraints
112 this.__getLinkEnds1r = getLinkEnds1r;
113 if (isMetafacadePropertyCachingEnabled())
114 {
115 this.__getLinkEnds1rSet = true;
116 }
117 }
118 return getLinkEnds1r;
119 }
120
121 /**
122 * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type
123 * @return Collection
124 */
125 protected abstract Collection handleGetLinkEnds();
126
127 /**
128 * @param validationMessages Collection<ModelValidationMessage>
129 * @see ModelElementFacadeLogicImpl#validateInvariants(Collection validationMessages)
130 */
131 @Override
132 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
133 {
134 super.validateInvariants(validationMessages);
135 }
136 }