Class BusinessObjectBase
- java.lang.Object
-
- de.hybris.platform.sap.core.bol.businessobject.BusinessObjectBase
-
- All Implemented Interfaces:
BackendAware,BusinessObject,MessageListHolder,java.io.Serializable,java.lang.Cloneable
- Direct Known Subclasses:
AddressImpl,ConnectedObjectImpl,ConverterImpl,PartnerBaseImpl,SapCreditCheckBOImpl,SapInvoiceBOImpl,SapPricingImpl,SapProductAvailabilityBOImpl,SchedlineImpl,SearchImpl,SimpleDocumentImpl,SimpleHeaderImpl,SimpleItemImpl,TestBusinessObjectBaseBEDeterminationImpl,TestBusinessObjectBaseBEDeterminationNotFoundImpl,TestBusinessObjectBaseBEInjectionImpl,TestBusinessObjectBaseBENotUniqueDeterminationImpl,TestBusinessObjectBaseBESingleImplementationImpl,TransactionConfigurationImpl
public class BusinessObjectBase extends java.lang.Object implements BusinessObject, BackendAware, java.lang.Cloneable
Base implementation for business object interface.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected BackendBusinessObjectbackendObjectBackend Object reference.protected java.lang.StringbackendTypeBackend type.protected MessageListbobMessagesBusiness Object messages.protected intbobStateBusiness Object state.protected java.util.Map<java.lang.String,java.lang.Object>extensionDataExtension data map.protected GenericFactorygenericFactoryGeneric Factory to create data container beans.protected java.lang.StringhandleTemporary handle.protected ModuleConfigurationAccessmoduleConfigurationAccessAccess to module configuration data.protected TechKeytechKeyTechnical key.-
Fields inherited from interface de.hybris.platform.sap.core.common.message.MessageListHolder
INVALID, VALID
-
-
Constructor Summary
Constructors Constructor Description BusinessObjectBase()Standard constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddExtensionData(java.lang.String key, java.lang.Object value)This method stores arbitrary data within this Business Object.voidaddMessage(Message message)Add a message to the message list.voidclearMessages()Clear all messages in the message list.voidclearMessages(java.lang.String resourceKey)Removes all messages with the given key from the list of messages.voidclearOwnMessages()Clears all messages and set state of the Business Object to valid.java.lang.Objectclone()Makes a copy of the object.voidcopyMessages(BusinessObjectBase bob)copy the messages from an another BusinessObject and add this to the object.voidcopyMessages(MessageListHolder messageListHolder)Copy the messages from an another Message list holder and add this to the object.voidcreateUniqueHandle()This method creates a unique handle, as an alternative key for the business object, because at the creation point no techkey for the object exists.voiddestroy()This method is called before the bean is invalidated It needs to be defined in the Spring bean definition as destroy-method.protected voiddetermineBackendObject(boolean initialize)Determines the backend object.booleanequals(java.lang.Object o)Compares this object to the specified object.BackendBusinessObjectgetBackendBusinessObject()Returns the backend business object.BackendBusinessObjectgetBackendBusinessObject(boolean initialize)Returns the backend business object.java.lang.StringgetBackendType()Get the current backend type.java.lang.ObjectgetExtensionData(java.lang.String key)This method retrieves extension data associated with the Business Object.java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>>getExtensionDataValues()This method retrieves all extension data associated with the Business Object.java.util.Map<java.lang.String,java.lang.Object>getExtensionMap()Returns the extension map.java.lang.StringgetHandle()This method returns the handle, as an alternative key for the business object, because at the creation point no techKey for the object exists.MessageListgetMessageList()Returns the messages list object itself.protected ModuleConfigurationAccessgetModuleConfigurationAccess()Returns theModuleConfigurationAccess.MessageListgetOwnMessageList()Returns the messages of the Business Object itself.java.util.Iterator<BusinessObjectBase>getSubObjectIterator()The method returns an iterator over all sub objects of the BusinessObject.TechKeygetTechKey()Retrieves the key for the object.booleanhasHandle()Returns the information, if a handle for the object exists.inthashCode()Returns the hash code for this object.booleanhasMessages()Returns if the business object or one of it sub objects has a message.booleanhasOwnMessages()Returns if the business object itself has a message.voidinit()This method is called after all properties have been set It needs to be defined in the Spring bean definition as init-method.booleanisValid()Returns if the business object is valid.voidlogMessage(Message message)Log an message to the IsaLocation of BusinessObject.voidremoveExtensionData(java.lang.String key)This method removes extension data from the Business Object.voidremoveExtensionDataValues()This method removes all extensions data from the Business Object.voidsetBackendObject(BackendBusinessObject backendObject)Set the current backend business object (optional).voidsetBackendType(java.lang.String backendType)Set the current backend type.voidsetExtensionMap(java.util.Map<java.lang.String,java.lang.Object> extensionData)Sets the extension map to the given map.voidsetGenericFactory(GenericFactory genericFactory)Injection setter forGenericFactory.voidsetHandle(java.lang.String handle)This method sets the handle, as an alternative key for the business object, because at the creation point no techkey for the object exists.voidsetInvalid()Set the Business Object invalid, no property.voidsetModuleConfigurationAccess(ModuleConfigurationAccess moduleConfigurationAccess)Injection setter forModuleConfigurationAccess.voidsetTechKey(TechKey techKey)Sets the key for the document.voidsetValid()Set the Business Object valid, no property.java.lang.StringtoString()
-
-
-
Field Detail
-
techKey
protected TechKey techKey
Technical key.
-
handle
protected java.lang.String handle
Temporary handle.
-
bobMessages
protected MessageList bobMessages
Business Object messages.
-
bobState
protected int bobState
Business Object state.
-
extensionData
protected java.util.Map<java.lang.String,java.lang.Object> extensionData
Extension data map.
-
backendType
protected java.lang.String backendType
Backend type.
-
backendObject
protected BackendBusinessObject backendObject
Backend Object reference.
-
genericFactory
protected GenericFactory genericFactory
Generic Factory to create data container beans.
-
moduleConfigurationAccess
protected ModuleConfigurationAccess moduleConfigurationAccess
Access to module configuration data.
-
-
Method Detail
-
setGenericFactory
public void setGenericFactory(GenericFactory genericFactory)
Injection setter forGenericFactory.- Parameters:
genericFactory-GenericFactory
-
setModuleConfigurationAccess
public void setModuleConfigurationAccess(ModuleConfigurationAccess moduleConfigurationAccess)
Injection setter forModuleConfigurationAccess.- Parameters:
moduleConfigurationAccess- theModuleConfigurationAccessto set
-
setBackendObject
public void setBackendObject(BackendBusinessObject backendObject)
Set the current backend business object (optional).- Parameters:
backendObject- the backend business object to use
-
setBackendType
public void setBackendType(java.lang.String backendType)
Set the current backend type.- Parameters:
backendType- backend type
-
init
public void init()
Description copied from interface:BusinessObjectThis method is called after all properties have been set It needs to be defined in the Spring bean definition as init-method.- Specified by:
initin interfaceBusinessObject
-
destroy
public void destroy()
Description copied from interface:BusinessObjectThis method is called before the bean is invalidated It needs to be defined in the Spring bean definition as destroy-method.- Specified by:
destroyin interfaceBusinessObject
-
getBackendType
public java.lang.String getBackendType()
Get the current backend type.- Returns:
- backend type
-
getBackendBusinessObject
public BackendBusinessObject getBackendBusinessObject() throws BackendException
Description copied from interface:BackendAwareReturns the backend business object.- Specified by:
getBackendBusinessObjectin interfaceBackendAware- Returns:
- backend business object
- Throws:
BackendException-BackendException
-
getBackendBusinessObject
public BackendBusinessObject getBackendBusinessObject(boolean initialize) throws BackendException
Description copied from interface:BackendAwareReturns the backend business object.- Specified by:
getBackendBusinessObjectin interfaceBackendAware- Parameters:
initialize- if true, backend object is re-created- Returns:
- backend business object
- Throws:
BackendException-BackendException
-
getTechKey
public TechKey getTechKey()
Description copied from interface:BusinessObjectRetrieves the key for the object.- Specified by:
getTechKeyin interfaceBusinessObject- Returns:
- The object's key
-
setTechKey
public void setTechKey(TechKey techKey)
Description copied from interface:BusinessObjectSets the key for the document.- Specified by:
setTechKeyin interfaceBusinessObject- Parameters:
techKey- Key to be set
-
createUniqueHandle
public void createUniqueHandle()
Description copied from interface:BusinessObjectThis method creates a unique handle, as an alternative key for the business object, because at the creation point no techkey for the object exists. Therefore maybay the handle is needed to identify the object in backend- Specified by:
createUniqueHandlein interfaceBusinessObject
-
setHandle
public void setHandle(java.lang.String handle)
Description copied from interface:BusinessObjectThis method sets the handle, as an alternative key for the business object, because at the creation point no techkey for the object exists. Therefore maybay the handle is needed to identify the object in backend- Specified by:
setHandlein interfaceBusinessObject- Parameters:
handle- the handle of business object which identifies the object in the backend, if the techkey still not exists
-
getHandle
public java.lang.String getHandle()
Description copied from interface:BusinessObjectThis method returns the handle, as an alternative key for the business object, because at the creation point no techKey for the object exists. Therefore maybe the handle is needed to identify the object in back end return the handle of business object which is needed to identify the object in the back end, if the techKey still not exists- Specified by:
getHandlein interfaceBusinessObject- Returns:
- the BO handle
-
hasHandle
public boolean hasHandle()
Description copied from interface:BusinessObjectReturns the information, if a handle for the object exists.- Specified by:
hasHandlein interfaceBusinessObject- Returns:
- true, if there is a handle false, if the handle is
nullor if the handle is an empty string.
-
setInvalid
public void setInvalid()
Description copied from interface:BusinessObjectSet the Business Object invalid, no property.- Specified by:
setInvalidin interfaceBusinessObject
-
setValid
public void setValid()
Description copied from interface:BusinessObjectSet the Business Object valid, no property.- Specified by:
setValidin interfaceBusinessObject
-
isValid
public boolean isValid()
Description copied from interface:BusinessObjectReturns if the business object is valid.- Specified by:
isValidin interfaceBusinessObject- Returns:
- valid
-
addMessage
public void addMessage(Message message)
Description copied from interface:MessageListHolderAdd a message to the message list.- Specified by:
addMessagein interfaceMessageListHolder- Parameters:
message- message to add
-
copyMessages
public void copyMessages(BusinessObjectBase bob)
Description copied from interface:BusinessObjectcopy the messages from an another BusinessObject and add this to the object.- Specified by:
copyMessagesin interfaceBusinessObject- Parameters:
bob- reference to aBusinessObjectBaseobject
-
copyMessages
public void copyMessages(MessageListHolder messageListHolder)
Description copied from interface:BusinessObjectCopy the messages from an another Message list holder and add this to the object.- Specified by:
copyMessagesin interfaceBusinessObject- Parameters:
messageListHolder- reference to aMessageListHolderobject
-
hasMessages
public boolean hasMessages()
Description copied from interface:BusinessObjectReturns if the business object or one of it sub objects has a message.- Specified by:
hasMessagesin interfaceBusinessObject- Returns:
true, if at least one message exists
-
clearMessages
public void clearMessages(java.lang.String resourceKey)
Description copied from interface:BusinessObjectRemoves all messages with the given key from the list of messages.- Specified by:
clearMessagesin interfaceBusinessObject- Parameters:
resourceKey- resourceKey of messages
-
hasOwnMessages
public boolean hasOwnMessages()
Description copied from interface:BusinessObjectReturns if the business object itself has a message.- Specified by:
hasOwnMessagesin interfaceBusinessObject- Returns:
true, if at least one message exists
-
getOwnMessageList
public MessageList getOwnMessageList()
Description copied from interface:BusinessObjectReturns the messages of the Business Object itself.- Specified by:
getOwnMessageListin interfaceBusinessObject- Returns:
- message list of Business Object without child objects
-
clearMessages
public void clearMessages()
Description copied from interface:MessageListHolderClear all messages in the message list.- Specified by:
clearMessagesin interfaceMessageListHolder
-
clearOwnMessages
public void clearOwnMessages()
Description copied from interface:BusinessObjectClears all messages and set state of the Business Object to valid.- Specified by:
clearOwnMessagesin interfaceBusinessObject
-
getMessageList
public MessageList getMessageList()
Description copied from interface:MessageListHolderReturns the messages list object itself. Always the reference of the original object should be provided.- Specified by:
getMessageListin interfaceMessageListHolder- Returns:
- reference to message list
-
logMessage
public void logMessage(Message message)
Description copied from interface:BusinessObjectLog an message to the IsaLocation of BusinessObject.- Specified by:
logMessagein interfaceBusinessObject- Parameters:
message- message to log
-
getSubObjectIterator
public java.util.Iterator<BusinessObjectBase> getSubObjectIterator()
The method returns an iterator over all sub objects of the BusinessObject.- Specified by:
getSubObjectIteratorin interfaceBusinessObject- Returns:
- Iterator to loop over sub objects
-
addExtensionData
public void addExtensionData(java.lang.String key, java.lang.Object value)Description copied from interface:BusinessObjectThis method stores arbitrary data within this Business Object.- Specified by:
addExtensionDatain interfaceBusinessObject- Parameters:
key- key with which the specified value is to be associated.value- value to be associated with the specified key.
-
getExtensionData
public java.lang.Object getExtensionData(java.lang.String key)
Description copied from interface:BusinessObjectThis method retrieves extension data associated with the Business Object.- Specified by:
getExtensionDatain interfaceBusinessObject- Parameters:
key- key with which the specified value is to be associated.- Returns:
- value which is associated with the specified key
-
removeExtensionData
public void removeExtensionData(java.lang.String key)
Description copied from interface:BusinessObjectThis method removes extension data from the Business Object.- Specified by:
removeExtensionDatain interfaceBusinessObject- Parameters:
key- key of the extension data
-
getExtensionDataValues
public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> getExtensionDataValues()
Description copied from interface:BusinessObjectThis method retrieves all extension data associated with the Business Object.- Specified by:
getExtensionDataValuesin interfaceBusinessObject- Returns:
- all extension data as entry set
-
removeExtensionDataValues
public void removeExtensionDataValues()
Description copied from interface:BusinessObjectThis method removes all extensions data from the Business Object.- Specified by:
removeExtensionDataValuesin interfaceBusinessObject
-
setExtensionMap
public void setExtensionMap(java.util.Map<java.lang.String,java.lang.Object> extensionData)
Description copied from interface:BusinessObjectSets the extension map to the given map.- Specified by:
setExtensionMapin interfaceBusinessObject- Parameters:
extensionData- the new extension HashMap for the object
-
getExtensionMap
public java.util.Map<java.lang.String,java.lang.Object> getExtensionMap()
Description copied from interface:BusinessObjectReturns the extension map.- Specified by:
getExtensionMapin interfaceBusinessObject- Returns:
- extensionData, the extension Map of the object
-
getModuleConfigurationAccess
protected ModuleConfigurationAccess getModuleConfigurationAccess()
Returns theModuleConfigurationAccess.- Returns:
- the
ModuleConfigurationAccess
-
determineBackendObject
protected void determineBackendObject(boolean initialize)
Determines the backend object.- Parameters:
initialize- if true, backend object is reset first (works only in determination mode!)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
Compares this object to the specified object. The result istrueif and only if the argument is notnulland is of the same class that has the same technical key (TechKey) as this object.- Overrides:
equalsin classjava.lang.Object- Parameters:
o- Object to compare with- Returns:
trueif the objects are identical; otherwiesefalse.
-
hashCode
public int hashCode()
Returns the hash code for this object.- Overrides:
hashCodein classjava.lang.Object- Returns:
- Hash code
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedExceptionMakes a copy of the object. The MessageList is copied.- Overrides:
clonein classjava.lang.Object- Returns:
- a copy of object
- Throws:
java.lang.CloneNotSupportedException-CloneNotSupportedException
-
-