org.broadleafcommerce.openadmin.client.dto
Class Entity

java.lang.Object
  extended by org.broadleafcommerce.openadmin.client.dto.Entity
All Implemented Interfaces:
com.google.gwt.user.client.rpc.IsSerializable, Serializable

public class Entity
extends Object
implements com.google.gwt.user.client.rpc.IsSerializable, Serializable

Generic DTO for a domain object. Each property of the domain object is represented by the 'properties' instance variable which allows for further display metadata to be stored.

Author:
jfischer
See Also:
Property}, Serialized Form

Constructor Summary
Entity()
           
 
Method Summary
 void addProperty(Property property)
           
 void addValidationError(String fieldName, String errorOrErrorKey)
          Adds a single validation error to this entity.
 boolean equals(Object o)
           
 Property findProperty(String name)
           
 Boolean getActive()
           
 Boolean getDeleted()
           
 Boolean getInactive()
           
 Boolean getLocked()
           
 String getLockedBy()
           
 String getLockedDate()
           
 Map<String,Property> getPMap()
           
 Property[] getProperties()
           
 String[] getType()
           
 String[][] getValidationErrors()
          The validation errors returned here are all 2-element arrays.
 int hashCode()
           
 boolean isDirty()
           
 boolean isMultiPartAvailableOnThread()
           
 boolean isValidationFailure()
           
 void mergeProperties(String prefix, Entity entity)
           
 void setActive(Boolean active)
           
 void setDeleted(Boolean deleted)
           
 void setDirty(boolean dirty)
           
 void setInactive(Boolean inactive)
           
 void setLocked(Boolean locked)
           
 void setLockedBy(String lockedBy)
           
 void setLockedDate(String lockedDate)
           
 void setMultiPartAvailableOnThread(boolean multiPartAvailableOnThread)
           
 void setProperties(Property[] properties)
           
 void setType(String[] type)
           
 void setValidationErrors(String[][] validationErrors)
          Completely reset the validation errors for this Entity.
 void setValidationFailure(boolean validationFailure)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Entity

public Entity()
Method Detail

getType

public String[] getType()

setType

public void setType(String[] type)

getPMap

public Map<String,Property> getPMap()

getProperties

public Property[] getProperties()

setProperties

public void setProperties(Property[] properties)

mergeProperties

public void mergeProperties(String prefix,
                            Entity entity)

findProperty

public Property findProperty(String name)

addProperty

public void addProperty(Property property)

addValidationError

public void addValidationError(String fieldName,
                               String errorOrErrorKey)
Adds a single validation error to this entity. Note that in order to ensure that a

Parameters:
fieldName - - the field that is in error. This works on top-level properties (like a 'manufacturer' field on a Product entity) but can also work on properties gleaned from a related entity (like 'defaultSku.weight.weightUnitOfMeasure' on a Product entity)
errorOrErrorKey - - the error message to present to a user. Could be the actual error message or a key to a property in messages.properties to support different locales

isDirty

public boolean isDirty()

setDirty

public void setDirty(boolean dirty)

isMultiPartAvailableOnThread

public boolean isMultiPartAvailableOnThread()

setMultiPartAvailableOnThread

public void setMultiPartAvailableOnThread(boolean multiPartAvailableOnThread)

isValidationFailure

public boolean isValidationFailure()

setValidationFailure

public void setValidationFailure(boolean validationFailure)

getValidationErrors

public String[][] getValidationErrors()
The validation errors returned here are all 2-element arrays. Index 0 holds the property name that failed validation while index 1 holds the validation error message (which could be either a message key or the actual message itself)

Returns:
a list of 2-element arrays that correspond to validation errors on this Entity

setValidationErrors

public void setValidationErrors(String[][] validationErrors)
Completely reset the validation errors for this Entity. In most cases it is more appropriate to use the convenience method for adding a single error via addValidationError(String, String).

Parameters:
validationErrors -
See Also:
addValidationError(String, String)

getActive

public Boolean getActive()

setActive

public void setActive(Boolean active)

getDeleted

public Boolean getDeleted()

setDeleted

public void setDeleted(Boolean deleted)

getInactive

public Boolean getInactive()

setInactive

public void setInactive(Boolean inactive)

getLocked

public Boolean getLocked()

setLocked

public void setLocked(Boolean locked)

getLockedBy

public String getLockedBy()

setLockedBy

public void setLockedBy(String lockedBy)

getLockedDate

public String getLockedDate()

setLockedDate

public void setLockedDate(String lockedDate)

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2013. All Rights Reserved.