com.corrspt.xeo.tests
Class AbstractJSONImplementation

java.lang.Object
  extended by com.corrspt.xeo.tests.AbstractJSONImplementation
All Implemented Interfaces:
BaseModel

public abstract class AbstractJSONImplementation
extends java.lang.Object
implements BaseModel


Field Summary
protected  JSONObject attributes
           
protected static java.lang.String BOUI
           
protected  java.util.Map<java.lang.String,java.util.List<BaseModel>> bridges
           
protected static java.lang.String CHANGED
           
protected static java.lang.String CLASSNAME
           
protected static java.lang.String DISABLED
           
protected static java.lang.String EXISTS
           
protected  java.util.Map<java.lang.String,netgest.io.iFile> ifiles
           
protected static java.lang.String OBJ_ATTRIBUTE_ERRORS
           
protected static java.lang.String OBJ_ERRORS
           
protected  BaseModel parent
           
protected static java.lang.String PARENT
           
protected  java.util.Map<java.lang.String,BaseModel> relations
           
protected static java.lang.String SYS_DTCREATE
           
protected static java.lang.String SYS_UPDATE
           
protected  JSONObject system
           
 
Constructor Summary
protected AbstractJSONImplementation()
           
protected AbstractJSONImplementation(JSONObject definition)
           
 
Method Summary
 void addErrorMessage(java.lang.String errorMessage)
          Adds a new error message to the instance
 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
protected  boolean contains(java.lang.String key)
           
 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
protected  java.lang.String get(java.lang.String key)
           
protected  java.lang.Boolean getBoolean(java.lang.String key)
           
protected  boolean getBoolSys(java.lang.String key)
           
 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
protected  java.util.Date getDate(java.lang.String key)
           
 java.util.Date getDateCreate()
          Retrieve the date of creation for this object
 java.util.Date getDateLastUpdate()
          Retrieve the date of the last update to this instance
 netgest.bo.runtime.EboContext getEboContext()
          Retrieves the EboContext associated to this object
protected  java.lang.Long getLong(java.lang.String key)
           
protected  long getLongSys(java.lang.String key)
           
 netgest.bo.runtime.boObject getOriginal()
          Retrieves the original instance
 BaseModel getParent()
          Returns the parent object for this instance
protected  java.lang.String getString(java.lang.String key)
           
protected  java.lang.String getStringSys(java.lang.String key)
           
 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 o)
          Whether the instance is the same as the passed one
 boolean isValid()
          Whether the instance is valid or not
protected  void markChanged()
           
protected  void put(java.lang.String key, java.lang.Object value)
           
protected  void putSystem(java.lang.String key, java.lang.Object value)
           
protected  void removeKey(java.lang.String key)
           
 void setParent(BaseModel parent)
          Sets the parent for this instance
 void update()
          Saves the instance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXISTS

protected static final java.lang.String EXISTS
See Also:
Constant Field Values

CHANGED

protected static final java.lang.String CHANGED
See Also:
Constant Field Values

DISABLED

protected static final java.lang.String DISABLED
See Also:
Constant Field Values

CLASSNAME

protected static final java.lang.String CLASSNAME
See Also:
Constant Field Values

SYS_DTCREATE

protected static final java.lang.String SYS_DTCREATE
See Also:
Constant Field Values

SYS_UPDATE

protected static final java.lang.String SYS_UPDATE
See Also:
Constant Field Values

PARENT

protected static final java.lang.String PARENT
See Also:
Constant Field Values

OBJ_ERRORS

protected static final java.lang.String OBJ_ERRORS
See Also:
Constant Field Values

OBJ_ATTRIBUTE_ERRORS

protected static final java.lang.String OBJ_ATTRIBUTE_ERRORS
See Also:
Constant Field Values

BOUI

protected static final java.lang.String BOUI
See Also:
Constant Field Values

attributes

protected JSONObject attributes

ifiles

protected java.util.Map<java.lang.String,netgest.io.iFile> ifiles

relations

protected java.util.Map<java.lang.String,BaseModel> relations

bridges

protected java.util.Map<java.lang.String,java.util.List<BaseModel>> bridges

parent

protected BaseModel parent

system

protected JSONObject system
Constructor Detail

AbstractJSONImplementation

protected AbstractJSONImplementation(JSONObject definition)

AbstractJSONImplementation

protected AbstractJSONImplementation()
Method Detail

put

protected void put(java.lang.String key,
                   java.lang.Object value)

contains

protected boolean contains(java.lang.String key)

removeKey

protected void removeKey(java.lang.String key)

markChanged

protected void markChanged()

putSystem

protected void putSystem(java.lang.String key,
                         java.lang.Object value)

get

protected java.lang.String get(java.lang.String key)

getString

protected java.lang.String getString(java.lang.String key)

getDate

protected java.util.Date getDate(java.lang.String key)

getLong

protected java.lang.Long getLong(java.lang.String key)

getBoolean

protected java.lang.Boolean getBoolean(java.lang.String key)

getBoolSys

protected boolean getBoolSys(java.lang.String key)

getLongSys

protected long getLongSys(java.lang.String key)

getStringSys

protected java.lang.String getStringSys(java.lang.String key)

update

public void update()
            throws netgest.bo.runtime.boRuntimeException
Description copied from interface: BaseModel
Saves the instance

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

destroy

public void destroy()
             throws netgest.bo.runtime.boRuntimeException
Description copied from interface: BaseModel
Deletes this instance

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

getOriginal

public netgest.bo.runtime.boObject getOriginal()
Description copied from interface: BaseModel
Retrieves the original instance

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

getCardId

public java.lang.String getCardId()
Description copied from interface: BaseModel
Retrieves the textual card id

Specified by:
getCardId in interface BaseModel
Returns:
A String with the card id

getCardIdIcon

public java.lang.String getCardIdIcon()
Description copied from interface: BaseModel
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

getXeoModelName

public java.lang.String getXeoModelName()
Description copied from interface: BaseModel
Retrieve the name of the Model

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

addErrorMessage

public void addErrorMessage(java.lang.String errorMessage)
Description copied from interface: BaseModel
Adds a new error message to the instance

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

hasErrors

public boolean hasErrors()
Description copied from interface: BaseModel
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()
Description copied from interface: BaseModel
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()
Description copied from interface: BaseModel
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()
Description copied from interface: BaseModel
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()
Description copied from interface: BaseModel
Clears the list of errors (instance and object)

Specified by:
clearErrors in interface BaseModel

clearObjectErrors

public void clearObjectErrors()
Description copied from interface: BaseModel
Clears errors of the instance

Specified by:
clearObjectErrors in interface BaseModel

clearAttributeErrors

public void clearAttributeErrors()
Description copied from interface: BaseModel
Clears all errors associated to attributes

Specified by:
clearAttributeErrors in interface BaseModel

isChanged

public boolean isChanged()
Description copied from interface: BaseModel
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()
Description copied from interface: BaseModel
Disables all attributes in the instance

Specified by:
disable in interface BaseModel

isDisabled

public boolean isDisabled()
Description copied from interface: BaseModel
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()
Description copied from interface: BaseModel
Enables the instance (sets all attributes to enabled)

Specified by:
enable in interface BaseModel

isEnabled

public boolean isEnabled()
Description copied from interface: BaseModel
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)
Description copied from interface: BaseModel
Sets the parent for this instance

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

getEboContext

public netgest.bo.runtime.EboContext getEboContext()
Description copied from interface: BaseModel
Retrieves the EboContext associated to this object

Specified by:
getEboContext in interface BaseModel
Returns:
The EboContext

getBoui

public BOUI getBoui()
Description copied from interface: BaseModel
Retrieves the BOUI of the instance

Specified by:
getBoui in interface BaseModel
Returns:

getDateCreate

public java.util.Date getDateCreate()
Description copied from interface: BaseModel
Retrieve the date of creation for this object

Specified by:
getDateCreate in interface BaseModel

getDateLastUpdate

public java.util.Date getDateLastUpdate()
Description copied from interface: BaseModel
Retrieve the date of the last update to this instance

Specified by:
getDateLastUpdate in interface BaseModel

hasParent

public boolean hasParent()
Description copied from interface: BaseModel
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

getParent

public BaseModel getParent()
Description copied from interface: BaseModel
Returns the parent object for this instance

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

isSame

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

Specified by:
isSame in interface BaseModel
Parameters:
o - 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