org.usergrid.persistence
Class AbstractEntity

java.lang.Object
  extended by org.usergrid.persistence.AbstractEntity
All Implemented Interfaces:
Comparable<Entity>, Entity, EntityRef
Direct Known Subclasses:
DynamicEntity, TypedEntity

public abstract class AbstractEntity
extends Object
implements Entity

The abstract superclass implementation of the Entity interface.

Author:
edanuff

Field Summary
protected  Long created
           
protected  Map<String,Object> dynamic_properties
           
protected  Map<String,Set<Object>> dynamic_sets
           
protected  Long modified
           
protected  UUID uuid
           
 
Constructor Summary
AbstractEntity()
           
 
Method Summary
 void addProperties(Map<String,Object> properties)
           
 void clearDataset(String property)
           
 void clearMetadata()
           
 int compareTo(Entity o)
           
 List<Entity> getCollections(String key)
           
 List<Entity> getConnections(String key)
           
 Long getCreated()
           
<T> T
getDataset(String property, String key)
           
 Map<String,Object> getDynamicProperties()
           
 Object getMetadata(String key)
           
 Long getModified()
           
 String getName()
           
 Map<String,Object> getProperties()
           
 Object getProperty(String propertyName)
           
 String getType()
          Gets the type.
 UUID getUuid()
          Gets the id.
<T> void
mergeDataset(String property, Map<String,T> new_metadata)
           
 void mergeMetadata(Map<String,Object> new_metadata)
           
 void setCollections(String key, List<Entity> results)
           
 void setConnections(String key, List<Entity> results)
           
 void setCreated(Long created)
           
<T> void
setDataset(String property, String key, T value)
           
 void setDynamicProperty(String key, Object value)
           
 void setMetadata(String key, Object value)
           
 void setModified(Long modified)
           
 void setProperties(Map<String,Object> properties)
           
 void setProperty(String propertyName, Object propertyValue)
           
 void setType(String type)
           
 void setUuid(UUID uuid)
           
 String toString()
           
 Entity toTypedEntity()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

uuid

protected UUID uuid

created

protected Long created

modified

protected Long modified

dynamic_properties

protected Map<String,Object> dynamic_properties

dynamic_sets

protected Map<String,Set<Object>> dynamic_sets
Constructor Detail

AbstractEntity

public AbstractEntity()
Method Detail

getUuid

public UUID getUuid()
Description copied from interface: EntityRef
Gets the id.

Specified by:
getUuid in interface Entity
Specified by:
getUuid in interface EntityRef
Returns:
the id

setUuid

public void setUuid(UUID uuid)
Specified by:
setUuid in interface Entity

getType

public String getType()
Description copied from interface: EntityRef
Gets the type.

Specified by:
getType in interface Entity
Specified by:
getType in interface EntityRef
Returns:
the type

setType

public void setType(String type)
Specified by:
setType in interface Entity

getCreated

public Long getCreated()
Specified by:
getCreated in interface Entity

setCreated

public void setCreated(Long created)
Specified by:
setCreated in interface Entity

getModified

public Long getModified()
Specified by:
getModified in interface Entity

setModified

public void setModified(Long modified)
Specified by:
setModified in interface Entity

getName

public String getName()
Specified by:
getName in interface Entity

getProperties

public Map<String,Object> getProperties()
Specified by:
getProperties in interface Entity

getProperty

public final Object getProperty(String propertyName)
Specified by:
getProperty in interface Entity

setProperty

public final void setProperty(String propertyName,
                              Object propertyValue)
Specified by:
setProperty in interface Entity

setProperties

public void setProperties(Map<String,Object> properties)
Specified by:
setProperties in interface Entity

addProperties

public void addProperties(Map<String,Object> properties)
Specified by:
addProperties in interface Entity

getMetadata

public Object getMetadata(String key)
Specified by:
getMetadata in interface Entity

setMetadata

public void setMetadata(String key,
                        Object value)
Specified by:
setMetadata in interface Entity

mergeMetadata

public void mergeMetadata(Map<String,Object> new_metadata)
Specified by:
mergeMetadata in interface Entity

clearMetadata

public void clearMetadata()
Specified by:
clearMetadata in interface Entity

getDataset

public <T> T getDataset(String property,
                        String key)

setDataset

public <T> void setDataset(String property,
                           String key,
                           T value)

mergeDataset

public <T> void mergeDataset(String property,
                             Map<String,T> new_metadata)

clearDataset

public void clearDataset(String property)

getCollections

public List<Entity> getCollections(String key)
Specified by:
getCollections in interface Entity

setCollections

public void setCollections(String key,
                           List<Entity> results)
Specified by:
setCollections in interface Entity

getConnections

public List<Entity> getConnections(String key)
Specified by:
getConnections in interface Entity

setConnections

public void setConnections(String key,
                           List<Entity> results)
Specified by:
setConnections in interface Entity

toString

public String toString()
Overrides:
toString in class Object

setDynamicProperty

public void setDynamicProperty(String key,
                               Object value)
Specified by:
setDynamicProperty in interface Entity

getDynamicProperties

public Map<String,Object> getDynamicProperties()
Specified by:
getDynamicProperties in interface Entity

compareTo

public final int compareTo(Entity o)
Specified by:
compareTo in interface Comparable<Entity>
Specified by:
compareTo in interface Entity

toTypedEntity

public Entity toTypedEntity()
Specified by:
toTypedEntity in interface Entity


Copyright © 2013. All Rights Reserved.