com.loribel.commons.business
Class GB_BusinessObjectAbstract

java.lang.Object
  extended bycom.loribel.commons.business.GB_BusinessObjectAbstract
All Implemented Interfaces:
GB_BOParentOwner, GB_BOParentOwnerSet, GB_BOValueOwner, GB_LabelInfoOwner, GB_MementoCompliant, GB_SimpleBusinessObject, GB_SimpleBusinessObjectSet
Direct Known Subclasses:
GB_BusinessObjectDefault

public abstract class GB_BusinessObjectAbstract
extends java.lang.Object
implements GB_SimpleBusinessObjectSet, GB_BOValueOwner, GB_BOParentOwnerSet, GB_MementoCompliant

Default abstract implementattion of GB_SimpleBusinessObject. By default, the management of the values are delegated to GB_SimpleBOValue.

Author:
Gregory Borelli

Constructor Summary
GB_BusinessObjectAbstract()
          Constructor of GB_SimpleBusinessObjectAbstract without parameter.
 
Method Summary
 void addAllPropertyValues(java.lang.String a_propertyName, java.util.Collection a_values)
          Add some new values to a property of this businessObject.
 void addPropertyValue(java.lang.String a_propertyName, java.lang.Object a_value)
          Add or set a value to this businessObject.
 void addPropertyValue(java.lang.String a_propertyName, java.lang.Object a_value, int a_index)
          Add or set a value to this businessObject.
protected  void addPropertyValueMulti(java.lang.String a_propertyName, java.lang.Object a_value)
          Add a value to a property that accepts Multi values.
protected  void addPropertyValueMulti(java.lang.String a_propertyName, java.lang.Object a_value, int a_index)
          Add a value to a property that accepts Multi values.
protected  java.lang.String appendToString()
           
protected  java.util.Map buildBOValueMap()
          Method to init businessObjectValueMap.
protected  java.util.Map buildPropertyMap()
          Method to init propertyMap.
protected  java.util.List buildPropertyNames()
          Method to init propertyNames.
 boolean containsPropertyName(java.lang.String a_propertyName)
          Returns true if the list propertyNames contains this PropertyName.
 java.lang.String getBOName()
          Get Business Object name of the BusinessObject.
 GB_SimpleBusinessObjectSet getBoParent()
           
 GB_SimpleBOValue getBOValue(java.lang.String a_propertyName)
          Return the BusinessObjectValue, value of Map businessObjectValueMap associated with the key a_propertyName.
protected  GB_ValuesMapOwnerSet getBOValueMap(java.lang.String a_propertyName)
           
protected  GB_ValuesOwnerSet getBOValueMulti(java.lang.String a_propertyName)
          Return the container of values for property that accepts multi values.
 java.util.Map getBusinessObjectValueMap()
          Get Map of values for property..
 java.lang.String getLabelInfo()
          Vous pouvez redéfinir cette méthode si vous voulez afficher plus d'info sur vos objets.
 GB_BOProperty getProperty(java.lang.String a_propertyName)
          Return the Property, value of Map propertyMap associated with the key a_propertyName.
 GB_BOProperty[] getPropertyArray()
          Return an array with all the properties of this BusinessObject.
 int getPropertyCount()
          Returns the number of PropertyNames in the list propertyNames.
 java.util.Map getPropertyMap()
          Méthode getPropertyMap.
 java.lang.String[] getPropertyNames()
          Return a String array with all the property names of this BusinessObject.
 java.lang.Object getPropertyValue(java.lang.String a_propertyName)
          Returns the value for a property.
 int getPropertyValueIndex(java.lang.String a_propertyName, java.lang.Object a_value)
           
 java.util.Collection getPropertyValueList(java.lang.String a_propertyName)
          Return the list of values for property that accepts Multi values.
 java.util.Map getPropertyValueMap(java.lang.String a_propertyName)
           
 void installMemento(GB_Memento a_memento)
          Install a memento for this BusinessObject.
 boolean isModified()
          Returns true if this object has been modified.
 GB_Memento newMemento()
          Create a new memento for this BusinessObject.
 GB_Memento newMemento(boolean a_deep)
           
protected  java.lang.Object putBOValue(java.lang.String a_propertyName, GB_SimpleBOValue a_value)
          Add a value to the Map businessObjectValueMap.
 void putPropertyValueMap(java.lang.String a_propertyName, java.lang.String a_name, java.lang.Object a_value)
          Add a value to a property that accepts Multi values.
 void removePropertyValue(java.lang.String a_propertyName, java.lang.Object a_value)
          Remove a value for a specific property.
 void removePropertyValueMap(java.lang.String a_propertyName, java.lang.String a_name)
          Remove a value for the property a_propertyName
 void setBOName(java.lang.String a_bOName)
          Set Business Object name of the BusinessObject.
 void setBoParent(GB_SimpleBusinessObjectSet a_boParent)
           
 void setModified(boolean a_modified)
           
 void setPropertyValue(java.lang.String a_propertyName, java.lang.Object a_value)
          Set the value to a property that accepts single values.
 java.lang.String toString()
           
 void updateWithDefaultValues()
          Update values of this objects with default values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.loribel.commons.business.abstraction.GB_SimpleBusinessObjectSet
