public class ServiceSchema extends Object
ServiceSchema
provides interfaces to manage the
schema information of a service. The schema for a service can be one of the
following types: GLOBAL, ORGANIZATION, DYNAMIC, USER, and POLICY.Modifier | Constructor and Description |
---|---|
protected |
ServiceSchema(com.sun.identity.sm.ServiceSchemaImpl ssi,
String compName,
SchemaType type,
ServiceSchemaManager ssm) |
protected |
ServiceSchema(com.sun.identity.sm.ServiceSchemaImpl ssi,
String compName,
SchemaType type,
ServiceSchemaManager ssm,
boolean isOrgAttrSchema) |
Modifier and Type | Method and Description |
---|---|
void |
addAttributeSchema(InputStream xmlAttrSchema)
Adds the attribute schema to this service.
|
void |
addSubSchema(InputStream xmlSubSchema)
Adds the service's sub-schema given the XML input stream that follows the
SMS DTD.
|
Map<String,Set<String>> |
getAttributeDefaults()
Returns a map of all the attribute and their default values in this
schema.
|
Map<String,Set<String>> |
getAttributeExamples()
Returns a map of all the attribute and their example values in this
schema.
|
AttributeSchema |
getAttributeSchema(String attributeName)
Returns the schema for an attribute given the name of the attribute,
defined for this service.
|
Set |
getAttributeSchemaNames()
Returns the names of the schema attributes defined for the service.
|
Set<AttributeSchema> |
getAttributeSchemas()
Returns the attribute schemas defined for the service.
|
String |
getI18NFileName()
Returns the I18N properties file name for the service schema.
|
String |
getI18NKey()
Returns the I18N key that points to the description of the service.
|
String |
getI18NKeyWithoutDefault()
Returns the I18N key that points to the description of the schema, or
null if not present. |
String |
getInheritance()
Get the inheritance of this schema.
|
String |
getName()
Returns the name of the schema.
|
String |
getPropertiesViewBeanURL()
Returns the view bean URL for this service
|
Map |
getReadOnlyAttributeDefaults()
Returns an unmodifiable map of all the attribute and their default values
in this schema.
|
String |
getResourceName()
Returns the name for the service schema when used in a CREST representation.
|
Node |
getSchemaNode()
Returns the Node of this schema element.
|
protected Set |
getSearchableAttributeNames()
Returns the names of the schema attributes defined for the service which
are searchable.
|
Set |
getServiceAttributeNames()
Returns the attribute schemas defined for the service that is not a
status attribute and is not a service attribute.
|
String |
getServiceName()
Returns the name of the service.
|
SchemaType |
getServiceType()
Returns the schema type.
|
String |
getStatusAttribute()
Returns the name of the status attribute, as defined in the Service
schema
|
ServiceSchema |
getSubSchema(String subSchemaName)
Returns
ServiceSchema object given the name of the
service's sub-schema. |
Set<String> |
getSubSchemaNames()
Returns the names of sub-schemas for the service.
|
String |
getVersion()
Returns the version of the service.
|
boolean |
isExportable()
Returns
true if the service configuration created can be
exported to other organizations. |
boolean |
isHiddenInConfigUI()
Should this service schema be hidden in the Configuration UI.
|
boolean |
isRealmCloneable()
During the creation of a new organisation/realm the services assigned to the parent realm are copied to the
child realm.
|
void |
removeAttributeDefaults(Set attrs)
Removes the default values of attributes in the schema.
|
void |
removeAttributeSchema(String attrName)
Removes the attribute schema from this service.
|
void |
removeSubSchema(String subSchemaName)
Removes the service's sub-schema from the service.
|
void |
replaceAttributeSchema(String attrName,
Node attributeSchemaNode)
Removes the attribute schema from this service.
|
void |
setAttributeDefaults(Map attrs)
Method to change the default values of attributes in the schema.
|
void |
setAttributeDefaults(String attrName,
Set values)
Method to change default value for a specific attribute.
|
void |
setExportable(boolean exportable)
Sets the exportable nature of the service configurations created for this
schema.
|
void |
setI18NFileName(String url)
Sets the I18N properties file name for the service schema
|
void |
setI18Nkey(String key)
Sets the value of the I18N key in the service schema.
|
void |
setInheritance(String value)
Set the value of inheritance attribute in service schema.
|
void |
setResourceName(String name)
Sets the CREST resource name for the service schema.
|
boolean |
supportsMultipleConfigurations()
Returns
true if service schema supports multiple
configurations; false otherwise |
String |
toString()
Returns string representation of the schema.
|
Map |
validateAndInheritDefaults(Map attrMap,
boolean inherit)
Validates the
attrMap against the attributes defined in
this schema of the service. |
Map |
validateAndInheritDefaults(Map attrMap,
String orgName,
boolean inherit)
Validates the
attrMap against the attributes defined in
this schema of the service for the given organization. |
boolean |
validateAttributes(List<String> configPath,
Map<String,Set<String>> attributeSet)
Determines whether each attribute in the attribute set is valid.
|
boolean |
validateAttributes(List<String> configPath,
Map<String,Set<String>> attributeSet,
String orgName)
Determines whether each attribute in the attribute set is valid for the
given organization.
|
boolean |
validateAttributes(Map attributeSet)
Determines whether each attribute in the attribute set is valid.
|
boolean |
validateAttributes(Map attributeSet,
String orgName)
Determines whether each attribute in the attribute set is valid for the
given organization.
|
protected ServiceSchema(com.sun.identity.sm.ServiceSchemaImpl ssi, String compName, SchemaType type, ServiceSchemaManager ssm)
protected ServiceSchema(com.sun.identity.sm.ServiceSchemaImpl ssi, String compName, SchemaType type, ServiceSchemaManager ssm, boolean isOrgAttrSchema)
public String getServiceName()
public String getVersion()
public String getName()
public SchemaType getServiceType()
public String getI18NKey()
public String getI18NKeyWithoutDefault()
null
if not present.public boolean supportsMultipleConfigurations()
true
if service schema supports multiple
configurations; false
otherwisetrue
if service schema supports multiple
configurations; false
otherwisepublic String getInheritance()
The inheritance of a schema relate to that instance having a single instance or multiple instances.
See: ServiceSchema.INHERITANCE_SINGLE
and ServiceSchema.INHERITANCE_MULTIPLE
.
public void setI18Nkey(String key) throws SMSException, SSOException
key
- Value to be set for the I18N key of the service schema.SMSException
- if there is a problem setting the value in the data store.SSOException
- If the user has an invalid SSO token.public void setInheritance(String value) throws SMSException, SSOException
value
- New value of inheritance attribute.SMSException
- if there is a problem setting the value in the data store.SSOException
- if the user has an invalid single sign on token.public String getPropertiesViewBeanURL()
public String getStatusAttribute()
public boolean isExportable()
true
if the service configuration created can be
exported to other organizations.true
if service configurations for this schema can
be exported to other organizations; false
otherwise.public void setExportable(boolean exportable)
true
allows the configurations to be
exported to other organizations and a value of false
disables exporting of configuration data.exportable
- true
if service configurations for this schema
can be exported to other organizations; false
otherwise.public String getI18NFileName()
public void setI18NFileName(String url) throws SMSException, SSOException
url
- properties file nameSMSException
- if an error occurred while trying to perform the operationSSOException
- if the single sign on token is invalid or expiredpublic String getResourceName()
public boolean isHiddenInConfigUI()
public boolean isRealmCloneable()
realmCloneable
to no
to
avoid being copied.true
if the config is cloneable between realms.public void setResourceName(String name) throws SMSException, SSOException
name
- resource name.SMSException
- if an error occurred while trying to perform the operationSSOException
- if the single sign on token is invalid or expiredpublic Set getAttributeSchemaNames()
protected Set getSearchableAttributeNames()
public AttributeSchema getAttributeSchema(String attributeName)
attributeName
- the name of the schema attributepublic Set<AttributeSchema> getAttributeSchemas()
public Set getServiceAttributeNames()
public Map validateAndInheritDefaults(Map attrMap, boolean inherit) throws SMSException
attrMap
against the attributes defined in
this schema of the service. It will throw an exception if the map
contains any attribute not listed in the schema. It will also pick up
default values for any attributes not in the map but which are listed in
the schema, if the boolean inherit
is set to true.attrMap
- map of attributesinherit
- if true, then inherit the default valuesSMSException
- if invalid attribute names are present in the
attrMap
.public Map validateAndInheritDefaults(Map attrMap, String orgName, boolean inherit) throws SMSException
attrMap
against the attributes defined in
this schema of the service for the given organization. It will throw an
exception if the map contains any attribute not listed in the schema. It
will also pick up default values for any attributes not in the map but
which are listed in the schema, if the boolean inherit
is
set to true.attrMap
- map of attributesinherit
- if true, then inherit the default valuesSMSException
- if invalid attribute names are present in the
attrMap
.public void addAttributeSchema(InputStream xmlAttrSchema) throws SSOException, SMSException
xmlAttrSchema
- the XML format of the attribute schemaSMSException
- if an error occurred while performing the operationSSOException
- if the single sign on token is invalid or expiredpublic void removeAttributeSchema(String attrName) throws SSOException, SMSException
attrName
- the name of the attribute schemaSMSException
- if an error occurred while performing the operationSSOException
- if the single sign on token is invalid or expiredpublic Map<String,Set<String>> getAttributeDefaults()
public Map<String,Set<String>> getAttributeExamples()
public Map getReadOnlyAttributeDefaults()
public void setAttributeDefaults(Map attrs) throws SSOException, SMSException
attrs
- A map of the names of AttributeSchema
to
modify, and a Set of Values which should replace the default
values of the current schema.SMSException
- if an error occurred while performing the operationSSOException
- if the single sign on token is invalid or expiredpublic void setAttributeDefaults(String attrName, Set values) throws SchemaException, SMSException, SSOException
attrName
- Name of the attribute for which defaults values need to be
replaced.values
- Set of new values to replace the old ones.SchemaException
- if an error occurred while parsing the XMLSMSException
- if an error occurred while performing the operationSSOException
- if the single sign on token is invalid or expiredpublic void removeAttributeDefaults(Set attrs) throws SMSException, SSOException
attrs
- A set of the names of AttributeSchema
.SMSException
- if an error occurred while performing the operationSSOException
- if the single sign on token is invalid or expiredpublic Set<String> getSubSchemaNames()
public ServiceSchema getSubSchema(String subSchemaName) throws SMSException
ServiceSchema
object given the name of the
service's sub-schema.subSchemaName
- the name of the service's sub-schemaServiceSchema
objectSMSException
- if an error occurred while performing the operationpublic void addSubSchema(InputStream xmlSubSchema) throws SSOException, SMSException
xmlSubSchema
- the XML format of the sub-schemaSMSException
- if an error occurred while performing the operationSSOException
- if the single sign on token is invalid or expiredpublic void removeSubSchema(String subSchemaName) throws SSOException, SMSException
subSchemaName
- the name of the service's sub-schemaSMSException
- if an error occurred while performing the operationSSOException
- if the single sign on token is invalid or expiredpublic boolean validateAttributes(Map attributeSet) throws SMSException
attributeSet
- the Map
where key is the attribute name and
value is the Set
of attribute valuesSMSException
- if an error occurred while performing the operationpublic boolean validateAttributes(Map attributeSet, String orgName) throws SMSException
attributeSet
- the Map
where key is the attribute name and
value is the Set
of attribute valuesorgName
- organization nameSMSException
- if an error occurred while performing the operationpublic boolean validateAttributes(List<String> configPath, Map<String,Set<String>> attributeSet) throws SMSException
configPath
- The path of config names to the config instance - the ID of the instance should be the last
entry in the list.attributeSet
- the Map
where key is the attribute name and
value is the Set
of attribute valuesSMSException
- if an error occurred while performing the operationpublic boolean validateAttributes(List<String> configPath, Map<String,Set<String>> attributeSet, String orgName) throws SMSException
configPath
- The path of config names to the config instance - the ID of the instance should be the last
entry in the list.attributeSet
- the Map
where key is the attribute name and
value is the Set
of attribute valuesorgName
- organization nameSMSException
- if an error occurred while performing the operationpublic String toString()
public Node getSchemaNode()
ServiceType
to get ActionSchema
.ServiceType
to get ActionSchema
.public void replaceAttributeSchema(String attrName, Node attributeSchemaNode) throws SSOException, SMSException
attrName
- the name of the attribute schemaSMSException
- if an error occurred while performing the operationSSOException
- if the single sign on token is invalid or expiredCopyright © 2010-2018, ForgeRock All Rights Reserved.