org.argouml.model
Interface ModelManagementHelper


public interface ModelManagementHelper

The interface for the helper for ModelManagement.

Created from the old ModelManagementHelper.


Field Summary
static java.lang.String ACCESS_STEREOTYPE
          Name of stereotype applied to Permission which is an package access.
static java.lang.String FRIEND_STEREOTYPE
          Name of stereotype applied to Permission which is a friend.
static java.lang.String IMPORT_STEREOTYPE
          Name of stereotype applied to a Permission which is for import.
 
Method Summary
 java.util.Collection getAllBehavioralFeatures(java.lang.Object ns)
           
 java.util.Collection getAllContents(java.lang.Object namespace)
          This method calculates the following from the standard:
 java.util.Collection getAllImportedElements(java.lang.Object pack)
          This method calculates the collection of imported elements of a Package following from the standard:
 java.util.Collection getAllModelElementsOfKind(java.lang.Object namespace, java.lang.Object type)
          Returns all modelelements found in this namespace and its containing namespaces that are of some class kind.
 java.util.Collection getAllModelElementsOfKind(java.lang.Object namespace, java.lang.String kind)
          helper method for getAllModelElementsOfKind(Object, Object).
 java.util.Collection getAllModelElementsOfKindWithModel(java.lang.Object model, java.lang.Object type)
          Returns all modelelements of the given kind.
 java.util.Collection getAllNamespaces(java.lang.Object ns)
          Returns all namespaces found in this namespace and in its containing namespaces.
 java.util.Collection getAllPossibleImports(java.lang.Object pack)
          Returns a collection of ModelElements that may possibly be imported in the given package.
 java.util.Collection getAllSubSystems(java.lang.Object ns)
          Returns all subsystems found in this namespace and in its containing namespaces.
 java.util.Collection getAllSurroundingNamespaces(java.lang.Object ns)
          Returns all surrounding namespaces of some namespace ns.
 java.util.Collection getContents(java.lang.Object namespace)
          This method calculates the "contents" additional operation from the standard:
 java.lang.Object getElement(java.util.List<java.lang.String> path)
          Get the modelelement with the given path, starting at the root of repository.
 java.lang.Object getElement(java.util.List<java.lang.String> path, java.lang.Object theRootNamespace)
          Get the modelelement a given path below a given root-namespace.
 java.util.List<java.lang.String> getPathList(java.lang.Object element)
          Find the absolute path of a ModelElement.
 boolean isCyclicOwnership(java.lang.Object parent, java.lang.Object child)
          Checks if a child for some ownership relationship (as in a namespace A is owned by a namespace B) is already in the ownerhship relation.
 boolean isReadOnly(java.lang.Object element)
          Return the true if the model element is read only (ie not modifiable).
 void removeImportedElement(java.lang.Object handle, java.lang.Object me)
          This method removes the import of a modelelement from a package.
 void setAlias(java.lang.Object handle, java.lang.String alias)
          Set the alias of the ElementImport.
 void setImportedElements(java.lang.Object pack, java.util.Collection imports)
          Set the complete collection of imported elements for a package.
 void setSpecification(java.lang.Object handle, boolean isSpecification)
          Set the isSpecification attribute for the ElementImport.
 

Field Detail

FRIEND_STEREOTYPE

static final java.lang.String FRIEND_STEREOTYPE
Name of stereotype applied to Permission which is a friend.

See Also:
Constant Field Values

IMPORT_STEREOTYPE

static final java.lang.String IMPORT_STEREOTYPE
Name of stereotype applied to a Permission which is for import.

See Also:
Constant Field Values

ACCESS_STEREOTYPE

static final java.lang.String ACCESS_STEREOTYPE
Name of stereotype applied to Permission which is an package access.

See Also:
Constant Field Values
Method Detail

getAllSubSystems

java.util.Collection getAllSubSystems(java.lang.Object ns)
Returns all subsystems found in this namespace and in its containing namespaces.

Parameters:
ns - is the namespace
Returns:
Collection

