public class UmlModel
extends java.lang.Object
Under the root in a repository, there may be several models. This class stores them all as
UmlPackage.Kind.MODEL
packages - they are the entry point into the full UML content. In the standard
IEC TC57 UML we have two such models:
Nature.CIM
(default), and,Nature.IEC61850
(must be specified in configuration).UmlPackage.Kind.TOP
packages, each of them assigned to an owner
OwningWg
. Owner is typically an IEC TC57 working group that manages the part of the model
under the UmlPackage.Kind.TOP
package.
If a model package is found that contains top-level packages of unknown names, that model will
get the owner OwningWg.OTHER_CIM
(default) or OwningWg.OTHER_IEC61850
(if model
name specified in configuration as Nature.IEC61850
). This allows to combine the custom
extensions with the standard models.
The current implementation of OwningWg
defines the "known" top-package names and IEC TC57
working groups and holds the rules about allowed dependencies. That class does not care about
models, but rather about top-level packages (each owned by a WG). This also provides for
flexibility when you develop non-standard extensions.
Implementation note 1: The internal maps in this class are used purely to store model elements
present in the UML repository, for quick access to elements per UML type where bulk data is
needed. The package-private modifiers, such as addClass(UmlClass)
, perform no
consistency checks at all and should not be used - respect the restrictions given in their doc!
In contrast, the in-memory objects, once after they get inter-linked with their own accessors
(e.g., UmlPackage.addClass(UmlClass)
), can be navigated "naturally" with their own
getters ((e.g., UmlPackage.getClasses()
)). The entry point for that navigation are model
packages, obtained through getModelPackages()
.
Implementation note 2: This class also creates internal "null" model packages and classes (one
per nature) to provide for valid in-memory objects for types of attributes and operations that
may be invalid in the repository (and for which we don't have any information, but need to create
an instance of UmlClass
. The treatment of these "null" elements is different on purpose:
we don't want to, e.g., validate them or to print their documentation - but we have to be able to
do this with the in-memory objects whose type UmlClass
may be invalid in the original UML
repository - so, they are never included in maps/collections that contain the in-memory contect
from the real UML model repository.
Modifier and Type | Method and Description |
---|---|
void |
crossCheck(UmlModel profilesModel) |
java.util.Collection<UmlAssociation> |
findAssociations(java.util.EnumSet<OwningWg> wgs,
java.util.EnumSet<UmlAssociationEnd.Kind> kinds,
boolean includeNormative,
boolean includeInformative)
Returns all associations involving classes from owners
wg . |
java.util.List<UmlAttribute> |
findAttributes(java.lang.String packageName,
boolean includeLiterals,
boolean includeNonLiterals)
Returns all attributes in and under the package
packageName according to the
given filters (note: setting both includeLiterals and
includeNonLiterals to true returns all attributes). |
java.util.List<UmlAttribute> |
findAttributes(java.lang.String packageName,
boolean includeLiterals,
boolean includeNonLiterals,
boolean namesOrdered)
Same as
findAttributes(String, boolean, boolean) , but allows for ordering per name
to be specified. |
java.util.Collection<UmlAttribute> |
findAttributesWithConstraints()
Returns attributes that have any kind of constraint (own and by class).
|
java.util.Map<java.lang.String,java.util.List<UmlAttribute>> |
findAttributesWithDuplicates(java.lang.String packageName,
boolean includeLiterals,
boolean includeNonLiterals,
boolean namesOrdered)
Returns all attributes per name in and under the package
packageName , grouped by
their name and according to the given filters (note: setting both
includeLiterals and includeNonLiterals to true returns all
attributes). |
java.util.Collection<UmlAssociation> |
findCimNoncimAssociations()
Returns all associations that are mappings between models of different natures.
|
java.util.Set<UmlClass> |
findClasses(java.util.EnumSet<OwningWg> wgs,
java.util.EnumSet<UmlClass.CimKind> cimKinds,
java.util.EnumSet<UmlClass.Iec61850Kind> iec61850Kinds,
boolean includeNormative,
boolean includeInformative)
Returns all classes from owners
wg . |
java.util.Set<UmlClass> |
findClasses(java.lang.String name)
Returns all classes with name matching
name . |
java.util.Collection<UmlClass> |
findClassesWithConstraints()
Returns all classes that have constraints.
|
java.util.Collection<UmlDiagram> |
findDiagrams(java.lang.String containerName,
java.lang.String name,
boolean includeOnPackage,
boolean includeOnClass)
Returns all diagrams whose container name matches
containerName and with name
name , with the specified options applied. |
java.util.Collection<UmlAttribute> |
findDOAttributes()
Returns attributes on logical nodes (not in meta-model).
|
java.util.Collection<UmlAttribute> |
findMultivaluedAttributes()
Returns multi-valued attributes.
|
java.util.Collection<UmlPackage> |
findPackages(java.util.List<java.lang.String> names)
TODO: Refactor to use AbstractUmlObject.findAllForName().
|
java.util.Map<java.lang.String,UmlAttribute> |
findPresenceConditionLiterals()
Returns all literals that represent presence conditions.
|
java.util.Map<java.lang.String,java.lang.String> |
getAbbreviatedTermsSortedPerDecreasingLength()
(IEC61850) Returns all abbreviated terms sorted by decreasing length; handles duplicate
definitions by appending all of them per term.
|
java.util.Map<java.lang.String,java.util.List<UmlAttribute>> |
getAbbreviationLiterals()
(IEC61850) Returns all abbreviation literal indexed by name.
|
java.util.Collection<UmlAssociation> |
getAssociations()
Returns all associations in this model.
|
java.util.Collection<UmlAttribute> |
getAttributes()
Returns all attributes in this model.
|
Config |
getCfg()
Returns configuration.
|
java.util.Collection<UmlClass> |
getClasses()
Returns all classes in this model.
|
java.util.Collection<UmlDependency> |
getDependencies()
Returns all explicit (hand-drawn) dependencies in this model.
|
java.util.Collection<UmlDiagram> |
getDiagrams()
Returns all diagrams in this model.
|
java.lang.String |
getModelNamesWithNature()
Returns comma-separated pairs {modelPackageName nature}.
|
java.util.Collection<UmlPackage> |
getModelPackages()
Returns all model packages.
|
java.util.Collection<UmlPackage> |
getModelPackages(java.util.EnumSet<Nature> natures)
Returns model packages of specified nature.
|
java.util.Collection<NamespaceInfo> |
getNamespaceInfos()
Returns non-null namespace informations for all packages.
|
java.util.Collection<UmlPackage> |
getNamespacePackages(java.util.EnumSet<OwningWg> wgs)
Returns packages that have namespace info for specified owners.
|
java.util.Map<Nature,UmlClass> |
getNullClasses()
Returns special, "null" classes per nature.
|
java.util.Map<Nature,UmlPackage> |
getNullModelPackages()
Returns special, "null" model packages per nature; they are created by default to hold
special, "null" classes that may be needed when the model repository allows for invalid or
bad definition of types for attributes and operation parameters.
|
java.util.Collection<UmlOperation> |
getOperations()
Returns all operations in this model.
|
java.util.Collection<UmlPackage> |
getPackages()
Returns all packages in this model.
|
java.util.Map<java.lang.String,java.util.Set<UmlObject>> |
getTags() |
java.util.Collection<UmlPackage> |
getTopPackages(java.util.EnumSet<OwningWg> wgs)
Returns top packages for specified owners.
|
java.lang.String |
getUuid()
Returns model UUID.
|
java.util.Collection<VersionInfo> |
getVersionInfos(java.util.EnumSet<OwningWg> wgs)
Returns version informations for top-level packages of specified owners.
|
java.lang.String |
toString() |
public UmlModel(Config cfg)
public Config getCfg()
public java.lang.String getUuid()
public java.util.Collection<UmlPackage> getModelPackages()
public java.util.Map<Nature,UmlPackage> getNullModelPackages()
public java.util.Map<Nature,UmlClass> getNullClasses()
getNullModelPackages()
public void crossCheck(UmlModel profilesModel)
profilesModel
- public java.util.Collection<UmlPackage> getPackages()
public java.util.Collection<UmlPackage> findPackages(java.util.List<java.lang.String> names)
Returns potentially empty list of all packages whose name matches one of names
.
public java.util.Collection<UmlClass> getClasses()
public java.util.Set<UmlClass> findClasses(java.lang.String name)
name
.public java.util.Set<UmlClass> findClasses(java.util.EnumSet<OwningWg> wgs, java.util.EnumSet<UmlClass.CimKind> cimKinds, java.util.EnumSet<UmlClass.Iec61850Kind> iec61850Kinds, boolean includeNormative, boolean includeInformative)
wg
.wgs
- one or more owners.cimKinds
- one or more CIM class kinds.iec61850Kinds
- one or more IEC61850 class kinds.includeNormative
- whether to include normative classes.includeInformative
- whether to include informative classes.public java.util.Collection<UmlClass> findClassesWithConstraints()
public java.util.Map<java.lang.String,java.lang.String> getAbbreviatedTermsSortedPerDecreasingLength()
public java.util.Collection<UmlAttribute> getAttributes()
public java.util.Map<java.lang.String,java.util.List<UmlAttribute>> getAbbreviationLiterals()
public java.util.Map<java.lang.String,UmlAttribute> findPresenceConditionLiterals()
public java.util.List<UmlAttribute> findAttributes(java.lang.String packageName, boolean includeLiterals, boolean includeNonLiterals)
packageName
according to the
given filters (note: setting both includeLiterals
and
includeNonLiterals
to true returns all attributes).packageName
- name of package to start from.includeLiterals
- whether to include enumeration literals.includeNonLiterals
- whether to include non-literals.public java.util.Map<java.lang.String,java.util.List<UmlAttribute>> findAttributesWithDuplicates(java.lang.String packageName, boolean includeLiterals, boolean includeNonLiterals, boolean namesOrdered)
packageName
, grouped by
their name and according to the given filters (note: setting both
includeLiterals
and includeNonLiterals
to true returns all
attributes). The names may be ordered.packageName
- name of package to start from.includeLiterals
- whether to include enumeration literals.includeNonLiterals
- whether to include non-literals.namesOrdered
- whether to perform name ordering.public java.util.List<UmlAttribute> findAttributes(java.lang.String packageName, boolean includeLiterals, boolean includeNonLiterals, boolean namesOrdered)
findAttributes(String, boolean, boolean)
, but allows for ordering per name
to be specified.packageName
- name of package to start from.includeLiterals
- whether to include enumeration literals.includeNonLiterals
- whether to include non-literals.namesOrdered
- whether to perform name ordering.public java.util.Collection<UmlAttribute> findAttributesWithConstraints()
public java.util.Collection<UmlAttribute> findMultivaluedAttributes()
public java.util.Collection<UmlAttribute> findDOAttributes()
public java.util.Collection<UmlOperation> getOperations()
public java.util.Collection<UmlAssociation> getAssociations()
public java.util.Collection<UmlAssociation> findAssociations(java.util.EnumSet<OwningWg> wgs, java.util.EnumSet<UmlAssociationEnd.Kind> kinds, boolean includeNormative, boolean includeInformative)
wg
.wgs
- one or more owners.kinds
- one or more association kinds.includeNormative
- whether to include normative associations.includeInformative
- whether to include informative associations.public java.util.Collection<UmlAssociation> findCimNoncimAssociations()
public java.util.Collection<UmlDependency> getDependencies()
public java.util.Collection<UmlDiagram> getDiagrams()
public java.util.Collection<UmlDiagram> findDiagrams(java.lang.String containerName, java.lang.String name, boolean includeOnPackage, boolean includeOnClass)
containerName
and with name
name
, with the specified options applied.containerName
- name of the diagram's container.name
- name of the diagram.includeOnPackage
- includes diagrams defined on packages.includeOnClass
- includes diagrams defined on classes.public java.util.Map<java.lang.String,java.util.Set<UmlObject>> getTags()
public java.lang.String getModelNamesWithNature()
public java.util.Collection<UmlPackage> getModelPackages(java.util.EnumSet<Nature> natures)
public java.util.Collection<UmlPackage> getTopPackages(java.util.EnumSet<OwningWg> wgs)
public java.util.Collection<UmlPackage> getNamespacePackages(java.util.EnumSet<OwningWg> wgs)
public java.util.Collection<VersionInfo> getVersionInfos(java.util.EnumSet<OwningWg> wgs)
public java.util.Collection<NamespaceInfo> getNamespaceInfos()
public java.lang.String toString()
toString
in class java.lang.Object
Copyright 2009-2016 Tatjana (Tanja) Kostic