Class IndexEntryKey

  • All Implemented Interfaces:
    Serializable

    public final class IndexEntryKey
    extends Object
    implements Serializable
    An IndexEntryKey uniquely identifies an entry in the indexes. An IndexEntryKey is set at the index entry creation time: when a Silverpeas component adds a new document to index. The document to index refers a contribution or a resource of the specified component. A contribution can be, for example, a publication or a comment. A resource, on the other side, can be, for example a user or a space instance. A component can be a space management service, a user management service, a Silverpeas application, or any other modular components of which Silverpeas is made up.

    This IndexEntryKey will be returned later when the document matches a query. A document in Silverpeas is uniquely identified by:

    • The component which handles the contribution or the resource, referred further to as the object. It can be a transverse service, an administration one or a component instance (a Silverpeas application).
    • The type of the object (contribution or resource) referred by the document to index. The meaning of this type is uniquely determined by the component that handles the object.
    • The unique identifier of the object. For example a user identifier or a contribution identifier.
    • Eventually, if any, the identifier of another object to which the object referred by the key is linked. For example, a publication is the object to which a comment is linked.
    See Also:
    Serialized Form
    • Constructor Detail

      • IndexEntryKey

        public IndexEntryKey​(String componentId,
                             String objectType,
                             String objectId)
        Constructs a new IndexEntryKey instance.
        Parameters:
        componentId - the unique identifier of a component.
        objectType - the type of the object related by the document to index.
        objectId - the unique identifier of the object related by the document to index.
      • IndexEntryKey

        public IndexEntryKey​(String componentId,
                             String objectType,
                             String objectId,
                             String linkedObjectId)
        Constructs a new IndexEntryKey instance.
        Parameters:
        componentId - the unique identifier of a component.
        objectType - the type of the object related by the document to index.
        objectId - the unique identifier of the object related by the document to index.
        linkedObjectId - the unique identifier of the object to which the object referred by the key is linked. For example, for a comment, the linked object can be a publication.
    • Method Detail

      • create

        public static IndexEntryKey create​(String s)
        Creates a new IndexEntry from the specified formatted text.
        Parameters:
        s - the formatted entry key
        Returns:
        the IndexEntryKey instance got from the decoding of the given text.
      • getComponentId

        public String getComponentId()
        Gets the unique identifier of the component instance handling the object referred by this key.
        Returns:
        the identifier of the component that handles the object related by the indexed document.
      • getObjectType

        public String getObjectType()
        Gets the type of the object referred by this key. The meaning of this type is uniquely determined by the component handling the object.
        Returns:
        the type of the object related by the indexed document.
      • getObjectId

        public String getObjectId()
        Gets the identifier of the object referred by this key.
        Returns:
        the unique identifier of the object related by the indexed document.
      • getLinkedObjectId

        public String getLinkedObjectId()
        Gets the identifier of the object to which the object referred by this key is linked.
        Returns:
        identifier of the linked object or an empty string if no object is linked.
      • toString

        public String toString()
        Returns a string which can be used later to construct the key with the create method.
        Overrides:
        toString in class Object
      • equals

        public boolean equals​(Object o)
        To be equal two IndexEntryKey must have the same four parts (space, component, type, id). The equals method is redefined so IndexEntryKey objects can be put in a Set or used as Map key.
        Overrides:
        equals in class Object
      • hashCode

        public int hashCode()
        Returns the hash code of the String representation. The hashCode method is redefined so IndexEntryKey objects can be put in a Set or used as Map key.
        Overrides:
        hashCode in class Object