java.lang.Object
ch.colabproject.colab.api.model.document.Document
All Implemented Interfaces:
ColabEntity, StickyNoteSourceable, WithDeletionStatus, WithIndex, WithPermission, WithTrackingData, WithWebsocketChannels, WithId, WithJsonDiscriminator, Serializable
Direct Known Subclasses:
DocumentFile, ExternalLink, TextDataBlock

@Entity public abstract class Document extends Object implements ColabEntity, WithWebsocketChannels, WithIndex, StickyNoteSourceable
Any document.

The subclass handles the content.

A document is owned by either a card content or a resource.

Author:
sandra
See Also:
  • Field Details

    • DOCUMENT_SEQUENCE_NAME

      public static final String DOCUMENT_SEQUENCE_NAME
      Name of the document/resource sequence
      See Also:
    • id

      protected Long id
      Document ID
    • owningCardContent

      protected CardContent owningCardContent
      The card content for which this document is a deliverable
    • owningResource

      protected Resource owningResource
      The resource this document is part of
  • Constructor Details

    • Document

      public Document()
  • Method Details

    • getId

      public Long getId()
      Specified by:
      getId in interface WithId
      Returns:
      the document id
    • setId

      public void setId(Long id)
      Parameters:
      id - the document id
    • getTrackingData

      public Tracking getTrackingData()
      Get the tracking data
      Specified by:
      getTrackingData in interface WithTrackingData
      Returns:
      tracking data
    • setTrackingData

      public void setTrackingData(Tracking trackingData)
      Set tracking data
      Specified by:
      setTrackingData in interface WithTrackingData
      Parameters:
      trackingData - new tracking data
    • getDeletionStatus

      public DeletionStatus getDeletionStatus()
      Description copied from interface: WithDeletionStatus
      Get the deletion status :

      Is it in a bin or ready to be definitely deleted.

      Null means active.

      Specified by:
      getDeletionStatus in interface WithDeletionStatus
      Returns:
      null or a deletion status
    • setDeletionStatus

      public void setDeletionStatus(DeletionStatus status)
      Description copied from interface: WithDeletionStatus
      Set the deletion status :

      Is it in a bin or ready to be definitely deleted.

      Null means active.

      Specified by:
      setDeletionStatus in interface WithDeletionStatus
      Parameters:
      status - null or a deletion status
    • getIndex

      public int getIndex()
      Specified by:
      getIndex in interface WithIndex
      Returns:
      the index to define the place of the document
    • setIndex

      public void setIndex(int index)
      Specified by:
      setIndex in interface WithIndex
      Parameters:
      index - the index to define the place of the document to set
    • getOwningCardContent

      public CardContent getOwningCardContent()
      Returns:
      the card content for which this document is a deliverable
    • setOwningCardContent

      public void setOwningCardContent(CardContent cardContent)
      Parameters:
      cardContent - the card content for which this document is a deliverable
    • getOwningCardContentId

      public Long getOwningCardContentId()
      Returns:
      the id of the card content for which this document is a deliverable
    • setOwningCardContentId

      public void setOwningCardContentId(Long cardContentId)
      Parameters:
      cardContentId - the id of the card content for which this document is a deliverable
    • hasOwningCardContent

      public boolean hasOwningCardContent()
      Returns:
      True if there is an owning card content
    • getOwningResource

      public Resource getOwningResource()
      Returns:
      the resource this document is part of
    • setOwningResource

      public void setOwningResource(Resource resource)
      Parameters:
      resource - the resource this document is part of
    • getOwningResourceId

      public Long getOwningResourceId()
      Returns:
      the id of the resource this document is part of
    • setOwningResourceId

      public void setOwningResourceId(Long resourceId)
      Parameters:
      resourceId - the id of the resource this document is part of
    • hasOwningResource

      public boolean hasOwningResource()
      Returns:
      True if there is an owning resource
    • getStickyNoteLinksAsSrc

      public List<StickyNoteLink> getStickyNoteLinksAsSrc()
      Specified by:
      getStickyNoteLinksAsSrc in interface StickyNoteSourceable
      Returns:
      the list of sticky note links of which the document is the source
    • setStickyNoteLinksAsSrc

      public void setStickyNoteLinksAsSrc(List<StickyNoteLink> stickyNoteLinksAsSrc)
      Parameters:
      stickyNoteLinksAsSrc - the list of sticky note links of which the document is the source
    • mergeToUpdate

      public void mergeToUpdate(ColabEntity other) throws ColabMergeException
      Description copied from interface: ColabEntity
      Update this object according to values provided by other.

      This is used when an object is prepared to be updated in database.

      Specified by:
      mergeToUpdate in interface ColabEntity
      Parameters:
      other - object to take new values from
      Throws:
      ColabMergeException - if merging is not possible
    • getProject

      public Project getProject()
      Get the project this document belongs to
      Returns:
      document owner
    • getChannelsBuilder

      public ChannelsBuilders.ChannelsBuilder getChannelsBuilder()
      Description copied from interface: WithWebsocketChannels
      Get the channels this entity shall be sent through.
      Specified by:
      getChannelsBuilder in interface WithWebsocketChannels
      Returns:
      list of channels
    • getReadCondition

      public Conditions.Condition getReadCondition()
      Description copied from interface: WithPermission
      Get the condition required to read this entity
      Specified by:
      getReadCondition in interface WithPermission
      Returns:
      the condition
    • getUpdateCondition

      public Conditions.Condition getUpdateCondition()
      Description copied from interface: WithPermission
      Get the condition required to update this entity
      Specified by:
      getUpdateCondition in interface WithPermission
      Returns:
      the condition
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public abstract String toString()
      Overrides:
      toString in class Object
    • toPartialString

      protected String toPartialString()
      Returns:
      This abstract class fields to mention in the toString implementations