de.interactive_instruments.ShapeChange.Model.Generic
Class GenericClassInfo

java.lang.Object
  extended by de.interactive_instruments.ShapeChange.Model.InfoImpl
      extended by de.interactive_instruments.ShapeChange.Model.ClassInfoImpl
          extended by de.interactive_instruments.ShapeChange.Model.Generic.GenericClassInfo
All Implemented Interfaces:
MessageSource, ClassInfo, Info

public class GenericClassInfo
extends ClassInfoImpl
implements MessageSource

Author:
Johannes Echterhoff (echterhoff interactive-instruments de)

Field Summary
protected  boolean asCharacterString
           
protected  boolean asDictionary
           
protected  boolean asDictionaryGml33
           
protected  boolean asGroup
           
protected  AssociationInfo assocClass
           
protected  ClassInfo baseClass
           
protected  Vector<Constraint> constraints
          Not null
protected  boolean hasNilReason
           
protected  String id
           
protected  boolean includeByValuePropertyType
           
protected  boolean includePropertyType
           
protected  boolean isAbstract
           
protected  boolean isCollection
           
protected  boolean isLeaf
           
protected  GenericModel model
           
protected  String name
           
protected  Options options
           
protected  PackageInfo pkg
           
protected  TreeMap<StructuredNumber,PropertyInfo> properties
           
protected  ShapeChangeResult result
           
protected  HashSet<String> stereotypes
           
protected  HashSet<String> subtypes
           
protected  HashSet<String> supertypes
          Set of ids of all base classes of this class
protected  boolean suppressed
           
protected  HashMap<String,String> taggedValues
           
protected  String xmlSchemaType
           
 
Fields inherited from class de.interactive_instruments.ShapeChange.Model.ClassInfoImpl
category, diagrams, processed
 
Fields inherited from class de.interactive_instruments.ShapeChange.Model.InfoImpl
aliasName, definition, description, documentation
 
