com.ibm.wsspi.wim

Class GenericHelper

  • java.lang.Object
    • com.ibm.wsspi.wim.GenericHelper


  • public class GenericHelper
    extends java.lang.Object
    This class contains utility methods to be used by virtual member manager adapter and plugin providers.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String DO_FIRST_ENTITY
      The XPATH string constant for first entity in the "entities" DataObject.
      static java.lang.String EXTERNAL_ID_PATH
      The XPATH string constant for externalId.
      static java.lang.String EXTERNAL_NAME_PATH
      The XPATH string constant for externalName.
      static java.util.List IDENTIFIER_REF
      The list containing SchemaConstants.DO_IDENTIFIER as the reference property.
      static java.lang.String UNIQUE_ID_PATH
      The XPATH string constant for uniqueId.
      static java.lang.String UNIQUE_NAME_PATH
      The XPATH string constant for uniqueName.
      static java.lang.String WILDCARD
      The string constant for wild card.
    • Constructor Summary

      Constructors 
      Constructor and Description
      GenericHelper() 
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      static void checkLoginAccountReadOnlyProperties(java.lang.String type, DataObject entity, java.lang.String propName, java.lang.String repositoryId)
      For LoginAccount and its subclass types, check that principalName and realm is not set for create() and update() APIs.
      static void copyAllPropsOfDataObject(DataObject destDO, DataObject srcDO)
      Copy all properties (including reference properties) from source dataobject to destination dataobject.
      static void copyDataObject(DataObject destDO, DataObject srcDO, java.util.List props, java.util.List refs, java.lang.String mappedPrincipalNameProperty, boolean mappedPrincipalNamePropertyMultiValued, java.lang.String repositoryId)
      Copy selected properties from one dataobject to another.
      static void copyIdentifierDataObject(DataObject destDO, DataObject srcDO)
      Copy the identifier dataobject from source dataobject to destination dataobject.
      static DataObject createDataObject(DataObject parentDO, java.lang.String propertyName, java.lang.String prefixedTypeName)
      Returns a new data object contained by the given parent dataobject using the specified property, which must be a containment property.
      static java.util.Map getControlMap(DataObject root)
      Returns the control dataobjects set in the root dataobject.
      static java.lang.String getIdentifierString(DataObject entity)
      Returns the entity identifier in a string format (for tracing).
      static java.lang.String getNewUniqueName(java.lang.String type, DataObject entity, java.lang.String uniqueName)
      Builds the uniqueName of an entity, compares with the old uniqueName and returns the new uniqueName if it has changed.
      static boolean isDN(java.lang.String value)
      Determines whether the specified value is a valid Distinguished Name.
      static void saveDataGraphToFile(DataGraph entityDG, java.lang.String fileName)
      Save the DataGraph to a file.
      static void validateNestingLevel(DataObject control, java.lang.String controlType)
      Validate the nesting level in control dataobjects.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • UNIQUE_ID_PATH

        public static final java.lang.String UNIQUE_ID_PATH
        The XPATH string constant for uniqueId. The value of this field is "identifier/uniqueId".
        See Also:
        Constant Field Values
      • UNIQUE_NAME_PATH

        public static final java.lang.String UNIQUE_NAME_PATH
        The XPATH string constant for uniqueName. The value of this field is "identifier/uniqueName".
        See Also:
        Constant Field Values
      • EXTERNAL_ID_PATH

        public static final java.lang.String EXTERNAL_ID_PATH
        The XPATH string constant for externalId. The value of this field is "identifier/externalId".
        See Also:
        Constant Field Values
      • EXTERNAL_NAME_PATH

        public static final java.lang.String EXTERNAL_NAME_PATH
        The XPATH string constant for externalName. The value of this field is "identifier/externalName".
        See Also:
        Constant Field Values
      • DO_FIRST_ENTITY

        public static final java.lang.String DO_FIRST_ENTITY
        The XPATH string constant for first entity in the "entities" DataObject. The value of this field is "entities.0".
        See Also:
        Constant Field Values
      • WILDCARD

        public static final java.lang.String WILDCARD
        The string constant for wild card. The value of this field is "*".
        See Also:
        Constant Field Values
      • IDENTIFIER_REF

        public static final java.util.List IDENTIFIER_REF
        The list containing SchemaConstants.DO_IDENTIFIER as the reference property.
    • Constructor Detail

      • GenericHelper

        public GenericHelper()
    • Method Detail

      • isDN

        public static boolean isDN(java.lang.String value)
        Determines whether the specified value is a valid Distinguished Name.
        Parameters:
        value - A string value.
        Return:
        True if value is a valid Distinguished Name, false otherwise.
      • getNewUniqueName

        public static java.lang.String getNewUniqueName(java.lang.String type,
                                        DataObject entity,
                                        java.lang.String uniqueName)
                                                 throws WIMException
        Builds the uniqueName of an entity, compares with the old uniqueName and returns the new uniqueName if it has changed. If the uniqueName has not changed then returns null.
        Parameters:
        type - entity type
        entity - entity dataobject
        uniqueName - old unique name
        Throws:
        WIMException
        Return:
        New uniqueName if the uniqueName has changed, null otherwise.
      • copyIdentifierDataObject

        public static void copyIdentifierDataObject(DataObject destDO,
                                    DataObject srcDO)
                                             throws WIMException
        Copy the identifier dataobject from source dataobject to destination dataobject.
        Parameters:
        destDO - Destination dataobject.
        srcDO - Source dataobject.
        Throws:
        WIMException
      • copyAllPropsOfDataObject

        public static void copyAllPropsOfDataObject(DataObject destDO,
                                    DataObject srcDO)
                                             throws WIMException
        Copy all properties (including reference properties) from source dataobject to destination dataobject.
        Parameters:
        destDO - Destination dataobject.
        srcDO - Source dataobject.
        Throws:
        WIMException
      • copyDataObject

        public static void copyDataObject(DataObject destDO,
                          DataObject srcDO,
                          java.util.List props,
                          java.util.List refs,
                          java.lang.String mappedPrincipalNameProperty,
                          boolean mappedPrincipalNamePropertyMultiValued,
                          java.lang.String repositoryId)
                                   throws WIMException
        Copy selected properties from one dataobject to another.
        Parameters:
        destDO - destination dataobject to which the properties are copied.
        srcDO - source dataobject from which the properties are copied.
        props - List of properties to be copied. If null or empty, no props is copied. If not empty, properties in this list are copied. If prop name is *, all properties are copied except operational properties. Operational properties must be specified to be returned.
        refs - List of references(like, parent, member, etc) to be copied. If null or empty, no reference is copied. If not empty, references in this list are copied. If reference name is *, all references are copied.
        mappedPrincipalNameProperty - property name to which the principalName property of LoginAccount is mapped. If not null, principalName property is set in the destDO. The value(s) of the principalName property will be same as the value of the mapped property.
        mappedPrincipalNamePropertyMultiValued - boolean indicating whether principalName property is multi-valued. If true and mappedPrincipalNameProperty is set, all the values of mapped property will be set in the destDO.
        repositoryId - repository identifier. if not null, repository id will be set in the identifier dataobject of the destDO.
        Throws:
        WIMException
      • createDataObject

        public static DataObject createDataObject(DataObject parentDO,
                                  java.lang.String propertyName,
                                  java.lang.String prefixedTypeName)
        Returns a new data object contained by the given parent dataobject using the specified property, which must be a containment property. The package URI and the type of the created object is specified by the prefixed type name argument. The specified type must be a compatible target for the property identified by propertyName.
        Parameters:
        parentDO - the parent dataobject under which this dataobject will be created.
        propertyName - the name of the specified containment property.
        prefixedTypeName - the prefixed type name with ":" format.
        Return:
        The created dataobject.
      • checkLoginAccountReadOnlyProperties

        public static void checkLoginAccountReadOnlyProperties(java.lang.String type,
                                               DataObject entity,
                                               java.lang.String propName,
                                               java.lang.String repositoryId)
                                                        throws UpdatePropertyException
        For LoginAccount and its subclass types, check that principalName and realm is not set for create() and update() APIs. These are read only properties.
        Parameters:
        type - entity type.
        entity - entity dataobject.
        propName - property name.
        repositoryId - repository identifier.
        Throws:
        UpdatePropertyException - if the principalName or realm property is set.
      • validateNestingLevel

        public static void validateNestingLevel(DataObject control,
                                java.lang.String controlType)
                                         throws InvalidArgumentException
        Validate the nesting level in control dataobjects.
        Parameters:
        control - control dataobject
        controlType - type of control dataobject
        Throws:
        InvalidArgumentException - if SchemaConstants.PROP_LEVEL is less than 0.
      • getControlMap

        public static java.util.Map getControlMap(DataObject root)
        Returns the control dataobjects set in the root dataobject.
        Parameters:
        root - Root dataobject.
        Return:
        Map containing Control dataobject type as key and control dataobject as the value.
      • getIdentifierString

        public static java.lang.String getIdentifierString(DataObject entity)
        Returns the entity identifier in a string format (for tracing).
      • saveDataGraphToFile

        public static void saveDataGraphToFile(DataGraph entityDG,
                               java.lang.String fileName)
                                        throws WIMApplicationException
        Save the DataGraph to a file.
        Parameters:
        entityDG - entity datagraph.
        fileName - full path of the file.
        Throws:
        WIMApplicationException - if the DataGraph save fails.