public class UmlPackage extends UmlStructure
UmlStructure
(so we avoid code duplication).
Implementation note: We distinguish among hierarchy levels of packages by their UmlPackage.Kind
, to
ensure we can manage the actual UML model repositories in a loosely coupled way. This also allows
us to filter (opt in/out) parts of the in-memory model for e.g. validation, statistics or
document generation.
A cleaner design would be to effectively create subclasses instead of using the above kinds, but it would be overkill for minor differences in functionality per kind.
Modifier and Type | Class and Description |
---|---|
static class |
UmlPackage.Data
Data from the UML model repository specific to
UmlPackage . |
static class |
UmlPackage.Kind
Kind of UML package, reflecting hierarchical package containment and common properties for
the model content below a given level.
|
CLASS_SEPARATOR, NULL_OBJ_NAME, PACKAGE_SEPARATOR
Constructor and Description |
---|
UmlPackage(UmlModel model,
UmlObjectData objData,
UmlPackage.Data data)
Creates a model package (e.g.
|
UmlPackage(UmlPackage containingPackage,
UmlObjectData objData,
UmlPackage.Data data)
Creates a top-level or a regular package, and adds itself to
containingPackage . |
Modifier and Type | Method and Description |
---|---|
static UmlPackage |
basic(UmlModel model,
java.lang.String name)
Constructs minimal model package - useful for creation from profiles and testing.
|
static UmlPackage |
basic(UmlPackage containingPackage,
java.lang.String name)
Constructs minimal non-model package - useful for creation from profiles and testing.
|
static UmlPackage |
basic(UmlPackage containingPackage,
java.lang.String name,
java.lang.String stereotype)
Constructs minimal non-model package with stereotype(s) - useful for creation from profiles
and testing.
|
java.util.Collection<UmlPackage> |
collectDependencyEfferentPackages()
Returns all classes that I depend on through an explicit UML dependency in the model.
|
java.util.Set<UmlPackage> |
getChildPackages()
Returns all direct sub-packages.
|
java.util.Set<UmlPackage> |
getChildPackages(java.lang.String name)
Returns sub-packages with
name . |
java.util.Set<UmlClass> |
getClasses()
Returns all classes in this package.
|
UmlStructure |
getContainer()
Returns containing structure, null in case this is the model package.
|
UmlPackage |
getContainingPackage()
Returns the containing package, null for
UmlPackage.Kind.MODEL . |
int |
getDepth()
Returns the depth of this package, relative to the top-level package (i.e., for model package
returns -1, for top-level package returns 0, and for all other packages returns positive
offset relative to top-level package).
|
UmlKind |
getKind()
Returns kind of this UML object, as assigned by the application.
|
static java.util.List<UmlKind> |
getKinds(Nature nature)
Returns all available classifications (kinds) for packages.
|
UmlModel |
getModel()
Returns the model this structure belongs to.
|
Namespace |
getNamespace()
Returns the namespace of this UML object, based on tagged values in the UML model and when
missing, calculated by the application.
|
NamespaceInfo |
getNamespaceInfo()
(lazy loaded) Returns the namespace information in case the relevant namespace class (for
IEC61850) or version class (for CIM) is defined in the package, null otherwise.
|
Nature |
getNature()
Returns the nature of this UML object, which determines the validation rules to apply, and
sometimes document generation formats.
|
OwningWg |
getOwner()
Returns the IEC working group owning this UML object, as calculated by the application based
on the UML model structure.
|
java.util.Set<java.lang.String> |
getPredefinedTagNames()
Returns allowed tag names, as expected to be found in the UML model.
|
java.lang.String |
getQualifiedName()
Returns the name of this UML object combined with some container-related information (e.g.,
packageName.className, or containingPackageName.packageName).
|
VersionInfo |
getVersionInfo()
(lazy loaded) Returns the version information in case the relevant version class is defined
in the package, null otherwise.
|
boolean |
isInformative()
Returns whether this UML object is informative (and thus should be ignored when generating
official IEC documents).
|
boolean |
isInOrUnderPackage(java.lang.String packageName)
Returns whether this package or anywhere below it (recursively) there is a package called
packageName . |
boolean |
isTop()
Returns whether this package is a top package (owned by a WG).
|
boolean |
isUnderPackage(java.lang.String packageName)
Returns whether anywhere below this package (recursively) there is a package called
packageName . |
void |
orderClasses(java.util.List<java.lang.String> uuids)
Orders classes in the order given in
uuids . |
boolean |
shouldExportDiagrams() |
java.lang.String |
toString() |
addDependency, addDiagram, addSkippedUmlItem, collectDependencyAfferentStructures, collectDependencyEfferentStructures, collectMyAndParentsDependencyEfferentStructures, getDependenciesAsSource, getDependenciesAsTarget, getDiagrams, getSkippedUmlItems, isSelfDependent
addDeprecAndInf, addTaggedValue, appendRemainingCustomStereotypes, classifyPerScope, classifyPerScopePerTag, classifyPerTag, collectDuplicateDescriptions, collectDuplicateNames, collectForScope, collectNames, collectQNames, findAllForName, findWithSameUuidAndLog, getAlias, getDescription, getHtmlDescription, getId, getName, getSince, getStereotype, getTaggedValues, getUnallowedTagNames, getUuid, getVisibility, initFromTags, isDeprecated, saveTags, toShortString, toShortString, validateTag
public UmlPackage(UmlModel model, UmlObjectData objData, UmlPackage.Data data)
model
. After creating this object, you may want to add tagged values, classes
and child packages (as well as other objects - see
UmlStructure.UmlStructure(UmlObjectData, UmlStructure.Data)
).model
- parent UML modelobjData
- common data for every UmlObject
s.data
- data proper to UmlPackage
.public UmlPackage(UmlPackage containingPackage, UmlObjectData objData, UmlPackage.Data data)
containingPackage
.
After creating this object, you may want to add tagged values, classes and child packages (as
well as other objects - see
UmlStructure.UmlStructure(UmlObjectData, UmlStructure.Data)
).containingPackage
- parent UML packageobjData
- common data for every UmlObject
.data
- data proper to UmlPackage
.public static java.util.List<UmlKind> getKinds(Nature nature)
nature
- ignored in this methodpublic static UmlPackage basic(UmlModel model, java.lang.String name)
public static UmlPackage basic(UmlPackage containingPackage, java.lang.String name)
public static UmlPackage basic(UmlPackage containingPackage, java.lang.String name, java.lang.String stereotype)
public boolean shouldExportDiagrams()
public UmlPackage getContainingPackage()
UmlPackage.Kind.MODEL
.public boolean isTop()
public int getDepth()
public java.util.Set<UmlClass> getClasses()
public void orderClasses(java.util.List<java.lang.String> uuids)
uuids
.public java.util.Collection<UmlPackage> collectDependencyEfferentPackages()
public VersionInfo getVersionInfo()
public NamespaceInfo getNamespaceInfo()
public java.util.Set<UmlPackage> getChildPackages()
public java.util.Set<UmlPackage> getChildPackages(java.lang.String name)
name
. Normally, sub-packages should have name unique
within the containing package. However some tools allow this anomaly and we need to support
that kind of result (with a set returned).public boolean isUnderPackage(java.lang.String packageName)
packageName
. To include this package in the search, use
isInOrUnderPackage(String)
.public boolean isInOrUnderPackage(java.lang.String packageName)
packageName
. To exclude this package from the search, use
isUnderPackage(String)
.public UmlModel getModel()
Returns the model this package and all its recursive contents belongs to.
getModel
in class UmlStructure
public UmlStructure getContainer()
getContainer
in class UmlStructure
public OwningWg getOwner()
UmlObject
getOwner
in interface UmlObject
getOwner
in class UmlStructure
public Namespace getNamespace()
Returns own namespace initialised from tagged values if not empty. Otherwise, returns the namespace of the containing package, or empty namespace otherwise.
public Nature getNature()
UmlObject
getNature
in interface UmlObject
getNature
in class UmlStructure
public boolean isInformative()
This default implementation returns true if objects steretypes include . If there are additional criteria for deriving informative status, ensure to invoke this default implementation first.
Model package is never informative.
Any other package is considered as informative if any of the following is true:
UML.INF_PREFIX
,
UML.DetailedDiagrams
,
isInformative
in interface UmlObject
isInformative
in class AbstractUmlObject
UmlObject.isInformative()
public UmlKind getKind()
UmlObject
getKind
in interface UmlObject
getKind
in class UmlStructure
public java.lang.String getQualifiedName()
UmlObject
getQualifiedName
in interface UmlObject
getQualifiedName
in class UmlStructure
public java.util.Set<java.lang.String> getPredefinedTagNames()
UmlObject
public java.lang.String toString()
toString
in class java.lang.Object
Copyright 2009-2016 Tatjana (Tanja) Kostic