Class 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 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 entity
        attributeDesc - descriptor of attribute
        uuid - UUID of the request
        key - key of entity
        attribute - name of attribute of the entity
        stamp - timestamp of the event
        value - 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 entity
        attributeDesc - descriptor of attribute
        sequentialId - sequential ID of the upsert. The sequential ID is required to be positive.
        key - key of entity
        attribute - name of attribute of the entity
        stamp - timestamp of the event
        value - 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 entity
        attributeDesc - descriptor of attribute
        uuid - UUID of the event
        key - key of entity
        attribute - attribute of the entity
        stamp - 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 entity
        attributeDesc - descriptor of attribute
        sequentialId - sequential ID of the delete. The sequential ID is required to be positive.
        key - key of entity
        attribute - attribute of the entity
        stamp - 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 entity
        attributeDesc - descriptor of attribute
        uuid - UUID of the event
        key - key of entity
        attribute - string representation of the attribute
        stamp - 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 entity
        attributeDesc - descriptor of attribute
        sequentialId - sequential ID of the delete. The sequential ID is required to be positive.
        key - key of entity
        attribute - string representation of the attribute
        stamp - 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 entity
        attributeDesc - descriptor of attribute
        uuid - UUID of the event
        key - key of entity
        stamp - 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 entity
        attributeDesc - descriptor of attribute
        sequentialId - sequential ID of the delete. The sequential ID is required to be positive.
        key - key of entity
        stamp - 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 class java.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 class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • dump

        public java.lang.String dump()
        Dump in more verbose way into given stream.
        Returns:
        string representing the dumped element