|
| 1 | +/* |
| 2 | + * WARNING: GENERATED FILE - DO NOT EDIT |
| 3 | + * Module: CamelDesigner v1.0.05 |
| 4 | +
|
| 5 | + * This file was generated on 11/23/21 5:02 PM by Modelio Studio. |
| 6 | + */ |
| 7 | +package fr.softeam.cameldesigner.api.cameldiagrams.standard.classdiagram; |
| 8 | + |
| 9 | +import java.util.ArrayList; |
| 10 | +import java.util.Collections; |
| 11 | +import java.util.List; |
| 12 | +import java.util.Objects; |
| 13 | +import com.modeliosoft.modelio.javadesigner.annotations.objid; |
| 14 | +import fr.softeam.cameldesigner.api.CamelDesignerProxyFactory; |
| 15 | +import fr.softeam.cameldesigner.api.ICamelDesignerPeerModule; |
| 16 | +import fr.softeam.cameldesigner.api.camelcore.infrastructure.modelelement.CamelElement; |
| 17 | +import fr.softeam.cameldesigner.api.cameldiagrams.infrastructure.abstractdiagram.AbstractCamelDiagram; |
| 18 | +import fr.softeam.cameldesigner.api.executionmodel.standard.package_.ExecutionModel; |
| 19 | +import fr.softeam.cameldesigner.impl.CamelDesignerModule; |
| 20 | +import org.modelio.api.modelio.model.IModelingSession; |
| 21 | +import org.modelio.api.modelio.model.PropertyConverter; |
| 22 | +import org.modelio.api.module.context.IModuleContext; |
| 23 | +import org.modelio.metamodel.diagrams.ClassDiagram; |
| 24 | +import org.modelio.metamodel.mmextensions.infrastructure.ExtensionNotFoundException; |
| 25 | +import org.modelio.metamodel.uml.infrastructure.Dependency; |
| 26 | +import org.modelio.metamodel.uml.infrastructure.ModelElement; |
| 27 | +import org.modelio.metamodel.uml.infrastructure.Stereotype; |
| 28 | +import org.modelio.metamodel.uml.infrastructure.TagType; |
| 29 | +import org.modelio.metamodel.uml.infrastructure.properties.PropertyDefinition; |
| 30 | +import org.modelio.metamodel.uml.infrastructure.properties.PropertyTableDefinition; |
| 31 | +import org.modelio.vcore.smkernel.mapi.MObject; |
| 32 | + |
| 33 | +/** |
| 34 | + * Proxy class to handle a {@link ClassDiagram} with << ExecutionModelDiagram >> stereotype. |
| 35 | + * <p>Stereotype description: |
| 36 | + * <br/><i>null</i></p> |
| 37 | + */ |
| 38 | +@objid ("81054f40-4a19-4bee-8959-d5f552c3e112") |
| 39 | +public class ExecutionModelDiagram extends AbstractCamelDiagram { |
| 40 | + @objid ("efe196d7-6329-4033-acfa-fc6e964031e6") |
| 41 | + public static final String STEREOTYPE_NAME = "ExecutionModelDiagram"; |
| 42 | + |
| 43 | + /** |
| 44 | + * Tells whether a {@link ExecutionModelDiagram proxy} can be instantiated from a {@link MObject} checking it is a {@link ClassDiagram} stereotyped << ExecutionModelDiagram >>. |
| 45 | + * <p> |
| 46 | + * The method returns <code>false</code> if the instantiation cannot be carried out. |
| 47 | + * |
| 48 | + * @param elt a model object |
| 49 | + * @return <code>true</code> if the instantiation can be carried out else <code>false</code>. |
| 50 | + */ |
| 51 | + @objid ("0c99142a-1fc7-4aa6-8045-325efa4e0941") |
| 52 | + public static boolean canInstantiate(final MObject elt) { |
| 53 | + return ((elt instanceof ClassDiagram) && ((ClassDiagram) elt).isStereotyped(ICamelDesignerPeerModule.MODULE_NAME, ExecutionModelDiagram.STEREOTYPE_NAME)); |
| 54 | + } |
| 55 | + |
| 56 | + /** |
| 57 | + * Create a new {@link ClassDiagram} stereotyped << ExecutionModelDiagram >> then instantiate a {@link ExecutionModelDiagram} proxy. |
| 58 | + * |
| 59 | + * @return a {@link ExecutionModelDiagram} proxy on the created {@link ClassDiagram}. |
| 60 | + */ |
| 61 | + @objid ("aaf86775-d3ab-4211-b9a8-2bd3ba2d4a2b") |
| 62 | + public static ExecutionModelDiagram create() { |
| 63 | + ModelElement e = (ModelElement)CamelDesignerModule.getInstance().getModuleContext().getModelingSession().getModel().createElement("Standard.ClassDiagram"); |
| 64 | + e.addStereotype(ICamelDesignerPeerModule.MODULE_NAME, ExecutionModelDiagram.STEREOTYPE_NAME); |
| 65 | + return ExecutionModelDiagram.instantiate((ClassDiagram)e); |
| 66 | + } |
| 67 | + |
| 68 | + /** |
| 69 | + * Tries to instantiate a {@link ExecutionModelDiagram} proxy from a {@link ClassDiagram} stereotyped << ExecutionModelDiagram >> checking its metaclass and its stereotype. |
| 70 | + * <p> |
| 71 | + * The method returns <i>null</i> if the instantiation cannot be carried out. |
| 72 | + * @param obj a ClassDiagram |
| 73 | + * @return a {@link ExecutionModelDiagram} proxy or <i>null</i>. |
| 74 | + */ |
| 75 | + @objid ("bf0b0d0f-de47-41b8-b785-d1e5ab41a939") |
| 76 | + public static ExecutionModelDiagram instantiate(final ClassDiagram obj) { |
| 77 | + return ExecutionModelDiagram.canInstantiate(obj) ? new ExecutionModelDiagram(obj) : null; |
| 78 | + } |
| 79 | + |
| 80 | + /** |
| 81 | + * Tries to instantiate a {@link ExecutionModelDiagram} proxy from a {@link ClassDiagram} stereotyped << ExecutionModelDiagram >> checking its metaclass and its stereotype. |
| 82 | + * <p> |
| 83 | + * The method throws an {@link IllegalArgumentException} if the instantiation cannot be carried out. |
| 84 | + * @param obj a {@link ClassDiagram} |
| 85 | + * @return a {@link ExecutionModelDiagram} proxy. |
| 86 | + * @throws IllegalArgumentException if the instantiation cannot be carried out. |
| 87 | + */ |
| 88 | + @objid ("11457041-11e1-4f3e-bee4-b4451a75f1fe") |
| 89 | + public static ExecutionModelDiagram safeInstantiate(final ClassDiagram obj) throws IllegalArgumentException { |
| 90 | + if (ExecutionModelDiagram.canInstantiate(obj)) |
| 91 | + return new ExecutionModelDiagram(obj); |
| 92 | + else |
| 93 | + throw new IllegalArgumentException("ExecutionModelDiagram: Cannot instantiate "+obj+": wrong element type or stereotype"); |
| 94 | + } |
| 95 | + |
| 96 | + @objid ("16cf1c0b-12f6-4391-9903-112578e5cf23") |
| 97 | + @Override |
| 98 | + public boolean equals(final Object obj) { |
| 99 | + if (this == obj) { |
| 100 | + return true; |
| 101 | + } |
| 102 | + if (obj == null) { |
| 103 | + return false; |
| 104 | + } |
| 105 | + if (getClass() != obj.getClass()) { |
| 106 | + return false; |
| 107 | + } |
| 108 | + ExecutionModelDiagram other = (ExecutionModelDiagram) obj; |
| 109 | + return java.util.Objects.equals(getElement(), other.getElement()); |
| 110 | + } |
| 111 | + |
| 112 | + /** |
| 113 | + * Get the underlying {@link ClassDiagram}. |
| 114 | + * @return the ClassDiagram represented by this proxy, never null. |
| 115 | + */ |
| 116 | + @objid ("9fb21d8d-7e70-41ae-a5ee-6f41148ca453") |
| 117 | + @Override |
| 118 | + public ClassDiagram getElement() { |
| 119 | + return (ClassDiagram)super.getElement(); |
| 120 | + } |
| 121 | + |
| 122 | + /** |
| 123 | + * Get the value of the 'Origin' role.<p> |
| 124 | + * Role description: |
| 125 | + * null |
| 126 | + * |
| 127 | + */ |
| 128 | + @objid ("6b430a2d-af96-45cd-a714-f29d0eabd956") |
| 129 | + public ExecutionModel getOrigin() { |
| 130 | + for (Dependency d : this.elt.getImpactedDependency()) { |
| 131 | + if (d.isStereotyped(ExecutionModelDiagram.MdaTypes.MDAASSOCDEP) |
| 132 | + && Objects.equals(d.getTagValue(ExecutionModelDiagram.MdaTypes.MDAASSOCDEP_ROLE), "Diagram") |
| 133 | + && ExecutionModel.canInstantiate(d.getImpacted())) { |
| 134 | + return (ExecutionModel)CamelDesignerProxyFactory.instantiate(d.getImpacted(), ExecutionModel.MdaTypes.STEREOTYPE_ELT.getName()); |
| 135 | + } |
| 136 | + } |
| 137 | + return null; |
| 138 | + } |
| 139 | + |
| 140 | + @objid ("8d088545-5f00-4582-8e30-3f11c73c70d1") |
| 141 | + @Override |
| 142 | + public int hashCode() { |
| 143 | + return 23 + ((this.elt == null) ? 0 : this.elt.hashCode()); |
| 144 | + } |
| 145 | + |
| 146 | + /** |
| 147 | + * Set the value of the 'Origin' role.<p> |
| 148 | + * Role description: |
| 149 | + * null |
| 150 | + * |
| 151 | + */ |
| 152 | + @objid ("d61a787f-e4f2-4cf0-afd1-42a264da6db5") |
| 153 | + public void setOrigin(final ExecutionModel obj) { |
| 154 | + Dependency dep = null; |
| 155 | + for (Dependency d : this.elt.getImpactedDependency()) |
| 156 | + if (d.isStereotyped(ExecutionModelDiagram.MdaTypes.MDAASSOCDEP) && Objects.equals(d.getTagValue(ExecutionModelDiagram.MdaTypes.MDAASSOCDEP_ROLE), "Diagram")) { |
| 157 | + dep = d; |
| 158 | + break; |
| 159 | + } |
| 160 | + if (obj == null) { |
| 161 | + if (dep != null) dep.delete(); |
| 162 | + } else { |
| 163 | + if (dep == null) { |
| 164 | + IModelingSession session = CamelDesignerModule.getInstance().getModuleContext().getModelingSession(); |
| 165 | + dep = session.getModel().createDependency(obj.getElement(), this.elt, ExecutionModelDiagram.MdaTypes.MDAASSOCDEP); |
| 166 | + dep.setName("Diagram"); |
| 167 | + dep.putTagValue(ExecutionModelDiagram.MdaTypes.MDAASSOCDEP_ROLE, "Diagram"); |
| 168 | + } |
| 169 | + dep.setImpacted(obj.getElement()); |
| 170 | + } |
| 171 | + } |
| 172 | + |
| 173 | + @objid ("2f80f04c-df61-48c6-9945-4f635ce676b9") |
| 174 | + @Override |
| 175 | + public List<CamelElement> getChilds() { |
| 176 | + List<CamelElement> result = new ArrayList<>(); |
| 177 | + return result; |
| 178 | + } |
| 179 | + |
| 180 | + @objid ("8a7a2cc5-50c5-44cf-8446-9d4b3ea1617b") |
| 181 | + protected ExecutionModelDiagram(final ClassDiagram elt) { |
| 182 | + super(elt); |
| 183 | + } |
| 184 | + |
| 185 | + @objid ("ab4c82f7-565e-4087-a077-3c41552a0525") |
| 186 | + public static final class MdaTypes { |
| 187 | + @objid ("be5310a2-1499-4e67-9806-fdf8a761edea") |
| 188 | + public static Stereotype STEREOTYPE_ELT; |
| 189 | + |
| 190 | + @objid ("480b5b74-6ced-43b2-8dc1-c0d67f24fcb8") |
| 191 | + private static Stereotype MDAASSOCDEP; |
| 192 | + |
| 193 | + @objid ("cafd4fb7-1e60-471a-b8fd-fb55fbaf15b8") |
| 194 | + private static TagType MDAASSOCDEP_ROLE; |
| 195 | + |
| 196 | + @objid ("6d0d7da6-35c1-4808-bed1-76a8fb4609f2") |
| 197 | + public static void init(final IModuleContext ctx) { |
| 198 | + STEREOTYPE_ELT = ctx.getModelingSession().findElementById(Stereotype.class, "40a6ab6a-6df9-40b0-a877-d1de85918a7d"); |
| 199 | + MDAASSOCDEP = ctx.getModelingSession().findElementById(Stereotype.class, "94b7efa5-f94c-4d1d-896f-f103e56a8e2e"); |
| 200 | + MDAASSOCDEP_ROLE = ctx.getModelingSession().findElementById(TagType.class, "7637f2fd-b750-43c1-a15c-5d0b084ca1cd"); |
| 201 | + } |
| 202 | + |
| 203 | + |
| 204 | + static { |
| 205 | + if(CamelDesignerModule.getInstance() != null) { |
| 206 | + init(CamelDesignerModule.getInstance().getModuleContext()); |
| 207 | + } |
| 208 | + } |
| 209 | + } |
| 210 | + |
| 211 | +} |
0 commit comments