Package com.saperion.ngc.model.document
Class DocumentId
- java.lang.Object
-
- com.saperion.ngc.model.document.DocumentId
-
- All Implemented Interfaces:
java.io.Serializable
public class DocumentId extends java.lang.Object implements java.io.Serializable
Identifies a document on the backend system. By convention either object ID or revision ID must be set. The element-number is contained to specify which element to show in a viewer. It is ignored in the equals- and hashCode-methods.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DocumentId(java.lang.String objectId, java.lang.String ddcName)
Creates a new DocumentId.DocumentId(java.lang.String objectId, java.lang.String revisionId, java.lang.String ddcName)
Creates a new DocumentId.DocumentId(java.lang.String objectId, java.lang.String revisionId, java.lang.String ddcName, int elementId)
Creates a new DocumentId.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.util.List<java.lang.String>
convertToObjectIdList(java.util.Collection<DocumentId> list)
Converts to a list of object id's.static java.util.List<java.lang.String>
convertToRevisionIdList(java.util.Collection<DocumentId> list)
/**Converts to a list of revision id's.boolean
equals(java.lang.Object obj)
Returns true if the IDs identify the same document.static DocumentId
fromString(java.lang.String idAsString)
Creates a new DocumentId based on the specified string.java.lang.String
getDdcName()
int
getElementId()
java.lang.String
getObjectId()
java.lang.String
getRevisionId()
int
hashCode()
Generates a hash code for the ID.boolean
isAttachment()
void
setAttachment(boolean isAttachment)
java.lang.String
toString()
Returns a string representing this DocumentId.
-
-
-
Constructor Detail
-
DocumentId
public DocumentId(java.lang.String objectId, java.lang.String ddcName)
Creates a new DocumentId.- Parameters:
objectId
- object ID of the document. This corresponds with the SysRowId.ddcName
- ddc name
-
DocumentId
public DocumentId(java.lang.String objectId, java.lang.String revisionId, java.lang.String ddcName)
Creates a new DocumentId.- Parameters:
objectId
- object ID of the document. This corresponds with the SysRowId.revisionId
- revision ID of the document. This corresponds with the HDOC.ddcName
- ddc name
-
DocumentId
public DocumentId(java.lang.String objectId, java.lang.String revisionId, java.lang.String ddcName, int elementId)
Creates a new DocumentId.- Parameters:
objectId
- object ID of the document. This corresponds with the SysRowId.revisionId
- revision ID of the document. This corresponds with the HDOC.ddcName
- ddc nameelementId
- element ID. Used only for structured documents to identify the page.
-
-
Method Detail
-
getElementId
public int getElementId()
- Returns:
- element ID. Used only for structured documents to identify the page. -1 for everything else.
-
getObjectId
public java.lang.String getObjectId()
- Returns:
- object ID of the document or null if not available. This corresponds with the SysRowId.
-
getRevisionId
public java.lang.String getRevisionId()
- Returns:
- revision ID of the document or null if not available. This corresponds with the HDOC.
-
getDdcName
public java.lang.String getDdcName()
- Returns:
- DDC name or null if not set.
-
convertToObjectIdList
public static final java.util.List<java.lang.String> convertToObjectIdList(java.util.Collection<DocumentId> list)
Converts to a list of object id's.- Parameters:
list
- Input- Returns:
- List of object id's
-
convertToRevisionIdList
public static final java.util.List<java.lang.String> convertToRevisionIdList(java.util.Collection<DocumentId> list)
/**Converts to a list of revision id's.- Parameters:
list
- Input- Returns:
- List of revision id's
-
equals
public boolean equals(java.lang.Object obj)
Returns true if the IDs identify the same document. Revision IDs are compared only if present in both objects.- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- other id- Returns:
- true if IDs identify the same document
- See Also:
Object.equals(java.lang.Object)
-
hashCode
public int hashCode()
Generates a hash code for the ID. The hash code is based on a string with the format ddcName|SysRowId|HDoc.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- hash code
- See Also:
Object.hashCode()
-
toString
public java.lang.String toString()
Returns a string representing this DocumentId. Format: DDC|ObjectId|RevisionId|Element.- Overrides:
toString
in classjava.lang.Object
- Returns:
- string representation of this DocumentId
- See Also:
Object.toString()
-
fromString
public static DocumentId fromString(java.lang.String idAsString)
Creates a new DocumentId based on the specified string. The format of the string is expected to be exactly like it is created by the toString method.- Parameters:
idAsString
- string representation of the ID- Returns:
- DocumentId instance
- See Also:
toString()
-
isAttachment
public boolean isAttachment()
- Returns:
- true if this document ID identifies an attachment of a workflow task
-
setAttachment
public void setAttachment(boolean isAttachment)
- Parameters:
isAttachment
- set to true if this ID identifies an attachment of a workflow task
-
-