Package de.hybris.platform.sap.sapordermgmtbol.transaction.salesdocument.backend.impl.messagemapping
Class BackendMessageMapperImpl
- java.lang.Object
-
- de.hybris.platform.sap.sapordermgmtbol.transaction.salesdocument.backend.impl.messagemapping.BackendMessageMapperImpl
-
- All Implemented Interfaces:
BackendMessageMapper
public class BackendMessageMapperImpl extends java.lang.Object implements BackendMessageMapper
Maps backend messages to BOL messages (with a replaced text or a replaced severity). Refer to messages.xml
-
-
Field Summary
Fields Modifier and Type Field Description protected static charBAPI_RETURN_ABORTIndicates that message reflects a fatal errorprotected static charBAPI_RETURN_ERRORIndicates that message reflects an errorprotected static charBAPI_RETURN_INFOIndicates that message reflects an informationprotected static charBAPI_RETURN_SUCCESSIndicates that message reflects a success informationprotected static charBAPI_RETURN_WARNINGIndicates that message reflects a warningprotected GenericFactorygenericFactoryFactory to access SAP session beansprotected MessageMappingRulesContainermessageMappingRulesContainerContainer for message mapping rules, parsed from messages.xmlprotected static Log4JWrappersapLoggerLogging instance
-
Constructor Summary
Constructors Constructor Description BackendMessageMapperImpl()Default constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected BackendMessagecreateBackendMessage(com.sap.conn.jco.JCoRecord struct)Creates new message based on a JCO structureprotected BusinessObjectfindReferredBO(BusinessObject rootBo, BackendMessage msg)Find BO a message belongs toprotected booleanisMessageReferChildBO(BusinessObject bo, BackendMessage msg)Does message belong to a child BO?protected booleanisMessageReferRootBO(BusinessObject bo, BackendMessage msg)Does message refer to the root BO?Messagemap(BusinessObject rootBo, com.sap.conn.jco.JCoRecord struct)Maps messages contained in the provided table structure to a BO.voidmap(BusinessObject rootBo, com.sap.conn.jco.JCoRecord singleMsg, com.sap.conn.jco.JCoTable msgTable)Maps messages contained in the provided table and/or structure to a BO.protected static intmsgTypeBe2Java(java.lang.String msgType)Convert external message type to internal.protected OrderMgmtMessagepassMessage(BackendMessage beMsg)Parses messagevoidsetGenericFactory(GenericFactory genericFactory)protected static intseverityScale(char beSeverity)Returns a relative scale of severity.protected voidtakeOverAllwaysPassedAttributes(BackendMessage beMsg, OrderMgmtMessage msg)Transfers attributes from a backend message to a transformed one (reference key, parameters)protected OrderMgmtMessagetransformMessageByRule(BackendMessage beMsg, MessageMappingRule rule)Transforms a message from backend applying the rules from messages.xml
-
-
-
Field Detail
-
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:
- Constant Field Values
-
BAPI_RETURN_WARNING
protected static final char BAPI_RETURN_WARNING
Indicates that message reflects a warning- See Also:
- Constant Field Values
-
BAPI_RETURN_INFO
protected static final char BAPI_RETURN_INFO
Indicates that message reflects an information- See Also:
- Constant Field Values
-
BAPI_RETURN_ABORT
protected static final char BAPI_RETURN_ABORT
Indicates that message reflects a fatal error- See Also:
- Constant Field Values
-
BAPI_RETURN_SUCCESS
protected static final char BAPI_RETURN_SUCCESS
Indicates that message reflects a success information- See Also:
- Constant Field Values
-
messageMappingRulesContainer
protected MessageMappingRulesContainer messageMappingRulesContainer
Container for message mapping rules, parsed from messages.xml
-
-
Method Detail
-
msgTypeBe2Java
protected static int msgTypeBe2Java(java.lang.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:BackendMessageMapperMaps messages contained in the provided table and/or structure to a BO. Mapping is according to the rules defined in messages.xml- Specified by:
mapin interfaceBackendMessageMapper- Parameters:
rootBo- BO which gets the messagessingleMsg- Error structuremsgTable- 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:BackendMessageMapperMaps messages contained in the provided table structure to a BO. Mapping is according to the rules defined in messages.xml- Specified by:
mapin interfaceBackendMessageMapper- 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 messagerule- 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 messagemsg- Transformed message
-
isMessageReferRootBO
protected boolean isMessageReferRootBO(BusinessObject bo, BackendMessage msg)
Does message refer to the root BO?- Parameters:
bo- Business object which might contain childsmsg- 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 childsmsg- 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 childsmsg- 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
-
-