setReadOnly
 
Methods inherited from interface com.loribel.commons.business.abstraction.GB_SimpleBusinessObject
isReadOnly
 

Constructor Detail

GB_BusinessObjectAbstract

public GB_BusinessObjectAbstract()
Constructor of GB_SimpleBusinessObjectAbstract without parameter.

Method Detail

addAllPropertyValues

public void addAllPropertyValues(java.lang.String a_propertyName,
                                 java.util.Collection a_values)
Add some new values to a property of this businessObject.

Parameters:
a_propertyName - String -
a_values - Collection -

addPropertyValue

public void addPropertyValue(java.lang.String a_propertyName,
                             java.lang.Object a_value,
                             int a_index)
Add or set a value to this businessObject.

Parameters:
a_propertyName - String -
a_value - Object -

addPropertyValue

public void addPropertyValue(java.lang.String a_propertyName,
                             java.lang.Object a_value)
Add or set a value to this businessObject.

Specified by:
addPropertyValue in interface GB_SimpleBusinessObjectSet
Parameters:
a_propertyName - String -
a_value - Object -

addPropertyValueMulti

protected void addPropertyValueMulti(java.lang.String a_propertyName,
                                     java.lang.Object a_value,
                                     int a_index)
Add a value to a property that accepts Multi values.

Parameters:
a_propertyName - String - a_propertyName
a_value - Object - a_value

getPropertyValueIndex

public int getPropertyValueIndex(java.lang.String a_propertyName,
                                 java.lang.Object a_value)

addPropertyValueMulti

protected void addPropertyValueMulti(java.lang.String a_propertyName,
                                     java.lang.Object a_value)
Add a value to a property that accepts Multi values.

Parameters:
a_propertyName - String - a_propertyName
a_value - Object - a_value

buildBOValueMap

protected java.util.Map buildBOValueMap()
Method to init businessObjectValueMap.

This method is called by getBusinessObjectValueMap() to set the value of businessObjectValueMap the first time.

Returns:
Map - businessObjectValueMap

buildPropertyMap

protected java.util.Map buildPropertyMap()
Method to init propertyMap.

This method is called by getPropertyMap() to set the value of propertyMap the first time.

Returns:
Map - propertyMap

buildPropertyNames

protected java.util.List buildPropertyNames()
Method to init propertyNames.

This method is called by #getPropertyNameList() to set the value of propertyNames the first time.

Returns:
List - propertyNames

containsPropertyName

public boolean containsPropertyName(java.lang.String a_propertyName)
Returns true if the list propertyNames contains this PropertyName.

Parameters:
a_propertyName - String - element whose presence in the list is to be tested
Returns:
boolean

getBOName

public java.lang.String getBOName()
Get Business Object name of the BusinessObject.

Specified by:
getBOName in interface GB_SimpleBusinessObject
Returns:
String - bOName

getBoParent

public GB_SimpleBusinessObjectSet getBoParent()
Specified by:
getBoParent in interface GB_BOParentOwner

getBOValue

public GB_SimpleBOValue getBOValue(java.lang.String a_propertyName)
Return the BusinessObjectValue, value of Map businessObjectValueMap associated with the key a_propertyName.

Specified by:
getBOValue in interface GB_BOValueOwner
Parameters:
a_propertyName - String - name of the property
Returns:
GB_SimpleBusinessObjectValue

getBOValueMap

protected GB_ValuesMapOwnerSet getBOValueMap(java.lang.String a_propertyName)

getBOValueMulti

protected GB_ValuesOwnerSet getBOValueMulti(java.lang.String a_propertyName)
Return the container of values for property that accepts multi values.

Parameters:
a_propertyName - String -
Returns:
GB_ValuesOwnerSet

getBusinessObjectValueMap

public java.util.Map getBusinessObjectValueMap()
Get Map of values for property.. Use the method buildBusinessObjectValueMap() to init the property the first time.

Returns:
Map - businessObjectValueMap

getProperty

public GB_BOProperty getProperty(java.lang.String a_propertyName)
Return the Property, value of Map propertyMap associated with the key a_propertyName.

Specified by:
getProperty in interface GB_SimpleBusinessObject
Parameters:
a_propertyName - String -
Returns:
GB_BOProperty

getPropertyArray

public GB_BOProperty[] getPropertyArray()
Return an array with all the properties of this BusinessObject.