getAllNamespaces

java.util.Collection getAllNamespaces(java.lang.Object ns)
Returns all namespaces found in this namespace and in its containing namespaces.

Parameters:
ns - namespace to process
Returns:
Collection of all namespaces found

getAllModelElementsOfKindWithModel

java.util.Collection getAllModelElementsOfKindWithModel(java.lang.Object model,
                                                        java.lang.Object type)
Returns all modelelements of the given kind.

Parameters:
model - the model that is searched
type - is the class kind that is sought
Returns:
Collection

getAllModelElementsOfKind

java.util.Collection getAllModelElementsOfKind(java.lang.Object namespace,
                                               java.lang.Object type)
Returns all modelelements found in this namespace and its containing namespaces that are of some class kind.

Parameters:
namespace - is the namespace
type - is the class kind
Returns:
Collection

getAllModelElementsOfKind

java.util.Collection getAllModelElementsOfKind(java.lang.Object namespace,
                                               java.lang.String kind)
helper method for getAllModelElementsOfKind(Object, Object).

Parameters:
namespace - namespace.
kind - name of class to find (without implementation-specific additions)
Returns:
a Collection.

getAllSurroundingNamespaces

java.util.Collection getAllSurroundingNamespaces(java.lang.Object ns)
Returns all surrounding namespaces of some namespace ns. See section 2.5.3.26 of the UML 1.4 spec for a definition.

Parameters:
ns - to process
Returns:
Collection of surrounding namespaces.

getAllBehavioralFeatures

java.util.Collection getAllBehavioralFeatures(java.lang.Object ns)
Parameters:
ns - the given namespace
Returns:
a collection of all behavioralfeatures in the given namespace

getAllPossibleImports

java.util.Collection getAllPossibleImports(java.lang.Object pack)
Returns a collection of ModelElements that may possibly be imported in the given package.

Parameters:
pack - the given package
Returns:
a collection with modelelements that may possibly be imported in the given package

getElement

java.lang.Object getElement(java.util.List<java.lang.String> path)
Get the modelelement with the given path, starting at the root of repository.

Parameters:
path - the given path
Returns:
the modelelement looked for, or null if not found

getElement

java.lang.Object getElement(java.util.List<java.lang.String> path,
                            java.lang.Object theRootNamespace)
Get the modelelement a given path below a given root-namespace.