Constructor Summary
GenericClassInfo(GenericModel model, String id, String name, int category)
           
 
Method Summary
 void addConstraints(Vector<Constraint> newConstraints)
           
 void addPropertiesAtBottom(List<GenericPropertyInfo> newProps, GenericModel.PropertyCopyDuplicatBehaviorIndicator duplicateHandling)
          Adds the given list of new properties to this class.
 void addPropertiesAtTop(List<GenericPropertyInfo> newProps, GenericModel.PropertyCopyDuplicatBehaviorIndicator duplicateHandling)
          Adds the given list of new properties to this class.
 void addPropertiesInSequence(List<GenericPropertyInfo> newProps, GenericModel.PropertyCopyDuplicatBehaviorIndicator duplicateHandling)
          Adds the given list of new properties to this class.
 void addProperty(GenericPropertyInfo newProperty, GenericModel.PropertyCopyDuplicatBehaviorIndicator duplicateHandling)
          Adds the new property to the set of properties of this class.
 String aliasName()
          Retrieve the alias, typically a human readable name
 boolean asCharacterString()
          If a <> class has a tagged value "gmlAsCharacterString" with a value "true" it will be translated into an xsd:string simple type regardless of how it is actually built.
 boolean asDictionary()
          Find out if this class has to be output as a dictionary.
 boolean asDictionaryGml33()
          Find out if this class has to be output as a dictionary.
 boolean asGroup()
          If a <> class has a tagged value "asGroup" with a value "true" then it is encoded as a global group which is referenced wherever a property is defined that has the union class as its value.
 ClassInfo baseClass()
           
 Vector<Constraint> constraints()
           
 GenericClassInfo createCopy(String copyId, String copyName, int copyCategory)
           
 String documentation()
           
 String fullName()
          Fully qualified UML name.
 StructuredNumber getNextSequenceNumber()
           
 boolean hasConstraints()
           
 boolean hasNilReason()
           
 boolean hasSubtypes()
           
 boolean hasSupertypes()
           
 String id()
           
 boolean includeByValuePropertyType()
          Determine whether a property type shall be included in the schema for the object type that does not support Xlinks but requires encoding the property value inline.
 boolean includePropertyType()
          Determine whether a standard property type shall be included in the schema.
 boolean isAbstract()
           
 AssociationInfo isAssocClass()
           
 boolean isCollection()
          This predicate determines if the class is a collection.
 boolean isLeaf()
           
 String message(int mnr)
          Return a message for a message number.
 GenericModel model()
           
 String name()
           
 OperationInfo operation(String name, String[] types)
          NOTE: Operations are currently not supported
 Options options()
           
 PackageInfo pkg()
           
 TreeMap<StructuredNumber,PropertyInfo> properties()
           
 PropertyInfo property(String name)
          Find the property given by its name in this class or (if not present there) recursively in its base classes / supertypes.
 GenericPropertyInfo propertyByName(String name)
           
 void removeByStructuredNumber(StructuredNumber sn)
          Removes the property from this class where property.sequenceNumber().equals(sn).
 ShapeChangeResult result()
           
 void setAliasName(String aliasName)
           
 void setAsCharacterString(boolean asCharacterString)
           
 void setAsDictionary(boolean asDictionary)
           
 void setAsDictionaryGml33(boolean asDictionaryGml33)
           
 void setAsGroup(boolean asGroup)
           
 void setAssocInfo(AssociationInfo assocClass)
           
 void setBaseClass(ClassInfo baseClass)
           
 void setCategory(int category)
           
 void setConstraints(Vector<Constraint> constraints)
           
 void setDocumentation(String documentation)
           
 void setHasNilReason(boolean hasNilReason)
           
 void setId(String id)
           
 void setIncludeByValuePropertyType(boolean includeByValuePropertyType)
           
 void setIncludePropertyType(boolean includePropertyType)
           
 void setIsAbstract(boolean isAbstract)
           
 void setIsCollection(boolean isCollection)
           
 void setIsLeaf(boolean isLeaf)
           
 void setModel(GenericModel model)
           
 void setName(String name)
           
 void setOptions(Options options)
           
 void setPkg(PackageInfo pkg)
           
 void setProperties(TreeMap<StructuredNumber,PropertyInfo> properties)
           
 void setResult(ShapeChangeResult result)
           
 void setStereotype(String stereotype)
           
 void setStereotypes(Set<String> stereotypeSet)
           
 void setSubtypes(HashSet<String> subtypes)
           
 void setSupertypes(HashSet<String> supertypes)
           
 void setSuppressed(boolean suppressed)
           
 void setTaggedValue(String tvName, String tvValue, boolean updateFields)
           
 void setTaggedValues(HashMap<String,String> taggedValues, boolean updateFields)
           
 void setXmlSchemaType(String xmlSchemaType)
           
 Set<String> stereotypes()
           
 HashSet<String> subtypes()
          Returns the list of ids of the subtypes that belong to this class.
 HashSet<String> supertypes()
          Provides the ids of all base classes of this class.
 boolean suppressed()
          Determine whether this is a 'suppressed' class.
 String taggedValue(String tag)
           
 HashMap<String,String> taggedValues()
           
 HashMap<String,String> taggedValues(String tagList)
          Return all the tagged values listed in the input string.
 String toString(String indent)
           
 void updateSubtypeId(String currentId, String newId)
           
 void updateSupertypeId(String currentId, String newId)
          NOTE: does not update baseclass info
 String xmlSchemaType()
          Return the XML schema type corresponding to the class.
 
Methods inherited from class de.interactive_instruments.ShapeChange.Model.ClassInfoImpl
category, checkSupertypes, encodingRule, establishCategory, fixIfCategoryIsUnknown, getDiagrams, hasConstraint, inSchema, isKindOf, isSubtype, isUnionDirect, ns, nsabr, postprocessAfterLoadingAndValidate, processed, processed, qname, setDiagrams, unsuppressedSupertype
 
Methods inherited from class de.interactive_instruments.ShapeChange.Model.InfoImpl
definition, description, matches, stereotype
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.interactive_instruments.ShapeChange.Model.Info
definition, description, matches, stereotype
 

