|
|||||||||||
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 Package
s, Stereotype
s
and DataType
s.
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.ElementFactory s
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.ElementFactory s. |
void |
addElementFactory(Model.ElementFactory factory)
Add to the end of the list of ElementFactory s used to create ModelElement s
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 StandardElementDef s
and StandardElementDef constants in Class es are
present in this model. |
boolean |
checkStandardElements(java.util.Collection defs,
boolean create)
Check whether the elements defined by a Collection of StandardElementDef s 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.ElementFactory s 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 Abstraction s 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 Actor s which are defined at any level in this Model . |
java.util.Collection |
getAllElements()
Get all the ModelElement s in this Model. |
java.util.Collection |
getAllStereotypes()
Get all the Stereotype s in this Model. |
java.util.Collection |
getAssociations()
Get the Association s 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 ClassType s 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 DataType s belong in this Model. |
java.util.Collection |
getDataTypes()
Get the DataType s at any level in this Model |
static java.util.List |
getDefaultElementFactoryList()
Get the default list of Model.ElementFactory s. |
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 ElementFactory s used to create ModelElement s
within this Model |
java.util.Collection |
getGeneralizations()
Get the Generalization s 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 InterfaceType s 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 ModelPackage s 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 Stereotype s 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 TagDefinition s in this Model. |
java.util.Collection |
getTopPackages()
Get the top-level ModelPackage s 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 Stereotype s first. |
protected void |
loadTagDefinitions(java.util.Collection c)
Load the MTagDefinition s 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 ClassType s which are defined at any level in this Model ,
and which have a given stereotype. |
java.util.Collection |
selectElements(Stereotype stereotype)
Get the ModelElement s 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.ElementFactory
s
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 Model
factoryList
- 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.ElementFactory
s.
public static void addDefaultElementFactory(Model.ElementFactory factory)
Model.ElementFactory
s.
factory
- the Model.ElementFactory
to addpublic 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 filepublic 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 ModelElement
public java.util.List getElementFactoryList()
ElementFactory
s used to create ModelElement
s
within this Model
public void addElementFactory(Model.ElementFactory factory)
ElementFactory
s used to create ModelElement
s
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()
ModelElement
s 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()
ModelPackage
s in this Model
ModelPackage
objectspublic java.util.Collection getAllStereotypes()
Stereotype
s 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)
Stereotype
s in this Model with a given short name
.
shortName
- short name of the required Stereotype
s
Stereotype
whose name is name
,
may be emptypublic java.util.Collection getTagDefinitions()
TagDefinition
s 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()
ModelPackage
s 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 String
package 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
fullPackageName
public java.util.Collection getDataTypes()
DataType
s 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 DataType
s 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()
ClassType
s 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)
ModelElement
s which are defined at any level in this Model
,
and which have a given stereotype.
ClassType
objectspublic java.util.Collection selectClasses(Stereotype stereotype)
ClassType
s which are defined at any level in this Model
,
and which have a given stereotype.
ClassType
objectspublic java.util.Collection getInterfaces()
InterfaceType
s 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 #getDataType
public java.util.Collection getGeneralizations()
Generalization
s which are defined at any level in this Model
.
Generalization
objectspublic java.util.Collection getAbstractions()
Abstraction
s which are defined at any level in this Model
.
Abstraction
objectspublic java.util.Collection getAssociations()
Association
s which are defined at any level in this Model
.
Association
objectspublic java.util.Collection getActors()
Actor
s 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 objectpublic 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 StandardElementDef
s
Set
of StandardElementDef
objectspublic boolean checkStandardElementColl(java.util.Collection defObjects, boolean create)
StandardElementDef
s
and StandardElementDef
constants in Class
es 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 StandardElementDef
s 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 StandardElementDef
s of the elements to checkcreate
- if true, and an element defined one of the def
s 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 Model
protected void load()
ModelElement.load()
to get the Stereotype
s first.
load
in class ModelElement
protected void loadTagDefinitions(java.util.Collection c)
MTagDefinition
s 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 MTagDefinition
spublic ModelElement createElement(ru.novosoft.uml.foundation.core.MModelElement me, ModelElement parent)
Model.ElementFactory
s with which this Model
was created. They are tried in reverse order. If none of the ElementFactory
s
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 ModelElement
java.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 |