Package com.sun.identity.sm
Class AttributeSchema
- java.lang.Object
-
- com.sun.identity.sm.AttributeSchema
-
@SupportedAll public class AttributeSchema extends Object
The classAttributeSchema
provides methods to access the schema of a configuration parameter. Also, it provides methods to set default and choice values.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AttributeSchema.ListOrder
This enumListOrder
defines the list orders of schema attributes and provides constants for these list orders.static class
AttributeSchema.Syntax
The classSyntax
defines the syntax of the schema attributes and provides static constants for these types.static class
AttributeSchema.Type
The classType
defines the types of schema attributes and provides static constants for these types.static class
AttributeSchema.UIType
The classUIType
defines the UI types of schema attributes and provides static constants for these types.
-
Constructor Summary
Constructors Modifier Constructor Description protected
AttributeSchema(com.sun.identity.sm.AttributeSchemaImpl as, com.sun.identity.sm.PluginSchema ps)
protected
AttributeSchema(com.sun.identity.sm.AttributeSchemaImpl as, ServiceSchemaManager ssm, ServiceSchema ss)
Constructor used by ServiceSchema to instantiateAttributeSchema
objects.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChoiceValue(String value, String i18nKey)
Adds a choice value and its i18n key to the existing set of choice values.void
addDefaultValue(String value)
Adds a default value to the existing set of default values.String
getAny()
Method to get service specific attributes.String
getChoiceValueI18NKey(String cValue)
Returns the I18N key for the given choice value.String[]
getChoiceValues()
Returns the possible choice values for the attribute if the attribute type is eitherSINGLE_CHOICE
orMULTIPLE_CHOICE
.String[]
getChoiceValues(Map envParams)
Returns the possible choice values for the attribute if the attribute type is eitherSINGLE_CHOICE
orMULTIPLE_CHOICE
, for the given environment parameters.Map<String,String>
getChoiceValuesMap(Map<String,Object> envParams)
Returns the possible choice values for the attribute if the attribute type is eitherSINGLE_CHOICE
orMULTIPLE_CHOICE
, for the given environment parameters, along with the values' i18n keys.String
getCosQualifier()
Returns the value of thecosQualifier
for this attribute that isdefault, override, operational or merge-cos
.Set<String>
getDefaultValues()
Returns the default values of the attribute.Set<String>
getDefaultValues(Map envParams)
Returns the default values of the attribute for the given environment parameters.String
getEndRange()
Returns the end range if the attribute syntax is eitherNUMBER_RANGE
orDECIMAL_RANGE
.Set<String>
getExampleValues()
Returns the example values of the attribute.String
getFalseValue()
Returns the string value forBooleanFalseValue
.String
getFalseValueI18NKey()
Returns theI18N
Key forBooleanFalseValue
.String
getI18NKey()
Returns the I18N key to describe the configuration attribute.AttributeSchema.ListOrder
getListOrder()
Returns the list order of the attribute.int
getMaxValue()
Returns the maximum number of values for the attribute if the attribute is of typeMULTIPLE_CHOICE
.int
getMinLength()
Returns the required minimum lenght of the attribute valueint
getMinValue()
Returns the minimum number of values for the attribute if the attribute is of typeMULTIPLE_CHOICE
.String
getName()
Returns the name of the attribute.Integer
getOrder()
Returns the order of this attribute.String
getPropertiesViewBeanURL()
Returns URL of the view bean for the attribute.String
getResourceName()
Returns the name of this attribute when used in a CREST representation.ServiceSchema
getServiceSchema()
Returns Service Schema.String
getStartRange()
Returns the start range if the attribute syntax is eitherNUMBER_RANGE
orDECIMAL_RANGE
.AttributeSchema.Syntax
getSyntax()
Returns the syntax of the attribute.String
getTrueValue()
Returns the string value forBooleanTrueValue
.String
getTrueValueI18NKey()
Returns theI18N
key forBooleanTrueValue
.AttributeSchema.Type
getType()
Returns the type of the attribute.AttributeSchema.UIType
getUIType()
Returns the UI type of the attribute.String
getValidator()
Method to get the validator name for using to validate this service attributeboolean
hasChoiceValues()
Indicates whether this AttributeSchema has choice values defined.boolean
isHiddenInConfigUI()
Should this attribute schema be hidden in the Configuration UI.boolean
isOptional()
Returns true if the attribute is an optional attribute.boolean
isResourceNameAllowed()
Checks if the attribute allows to have resource name.boolean
isSearchable()
Returnstrue
if the attribute is searchable;false
otherwiseboolean
isServiceIdentifier()
Returns true if the attribute is a service identifier (i.e., in the case of LDAP it would be the COS Specifier attribute).boolean
isStatusAttribute()
Returns true if the attribute is a service's status attribute.void
removeChoiceValue(String value)
Removes the given value from the set of choice values.void
removeDefaultValue(String value)
Removes the given value from the set of default values.void
removeDefaultValues()
Removes the all the default values for the attribute.void
setAny(String a)
Sets the any attribute.void
setBooleanValues(String trueValue, String trueValueI18nKey, String falseValue, String falseValueI18nKey)
Sets the boolean values of the attribute.void
setCosQualifier(String cosq)
Sets thecosQualifier
attributevoid
setDefaultValues(Set<String> values)
Sets the default values of the attribute.void
setEndRange(String edRange)
Sets the end range Attribute.void
setI18NKey(String i18nKey)
Sets the I18N key to describe the configuration attribute.void
setMaxValue(String maxV)
Sets the maximum value attribute.void
setMinValue(String minV)
Sets the minimum value attribute.void
setOrder(Integer order)
Sets the order of this attribute.void
setPropertiesViewBeanUR(String prop)
Sets the URL of the view bean for the attribute.void
setResourceName(String name)
Sets the CREST representation name for the attribute.void
setSearchable(String value)
Sets the attribute isSearchable, if value is set totrue
, orfalse
.void
setStartRange(String stRange)
Sets the start range attribute.void
setSyntax(String synt)
Sets the Syntax attribute.void
setType(String type)
Sets the type.void
setUIType(String uiType)
Sets theUIType
attribute.void
setValidator(String valid)
Sets the Validator attributeString
toString()
Returns a string representation of thisAttributeSchema
object.protected void
updateBooleanValues(String trueValue, String trueValueI18nKey, String falseValue, String falseValueI18nKey, Document doc)
protected void
updateChoiceValues(Map<String,String> choiceValues)
protected void
updateChoiceValues(Map<String,String> choiceValues, Document doc)
protected void
updateDefaultValues(Set<String> defaultValues)
Method for modifying default valuesprotected void
updateDefaultValues(Set<String> defaultValues, Document doc)
Method for modifying default values given the XML documentprotected void
updateXMLDocument(StringBuffer sb, String elementName, Document updateDoc)
protected void
updateXMLDocument(String attrName, String attrValue)
update attribute value in attribute schema element
-
-
-
Constructor Detail
-
AttributeSchema
protected AttributeSchema(com.sun.identity.sm.AttributeSchemaImpl as, ServiceSchemaManager ssm, ServiceSchema ss)
Constructor used by ServiceSchema to instantiateAttributeSchema
objects.
-
AttributeSchema
protected AttributeSchema(com.sun.identity.sm.AttributeSchemaImpl as, com.sun.identity.sm.PluginSchema ps)
-
-
Method Detail
-
getName
public String getName()
Returns the name of the attribute.- Returns:
- the name of the attribute
-
isHiddenInConfigUI
public boolean isHiddenInConfigUI()
Should this attribute schema be hidden in the Configuration UI.- Returns:
- {true} if it should be hidden.
-
getType
public AttributeSchema.Type getType()
Returns the type of the attribute.- Returns:
- the type of the attribute
-
getServiceSchema
public ServiceSchema getServiceSchema()
Returns Service Schema.- Returns:
- Service Schema.
-
setType
public void setType(String type) throws SMSException, SSOException
Sets the type.- Parameters:
type
- to be changed to- Throws:
SMSException
- if an error is encountered when trying to setSSOException
- if the single sign on token is invalid or expired
-
getListOrder
public AttributeSchema.ListOrder getListOrder()
Returns the list order of the attribute.- Returns:
- The list order of the attribute, or
null
if the list order is not defined.
-
getUIType
public AttributeSchema.UIType getUIType()
Returns the UI type of the attribute.- Returns:
- the UI type of the attribute; or null if the UI Type is not defined
-
setUIType
public void setUIType(String uiType) throws SMSException, SSOException
Sets theUIType
attribute.- Parameters:
uiType
- user interface type.- Throws:
SMSException
- if an error is encountered when trying to setUIType
to the attribute schema.SSOException
- if the single sign on token is invalid or expired
-
getSyntax
public AttributeSchema.Syntax getSyntax()
Returns the syntax of the attribute.- Returns:
- the syntax of the attribute
-
getMinLength
public int getMinLength()
Returns the required minimum lenght of the attribute value- Returns:
- the required minimum length of the attribute value
-
setSyntax
public void setSyntax(String synt) throws SMSException, SSOException
Sets the Syntax attribute.- Parameters:
synt
- syntax- Throws:
SMSException
- if an error is encountered when trying to set the attribute syntaxSSOException
- if the single sign on token is invalid or expired
-
getI18NKey
public String getI18NKey()
Returns the I18N key to describe the configuration attribute.- Returns:
- the I18N key to describe the configuration attribute
-
getOrder
public Integer getOrder()
Returns the order of this attribute.- Returns:
- the order of this attribute, null if not defined
-
setI18NKey
public void setI18NKey(String i18nKey) throws SMSException, SSOException
Sets the I18N key to describe the configuration attribute.- Parameters:
i18nKey
- the I18N key to describe the attribute- Throws:
SMSException
- if an error is encountered when trying to set I18N key to the attribute schemaSSOException
- if the single sign on token is invalid or expired
-
setOrder
public void setOrder(Integer order) throws SMSException, SSOException
Sets the order of this attribute.- Parameters:
order
- the integer value representing the order- Throws:
SMSException
- if an error is encounteredSSOException
- if the single sign on token is invalid or expired
-
getCosQualifier
public String getCosQualifier()
Returns the value of thecosQualifier
for this attribute that isdefault, override, operational or merge-cos
.- Returns:
- the value of the
cosQualifier
.
-
setCosQualifier
public void setCosQualifier(String cosq) throws SMSException, SSOException
Sets thecosQualifier
attribute- Parameters:
cosq
- value ofcosQualifier
.- Throws:
SMSException
- if an error is encountered when trying to set.SSOException
- if the single sign on token is invalid or expired
-
getDefaultValues
public Set<String> getDefaultValues()
Returns the default values of the attribute. If there are no default values defined for this attribute in the schema then this method returns a Collections.EMPTY_SET- Returns:
- set of default values of the attribute
-
getDefaultValues
public Set<String> getDefaultValues(Map envParams)
Returns the default values of the attribute for the given environment parameters. If there are no default values defined for this attribute in the schema then this method returns a Collections.EMPTY_SET- Parameters:
envParams
- Map of environment parameter to a set of values- Returns:
- set of default values of the attribute
-
getExampleValues
public Set<String> getExampleValues()
Returns the example values of the attribute. If there are no example values defined for this attribute in the schema then this method returns a Collections.EMPTY_SET- Returns:
- set of example values of the attribute
-
setDefaultValues
public void setDefaultValues(Set<String> values) throws SMSException, SSOException
Sets the default values of the attribute.- Parameters:
values
- the set of default values- Throws:
SMSException
- if an error is encountered when trying to set.SSOException
- if the single sign on token is invalid or expired
-
addDefaultValue
public void addDefaultValue(String value) throws SMSException, SSOException
Adds a default value to the existing set of default values.- Parameters:
value
- the default value to add- Throws:
SMSException
- if an error is encountered when trying to set.SSOException
- if the single sign on token is invalid or expired
-
removeDefaultValues
public void removeDefaultValues() throws SMSException, SSOException
Removes the all the default values for the attribute.- Throws:
SMSException
- if an error is encountered when trying to set.SSOException
- if the single sign on token is invalid or expired
-
removeDefaultValue
public void removeDefaultValue(String value) throws SMSException, SSOException
Removes the given value from the set of default values.- Parameters:
value
- the default value to remove- Throws:
SMSException
- if an error is encountered when trying to set.SSOException
- if the single sign on token is invalid or expired
-
getChoiceValues
public String[] getChoiceValues()
Returns the possible choice values for the attribute if the attribute type is eitherSINGLE_CHOICE
orMULTIPLE_CHOICE
.- Returns:
- set of possible choice values
-
getChoiceValues
public String[] getChoiceValues(Map envParams)
Returns the possible choice values for the attribute if the attribute type is eitherSINGLE_CHOICE
orMULTIPLE_CHOICE
, for the given environment parameters.- Parameters:
envParams
- Map of environment parameter to a set of values- Returns:
- set of possible choice values
-
getChoiceValuesMap
public Map<String,String> getChoiceValuesMap(Map<String,Object> envParams)
Returns the possible choice values for the attribute if the attribute type is eitherSINGLE_CHOICE
orMULTIPLE_CHOICE
, for the given environment parameters, along with the values' i18n keys.- Parameters:
envParams
- Map of environment parameter to a set of values- Returns:
- Map of value to i18n key.
-
hasChoiceValues
public boolean hasChoiceValues()
Indicates whether this AttributeSchema has choice values defined.
-
getChoiceValueI18NKey
public String getChoiceValueI18NKey(String cValue)
Returns the I18N key for the given choice value.- Parameters:
cValue
- choice value.- Returns:
- the I18N key for the given choice value
-
addChoiceValue
public void addChoiceValue(String value, String i18nKey) throws SMSException, SSOException
Adds a choice value and its i18n key to the existing set of choice values.- Parameters:
value
- the choice value to addi18nKey
- the I18N key for the choice value- Throws:
SMSException
- if an error is encountered when trying to set.SSOException
- if the single sign on token is invalid or expired
-
removeChoiceValue
public void removeChoiceValue(String value) throws SMSException, SSOException
Removes the given value from the set of choice values.- Parameters:
value
- the choice value to remove- Throws:
SMSException
- if an error is encountered when trying to set.SSOException
- if the single sign on token is invalid or expired
-
getStartRange
public String getStartRange()
Returns the start range if the attribute syntax is eitherNUMBER_RANGE
orDECIMAL_RANGE
.- Returns:
- the start range for the attribute value
-
setStartRange
public void setStartRange(String stRange) throws SMSException, SSOException
Sets the start range attribute.- Parameters:
stRange
- start range.- Throws:
SMSException
- if an error is encountered when trying to setSSOException
- if the single sign on token is invalid or expired
-
getEndRange
public String getEndRange()
Returns the end range if the attribute syntax is eitherNUMBER_RANGE
orDECIMAL_RANGE
.- Returns:
- the end range for the attribute value
-
setEndRange
public void setEndRange(String edRange) throws SMSException, SSOException
Sets the end range Attribute.- Parameters:
edRange
- end range.- Throws:
SMSException
- if an error is encountered when trying to setSSOException
- if the single sign on token is invalid or expired
-
getValidator
public String getValidator()
Method to get the validator name for using to validate this service attribute- Returns:
- the validator name
-
setValidator
public void setValidator(String valid) throws SMSException, SSOException
Sets the Validator attribute- Parameters:
valid
- validator- Throws:
SMSException
- if an error is encountered when trying to setSSOException
- if the single sign on token is invalid or expired
-
getMinValue
public int getMinValue()
Returns the minimum number of values for the attribute if the attribute is of typeMULTIPLE_CHOICE
.- Returns:
- the minimum number of values
-
setMinValue
public void setMinValue(String minV) throws SMSException, SSOException
Sets the minimum value attribute.- Parameters:
minV
- minimum value.- Throws:
SMSException
- if an error is encountered when trying to setSSOException
- if the single sign on token is invalid or expired
-
getMaxValue
public int getMaxValue()
Returns the maximum number of values for the attribute if the attribute is of typeMULTIPLE_CHOICE
.- Returns:
- the maximum number of values
-
setMaxValue
public void setMaxValue(String maxV) throws SMSException, SSOException
Sets the maximum value attribute.- Parameters:
maxV
- maximum value.- Throws:
SMSException
- if an error is encountered when trying to setSSOException
- if the single sign on token is invalid or expired
-
setBooleanValues
public void setBooleanValues(String trueValue, String trueValueI18nKey, String falseValue, String falseValueI18nKey) throws SSOException, SMSException
Sets the boolean values of the attribute.- Parameters:
trueValue
- string value forBooleanTrueValue
.trueValueI18nKey
-I18N
key forBooleanTrueValue
.falseValue
- string value forBooleanFalseValue
.falseValueI18nKey
-I18N
Key forBooleanFalseValue
.- Throws:
SMSException
- if an error is encountered when trying to set.SSOException
- if the single sign on token is invalid or expired
-
getTrueValue
public String getTrueValue()
Returns the string value forBooleanTrueValue
.- Returns:
- the string value for
BooleanTrueValue
.
-
getTrueValueI18NKey
public String getTrueValueI18NKey()
Returns theI18N
key forBooleanTrueValue
.- Returns:
- the
I18N
key forBooleanTrueValue
.
-
getFalseValue
public String getFalseValue()
Returns the string value forBooleanFalseValue
.- Returns:
- the string value for
BooleanFalseValue
.
-
getFalseValueI18NKey
public String getFalseValueI18NKey()
Returns theI18N
Key forBooleanFalseValue
.- Returns:
- the
I18N
Key forBooleanFalseValue
.
-
isOptional
public boolean isOptional()
Returns true if the attribute is an optional attribute.- Returns:
- true if the attribute is an optional attribute.
-
isServiceIdentifier
public boolean isServiceIdentifier()
Returns true if the attribute is a service identifier (i.e., in the case of LDAP it would be the COS Specifier attribute).- Returns:
- true if the attribute is service identifier attribute.
-
isResourceNameAllowed
public boolean isResourceNameAllowed()
Checks if the attribute allows to have resource name.- Returns:
- true if the attribute allows to have resource name; false otherwise
-
isStatusAttribute
public boolean isStatusAttribute()
Returns true if the attribute is a service's status attribute.- Returns:
- true if the attribute is a status attribute.
-
getAny
public String getAny()
Method to get service specific attributes. It return the value of the "any" attribute, if set in the XML schema for the service- Returns:
- value of "any" attribute
-
setAny
public void setAny(String a) throws SMSException, SSOException
Sets the any attribute.- Parameters:
a
- value for any attribute.- Throws:
SMSException
- if an error is encountered when trying to set.SSOException
- if the single sign on token is invalid or expired.
-
getPropertiesViewBeanURL
public String getPropertiesViewBeanURL()
Returns URL of the view bean for the attribute.- Returns:
- URL for view bean
-
setPropertiesViewBeanUR
public void setPropertiesViewBeanUR(String prop) throws SMSException, SSOException
Sets the URL of the view bean for the attribute.- Parameters:
prop
- properties view bean URL.- Throws:
SMSException
- if an error is encountered when trying to set.SSOException
- if the single sign on token is invalid or expired.
-
isSearchable
public boolean isSearchable()
Returnstrue
if the attribute is searchable;false
otherwise- Returns:
true
if the attribute is an optional attribute;false
otherwise
-
setSearchable
public void setSearchable(String value) throws SMSException, SSOException
Sets the attribute isSearchable, if value is set totrue
, orfalse
.- Parameters:
value
- if set totrue
the attribute will be searchable; else searches cannot be performed on this attribute.- Throws:
SMSException
- if an error is encountered when trying to setSSOException
- if the single sign on token is invalid or expired
-
getResourceName
public String getResourceName()
Returns the name of this attribute when used in a CREST representation.
-
setResourceName
public void setResourceName(String name) throws SSOException, SMSException
Sets the CREST representation name for the attribute.- Parameters:
name
- the name of the CREST property.- Throws:
SMSException
- if an error is encountered when trying to set.SSOException
- if the single sign on token is invalid or expired.
-
toString
public String toString()
Returns a string representation of thisAttributeSchema
object.
-
updateDefaultValues
protected void updateDefaultValues(Set<String> defaultValues) throws SMSException, SSOException
Method for modifying default values- Throws:
SMSException
SSOException
-
updateDefaultValues
protected void updateDefaultValues(Set<String> defaultValues, Document doc) throws SMSException, SSOException
Method for modifying default values given the XML document- Throws:
SMSException
SSOException
-
updateChoiceValues
protected void updateChoiceValues(Map<String,String> choiceValues) throws SMSException, SSOException
- Throws:
SMSException
SSOException
-
updateChoiceValues
protected void updateChoiceValues(Map<String,String> choiceValues, Document doc) throws SMSException, SSOException
- Throws:
SMSException
SSOException
-
updateBooleanValues
protected void updateBooleanValues(String trueValue, String trueValueI18nKey, String falseValue, String falseValueI18nKey, Document doc) throws SMSException, SSOException
- Throws:
SMSException
SSOException
-
updateXMLDocument
protected void updateXMLDocument(StringBuffer sb, String elementName, Document updateDoc) throws SMSException, SSOException
- Throws:
SMSException
SSOException
-
updateXMLDocument
protected void updateXMLDocument(String attrName, String attrValue) throws SMSException, SSOException
update attribute value in attribute schema element- Throws:
SMSException
SSOException
-
-