|
| 1 | +/* |
| 2 | + * WARNING: GENERATED FILE - DO NOT EDIT |
| 3 | + * Module: ToscaDesigner v0.0.00 |
| 4 | +
|
| 5 | + * This file was generated on 28/10/2024 10:11 by Modelio Studio. |
| 6 | + */ |
| 7 | +package fr.softeam.toscadesigner.api.tosca.standard.class_; |
| 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.api.module.MManualAssociationRole; |
| 14 | +import com.modeliosoft.modelio.api.module.MManualAttribute; |
| 15 | +import com.modeliosoft.modelio.api.module.MManualClass; |
| 16 | +import com.modeliosoft.modelio.api.module.MManualImport; |
| 17 | +import com.modeliosoft.modelio.api.module.MManualOperation; |
| 18 | +import com.modeliosoft.modelio.api.module.mda.IMdaProxy; |
| 19 | +import com.modeliosoft.modelio.api.module.mda.MdaProxyException; |
| 20 | +import com.modeliosoft.modelio.javadesigner.annotations.objid; |
| 21 | +import fr.softeam.toscadesigner.api.ToscaDesignerProxyFactory; |
| 22 | +import org.modelio.api.modelio.model.IModelingSession; |
| 23 | +import org.modelio.api.modelio.model.ModelingSessionRegistry; |
| 24 | +import org.modelio.api.modelio.model.PropertyConverter; |
| 25 | +import org.modelio.metamodel.mmextensions.infrastructure.ExtensionNotFoundException; |
| 26 | +import org.modelio.metamodel.uml.infrastructure.Dependency; |
| 27 | +import org.modelio.metamodel.uml.infrastructure.ModelElement; |
| 28 | +import org.modelio.metamodel.uml.infrastructure.Stereotype; |
| 29 | +import org.modelio.metamodel.uml.infrastructure.TagType; |
| 30 | +import org.modelio.metamodel.uml.infrastructure.properties.PropertyDefinition; |
| 31 | +import org.modelio.metamodel.uml.infrastructure.properties.PropertyTableDefinition; |
| 32 | +import org.modelio.metamodel.uml.statik.Class; |
| 33 | +import org.modelio.vcore.smkernel.mapi.MObject; |
| 34 | +import org.modelio.vcore.smkernel.mapi.MRef; |
| 35 | + |
| 36 | +/** |
| 37 | + * Proxy class to handle a {@link Class} with << TGroupType >> stereotype. |
| 38 | + * <p>Stereotype description: |
| 39 | + * <br/><i>null</i></p> |
| 40 | + */ |
| 41 | +@objid ("39f193a1-127c-495d-be75-44587d7d007d") |
| 42 | +public class TGroupType extends TEntityType implements IMdaProxy { |
| 43 | + @objid ("502b9a07-2323-4726-9fd7-f1b4756cd909") |
| 44 | + public static final String STEREOTYPE_NAME = "TGroupType"; |
| 45 | + |
| 46 | + /** |
| 47 | + * Tells whether a {@link TGroupType proxy} can be instantiated from a {@link MObject} checking it is a {@link Class} stereotyped << TGroupType >>. |
| 48 | + * <p> |
| 49 | + * The method returns <code>false</code> if the instantiation cannot be carried out. |
| 50 | + * @param elt a model object |
| 51 | + * @return <code>true</code> if the instantiation can be carried out else <code>false</code>. |
| 52 | + */ |
| 53 | + @objid ("2a7a7ecb-c42e-4fea-8b58-14ef820445d0") |
| 54 | + public static boolean canInstantiate(final MObject elt) { |
| 55 | + return ((elt instanceof Class) && (TGroupType.MdaTypes.STEREOTYPE_ELT!=null) && ((Class) elt).isStereotyped(TGroupType.MdaTypes.STEREOTYPE_ELT)); |
| 56 | + } |
| 57 | + |
| 58 | + /** |
| 59 | + * Create a new {@link Class} stereotyped << TGroupType >> then instantiate a {@link TGroupType} proxy. |
| 60 | + * |
| 61 | + * @return a {@link TGroupType} proxy on the created {@link Class}. |
| 62 | + */ |
| 63 | + @objid ("29931b57-512e-455c-ba94-f3d165bf26fa") |
| 64 | + public static TGroupType create(final IModelingSession session) { |
| 65 | + ModelElement e = (ModelElement)session.getModel().createElement("Standard.Class"); |
| 66 | + e.getExtension().add(TGroupType.MdaTypes.STEREOTYPE_ELT); |
| 67 | + return TGroupType.instantiate((Class)e); |
| 68 | + } |
| 69 | + |
| 70 | + /** |
| 71 | + * Tries to instantiate a {@link TGroupType} proxy from a {@link Class} stereotyped << TGroupType >> checking its metaclass and its stereotype. |
| 72 | + * <p> |
| 73 | + * The method returns <i>null</i> if the instantiation cannot be carried out. |
| 74 | + * @param obj a Class |
| 75 | + * @return a {@link TGroupType} proxy or <i>null</i>. |
| 76 | + */ |
| 77 | + @objid ("46e9ce50-619e-4581-b7f7-36499a2b805a") |
| 78 | + public static TGroupType instantiate(final Class obj) { |
| 79 | + return TGroupType.canInstantiate(obj) ? new TGroupType(obj) : null; |
| 80 | + } |
| 81 | + |
| 82 | + /** |
| 83 | + * Tries to instantiate a {@link TGroupType} proxy from a {@link Class} stereotyped << TGroupType >> checking its metaclass and its stereotype. |
| 84 | + * <p> |
| 85 | + * The method throws an {@link IllegalArgumentException} if the instantiation cannot be carried out. |
| 86 | + * @param obj a {@link Class} |
| 87 | + * @return a {@link TGroupType} proxy. |
| 88 | + * @throws IllegalArgumentException if the instantiation cannot be carried out. |
| 89 | + */ |
| 90 | + @objid ("e2408bd1-afef-426f-82ce-2dda7fb74c24") |
| 91 | + public static TGroupType safeInstantiate(final Class obj) throws IllegalArgumentException { |
| 92 | + if (TGroupType.canInstantiate(obj)) |
| 93 | + return new TGroupType(obj); |
| 94 | + else |
| 95 | + throw new IllegalArgumentException("TGroupType: Cannot instantiate "+obj+": wrong element type or stereotype"); |
| 96 | + } |
| 97 | + |
| 98 | + @objid ("b1e25794-df72-43fd-8d01-55e06a54b7da") |
| 99 | + @Override |
| 100 | + public boolean equals(final Object obj) { |
| 101 | + if (this == obj) { |
| 102 | + return true; |
| 103 | + } |
| 104 | + if (obj == null) { |
| 105 | + return false; |
| 106 | + } |
| 107 | + if (getClass() != obj.getClass()) { |
| 108 | + return false; |
| 109 | + } |
| 110 | + TGroupType other = (TGroupType) obj; |
| 111 | + return java.util.Objects.equals(getElement(), other.getElement()); |
| 112 | + } |
| 113 | + |
| 114 | + /** |
| 115 | + * Get the underlying {@link Class}. |
| 116 | + * @return the Class represented by this proxy, never null. |
| 117 | + */ |
| 118 | + @objid ("fe965268-6d0c-4988-8e66-b69aad473755") |
| 119 | + @Override |
| 120 | + public Class getElement() { |
| 121 | + return (Class)super.getElement(); |
| 122 | + } |
| 123 | + |
| 124 | + @objid ("280580c4-af56-410a-b75f-a82e7ab726ba") |
| 125 | + @Override |
| 126 | + public int hashCode() { |
| 127 | + return 23 + ((this.elt == null) ? 0 : this.elt.hashCode()); |
| 128 | + |
| 129 | + } |
| 130 | + |
| 131 | + @objid ("e8653d3b-2cf5-45f3-92d4-e86ee93a7a6a") |
| 132 | + protected TGroupType(final Class elt) { |
| 133 | + super(elt); |
| 134 | + } |
| 135 | + |
| 136 | + @objid ("95f59d83-2128-4004-9924-10b684ba49ab") |
| 137 | + public static final class MdaTypes { |
| 138 | + @objid ("ff367d42-b5dc-4aa3-83cc-c4427a96e29b") |
| 139 | + public static Stereotype STEREOTYPE_ELT; |
| 140 | + |
| 141 | + @objid ("f1027514-4b6a-410b-8f7e-56e5d0885e25") |
| 142 | + private static Stereotype MDAASSOCDEP; |
| 143 | + |
| 144 | + @objid ("2eaeb70f-ffda-4bb0-9cda-d46d4f3fdebc") |
| 145 | + private static TagType MDAASSOCDEP_ROLE; |
| 146 | + |
| 147 | + @objid ("30f88e85-409c-411d-84b8-93159984bb31") |
| 148 | + public static void init(final IModelingSession session) throws MdaProxyException { |
| 149 | + List <MRef> missingRefs = new ArrayList<>(); |
| 150 | + MRef mRef; |
| 151 | + mRef = new MRef(Stereotype.MQNAME, "94a5619a-6aed-4b34-a0d8-03e85419ad55", "TGroupType"); |
| 152 | + STEREOTYPE_ELT = (Stereotype) session.findByRef(mRef); |
| 153 | + if (STEREOTYPE_ELT==null) missingRefs.add(mRef); |
| 154 | + |
| 155 | + mRef = new MRef(Stereotype.MQNAME, "94b7efa5-f94c-4d1d-896f-f103e56a8e2e", "MDAAssocDep"); |
| 156 | + MDAASSOCDEP = (Stereotype) session.findByRef(mRef); |
| 157 | + if (MDAASSOCDEP==null) missingRefs.add(mRef); |
| 158 | + |
| 159 | + mRef = new MRef(TagType.MQNAME, "7637f2fd-b750-43c1-a15c-5d0b084ca1cd", "MDAAssocDepRole"); |
| 160 | + MDAASSOCDEP_ROLE = (TagType) session.findByRef(mRef); |
| 161 | + if (MDAASSOCDEP_ROLE==null) missingRefs.add(mRef); |
| 162 | + |
| 163 | + if (! missingRefs.isEmpty()) throw new MdaProxyException(MdaProxyException.MdaProxyExceptionReason.MISSING_MDA_ELEMENT, missingRefs); |
| 164 | + |
| 165 | + } |
| 166 | + |
| 167 | + } |
| 168 | + |
| 169 | +} |
0 commit comments