de.interactive_instruments.ShapeChange.Transformation.Flattening
Class Flattener

java.lang.Object
  extended by de.interactive_instruments.ShapeChange.Transformation.Flattening.Flattener
All Implemented Interfaces:
Transformer

public class Flattener
extends Object
implements Transformer

Encapsulates the logic for flattening/simplifying complex constructs within an application schema.

Author:
Johannes Echterhoff (echterhoff interactive-instruments de)

Field Summary
static String CHARACTER_STRING_CLASS_ID
           
static String PARAM_FLATTEN_OBJECT_TYPES
           
static String PARAM_FLATTEN_OBJECT_TYPES_INCLUDE_REGEX
           
static String PARAM_HOMOGENEOUSGEOMETRIES_APPLY_ON_SUBTYPES
           
static String PARAM_HOMOGENEOUSGEOMETRIES_OMIT_RULE_FOR_CASE_OF_SINGLE_GEOMETRY_PROP
           
static String PARAM_IGNORE_FEATURE_OR_OBJECT_TYPED_PROPERTIES
           
static String PARAM_INHERITANCE_INCLUDE_REGEX
           
static String PARAM_MAXOCCURS
           
static String PARAM_MAXOCCURS_FOR_SPECIFIC_PROPERTIES
           
static String REQ_FLATTEN_TYPES_IDENTIFY_CIRCULAR_DEPENDENCIES
          If this requirement is included in the encoding rules together with "rule-trf-prop-flatten-types" then the Flattener will, before applying the rule, create a graph of selected schema types.
static String RULE_TRF_ALL_FLATTEN_CODELISTS
           
static String RULE_TRF_ALL_FLATTEN_CONSTRAINTS
           
static String RULE_TRF_ALL_FLATTEN_NAME
           
static String RULE_TRF_ALL_REMOVETYPE
           
static String RULE_TRF_CLS_FLATTEN_INHERITANCE
           
static String RULE_TRF_PROP_FLATTEN_HOMOGENEOUSGEOMETRIES
           
static String RULE_TRF_PROP_FLATTEN_MULTIPLICITY
           
static String RULE_TRF_PROP_FLATTEN_ONINAS
           
static String RULE_TRF_PROP_FLATTEN_TYPES
           
static String RULE_TRF_PROP_OPTIONALITY
           
static String RULE_TRF_PROP_REMOVE_NAME_AND_ALIAS_COMPONENT
           
static String RULE_TRF_PROP_REMOVE_NAME_AND_CODE_COMPONENT
           
static String RULE_TRF_PROP_UNION_DIRECT_OPTIONALITY
           
static String TAGGED_VALUE_IS_FLAT_TARGET
          Name of the tagged value that provides further information on type flattening direction for an undirected association.
static String TRANSFORMER_ALIAS_FOR_ENUMERATION_VALUES
           
static String TRANSFORMER_CODE_FOR_ENUMERATION_VALUES
           
static String TRANSFORMER_CODEBY_TAGGEDVALUE
           
static String TRANSFORMER_ENFORCE_OPTIONALITY
           
static String TRANSFORMER_KEEP_ORIGINAL_NAME_AS_ALIAS
           
static String TRANSFORMER_KEEP_ORIGINAL_NAME_AS_CODE
           
static String TRANSFORMER_LOWER_CASE_ALIAS_FOR_PROPERTIES
           
static String TRANSFORMER_LOWER_CASE_CODE_FOR_PROPERTIES
           
static String TRANSFORMER_NAMESPACE_SUFFIX_PARAMETER
           
static String TRANSFORMER_REMOVE_PROPERTY_NAME_AND_ALIAS_COMPONENT
           
static String TRANSFORMER_REMOVE_PROPERTY_NAME_AND_CODE_COMPONENT
           
static String TRANSFORMER_REMOVE_TYPE_PARAMETER
           
static String TRANSFORMER_SEPARATOR_FOR_PROPERTY_FROM_NON_UNION
           
static String TRANSFORMER_SEPARATOR_FOR_PROPERTY_FROM_UNION
           
static String TRANSFORMER_SEPARATOR_FOR_PROPERTY_INDEX_NUMBER
           
 
Constructor Summary
Flattener()
           
 
Method Summary
protected  String join(Set<String> parts, String delimiter)
          Creates a string that contains the parts, separated by the given delimiter (if null it defaults to the empty string).
 void process(GenericModel genModel, Options options, TransformerConfiguration trfConfig, ShapeChangeResult result)
          Processes the model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRANSFORMER_NAMESPACE_SUFFIX_PARAMETER

public static final String TRANSFORMER_NAMESPACE_SUFFIX_PARAMETER
See Also:
Constant Field Values

TRANSFORMER_REMOVE_TYPE_PARAMETER

