public abstract class AbstractUpgradeHelper extends Object implements UpgradeHelper
Modifier and Type | Field and Description |
---|---|
protected Set<String> |
attributes |
Constructor and Description |
---|
AbstractUpgradeHelper() |
Modifier and Type | Method and Description |
---|---|
AttributeSchemaImpl |
addNewAttribute(Set<AttributeSchemaImpl> existingAttrs,
AttributeSchemaImpl newAttr)
Given the existing attributes in the schema and the new attribute the upgrade helper
can decide how to change the new attr based on the state of the existing attributes.
|
protected Set<String> |
encryptValues(Set<String> values)
Encrypts all values in the provided set.
|
Set<String> |
getAttributes()
Return the Set of attributes that are to be upgrade by this service helper
|
protected AttributeSchemaImpl |
updateChoiceValues(AttributeSchemaImpl attribute,
Collection<String> choiceValues)
Update the choice values of an attribute schema
|
protected AttributeSchemaImpl |
updateDefaultValues(AttributeSchemaImpl attribute,
Set<String> defaultValues)
Update the default values of an attribute schema
|
protected AttributeSchemaImpl |
updateExampleValues(AttributeSchemaImpl attribute,
Set<String> exampleValues)
Update the example values of an attribute schema
|
protected static Node |
updateNode(Document newValueNode,
String element,
Node attributeSchemaNode) |
protected AttributeSchemaImpl |
updateOptional(AttributeSchemaImpl attribute,
boolean isOptional)
Update the optional value of an attribute schema
|
AttributeSchemaImpl |
upgradeAttribute(AttributeSchemaImpl newAttr)
Implement this method to perform modifications to a newly added attribute.
|
abstract AttributeSchemaImpl |
upgradeAttribute(AttributeSchemaImpl oldAttr,
AttributeSchemaImpl newAttr)
Implement this method to perform modifications to an existing attribute based on custom logic.
|
protected AttributeSchemaImpl updateOptional(AttributeSchemaImpl attribute, boolean isOptional) throws UpgradeException
attribute
- the attribute schemaisOptional
- true if this attribute is optionalUpgradeException
- If there was an error while performing the attribute upgrade.protected AttributeSchemaImpl updateChoiceValues(AttributeSchemaImpl attribute, Collection<String> choiceValues) throws UpgradeException
attribute
- the attribute schemachoiceValues
- the new choice valuesUpgradeException
- If there was an error while performing the attribute upgrade.protected AttributeSchemaImpl updateDefaultValues(AttributeSchemaImpl attribute, Set<String> defaultValues) throws UpgradeException
attribute
- the attribute schemadefaultValues
- the new default valuesUpgradeException
- If there was an error while performing the attribute upgrade.protected AttributeSchemaImpl updateExampleValues(AttributeSchemaImpl attribute, Set<String> exampleValues) throws UpgradeException
attribute
- the attribute schemaexampleValues
- the new examples valuesUpgradeException
- If there was an error while performing the attribute upgrade.protected Set<String> encryptValues(Set<String> values)
To be used when copying default values which need to be stored encrypted.
values
- The values to encrypt.protected static Node updateNode(Document newValueNode, String element, Node attributeSchemaNode)
public AttributeSchemaImpl addNewAttribute(Set<AttributeSchemaImpl> existingAttrs, AttributeSchemaImpl newAttr) throws UpgradeException
UpgradeHelper
addNewAttribute
in interface UpgradeHelper
existingAttrs
- The old attributesnewAttr
- The new attribute schemaUpgradeException
- If something bad happens, this will be used to log not stop the upgradepublic abstract AttributeSchemaImpl upgradeAttribute(AttributeSchemaImpl oldAttr, AttributeSchemaImpl newAttr) throws UpgradeException
attributes
.upgradeAttribute
in interface UpgradeHelper
oldAttr
- The attribute schema definition currently specified.newAttr
- The attribute schema definition we are planning to upgrade to.null
, otherwise either the amended attribute or the newAttr can be
returned directly.UpgradeException
- If there was an error while performing the attribute upgrade.public AttributeSchemaImpl upgradeAttribute(AttributeSchemaImpl newAttr) throws UpgradeException
attributes
.upgradeAttribute
in interface UpgradeHelper
newAttr
- The attribute schema definition we are planning to upgrade to.null
,
otherwise the amended attribute can be returned directly.UpgradeException
- If there was an error while performing the attribute upgrade.public final Set<String> getAttributes()
UpgradeHelper
getAttributes
in interface UpgradeHelper
Copyright © 2010–2025 Open Identity Platform Community. All rights reserved.