de.interactive_instruments.ShapeChange.Model
Class ClassInfoImpl

java.lang.Object
  extended by de.interactive_instruments.ShapeChange.Model.InfoImpl
      extended by de.interactive_instruments.ShapeChange.Model.ClassInfoImpl
All Implemented Interfaces:
ClassInfo, Info
Direct Known Subclasses:
ClassInfoEA, ClassInfoGSIP, ClassInfoXmi10, GenericClassInfo

public abstract class ClassInfoImpl
extends InfoImpl
implements ClassInfo


Field Summary
protected  int category
          Category of the class according to ISO 19136 (and ShapeChange extensions)
protected  List<ImageMetadata> diagrams
           
protected  int processed
          Bit mask for target types for which the class has been processed
 
Fields inherited from class de.interactive_instruments.ShapeChange.Model.InfoImpl
aliasName, definition, description, documentation
 
Constructor Summary
ClassInfoImpl()
           
 
Method Summary
 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.
 int category()
          Return the category of the class.
 boolean checkSupertypes(int cat)
          This is supposed to find out, whether the given category 'cat' applied in 'this' class complies to the categories of all its base classes.
 String encodingRule(String platform)
          Return the encoding rule relevant on the class, given the platform
 void establishCategory()
          Establish category.
 void fixIfCategoryIsUnknown()
          Fix the category of a class, which from its stereotypes alone has not been assigned UNKONWN.
 String fullName()
          Fully qualified UML name.
 List<ImageMetadata> getDiagrams()
           
 boolean hasConstraint(String name)
          Find out whether this class owns a constraint of the given name.
 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 inSchema(PackageInfo pi)
          Check whether the class and the package pi are part of the same schema (= XML namespace).
 boolean isCollection()
          This predicate determines if the class is a collection.
 boolean isKindOf(String supertype)
           
 boolean isSubtype(ClassInfo ci)
          Determine whether this type is a direct or indirect subtype of the argument type.
 boolean isUnionDirect()
          Special case of a <> with two properties (value and reasons) that can be mapped to a native nil/void/null mechanism in some implementation environments, e.g.
 String ns()
           
 String nsabr()
           
 void postprocessAfterLoadingAndValidate()
          Postprocess the class to execute any actions that require that the complete model has been loaded.
 boolean processed(int t)
          Check if the class has been processed already for a target type (the target types are bit masked).
 void processed(int t, boolean p)
          Set that the class has been processed already for a target type (the target types are bit masked).
 String qname()
          Return the namespace-prefixed class name.
 void setDiagrams(List<ImageMetadata> diagrams)
           
 boolean suppressed()
          Determine whether this is a 'suppressed' class.
 ClassInfo unsuppressedSupertype(boolean permitAbstract)
          Find the next direct or indirect superclass of this class which is not suppressed.
 String xmlSchemaType()
          Return the XML schema type corresponding to the class.
 
Methods inherited from class de.interactive_instruments.ShapeChange.Model.InfoImpl
aliasName, definition, description, documentation, 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.ClassInfo
baseClass, constraints, hasNilReason, isAbstract, isAssocClass, isLeaf, operation, pkg, properties, property, subtypes, supertypes
 
Methods inherited from interface de.interactive_instruments.ShapeChange.Model.Info
aliasName, definition, description, documentation, id, matches, model, name, options, result, stereotype, stereotypes, taggedValue, taggedValues, taggedValues
 

Field Detail

category

protected int category
Category of the class according to ISO 19136 (and ShapeChange extensions)


processed

protected int processed
Bit mask for target types for which the class has been processed


diagrams

protected List<ImageMetadata> diagrams
Constructor Detail

ClassInfoImpl

public ClassInfoImpl()
Method Detail

nsabr

public String nsabr()

ns

public String ns()

encodingRule

public String encodingRule(String platform)
Return the encoding rule relevant on the class, given the platform

Specified by:
encodingRule in interface Info
Overrides:
encodingRule in class InfoImpl
Returns:
the encoding rule relevant on the element

xmlSchemaType

public String xmlSchemaType()
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

includeByValuePropertyType

public 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.

Specified by:
includeByValuePropertyType in interface ClassInfo

includePropertyType

public boolean includePropertyType()
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