public static final String TRANSFORMER_REMOVE_TYPE_PARAMETER
See Also:
Constant Field Values

TRANSFORMER_LOWER_CASE_ALIAS_FOR_PROPERTIES

public static final String TRANSFORMER_LOWER_CASE_ALIAS_FOR_PROPERTIES
See Also:
Constant Field Values

TRANSFORMER_LOWER_CASE_CODE_FOR_PROPERTIES

public static final String TRANSFORMER_LOWER_CASE_CODE_FOR_PROPERTIES
See Also:
Constant Field Values

TRANSFORMER_ALIAS_FOR_ENUMERATION_VALUES

public static final String TRANSFORMER_ALIAS_FOR_ENUMERATION_VALUES
See Also:
Constant Field Values

TRANSFORMER_CODE_FOR_ENUMERATION_VALUES

public static final String TRANSFORMER_CODE_FOR_ENUMERATION_VALUES
See Also:
Constant Field Values

TRANSFORMER_ENFORCE_OPTIONALITY

public static final String TRANSFORMER_ENFORCE_OPTIONALITY
See Also:
Constant Field Values

TRANSFORMER_KEEP_ORIGINAL_NAME_AS_ALIAS

public static final String TRANSFORMER_KEEP_ORIGINAL_NAME_AS_ALIAS
See Also:
Constant Field Values

TRANSFORMER_KEEP_ORIGINAL_NAME_AS_CODE

public static final String TRANSFORMER_KEEP_ORIGINAL_NAME_AS_CODE
See Also:
Constant Field Values

TRANSFORMER_SEPARATOR_FOR_PROPERTY_FROM_UNION

public static final String TRANSFORMER_SEPARATOR_FOR_PROPERTY_FROM_UNION
See Also:
Constant Field Values

TRANSFORMER_SEPARATOR_FOR_PROPERTY_FROM_NON_UNION

public static final String TRANSFORMER_SEPARATOR_FOR_PROPERTY_FROM_NON_UNION
See Also:
Constant Field Values

TRANSFORMER_SEPARATOR_FOR_PROPERTY_INDEX_NUMBER

public static final String TRANSFORMER_SEPARATOR_FOR_PROPERTY_INDEX_NUMBER
See Also:
Constant Field Values

TRANSFORMER_REMOVE_PROPERTY_NAME_AND_ALIAS_COMPONENT

public static final String TRANSFORMER_REMOVE_PROPERTY_NAME_AND_ALIAS_COMPONENT
See Also:
Constant Field Values

TRANSFORMER_REMOVE_PROPERTY_NAME_AND_CODE_COMPONENT

public static final String TRANSFORMER_REMOVE_PROPERTY_NAME_AND_CODE_COMPONENT
See Also:
Constant Field Values

TRANSFORMER_CODEBY_TAGGEDVALUE

public static final String TRANSFORMER_CODEBY_TAGGEDVALUE
See Also:
Constant Field Values

PARAM_INHERITANCE_INCLUDE_REGEX

public static final String PARAM_INHERITANCE_INCLUDE_REGEX
See Also:
Constant Field Values

PARAM_FLATTEN_OBJECT_TYPES

public static final String PARAM_FLATTEN_OBJECT_TYPES
See Also:
Constant Field Values

PARAM_FLATTEN_OBJECT_TYPES_INCLUDE_REGEX

public static final String PARAM_FLATTEN_OBJECT_TYPES_INCLUDE_REGEX
See Also:
Constant Field Values

PARAM_MAXOCCURS

public static final String PARAM_MAXOCCURS
See Also:
Constant Field Values

PARAM_MAXOCCURS_FOR_SPECIFIC_PROPERTIES

public static final String PARAM_MAXOCCURS_FOR_SPECIFIC_PROPERTIES
See Also:
Constant Field Values

PARAM_IGNORE_FEATURE_OR_OBJECT_TYPED_PROPERTIES

public static final String PARAM_IGNORE_FEATURE_OR_OBJECT_TYPED_PROPERTIES
See Also:
Constant Field Values

PARAM_HOMOGENEOUSGEOMETRIES_APPLY_ON_SUBTYPES

public static final String PARAM_HOMOGENEOUSGEOMETRIES_APPLY_ON_SUBTYPES
See Also:
Constant Field Values

PARAM_HOMOGENEOUSGEOMETRIES_OMIT_RULE_FOR_CASE_OF_SINGLE_GEOMETRY_PROP

public static final String PARAM_HOMOGENEOUSGEOMETRIES_OMIT_RULE_FOR_CASE_OF_SINGLE_GEOMETRY_PROP
See Also:
Constant Field Values

RULE_TRF_ALL_FLATTEN_CODELISTS

public static final String RULE_TRF_ALL_FLATTEN_CODELISTS
See Also:
Constant Field Values

