com.ibm.commerce.component.servicemapper

Class ServiceMappingGroup

  • java.lang.Object
    • com.ibm.commerce.component.servicemapper.ServiceMappingGroup


  • public class ServiceMappingGroup
    extends java.lang.Object
    This class represents a group of service mappings between a set of request parameters and a service. A mapping group has an identifying name, a corresponding service name, and a collection of service mappings. A service mapping group has the following requirements: -- Its name can not be empty or contain only blanks. If a given name is blank, the group will ignore the name. -- Each mapping has a unique source.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String CLASS_NAME
      The name of this class
      static java.lang.String COPYRIGHT
      IBM copyright notice field.
    • Constructor Summary

      Constructors 
      Constructor and Description
      ServiceMappingGroup()
      Constructs an empty service mapping group
      ServiceMappingGroup(java.lang.String groupName, java.lang.String serviceName, ServiceMapping[] mappings, java.lang.Class serviceInputType, java.lang.Class defaultNounType, java.lang.Class verbType)
      Construct a service mapping group with given configuration.
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM copyright notice field.
        See Also:
        Constant Field Values
      • CLASS_NAME

        public static final java.lang.String CLASS_NAME
        The name of this class
    • Constructor Detail

      • ServiceMappingGroup

        public ServiceMappingGroup()
        Constructs an empty service mapping group
      • ServiceMappingGroup

        public ServiceMappingGroup(java.lang.String groupName,
                                   java.lang.String serviceName,
                                   ServiceMapping[] mappings,
                                   java.lang.Class serviceInputType,
                                   java.lang.Class defaultNounType,
                                   java.lang.Class verbType)
        Construct a service mapping group with given configuration.
        Parameters:
        groupName - the name of this service mapping group
        serviceName - the name of the service described by this mapping group
        mappings - the mappings to be added to this mapping group
        serviceInputType - the type of the service input object.
        defaultNounType - the default noun type for the group. It can be null
        verbType - the concrete verb Verb used by the service input of this group
    • Method Detail

      • addServiceMappings

        public void addServiceMappings(ServiceMapping[] mappings)
        Adds a list of mappings for the mapping group
        Parameters:
        mappings - an array of ServiceMapping instances
      • setServiceMappings

        public void setServiceMappings(ServiceMapping[] mappings)
        Sets the service mappings to the given one
        Parameters:
        mappings - the array of mappings to be set
      • addServiceMappings

        public void addServiceMappings(java.util.List mappingList)
        Adds the mappings for the mapping group
        Parameters:
        mappings - an array of ServiceMapping instances
      • addServiceMapping

        public void addServiceMapping(ServiceMapping mapping)
        Add a ServiceMapping to the service mapping group
        Parameters:
        mapping - the ServiceMapping instance to be added
      • getAllMappings

        public java.util.Collection getAllMappings()
        Retrieves all the mappings in this mapping group.
        Returns:
        The collection of all the ServiceMapping instances. Empty collection if no mappings are stored.
      • getName

        public java.lang.String getName()
        Retrieves the name of this service mapping group
        Returns:
        A string that represents the name of this mapping group. Null if there is no name for this group.
      • getServiceName

        public java.lang.String getServiceName()
        Retrieves the name of this service
        Returns:
        A string that represents the name of the mapped service. Null if there is no name for the service.
      • getServiceMapping

        public ServiceMapping getServiceMapping(java.lang.String source)
        Retrieves the ServiceMapping object that has the given source
        Parameters:
        source - the source that is mapped in a mapping
        Returns:
        the mapping that has the given source and variables (if any). If no such mapping is found, this method will return Null.
      • setServiceName

        public void setServiceName(java.lang.String serviceName)
        Sets the name of the mapped service. Invalid name will be ignored.
        Parameters:
        name - the name of this mapping group
      • setName

        public void setName(java.lang.String name)
        Sets the name of the mapping group. Invalid name will be ignored.
        Parameters:
        name - the name of this mapping group
      • setServiceInputType

        public void setServiceInputType(java.lang.Class serviceInputType)
        Sets the input type of a the service that has the service name of this mapping group
        Parameters:
        serviceInputType - the type of the service input object
      • getServiceInputType

        public java.lang.Class getServiceInputType()
        Retrieves the service input type
        Returns:
        the class of the service input object
      • isValidName

        public static final boolean isValidName(java.lang.String name)
        Determines if a string is valid for service name or group name.
        Parameters:
        name - the string intended to be used for either group name or service name
        Returns:
        true if the given name is not null, empty, or contains only blanks. False otherwise.
      • hasName

        public boolean hasName()
        Determines if this service mapping group has a valid name. A valid name should be a non-empty, non-blank string.
        Returns:
        true if there is a non-empty, non-blank string. Otherwise false.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        Returns:
        The string representation of the mapping group
      • getDefaultNounType

        public java.lang.Class getDefaultNounType()
        Returns:
        the default noun type for this mapping group
      • setDefaultNounType

        public void setDefaultNounType(java.lang.Class nounType)
        Sets the default noun type for this mapping group
        Parameters:
        nounType - the type to set
      • getVerbType

        public java.lang.Class getVerbType()
        Returns:
        the verb type for this group's service input
      • setVerbType

        public void setVerbType(java.lang.Class verbType)
        Sets the verb type for this group
        Parameters:
        verbType - the type of the verb to set