|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--com.ashridgetech.jamda.uml.ModelElement
|
+--com.ashridgetech.jamda.uml.Model
A UML model. Provides access to the Packages, Stereotypes
and DataTypes.
| Nested Class Summary | |
static interface |
Model.ElementFactory
A factory object responsible for creating the correct ModelElement subclass object for a NSUML MModelElement
encountered during loading. |
static class |
Model.ElementType
Type-safe enumeration for the standard UML element types, as used in Stereotype as the base class type. |
| Nested classes inherited from class com.ashridgetech.jamda.uml.ModelElement |
ModelElement.DuplicateElementException, ModelElement.ElementListStore, ModelElement.ElementNameListStore, ModelElement.ElementNameStore, ModelElement.ElementStore, ModelElement.TaggedValue, ModelElement.UnknownElementException |
| Field Summary | |
static java.lang.String |
DATA_TYPE_PACKAGE_NAME
|
| Fields inherited from class com.ashridgetech.jamda.uml.ModelElement |
DUMMY_STORE |
| Constructor Summary | |
Model(ru.novosoft.uml.model_management.MModel mm)
Creates new Model from a NSUML model object using the Model.ElementFactorys
from getDefaultElementFactoryList(). |
|
Model(ru.novosoft.uml.model_management.MModel mm,
java.util.List factoryList,
java.util.List stdElementClasses)
Creates new Model from a NSUML model object. |
|
| Method Summary | |
static void |
addDefaultElementFactory(Model.ElementFactory factory)
Add to the default list of Model.ElementFactorys. |
void |
addElementFactory(Model.ElementFactory factory)
Add to the end of the list of ElementFactorys used to create ModelElements
within this Model |
boolean |
checkStandardElement(StandardElementDef def,
boolean create)
Check whether the element defined by a StandardElementDef is
present in this model. |
boolean |
checkStandardElementColl(java.util.Collection defObjects,
boolean create)
Check whether the elements defined by a set of StandardElementDefs
and StandardElementDef constants in Classes are
present in this model. |
boolean |
checkStandardElements(java.util.Collection defs,
boolean create)
Check whether the elements defined by a Collection of StandardElementDefs are
present in this model. |
void |
checkValid()
Check whether this object is valid. |
ModelElement |
createElement(ru.novosoft.uml.foundation.core.MModelElement me,
ModelElement parent)
Create an element using the Model.ElementFactorys with which this Model
was created. |
java.util.Set |
extractStandardElements(java.lang.Class defClass)
Get the StandardElementDef constants
defined by a Class. |
java.util.Collection |
getAbstractions()
Get the Abstractions which are defined at any level in this Model. |
Actor |
getActor(java.lang.String name)
Get the Actor defined at any level in this Model with a given name |
java.util.Collection |
getActors()
Get the Actors which are defined at any level in this Model. |
java.util.Collection |
getAllElements()
Get all the ModelElements in this Model. |
java.util.Collection |
getAllStereotypes()
Get all the Stereotypes in this Model. |
java.util.Collection |
getAssociations()
Get the Associations which are defined at any level in this Model. |
ClassType |
getClass(java.lang.String name)
Get the ClassType defined at any level in this Model with a given name |
java.util.Collection |
getClasses()
Get the ClassTypes which are defined at any level in this Model. |
DataType |
getDataType(java.lang.String name)
Get the DataType at any level in this Model with a given name |
ModelPackage |
getDataTypePackage()
Get the ModelPackage to which DataTypes belong in this Model. |
java.util.Collection |
getDataTypes()
Get the DataTypes at any level in this Model |
static java.util.List |
getDefaultElementFactoryList()
Get the default list of Model.ElementFactorys. |
ModelElement |
getElementById(java.lang.String id)
Get the ModelElement in this Model with a given XMI id,
as returned by ModelElement.getId(). |
Model.ElementFactory |
getElementFactory(java.lang.Class factoryClass)
Get the ElementFactory of the given class, if it exists in this Model. |
java.util.List |
getElementFactoryList()
Get the list of ElementFactorys used to create ModelElements
within this Model |
java.util.Collection |
getGeneralizations()
Get the Generalizations which are defined at any level in this Model. |
InterfaceType |
getInterface(java.lang.String name)
Get the InterfaceType defined at any level in this Model with a given name |
java.util.Collection |
getInterfaces()
Get the InterfaceTypes which are defined at any level in this Model. |
Model |
getModel()
Override the ModelElement method to return this Model |
ModelPackage |
getPackage(java.lang.String name)
Get the ModelPackage at any level in this Model with a given name |
java.util.Collection |
getPackages()
Get the ModelPackages at any level in this Model |
Stereotype |
getStereotype(java.lang.String name)
Get the Stereotype in this Model with a given name. |
java.util.List |
getStereotypes(java.lang.String shortName)
Get the Stereotypes in this Model with a given short name. |
protected ModelElement.ElementStore |
getSubElementStore(java.lang.Class meClass)
Overridden to return the sub-element ModelElement.ElementStore
into which an object of the class meClass should be stored. |
TagDefinition |
getTagDefinition(java.lang.String name)
Get the TagDefinition in this Model with a given name |
java.util.Collection |
getTagDefinitions()
Get all the TagDefinitions in this Model. |
java.util.Collection |
getTopPackages()
Get the top-level ModelPackages in this Model |
Type |
getType(java.lang.String name)
Get the Type at any level in this Model with a given name. |
(package private) ru.novosoft.uml.foundation.core.MCorePackage |
getUmlCorePackage()
Get the NSUML core package connected with this Model. |
(package private) ru.novosoft.uml.foundation.data_types.MDataTypesPackage |
getUmlDataTypesPackage()
Get the NSUML core package connected with this Model. |
(package private) ru.novosoft.uml.model_management.MModelManagementPackage |
getUmlModelManagementPackage()
Get the NSUML model management package connected with this Model. |
protected void |
load()
Override ModelElement.load() to get the Stereotypes first. |
protected void |
loadTagDefinitions(java.util.Collection c)
Load the MTagDefinitions of a given collection, choosing
those which are instances of a certain class. |
static Model |
loadXmi(java.lang.String xmiFileName)
Loads a Model from an XMI file. |
static Model |
loadXmi(java.lang.String xmiFileName,
java.util.List factoryList,
java.util.List stdElementClasses)
Loads a Model from an XMI file. |
ModelPackage |
makePackages(java.util.List packageChain)
Add any packages which do not exist in a hierarchical list, starting below this Model. |
ModelPackage |
makePackages(java.lang.String fullPackageName)
Create a package and any necessary intermediate packages, starting below this Model. |
java.util.Collection |
selectClasses(Stereotype stereotype)
Get the ClassTypes which are defined at any level in this Model,
and which have a given stereotype. |
java.util.Collection |
selectElements(Stereotype stereotype)
Get the ModelElements which are defined at any level in this Model,
and which have a given stereotype. |
protected void |
store(ModelElement me)
Add a ModelElement instance to this Model. |
void |
writeXmi(java.lang.String xmiFileName)
Writes a Model to an XMI file. |
| Methods inherited from class com.ashridgetech.jamda.uml.ModelElement |
add, addStereotype, addTaggedValue, addTaggedValue, addTaggedValues, addTaggedValuesInternal, checkInitialised, checkState, findTaggedValueCollection, getBooleanTaggedValue, getChildElements, getComment, getDescription, getDirectSource, getElement, getElementType, getFullName, getId, getName, getNsElement, getOriginalSource, getParentElement, getProperties, getStereotypes, getStringTaggedValue, getTaggedValue, getTaggedValues, getXpathContext, hasStereotype, hasTaggedValue, init, initLoad, isInitialised, load, load, loadElement, logChange, logger, logger, logLoad, logLoadWarning, logNew, logWarning, removeTaggedValue, select, setComment, setDirectSource, setTaggedValue, setTaggedValue, setTaggedValue, setTaggedValues, stereotype, tag, tagError, toString, type, type, type, xpath, xpathList |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final java.lang.String DATA_TYPE_PACKAGE_NAME
| Constructor Detail |
public Model(ru.novosoft.uml.model_management.MModel mm)
Model.ElementFactorys
from getDefaultElementFactoryList().
mm - The NSUML model backing this Model
within this Model
public Model(ru.novosoft.uml.model_management.MModel mm,
java.util.List factoryList,
java.util.List stdElementClasses)
mm - The NSUML model backing this ModelfactoryList - the list of factories to use to create new elements at any level
within this Model. These are added to the default list.
The factories are used in the reverse order that
they occur in the list. The Model calls Model.ElementFactory.createCopy(com.ashridgetech.jamda.uml.Model)
on each one. May be null.stdElementClasses - a list of Class objects used as described in checkStandardElementColl(java.util.Collection, boolean)
to create standard model elements. May be null.| Method Detail |
public static java.util.List getDefaultElementFactoryList()
Model.ElementFactorys.
public static void addDefaultElementFactory(Model.ElementFactory factory)
Model.ElementFactorys.
factory - the Model.ElementFactory to add
public static Model loadXmi(java.lang.String xmiFileName)
throws java.io.IOException
xmiFileName - the name of the file containing the model in XMI format
java.io.IOException - if there is a problem reading from the file
public static Model loadXmi(java.lang.String xmiFileName,
java.util.List factoryList,
java.util.List stdElementClasses)
throws java.io.IOException
xmiFileName - the name of the file containing the model in XMI formatfactoryList - the list of factories to use to create new elements at any level
within the new Model. The factories are used in the reverse order that
they occur in the list.stdElementClasses - a list of Class objects used as described in checkStandardElementColl(java.util.Collection, boolean)
to create standard model elements
java.io.IOException - if there is a problem reading from the filepublic Model getModel()
ModelElement method to return this Model
getModel in class ModelElementpublic java.util.List getElementFactoryList()
ElementFactorys used to create ModelElements
within this Model
public void addElementFactory(Model.ElementFactory factory)
ElementFactorys used to create ModelElements
within this Model
public Model.ElementFactory getElementFactory(java.lang.Class factoryClass)
ElementFactory of the given class, if it exists in this Model.
public java.util.Collection getAllElements()
ModelElements in this Model.
public ModelElement getElementById(java.lang.String id)
ModelElement in this Model with a given XMI id,
as returned by ModelElement.getId().
id - the id of the required ModelElement
ModelElement whose id is id,
or null if there is no such objectpublic java.util.Collection getTopPackages()
ModelPackages in this Model
ModelPackage objectspublic java.util.Collection getAllStereotypes()
Stereotypes in this Model.
Note: the ModelElement.getStereotypes() method
will return an empty list for a Model
Stereotype objectspublic Stereotype getStereotype(java.lang.String name)
Stereotype in this Model with a given name. The name
may be either the full name, including the base class, as returned
by Stereotype.getName(ru.novosoft.uml.foundation.core.MStereotype) or the short name as returned by
Stereotype.getShortName().
name - the full or short name of the required Stereotype
Stereotype whose name is name,
or null if there is no such object
java.lang.IllegalArgumentException - if there is more than one Stereotype
with a given short namepublic java.util.List getStereotypes(java.lang.String shortName)
Stereotypes in this Model with a given short name.
shortName - short name of the required Stereotypes
Stereotype whose name is name,
may be emptypublic java.util.Collection getTagDefinitions()
TagDefinitions in this Model.
TagDefinition objectspublic TagDefinition getTagDefinition(java.lang.String name)
TagDefinition in this Model with a given name
name - the name of the required TagDefinition
TagDefinition whose name is name,
or null if there is no such objectpublic java.util.Collection getPackages()
ModelPackages at any level in this Model
ModelPackage objectspublic ModelPackage getPackage(java.lang.String name)
ModelPackage at any level in this Model with a given name
name - the full name of the required ModelPackage
ModelPackage whose name is name,
or null if there is no such objectpublic ModelPackage makePackages(java.util.List packageChain)
Model.
If all the packages exist, nothing is added.
packageChain - the list of Stringpackage names, from top to bottom
public ModelPackage makePackages(java.lang.String fullPackageName)
Model.
If all the packages exist, nothing is added.
fullPackageName - the full package name
fullPackageNamepublic java.util.Collection getDataTypes()
DataTypes at any level in this Model
DataType objectspublic DataType getDataType(java.lang.String name)
DataType at any level in this Model with a given name
name - the name of the required DataType
DataType whose name is name,
or null if there is no such objectpublic ModelPackage getDataTypePackage()
ModelPackage to which DataTypes belong in this Model.
This is the package with the name given by DATA_TYPE_PACKAGE_NAME.
Create the package if it does not exist.
ModelPackage for data typespublic java.util.Collection getClasses()
ClassTypes which are defined at any level in this Model.
ClassType objectspublic ClassType getClass(java.lang.String name)
ClassType defined at any level in this Model with a given name
name - the full name (see ModelElement.getFullName()) of the required ClassType
ClassType whose name is name,
or null if there is no such objectpublic java.util.Collection selectElements(Stereotype stereotype)
ModelElements which are defined at any level in this Model,
and which have a given stereotype.
ClassType objectspublic java.util.Collection selectClasses(Stereotype stereotype)
ClassTypes which are defined at any level in this Model,
and which have a given stereotype.
ClassType objectspublic java.util.Collection getInterfaces()
InterfaceTypes which are defined at any level in this Model.
InterfaceType objectspublic InterfaceType getInterface(java.lang.String name)
InterfaceType defined at any level in this Model with a given name
name - the full name (see ModelElement.getFullName()) of the required InterfaceType
InterfaceType whose name is name,
or null if there is no such objectpublic Type getType(java.lang.String name)
Type at any level in this Model with a given name.
Searches first for a ClassType, then for an InterfaceType,
then for a DataType.
name - the name of the required Type
Type whose name is name,
or null if there is no such object#getInterface #getDataTypepublic java.util.Collection getGeneralizations()
Generalizations which are defined at any level in this Model.
Generalization objectspublic java.util.Collection getAbstractions()
Abstractions which are defined at any level in this Model.
Abstraction objectspublic java.util.Collection getAssociations()
Associations which are defined at any level in this Model.
Association objectspublic java.util.Collection getActors()
Actors which are defined at any level in this Model.
Actor objectspublic Actor getActor(java.lang.String name)
Actor defined at any level in this Model with a given name
name - the full name (see ModelElement.getFullName()) of the required Actor
Actor whose name is name,
or null if there is no such object
public void writeXmi(java.lang.String xmiFileName)
throws java.io.IOException
xmiFileName - the name of the file to which the model is written in XMI format
java.io.IOException - if there is a problem writing to the filepublic java.util.Set extractStandardElements(java.lang.Class defClass)
StandardElementDef constants
defined by a Class.
defClass - the Class containing the StandardElementDefs
Set of StandardElementDef objects
public boolean checkStandardElementColl(java.util.Collection defObjects,
boolean create)
StandardElementDefs
and StandardElementDef constants in Classes are
present in this model. Optionally create the elements. Log error
if an element is not present and create is false,
or info if an element is created.
create - if true, and an element defined in defClasses is
not present, create it.
public boolean checkStandardElement(StandardElementDef def,
boolean create)
StandardElementDef is
present in this model. Optionally create the element. Log error
if not present and create is false, or info if created.
def - the StandardElementDef of the element to checkcreate - if true, and the element defined by def is
not present, create it.
public boolean checkStandardElements(java.util.Collection defs,
boolean create)
Collection of StandardElementDefs are
present in this model. Optionally create the elements. Log error
if not present and create is false, or warning if an element is created.
defs - the StandardElementDefs of the elements to checkcreate - if true, and an element defined one of the defs is
not present, create it.
ru.novosoft.uml.foundation.core.MCorePackage getUmlCorePackage()
Model.
This can be used for creating new NSUML core objects.
ru.novosoft.uml.model_management.MModelManagementPackage getUmlModelManagementPackage()
Model.
This can be used for creating new NSUML model objects.
ru.novosoft.uml.foundation.data_types.MDataTypesPackage getUmlDataTypesPackage()
Model.
This can be used for creating new NSUML datatype objects.
protected void store(ModelElement me)
ModelElement instance to this Model.
me - The ModelElement to be added to this Model.
Must not be null and its name property must not be null
java.lang.IllegalArgumentException - if me already belongs to this Modelprotected void load()
ModelElement.load() to get the Stereotypes first.
load in class ModelElementprotected void loadTagDefinitions(java.util.Collection c)
MTagDefinitions of a given collection, choosing
those which are instances of a certain class.
Calls ModelElement.loadElement(ru.novosoft.uml.foundation.core.MModelElement) for each one.
c - the MModelElements from which to load the MTagDefinitions
public ModelElement createElement(ru.novosoft.uml.foundation.core.MModelElement me,
ModelElement parent)
Model.ElementFactorys with which this Model
was created. They are tried in reverse order. If none of the ElementFactorys
return a new element, return null.
me - the model element being loadedparent - the element which will contain the new ModelElement
ModelElement, or null if no ElementFactory can create one
for me
public void checkValid()
throws java.lang.IllegalStateException
checkValid in class ModelElementjava.lang.IllegalStateException - if a problem is foundprotected ModelElement.ElementStore getSubElementStore(java.lang.Class meClass)
ModelElement.ElementStore
into which an object of the class meClass should be stored.
getSubElementStore in class ModelElement
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||