Class TransformationApi
- java.lang.Object
-
- com.opencloud.slee.upgrade.transformation.TransformationApi
-
public abstract class TransformationApi extends java.lang.Object
This class provides an API for writing transformation rules.
It provides a Java based DSL for writing the graphs of transformation rules directly.
Note: read the 'SLEE Data Transformation' section of the 'Operational Tools' user guide before using this API.
-
-
Constructor Summary
Constructors Constructor Description TransformationApi()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static ProfileAction
addAttribute(java.lang.String name, java.lang.Class<?> clazz, boolean defaultValue)
static ProfileAction
addAttribute(java.lang.String name, java.lang.Class<?> clazz, long defaultValue)
static ProfileAction
addAttribute(java.lang.String name, java.lang.Class<?> clazz, ObjectGenerator defaultValue)
static ProfileAction
addAttribute(java.lang.String name, java.lang.Class<?> clazz, ValueFunction function)
static ProfileAction
addAttribute(java.lang.String name, java.lang.Class<?> clazz, java.lang.String defaultValue)
static ProfileAction
addAttribute(java.lang.String name, java.lang.String type, boolean defaultValue)
static ProfileAction
addAttribute(java.lang.String name, java.lang.String type, long defaultValue)
static ProfileAction
addAttribute(java.lang.String name, java.lang.String type, ObjectGenerator defaultValue)
The addAttribute() action rule adds a new non-serialised attribute by specifying its name and type, and optionally a default value to be used when no other more specific value is given, and when an attribute value was not already present within the export data.static ProfileAction
addAttribute(java.lang.String name, java.lang.String type, ValueFunction function)
This is a specialized form of the addAttribute() rule, where the default value is the null value.static ProfileAction
addAttribute(java.lang.String name, java.lang.String type, java.lang.String defaultValue)
static ProfileAction
addAttribute(java.lang.String name, java.lang.String type, java.lang.String serialisationVersion, ObjectGenerator defaultValue)
The addAttribute() action rule adds a new serialised attribute by specifying its name and type, and optionally a default value to be used when no other more specific value is given, and when an attribute value was not already present within the export data.static ProfileAction
addAttribute(java.lang.String name, java.lang.String type, java.lang.String serialisationVersion, ValueFunction function)
Adds a serialised attribute.static ProfileAction
addAttribute(java.lang.String name, java.lang.String type, java.lang.String serialisationVersion, java.lang.String defaultValue)
Adds a serialised attribute.static ProfileAction
addAttributeAsNull(java.lang.String name, java.lang.Class<?> clazz)
This is a specialized form of the addAttribute() rule, where the default value is the null value.static ProfileAction
addAttributeAsNull(java.lang.String name, java.lang.String type)
This is a specialized form of the addAttribute() rule, where the default value is the null value.static ProfileAction
addAttributeAsNull(java.lang.String name, java.lang.String type, java.lang.String serialisationVersion)
Adds a serialised attribute.static RaConfigAction
addProperty(java.lang.String name, java.lang.Class<?> clazz, boolean defaultValue)
static RaConfigAction
addProperty(java.lang.String name, java.lang.Class<?> clazz, long defaultValue)
static RaConfigAction
addProperty(java.lang.String name, java.lang.Class<?> clazz, ObjectGenerator.StringGenerator defaultValue)
static RaConfigAction
addProperty(java.lang.String name, java.lang.Class<?> clazz, java.lang.String defaultValue)
static RaConfigAction
addProperty(java.lang.String name, java.lang.String type, boolean defaultValue)
static RaConfigAction
addProperty(java.lang.String name, java.lang.String type, long defaultValue)
static RaConfigAction
addProperty(java.lang.String name, java.lang.String type, ObjectGenerator.StringGenerator defaultValue)
Adds a configuration property to an RA entity.static RaConfigAction
addProperty(java.lang.String name, java.lang.String type, java.lang.String defaultValue)
static RaConfigAction
addPropertyAsNull(java.lang.String name, java.lang.Class<?> clazz)
This is a specialized form of addProperty that has null as the default value.static RaConfigAction
addPropertyAsNull(java.lang.String name, java.lang.String type)
This is a specialized form of addProperty that has null as the default value.static StringMatcher
anyString()
Returns a matcher object that matches any string.static ObjectGenerator
array()
Used for generating an empty array.static ObjectGenerator
array(ObjectGenerator... values)
Used for generating an array value, whose individual elements are generated in turn by the given generators, 1 value per generator.static ObjectGenerator
array(java.lang.Object... values)
Used for generating an array from arbitrary and mixed argument types.static ObjectGenerator
array(java.lang.String... values)
Used for generating a String array, with the given fixed values.static ProfileAction
changeAttributeType(java.lang.String name, java.lang.Class<?> clazz)
static ProfileAction
changeAttributeType(java.lang.String name, java.lang.String newType)
The changeAttributeType() rule changes the type of the name attribute.static ComponentMatcher
component(StringMatcher name, StringMatcher vendor, StringMatcher version)
static ComponentMatcher
component(StringMatcher name, StringMatcher vendor, java.lang.String version)
static ComponentMatcher
component(StringMatcher name, java.lang.String vendor, StringMatcher version)
static ComponentMatcher
component(StringMatcher name, java.lang.String vendor, java.lang.String version)
static ComponentMatcher
component(java.lang.String name, StringMatcher vendor, StringMatcher version)
static ComponentMatcher
component(java.lang.String name, StringMatcher vendor, java.lang.String version)
static ComponentMatcher
component(java.lang.String name, java.lang.String vendor, StringMatcher version)
static ComponentMatcher
component(java.lang.String name, java.lang.String vendor, java.lang.String version)
Returns a ComponentMatcher object for use by ProfileSpec context rules.
Each SLEE component is identified by name, vendor and version, and there are variants of this factory method that allow each of these to be specified as a constant string, or as aregex(java.lang.String)
oranyString()
.static ProfileAction
createProfile(java.lang.String name)
The createProfile() action rule is used to create a new named profile within a profile table.static ProfileTableCreationRule
createTable(java.lang.String tableName, java.lang.String specName, java.lang.String specVendor, java.lang.String specVersion)
The createTable() action rule is unique in that it is the one action rule that does not need to be enclosed in a context rule.static ProfileAction
doNotImportAttribute(java.lang.String name)
The doNotImportAttribute() action deletes a named attribute from the exported data for a profile table.static ProfileAction
doNotImportProfile()
The doNotImportProfile() rule deletes the profile from the export data.static ProfileAction
doNotImportProfileTable()
The doNotImportProfileTable() rule deletes an entire profile table from the export data.static RaConfigAction
doNotImportProperty(java.lang.String name)
This action rule deletes an RA configuration property from the exported data.static RaConfigAction
doNotImportRaEntity()
Deletes the RA entity from the exported data.static ValueFunction
functionArrayAddUniqueValues(java.lang.String... values)
Returns a function that only adds the unique given values to an array in a profile attribute value.static ValueFunction
functionArrayAppend(java.lang.String... values)
Returns a function that appends the given values to an array in a profile attribute value.static ValueFunction
functionArrayRemove(java.lang.String... values)
Returns a function that removes the given values from an array in a profile attribute value.static ValueFunction
functionForConstant(java.lang.Object value)
Returns a function which always returns the given value, which may be null.static ValueFunction
functionForDefaultProfileAndOthers(ValueFunction valueForDefaultProfile, ValueFunction valueForNonDefaultProfiles)
Returns a function that uses the first value if editing the default profile, or the second value if editing a non-default profile.static ValueFunction
functionForDefaultProfileAndOthers(ValueFunction valueForDefaultProfile, java.lang.String valueForNonDefaultProfiles)
static ValueFunction
functionForDefaultProfileAndOthers(java.lang.String valueForDefaultProfile, ValueFunction valueForNonDefaultProfiles)
static ValueFunction
functionForDefaultProfileAndOthers(java.lang.String valueForDefaultProfile, java.lang.String valueForNonDefaultProfiles)
ValueFunction
functionUplevelProfileAttribute()
Returns a function that uses the existing uplevel value for the relevant profile attribute.ValueFunction
functionUplevelProfileAttributeArray()
Returns a function that uses the existing uplevel value for the relevant profile attribute which has an array type.java.lang.String
getProfileAttribute(java.lang.String profileTable, java.lang.String profileName, java.lang.String attributeName)
Get the current (i.e. prior to upgrade) value of a profile attribute.java.lang.String[]
getProfileAttributeArray(java.lang.String profileTable, java.lang.String profileName, java.lang.String attributeName)
Get the current (i.e. prior to upgrade) value of a profile attribute which has an array type.java.lang.String[]
getProfileNames(java.lang.String profileTable)
Get an array of all the profile names in the specified profile table.java.lang.String
getRaProperty(java.lang.String entityName, java.lang.String propertyName)
Get the current (i.e. prior to upgrade) value of a property.java.lang.String
getUplevelProfileAttribute(java.lang.String profileTable, java.lang.String profileName, java.lang.String attributeName)
Get the uplevel (i.e. present in the upgraded version) value of a profile attribute.java.lang.String[]
getUplevelProfileAttributeArray(java.lang.String profileTable, java.lang.String profileName, java.lang.String attributeName)
Get the uplevel (i.e. present in the upgraded version) value of a profile attribute which has an array type.java.lang.String[]
getUplevelProfileNames(java.lang.String profileTable)
Gets an array of all the profile names in the uplevel version of the specified profile table.java.lang.String
getUplevelRaProperty(java.lang.String entityName, java.lang.String propertyName)
Get the uplevel (i.e. present in the upgraded version) value of a property.static ProfileRule
ifAttributeValue(java.lang.String name, StringMatcher value, ProfileRuleChild... children)
static ProfileRule
ifAttributeValue(java.lang.String name, java.lang.String value, ProfileRuleChild... children)
The ifAttributeValue() context rule will have its child rules applied only if the specified profile attribute matches the specified value.static ProfileRule
ifAttributeValueIsNull(java.lang.String name, ProfileRuleChild... children)
The ifAttributeValueIsNull() context rule is a specialized form of the ifAttributeValue() rule that matches on the profile attribute value being null.static RaConfigRule
ifPropertyValue(java.lang.String name, StringMatcher value, RaConfigRuleChild... children)
static RaConfigRule
ifPropertyValue(java.lang.String name, java.lang.String value, RaConfigRuleChild... children)
The ifPropertyValue() context rule will have its child rules applied only if the specified RA configuration property matches the specified value.static RaConfigRule
ifPropertyValueIsNull(java.lang.String name, RaConfigRuleChild... children)
The ifPropertyValueIsNull() context rule is a specialized form of the ifPropertyValue() rule that matches on a value being null.void
issueWarning(java.lang.String message)
The primary use for the issueWarning() method is so that code that uses the API can issue a warning, for example if it discovers that the data it is transforming is too complex to be automatically handled.static ProfileRule
profileName(StringMatcher profileName, ProfileRuleChild... children)
static ProfileRule
profileName(java.lang.String profileName, ProfileRuleChild... children)
The profileName() context rule is used to identify which profile name needs to be matched in order for the child rules to be applied.
This method is overloaded to provide multiple ways to specify the profile name, either usingregex(java.lang.String)
,anyString()
, or passing the name directly as a String value.
A profileName context rule can be nested insideprofileSpec(com.opencloud.slee.upgrade.transformation.model.ComponentMatcher, com.opencloud.slee.upgrade.transformation.model.ProfileRuleChild...)
orprofileTable(java.lang.String, com.opencloud.slee.upgrade.transformation.model.ProfileRuleChild...)
contexts if desired.static ProfileRule
profileSpec(ComponentMatcher profileSpecId, ProfileRuleChild... children)
The profileSpec() context rule is used to identify which profile specs need to be matched in order for the child rules to be applied.
This method is overloaded to provide multiple ways to specify the profile spec, either usingcomponent(java.lang.String, java.lang.String, java.lang.String)
or passing the three parameters (name, vendor, and version) directly.static ProfileRule
profileSpec(StringMatcher name, StringMatcher vendor, StringMatcher version, ProfileRuleChild... children)
static ProfileRule
profileSpec(StringMatcher name, StringMatcher vendor, java.lang.String version, ProfileRuleChild... children)
static ProfileRule
profileSpec(StringMatcher name, java.lang.String vendor, StringMatcher version, ProfileRuleChild... children)
static ProfileRule
profileSpec(StringMatcher name, java.lang.String vendor, java.lang.String version, ProfileRuleChild... children)
static ProfileRule
profileSpec(java.lang.String name, StringMatcher vendor, StringMatcher version, ProfileRuleChild... children)
static ProfileRule
profileSpec(java.lang.String name, StringMatcher vendor, java.lang.String version, ProfileRuleChild... children)
static ProfileRule
profileSpec(java.lang.String name, java.lang.String vendor, StringMatcher version, ProfileRuleChild... children)
static ProfileRule
profileSpec(java.lang.String name, java.lang.String vendor, java.lang.String version, ProfileRuleChild... children)
static ProfileRule
profileTable(StringMatcher tableName, ProfileRuleChild... children)
static ProfileRule
profileTable(java.lang.String tableName, ProfileRuleChild... children)
The profileTable() context rule is used to identify which profile table needs to be matched in order for the child rules to be applied.
This method is overloaded to provide multiple ways to specify the profile table name, either usingregex(java.lang.String)
,anyString()
, or passing the name directly as a String value.
A profileTable context rule can be nested inside aprofileSpec(com.opencloud.slee.upgrade.transformation.model.ComponentMatcher, com.opencloud.slee.upgrade.transformation.model.ProfileRuleChild...)
context if desired.static RaConfigRule
raEntity(StringMatcher entityName, RaConfigRuleChild... children)
static RaConfigRule
raEntity(java.lang.String entityName, RaConfigRuleChild... children)
The raEntity() context rule is used to select on entity names.static StringMatcher
regex(java.lang.String pattern)
Returns a matcher object based on the given regular expression.
Note: in order to match, the regular expression must match the full value, rather than just a substring.static ProfileAction
renameAttribute(java.lang.String originalName, java.lang.String newName)
The renameAttribute() rule changes the name of an attribute, without affecting its type or value.java.util.Map<java.lang.String,java.lang.String>
renamedOids(RulesContext rulesContext)
This can be optionally overridden to provide a map of renamed OIDs and counters.static ProfileAction
renameProfile(ValueFunction newName)
The renameProfile() rule renames a profile.static ProfileAction
renameProfile(java.lang.String newName)
static ProfileAction
renameProfileSpec(java.lang.String newName)
Changes the name of the profile spec which is associated with the profile table in the current context.static ProfileAction
renameProfileTable(java.lang.String newName)
Renames a profile table.static RaConfigAction
renameProperty(java.lang.String originalName, java.lang.String newName)
Renames an RA configuration property.static RaConfigAction
renameRaEntity(java.lang.String newName)
Renames the RA entity.abstract Rule[]
rules(RulesContext rulesContext)
This is the method that all API users must implement.static ProfileAction
setAttribute(java.lang.String name, boolean newValue)
static ProfileAction
setAttribute(java.lang.String name, int[] newValue)
static ProfileAction
setAttribute(java.lang.String name, long newValue)
static ProfileAction
setAttribute(java.lang.String name, long[] newValue)
static ProfileAction
setAttribute(java.lang.String name, ObjectGenerator newValue)
The setAttribute() action rule sets a named attribute to a particular value.static ProfileAction
setAttribute(java.lang.String name, ValueFunction function)
static ProfileAction
setAttribute(java.lang.String name, java.lang.Object[] newValue)
static ProfileAction
setAttribute(java.lang.String name, java.lang.String newValue)
static ProfileAction
setAttributeToNull(java.lang.String name)
This is a specialized form of the setAttribute action rule that uses a value of null.void
setEnvironment(java.util.List<org.w3c.dom.Document> documents, com.opencloud.slee.data.migration.ExportData exportData, java.util.List<org.w3c.dom.Document> uplevelDocuments, com.opencloud.slee.data.migration.ExportData uplevelData)
This method is not part of the API.void
setProblemCollector(ProblemCollector problemCollector)
This method is not part of the API.static RaConfigAction
setProperty(java.lang.String name, boolean newValue)
static RaConfigAction
setProperty(java.lang.String name, long newValue)
static RaConfigAction
setProperty(java.lang.String name, ObjectGenerator.StringGenerator newValue)
This action sets the value of an RA configuration property.static RaConfigAction
setProperty(java.lang.String name, java.lang.String newValue)
static RaConfigAction
setPropertyToNull(java.lang.String name)
This is a specialized form of the setProperty action, where the value to be set is null.static Rule[]
toRulesArray(java.lang.Iterable<Rule> rules)
The toRulesArray() method converts an Iterable object containing rules to the array required by the API'srules(com.opencloud.slee.upgrade.transformation.model.RulesContext)
method, for cases where it’s easier to build up the rules dynamically.
-
-
-
Method Detail
-
rules
public abstract Rule[] rules(RulesContext rulesContext)
This is the method that all API users must implement. Its purpose is to return the list of rules for transforming the exported data.- Parameters:
rulesContext
- provides access to information on the components included in the downlevel and the uplevel installations, so that rules can be tailored to apply to the component versions involved in the upgrade.
-
renamedOids
public java.util.Map<java.lang.String,java.lang.String> renamedOids(RulesContext rulesContext)
This can be optionally overridden to provide a map of renamed OIDs and counters. To rename an OID, the entries in the map must contain the full parameter set type name, thus Metrics.Services.SbbID[name=volte.sentinel.sip,vendor=OpenCloud,version=2.7.0-copy#1].lifecycle for both the origin and the result of the mapping. Note that this string value includes a version number, which will be ignored in any comparison, but is left in to make it easiest when pasting in values to produce this mapping table. It is expected that only the name is changed in the mapping. To rename an counter within an OID, the appropriate counter is given by using the full OID name as a prefix, followed by a dot, and the name of the counter, thus Metrics.Services.SbbID[name=volte.sentinel.sip,vendor=OpenCloud,version=2.7.0-copy#1].lifecycle.sbbRollbacks As with the unprefixed OID string, the version number will be ignored in any comparisons. The result string for the mapping must only give the new counter name, thus sbbRollbacksDone- Parameters:
rulesContext
- provides access to information on the components included in the downlevel and the uplevel installations, so that rules can be tailored to apply to the component versions involved in the upgrade.
-
array
public static ObjectGenerator array(ObjectGenerator... values)
Used for generating an array value, whose individual elements are generated in turn by the given generators, 1 value per generator.
-
array
public static ObjectGenerator array()
Used for generating an empty array.
-
array
public static ObjectGenerator array(java.lang.String... values)
Used for generating a String array, with the given fixed values.
-
array
public static ObjectGenerator array(java.lang.Object... values)
Used for generating an array from arbitrary and mixed argument types. Note: the individual values cannot themselves be arrays, or Iterable types. Primitives, and non-String values are converted to Strings.
-
anyString
public static StringMatcher anyString()
Returns a matcher object that matches any string. It is a better alternative than using a regex matcher that can also be constructed to match anything.
-
regex
public static StringMatcher regex(java.lang.String pattern)
Returns a matcher object based on the given regular expression.
Note: in order to match, the regular expression must match the full value, rather than just a substring.
-
component
public static ComponentMatcher component(java.lang.String name, java.lang.String vendor, java.lang.String version)
Returns a ComponentMatcher object for use by ProfileSpec context rules.
Each SLEE component is identified by name, vendor and version, and there are variants of this factory method that allow each of these to be specified as a constant string, or as aregex(java.lang.String)
oranyString()
.
-
component
public static ComponentMatcher component(java.lang.String name, java.lang.String vendor, StringMatcher version)
- See Also:
for semantics.
-
component
public static ComponentMatcher component(java.lang.String name, StringMatcher vendor, java.lang.String version)
- See Also:
for semantics.
-
component
public static ComponentMatcher component(java.lang.String name, StringMatcher vendor, StringMatcher version)
- See Also:
for semantics.
-
component
public static ComponentMatcher component(StringMatcher name, java.lang.String vendor, java.lang.String version)
- See Also:
for semantics.
-
component
public static ComponentMatcher component(StringMatcher name, java.lang.String vendor, StringMatcher version)
- See Also:
for semantics.
-
component
public static ComponentMatcher component(StringMatcher name, StringMatcher vendor, java.lang.String version)
- See Also:
for semantics.
-
component
public static ComponentMatcher component(StringMatcher name, StringMatcher vendor, StringMatcher version)
- See Also:
for semantics.
-
profileSpec
public static ProfileRule profileSpec(ComponentMatcher profileSpecId, ProfileRuleChild... children)
The profileSpec() context rule is used to identify which profile specs need to be matched in order for the child rules to be applied.
This method is overloaded to provide multiple ways to specify the profile spec, either usingcomponent(java.lang.String, java.lang.String, java.lang.String)
or passing the three parameters (name, vendor, and version) directly.- Parameters:
profileSpecId
- Identifies the profile specification.children
- Each child is either a nestedProfileRule
, or aProfileAction
to apply within the context of this enclosing rule.
-
profileSpec
public static ProfileRule profileSpec(java.lang.String name, java.lang.String vendor, java.lang.String version, ProfileRuleChild... children)
- See Also:
for semantics.
-
profileSpec
public static ProfileRule profileSpec(java.lang.String name, java.lang.String vendor, StringMatcher version, ProfileRuleChild... children)
- See Also:
for semantics.
-
profileSpec
public static ProfileRule profileSpec(java.lang.String name, StringMatcher vendor, java.lang.String version, ProfileRuleChild... children)
- See Also:
for semantics.
-
profileSpec
public static ProfileRule profileSpec(java.lang.String name, StringMatcher vendor, StringMatcher version, ProfileRuleChild... children)
- See Also:
for semantics.
-
profileSpec
public static ProfileRule profileSpec(StringMatcher name, java.lang.String vendor, java.lang.String version, ProfileRuleChild... children)
- See Also:
for semantics.
-
profileSpec
public static ProfileRule profileSpec(StringMatcher name, java.lang.String vendor, StringMatcher version, ProfileRuleChild... children)
- See Also:
for semantics.
-
profileSpec
public static ProfileRule profileSpec(StringMatcher name, StringMatcher vendor, java.lang.String version, ProfileRuleChild... children)
- See Also:
for semantics.
-
profileSpec
public static ProfileRule profileSpec(StringMatcher name, StringMatcher vendor, StringMatcher version, ProfileRuleChild... children)
- See Also:
for semantics.
-
profileTable
public static ProfileRule profileTable(java.lang.String tableName, ProfileRuleChild... children)
The profileTable() context rule is used to identify which profile table needs to be matched in order for the child rules to be applied.
This method is overloaded to provide multiple ways to specify the profile table name, either usingregex(java.lang.String)
,anyString()
, or passing the name directly as a String value.
A profileTable context rule can be nested inside aprofileSpec(com.opencloud.slee.upgrade.transformation.model.ComponentMatcher, com.opencloud.slee.upgrade.transformation.model.ProfileRuleChild...)
context if desired.- Parameters:
tableName
- Identifies the profile table name.children
- Each child is either a nestedProfileRule
, or aProfileAction
to apply within the context of this enclosing rule.
-
profileTable
public static ProfileRule profileTable(StringMatcher tableName, ProfileRuleChild... children)
- See Also:
for semantics.
-
profileName
public static ProfileRule profileName(java.lang.String profileName, ProfileRuleChild... children)
The profileName() context rule is used to identify which profile name needs to be matched in order for the child rules to be applied.
This method is overloaded to provide multiple ways to specify the profile name, either usingregex(java.lang.String)
,anyString()
, or passing the name directly as a String value.
A profileName context rule can be nested insideprofileSpec(com.opencloud.slee.upgrade.transformation.model.ComponentMatcher, com.opencloud.slee.upgrade.transformation.model.ProfileRuleChild...)
orprofileTable(java.lang.String, com.opencloud.slee.upgrade.transformation.model.ProfileRuleChild...)
contexts if desired.- Parameters:
profileName
- Identities the profile name.children
- Each child is either a nestedProfileRule
, or aProfileAction
to apply within the context of this enclosing rule.
-
profileName
public static ProfileRule profileName(StringMatcher profileName, ProfileRuleChild... children)
- See Also:
for semantics.
-
ifAttributeValueIsNull
public static ProfileRule ifAttributeValueIsNull(java.lang.String name, ProfileRuleChild... children)
The ifAttributeValueIsNull() context rule is a specialized form of the ifAttributeValue() rule that matches on the profile attribute value being null.- See Also:
for semantics.
-
ifAttributeValue
public static ProfileRule ifAttributeValue(java.lang.String name, java.lang.String value, ProfileRuleChild... children)
The ifAttributeValue() context rule will have its child rules applied only if the specified profile attribute matches the specified value.
The name of the attribute is always specified as a string.
The value can be specified directly as a string, or via a matcher such as returned byregex(java.lang.String)
.
An ifAttributeValue context rule can be nested inside any of the profile​ or ifAttribute contexts. In fact the way to match on multiple attributes at once is to nest ifAttributeValue rules.- Parameters:
name
- The name of the attribute to match.value
- The value to match against.children
- Each child is either a nestedProfileRule
, or aProfileAction
to apply within the context of this enclosing rule.
-
ifAttributeValue
public static ProfileRule ifAttributeValue(java.lang.String name, StringMatcher value, ProfileRuleChild... children)
- See Also:
for semantics.
-
createTable
public static ProfileTableCreationRule createTable(java.lang.String tableName, java.lang.String specName, java.lang.String specVendor, java.lang.String specVersion)
The createTable() action rule is unique in that it is the one action rule that does not need to be enclosed in a context rule.
Its purpose is to create a new profile table with a specified name, that uses the given profile spec.- Parameters:
tableName
- The name of the profile table to create.specName
- The name of the profile spec used by the profile table.specVendor
- The vendor of the profile spec used by the profile table.specVersion
- The version of the profile spec used by the profile table.
-
raEntity
public static RaConfigRule raEntity(java.lang.String entityName, RaConfigRuleChild... children)
The raEntity() context rule is used to select on entity names.
The value can be specified directly as a string, or via a matcher such as returned byregex(java.lang.String)
.- Parameters:
entityName
- The name of the RA entity to match.children
- Each child is either a nestedRaConfigRule
, or aRaConfigAction
to apply within the context of this enclosing rule.
-
raEntity
public static RaConfigRule raEntity(StringMatcher entityName, RaConfigRuleChild... children)
- See Also:
for semantics.
-
ifPropertyValueIsNull
public static RaConfigRule ifPropertyValueIsNull(java.lang.String name, RaConfigRuleChild... children)
The ifPropertyValueIsNull() context rule is a specialized form of the ifPropertyValue() rule that matches on a value being null.- See Also:
for semantics.
-
ifPropertyValue
public static RaConfigRule ifPropertyValue(java.lang.String name, java.lang.String value, RaConfigRuleChild... children)
The ifPropertyValue() context rule will have its child rules applied only if the specified RA configuration property matches the specified value.
The value can be specified directly as a string, or via a matcher such as returned byregex(java.lang.String)
.
An ifPropertyValue context rule can be nested inside an raEntity context, or another ifPropertyValue one (which allows matching on multiple properties at once).- Parameters:
name
- The name of the property to match.value
- The value to match against.children
- Each child is either a nestedRaConfigRule
, or aRaConfigAction
to apply within the context of this enclosing rule.
-
ifPropertyValue
public static RaConfigRule ifPropertyValue(java.lang.String name, StringMatcher value, RaConfigRuleChild... children)
- See Also:
for semantics.
-
addAttributeAsNull
public static ProfileAction addAttributeAsNull(java.lang.String name, java.lang.String type)
This is a specialized form of the addAttribute() rule, where the default value is the null value.- See Also:
for semantics.
-
addAttributeAsNull
public static ProfileAction addAttributeAsNull(java.lang.String name, java.lang.String type, @Nullable java.lang.String serialisationVersion)
Adds a serialised attribute. This is a specialized form of the addAttribute() rule, where the default value is the null value.- See Also:
for semantics.
-
addAttributeAsNull
public static ProfileAction addAttributeAsNull(java.lang.String name, java.lang.Class<?> clazz)
This is a specialized form of the addAttribute() rule, where the default value is the null value.- See Also:
for semantics.
-
addAttribute
public static ProfileAction addAttribute(java.lang.String name, java.lang.String type, ValueFunction function)
This is a specialized form of the addAttribute() rule, where the default value is the null value.- See Also:
for semantics.
-
addAttribute
public static ProfileAction addAttribute(java.lang.String name, java.lang.String type, @Nullable java.lang.String serialisationVersion, ValueFunction function)
Adds a serialised attribute. This is a specialized form of the addAttribute() rule, where the default value is the null value.- See Also:
for semantics.
-
addAttribute
public static ProfileAction addAttribute(java.lang.String name, java.lang.Class<?> clazz, ValueFunction function)
- See Also:
for semantics.
-
addAttribute
public static ProfileAction addAttribute(java.lang.String name, java.lang.String type, boolean defaultValue)
- See Also:
for semantics.
-
addAttribute
public static ProfileAction addAttribute(java.lang.String name, java.lang.Class<?> clazz, boolean defaultValue)
- See Also:
for semantics.
-
addAttribute
public static ProfileAction addAttribute(java.lang.String name, java.lang.String type, long defaultValue)
- See Also:
for semantics.
-
addAttribute
public static ProfileAction addAttribute(java.lang.String name, java.lang.Class<?> clazz, long defaultValue)
-
addAttribute
public static ProfileAction addAttribute(java.lang.String name, java.lang.String type, java.lang.String defaultValue)
- See Also:
for semantics.
-
addAttribute
public static ProfileAction addAttribute(java.lang.String name, java.lang.String type, @Nullable java.lang.String serialisationVersion, java.lang.String defaultValue)
Adds a serialised attribute.- See Also:
for semantics.
-
addAttribute
public static ProfileAction addAttribute(java.lang.String name, java.lang.Class<?> clazz, java.lang.String defaultValue)
- See Also:
for semantics.
-
addAttribute
public static ProfileAction addAttribute(java.lang.String name, java.lang.Class<?> clazz, ObjectGenerator defaultValue)
- See Also:
for semantics.
-
addAttribute
public static ProfileAction addAttribute(java.lang.String name, java.lang.String type, ObjectGenerator defaultValue)
The addAttribute() action rule adds a new non-serialised attribute by specifying its name and type, and optionally a default value to be used when no other more specific value is given, and when an attribute value was not already present within the export data.
The name is always given as a string, the type can be a string, or preferably a Java class whose type will be used automatically (which avoids the possibility of mistyping the string).
The optional default value can be almost any type that is found convenient, and no checking is done that it actually matches the type that you specify. A particularly powerful feature of the API is being able to pass a ValueFunction object as the default value, which allows the value to be calculated when the rule is actually applied.- Parameters:
name
- The name of the attribute.type
- The type of the attribute, expressed as a fully qualified Java class name.defaultValue
- The value to use if a value isn't already present in the export, and if no more specific value is set elsewhere.
-
addAttribute
public static ProfileAction addAttribute(java.lang.String name, java.lang.String type, @Nullable java.lang.String serialisationVersion, ObjectGenerator defaultValue)
The addAttribute() action rule adds a new serialised attribute by specifying its name and type, and optionally a default value to be used when no other more specific value is given, and when an attribute value was not already present within the export data.
The name is always given as a string, the type can be a string, or preferably a Java class whose type will be used automatically (which avoids the possibility of mistyping the string).
The optional default value can be almost any type that is found convenient, and no checking is done that it actually matches the type that you specify. A particularly powerful feature of the API is being able to pass a ValueFunction object as the default value, which allows the value to be calculated when the rule is actually applied.- Parameters:
name
- The name of the attribute.type
- The type of the attribute, expressed as a fully qualified Java class name.serialisationVersion
- The serialisation-version to use in the profile export XML.defaultValue
- The value to use if a value isn't already present in the export, and if no more specific value is set elsewhere.
-
doNotImportAttribute
public static ProfileAction doNotImportAttribute(@Nonnull java.lang.String name)
The doNotImportAttribute() action deletes a named attribute from the exported data for a profile table.
Note: Deleting the profile attribute from the export data does not mean that it is always deleted from the system - a profile attribute that is not in the export can still be present in the uplevel system if the installation of the new version recreates a profile attribute which was removed from the export data.- Parameters:
name
- The name of the attribute to remove from the export data.
-
setAttributeToNull
public static ProfileAction setAttributeToNull(@Nonnull java.lang.String name)
This is a specialized form of the setAttribute action rule that uses a value of null.- See Also:
for semantics.
-
setAttribute
public static ProfileAction setAttribute(@Nonnull java.lang.String name, ValueFunction function)
- See Also:
for semantics.
-
setAttribute
public static ProfileAction setAttribute(@Nonnull java.lang.String name, boolean newValue)
- See Also:
for semantics.
-
setAttribute
public static ProfileAction setAttribute(@Nonnull java.lang.String name, long newValue)
- See Also:
for semantics.
-
setAttribute
public static ProfileAction setAttribute(@Nonnull java.lang.String name, java.lang.Object[] newValue)
- See Also:
for semantics.
-
setAttribute
public static ProfileAction setAttribute(@Nonnull java.lang.String name, int[] newValue)
- See Also:
for semantics.
-
setAttribute
public static ProfileAction setAttribute(@Nonnull java.lang.String name, long[] newValue)
- See Also:
for semantics.
-
setAttribute
public static ProfileAction setAttribute(@Nonnull java.lang.String name, java.lang.String newValue)
- See Also:
for semantics.
-
setAttribute
public static ProfileAction setAttribute(@Nonnull java.lang.String name, @Nonnull ObjectGenerator newValue)
The setAttribute() action rule sets a named attribute to a particular value.
Overrides on this method allow the value to be specified in a large variety of ways, and no checking is done that the value is of the specific type that the profile stores. As withaddAttribute(String, String, ValueFunction)
, the value can also be passed via a ValueFunction object, which allows the value to be calculated when the rule is actually applied.- Parameters:
name
- The name of the attribute to set.newValue
- The new value to set the attribute to.
-
renameAttribute
public static ProfileAction renameAttribute(@Nonnull java.lang.String originalName, @Nonnull java.lang.String newName)
The renameAttribute() rule changes the name of an attribute, without affecting its type or value.- Parameters:
originalName
- The original name of the attribute.newName
- The new name to use for the attribute.
-
changeAttributeType
public static ProfileAction changeAttributeType(@Nonnull java.lang.String name, @Nonnull java.lang.String newType)
The changeAttributeType() rule changes the type of the name attribute.
The name is specified as a string, and the type as either a string or the Java class of the type.- Parameters:
name
- The name of the attribute to change.newType
- The new type to use for the attribute, as a fully qualified Java class name.
-
changeAttributeType
public static ProfileAction changeAttributeType(@Nonnull java.lang.String name, @Nonnull java.lang.Class<?> clazz)
- See Also:
for semantics.
-
createProfile
public static ProfileAction createProfile(@Nonnull java.lang.String name)
The createProfile() action rule is used to create a new named profile within a profile table.- Parameters:
name
- The name of the profile to create.
-
doNotImportProfile
public static ProfileAction doNotImportProfile()
The doNotImportProfile() rule deletes the profile from the export data.
Note: Deleting the profile from the export data does not mean that it is always deleted from the system - a profile that is not in the export can still be present in the uplevel system if the installation of the new version recreates a profile which was removed from the export data.
-
doNotImportProfileTable
public static ProfileAction doNotImportProfileTable()
The doNotImportProfileTable() rule deletes an entire profile table from the export data.
Note: Deleting the profile table from the export data does not mean that it is always deleted from the system - a profile table that is not in the export can still be present in the uplevel system if the installation of the new version recreates a profile table which was removed from the export data.
-
renameProfile
public static ProfileAction renameProfile(@Nonnull java.lang.String newName)
- See Also:
for semantics.
-
renameProfile
public static ProfileAction renameProfile(@Nonnull ValueFunction newName)
The renameProfile() rule renames a profile.
The new name can be a constant value, or can be a ValueFunction which, since it is passed the GeneratorContext, allows the existing name to be used in the production of the new name.- Parameters:
newName
- The new name to use for the profile.
-
renameProfileTable
public static ProfileAction renameProfileTable(@Nonnull java.lang.String newName)
Renames a profile table.- Parameters:
newName
- The new name to use for the profile table.
-
renameProfileSpec
public static ProfileAction renameProfileSpec(@Nonnull java.lang.String newName)
Changes the name of the profile spec which is associated with the profile table in the current context.- Parameters:
newName
- The new name for the profile spec.
-
addPropertyAsNull
public static RaConfigAction addPropertyAsNull(@Nonnull java.lang.String name, java.lang.Class<?> clazz)
This is a specialized form of addProperty that has null as the default value.- See Also:
for semantics.
-
addPropertyAsNull
public static RaConfigAction addPropertyAsNull(@Nonnull java.lang.String name, @Nonnull java.lang.String type)
This is a specialized form of addProperty that has null as the default value.- See Also:
for semantics.
-
addProperty
public static RaConfigAction addProperty(@Nonnull java.lang.String name, java.lang.Class<?> clazz, boolean defaultValue)
- See Also:
for semantics.
-
addProperty
public static RaConfigAction addProperty(@Nonnull java.lang.String name, @Nonnull java.lang.String type, boolean defaultValue)
- See Also:
for semantics.
-
addProperty
public static RaConfigAction addProperty(@Nonnull java.lang.String name, java.lang.Class<?> clazz, long defaultValue)
- See Also:
for semantics.
-
addProperty
public static RaConfigAction addProperty(@Nonnull java.lang.String name, @Nonnull java.lang.String type, long defaultValue)
- See Also:
for semantics.
-
addProperty
public static RaConfigAction addProperty(@Nonnull java.lang.String name, @Nonnull java.lang.String type, @Nonnull java.lang.String defaultValue)
- See Also:
for semantics.
-
addProperty
public static RaConfigAction addProperty(@Nonnull java.lang.String name, @Nonnull java.lang.Class<?> clazz, @Nonnull java.lang.String defaultValue)
- See Also:
for semantics.
-
addProperty
public static RaConfigAction addProperty(@Nonnull java.lang.String name, @Nonnull java.lang.Class<?> clazz, @Nonnull ObjectGenerator.StringGenerator defaultValue)
- See Also:
for semantics.
-
addProperty
public static RaConfigAction addProperty(@Nonnull java.lang.String name, @Nonnull java.lang.String type, @Nonnull ObjectGenerator.StringGenerator defaultValue)
Adds a configuration property to an RA entity.
Takes the name of the new property, its type (either as a string, or better as the class of the type), and the default value to be used when no other value is provided, and when the property is not already set in the export data.
The value can be provided as whatever type is most convenient, which does not need to match the actual defined type of the property (just to be compatible with it, so for example you can pass a numeric parameter to a property that is stored as a string, and the string representation of the number will be used).
This action rule needs to be inside an raEntity context.- Parameters:
name
- The name of the RA configuration property to add.type
- The type of the RA configuration property, as a fully qualified Java class name.defaultValue
- The value to use when no other value is provided, and when the property is not already set in the export data.
-
doNotImportProperty
public static RaConfigAction doNotImportProperty(@Nonnull java.lang.String name)
This action rule deletes an RA configuration property from the exported data.
Note: Deleting the property from the export data does not mean that it is always deleted from the system - data that is not in the export can still be present in the uplevel system if the installation of the new version recreates the property which was removed from the export data.- Parameters:
name
- The name of the configuration property to delete.
-
setPropertyToNull
public static RaConfigAction setPropertyToNull(@Nonnull java.lang.String name)
This is a specialized form of the setProperty action, where the value to be set is null.- See Also:
for semantics.
-
setProperty
public static RaConfigAction setProperty(@Nonnull java.lang.String name, boolean newValue)
- See Also:
for semantics.
-
setProperty
public static RaConfigAction setProperty(@Nonnull java.lang.String name, long newValue)
- See Also:
for semantics.
-
setProperty
public static RaConfigAction setProperty(@Nonnull java.lang.String name, @Nonnull java.lang.String newValue)
- See Also:
for semantics.
-
setProperty
public static RaConfigAction setProperty(@Nonnull java.lang.String name, @Nonnull ObjectGenerator.StringGenerator newValue)
This action sets the value of an RA configuration property.
The value can be specified in a variety of different types (which do not need to match, just be compatible with the actual type of the property).- Parameters:
name
- The name of the RA configuration property.newValue
- The new value to set the configuration property to.
-
renameProperty
public static RaConfigAction renameProperty(@Nonnull java.lang.String originalName, @Nonnull java.lang.String newName)
Renames an RA configuration property.- Parameters:
originalName
- The original name of the property.newName
- The new name to use for the property.
-
doNotImportRaEntity
public static RaConfigAction doNotImportRaEntity()
Deletes the RA entity from the exported data.
Note: Deleting the RA entity from the export data does not mean that it is always deleted from the system - an RA entity that is not in the export can still be present in the uplevel system if the installation of the new version recreates that RA entity which was removed from the export data.
-
renameRaEntity
public static RaConfigAction renameRaEntity(@Nonnull java.lang.String newName)
Renames the RA entity.- Parameters:
newName
- The new name to use for the RA entity.
-
toRulesArray
public static Rule[] toRulesArray(java.lang.Iterable<Rule> rules)
The toRulesArray() method converts an Iterable object containing rules to the array required by the API'srules(com.opencloud.slee.upgrade.transformation.model.RulesContext)
method, for cases where it’s easier to build up the rules dynamically.
-
getRaProperty
@Nullable public java.lang.String getRaProperty(@Nonnull java.lang.String entityName, @Nonnull java.lang.String propertyName)
Get the current (i.e. prior to upgrade) value of a property.- Parameters:
entityName
- The name of the RA entity to query.propertyName
- The name of the RA configuration property to query.- Returns:
- The value of the property, or null if not found
-
getUplevelRaProperty
@Nullable public java.lang.String getUplevelRaProperty(@Nonnull java.lang.String entityName, @Nonnull java.lang.String propertyName)
Get the uplevel (i.e. present in the upgraded version) value of a property.- Parameters:
entityName
- The name of the RA entity to query.propertyName
- The name of the RA configuration property to query.- Returns:
- The value of the property, or null if not found
-
getProfileAttribute
@Nullable public java.lang.String getProfileAttribute(@Nonnull java.lang.String profileTable, @Nonnull java.lang.String profileName, @Nonnull java.lang.String attributeName)
Get the current (i.e. prior to upgrade) value of a profile attribute.
If the particular attribute being queried is of an array type, this method will return null, and give a warning. To get the value of an array attribute, you must usegetProfileAttributeArray(String, String, String)
, which has a return type which can correctly express the array contents.- Parameters:
profileTable
- The name of the profile table to query.profileName
- The name of the profile to query.attributeName
- The name of the profile attribute to query.- Returns:
- The value of the attribute, or null if not found
-
getUplevelProfileAttribute
@Nullable public java.lang.String getUplevelProfileAttribute(@Nonnull java.lang.String profileTable, @Nonnull java.lang.String profileName, @Nonnull java.lang.String attributeName)
Get the uplevel (i.e. present in the upgraded version) value of a profile attribute.
If the particular attribute being queried is of an array type, this method will return null, and give a warning. To get the value of an array attribute, you must usegetUplevelProfileAttributeArray(String, String, String)
, which has a return type which can correctly express the array contents.- Parameters:
profileTable
- The name of the profile table to query.profileName
- The name of the profile to query.attributeName
- The name of the profile attribute to query.- Returns:
- The value of the attribute, or null if not found
-
getProfileAttributeArray
@Nullable public java.lang.String[] getProfileAttributeArray(@Nonnull java.lang.String profileTable, @Nonnull java.lang.String profileName, @Nonnull java.lang.String attributeName)
Get the current (i.e. prior to upgrade) value of a profile attribute which has an array type.
If the particular attribute being queried is not of an array type, this method will return null, and give a warning. To get the value of a non-array attribute, you must usegetProfileAttribute(String, String, String)
, which has a return type that can correctly express the simple contents.- Parameters:
profileTable
- The name of the profile table to query.profileName
- The name of the profile to query.attributeName
- The name of the profile attribute to query.- Returns:
- The value of the attribute, or null if not found
-
getUplevelProfileAttributeArray
@Nullable public java.lang.String[] getUplevelProfileAttributeArray(@Nonnull java.lang.String profileTable, @Nonnull java.lang.String profileName, @Nonnull java.lang.String attributeName)
Get the uplevel (i.e. present in the upgraded version) value of a profile attribute which has an array type.
If the particular attribute being queried is not of an array type, this method will return null, and give a warning. To get the value of a non-array attribute, you must usegetUplevelProfileAttribute(String, String, String)
, which has a return type that can correctly express the simple contents- Parameters:
profileTable
- The name of the profile table to query.profileName
- The name of the profile to query.attributeName
- The name of the profile attribute to query.- Returns:
- The value of the attribute, or null if not found
-
getProfileNames
public java.lang.String[] getProfileNames(java.lang.String profileTable)
Get an array of all the profile names in the specified profile table.
-
getUplevelProfileNames
public java.lang.String[] getUplevelProfileNames(java.lang.String profileTable)
Gets an array of all the profile names in the uplevel version of the specified profile table.
-
issueWarning
public void issueWarning(java.lang.String message)
The primary use for the issueWarning() method is so that code that uses the API can issue a warning, for example if it discovers that the data it is transforming is too complex to be automatically handled.
A secondary use is as "print statements" for use as a temporary diagnostic aid.- Parameters:
message
- The warning message to issue.
-
functionArrayAppend
public static ValueFunction functionArrayAppend(java.lang.String... values)
Returns a function that appends the given values to an array in a profile attribute value.
The function must be used with a context where there is a non-null attribute, it will create a new array and add the values if the array was originally null. Allows duplicate entries in the array.- Parameters:
values
- The values to append to the array.- Returns:
- A function that will append the given values to a profile array attribute.
-
functionArrayAddUniqueValues
public static ValueFunction functionArrayAddUniqueValues(java.lang.String... values)
Returns a function that only adds the unique given values to an array in a profile attribute value. The function must be used with a context where there is a non-null attribute, it will create a new array and add the values if the array was originally null. NOTE: The returned array will have no duplicate entries even if the initial array did.- Parameters:
values
- The values to add to the array.- Returns:
- A function that will add the given values to a profile array attribute.
-
functionArrayRemove
public static ValueFunction functionArrayRemove(java.lang.String... values)
Returns a function that removes the given values from an array in a profile attribute value. If a value is present multiple times in the array, one instance (the first) will be removed per occurrence in the given values.
The function must be used with a context where there is a non-null attribute, it will create an empty array if the array was originally null.- Parameters:
values
- The values to remove from the array.- Returns:
- A function that will remove the given values from a profile array attribute.
- See Also:
List.removeAll(Collection)
-
functionUplevelProfileAttribute
public ValueFunction functionUplevelProfileAttribute()
Returns a function that uses the existing uplevel value for the relevant profile attribute. In other words, when generating a value for a particular profile attribute, this function will query the newly installed uplevel data for the equivalent profile attribute, and will use its value if present.
-
functionUplevelProfileAttributeArray
public ValueFunction functionUplevelProfileAttributeArray()
Returns a function that uses the existing uplevel value for the relevant profile attribute which has an array type. In other words, when generating an array value for a particular profile attribute, this function will query the newly installed uplevel data for the equivalent profile attribute, and will use its value if present.
-
functionForDefaultProfileAndOthers
public static ValueFunction functionForDefaultProfileAndOthers(@Nonnull ValueFunction valueForDefaultProfile, @Nonnull ValueFunction valueForNonDefaultProfiles)
Returns a function that uses the first value if editing the default profile, or the second value if editing a non-default profile.- Parameters:
valueForDefaultProfile
- The value to use when editing the default profile. (the profile whose name is the empty string).valueForNonDefaultProfiles
- The value to use when editing any profile other than the default profile.
-
functionForDefaultProfileAndOthers
public static ValueFunction functionForDefaultProfileAndOthers(java.lang.String valueForDefaultProfile, java.lang.String valueForNonDefaultProfiles)
- See Also:
for semantics.
-
functionForDefaultProfileAndOthers
public static ValueFunction functionForDefaultProfileAndOthers(java.lang.String valueForDefaultProfile, ValueFunction valueForNonDefaultProfiles)
- See Also:
for semantics.
-
functionForDefaultProfileAndOthers
public static ValueFunction functionForDefaultProfileAndOthers(ValueFunction valueForDefaultProfile, java.lang.String valueForNonDefaultProfiles)
- See Also:
for semantics.
-
functionForConstant
public static ValueFunction functionForConstant(@Nullable java.lang.Object value)
Returns a function which always returns the given value, which may be null.
-
setEnvironment
public void setEnvironment(java.util.List<org.w3c.dom.Document> documents, com.opencloud.slee.data.migration.ExportData exportData, java.util.List<org.w3c.dom.Document> uplevelDocuments, com.opencloud.slee.data.migration.ExportData uplevelData)
This method is not part of the API. Subclasses should never call this method.
-
setProblemCollector
public void setProblemCollector(ProblemCollector problemCollector)
This method is not part of the API. Subclasses should never call this method.
-
-