com.loribel.commons.business
Class GB_BusinessObjectDefault

java.lang.Object
  extended bycom.loribel.commons.business.GB_BusinessObjectAbstract
      extended bycom.loribel.commons.business.GB_BusinessObjectDefault
All Implemented Interfaces:
GB_BOParentOwner, GB_BOParentOwnerSet, GB_BOValueOwner, GB_BusinessObject, GB_Debugable, GB_LabelInfoOwner, GB_MementoCompliant, GB_MyPropertyOwner, GB_SimpleBusinessObject, GB_SimpleBusinessObjectSet, GB_Unregisterable
Direct Known Subclasses:
GB_BOEnumItemBOGen, GB_BOEnumItemSearchBOGen, GB_BOEnumValuesBOGen, GB_BOEnumValuesGroupBOGen, GB_BOExtendsBOGen, GB_BOExtensionBOGen, GB_BOLinkIdBOGen, GB_BOLinkIdLongBOGen, GB_BOMetaDataBOGen, GB_BOMetaDataSearchBOGen, GB_BOPropertyBOGen, GB_BOPropertySearchBOGen, GB_BOStringMBOGen, GB_Regex2FileFilterBOGen

public class GB_BusinessObjectDefault
extends GB_BusinessObjectAbstract
implements GB_BusinessObject, GB_Debugable, GB_Unregisterable

Default implementation for BusinessObject.

Author:
Gregory Borelli

Nested Class Summary
 
Nested classes inherited from class com.loribel.commons.business.abstraction.GB_BusinessObject
GB_BusinessObject.MY_PROPERTY
 
Constructor Summary
GB_BusinessObjectDefault(java.lang.String a_name)
          Constructor of GB_BusinessObjectDefault with parameter(s).
 
Method Summary
 void addApplyPropertyChangeListener(GB_MyPropertyChangeListener a_listener)
          Add a PropertyChangeListener for the specific property MY_PROPERTY.APPLY.
 void addMyPropertyChangeListener(GB_MyPropertyChangeListener a_listener)
          Add a MyPropertyChangeListener to the listener list.
 void addMyPropertyChangeListener(java.lang.String a_property, GB_MyPropertyChangeListener a_listener)
          Add a MyPropertyChangeListener for a specific property.
protected  void addPropertyDependent(java.lang.String a_propertySrc, java.lang.String a_calculatedProperty)
          Add a dependence between properties.
 void addPropertyValue(java.lang.String a_propertyName, java.lang.Object a_value, int a_index)
          Subclass this method to fire event when a property changes.
protected  java.util.Map buildBOValueMap()
          Overwrite method to create a new Map with the init size = propertyCount.
protected  java.util.Map buildPropertyMap()
          This method is used the first time we demand the map of properties.
protected  java.util.List buildPropertyNames()
          This method is used the first time we demand the propertyNames.
 void doApply()
          Do Apply and send MyPropertyEvent.
 void doUpdate()
          Send PropertyEvent for property MY_PROPERTY_UPDATE.
protected  void fireEventFromBOValue(java.lang.String a_propertyName)
          Fire a event on a specific property.
protected  void fireMyPropertyChange(java.lang.String a_propertyName, java.lang.Object a_oldValue, java.lang.Object a_newValue)
          Report a property update to any registered listeners.
 java.util.List getAllListeners()
          Returns a list of all listeners.
 boolean isReadOnly()
          Get flag read-only.
 void removeApplyPropertyChangeListener(GB_MyPropertyChangeListener a_listener)
          Remove a PropertyChangeListener for the specific property MY_PROPERTY.APPLY.
 void removeMyPropertyChangeListener(GB_MyPropertyChangeListener a_listener)
          Remove a GB_PropertyChangeListener from the listener list.
 void removeMyPropertyChangeListener(java.lang.String a_property, GB_MyPropertyChangeListener a_listener)
          Remove a GB_PropertyChangeListener for a specific property.
 void removePropertyValue(java.lang.String a_propertyName, java.lang.Object a_value)
          Subclass this method to fire event when a property changes.
 void setModified(boolean a_modified)
          Override method to fire property event when flag change.
 void setPropertyValue(java.lang.String a_propertyName, java.lang.Object a_value)
          Subclass this method to fire event when a property changes.
 void setReadOnly(boolean a_flagReadOnly)
          Set flag read-only.
 java.util.List toDebug()
          Returns an array to debug values of BusinessObject.
 java.lang.String toDebugId()
          Returns an id for debug.
 boolean unregister()
          Unregister all listeners of this business object.
 
