org.argouml.model
Interface UmlFactory


public interface UmlFactory

The interface for the UmlFactory.


Method Summary
 java.lang.Object buildConnection(java.lang.Object connectionType, java.lang.Object fromElement, java.lang.Object fromStyle, java.lang.Object toElement, java.lang.Object toStyle, java.lang.Object unidirectional, java.lang.Object namespace)
          Creates a UML model element of the given type and uses this to connect two other existing UML model elements.
 java.lang.Object buildNode(java.lang.Object elementType)
          Creates a UML model element of the given type.
 java.lang.Object buildNode(java.lang.Object elementType, java.lang.Object container)
          Creates a UML model element of the given type and adds it to the passed in container.
 void delete(java.lang.Object elem)
          Delete a model element.
 void deleteExtent(java.lang.Object element)
          Delete the entire extent which contains the given element.
 boolean isConnectionType(java.lang.Object connectionType)
          Checks if some type of UML model element is valid to connect other UML model elements.
 boolean isConnectionValid(java.lang.Object connectionType, java.lang.Object fromElement, java.lang.Object toElement, boolean checkWFR)
          Checks if the given type of UML model element is valid to connect two other existing UML model elements, optionally checking UML well-formedness rules in addition to basic metamodel validity.
 boolean isContainmentValid(java.lang.Object metaType, java.lang.Object container)
          Checks if the given type of UML model element is valid to be contained within the passed in container model element.
 boolean isRemoved(java.lang.Object o)
          Check whether a model element has been deleted.
 

Method Detail

buildConnection

java.lang.Object buildConnection(java.lang.Object connectionType,
                                 java.lang.Object fromElement,
                                 java.lang.Object fromStyle,
                                 java.lang.Object toElement,
                                 java.lang.Object toStyle,
                                 java.lang.Object unidirectional,
                                 java.lang.Object namespace)
                                 throws IllegalModelElementConnectionException
Creates a UML model element of the given type and uses this to connect two other existing UML model elements. This only works for UML elements. If a diagram contains elements of another type then it is the responsibility of the diagram manage those items and not call this method.

Parameters:
connectionType - the UML object type of the connection
fromElement - the UML object for the "from" element
fromStyle - the aggregationkind for the connection in case of an association
toElement - the UML object for the "to" element
toStyle - the aggregationkind for the connection in case of an association
unidirectional - for association and associationrole
namespace - the namespace to use if it can't be determined
Returns:
the newly build connection (UML object)
Throws:
IllegalModelElementConnectionException - if the connection is not a valid thing to do

buildNode

java.lang.Object buildNode(java.lang.Object elementType)
Creates a UML model element of the given type. This only works for UML elements. If a diagram contains elements of another type then it is the responsibility of the diagram manage those items and not call this method. It also only works for UML model elements that are represented in diagrams by a node.

Parameters:
elementType - the type of model element to build
Returns:
the model element TODO: This needs an extra parameter to specify the model/extent where the new element should be created.

buildNode

java.lang.Object buildNode(java.lang.Object elementType,
                           java.lang.Object container)
Creates a UML model element of the given type and adds it to the passed in container.

Parameters:
elementType - the type of model element to build
container - the model element that will contain the newly built model element
Returns:
the model element

isConnectionType

boolean isConnectionType(java.lang.Object connectionType)
Checks if some type of UML model element is valid to connect other UML model elements.

Parameters:
connectionType - the UML object type of the connection
Returns:
true if valid

isConnectionValid

boolean isConnectionValid(java.lang.Object connectionType,
                          java.lang.Object fromElement,
                          java.lang.Object toElement,
                          boolean checkWFR)
Checks if the given type of UML model element is valid to connect two other existing UML model elements, optionally checking UML well-formedness rules in addition to basic metamodel validity.

Parameters:
connectionType - the UML object type of the connection
fromElement - the UML object type of the "from"
toElement - the UML object type of the "to"
checkWFR - true to check UML Well Formedness Rules
Returns:
true if valid

isContainmentValid

boolean isContainmentValid(java.lang.Object metaType,
                           java.lang.Object container)
Checks if the given type of UML model element is valid to be contained within the passed in container model element.

Parameters:
metaType - the UML object type to be tested
container - the UML object that is the container
Returns:
true if valid

delete

void delete(java.lang.Object elem)
Delete a model element. This will do a a 'cascading deletes' which recursively deletes any model elements which would no longer be valid after this element is deleted. For example, a binary association which has one end deleted will also be deleted because it no longer meets the minimum multiplicity constraint.

Callers who are interested in receiving notification of all elements which were deleted should register an event listener to receive delete events.

Parameters:
elem - The element to be deleted

deleteExtent

void deleteExtent(java.lang.Object element)
Delete the entire extent which contains the given element. Typically this is the collection of elements which were read in from a single XMI file.

Parameters:
element - an element in extent to be deleted.

isRemoved

boolean isRemoved(java.lang.Object o)
Check whether a model element has been deleted.

NOTE:You probably don't want to use this. It's not thread-safe! Without external synchronization there's no guarantee that the element won't be deleted by thread after this method returns, but before the caller can do anything with it.

If the calling code isn't protected by a lock or some other type of synchronization, a much, MUCH better alternative to using this call is to use a try/catch block which catches InvalidElementExceptions.

Parameters:
o - the object to be checked
Returns:
true if removed


ArgoUML © 1996-2006ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook