com.corrspt.xeo.api.core
Class AbstractModelWrapper

java.lang.Object
  extended by com.corrspt.xeo.api.core.AbstractModelWrapper
All Implemented Interfaces:
BaseModel
Direct Known Subclasses:
XEOObject

public class AbstractModelWrapper
extends java.lang.Object
implements BaseModel

Base class for the wrappers around instances XEO Models


Nested Class Summary
static class AbstractModelWrapper.SystemAtts
          Enumeration of System Attributes
 
Field Summary
protected  netgest.bo.runtime.boObject object
          The instance to wrap
 
Constructor Summary
protected AbstractModelWrapper(netgest.bo.runtime.boObject obj)
          Constructor from a given instance
protected AbstractModelWrapper(long boui, netgest.bo.runtime.EboContext ctx)
          Constructor from a BOUI
 
Method Summary
 void addErrorMessage(java.lang.String errorMessage)
          Adds a new error message to the instance
protected  void checkEboContextIsActive()
           
protected  void checkObjectLoaded()
          Checks if the object is loaded and if not, attempts to load it
 void clearAttributeErrors()
          Clears all errors associated to attributes
 void clearErrors()
          Clears the list of errors (instance and object)
 void clearObjectErrors()
          Clears errors of the instance
 void destroy()
          Deletes this instance
 void disable()
          Disables all attributes in the instance
 void enable()
          Enables the instance (sets all attributes to enabled)
 boolean exists()
          Checks whether the object is persisted in the database or not
 BOUI getBoui()
          Retrieves the BOUI of the instance
 java.lang.String getCardId()
          Retrieves the textual card id
 java.lang.String getCardIdIcon()
          Retrieves the CardId with the icon as a string
 java.util.Date getDateCreate()
          Retrieve the date of creation for this object
 java.util.Date getDateLastUpdate()
          Retrieve the date of the lastupdate to this instance
 netgest.bo.runtime.EboContext getEboContext()
          Retrieves the EboContext associated to this object
 netgest.bo.runtime.boObject getOriginal()
          Retrieves the original instance
 BaseModel getParent()
          Returns the parent object for this instance
 java.lang.String getXeoModelName()
          Retrieve the name of the Model
 boolean hasAttributeErrors()
          Checks whether the instance has errors in its attributes
 boolean hasErrors()
          Checks whether the instance has errors (either object or attribute errors)
 boolean hasErrorsInObjectOnly()
          Checks whether there are errors in the instance (does not include attribute errors)
 boolean hasParent()
          Checks whether this object has a parent object
 boolean isChanged()
          Whether the instance was changed since it was first loaded
 boolean isDisabled()
          Checks whether the instance is disabled not
 boolean isEnabled()
          Checks whether the instance is enabled or not
 boolean isSame(BaseModel model)
          Whether the instance is the same as the passed one
 boolean isValid()
          Whether the instance is valid or not
 void setParent(BaseModel parent)
          Sets the parent for this instance
 java.lang.String toString()
           
 void update()
          Saves the instance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

object

protected netgest.bo.runtime.boObject object
The instance to wrap

Constructor Detail

AbstractModelWrapper

protected AbstractModelWrapper(netgest.bo.runtime.boObject obj)
Constructor from a given instance

Parameters:
obj - The instance to wrap

AbstractModelWrapper

protected AbstractModelWrapper(long boui,
                               netgest.bo.runtime.EboContext ctx)
Constructor from a BOUI

Parameters:
boui - The boui to load from
ctx - The EboContext
Method Detail

checkEboContextIsActive

protected void checkEboContextIsActive()

checkObjectLoaded

protected void checkObjectLoaded()
Checks if the object is loaded and if not, attempts to load it

Throws:
netgest.bo.runtime.boRuntimeException

update

public void update()
            throws netgest.bo.runtime.boRuntimeException
Saves the instance

Specified by:
update in interface BaseModel
Throws:
netgest.bo.runtime.boRuntimeException

destroy

public void destroy()
             throws netgest.bo.runtime.boRuntimeException
Deletes this instance

Specified by:
destroy in interface BaseModel
Throws:
netgest.bo.runtime.boRuntimeException

getOriginal

public netgest.bo.runtime.boObject getOriginal()
Retrieves the original instance

Specified by:
getOriginal in interface BaseModel
Returns:
The original boObject instance

getCardId

public java.lang.String getCardId()
Retrieves the textual card id

Specified by:
getCardId in interface BaseModel
Returns:
A Strgin with the card id
Throws:
netgest.bo.runtime.boRuntimeException

getCardIdIcon

public java.lang.String getCardIdIcon()
Retrieves the CardId with the icon as a string

Specified by:
getCardIdIcon in interface BaseModel
Returns:
An Html String with the icon and the Card id
Throws:
netgest.bo.runtime.boRuntimeException

getXeoModelName

public java.lang.String getXeoModelName()
Retrieve the name of the Model

Specified by:
getXeoModelName in interface BaseModel
Returns:
A string with the name of the model

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

addErrorMessage

public void addErrorMessage(java.lang.String errorMessage)
Adds a new error message to the instance

Specified by:
addErrorMessage in interface BaseModel
Parameters:
errorMessage - The error message

hasErrors

public boolean hasErrors()
Checks whether the instance has errors (either object or attribute errors)

Specified by:
hasErrors in interface BaseModel
Returns:
True if the instance has errors and false otherwise

hasAttributeErrors

public boolean hasAttributeErrors()
Checks whether the instance has errors in its attributes

Specified by:
hasAttributeErrors in interface BaseModel
Returns:
True if any error has an attribute and false otherwise

hasErrorsInObjectOnly

public boolean hasErrorsInObjectOnly()
Checks whether there are errors in the instance (does not include attribute errors)

Specified by:
hasErrorsInObjectOnly in interface BaseModel
Returns:
True if the instance (not its attribute) has errors

exists

public boolean exists()
Checks whether the object is persisted in the database or not

Specified by:
exists in interface BaseModel
Returns:
True if the object exists in the database and false otherwise

clearErrors

public void clearErrors()
Clears the list of errors (instance and object)

Specified by:
clearErrors in interface BaseModel

clearObjectErrors

public void clearObjectErrors()
Clears errors of the instance

Specified by:
clearObjectErrors in interface BaseModel

clearAttributeErrors

public void clearAttributeErrors()
Clears all errors associated to attributes

Specified by:
clearAttributeErrors in interface BaseModel

isChanged

public boolean isChanged()
Whether the instance was changed since it was first loaded

Specified by:
isChanged in interface BaseModel
Returns:
True if the instance was changed since it was first loaded and false otherwise

disable

public void disable()
Disables all attributes in the instance

Specified by:
disable in interface BaseModel
Throws:
netgest.bo.runtime.boRuntimeException

isDisabled

public boolean isDisabled()
Checks whether the instance is disabled not

Specified by:
isDisabled in interface BaseModel
Returns:
True if the instance is disabled and false otherwise

enable

public void enable()
Enables the instance (sets all attributes to enabled)

Specified by:
enable in interface BaseModel

isEnabled

public boolean isEnabled()
Checks whether the instance is enabled or not

Specified by:
isEnabled in interface BaseModel
Returns:
True if the instance is enabled and false otherwise

setParent

public void setParent(BaseModel parent)
Sets the parent for this instance

Specified by:
setParent in interface BaseModel
Parameters:
parent - The parent

getEboContext

public netgest.bo.runtime.EboContext getEboContext()
Retrieves the EboContext associated to this object

Specified by:
getEboContext in interface BaseModel
Returns:
The EboContext

getBoui

public BOUI getBoui()
Retrieves the BOUI of the instance

Specified by:
getBoui in interface BaseModel
Returns:

getDateCreate

public java.util.Date getDateCreate()
Retrieve the date of creation for this object

Specified by:
getDateCreate in interface BaseModel
Returns:
Throws:
netgest.bo.runtime.boRuntimeException

getDateLastUpdate

public java.util.Date getDateLastUpdate()
Retrieve the date of the lastupdate to this instance

Specified by:
getDateLastUpdate in interface BaseModel
Returns:
Throws:
netgest.bo.runtime.boRuntimeException

hasParent

public boolean hasParent()
Checks whether this object has a parent object

Specified by:
hasParent in interface BaseModel
Returns:
True if the object has a parent and false otherwise
Throws:
netgest.bo.runtime.boRuntimeException

getParent

public BaseModel getParent()
Returns the parent object for this instance

Specified by:
getParent in interface BaseModel
Returns:
The parent of this instance

isSame

public boolean isSame(BaseModel model)
Description copied from interface: BaseModel
Whether the instance is the same as the passed one

Specified by:
isSame in interface BaseModel
Parameters:
model - The instance to compare
Returns:
True if the instances are the same

isValid

public boolean isValid()
Description copied from interface: BaseModel
Whether the instance is valid or not

Specified by:
isValid in interface BaseModel
Returns:
True if the instance is valid and false otherwise