8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Copyright (c) 2005 Sun Microsystems Inc. All Rights Reserved
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The contents of this file are subject to the terms
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * of the Common Development and Distribution License
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * (the License). You may not use this file except in
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * compliance with the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * You can obtain a copy of the License at
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * https://opensso.dev.java.net/public/CDDLv1.0.html or
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * See the License for the specific language governing
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * permission and limitations under the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * When distributing Covered Code, include this CDDL
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Header Notice in each file and include the License file
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * If applicable, add the following below the CDDL Header,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * with the fields enclosed by brackets [] replaced by
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * your own identifying information:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * "Portions Copyrighted [year] [name of copyright owner]"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * $Id: AttributeSchemaImpl.java,v 1.3 2008/06/25 05:44:03 qcheng Exp $
5aad467ce6f83c127919b32d6610b3e13ebc180bPhill Cunnington * Portions Copyrighted 2011-2016 ForgeRock AS.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport static com.sun.identity.sm.AttributeSchema.ListOrder.INSERTION;
f340ca28e0f04c4b3b878647094bfd9439c0b698David Lunaimport static org.forgerock.openam.utils.CollectionUtils.isEmpty;
5aad467ce6f83c127919b32d6610b3e13ebc180bPhill Cunningtonimport com.sun.identity.shared.xml.XMLUtils;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The class <code>AttributeSchemaImpl</code> provides methods to access the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * schema of a configuration parameter.
8d3140b524c0e28c0a49dc7c7d481123ef3cfe11Chris Lee // Input variables
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Variables derived from the Node
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Attribute display properties
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Constructor used by ServiceSchema to instantiate AttributeSchema objects.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Retunrs the name of the attribute.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the name of the attribute for CREST representation.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the type of the attribute.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the UI type of the attribute; or null if UI type is not defined.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the list order of the attribute, or {@code null} if the list order is not defined.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public AttributeSchema.ListOrder getListOrder() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the syntax of the attribute.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the I18N key to describe the configuration attribute.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the order of this attribute.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return the order of this attribute, null if not defined
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the value of the cosQualifier for this attribute. Either default,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * overrid, operational or merge-cos.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return the value of the cosQualifier for this attribute.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the default values of the attribute.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster defaultValues = defaultsObject.getDefaultValues();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the default values of the attribute.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param envParams
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Map of environment parameter to a set of values
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return default values for the attribute
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster defaultValues = defaultsObject.getDefaultValues(envParams);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the example values of the attribute.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster private <T> Set<T> getValuesCopy(Set<T> defaultValues) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the possible choice values for the attribute if the attribute
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * type is either <code>SINGLE_CHOICE</code> or
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <code>MULTIPLE_CHOICE</code>.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return choice values for the attribute
f340ca28e0f04c4b3b878647094bfd9439c0b698David Luna return ((String[]) ret.toArray(new String[ret.size()]));
f340ca28e0f04c4b3b878647094bfd9439c0b698David Luna * Returns the possible choice values for the attribute if the attribute
f340ca28e0f04c4b3b878647094bfd9439c0b698David Luna * type is either <code>SINGLE_CHOICE</code> or
f340ca28e0f04c4b3b878647094bfd9439c0b698David Luna * <code>MULTIPLE_CHOICE</code>.
f340ca28e0f04c4b3b878647094bfd9439c0b698David Luna * @param envParams
f340ca28e0f04c4b3b878647094bfd9439c0b698David Luna * Map of environment parameter to a set of values
f340ca28e0f04c4b3b878647094bfd9439c0b698David Luna * @return choice values for the attribute
f340ca28e0f04c4b3b878647094bfd9439c0b698David Luna choiceValues = choiceObject.getChoiceValues(envParams);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return ((String[]) ret.toArray(new String[ret.size()]));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the choice values as a Map.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return choice values for the attribute and its i18n key
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return (new HashMap());
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the choice values as a set.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return choice values for the attribute
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return (new HashSet());
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the choice values as a Map.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param envParams
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Map of environment parameter to a set of values
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return choice values for the attribute
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster protected Map getChoiceValuesMap(Map envParams) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster choiceValues = choiceObject.getChoiceValues(envParams);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return (new HashMap());
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the choice values as a set.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param envParams
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Map of environment parameter to a set of values
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return choice values for the attribute
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster protected Set getChoiceValuesSet(Map envParams) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster choiceValues = choiceObject.getChoiceValues(envParams);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return (new HashSet());
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the I18N key for the given choice value.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return the I18N key for the given choice value
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public String getChoiceValueI18NKey(String cValue) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Indicates whether this AttributeSchema has choice values configured.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the start range if the attribute syntax is either
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <code>NUMBER_RANGE</code> or <code>DECIMAL_RANGE</code>.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the end range if the attribute syntax is either
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <code>NUMBER_RANGE</code> or <code>DECIMAL_RANGE</code>.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Method to get the validator name for using to validate this service
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return the validator name
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the minimum number of values for the attribute if the attribute
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * is of type <code>MULTIPLE_CHOICE</code>.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the maximum number of values for the attribute if the attribute
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * is of type <code>MULTIPLE_CHOICE</code>.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the string value for BooleanTrueValue.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Retruns the I18N Key for BooleanTrueValue.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the string value for BooleanFalseValue.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the I18N Key for BooleanFalseValue.
return (falseValueKey);
return (isOptional);
return (isServiceIdentifier);
return (isResourceNameAllowed);
return (isStatusAttribute);
return (any);
return (attributeViewBeanURL);
return attrSchemaNode;
attrSchemaNode = n;
} catch (NumberFormatException e) {
} catch (Exception e) {
} catch (Exception e) {
} catch (Exception e) {
} catch (Exception e) {
hasChoiceValues = true;
} catch (Exception e) {
} catch (Exception e) {
} catch (Throwable e) {
} catch (NumberFormatException e) {
} catch (NumberFormatException e) {
isOptional = true;
isServiceIdentifier = false;
isServiceIdentifier = true;
isResourceNameAllowed = false;
isResourceNameAllowed = true;
isStatusAttribute = false;
isStatusAttribute = true;
isSearchable = false;
isSearchable = true;
return (retVal);
return (isSearchable);