Package org.apache.unomi.api
Class Item
- java.lang.Object
-
- org.apache.unomi.api.Item
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
CustomItem
,Event
,GeonameEntry
,ImportExportConfiguration
,JsonSchemaWrapper
,MetadataItem
,Patch
,Profile
,ProfileAlias
,RuleStatistics
,Session
,SFDCConfiguration
,Topic
public abstract class Item extends Object implements Serializable
A context server tracked entity. All tracked entities need to extend this class so as to provide the minimal information the context server needs to be able to track such entities and operate on them. Items are persisted according to their type (structure) and identifier (identity). Of note, all Item subclasses must define a public String constant namedITEM_TYPE
that is used to identify the type of a specific Item viagetItemType(java.lang.Class)
. It is therefore important thatITEM_TYPE
be unique across all persisted type of Items. Similarly, since Items are persisted according to their type, an Item's identifier must be unique among Items of the same type.Additionally, Items are also gathered by scope allowing the context server to group together related Items (usually pertaining to a given site being analyzed, though scopes could span across sites depending on the desired analysis granularity). Scopes allow clients accessing the context server to filter data. The context server defines a built-in scope (
Metadata.SYSTEM_SCOPE
) that clients can use to share data across scopes.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
String
getItemId()
Retrieves the Item's identifier used to uniquely identify this Item when persisted or when referred to.String
getItemType()
Retrieves the Item's type used to assert metadata and structure common to Items of this type, notably for persistence purposes.static String
getItemType(Class clazz)
String
getScope()
Retrieves the Item's scope.Object
getSystemMetadata(String key)
Long
getVersion()
int
hashCode()
void
setItemId(String itemId)
void
setItemType(String itemType)
void
setScope(String scope)
void
setSystemMetadata(String key, Object value)
void
setVersion(Long version)
-
-
-
Constructor Detail
-
Item
public Item()
-
Item
public Item(String itemId)
-
-
Method Detail
-
getItemId
public String getItemId()
Retrieves the Item's identifier used to uniquely identify this Item when persisted or when referred to. An Item's identifier must be unique among Items with the same type.- Returns:
- a String representation of the identifier, no particular format is prescribed as long as it is guaranteed unique for this particular Item.
-
setItemId
public void setItemId(String itemId)
-
getItemType
public String getItemType()
Retrieves the Item's type used to assert metadata and structure common to Items of this type, notably for persistence purposes. The Item's type must match the value defined by the implementation'sITEM_TYPE
public constant.- Returns:
- a String representation of this Item's type, must equal the
ITEM_TYPE
value
-
setItemType
public void setItemType(String itemType)
-
getScope
public String getScope()
Retrieves the Item's scope.- Returns:
- the Item's scope name
-
setScope
public void setScope(String scope)
-
getVersion
public Long getVersion()
-
setVersion
public void setVersion(Long version)
-
-