isCollection

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

Specified by:
isCollection in interface ClassInfo

asDictionary

public boolean asDictionary()
Find out if this class has to be output as a dictionary.

Specified by:
asDictionary in interface ClassInfo

asDictionaryGml33

public boolean asDictionaryGml33()
Find out if this class has to be output as a dictionary.

Specified by:
asDictionaryGml33 in interface ClassInfo

asGroup

public 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. 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

asCharacterString

public 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.
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

establishCategory

public void establishCategory()
                       throws ShapeChangeAbortException
Establish category. This auxiliary function determines the category of the class (being a FeatureType, a Codelist, a Union etc) from its stereotype. It is an error, if a class carries a stereotype not recognized by ShapeChange.

Throws:
ShapeChangeAbortException

category

public int category()
Return the category of the class.

Specified by:
category in interface ClassInfo

fixIfCategoryIsUnknown

public void fixIfCategoryIsUnknown()
Fix the category of a class, which from its stereotypes alone has not been assigned UNKONWN. The correction is applied by fetching the missing category from one of the supertypes.


inSchema

public boolean inSchema(PackageInfo pi)
Check whether the class and the package pi are part of the same schema (= XML namespace).

Specified by:
inSchema in interface ClassInfo

qname

public String qname()
Return the namespace-prefixed class name. The namespace prefix is fetched from the package the class belongs to. If no prefix is found, the class name alone is returned.

Specified by:
qname in interface ClassInfo

processed

public boolean processed(int t)
Check if the class has been processed already for a target type (the target types are bit masked).

Specified by:
processed in interface ClassInfo

processed

public void processed(int t,
                      boolean p)
Set that the class has been processed already for a target type (the target types are bit masked).

Specified by:
processed in interface ClassInfo

checkSupertypes

public boolean checkSupertypes(int cat)
This is supposed to find out, whether the given category 'cat' applied in 'this' class complies to the categories of all its base classes. If at least one base class does not comply, 'false' is returned.

Specified by:
checkSupertypes in interface ClassInfo

isSubtype

public boolean isSubtype(ClassInfo ci)
Determine whether this type is a direct or indirect subtype of the argument type.

Specified by:
isSubtype in interface ClassInfo

isKindOf

public boolean isKindOf(String supertype)
Specified by:
isKindOf in interface ClassInfo

suppressed

public boolean suppressed()
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

unsuppressedSupertype

public ClassInfo unsuppressedSupertype(boolean permitAbstract)
Find the next direct or indirect superclass of this class which is not suppressed. Only concrete classes are considered if permitAbstract is false, otherwise also abstract classes are deemed a valid return values.
The logic of superclass determination is as defined by method baseClass().
If no such class can be found null is returned. If the class where we start (this class) is already found unsuppressed, then this class is returned.

Specified by:
unsuppressedSupertype in interface ClassInfo

hasConstraint

public boolean hasConstraint(String name)
Find out whether this class owns a constraint of the given name. More efficient overwrites should be added in the various models.

Specified by:
hasConstraint in interface ClassInfo

fullName

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

Specified by:
fullName in interface Info
See Also:
Info.fullName()

postprocessAfterLoadingAndValidate

public void postprocessAfterLoadingAndValidate()
Postprocess the class to execute any actions that require that the complete model has been loaded. Validate the class against all applicable requirements and recommendations.

Specified by:
postprocessAfterLoadingAndValidate in interface Info
Overrides:
postprocessAfterLoadingAndValidate in class InfoImpl

isUnionDirect

public boolean isUnionDirect()
Description copied from interface: ClassInfo
Special case of a <> with two properties (value and reasons) that can be mapped to a native nil/void/null mechanism in some implementation environments, e.g. XML Schema

Specified by:
isUnionDirect in interface ClassInfo
Returns:

getDiagrams

public List<ImageMetadata> getDiagrams()
Specified by:
getDiagrams in interface ClassInfo
Returns:
metadata about the diagrams relevant for this class, null if no diagrams are available

setDiagrams

public void setDiagrams(List<ImageMetadata> diagrams)
Specified by:
setDiagrams in interface ClassInfo
Parameters:
diagrams - metadata about the diagrams relevant for this class


Copyright © 2015. All rights reserved.