public class GenericModel extends ModelImpl implements MessageSource
Modifier and Type | Class and Description |
---|---|
protected static class |
GenericModel.ConstraintComparators |
static class |
GenericModel.PropertyCopyDuplicatBehaviorIndicator
Identifies different behaviors for situations in which a property is
intended to be copied to a class but another property with the same name
already exists in that class.
|
static class |
GenericModel.PropertyCopyPositionIndicator |
Modifier and Type | Field and Description |
---|---|
protected String |
characterEncoding |
protected Map<String,GenericAssociationInfo> |
genAssociationInfosById |
protected Map<String,GenericClassInfo> |
genClassInfosById |
protected Map<String,GenericClassInfo> |
genClassInfosByName |
protected Map<String,GenericPackageInfo> |
genPackageInfosById |
protected Map<String,GenericPropertyInfo> |
genPropertiesById |
protected Options |
options |
protected ShapeChangeResult |
result |
protected Set<String> |
selectedSchemaPackageIds |
allowedTags, arcgisTags, gmlTags, iso19109Tags, jsonTags, postprocessed, shapeChangeTags
Constructor and Description |
---|
GenericModel()
Constructor used when reading the model during the initialise(...)
|
GenericModel(Model model) |
Modifier and Type | Method and Description |
---|---|
void |
add(GenericPropertyInfo newProperty,
ClassInfo classToAddProperty)
Adds the property to the model map and also the given class.
|
void |
add(GenericPropertyInfo newProperty,
ClassInfo classToAddProperty,
GenericModel.PropertyCopyDuplicatBehaviorIndicator behavior)
Adds the property to the model map and also the given class.
|
void |
add(GenericPropertyInfo newProperty,
GenericClassInfo classToAddProperty,
GenericModel.PropertyCopyPositionIndicator copyPositionIndicator,
GenericModel.PropertyCopyDuplicatBehaviorIndicator duplicateHandling)
Adds the property to the model map and also the given class.
|
void |
add(List<GenericPropertyInfo> newProperties,
GenericModel.PropertyCopyDuplicatBehaviorIndicator behavior)
Adds the given properties to their inClasses
|
void |
addAssociation(GenericAssociationInfo ai)
At the moment simply puts the association info into the map with all
GenericAssociationInfos
|
void |
addClass(GenericClassInfo genCi) |
void |
addPrefixToModelElementIDs(String prefix)
Adds the given prefix to the IDs of all model elements and updates all
fields where the ID is relevant.
|
String |
characterEncoding() |
ClassInfo |
classById(String id) |
ClassInfo |
classByName(String name) |
SortedSet<ClassInfo> |
classes(PackageInfo pi)
Return all ClassInfo objects contained in the given package and in sub-
packages, which do not belong to an app schema different to the one of
the given package.
|
Vector<Constraint> |
copy(List<Constraint> constraints) |
TreeSet<String> |
copy(SortedSet<String> hs) |
void |
copyClassContent(GenericClassInfo fromClass,
GenericClassInfo toClass,
GenericModel.PropertyCopyPositionIndicator copyPositionIndicator,
GenericModel.PropertyCopyDuplicatBehaviorIndicator duplicateHandling)
Copies the content of fromClass to toClass, including attributes, but
NOT:
associations
constraints (because the latter are automatically retrieved and
potentially overridden by each class while the input model is loaded)
operations
dependencies
|
GenericAssociationInfo |
createCopy(AssociationInfo ai,
String copyId)
Creates a copy of the given association.
|
GenericClassInfo |
createCopy(ClassInfo ci,
String copyId)
Creates a copy of the given class.
|
GenericPropertyInfo |
createCopy(PropertyInfo pi,
String copyId)
Creates a copy of the given property.
|
void |
dissolveAssociation(GenericAssociationInfo genAI)
Basically turns the properties representing the two ends of an
association into attributes of the classes they are in (unless the
association end is not navigable).
|
Map<String,GenericAssociationInfo> |
getGenAssociations() |
Map<String,GenericClassInfo> |
getGenClasses() |
Map<String,GenericPackageInfo> |
getGenPackageInfosById() |
Map<String,GenericPackageInfo> |
getGenPackages() |
Map<String,GenericPropertyInfo> |
getGenProperties() |
Set<String> |
getSelectedSchemaPackageIds() |
void |
initialise(ShapeChangeResult r,
Options o,
String repositoryFileName) |
boolean |
isInAppSchema(ClassInfo ci) |
boolean |
isInAppSchema(PackageInfo pi) |
boolean |
isKindOf(ClassInfo childCi,
ClassInfo parentCi)
Determines if ci1 is kind of ci2, by searching the complete inheritance
tree of ci2 created by its subtypes.
|
String |
message(int mnr)
Return a message for a message number.
|
Options |
options() |
PackageInfo |
packageById(String id) |
SortedSet<PackageInfo> |
packages() |
protected Constraint |
parse(FolConstraint con,
Sbvr2FolParser parser,
GenericClassInfo genCi) |
protected Constraint |
parse(OclConstraint con,
GenericClassInfo genCi) |
protected Constraint |
parse(OclConstraint con,
GenericPropertyInfo genPi) |
void |
postprocessAfterLoadingAndValidate()
Execute postprocessing and validation checks after the model has been
loaded.
|
String |
printToString(String indent) |
void |
register(GenericClassInfo genCi)
Puts the given class info into the genClassInfosById and
genClassInfosByName maps.
|
void |
register(GenericPropertyInfo genPi) |
void |
remove(AssociationInfo ai) |
void |
remove(Collection<GenericClassInfo> cisToRemove)
Removes the given classes from the model.
|
void |
remove(GenericClassInfo ciToRemove)
Removes the given class from the model.
|
void |
remove(GenericPropertyInfo genPi,
boolean tryKeepAssociation)
Removes the property from the model.
|
void |
remove(Set<PackageInfo> packagesToRemove)
Removes all of the packages in the set from the model, including all
classes contained in these packages.
|
void |
removeByClassCategory(int classCategory) |
void |
removeByClassId(String id) |
boolean |
removeFromSelectedSchemaPackageIds(String id)
Removes the specified id from the set of selected schema package IDs if
it is present.
|
ShapeChangeResult |
result() |
SortedSet<GenericAssociationInfo> |
selectedSchemaAssociations() |
SortedSet<GenericClassInfo> |
selectedSchemaClasses() |
SortedSet<GenericPropertyInfo> |
selectedSchemaProperties() |
SortedSet<GenericPackageInfo> |
selectedSchemas()
Return all schemas that are selected using the relevant parameters:
appSchemaName, appSchemaNameRegex, appSchemaNamespaceRegex
NOTE: Transformations may change the set of selected schemas
|
void |
setGenAssociationInfosById(Map<String,GenericAssociationInfo> genAssociationInfosById) |
void |
setGenClassInfosById(Map<String,GenericClassInfo> genClassInfosById) |
void |
setGenClassInfosByName(Map<String,GenericClassInfo> genClassInfosByName) |
void |
setGenPackageInfosById(Map<String,GenericPackageInfo> genPackageInfosById) |
void |
setGenPropertiesById(Map<String,GenericPropertyInfo> genPropertiesById) |
void |
setSelectedSchemaPackageIds(Set<String> selectedSchemaPackageIds) |
void |
shutdown() |
void |
updateClassName(GenericClassInfo genCi,
String newName)
Replaces the current name of the class with the given name, applying the
update in the model as well (superclasses, subtypes, model, and property
type info).
|
void |
validateConstraints() |
allPackagesFromSelectedSchemas, classByIdOrName, initialise, isInSelectedSchemas, loadInformationFromExternalSources, normalizeTaggedValue, packages, schemaPackage, schemas
protected Options options
protected ShapeChangeResult result
protected String characterEncoding
protected Map<String,GenericPropertyInfo> genPropertiesById
protected Map<String,GenericAssociationInfo> genAssociationInfosById
protected Map<String,GenericClassInfo> genClassInfosById
protected Map<String,GenericClassInfo> genClassInfosByName
protected Map<String,GenericPackageInfo> genPackageInfosById
public GenericModel()
public GenericModel(Model model)
public void register(GenericClassInfo genCi)
genCi
- public Vector<Constraint> copy(List<Constraint> constraints)
public void addClass(GenericClassInfo genCi)
public boolean isInAppSchema(PackageInfo pi)
public boolean isInAppSchema(ClassInfo ci)
public boolean isKindOf(ClassInfo childCi, ClassInfo parentCi)
childCi
- - the potential child classparentCi
- - the potential parent classtrue
if ci1 is kind of ci2 (includes that ci1 and
ci2 are of the same type)public Options options()
options
in interface Model
Model.options()
public ShapeChangeResult result()
result
in interface Model
Model.result()
public void initialise(ShapeChangeResult r, Options o, String repositoryFileName) throws ShapeChangeAbortException
initialise
in interface Model
ShapeChangeAbortException
de.interactive_instruments.ShapeChange.Model.Model#initialise(de.
interactive_instruments.ShapeChange.ShapeChangeResult,
de.interactive_instruments.ShapeChange.Options, java.lang.String)
public SortedSet<ClassInfo> classes(PackageInfo pi)
public void postprocessAfterLoadingAndValidate()
Model
postprocessAfterLoadingAndValidate
in interface Model
postprocessAfterLoadingAndValidate
in class ModelImpl
postprocessAfterLoadingAndValidate()
public PackageInfo packageById(String id)
packageById
in interface Model
null
if
such a class was not foundpublic ClassInfo classByName(String name)
classByName
in interface Model
null
if
such a class was not foundpublic void shutdown()
shutdown
in interface Model
Model.shutdown()
public String characterEncoding()
characterEncoding
in interface Model
Model.characterEncoding()
public void add(GenericPropertyInfo newProperty, ClassInfo classToAddProperty)
add(GenericPropertyInfo, ClassInfo, PropertyCopyDuplicatBehaviorIndicator)
to control this behavior.newProperty
- classToAddProperty
- public void add(GenericPropertyInfo newProperty, ClassInfo classToAddProperty, GenericModel.PropertyCopyDuplicatBehaviorIndicator behavior)
newProperty
- classToAddProperty
- behavior
- public void add(List<GenericPropertyInfo> newProperties, GenericModel.PropertyCopyDuplicatBehaviorIndicator behavior)
newProperty
- behavior
- public void add(GenericPropertyInfo newProperty, GenericClassInfo classToAddProperty, GenericModel.PropertyCopyPositionIndicator copyPositionIndicator, GenericModel.PropertyCopyDuplicatBehaviorIndicator duplicateHandling)
newProperty
- classToAddProperty
- behavior
- public void remove(GenericClassInfo ciToRemove)
ciToRemove
- public void remove(Collection<GenericClassInfo> cisToRemove)
cisToRemove
- public Map<String,GenericAssociationInfo> getGenAssociations()
public Map<String,GenericPropertyInfo> getGenProperties()
public Map<String,GenericPackageInfo> getGenPackages()
public Map<String,GenericClassInfo> getGenClasses()
public void remove(GenericPropertyInfo genPi, boolean tryKeepAssociation)
genPi
- the property that potentially is removed from the model and
its class (depends on the tryKeepAssociation parameter and
whether the property is navigable or not)tryKeepAssociation
- true if the algorithm should only delete the property if the
association it potentially belongs to is no longer navigable
(in both directions) after the property has been set to be
non-navigable, false if any association the property belongs
to shall be removed outright.public void remove(AssociationInfo ai)
public void removeByClassCategory(int classCategory)
public void copyClassContent(GenericClassInfo fromClass, GenericClassInfo toClass, GenericModel.PropertyCopyPositionIndicator copyPositionIndicator, GenericModel.PropertyCopyDuplicatBehaviorIndicator duplicateHandling)
fromClass
- toClass
- copyPositionIndicator
- duplicateHandling
- public GenericAssociationInfo createCopy(AssociationInfo ai, String copyId)
ai
- copyId
- public GenericClassInfo createCopy(ClassInfo ci, String copyId)
ci
- copyId
- public GenericPropertyInfo createCopy(PropertyInfo pi, String copyId)
pi
- copyId
- public void remove(Set<PackageInfo> packagesToRemove)
packagesToRemove
- public void dissolveAssociation(GenericAssociationInfo genAI)
null
. Each property that is kept in the model is set to be
an attribute, a composition, but no aggregation. Finally, the reference
to the association is removed from the model.
WARNING: a possibly existing association class is also removed from the
model, with all its properties and links to other model elements!genAI
- public void updateClassName(GenericClassInfo genCi, String newName)
newName
- public SortedSet<PackageInfo> packages()
packages
in interface Model
PackageInfo
objects contained in the model; can be
empty but not null
.public void removeByClassId(String id)
public void addAssociation(GenericAssociationInfo ai)
ai
- public SortedSet<GenericPackageInfo> selectedSchemas()
Model
NOTE: Transformations may change the set of selected schemas
selectedSchemas
in interface Model
selectedSchemas
in class ModelImpl
PackageInfo.isSchema()
public SortedSet<GenericClassInfo> selectedSchemaClasses()
selectedSchemaClasses
in interface Model
selectedSchemaClasses
in class ModelImpl
null
.public SortedSet<GenericPropertyInfo> selectedSchemaProperties()
null
.public SortedSet<GenericAssociationInfo> selectedSchemaAssociations()
null
.public boolean removeFromSelectedSchemaPackageIds(String id)
id
- public Set<String> getSelectedSchemaPackageIds()
public void setSelectedSchemaPackageIds(Set<String> selectedSchemaPackageIds)
selectedSchemaPackageIds
- the selectedSchemaPackageIds to setpublic Map<String,GenericPackageInfo> getGenPackageInfosById()
public void setGenPackageInfosById(Map<String,GenericPackageInfo> genPackageInfosById)
genPackageInfosById
- the genPackageInfosById to setpublic void setGenClassInfosById(Map<String,GenericClassInfo> genClassInfosById)
genClassInfosById
- the genClassInfosById to setpublic void setGenClassInfosByName(Map<String,GenericClassInfo> genClassInfosByName)
genClassInfosByName
- the genClassInfosByName to setpublic void setGenAssociationInfosById(Map<String,GenericAssociationInfo> genAssociationInfosById)
genAssociationInfosById
- the genAssociationInfosById to setpublic void setGenPropertiesById(Map<String,GenericPropertyInfo> genPropertiesById)
genPropertiesById
- the genPropertiesById to setpublic void register(GenericPropertyInfo genPi)
public void addPrefixToModelElementIDs(String prefix)
prefix
- public void validateConstraints()
protected Constraint parse(FolConstraint con, Sbvr2FolParser parser, GenericClassInfo genCi)
protected Constraint parse(OclConstraint con, GenericClassInfo genCi)
con
- constraint to validategenCi
- context of the constraintprotected Constraint parse(OclConstraint con, GenericPropertyInfo genPi)
public String message(int mnr)
MessageSource
message
in interface MessageSource
Copyright © 2017. All rights reserved.