|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.tenduke.types.AbstractBindableObject
com.tenduke.objectmodel.TendukeObject
public abstract class TendukeObject
Base class for 10duke object model objects.
| Nested Class Summary | |
|---|---|
static class |
TendukeObject.CreatedDateComparator<T extends TendukeObject>
|
static class |
TendukeObject.ModifiedDateComparator<T extends TendukeObject>
|
| Field Summary | |
|---|---|
static java.lang.String |
FIELD_NAME_CREATED
Field name for created timestamp. |
static java.lang.String |
FIELD_NAME_CREATED_BY_PROFILE
Name that identifies TendukeObject._createdByProfile field, use case: bind. |
static java.lang.String |
FIELD_NAME_MODIFIED
Field name for modified timestamp. |
static java.lang.String |
FIELD_NAME_MODIFIED_BY_PROFILE
Name that identifies TendukeObject._modifiedByProfile field, use case: bind. |
static java.lang.String |
FIELD_NAME_OBJECT_CATEGORY
Name that identifies TendukeObject object category member, use case: bind. |
static java.lang.String |
FIELD_NAME_OBJECT_CATEGORY_ID
Name that identifies TendukeObject object category id member. |
static java.lang.String |
FIELD_NAME_OBJECT_CONSUMPTION
Name that identifies TendukeObject object properties member, use case: bind. |
static java.lang.String |
FIELD_NAME_OBJECT_FEATURES
Name that identifies TendukeObject object features member, use case: bind. |
static java.lang.String |
FIELD_NAME_OBJECT_PROPERTIES
Name that identifies TendukeObject object properties member, use case: bind. |
static int |
RELATED_FIELD_COPY_STYLE_DEEP
Value for determining how related fields are copied / cloned by clone operations: a deep copy of the related fields is set to the copied / cloned object, i.e. |
static int |
RELATED_FIELD_COPY_STYLE_NONE
Value for determining how related fields are copied / cloned by clone operations: related fields are not copied at all, i.e. |
static int |
RELATED_FIELD_COPY_STYLE_SHALLOW
Value for determining how related fields are copied / cloned by clone operations: a shallow copy of the related fields is set to the copied / cloned object. |
| Fields inherited from class com.tenduke.types.AbstractBindableObject |
|---|
FIELD_LENGTH_SHORT_ID, FIELD_NAME_OBJECT_STATE_CHANGE, FIELD_NAME_REPLACES_OBJECT, FIELD_NAME_SHORT_ID, PERMISSION_ACTION_CREATE, PERMISSION_ACTION_DELETE, PERMISSION_ACTION_MODIFY, PERMISSION_ACTION_READ |
| Constructor Summary | |
|---|---|
TendukeObject()
Initializes new instance of the TendukeObject class. |
|
| Method Summary | ||
|---|---|---|
void |
addFeature(FeatureBase feature)
|
|
void |
addObjectConsumption(ObjectConsumption objectConsumption)
Adds ObjectConsumption object related to object. |
|
void |
addObjectProperty(java.lang.String propertyKey,
java.lang.String propertyValue)
Add a Property to the object by Property key and value. |
|
void |
addProperty(Property property)
Add a Property for the object. |
|
void |
addRelatedObjectDefault(AbstractBindableObject obj)
Adds an object to the list of related objects by default relation type. |
|
void |
addRelatedObjectDefault(java.lang.String relationName,
AbstractBindableObject obj)
Adds an object to the list of related objects by default relation type and given relation name. |
|
|
addRelatedObjectsDefault(java.util.List<U> objects)
Adds all objects in the given list to the list of related objects by default relation. |
|
|
addRelatedObjectsDefault(java.lang.String relationName,
java.util.List<U> objects)
Adds all objects in the given list to the list of related objects by default relation type and given relation name. |
|
java.lang.Object |
clone()
Clone this object. |
|
java.lang.Object |
clone(int relatedFieldCopyStyle)
Clone this object. |
|
protected void |
copyThis(TendukeObject result)
Util for use in Object.clone implementation. |
|
protected void |
copyThis(TendukeObject result,
boolean includeRelated)
Util for use in Object.clone implementation. |
|
boolean |
equals(java.lang.Object rhs)
Two TendukeObject objects are the same object if they have same id. |
|
protected void |
fieldValueToString(java.lang.StringBuilder objectToString,
java.lang.String fieldName,
java.lang.Object fieldValue)
Serializes value of object field as part of building String representation of object. |
|
static Property |
findProperty(java.util.List<Property> properties,
Property findProperty)
Iterates all specified properties and checks if a contained property with key equal to key specified by input property's key exists (findProperty's key). |
|
Property |
findProperty(Property findProperty)
Iterates all instance's properties and checks if a contained property with key equal to key specified by input property's key exists (findProperty's key). |
|
java.util.Map<java.lang.String,ValueChange> |
getChangedSerializableFieldValues(java.lang.Object changed)
Searches through serializable fields (fields annotated with SerializableField annotation) in changed object and checks whether values of fields are different. |
|
java.util.Date |
getCreated()
Gets timestamp when object was created. |
|
Profile |
getCreatedBy()
Gets Profile that created this object. |
|
void |
getCreatedByRecursive(java.util.List<Profile> createdByProfiles)
Recursively adds created by profiles of this object and all related objects to list of created by profiles. |
|
BindableObjectActor |
getCreatingActor()
Gets actor that has created the object. |
|
java.util.Date |
getModified()
Gets timestamp when object has been modified. |
|
Profile |
getModifiedBy()
Gets modifying Profile of this object. |
|
void |
getModifiedByRecursive(java.util.List<Profile> modifyingProfiles)
Recursively adds modifying profiles of this object and all related objects to list of modifying profiles. |
|
BindableObjectActor |
getModifyingActor()
Gets actor that has modified the object. |
|
Category |
getObjectCategory()
Gets the objects category. |
|
java.util.UUID |
getObjectCategoryId()
Get object's category id. |
|
java.util.List<ObjectConsumption> |
getObjectConsumption()
Getter for object consumption. |
|
java.lang.String |
getObjectContractName()
Checks if this object is an instance of class that has SerializableClass annotation and if so read
the object contract name. |
|
static java.lang.String |
getObjectContractName(java.lang.Class<?> serializableClass)
Checks if the specified class is annotated with SerializableClass and if so read the object contract name. |
|
FeatureBase |
getObjectFeature(java.lang.String key)
Get an object feature by name. |
|
java.util.List<FeatureBase> |
getObjectFeatures()
|
|
java.util.List<Property> |
getObjectProperties()
|
|
Property |
getObjectProperty(java.lang.String key)
|
|
java.lang.String |
getObjectPropertyValue(java.lang.String key)
|
|
|
getRelatedObjectsDefault(java.lang.Class<T> relatedObjectType)
Gets objects related to this object with default relation type. |
|
|
getRelatedObjectsDefault(java.lang.String relationName,
java.lang.Class<T> relatedObjectType)
Gets objects related to this object with default relation type. |
|
int |
hashCode()
Since two TendukeObjects are same if they have same id, getId().hashCode() can be used also as the objects hashcode. |
|
static java.util.UUID |
idFromString(java.lang.String id)
Parse id from string. |
|
void |
merge(TendukeObject nullFieldValuesFromObject)
Search SerializableField annotated fields of the object and check whether field value is null. |
|
java.util.Map<java.lang.String,FeatureBase> |
objectFeaturesToMap()
Utility to convert objects feature list to Map. |
|
java.util.Map<java.lang.String,Property> |
objectPropertiesToMap()
Utility to convert objects property list to Map. |
|
static
|
orderByCreatedDate(java.util.List<T> objects,
boolean ascending)
Order TendukeObject descendants by their created by date. |
|
static
|
orderByModifiedDate(java.util.List<T> objects,
boolean ascending)
Order TendukeObject descendants by their created by date. |
|
void |
setCreated(java.util.Date created)
Sets timestamp when object was created. |
|
void |
setCreatedBy(Profile createdBy)
Sets Profile that created this object. |
|
static void |
setCreatedByRecursive(AbstractBindableObject object,
BindableObjectActor createdBy)
Recursively sets created by actor to an object model hierarchy (the given object and all objects that can be accessed via FieldName annotated fields). |
|
void |
setCreatedByRecursive(Profile createdBy)
Recursively sets created by profile to an object model hierarchy (this object and all objects that can be accessed via FieldName annotated fields). |
|
void |
setCreatingActor(BindableObjectActor actor)
Sets actor that has created the object. |
|
void |
setModified(java.util.Date modified)
Sets timestamp when object has been modified. |
|
static
|
setModifiedBy(java.util.List<T> objects,
Profile modifiedBy)
Setting modified by profile for a list of objects. |
|
void |
setModifiedBy(Profile modifiedBy)
Sets modifying Profile of this object. |
|
static void |
setModifiedByRecursive(AbstractBindableObject object,
BindableObjectActor modifiedBy)
Recursively sets modified by actor to an object model hierarchy (the given object and all objects that can be accessed via FieldName annotated fields). |
|
static
|
setModifiedByRecursive(java.util.List<T> objects,
Profile modifiedBy)
Setting modified by profile recursively for a list of objects. |
|
void |
setModifiedByRecursive(Profile modifiedBy)
Recursively sets modified by profile to an object model hierarchy (this object and all objects that can be accessed via FieldName annotated fields). |
|
void |
setModifyingActor(BindableObjectActor actor)
Sets actor that has modified the object. |
|
void |
setObjectCategory(Category category)
Sets object category and also sets category object's parent to this. |
|
void |
setObjectCategoryId(java.util.UUID categoryId)
Set object's category id. |
|
void |
setObjectConsumption(java.util.List<ObjectConsumption> objectConsumption)
Sets list of ObjectConsumption objects related to object. |
|
void |
setObjectFeatures(java.util.List<FeatureBase> objectFeatures)
|
|
void |
setObjectProperties(java.util.List<Property> objectProperties)
|
|
void |
setRelatedObjectsDefault(java.util.List<AbstractBindableObject> objects)
Sets the list of related objects with default relation type, replacing earlier related objects for the relation. |
|
void |
setRelatedObjectsDefault(java.lang.String relationName,
java.util.List<AbstractBindableObject> objects)
Sets the list of related objects with default relation type and given relation name, replacing earlier related objects for the relation. |
|
java.lang.String |
toString()
Returns a String representation of the object. |
|
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String FIELD_NAME_CREATED
public static final java.lang.String FIELD_NAME_CREATED_BY_PROFILE
public static final java.lang.String FIELD_NAME_MODIFIED
public static final java.lang.String FIELD_NAME_MODIFIED_BY_PROFILE
public static final java.lang.String FIELD_NAME_OBJECT_CATEGORY
public static final java.lang.String FIELD_NAME_OBJECT_CATEGORY_ID
public static final java.lang.String FIELD_NAME_OBJECT_CONSUMPTION
public static final java.lang.String FIELD_NAME_OBJECT_FEATURES
public static final java.lang.String FIELD_NAME_OBJECT_PROPERTIES
public static final int RELATED_FIELD_COPY_STYLE_DEEP
public static final int RELATED_FIELD_COPY_STYLE_NONE
public static final int RELATED_FIELD_COPY_STYLE_SHALLOW
| Constructor Detail |
|---|
public TendukeObject()
| Method Detail |
|---|
public void addFeature(FeatureBase feature)
public void addObjectConsumption(ObjectConsumption objectConsumption)
ObjectConsumption object related to object.
objectConsumption - ObjectConsumption object related to object to add.
public void addObjectProperty(java.lang.String propertyKey,
java.lang.String propertyValue)
propertyKey - Property key.propertyValue - Property value.public void addProperty(Property property)
property - The Property to add.public void addRelatedObjectDefault(AbstractBindableObject obj)
Adds an object to the list of related objects by default relation type.
This overload uses Relation as default relation type.
This overload creates relation description (instance of ObjectRelation) with given relation type and null
(default) relation name.
Methods of this class that handle related objects can be used for dynamic relations between any objects that derive from AbstractBindableObject. Derived classes may also explicitly define relations.
obj - Object to be added to the relation.
public void addRelatedObjectDefault(java.lang.String relationName,
AbstractBindableObject obj)
Adds an object to the list of related objects by default relation type and given relation name.
This overload uses Relation as default relation type.
Methods of this class that handle related objects can be used for dynamic relations between any objects that derive from AbstractBindableObject. Derived classes may also explicitly define relations.
relationName - Name of the relation.obj - Object to be added to the relation.public <U extends AbstractBindableObject> void addRelatedObjectsDefault(java.util.List<U> objects)
Adds all objects in the given list to the list of related objects by default relation.
This overload uses Relation as default relation type.
This overload creates relation description (instance of ObjectRelation) with given relation type and null
(default) relation name.
Methods of this class that handle related objects can be used for dynamic relations between any objects that derive from AbstractBindableObject. Derived classes may also explicitly define relations.
objects - List of objects to be added to the relation.
public <U extends AbstractBindableObject> void addRelatedObjectsDefault(java.lang.String relationName,
java.util.List<U> objects)
Adds all objects in the given list to the list of related objects by default relation type and given relation name.
This overload uses Relation as default relation type.
Methods of this class that handle related objects can be used for dynamic relations between any objects that derive from AbstractBindableObject. Derived classes may also explicitly define relations.
relationName - Name of the relation.objects - List of objects to be added to the relation.
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedException - Exception not explicitly thrown, method is implemented.
public java.lang.Object clone(int relatedFieldCopyStyle)
throws java.lang.CloneNotSupportedException
relatedFieldCopyStyle - Style how fields with SerializableField.relation != RELATION_NONE are copied. Use
RELATED_FIELD_COPY_STYLE constants defined by this class for values of this parameter.
java.lang.CloneNotSupportedException - Exception not explicitly thrown, method is implemented.protected void copyThis(TendukeObject result)
protected void copyThis(TendukeObject result,
boolean includeRelated)
public boolean equals(java.lang.Object rhs)
Two TendukeObject objects are the same object if they have same id.
DO NOT override this in sub classes. It is a system contract that equals between two objects is based on the object Id fields equality measure.
equals in class java.lang.Objectrhs - Object to compare for equality.
protected void fieldValueToString(java.lang.StringBuilder objectToString,
java.lang.String fieldName,
java.lang.Object fieldValue)
objectToString - StringBuilder where String representation of the object is written.fieldName - Name of field to serialize.fieldValue - Value of the field to serialize.
public static Property findProperty(java.util.List<Property> properties,
Property findProperty)
properties - List of properties in which to search for a specific key.findProperty - Input property that defines key, which is used to find property in list.
public Property findProperty(Property findProperty)
findProperty - Input property, which is used to access reference key value
public java.util.Map<java.lang.String,ValueChange> getChangedSerializableFieldValues(java.lang.Object changed)
changed - The changed object to compare against baseline.
public java.util.Date getCreated()
Gets timestamp when object was created.
An object's created field is intended to mark a technical timestamp when the object has been created. Users of the object model may decide if the field has relevance from business logical point of view.
getCreated in class AbstractBindableObjectpublic Profile getCreatedBy()
public void getCreatedByRecursive(java.util.List<Profile> createdByProfiles)
createdByProfiles - List where created by profiles are added.public BindableObjectActor getCreatingActor()
getCreatingActor in class AbstractBindableObjectpublic java.util.Date getModified()
Gets timestamp when object has been modified.
An object's modified field is intended to mark a technical timestamp when the object has been last changed. The change / update may be of no relevance from business logical point of view (Users of the object model may decide if the field has relevance from business logical point of view).
getModified in class AbstractBindableObjectpublic Profile getModifiedBy()
public void getModifiedByRecursive(java.util.List<Profile> modifyingProfiles)
modifyingProfiles - List where modifying profiles are added.public BindableObjectActor getModifyingActor()
getModifyingActor in class AbstractBindableObjectpublic Category getObjectCategory()
public java.util.UUID getObjectCategoryId()
AbstractBindableObject
getObjectCategoryId in class AbstractBindableObjectpublic java.util.List<ObjectConsumption> getObjectConsumption()
ObjectConsumption objects related to object.public java.lang.String getObjectContractName()
Checks if this object is an instance of class that has SerializableClass annotation and if so read
the object contract name.
Calls getObjectContractName(java.lang.Class) with this.getClass() argument. See the
getObjectContractName(...) method documentation for further details.
public static java.lang.String getObjectContractName(java.lang.Class<?> serializableClass)
Checks if the specified class is annotated with SerializableClass and if so read the object contract name.
The object contract name of an object is the name attribute of a SerializableClass annotation of the
class the object is instance of. If the name attribute is not set, then the object contract name is a simple name
of the class.
Examples:
MyObjectContractname as the object contract name. @SerializableClass(name = "MyObjectContractname")public class SomeClass {...}
SomeClass as the object contract name. @SerializableClasspublic class SomeClass {...}
null is returned if an object contract
name is asked for.public class SomeClass {...}
serializableClass - The class to be checked and analyzed
SerializableClass annotation or null if
the class is not annotated with SerializableClass.public FeatureBase getObjectFeature(java.lang.String key)
key - The name for the feature to look up
public java.util.List<FeatureBase> getObjectFeatures()
public java.util.List<Property> getObjectProperties()
public Property getObjectProperty(java.lang.String key)
public java.lang.String getObjectPropertyValue(java.lang.String key)
public <T extends AbstractBindableObject> java.util.List<T> getRelatedObjectsDefault(java.lang.Class<T> relatedObjectType)
Gets objects related to this object with default relation type.
This overload uses Relation as default relation type.
This overload creates relation description (instance of ObjectRelation) with given relation type and null
(default) relation name.
Methods of this class that handle related objects can be used for dynamic relations between any objects that derive from AbstractBindableObject. Derived classes may also explicitly define relations.
T - Type of related objects.relatedObjectType - Type of related objects.
public <T extends AbstractBindableObject> java.util.List<T> getRelatedObjectsDefault(java.lang.String relationName,
java.lang.Class<T> relatedObjectType)
Gets objects related to this object with default relation type.
This overload uses Relation as default relation type.
Methods of this class that handle related objects can be used for dynamic relations between any objects that derive from AbstractBindableObject. Derived classes may also explicitly define relations.
T - Type of related objects.relationName - Name of the relation.relatedObjectType - Type of related objects.
public int hashCode()
hashCode in class java.lang.Objectpublic static java.util.UUID idFromString(java.lang.String id)
UUIDUtils.parseUUID(java.lang.String)
and logs errors as very verbose warning level log entries using Logger.
id - UUID in string format. Argument is checked to not be null.
public void merge(TendukeObject nullFieldValuesFromObject)
nullFieldValuesFromObject - Object whose field values are used to set values to SerializableField annotated fields of
this object.public java.util.Map<java.lang.String,FeatureBase> objectFeaturesToMap()
public java.util.Map<java.lang.String,Property> objectPropertiesToMap()
public static <T extends TendukeObject> java.util.List<T> orderByCreatedDate(java.util.List<T> objects,
boolean ascending)
T - TendukeObject derived classobjects - List to be orderedascending - If true, ordered in ascending order, otherwise in descending order
public static <T extends TendukeObject> java.util.List<T> orderByModifiedDate(java.util.List<T> objects,
boolean ascending)
T - TendukeObject derived classobjects - List to be orderedascending - If true, ordered in ascending order, otherwise in descending order
public void setCreated(java.util.Date created)
Sets timestamp when object was created.
An object's created field is intended to mark a technical timestamp when the object has been created. Users of the object model may decide if the field has relevance from business logical point of view.
setCreated in class AbstractBindableObjectcreated - timestamp when object was created.public void setCreatedBy(Profile createdBy)
createdBy - Profile that created this object.
public static void setCreatedByRecursive(AbstractBindableObject object,
BindableObjectActor createdBy)
object - Object for which creating actor is set recursively.createdBy - Creating actor for the object.public void setCreatedByRecursive(Profile createdBy)
createdBy - Creating Profile of this object.public void setCreatingActor(BindableObjectActor actor)
setCreatingActor in class AbstractBindableObjectactor - that has created the objectpublic void setModified(java.util.Date modified)
Sets timestamp when object has been modified.
An object's modified field is intended to mark a technical timestamp when the object has been last changed. The change / update may be of no relevance from business logical point of view (Users of the object model may decide if the field has relevance from business logical point of view).
setModified in class AbstractBindableObjectmodified - timestamp when object has been modified.
public static <T extends AbstractBindableObject> void setModifiedBy(java.util.List<T> objects,
Profile modifiedBy)
objects - The objects for which to set the modifiedBy profilemodifiedBy - The modifier profilepublic void setModifiedBy(Profile modifiedBy)
modifiedBy - Modifying Profile of this object.
public static void setModifiedByRecursive(AbstractBindableObject object,
BindableObjectActor modifiedBy)
object - Object for which modifying actor is set recursively.modifiedBy - Modifying actor for the object.
public static <T extends AbstractBindableObject> void setModifiedByRecursive(java.util.List<T> objects,
Profile modifiedBy)
objects - The objects for which to set the modifiedBy profilemodifiedBy - The modifier profilepublic void setModifiedByRecursive(Profile modifiedBy)
modifiedBy - Modifying Profile of this object.public void setModifyingActor(BindableObjectActor actor)
setModifyingActor in class AbstractBindableObjectactor - actor that has modified the object.public void setObjectCategory(Category category)
category object's parent to this.
category - Categorypublic void setObjectCategoryId(java.util.UUID categoryId)
AbstractBindableObject
setObjectCategoryId in class AbstractBindableObjectcategoryId - The category id to set.public void setObjectConsumption(java.util.List<ObjectConsumption> objectConsumption)
ObjectConsumption objects related to object.
objectConsumption - list of ObjectConsumption objects related to object.public void setObjectFeatures(java.util.List<FeatureBase> objectFeatures)
public void setObjectProperties(java.util.List<Property> objectProperties)
public void setRelatedObjectsDefault(java.util.List<AbstractBindableObject> objects)
Sets the list of related objects with default relation type, replacing earlier related objects for the relation.
This overload uses Relation as default relation type.
This overload creates relation description (instance of ObjectRelation) with given relation type and null
(default) relation name.
Methods of this class that handle related objects can be used for dynamic relations between any objects that derive from AbstractBindableObject. Derived classes may also explicitly define relations.
objects - List of objects to be set as related objects with default relation.
public void setRelatedObjectsDefault(java.lang.String relationName,
java.util.List<AbstractBindableObject> objects)
Sets the list of related objects with default relation type and given relation name, replacing earlier related objects for the relation.
This overload uses Relation as default relation type.
Methods of this class that handle related objects can be used for dynamic relations between any objects that derive from AbstractBindableObject. Derived classes may also explicitly define relations.
relationName - Name of the relation.objects - List of objects to be set as related objects with default relation.public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||