com.ibm.commerce.rest.bod.helpers

Class DataObjectHelper

  • java.lang.Object
    • com.ibm.commerce.rest.bod.helpers.DataObjectHelper


  • public class DataObjectHelper
    extends java.lang.Object
    This class provides helper methods to create an intermediary Map from a DataObject.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String COPYRIGHT
      IBM Copyright notice field.
    • Constructor Summary

      Constructors 
      Constructor and Description
      DataObjectHelper() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static void changeKeyInMap(java.util.Map<java.lang.String,java.lang.Object> map, java.lang.String oldKey, java.lang.String newKey)
      Change a key name in a map.
      static java.util.Map<java.lang.String,java.lang.Object> createIntermediary(commonj.sdo.DataObject dataArea, java.lang.String resourceName, java.lang.String urlParamGrpName, boolean flattenNoun)
      This method create intermediary Map for a DataObject based on Map and BOD mapping configuration file for the resource.
      static void flattenListOfMap(java.util.Map<java.lang.String,java.lang.Object> map, java.lang.String key, boolean force)
      This method will call map.get(key).
      static void setResourceIdByIdentifier(java.util.Map<java.lang.String,java.lang.Object> dataMap, java.lang.String identifier, java.lang.String requestUri, java.lang.String lastPathElement)
      Derive resource id based on requestUri and the value of its ID.
      static void setResourceIdByKey(java.util.Map<java.lang.String,java.lang.Object> dataMap, java.lang.String idKey, java.lang.String requestUri, java.lang.String lastPathElement)
      Derive resource id based on requestUri and the value of its ID.
      • Methods inherited from class java.lang.Object

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

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM Copyright notice field.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DataObjectHelper

        public DataObjectHelper()
    • Method Detail

      • createIntermediary

        public static java.util.Map<java.lang.String,java.lang.Object> createIntermediary(commonj.sdo.DataObject dataArea,
                                                                                          java.lang.String resourceName,
                                                                                          java.lang.String urlParamGrpName,
                                                                                          boolean flattenNoun)
        This method create intermediary Map for a DataObject based on Map and BOD mapping configuration file for the resource.
        Parameters:
        dataArea - the data area
        resourceName - the resource name
        urlParamGrpName - the url param grp name
        flattenNoun - the flatten noun
        Returns:
        the map
      • setResourceIdByKey

        public static void setResourceIdByKey(java.util.Map<java.lang.String,java.lang.Object> dataMap,
                                              java.lang.String idKey,
                                              java.lang.String requestUri,
                                              java.lang.String lastPathElement)
        Derive resource id based on requestUri and the value of its ID.
        Parameters:
        dataMap - A map
        idKey - The key for resource identifier in map.
        requestUri - The request URI path.
        lastPathElement - The last path element on URI path that is used to construct resource id.
      • setResourceIdByIdentifier

        public static void setResourceIdByIdentifier(java.util.Map<java.lang.String,java.lang.Object> dataMap,
                                                     java.lang.String identifier,
                                                     java.lang.String requestUri,
                                                     java.lang.String lastPathElement)
        Derive resource id based on requestUri and the value of its ID.
        Parameters:
        dataMap - A map
        identifier - the identifier
        requestUri - The request URI path.
        lastPathElement - The last path element on URI path that is used to construct resource id.
      • flattenListOfMap

        public static void flattenListOfMap(java.util.Map<java.lang.String,java.lang.Object> map,
                                            java.lang.String key,
                                            boolean force)
        This method will call map.get(key). If the returned object is a List, it will flat it out by removing the List level.
        Parameters:
        map - the map
        key - the key
        force - Always do it even if the List contains more than one item
      • changeKeyInMap

        public static void changeKeyInMap(java.util.Map<java.lang.String,java.lang.Object> map,
                                          java.lang.String oldKey,
                                          java.lang.String newKey)
        Change a key name in a map.
        Parameters:
        map - the map
        oldKey - the old key
        newKey - the new key