Field Detail

options

protected Options options

result

protected ShapeChangeResult result

model

protected GenericModel model

id

protected String id

name

protected String name

stereotypes

protected HashSet<String> stereotypes

taggedValues

protected HashMap<String,String> taggedValues

includePropertyType

protected boolean includePropertyType

includeByValuePropertyType

protected boolean includeByValuePropertyType

isCollection

protected boolean isCollection

asDictionary

protected boolean asDictionary

asGroup

protected boolean asGroup

asCharacterString

protected boolean asCharacterString

hasNilReason

protected boolean hasNilReason

pkg

protected PackageInfo pkg

isAbstract

protected boolean isAbstract

isLeaf

protected boolean isLeaf

assocClass

protected AssociationInfo assocClass

supertypes

protected HashSet<String> supertypes
Set of ids of all base classes of this class


subtypes

protected HashSet<String> subtypes

baseClass

protected ClassInfo baseClass

properties

protected TreeMap<StructuredNumber,PropertyInfo> properties

constraints

protected Vector<Constraint> constraints
Not null


suppressed

protected boolean suppressed

asDictionaryGml33

protected boolean asDictionaryGml33

xmlSchemaType

protected String xmlSchemaType
Constructor Detail

GenericClassInfo

public GenericClassInfo(GenericModel model,
                        String id,
                        String name,
                        int category)
Method Detail

setXmlSchemaType

public void setXmlSchemaType(String xmlSchemaType)
Parameters:
xmlSchemaType - the xmlSchemaType to set

setIncludePropertyType

public void setIncludePropertyType(boolean includePropertyType)
Parameters:
includePropertyType - the includePropertyType to set

setIncludeByValuePropertyType

public void setIncludeByValuePropertyType(boolean includeByValuePropertyType)
Parameters:
includeByValuePropertyType - the includeByValuePropertyType to set

setIsCollection

public void setIsCollection(boolean isCollection)
Parameters:
isCollection - the isCollection to set

setAsDictionary

public void setAsDictionary(boolean asDictionary)
Parameters:
asDictionary - the asDictionary to set

setAsGroup

public void setAsGroup(boolean asGroup)
Parameters:
asGroup - the asGroup to set

setAsCharacterString

public void setAsCharacterString(boolean asCharacterString)
Parameters:
asCharacterString - the asCharacterString to set

setHasNilReason

public void setHasNilReason(boolean hasNilReason)
Parameters:
hasNilReason - the hasNilReason to set

setPkg

public void setPkg(PackageInfo pkg)
Parameters:
pkg - the pkg to set

setIsAbstract

public void setIsAbstract(boolean isAbstract)
Parameters:
isAbstract - the isAbstract to set

setIsLeaf

public void setIsLeaf(boolean isLeaf)
Parameters:
isLeaf - the isLeaf to set

setAssocInfo

public void setAssocInfo(AssociationInfo assocClass)
Parameters:
isAssocClass - the isAssocClass to set

setSupertypes

public void setSupertypes(HashSet<String> supertypes)
Parameters:
supertypes - the supertypes to set

setSubtypes

public void setSubtypes(HashSet<String> subtypes)
Parameters:
subtypes - the subtypes to set

setBaseClass

public void setBaseClass(ClassInfo baseClass)
Parameters:
baseClass - the baseClass to set

setProperties

public void setProperties(TreeMap<StructuredNumber,PropertyInfo> properties)
Parameters:
properties - the properties to set

setConstraints

public void setConstraints(Vector<Constraint> constraints)
Parameters:
constraints - the constraints to set

setSuppressed

public void setSuppressed(boolean suppressed)
Parameters:
suppressed - the suppressed to set

setAsDictionaryGml33

public void setAsDictionaryGml33(boolean asDictionaryGml33)
Parameters:
asDictionaryGml33 - the asDictionaryGml33 to set

stereotypes

public Set<String> stereotypes()
Specified by:
stereotypes in interface Info
See Also:
Info.stereotypes()

aliasName

