@OpenApiAll public class ModelHelper extends InstanceSpecificationHelper
ClassifierHelper.ElementsGetter<T>, ClassifierHelper.PropertyValueGetter, ClassifierHelper.PureAttributesGetter, ClassifierHelper.ShortElementNameResolver
Constructor and Description |
---|
ModelHelper() |
Modifier and Type | Method and Description |
---|---|
static boolean |
canAssignType(TypedElement typedElement,
Type type)
Check if given Type can be assigned to a given TypedElement.
|
static boolean |
canChangeNavigability(Property property)
Checks if navigability of the association end property can be inverted - navigable to
non-navigable and vice versa.
|
static boolean |
canChangeOwnerTo(Property property,
boolean toAssociation)
Checks if association end can be owned by association or connected element.
|
static void |
changeOwnerTo(Property property,
boolean toAssociation)
Changes ownership of the association end.
|
static java.util.List<Connector> |
collectConnectors(ConnectableElement connectableElement)
Deprecated.
use com.nomagic.magicdraw.uml.ConnectorsCollector#collectDirectConnectors(com.nomagic.uml2.ext.magicdraw.compositestructures.mdinternalstructures.ConnectableElement)
|
static java.util.List<Classifier> |
collectWithName(java.util.Collection<? extends Element> elements,
java.util.Collection<java.lang.Class> classifierClassTypes,
java.lang.String name,
boolean useQualifiedName)
Deprecated.
use
ModelHelperInternal.collectWithName(Collection, Collection, String, boolean, Collection) |
static java.lang.String |
constructEditCommandName(java.lang.String propertyName)
Deprecated.
use ModelHelperInternal#constructEditCommandName(String)
|
static Image |
createImage(ElementsFactory factory,
java.io.File file)
Creates image model element from a given image found in a file.
|
static Image |
createImage(ElementsFactory factory,
java.lang.String url)
Creates image model element from a given image found at url.
|
static Image |
createImage(java.io.File file)
Deprecated.
use #createImage(com.nomagic.uml2.impl.ElementsFactory, java.io.File)
|
static InterfaceRealization |
createProvidedInterfaceRelationship(BehavioredClassifier behavioredClassifier,
Interface anInterface)
Deprecated.
use ModelHelperInternal#createProvidedInterfaceRelationship(BehavioredClassifier, Interface)
|
static Behavior |
findBehaviorFor(Element element)
Finds a defining behavior for a given element.
|
static Deployment |
findDeployment(DeploymentTarget deploymentTarget,
DeployedArtifact artifact)
Find existing deployment among target and artifact
|
static Diagram |
findDiagram(Element element)
Deprecated.
use ModelHelperInternal#findDiagram(Element)
|
static Element |
findElementWithPath(Project project,
java.lang.String path,
java.lang.Class classType)
Deprecated.
use com.nomagic.magicdraw.uml.Finder#byQualifiedName
|
static java.util.List<Element> |
findElementWithPath(Project project,
java.lang.String path,
java.lang.Class classType,
boolean searchJustOne)
Deprecated.
com.nomagic.magicdraw.uml.Finder#byQualifiedName()
|
static <T extends Element> |
findElementWithPath(java.lang.String path)
Deprecated.
use com.nomagic.magicdraw.uml.Finder#byQualifiedName()
|
static void |
findInParent(Element parent,
java.lang.String name,
boolean searchRecursively,
java.util.Collection<Element> result)
Deprecated.
use com.nomagic.magicdraw.uml.Finder#byNameAll() or com.nomagic.magicdraw.uml.Finder#byNameAllRecursively()
|
static Element |
findInParent(Element parent,
java.lang.String name,
java.lang.Class classType)
Deprecated.
use com.nomagic.magicdraw.uml.Finder#byName()
|
static Element |
findInParent(Element parent,
java.lang.String name,
java.lang.Class classType,
boolean searchRecursively)
Deprecated.
use com.nomagic.magicdraw.uml.Finder#byName() or com.nomagic.magicdraw.uml.Finder#byNameRecursively()
|
static void |
findInParent(Element parent,
java.lang.String name,
java.lang.Class classType,
boolean searchRecursively,
java.util.Collection<Element> result)
Deprecated.
use com.nomagic.magicdraw.uml.Finder#byName() com.nomagic.magicdraw.uml.Finder#byNameRecursively()
|
static void |
findInParent(Element parent,
java.lang.String name,
java.lang.Class classType,
java.util.Collection<Element> result)
Deprecated.
use com.nomagic.magicdraw.uml.Finder#byNameAll()
|
static NamedElement |
findOwner(Property property,
boolean association)
Finds preferred owner element for the association end.
|
static java.util.List<ActivityParameterNode> |
getActivityParameterNodes(Activity activity)
Gets activity parameter nodes from a given activity.
|
static java.util.List<State> |
getAvailableClassifierStates(Classifier classifier)
Deprecated.
use
StateMachineHelperInternal.getBehavioredClassifierStates(BehavioredClassifier) |
static java.util.Collection<StateMachine> |
getClassifierStateMachines(Classifier classifier,
boolean createIfNotFound)
Deprecated.
use
StateMachineHelperInternal.getBehavioredClassifierStateMachines(BehavioredClassifier, boolean) |
static BehavioredClassifier |
getContext(Behavior behavior)
The classifier that is the context for the execution of the behavior.
|
static java.util.Collection<? extends Element> |
getElementsOfType(Element root,
java.lang.Class[] types,
boolean checkRoot)
Deprecated.
com.nomagic.magicdraw.uml.Finder#byTypeRecursively()
|
static java.util.Collection<? extends Element> |
getElementsOfType(Element root,
java.lang.Class[] types,
boolean checkRoot,
boolean recursively)
Deprecated.
use com.nomagic.magicdraw.uml.Finder#byType() or com.nomagic.magicdraw.uml.Finder#byTypeRecursively()
|
static java.util.Collection<? extends Element> |
getElementsOfType(Element root,
java.lang.Class[] types,
boolean checkRoot,
boolean recursively,
boolean includeAdditionalContents,
org.eclipse.core.runtime.IProgressMonitor monitor)
Deprecated.
use com.nomagic.magicdraw.uml.Finder#byType() or com.nomagic.magicdraw.uml.Finder#byTypeRecursively()
|
static <T> java.util.Collection<T> |
getElementsOfTypeS(Element root,
java.lang.Class<T>[] types,
boolean checkRoot)
Deprecated.
com.nomagic.magicdraw.uml.Finder#byTypeRecursively()
|
static ConnectorEnd |
getFirstEnd(Connector connector)
Return a first connector end
|
static ConnectorEnd |
getFirstMemberEnd(Connector connector)
Deprecated.
use #getFirstEnd(Connector) (Connector)
|
static Property |
getOpposite(Property end)
Deprecated.
use Property#getOpposite()
|
static ConnectorEnd |
getOppositeEnd(ConnectorEnd end)
Gets opposite connector end for a given connector end.
|
static java.util.Collection<Element> |
getReferencingElementsByTags(Element element,
java.lang.String propertyName)
Deprecated.
use StereotypesHelper#getReferencingElementsByTags(Element, String)
|
static ConnectorEnd |
getSecondEnd(Connector connector)
Return a second connector end
|
static ConnectorEnd |
getSecondMemberEnd(Connector connector)
Deprecated.
use #getSecondEnd(Connector)
|
static boolean |
isAggregation(Association association,
AggregationKind aggregationKind)
Determines if association is of specified aggregation kind.
|
static boolean |
isDirectedAssociation(Association association)
Check if association is directed
|
static boolean |
isNonNavigableAssociation(Association association)
Check if association is non navigable
|
static boolean |
isPropertyEqual(Property p1,
Property p2)
Compare the two given Property.
|
static void |
setNavigable(Property property,
boolean navigable)
Sets navigability of the specified association end.
|
static void |
setNavigable(Property property,
boolean navigable,
boolean automaticOwnership)
Sets navigability of the specified association end.
|
collectAllInstances, createSlot, createSlotsForDefaultValues, createSlotsForDefaultValues, findSlot, getAssignableAssociationsForLink, getAssociationOfLink, getLinksBetweenInstances, getNestedSlot, getSlot, getSlot, getValueBySlot, isInstanceSpecificationCompatibleWithType, isInstanceSpecificationCompatibleWithType, isLink, setClassifierForInstanceSpecification, setClassifierForInstanceSpecification, setSlotValue
areEqualParameterTypes, areEqualParameterTypes, associations, associationsIncludingInherited, attributes, checkForDerivedClassifier, collectBaseClassAttributes, collectBaseClassAttributes, collectBaseClassInheritableAttributes, collectBaseClassOperations, collectBaseClassPorts, collectCommonAssociations, collectDerivedClassifiersRecursivelly, collectDerivedClassifiersRecursively, collectGeneralClassifiersAndRealizedInterfacesRecursively, collectGeneralClassifiersRecursivelly, collectGeneralClassifiersRecursively, collectInheritedAttributes, collectInheritedBehaviors, collectInheritedElements, collectInheritedEnumerationLiterals, collectInheritedExtensionPoints, collectInheritedOperations, collectInheritedPorts, collectInheritedPureAttributes, collectInheritedPureAttributes, collectInheritedRealizedInterfaces, collectInheritedReceptions, collectInheritedRelations, collectRealizedInterfaces, findAssociationEndForType, findDataTypeFor, findGeneralization, findInterfaceRealization, getAllLiterals, getAssociationEndOwnedByAssociation, getAssociationEnds, getClassifierFor, getClassifierFor, getClassifierFor, getDerivedClassifiers, getDerivedClassifiers, getDerivedClassifiersRecursivelly, getDerivedClassifiersRecursively, getDerivedClassifiersRecursively, getGeneralClassifiers, getGeneralClassifiersRecursivelly, getGeneralClassifiersRecursivelly, getGeneralClassifiersRecursively, getGeneralClassifiersRecursively, getImplementedClasses, getInheritanceDeep, getOptimizedClassifierHierarchy, getParameters, getPropertiesWithoutRedefined, getProvided, getRealizedInterfaces, getReturnParameter, getReturnParameter, getReturnParameter, getReturnParameters, isBehavioralFeatureEqual, isClassifierOfType, isClassifierOfType, isDerivedClassifier, isDerivedOrRealizes, isLegalInheritance, isLegalInheritance, isLegalInterfaceRealization, isOperationEqual, isReturnParameter, isSameOrRedefined, isSecondTypeCompatibleToFirst, isSecondTypeCompatibleToFirst, operations, ports, pureAttributes, receptions, removeDerivedClassifiers, removeRedefined
cloneValueSpecification, createValueSpecification, createValueSpecification, createValueSpecification, createValueSpecification, createValueSpecification, getValueSpecificationClass, getValueSpecificationClass, getValueSpecificationValue, getValueString, isValueSpecificationClassElementValue, setValueDisposeIfNeeded, setValueSpecificationValue, setValueSpecificationValue, setValueSpecificationValue
areElementsEditable, canAddChild, canAssignName, canAssignName, canAssignName, canMoveChildInto, canMoveChildInto, configureBeforeParsing, dispose, findAcceptableParentFor, findAcceptableParentFor, findOwnerOfStrictType, findOwnerOfStrictTypeIncludingItself, findOwnerOfType, findOwnerOfTypeIncludingItself, findParent, findParent, findParentOfType, getAdditionalElementsIterator, getClientElement, getComment, getCommentElement, getCommentElementOrCreate, getDependentClients, getDependentSuppliers, getFirstMemberEnd, getMultiplicity, getName, getOppositeEnd, getOwnedElementsIncludingAdditional, getSecondMemberEnd, getSupplierElement, getSupplierElement, getSupplierElements, hasParentIn, isChildOf, isDocumentationComment, isMultiplicityMany, isParentOf, isParentOf, isRelationship, isRelationshipAlwaysInClient, parseMultiplicityString, setClientElement, setComment, setCommentElement, setConstraintText, setConstraintText, setMultiplicity, setMultiplicity, setSupplierElement
@Deprecated public static java.util.List<Classifier> collectWithName(java.util.Collection<? extends Element> elements, java.util.Collection<java.lang.Class> classifierClassTypes, java.lang.String name, boolean useQualifiedName)
ModelHelperInternal.collectWithName(Collection, Collection, String, boolean, Collection)
elements
- the collection of given elementsclassifierClassTypes
- the collection of metaclassesname
- a name of element to filter (simple or qualified)useQualifiedName
- (check qualified name or simple name)@Deprecated public static <T extends Element> T findElementWithPath(java.lang.String path)
@Deprecated public static Element findElementWithPath(Project project, java.lang.String path, @CheckForNull java.lang.Class classType)
@Deprecated @Nonnull public static java.util.List<Element> findElementWithPath(Project project, java.lang.String path, @CheckForNull java.lang.Class classType, boolean searchJustOne)
@Deprecated public static java.util.Collection<? extends Element> getElementsOfType(Element root, @CheckForNull java.lang.Class[] types, boolean checkRoot)
@Deprecated public static <T> java.util.Collection<T> getElementsOfTypeS(Element root, @CheckForNull java.lang.Class<T>[] types, boolean checkRoot)
@Deprecated public static java.util.Collection<? extends Element> getElementsOfType(Element root, @CheckForNull java.lang.Class[] types, boolean checkRoot, boolean recursively)
@Deprecated public static java.util.Collection<? extends Element> getElementsOfType(Element root, @CheckForNull java.lang.Class[] types, boolean checkRoot, boolean recursively, boolean includeAdditionalContents, @CheckForNull org.eclipse.core.runtime.IProgressMonitor monitor)
public static java.util.List<ActivityParameterNode> getActivityParameterNodes(Activity activity)
activity
- activity from which parameter nodes must be returned.@Deprecated public static Image createImage(java.io.File file)
public static Image createImage(ElementsFactory factory, java.io.File file)
file
- file in which to look for an image.public static Image createImage(ElementsFactory factory, java.lang.String url)
url
- url@Deprecated public static java.util.Collection<Element> getReferencingElementsByTags(Element element, java.lang.String propertyName)
@Deprecated @CheckForNull public static Element findInParent(Element parent, java.lang.String name, java.lang.Class classType)
@Deprecated @CheckForNull public static Element findInParent(Element parent, java.lang.String name, java.lang.Class classType, boolean searchRecursively)
@Deprecated public static void findInParent(Element parent, java.lang.String name, java.lang.Class classType, java.util.Collection<Element> result)
@Deprecated public static void findInParent(Element parent, java.lang.String name, boolean searchRecursively, java.util.Collection<Element> result)
@Deprecated public static void findInParent(Element parent, java.lang.String name, @CheckForNull java.lang.Class classType, boolean searchRecursively, java.util.Collection<Element> result)
public static boolean isPropertyEqual(Property p1, Property p2)
p1
- First propertyp2
- Second propertypublic static boolean canChangeNavigability(Property property)
property
- association end, can not be nullpublic static void setNavigable(Property property, boolean navigable)
Example: Association assoc = ...; Property secondMemberEnd = ModelHelper.getSecondMemberEnd(assoc); ModelHelper.setNavigable(secondMemberEnd, secondMemberEnd.isNavigable());
property
- association end. Can not be nullnavigable
- flagpublic static void setNavigable(Property property, boolean navigable, boolean automaticOwnership)
property
- association end. Can not be nullnavigable
- flagautomaticOwnership
- indicates if it should change association end ownership to connected element when its possiblepublic static boolean canChangeOwnerTo(Property property, boolean toAssociation)
property
- association end. Can not be nulltoAssociation
- indicates what kind of ownership shall be checked - true for association and false for connected elementpublic static void changeOwnerTo(Property property, boolean toAssociation)
property
- association end. Can not be nulltoAssociation
- preferred owner: true for association and false for connected elementpublic static NamedElement findOwner(Property property, boolean association)
property
- association end. Can not be nullassociation
- preferred owner: true for association and false for connected element@CheckForNull public static Behavior findBehaviorFor(Element element)
element
- elementpublic static boolean isAggregation(Association association, AggregationKind aggregationKind)
association
- association model element.aggregationKind
- AggregationKindEnum.SHARED - aggregation, AggregationKindEnum.COMPOSITE - composition.public static boolean isDirectedAssociation(Association association)
association
- associationpublic static boolean isNonNavigableAssociation(Association association)
association
- association@CheckForNull public static Deployment findDeployment(DeploymentTarget deploymentTarget, DeployedArtifact artifact)
deploymentTarget
- targetartifact
- artifact@CheckForNull public static BehavioredClassifier getContext(Behavior behavior)
behavior
- behavior for which to get the context.public static boolean canAssignType(TypedElement typedElement, @CheckForNull Type type)
typedElement
- typed elementtype
- type@Nonnull @Deprecated public static InterfaceRealization createProvidedInterfaceRelationship(@Nonnull BehavioredClassifier behavioredClassifier, @Nonnull Interface anInterface)
@Deprecated @Nonnull public static java.util.List<Connector> collectConnectors(ConnectableElement connectableElement)
@Deprecated public static java.lang.String constructEditCommandName(java.lang.String propertyName)
@Deprecated @CheckForNull public static Diagram findDiagram(Element element)
@Deprecated public static Property getOpposite(Property end)
public static ConnectorEnd getFirstEnd(Connector connector)
connector
- connectorpublic static ConnectorEnd getSecondEnd(Connector connector)
connector
- connector@Deprecated public static ConnectorEnd getFirstMemberEnd(Connector connector)
@Deprecated public static ConnectorEnd getSecondMemberEnd(Connector connector)
public static ConnectorEnd getOppositeEnd(ConnectorEnd end)
end
- connector end for which to get opposite end@Deprecated public static java.util.List<State> getAvailableClassifierStates(Classifier classifier)
StateMachineHelperInternal.getBehavioredClassifierStates(BehavioredClassifier)
@Deprecated public static java.util.Collection<StateMachine> getClassifierStateMachines(Classifier classifier, boolean createIfNotFound)
StateMachineHelperInternal.getBehavioredClassifierStateMachines(BehavioredClassifier, boolean)