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:Serializableis 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 protectedStreamElement(EntityDescriptor entityDesc, AttributeDescriptor<?> attributeDesc, long sequentialId, java.lang.String key, java.lang.String attribute, long stamp, boolean deleteWildcard, byte[] value)protectedStreamElement(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 StreamElementdelete(EntityDescriptor entityDesc, AttributeDescriptor<?> attributeDesc, long sequentialId, java.lang.String key, java.lang.String attribute, long stamp)Delete given instance of attribute.static StreamElementdelete(EntityDescriptor entityDesc, AttributeDescriptor<?> attributeDesc, java.lang.String uuid, java.lang.String key, java.lang.String attribute, long stamp)Delete given instance of attribute.static StreamElementdeleteWildcard(EntityDescriptor entityDesc, AttributeDescriptor<?> attributeDesc, long sequentialId, java.lang.String key, long stamp)Delete all versions of given wildcard attribute.static StreamElementdeleteWildcard(EntityDescriptor entityDesc, AttributeDescriptor<?> attributeDesc, long sequentialId, java.lang.String key, java.lang.String attribute, long stamp)Delete all versions of given wildcard attribute.static StreamElementdeleteWildcard(EntityDescriptor entityDesc, AttributeDescriptor<?> attributeDesc, java.lang.String uuid, java.lang.String key, long stamp)Delete all versions of given wildcard attribute.static StreamElementdeleteWildcard(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.Stringdump()Dump in more verbose way into given stream.booleanequals(java.lang.Object obj)<T> java.util.Optional<T>getParsed()Retrieve parsed value.java.lang.StringgetUuid()inthashCode()booleanhasSequentialId()booleanisDelete()Check if this is a delete ingest.booleanisDeleteWildcard()Check if this is a delete wildcard ingest.protected voidsetParsed(java.lang.Object parsed)java.lang.StringtoString()static StreamElementupsert(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 StreamElementupsert(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:
StreamElementto 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:
StreamElementto 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:
StreamElementto 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:
StreamElementto 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:
StreamElementto 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:
StreamElementto 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:
StreamElementto 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:
StreamElementto be written to the system
-
getUuid
public java.lang.String getUuid()
-
hasSequentialId
public boolean hasSequentialId()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
isDelete
public boolean isDelete()
Check if this is a delete ingest.- Returns:
trueif this is delete or delete wildcard event
-
isDeleteWildcard
public boolean isDeleteWildcard()
Check if this is a delete wildcard ingest.- Returns:
trueif 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 final void setParsed(java.lang.Object parsed)
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
dump
public java.lang.String dump()
Dump in more verbose way into given stream.- Returns:
- string representing the dumped element
-
-