public String aliasName()
Description copied from class: InfoImpl
Retrieve the alias, typically a human readable name

Specified by:
aliasName in interface Info
Overrides:
aliasName in class InfoImpl
Returns:
the human readable name or an empty string if none exists
See Also:
InfoImpl.aliasName()

documentation

public String documentation()
Specified by:
documentation in interface Info
Overrides:
documentation in class InfoImpl
See Also:
InfoImpl.documentation()

fullName

public String fullName()
Description copied from interface: Info
Fully qualified UML name.

Specified by:
fullName in interface Info
Overrides:
fullName in class ClassInfoImpl
See Also:
PackageInfoImpl.fullName()

id

public String id()
Specified by:
id in interface Info
See Also:
Info.id()

model

public GenericModel model()
Specified by:
model in interface Info
See Also:
Info.model()

name

public String name()
Specified by:
name in interface Info
See Also:
Info.name()

options

public Options options()
Specified by:
options in interface Info
See Also:
Info.options()

result

public ShapeChangeResult result()
Specified by:
result in interface Info
See Also:
Info.result()

setAliasName

public void setAliasName(String aliasName)
Parameters:
aliasName -

setDocumentation

public void setDocumentation(String documentation)
Parameters:
documentation -

setId

public void setId(String id)
Parameters:
id -

setModel

public void setModel(GenericModel model)
Parameters:
model -

setName

public void setName(String name)
Parameters:
name -

setOptions

public void setOptions(Options options)
Parameters:
options -

setResult

public void setResult(ShapeChangeResult result)
Parameters:
result -

setStereotypes

public void setStereotypes(Set<String> stereotypeSet)
Parameters:
stereotypeSet -

setStereotype

public void setStereotype(String stereotype)
Parameters:
stereotype -

setTaggedValues

public void setTaggedValues(HashMap<String,String> taggedValues,
                            boolean updateFields)
Parameters:
taggedValues -
updateFields - true if class fields should be updated based upon information from given tagged values, else false

hasNilReason

public boolean hasNilReason()
Specified by:
hasNilReason in interface ClassInfo
See Also:
ClassInfo.hasNilReason()

pkg

public PackageInfo pkg()
Specified by:
pkg in interface ClassInfo
See Also:
ClassInfo.pkg()

isAbstract

public boolean isAbstract()
Specified by:
isAbstract in interface ClassInfo
See Also:
ClassInfo.isAbstract()

isLeaf

public boolean isLeaf()
Specified by:
isLeaf in interface ClassInfo
See Also:
ClassInfo.isLeaf()

isAssocClass

public AssociationInfo isAssocClass()
Specified by:
isAssocClass in interface ClassInfo
See Also:
ClassInfo.isAssocClass()

supertypes

public HashSet<String> supertypes()
Description copied from interface: ClassInfo
Provides the ids of all base classes of this class.

Specified by:
supertypes in interface ClassInfo
Returns:
Set of ids of the base classes of this class.
See Also:
ClassInfo.supertypes()

subtypes

public HashSet<String> subtypes()
Returns the list of ids of the subtypes that belong to this class.

NOTE: does NOT return a shallow copy, thus modifications of the returned set will modify the subtype information for this class

Specified by:
subtypes in interface ClassInfo
Returns:
Set with the ids of all subtypes of this class (WARNING: this can be a shallow copy or derived set, thus it is not safe to assume that modifications to this set will update the subtype information in the class itself).
See Also:
ClassInfo.subtypes()

hasSupertypes

public boolean hasSupertypes()

hasConstraints

public boolean hasConstraints()

hasSubtypes

public boolean hasSubtypes()

baseClass

public ClassInfo baseClass()
Specified by:
baseClass in interface ClassInfo
See Also:
ClassInfo.baseClass()

properties

public TreeMap<StructuredNumber,PropertyInfo> properties()
Specified by:
properties in interface ClassInfo
See Also:
ClassInfo.properties()

constraints

public Vector<Constraint> constraints()
Specified by:
constraints in interface ClassInfo
See Also:
ClassInfo.constraints()