RULE_TRF_ALL_FLATTEN_CONSTRAINTS

public static final String RULE_TRF_ALL_FLATTEN_CONSTRAINTS
See Also:
Constant Field Values

RULE_TRF_ALL_FLATTEN_NAME

public static final String RULE_TRF_ALL_FLATTEN_NAME
See Also:
Constant Field Values

RULE_TRF_ALL_REMOVETYPE

public static final String RULE_TRF_ALL_REMOVETYPE
See Also:
Constant Field Values

RULE_TRF_CLS_FLATTEN_INHERITANCE

public static final String RULE_TRF_CLS_FLATTEN_INHERITANCE
See Also:
Constant Field Values

RULE_TRF_PROP_FLATTEN_HOMOGENEOUSGEOMETRIES

public static final String RULE_TRF_PROP_FLATTEN_HOMOGENEOUSGEOMETRIES
See Also:
Constant Field Values

RULE_TRF_PROP_FLATTEN_MULTIPLICITY

public static final String RULE_TRF_PROP_FLATTEN_MULTIPLICITY
See Also:
Constant Field Values

RULE_TRF_PROP_FLATTEN_ONINAS

public static final String RULE_TRF_PROP_FLATTEN_ONINAS
See Also:
Constant Field Values

RULE_TRF_PROP_FLATTEN_TYPES

public static final String RULE_TRF_PROP_FLATTEN_TYPES
See Also:
Constant Field Values

RULE_TRF_PROP_OPTIONALITY

public static final String RULE_TRF_PROP_OPTIONALITY
See Also:
Constant Field Values

RULE_TRF_PROP_REMOVE_NAME_AND_ALIAS_COMPONENT

public static final String RULE_TRF_PROP_REMOVE_NAME_AND_ALIAS_COMPONENT
See Also:
Constant Field Values

RULE_TRF_PROP_REMOVE_NAME_AND_CODE_COMPONENT

public static final String RULE_TRF_PROP_REMOVE_NAME_AND_CODE_COMPONENT
See Also:
Constant Field Values

RULE_TRF_PROP_UNION_DIRECT_OPTIONALITY

public static final String RULE_TRF_PROP_UNION_DIRECT_OPTIONALITY
See Also:
Constant Field Values

REQ_FLATTEN_TYPES_IDENTIFY_CIRCULAR_DEPENDENCIES

public static final String REQ_FLATTEN_TYPES_IDENTIFY_CIRCULAR_DEPENDENCIES
If this requirement is included in the encoding rules together with "rule-trf-prop-flatten-types" then the Flattener will, before applying the rule, create a graph of selected schema types. Types that are not flattened will be excluded from the graph, i.e. especially feature types and - if they are not flattened - object types. Edges within the graph represent navigable routes (each edge from type A to type B contains the set of properties in type A that have B as value type). When creating edges, the flattener takes into account additional information that might override navigability between types, like the tagged value "isFlatTarget". The flattener will then identify all circles that may exist in the graph, logging them on log level INFO.

See Also:
Constant Field Values

CHARACTER_STRING_CLASS_ID

public static final String CHARACTER_STRING_CLASS_ID
See Also:
Constant Field Values

TAGGED_VALUE_IS_FLAT_TARGET

public static final String TAGGED_VALUE_IS_FLAT_TARGET
Name of the tagged value that provides further information on type flattening direction for an undirected association. If one end (i.e. a property) of a bi-directional association has isFlatTarget tagged value = true while the other end has not, then its type is flattened (i.e. properties of the value type are flattened to the inClass of the property) while the other association end is ignored. However, if the other association end also has isFlatTarget=true, then the whole setting is ignored (because then there is no way to tell a difference) and a warning logged. Applies to rule "rule-trf-prop-flatten-types"

See Also:
Constant Field Values
Constructor Detail

Flattener

public Flattener()
Method Detail

process

public void process(GenericModel genModel,
                    Options options,
                    TransformerConfiguration trfConfig,
                    ShapeChangeResult result)
             throws ShapeChangeAbortException
Description copied from interface: Transformer
Processes the model. The given model is changed by the Transformer. NOTE: The TransformationManager ensures that this can be done without side-effects.

Specified by:
process in interface Transformer
Parameters:
genModel - The model to process.
options - Options to control the process execution.
result - Logging target.
Throws:
ShapeChangeAbortException

join

protected String join(Set<String> parts,
                      String delimiter)
Creates a string that contains the parts, separated by the given delimiter (if null it defaults to the empty string). If the set contains a null element, it is ignored. Joins the parts in the order returned by the iterator. If order of the set is important, ensure that an ordered set is used (e.g. TreeSet).

Parameters:
parts -
delimiter -
Returns:


Copyright © 2015. All rights reserved.