Methods inherited from class com.loribel.commons.business.GB_BusinessObjectAbstract
addAllPropertyValues, addPropertyValue, addPropertyValueMulti, addPropertyValueMulti, appendToString, containsPropertyName, getBOName, getBoParent, getBOValue, getBOValueMap, getBOValueMulti, getBusinessObjectValueMap, getLabelInfo, getProperty, getPropertyArray, getPropertyCount, getPropertyMap, getPropertyNames, getPropertyValue, getPropertyValueIndex, getPropertyValueList, getPropertyValueMap, installMemento, isModified, newMemento, newMemento, putBOValue, putPropertyValueMap, removePropertyValueMap, setBOName, setBoParent, toString, updateWithDefaultValues
 
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
addPropertyValue, putPropertyValueMap, removePropertyValueMap
 
Methods inherited from interface com.loribel.commons.business.abstraction.GB_SimpleBusinessObject
getBOName, getProperty, getPropertyNames, getPropertyValue, isModified
 
Methods inherited from interface com.loribel.commons.business.abstraction.GB_BOParentOwner
getBoParent
 
Methods inherited from interface com.loribel.commons.abstraction.GB_LabelInfoOwner
getLabelInfo
 
Methods inherited from interface com.loribel.commons.business.abstraction.GB_BOParentOwnerSet
setBoParent
 
Methods inherited from interface com.loribel.commons.business.abstraction.GB_BOValueOwner
getBOValue
 
Methods inherited from interface com.loribel.commons.abstraction.GB_MementoCompliant
installMemento, newMemento
 

Constructor Detail

GB_BusinessObjectDefault

public GB_BusinessObjectDefault(java.lang.String a_name)
Constructor of GB_BusinessObjectDefault with parameter(s).

Parameters:
a_name - String - business Object Name
Method Detail

addApplyPropertyChangeListener

public void addApplyPropertyChangeListener(GB_MyPropertyChangeListener a_listener)
Add a PropertyChangeListener for the specific property MY_PROPERTY.APPLY. The listener will be invoked only when a call on fireMyPropertyChange names that specific property.

Parameters:
a_listener - GB_MyPropertyChangeListener - the PropertyChangeListener to be added

addMyPropertyChangeListener

public void addMyPropertyChangeListener(GB_MyPropertyChangeListener a_listener)
Add a MyPropertyChangeListener to the listener list. The listener is registered for all properties.

Specified by:
addMyPropertyChangeListener in interface GB_MyPropertyOwner
Parameters:
a_listener - GB_MyPropertyChangeListener - the PropertyChangeListener to be added

addMyPropertyChangeListener

public void addMyPropertyChangeListener(java.lang.String a_property,
                                        GB_MyPropertyChangeListener a_listener)
Add a MyPropertyChangeListener for a specific property. The listener will be invoked only when a call on fireMyPropertyChange names that specific property.

Specified by:
addMyPropertyChangeListener in interface GB_MyPropertyOwner
Parameters:
a_property - String - the name of the property to listen on
a_listener - GB_MyPropertyChangeListener - the PropertyChangeListener to be added

addPropertyDependent

protected void addPropertyDependent(java.lang.String a_propertySrc,
                                    java.lang.String a_calculatedProperty)
Add a dependence between properties. When property a_propertySrc change, simulate a change of the property a_calculatedProperty. In general, a_calculatedProperty is a calculated property that use the value of a_propertySrc.

Parameters:
a_propertySrc - String - the property source
a_calculatedProperty - String - the property that must change when the property source changes

addPropertyValue

public void addPropertyValue(java.lang.String a_propertyName,
                             java.lang.Object a_value,
                             int a_index)
Subclass this method to fire event when a property changes.

Overrides:
addPropertyValue in class GB_BusinessObjectAbstract
Parameters:
a_propertyName - String -
a_value - Object -

buildBOValueMap

protected java.util.Map buildBOValueMap()
Overwrite method to create a new Map with the init size = propertyCount.