property

public PropertyInfo property(String name)
Find the property given by its name in this class or (if not present there) recursively in its base classes / supertypes.

Specified by:
property in interface ClassInfo
Returns:
See Also:
de.interactive_instruments.ShapeChange.Model.ClassInfo#property(java. lang.String)

operation

public OperationInfo operation(String name,
                               String[] types)
NOTE: Operations are currently not supported

Specified by:
operation in interface ClassInfo
See Also:
de.interactive_instruments.ShapeChange.Model.ClassInfo#operation(java .lang.String, java.lang.String[])

taggedValue

public String taggedValue(String tag)
Specified by:
taggedValue in interface Info
Parameters:
tag - name of the tagged value to look up
Returns:
the tagged value for the tag given or null if the tagged value is missing.
See Also:
Info.taggedValue(java.lang.String)

taggedValues

public HashMap<String,String> taggedValues()
Specified by:
taggedValues in interface Info
Returns:
a map with the tagged values defined for this object (key: tagged value name, value: the value of the tagged value); can be an empty map but not null
See Also:
Info.taggedValues()

taggedValues

public HashMap<String,String> taggedValues(String tagList)
Description copied from interface: Info
Return all the tagged values listed in the input string. Tags are assumed to be separated by commas.

Specified by:
taggedValues in interface Info
See Also:
Info.taggedValues(java.lang.String)

xmlSchemaType

public String xmlSchemaType()
Description copied from class: ClassInfoImpl
Return the XML schema type corresponding to the class. This is contained in the tagged value with tag 'xmlSchemaType'. If this is not specified, null is returned.

Specified by:
xmlSchemaType in interface ClassInfo
Overrides:
xmlSchemaType in class ClassInfoImpl
See Also:
ClassInfoImpl.xmlSchemaType()

includeByValuePropertyType

public boolean includeByValuePropertyType()
Description copied from class: ClassInfoImpl
Determine whether a property type shall be included in the schema for the object type that does not support Xlinks but requires encoding the property value inline.

Specified by:
includeByValuePropertyType in interface ClassInfo
Overrides:
includeByValuePropertyType in class ClassInfoImpl
See Also:
ClassInfoImpl.includeByValuePropertyType()

includePropertyType

public boolean includePropertyType()
Description copied from class: ClassInfoImpl
Determine whether a standard property type shall be included in the schema. This applies for classes that are object or data types.

Specified by:
includePropertyType in interface ClassInfo
Overrides:
includePropertyType in class ClassInfoImpl
See Also:
ClassInfoImpl.includePropertyType()

isCollection

public boolean isCollection()
Description copied from class: ClassInfoImpl
This predicate determines if the class is a collection. This is done by inspecting the associated tagged value.

Specified by:
isCollection in interface ClassInfo
Overrides:
isCollection in class ClassInfoImpl
See Also:
ClassInfoImpl.isCollection()

asDictionary

public boolean asDictionary()
Description copied from class: ClassInfoImpl
Find out if this class has to be output as a dictionary.

Specified by:
asDictionary in interface ClassInfo
Overrides:
asDictionary in class ClassInfoImpl
See Also:
ClassInfoImpl.asDictionary()

asDictionaryGml33

public boolean asDictionaryGml33()
Description copied from class: ClassInfoImpl
Find out if this class has to be output as a dictionary.

Specified by:
asDictionaryGml33 in interface ClassInfo
Overrides:
asDictionaryGml33 in class ClassInfoImpl
See Also:
ClassInfoImpl.asDictionaryGml33()

asGroup

public boolean asGroup()
Description copied from class: ClassInfoImpl
If a <> class has a tagged value "asGroup" with a value "true" then it is encoded as a global group which is referenced wherever a property is defined that has the union class as its value. Note that this is only valid, if it is clear from the context how to map the individual values to the conceptual model.

Specified by:
asGroup in interface ClassInfo
Overrides:
asGroup in class ClassInfoImpl
See Also:
ClassInfoImpl.asGroup()

asCharacterString

