Package cz.o2.proxima.core.storage
Class StreamElement
- java.lang.Object
-
- cz.o2.proxima.core.storage.StreamElement
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
KafkaStreamElement
,KeyValue
@Evolving("Should change to interface with implementations") public class StreamElement extends java.lang.Object implements java.io.Serializable
Data wrapper for all ingestion requests. NOTE:Serializable
is implemented only for tests. Real-world applications should never use java serialization for passing data elements.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
StreamElement(EntityDescriptor entityDesc, AttributeDescriptor<?> attributeDesc, long sequentialId, java.lang.String key, java.lang.String attribute, long stamp, boolean deleteWildcard, byte[] value)
protected
StreamElement(EntityDescriptor entityDesc, AttributeDescriptor<?> attributeDesc, java.lang.String uuid, java.lang.String key, java.lang.String attribute, long stamp, boolean deleteWildcard, byte[] value)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StreamElement
delete(EntityDescriptor entityDesc, AttributeDescriptor<?> attributeDesc, long sequentialId, java.lang.String key, java.lang.String attribute, long stamp)
Delete given instance of attribute.static StreamElement
delete(EntityDescriptor entityDesc, AttributeDescriptor<?> attributeDesc, java.lang.String uuid, java.lang.String key, java.lang.String attribute, long stamp)
Delete given instance of attribute.static StreamElement
deleteWildcard(EntityDescriptor entityDesc, AttributeDescriptor<?> attributeDesc, long sequentialId, java.lang.String key, long stamp)
Delete all versions of given wildcard attribute.static StreamElement
deleteWildcard(EntityDescriptor entityDesc, AttributeDescriptor<?> attributeDesc, long sequentialId, java.lang.String key, java.lang.String attribute, long stamp)
Delete all versions of given wildcard attribute.static StreamElement
deleteWildcard(EntityDescriptor entityDesc, AttributeDescriptor<?> attributeDesc, java.lang.String uuid, java.lang.String key, long stamp)
Delete all versions of given wildcard attribute.static StreamElement
deleteWildcard(EntityDescriptor entityDesc, AttributeDescriptor<?> attributeDesc, java.lang.String uuid, java.lang.String key, java.lang.String attribute, long stamp)
Delete all versions of given wildcard attribute.java.lang.String
dump()
Dump in more verbose way into given stream.boolean
equals(java.lang.Object obj)
<T> java.util.Optional<T>
getParsed()
Retrieve parsed value.java.lang.String
getUuid()
int
hashCode()
boolean
hasSequentialId()
boolean
isDelete()
Check if this is a delete ingest.boolean
isDeleteWildcard()
Check if this is a delete wildcard ingest.protected void
setParsed(java.lang.Object parsed)
java.lang.String
toString()
static StreamElement
upsert(EntityDescriptor entityDesc, AttributeDescriptor<?> attributeDesc, long sequentialId, java.lang.String key, java.lang.String attribute, long stamp, byte[] value)
Upsert given entity attribute with given value.static StreamElement
upsert(EntityDescriptor entityDesc, AttributeDescriptor<?> attributeDesc, java.lang.String uuid, java.lang.String key, java.lang.String attribute, long stamp, byte[] value)
Upsert given entity attribute with given value.
-
-
-
Constructor Detail
-
StreamElement
protected StreamElement(EntityDescriptor entityDesc, AttributeDescriptor<?> attributeDesc, java.lang.String uuid, java.lang.String key, java.lang.String attribute, long stamp, boolean deleteWildcard, @Nullable byte[] value)
-
StreamElement
protected StreamElement(EntityDescriptor entityDesc, AttributeDescriptor<?> attributeDesc, long sequentialId, java.lang.String key, java.lang.String attribute, long stamp, boolean deleteWildcard, @Nullable byte[] value)
-
-
Method Detail
-
upsert
public static StreamElement upsert(EntityDescriptor entityDesc, AttributeDescriptor<?> attributeDesc, java.lang.String uuid, java.lang.String key, java.lang.String attribute, long stamp, byte[] value)
Upsert given entity attribute with given value.- Parameters:
entityDesc
- descriptor of entityattributeDesc
- descriptor of attributeuuid
- UUID of the requestkey
- key of entityattribute
- name of attribute of the entitystamp
- timestamp of the eventvalue
- serialized value- Returns:
StreamElement
to be written to the system
-
upsert
public static StreamElement upsert(EntityDescriptor entityDesc, AttributeDescriptor<?> attributeDesc, long sequentialId, java.lang.String key, java.lang.String attribute, long stamp, byte[] value)
Upsert given entity attribute with given value.- Parameters:
entityDesc
- descriptor of entityattributeDesc
- descriptor of attributesequentialId
- sequential ID of the upsert. The sequential ID is required to be positive.key
- key of entityattribute
- name of attribute of the entitystamp
- timestamp of the eventvalue
- serialized value- Returns:
StreamElement
to be written to the system
-
delete
public static StreamElement delete(EntityDescriptor entityDesc, AttributeDescriptor<?> attributeDesc, java.lang.String uuid, java.lang.String key, java.lang.String attribute, long stamp)
Delete given instance of attribute.- Parameters:
entityDesc
- descriptor of entityattributeDesc
- descriptor of attributeuuid
- UUID of the eventkey
- key of entityattribute
- attribute of the entitystamp
- timestamp of the delete event- Returns:
StreamElement
to be written to the system
-
delete
public static StreamElement delete(EntityDescriptor entityDesc, AttributeDescriptor<?> attributeDesc, long sequentialId, java.lang.String key, java.lang.String attribute, long stamp)
Delete given instance of attribute.- Parameters:
entityDesc
- descriptor of entityattributeDesc
- descriptor of attributesequentialId
- sequential ID of the delete. The sequential ID is required to be positive.key
- key of entityattribute
- attribute of the entitystamp
- timestamp of the delete event- Returns:
StreamElement
to be written to the system
-
deleteWildcard
public static StreamElement deleteWildcard(EntityDescriptor entityDesc, AttributeDescriptor<?> attributeDesc, java.lang.String uuid, java.lang.String key, java.lang.String attribute, long stamp)
Delete all versions of given wildcard attribute.- Parameters:
entityDesc
- descriptor of entityattributeDesc
- descriptor of attributeuuid
- UUID of the eventkey
- key of entityattribute
- string representation of the attributestamp
- timestamp of the event- Returns:
StreamElement
to be written to the system
-
deleteWildcard
public static StreamElement deleteWildcard(EntityDescriptor entityDesc, AttributeDescriptor<?> attributeDesc, long sequentialId, java.lang.String key, java.lang.String attribute, long stamp)
Delete all versions of given wildcard attribute.- Parameters:
entityDesc
- descriptor of entityattributeDesc
- descriptor of attributesequentialId
- sequential ID of the delete. The sequential ID is required to be positive.key
- key of entityattribute
- string representation of the attributestamp
- timestamp of the event- Returns:
StreamElement
to be written to the system
-
deleteWildcard
public static StreamElement deleteWildcard(EntityDescriptor entityDesc, AttributeDescriptor<?> attributeDesc, java.lang.String uuid, java.lang.String key, long stamp)
Delete all versions of given wildcard attribute.- Parameters:
entityDesc
- descriptor of entityattributeDesc
- descriptor of attributeuuid
- UUID of the eventkey
- key of entitystamp
- timestamp of the event- Returns:
StreamElement
to be written to the system
-
deleteWildcard
public static StreamElement deleteWildcard(EntityDescriptor entityDesc, AttributeDescriptor<?> attributeDesc, long sequentialId, java.lang.String key, long stamp)
Delete all versions of given wildcard attribute.- Parameters:
entityDesc
- descriptor of entityattributeDesc
- descriptor of attributesequentialId
- sequential ID of the delete. The sequential ID is required to be positive.key
- key of entitystamp
- timestamp of the event- Returns:
StreamElement
to be written to the system
-
getUuid
public java.lang.String getUuid()
-
hasSequentialId
public boolean hasSequentialId()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
isDelete
public boolean isDelete()
Check if this is a delete ingest.- Returns:
true
if this is delete or delete wildcard event
-
isDeleteWildcard
public boolean isDeleteWildcard()
Check if this is a delete wildcard ingest.- Returns:
true
if this is delete wildcard event
-
getParsed
public <T> java.util.Optional<T> getParsed()
Retrieve parsed value.- Type Parameters:
T
- the deserialized datatype- Returns:
- optional deserialized value
-
setParsed
protected void setParsed(java.lang.Object parsed)
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
dump
public java.lang.String dump()
Dump in more verbose way into given stream.- Returns:
- string representing the dumped element
-
-