Interface AccumuloElementConverter

    • Method Detail

      • getKeysFromElement

        Pair<org.apache.accumulo.core.data.Key,​org.apache.accumulo.core.data.Key> getKeysFromElement​(Element element)
        Converts an Element Pair of keys which represent the keys created from the given element. If the given element was an entity only one key will be created and the second item in the pair will be null.
        Parameters:
        element - the element to be converted
        Returns:
        The key(s) that represent the given element.
      • getKeysFromEdge

        Pair<org.apache.accumulo.core.data.Key,​org.apache.accumulo.core.data.Key> getKeysFromEdge​(Edge edge)
        Converts an Edge to a pair of Keys.
        Parameters:
        edge - The edge to be converted
        Returns:
        The key(s) that represent the given edge
      • getKeyFromEntity

        org.apache.accumulo.core.data.Key getKeyFromEntity​(Entity entity)
        Converts an Entity to a Key.
        Parameters:
        entity - the entity to be converted
        Returns:
        The key(s) that represent the given entity
      • getValueFromProperties

        org.apache.accumulo.core.data.Value getValueFromProperties​(String group,
                                                                   Properties properties)
        Converts a set of Properties to an Accumulo Value.
        Parameters:
        group - the element group
        properties - the properties to use to create a Value
        Returns:
        A new Accumulo Value containing the serialised Properties
      • getValueFromElement

        org.apache.accumulo.core.data.Value getValueFromElement​(Element element)
        Converts the Properties in an element to an Accumulo Value where the property has a position within the store schema that indicates it should be stored in the value.
        Parameters:
        element - the element to be converted
        Returns:
        An Accumulo Value representing the Properties that should be stored in the value.
      • getPropertiesFromValue

        Properties getPropertiesFromValue​(String group,
                                          org.apache.accumulo.core.data.Value value)
        Converts an Accumulo Value to a Properties object.
        Parameters:
        group - the element group
        value - the Value containing the serialised properties
        Returns:
        A set of Properties that represent the property stored within the Value
      • getElementId

        ElementId getElementId​(org.apache.accumulo.core.data.Key key,
                               boolean includeMatchedVertex)
        Gets a new ElementId from an Accumulo Key.
        Parameters:
        key - the Key containing serialised parts of the Element
        includeMatchedVertex - if true then the matchedVertex field is set on Edges
        Returns:
        A new ElementId
      • getElementFromKey

        Element getElementFromKey​(org.apache.accumulo.core.data.Key key,
                                  boolean includeMatchedVertex)
        Gets a new Element from an Accumulo Key.
        Parameters:
        key - the Key containing serialised parts of the Element
        includeMatchedVertex - if true then the matchedVertex field is set on Edges
        Returns:
        A new Element including a partial set of Properties that were store in the Key
      • getFullElement

        Element getFullElement​(org.apache.accumulo.core.data.Key key,
                               org.apache.accumulo.core.data.Value value,
                               boolean includeMatchedVertex)
        Returns an Element populated with all the properties defined within the Key and Value.
        Parameters:
        key - the accumulo Key containing serialised parts of the Element
        value - the accumulo Value containing serialised properties of the Element
        includeMatchedVertex - if true then the matchedVertex field is set on Edges
        Returns:
        Returns an Element populated with all the properties defined within the Key and Value
      • serialiseVertex

        byte[] serialiseVertex​(Object vertex)
        Helper Used to create Bloom Filters, method Serialises a given object (from an EntityId ) with the Identifier Serialiser defined in the schema.
        Parameters:
        vertex - the vertex identifier to serialise
        Returns:
        A byte array representing the given object
      • getRowKeysFromElement

        Pair<byte[],​byte[]> getRowKeysFromElement​(Element element)
        Creates a byte array representing the Element identifiers, this will be stored in the Accumulo row Key.
        Parameters:
        element - the element
        Returns:
        the byte array(s) representing the provided Element identifiers.
      • buildColumnQualifier

        byte[] buildColumnQualifier​(String group,
                                    Properties properties)
        Creates a byte array representing a set of Properties that are to be stored in the column qualifier.
        Parameters:
        group - the element group
        properties - the element properties
        Returns:
        A byte array representing the provided Properties that are marked as to be stored in the provided position in the uk.gov.gchq.gaffer.accumulostore schema.
      • getPropertiesFromColumnQualifier

        Properties getPropertiesFromColumnQualifier​(String group,
                                                    byte[] columnQualifier)
        Returns a set of Properties that are stored in the part of the key that is provided.
        Parameters:
        group - the element group
        columnQualifier - the element column qualifier properties serialised into bytes
        Returns:
        The Properties stored within the part of the Key specified e.g Column Qualifier
      • getPropertiesAsBytesFromColumnQualifier

        BytesAndRange getPropertiesAsBytesFromColumnQualifier​(String group,
                                                              byte[] bytes,
                                                              int numProps)
        Truncates the provided columnQualifier, returning the byte representation of the serialised version of the specified properties.
        Parameters:
        group - the element group
        bytes - the full list of property bytes
        numProps - the number of properties to extract
        Returns:
        details of the bytes range.
      • buildColumnFamily

        byte[] buildColumnFamily​(String group)
        Creates a byte array representing the group.
        Parameters:
        group - the element group
        Returns:
        A byte array representing the group
      • getGroupFromColumnFamily

        String getGroupFromColumnFamily​(byte[] columnFamily)
        Returns the element class from the given bytes.
        Parameters:
        columnFamily - the column family bytes
        Returns:
        The element class
      • buildColumnVisibility

        byte[] buildColumnVisibility​(String group,
                                     Properties properties)
        Creates a byte array representing a set of Properties that are to be stored in the column visibility.
        Parameters:
        group - the element group
        properties - the element properties
        Returns:
        A byte array representing the provided Properties that are marked as to be stored in the provided position in the schema.
      • getPropertiesFromColumnVisibility

        Properties getPropertiesFromColumnVisibility​(String group,
                                                     byte[] columnVisibility)
        Returns a set of Properties that are stored in the part of the key that is provided.
        Parameters:
        group - the element group
        columnVisibility - the element visibility property serialised into bytes
        Returns:
        The Properties stored within the part of the Key specified e.g Column Qualifier
      • buildTimestamp

        long buildTimestamp​(String group,
                            Properties properties)
        Creates a timestamp based on the provided Properties will return a default value if properties do not have a valid timestamp value
        Parameters:
        group - the element group
        properties - the element properties
        Returns:
        the timestamp
      • getPropertiesFromTimestamp

        Properties getPropertiesFromTimestamp​(String group,
                                              long timestamp)
        Creates a properties object based on the provided timestamp and group. If the group contains a timestamp property then this property is populated in the returned object. Otherwise, the result is an empty properties object.
        Parameters:
        group - the group of the element - used to determine if the result should contain the timestamp.
        timestamp - the timestamp
        Returns:
        a properties object populated with the provided timestamp.