Parameters:
path - the given path
theRootNamespace - the given namespace to start from. If null, start from the root (equivalent to getElement(List).
Returns:
the modelelement looked for, or null if not found

getPathList

java.util.List<java.lang.String> getPathList(java.lang.Object element)
Find the absolute path of a ModelElement. Ie the name of each namespace starting a root or top level model element and ending with the name of the element.

The returned List implicitly starts with a root element and follows element's chain of owning namespaces back down to element. The first element will thus be the name of the top level namespace, and the last element will be the name of element itself.

COMPATIBILITY WARNING - The previous version of this method #getPath(Object) would only return the path to the first enclosing Model, not the root, and it would not include the name of the model itself. This version will keep going up until it finds an element with no parent and it includes the name of that top level element which means that it will normally be one element longer than the previous method.

Parameters:
element - is the object to resolve the path for.
Returns:
A List of namespaces as described above.
Throws:
java.lang.IllegalArgumentException - if element isn't a ModelElement properly owned by namespaces and a model.

isCyclicOwnership

boolean isCyclicOwnership(java.lang.Object parent,
                          java.lang.Object child)
Checks if a child for some ownership relationship (as in a namespace A is owned by a namespace B) is already in the ownerhship relation.

Parameters:
parent - The current leaf for the ownership relation
child - The child that should be owned by the parent
Returns:
true if the child is already in the ownership relationship

removeImportedElement

void removeImportedElement(java.lang.Object handle,
                           java.lang.Object me)
This method removes the import of a modelelement from a package.

Parameters:
handle - is the package
me - is the modelelement that was imported

setImportedElements

void setImportedElements(java.lang.Object pack,
                         java.util.Collection imports)
Set the complete collection of imported elements for a package.

Parameters:
pack - the package to import in
imports - the collection of modelelements to import

setAlias

void setAlias(java.lang.Object handle,
              java.lang.String alias)
Set the alias of the ElementImport.

Parameters:
handle - is the ElementImport
alias - the alias name

setSpecification

void setSpecification(java.lang.Object handle,
                      boolean isSpecification)
Set the isSpecification attribute for the ElementImport.

Parameters:
handle - ElementImport
isSpecification - true of the element is specification

getContents

java.util.Collection getContents(java.lang.Object namespace)
This method calculates the "contents" additional operation from the standard:

For a Namespace:

 [1] The operation contents results in a Set containing 
 all ModelElements contained by the Namespace.
 contents : Set(ModelElement)
 contents = self.ownedElement -> union(self.namespace, contents)
 

For a Package:

 [1] The operation contents results in a Set containing 
 the ModelElements owned by or imported by the Package.
 contents : Set(ModelElement)
 contents = self.ownedElement->union(self.importedElement)
 
For a Instance:
 [5] The operation contents results in a Set containing all 
 ModelElements contained by the Instance.
   contents: Set(ModelElement);
   contents = self.ownedInstance->union(self.ownedLink)
 
For a Subsystem:
 [2] The operation contents results in a Set containing 
 the ModelElements owned by or imported by the Subsystem.
   contents : Set(ModelElement)
   contents = self.ownedElement->union(self.importedElement)
 

Parameters:
namespace - the ns to get the contents from
Returns:
a collection of modelelements

getAllImportedElements

java.util.Collection getAllImportedElements(java.lang.Object pack)
This method calculates the collection of imported elements of a Package following from the standard:

 [2] The operation allImportedElements results 
 in a Set containing the ModelElements imported 
 by the Package or one of its parents.
 allImportedElements : Set(ModelElement)
 allImportedElements = self.importedElement->union(
 self.parent.oclAsType(Package).allImportedElements->select( re |
   re.elementImport.visibility = #public or
   re.elementImport.visibility = #protected))

Parameters:
pack - the package to get the imported elements from
Returns:
a collection of modelelements

getAllContents

java.util.Collection getAllContents(java.lang.Object namespace)
This method calculates the following from the standard:

For a Namespace:

 [2] The operation allContents results in a Set containing 
 all ModelElements contained by the Namespace.
 allContents : Set(ModelElement);
 allContents = self.contents
 

For a Classifier:

 [10] The operation allContents returns a Set containing 
 all ModelElements contained in the Classifier together
 with the contents inherited from its parents.
 allContents : Set(ModelElement);
 allContents = self.contents->union(
   self.parent.allContents->select(e |
        e.elementOwnership.visibility = #public or
        e.elementOwnership.visibility = #protected))
 

For a Package:

 [3]  The operation allContents results in a Set containing 
 the ModelElements owned by or imported 
 by the Package or one of its ancestors.
 allContents : Set(ModelElement);
 allContents = self.contents->union(
   self.parent.allContents->select(e |
        e.elementOwnership.visibility = #public or
        e.elementOwnership.visibility = #protected))
 
For a Collaboration:
 [1 ] The operation allContents results in the set of 
 all ModelElements contained in the Collaboration
 together with those contained in the parents 
 except those that have been specialized.
 allContents : Set(ModelElement);
 allContents = self.contents->union (
   self.parent.allContents->reject ( e |
        self.contents.name->include (e.name) ))
 

Parameters:
namespace - the namespace to get the contents from
Returns:
a collection of modelelements

isReadOnly

boolean isReadOnly(java.lang.Object element)
Return the true if the model element is read only (ie not modifiable). Note that this differs from {@link Facade#isReadOnly(Object)) which refers to instances of a given model (M0 level) as opposed to the model itself (M1).

Parameters:
element - a UML Element
Returns:
true if the element is readonly
Since:
0.26


ArgoUML © 1996-2006ArgoUML HomepageArgoUML Cookbook