org.argouml.model.uml.modelmanagement
Class ModelManagementHelper

java.lang.Object
  |
  +--org.argouml.model.uml.modelmanagement.ModelManagementHelper

public class ModelManagementHelper
extends java.lang.Object

Helper class for UML ModelManagement Package. Current implementation is a placeholder.

Since:
ARGO0.11.2

Field Summary
protected static org.apache.log4j.Category cat
           
 
Method Summary
 boolean corresponds(ru.novosoft.uml.foundation.core.MModelElement obj1, ru.novosoft.uml.foundation.core.MModelElement obj2)
          Tests if two objects are of the same type, have the same name and the same relative position in the model.
 java.util.Collection getAllModelElementsOfKind(java.lang.Class kind)
          Returns all modelelements found in this namespace and its children that are of some class kind n the projectbrowser model
 java.util.Collection getAllModelElementsOfKind(java.lang.Object nsa, java.lang.Class kind)
          Returns all modelelements found in this namespace and its children that are of some class kind.
 java.util.Collection getAllNamespaces()
          Returns all namespaces found in the projectbrowser model
 java.util.Collection getAllNamespaces(ru.novosoft.uml.foundation.core.MNamespace ns)
          Returns all namespaces found in this namespace and in its children
 java.util.Collection getAllSubSystems()
          Returns all subsystems found in the projectbrowser model
 java.util.Collection getAllSubSystems(ru.novosoft.uml.foundation.core.MNamespace ns)
          Returns all subsystems found in this namespace and in its children
 java.util.Collection getAllSurroundingNamespaces(ru.novosoft.uml.foundation.core.MNamespace ns)
          Returns all surrounding namespaces of some namespace ns.
 ru.novosoft.uml.foundation.core.MModelElement getCorrespondingElement(ru.novosoft.uml.foundation.core.MModelElement elem, ru.novosoft.uml.model_management.MModel model)
          Utility function for managing several overlayed models, eg a user model to which elements from some profile models is imported when needed.
 ru.novosoft.uml.foundation.core.MModelElement getCorrespondingElement(ru.novosoft.uml.foundation.core.MModelElement elem, ru.novosoft.uml.model_management.MModel model, boolean canCreate)
          Utility function for managing several overlayed models, eg a user model to which elements from some profile models is imported when needed.
 ru.novosoft.uml.foundation.core.MModelElement getElement(java.util.Vector path, ru.novosoft.uml.foundation.core.MModelElement root)
           
static ModelManagementHelper getHelper()
          Singleton instance access method.
 void moveElement(ru.novosoft.uml.foundation.core.MModelElement element, ru.novosoft.uml.model_management.MModel to)
          Deprecated. You should use getCorrespondingElement instead.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cat

protected static org.apache.log4j.Category cat
Method Detail

getHelper

public static ModelManagementHelper getHelper()
Singleton instance access method.

getAllSubSystems

public java.util.Collection getAllSubSystems()
Returns all subsystems found in the projectbrowser model
Returns:
Collection

getAllSubSystems

public java.util.Collection getAllSubSystems(ru.novosoft.uml.foundation.core.MNamespace ns)
Returns all subsystems found in this namespace and in its children
Returns:
Collection

getAllNamespaces

public java.util.Collection getAllNamespaces()
Returns all namespaces found in the projectbrowser model
Returns:
Collection

getAllNamespaces

public java.util.Collection getAllNamespaces(ru.novosoft.uml.foundation.core.MNamespace ns)
Returns all namespaces found in this namespace and in its children
Returns:
Collection

getAllModelElementsOfKind

public java.util.Collection getAllModelElementsOfKind(java.lang.Class kind)
Returns all modelelements found in this namespace and its children that are of some class kind n the projectbrowser model
Returns:
Collection

getAllModelElementsOfKind

public java.util.Collection getAllModelElementsOfKind(java.lang.Object nsa,
                                                      java.lang.Class kind)
Returns all modelelements found in this namespace and its children that are of some class kind.
Parameters:
ns -  
kind -  
Returns:
Collection

getAllSurroundingNamespaces

public java.util.Collection getAllSurroundingNamespaces(ru.novosoft.uml.foundation.core.MNamespace ns)
Returns all surrounding namespaces of some namespace ns. See section 2.5.3.24 of the UML 1.3 spec for a definition.
Parameters:
ns -  
Returns:
Collection

getElement

public ru.novosoft.uml.foundation.core.MModelElement getElement(java.util.Vector path,
                                                                ru.novosoft.uml.foundation.core.MModelElement root)

moveElement

public void moveElement(ru.novosoft.uml.foundation.core.MModelElement element,
                        ru.novosoft.uml.model_management.MModel to)
Deprecated. You should use getCorrespondingElement instead.

Move a modelelement to a new namespace. The way this is currently implemented this means that ALL modelelements that share the same namespace as the element to be moved are moved. TODO: make this into a copy function TODO: make this only move/copy the asked element
Parameters:
element -  
to -  

getCorrespondingElement

public ru.novosoft.uml.foundation.core.MModelElement getCorrespondingElement(ru.novosoft.uml.foundation.core.MModelElement elem,
                                                                             ru.novosoft.uml.model_management.MModel model)
Utility function for managing several overlayed models, eg a user model to which elements from some profile models is imported when needed. This version of the function assumes it is permissible to create missing elements. This function may fail and return null eg if some required object doesn't exist in the target model and cannot be copied.
Parameters:
elem - is some element.
model - is the model the returned object shall belong to.
Returns:
An element of the same type and at the same position in the model as elem, or if that would turn out impossible then null.

getCorrespondingElement

public ru.novosoft.uml.foundation.core.MModelElement getCorrespondingElement(ru.novosoft.uml.foundation.core.MModelElement elem,
                                                                             ru.novosoft.uml.model_management.MModel model,
                                                                             boolean canCreate)
Utility function for managing several overlayed models, eg a user model to which elements from some profile models is imported when needed. This version of the function will only copy objects if canCreate is true, but may then also copy other missing elements. This function may fail and return null eg if the required object doesn't exist in the target model and canCreate is false or some required object doesn't exist in the target model and cannot be copied.
Parameters:
elem - is some element.
model - is the model the returned object shall belong to.
canCreate - determines if objects can be copied into model.
Returns:
An element of the same type and at the same position in the model as elem, or if that would turn out impossible then null.

corresponds

public boolean corresponds(ru.novosoft.uml.foundation.core.MModelElement obj1,
                           ru.novosoft.uml.foundation.core.MModelElement obj2)
Tests if two objects are of the same type, have the same name and the same relative position in the model. Same relative position implies either: * their owners correspond to eachother. * they are both owned by model objects.
Parameters:
obj1 - is an object.
obj2 - is another object.
Returns:
true if obj1 corresponds to obj2, false otherwise.


ArgoUML (c) 1996-2002
ArgoUML Project Home
ArgoUML Cookbook