Overrides:
buildBOValueMap in class GB_BusinessObjectAbstract
Returns:
Map

buildPropertyMap

protected java.util.Map buildPropertyMap()
This method is used the first time we demand the map of properties. In the superclasse, this method returns null by default.

Overrides:
buildPropertyMap in class GB_BusinessObjectAbstract
Returns:
Map

buildPropertyNames

protected java.util.List buildPropertyNames()
This method is used the first time we demand the propertyNames. In the superclasse, this method returns null by default.

Overrides:
buildPropertyNames in class GB_BusinessObjectAbstract
Returns:
List

doApply

public void doApply()
Do Apply and send MyPropertyEvent.

Specified by:
doApply in interface GB_BusinessObject

doUpdate

public void doUpdate()
Send PropertyEvent for property MY_PROPERTY_UPDATE.

Specified by:
doUpdate in interface GB_BusinessObject

fireEventFromBOValue

protected void fireEventFromBOValue(java.lang.String a_propertyName)
Fire a event on a specific property. This method is used by {@link #addPropertyDependent()).

Parameters:
a_propertyName - String - a_propertyName

fireMyPropertyChange

protected void fireMyPropertyChange(java.lang.String a_propertyName,
                                    java.lang.Object a_oldValue,
                                    java.lang.Object a_newValue)
Report a property update to any registered listeners.

Parameters:
a_propertyName - String - the programmatic name of the property that was changed
a_oldValue - Object - the old value of the property
a_newValue - Object - the new value of the property

getAllListeners

public java.util.List getAllListeners()
Returns a list of all listeners.

Returns:
List

isReadOnly

public boolean isReadOnly()
Get flag read-only.

Specified by:
isReadOnly in interface GB_SimpleBusinessObject
Returns:
boolean - flagReadOnly

removeApplyPropertyChangeListener

public void removeApplyPropertyChangeListener(GB_MyPropertyChangeListener a_listener)
Remove a PropertyChangeListener for the specific property MY_PROPERTY.APPLY.

Parameters:
a_listener - GB_MyPropertyChangeListener - the PropertyChangeListener to be added

removeMyPropertyChangeListener

public void removeMyPropertyChangeListener(GB_MyPropertyChangeListener a_listener)
Remove a GB_PropertyChangeListener from the listener list. This removes a GB_PropertyChangeListener that was registered for all properties.

Specified by:
removeMyPropertyChangeListener in interface GB_MyPropertyOwner
Parameters:
a_listener - GB_MyPropertyChangeListener - the PropertyChangeListener to be removed

removeMyPropertyChangeListener

public void removeMyPropertyChangeListener(java.lang.String a_property,
                                           GB_MyPropertyChangeListener a_listener)
Remove a GB_PropertyChangeListener for a specific property.

Specified by:
removeMyPropertyChangeListener in interface GB_MyPropertyOwner
Parameters:
a_property - String - the name of the property that was listened on
a_listener - GB_MyPropertyChangeListener - the PropertyChangeListener to be removed

removePropertyValue

public void removePropertyValue(java.lang.String a_propertyName,
                                java.lang.Object a_value)
Subclass this method to fire event when a property changes.

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

setModified

public void setModified(boolean a_modified)
Override method to fire property event when flag change. The property used: MY_PROPERTY.MODIFY.

Specified by:
setModified in interface GB_SimpleBusinessObjectSet
Overrides:
setModified in class GB_BusinessObjectAbstract

setPropertyValue

public void setPropertyValue(java.lang.String a_propertyName,
                             java.lang.Object a_value)
Subclass this method to fire event when a property changes.

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

setReadOnly

public void setReadOnly(boolean a_flagReadOnly)
Set flag read-only.

Specified by:
setReadOnly in interface GB_SimpleBusinessObjectSet
Parameters:
a_flagReadOnly - boolean - flagReadOnly

toDebug

public java.util.List toDebug()
Returns an array to debug values of BusinessObject.

Specified by:
toDebug in interface GB_Debugable
Returns:
Object[]

toDebugId

public java.lang.String toDebugId()
Returns an id for debug.

Specified by:
toDebugId in interface GB_Debugable
Returns:
String

unregister

public boolean unregister()
Unregister all listeners of this business object.

Specified by:
unregister in interface GB_Unregisterable
Returns:
boolean


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