public boolean asCharacterString()
Description copied from class: ClassInfoImpl
If a <> class has a tagged value "gmlAsCharacterString" with a value "true" it will be translated into an xsd:string simple type regardless of how it is actually built.
Note: This is experimental code which is prone to being removed as soon as a better solution for the problem at hand is found.

Specified by:
asCharacterString in interface ClassInfo
Overrides:
asCharacterString in class ClassInfoImpl
See Also:
ClassInfoImpl.asCharacterString()

suppressed

public boolean suppressed()
Description copied from class: ClassInfoImpl
Determine whether this is a 'suppressed' class. A suppressed class is for attaching constraints to its next direct or indirect unsuppressed superclass.

Specified by:
suppressed in interface ClassInfo
Overrides:
suppressed in class ClassInfoImpl
See Also:
ClassInfoImpl.suppressed()

toString

public String toString(String indent)

setCategory

public void setCategory(int category)
Parameters:
category -

addProperty

public void addProperty(GenericPropertyInfo newProperty,
                        GenericModel.PropertyCopyDuplicatBehaviorIndicator duplicateHandling)
Adds the new property to the set of properties of this class. The behavior for adding a property that has the same name as an existing one is determined by a parameter.

Parameters:
newProperty -
duplicateHandling -

getNextSequenceNumber

public StructuredNumber getNextSequenceNumber()

addConstraints

public void addConstraints(Vector<Constraint> newConstraints)

updateSubtypeId

public void updateSubtypeId(String currentId,
                            String newId)

updateSupertypeId

public void updateSupertypeId(String currentId,
                              String newId)
NOTE: does not update baseclass info

Parameters:
currentId -
newId -

createCopy

public GenericClassInfo createCopy(String copyId,
                                   String copyName,
                                   int copyCategory)

removeByStructuredNumber

public void removeByStructuredNumber(StructuredNumber sn)
Removes the property from this class where property.sequenceNumber().equals(sn).

Parameters:
sn -

addPropertiesAtTop

public void addPropertiesAtTop(List<GenericPropertyInfo> newProps,
                               GenericModel.PropertyCopyDuplicatBehaviorIndicator duplicateHandling)
Adds the given list of new properties to this class. Their sequence numbers are used as-is. However, the sequence numbers of the already existing properties are shifted to "make space" for the new properties. The sequence/list of new properties will thus be placed before the existing properties, at the "top" of the list of class properties. The behavior for adding a property that has the same name as an existing one is determined by a parameter.

Parameters:
newProps -
duplicateHandling -

propertyByName

public GenericPropertyInfo propertyByName(String name)
Parameters:
name -
Returns:
The property with the given name, or null if no such property exists.

addPropertiesInSequence

public void addPropertiesInSequence(List<GenericPropertyInfo> newProps,
                                    GenericModel.PropertyCopyDuplicatBehaviorIndicator duplicateHandling)
Adds the given list of new properties to this class. Their sequence numbers are used as-is. The sequence/list of new properties will thus be merged with the existing properties. Sequence numbers may be duplicate (though still be different objects). The behavior for adding a property that has the same name as an existing one is determined by a parameter.

Parameters:
newProps -
duplicateHandling -

addPropertiesAtBottom

public void addPropertiesAtBottom(List<GenericPropertyInfo> newProps,
                                  GenericModel.PropertyCopyDuplicatBehaviorIndicator duplicateHandling)
Adds the given list of new properties to this class. Their sequence numbers are shifted so that the sequence/list of new properties is placed after the existing properties, at the "bottom" of the list of class properties. The behavior for adding a property that has the same name as an existing one is determined by a parameter.

Parameters:
newProps -
duplicateHandling -

message

public String message(int mnr)
Description copied from interface: MessageSource
Return a message for a message number.

Specified by:
message in interface MessageSource

setTaggedValue

public void setTaggedValue(String tvName,
                           String tvValue,
                           boolean updateFields)
Parameters:
tvName -
tvValue -
updateFields - true if class fields should be updated based upon information from given tagged value, else false


Copyright © 2015. All rights reserved.