Returns:
GB_BOProperty[]

getPropertyCount

public int getPropertyCount()
Returns the number of PropertyNames in the list propertyNames.

Returns:
int

getPropertyMap

public java.util.Map getPropertyMap()
Méthode getPropertyMap.

Use the method buildPropertyMap() to init the property the first time.

Returns:
Map - propertyMap

getPropertyNames

public java.lang.String[] getPropertyNames()
Return a String array with all the property names of this BusinessObject.

Specified by:
getPropertyNames in interface GB_SimpleBusinessObject
Returns:
String[]

getPropertyValue

public java.lang.Object getPropertyValue(java.lang.String a_propertyName)
Returns the value for a property.

Specified by:
getPropertyValue in interface GB_SimpleBusinessObject
Parameters:
a_propertyName - String -
Returns:
Object

getPropertyValueList

public java.util.Collection getPropertyValueList(java.lang.String a_propertyName)
Return the list of values for property that accepts Multi values.

Parameters:
a_propertyName - String - a_propertyName
Returns:
Collection

getPropertyValueMap

public java.util.Map getPropertyValueMap(java.lang.String a_propertyName)

installMemento

public void installMemento(GB_Memento a_memento)
Install a memento for this BusinessObject. Restore each single property value of memento to this BusinessObject. For multi property : - clear the list of the values - restore the old list (item by item)

Specified by:
installMemento in interface GB_MementoCompliant
Parameters:
a_memento - GB_Memento - the memento to use

isModified

public boolean isModified()
Description copied from interface: GB_SimpleBusinessObject
Returns true if this object has been modified. If a complex property has been changed, this method may return false if no direct modifications has beeen done to the simple properties of this object.

Specified by:
isModified in interface GB_SimpleBusinessObject
Returns:
boolean

newMemento

public GB_Memento newMemento()
Create a new memento for this BusinessObject. For single property keep the value For multi property clone the list of values in a new List (no deep clone).

Specified by:
newMemento in interface GB_MementoCompliant
Returns:
GB_Memento

newMemento

public GB_Memento newMemento(boolean a_deep)

putBOValue

protected java.lang.Object putBOValue(java.lang.String a_propertyName,
                                      GB_SimpleBOValue a_value)
Add a value to the Map businessObjectValueMap.

Parameters:
a_propertyName - String - name of the property
a_value - GB_SimpleBusinessObjectValue - value of the property
Returns:
Object - Previous value associated with specified key, or null if there was no mapping for key.

putPropertyValueMap

public void putPropertyValueMap(java.lang.String a_propertyName,
                                java.lang.String a_name,
                                java.lang.Object a_value)
Add a value to a property that accepts Multi values.

Specified by:
putPropertyValueMap in interface GB_SimpleBusinessObjectSet
Parameters:
a_propertyName - String - a_propertyName
a_value - Object - a_value

removePropertyValue

public void removePropertyValue(java.lang.String a_propertyName,
                                java.lang.Object a_value)
Remove a value for a specific property. This method is used for property that accepts multi values.

Specified by:
removePropertyValue in interface GB_SimpleBusinessObjectSet
Parameters:
a_propertyName - String - a_propertyName
a_value - Object - a_value

removePropertyValueMap

public void removePropertyValueMap(java.lang.String a_propertyName,
                                   java.lang.String a_name)
Description copied from interface: GB_SimpleBusinessObjectSet
Remove a value for the property a_propertyName

Specified by:
removePropertyValueMap in interface GB_SimpleBusinessObjectSet
Parameters:
a_propertyName - String -

setBOName

public void setBOName(java.lang.String a_bOName)
Set Business Object name of the BusinessObject.

Parameters:
a_bOName - String - bOName

setBoParent

public void setBoParent(GB_SimpleBusinessObjectSet a_boParent)
Specified by:
setBoParent in interface GB_BOParentOwnerSet

setModified

public void setModified(boolean a_modified)
Specified by:
setModified in interface GB_SimpleBusinessObjectSet

setPropertyValue

public void setPropertyValue(java.lang.String a_propertyName,
                             java.lang.Object a_value)
Set the value to a property that accepts single values.

Specified by:
setPropertyValue in interface GB_SimpleBusinessObjectSet
Parameters:
a_propertyName - String - a_propertyName
a_value - Object - a_value

updateWithDefaultValues

public void updateWithDefaultValues()
Update values of this objects with default values.


toString

public java.lang.String toString()

appendToString

protected java.lang.String appendToString()

getLabelInfo

public java.lang.String getLabelInfo()
Vous pouvez redéfinir cette méthode si vous voulez afficher plus d'info sur vos objets.

Specified by:
getLabelInfo in interface GB_LabelInfoOwner


Copyright © 2002-2007 Gregory Borelli [Loribel]. All Rights Reserved.