java.lang.Object
de.hybris.platform.sap.sapordermgmtbol.transaction.salesdocument.backend.impl.messagemapping.BackendMessageMapperImpl
All Implemented Interfaces:
BackendMessageMapper

public class BackendMessageMapperImpl extends Object implements BackendMessageMapper
Maps backend messages to BOL messages (with a replaced text or a replaced severity). Refer to messages.xml
  • Field Details

    • sapLogger

      protected static final Log4JWrapper sapLogger
      Logging instance
    • genericFactory

      protected GenericFactory genericFactory
      Factory to access SAP session beans
    • BAPI_RETURN_ERROR

      protected static final char BAPI_RETURN_ERROR
      Indicates that message reflects an error
      See Also:
    • BAPI_RETURN_WARNING

      protected static final char BAPI_RETURN_WARNING
      Indicates that message reflects a warning
      See Also:
    • BAPI_RETURN_INFO

      protected static final char BAPI_RETURN_INFO
      Indicates that message reflects an information
      See Also:
    • BAPI_RETURN_ABORT

      protected static final char BAPI_RETURN_ABORT
      Indicates that message reflects a fatal error
      See Also:
    • BAPI_RETURN_SUCCESS

      protected static final char BAPI_RETURN_SUCCESS
      Indicates that message reflects a success information
      See Also:
    • messageMappingRulesContainer

      protected MessageMappingRulesContainer messageMappingRulesContainer
      Container for message mapping rules, parsed from messages.xml
  • Constructor Details

    • BackendMessageMapperImpl

      public BackendMessageMapperImpl()
      Default constructor
  • Method Details

    • msgTypeBe2Java

      protected static int msgTypeBe2Java(String msgType)
      Convert external message type to internal. Returns '0' if the message could not being converted.
      Parameters:
      msgType - message type external
      Returns:
      message type internal
    • setGenericFactory

      public void setGenericFactory(GenericFactory genericFactory)
      Parameters:
      genericFactory - Factory to access SAP session beans
    • map

      public void map(BusinessObject rootBo, com.sap.conn.jco.JCoRecord singleMsg, com.sap.conn.jco.JCoTable msgTable) throws BackendException
      Description copied from interface: BackendMessageMapper
      Maps messages contained in the provided table and/or structure to a BO. Mapping is according to the rules defined in messages.xml
      Specified by:
      map in interface BackendMessageMapper
      Parameters:
      rootBo - BO which gets the messages
      singleMsg - Error structure
      msgTable - Error table, typically of structure BAPIRET2
      Throws:
      BackendException
    • map

      public Message map(BusinessObject rootBo, com.sap.conn.jco.JCoRecord struct) throws BackendException
      Description copied from interface: BackendMessageMapper
      Maps messages contained in the provided table structure to a BO. Mapping is according to the rules defined in messages.xml
      Specified by:
      map in interface BackendMessageMapper
      Parameters:
      rootBo - BO which gets the messages
      Returns:
      A BOL message
      Throws:
      BackendException
    • createBackendMessage

      protected BackendMessage createBackendMessage(com.sap.conn.jco.JCoRecord struct)
      Creates new message based on a JCO structure
      Parameters:
      struct - JCO structure
      Returns:
      Backend message
    • transformMessageByRule

      protected OrderMgmtMessage transformMessageByRule(BackendMessage beMsg, MessageMappingRule rule)
      Transforms a message from backend applying the rules from messages.xml
      Parameters:
      beMsg - Backend message
      rule - Rule
      Returns:
      Transformed message
    • passMessage

      protected OrderMgmtMessage passMessage(BackendMessage beMsg)
      Parses message
      Parameters:
      beMsg -
      Returns:
      Transformed message
    • takeOverAllwaysPassedAttributes

      protected void takeOverAllwaysPassedAttributes(BackendMessage beMsg, OrderMgmtMessage msg)
      Transfers attributes from a backend message to a transformed one (reference key, parameters)
      Parameters:
      beMsg - Backend message
      msg - Transformed message
    • isMessageReferRootBO

      protected boolean isMessageReferRootBO(BusinessObject bo, BackendMessage msg)
      Does message refer to the root BO?
      Parameters:
      bo - Business object which might contain childs
      msg - Backend message
      Returns:
      Belongs to root?
    • isMessageReferChildBO

      protected boolean isMessageReferChildBO(BusinessObject bo, BackendMessage msg)
      Does message belong to a child BO?
      Parameters:
      bo - Business object, might contain childs
      msg - Backend message
      Returns:
      Belongs to a child?
    • findReferredBO

      protected BusinessObject findReferredBO(BusinessObject rootBo, BackendMessage msg)
      Find BO a message belongs to
      Parameters:
      rootBo - Business object, might contain childs
      msg - Backend message
      Returns:
      The BO a message belongs to (either root or a child)
    • severityScale

      protected static int severityScale(char beSeverity)
      Returns a relative scale of severity.

      Concrete value is unimportant. Defined for severity comparison.

      Parameters:
      beSeverity - Severity
      Returns:
      Scale