Class DocumentBase

All Implemented Interfaces:
Serializable, Cloneable, org.eclipse.persistence.descriptors.changetracking.ChangeTracker, org.eclipse.persistence.internal.descriptors.PersistenceEntity, org.eclipse.persistence.internal.descriptors.PersistenceObject, org.eclipse.persistence.internal.weaving.PersistenceWeaved, org.eclipse.persistence.internal.weaving.PersistenceWeavedChangeTracking, org.eclipse.persistence.internal.weaving.PersistenceWeavedFetchGroups, org.eclipse.persistence.internal.weaving.PersistenceWeavedRest, org.eclipse.persistence.queries.FetchGroupTracker, GloballyUnique, Versioned, Document
Direct Known Subclasses:
MaintenanceDocumentBase, TransactionalDocumentBase

@MappedSuperclass public abstract class DocumentBase extends PersistableBusinessObjectBaseAdapter implements Document
See Also:
  • Field Details

  • Constructor Details

    • DocumentBase

      public DocumentBase()
  • Method Details

    • getAllowsCopy

      public boolean getAllowsCopy()
      Description copied from interface: Document
      This method returns whether or not this document can be copied.
      Specified by:
      getAllowsCopy in interface Document
      Returns:
      True if it can be copied, false if not.
    • getDocumentTitle

      public String getDocumentTitle()
      Retrieves the title of the document

      This is the default document title implementation. It concatenates the document's data dictionary file label attribute and the document's document header description together. This title is used to populate workflow and will show up in document search results and user action lists.

      return String representing the title of the document
      Specified by:
      getDocumentTitle in interface Document
      Returns:
      document title
    • prepareForSave

      public void prepareForSave()
      Description copied from interface: Document
      This method provides a hook that will be called before the document is saved. This method is useful for applying document level data to children. For example, if someone changes data at the document level, and that data needs to be propagated to child objects or child lists of objects, you can use this method to update the child object or iterate through the list of child objects and apply the document level data to them. Any document that follows this paradigm will need to make use of this method to apply all of those changes.
      Specified by:
      prepareForSave in interface Document
    • processAfterRetrieve

      public void processAfterRetrieve()
      Description copied from interface: Document
      This method provides a hook that will be called after a document is retrieved, but before it is returned from the DocumentService.
      Specified by:
      processAfterRetrieve in interface Document
    • doRouteLevelChange

      public void doRouteLevelChange(DocumentRouteLevelChange levelChangeEvent)
      The the default implementation for RouteLevelChange does nothing, but is meant to provide a hook for documents to implement for other needs.
      Specified by:
      doRouteLevelChange in interface Document
      Parameters:
      levelChangeEvent - route level change event
    • doActionTaken

      public void doActionTaken(ActionTakenEvent event)
      Description copied from interface: Document
      method to integrate with workflow where we will be able to perform logic for an action taken being performed on a document
      Specified by:
      doActionTaken in interface Document
      Parameters:
      event - action taken event
    • afterActionTaken

      public void afterActionTaken(org.kuali.rice.kew.api.action.ActionType performed, ActionTakenEvent event)
      Description copied from interface: Document
      method to integrate with workflow where we will be able to perform logic after an action taken being performed on a document
      Specified by:
      afterActionTaken in interface Document
      Parameters:
      performed - action type performed
      event - action taken event
    • getNonLockingActionTakenCodes

      protected List<String> getNonLockingActionTakenCodes()
      Return the list of actions a user could take on a document which should not result in the recalculation of the PessimisticLocks.
      See Also:
    • afterWorkflowEngineProcess

      public void afterWorkflowEngineProcess(boolean successfullyProcessed)
      The the default implementation for afterWorkflowEngineProcess does nothing, but is meant to provide a hook for documents to implement for other needs.
      Specified by:
      afterWorkflowEngineProcess in interface Document
      Parameters:
      successfullyProcessed - - true if the document was processed successfully, false otherwise
    • beforeWorkflowEngineProcess

      public void beforeWorkflowEngineProcess()
      The the default implementation for beforeWorkflowEngineProcess does nothing, but is meant to provide a hook for documents to implement for other needs.
      Specified by:
      beforeWorkflowEngineProcess in interface Document
    • getWorkflowEngineDocumentIdsToLock

      public List<String> getWorkflowEngineDocumentIdsToLock()
      The default implementation returns no additional ids for the workflow engine to lock prior to processing.
      Specified by:
      getWorkflowEngineDocumentIdsToLock in interface Document
      Returns:
      additional document IDs to lock prior to processing
    • toCopy

      public void toCopy() throws org.kuali.rice.kew.api.exception.WorkflowException, IllegalStateException
      Throws:
      org.kuali.rice.kew.api.exception.WorkflowException
      IllegalStateException
      See Also:
    • setNewDocumentHeader

      protected void setNewDocumentHeader() throws org.kuali.rice.kew.api.exception.WorkflowException
      Gets a new document header for this documents type and sets in the document instance.
      Throws:
      org.kuali.rice.kew.api.exception.WorkflowException
    • addCopyErrorDocumentNote

      protected void addCopyErrorDocumentNote(String noteText)
      Adds a note to the document indicating it was created by a copy or error correction.
      Parameters:
      noteText - - text for note
    • getXmlForRouteReport

      public String getXmlForRouteReport()
      Description copied from interface: Document
      This method is used to get the xml that should be used in a Route Report. In it's default implementation this will call the methods prepareForSave() and populateDocumentForRouting().
      Specified by:
      getXmlForRouteReport in interface Document
      Returns:
      XML data for routing
    • populateDocumentForRouting

      public void populateDocumentForRouting()
      Description copied from interface: Document
      This is the method to integrate with workflow, where we will actually populate the workflow defined data structure(s) so that workflow can routed based on this data. This method is responsible for passing over the proper Kuali (client system) data that will be used by workflow to determine how the document is actually routed.
      Specified by:
      populateDocumentForRouting in interface Document
    • serializeDocumentToXml

      public String serializeDocumentToXml()
      Description copied from interface: Document
      This is a method where we can get the xml of a document that the workflow system will use to base it's routing and search attributes on.
      Specified by:
      serializeDocumentToXml in interface Document
      Returns:
      the document serialized to an xml string
    • wrapDocumentWithMetadataForXmlSerialization

      public KualiDocumentXmlMaterializer wrapDocumentWithMetadataForXmlSerialization()
      Wraps a document in an instance of KualiDocumentXmlMaterializer, that provides additional metadata for serialization
      Specified by:
      wrapDocumentWithMetadataForXmlSerialization in interface Document
      Returns:
      a wrapper object (most likely containing a reference to "this"), or "this" itself.
      See Also:
    • getDocumentPropertySerizabilityEvaluator

      public PropertySerializabilityEvaluator getDocumentPropertySerizabilityEvaluator()
      If workflowProperties have been defined within the data dictionary for this document, then it returns an instance of BusinessObjectPropertySerializibilityEvaluator initialized with the properties. If none have been defined, then returns AlwaysTruePropertySerializibilityEvaluator.
      Specified by:
      getDocumentPropertySerizabilityEvaluator in interface Document
      Returns:
      a fully initialized evaluator object, ready to be used for workflow routing
      See Also:
    • createPropertySerializabilityEvaluator

      protected PropertySerializabilityEvaluator createPropertySerializabilityEvaluator(WorkflowProperties workflowProperties, WorkflowAttributes workflowAttributes)
    • getBasePathToDocumentDuringSerialization

      public String getBasePathToDocumentDuringSerialization()
      Returns the POJO property name of "this" document in the object returned by wrapDocumentWithMetadataForXmlSerialization()
      Specified by:
      getBasePathToDocumentDuringSerialization in interface Document
      Returns:
      a fully initialized evaluator object, ready to be used for workflow routing
      See Also:
    • getDocumentHeader

      public DocumentHeader getDocumentHeader()
      Description copied from interface: Document
      This retrieves the standard DocumentHeader object, which contains standard meta-data about a document.
      Specified by:
      getDocumentHeader in interface Document
      Returns:
      document header since all docs will have a document header
    • setDocumentHeader

      public void setDocumentHeader(DocumentHeader documentHeader)
      Description copied from interface: Document
      Sets the associated DocumentHeader for this document.
      Specified by:
      setDocumentHeader in interface Document
      Parameters:
      documentHeader -
    • getDocumentNumber

      public String getDocumentNumber()
      Description copied from interface: Document
      All documents have a document header id. This is the quick accessor to that unique identifier and should return the same value as documentHeader.getDocumentHeaderId().
      Specified by:
      getDocumentNumber in interface Document
      Returns:
      doc header id
    • setDocumentNumber

      public void setDocumentNumber(String documentNumber)
      Description copied from interface: Document
      setter for document header id
      Specified by:
      setDocumentNumber in interface Document
      Parameters:
      documentNumber -
    • getAdHocRoutePersons

      public List<AdHocRoutePerson> getAdHocRoutePersons()
      Description copied from interface: Document
      getter method to get the list of ad hoc route persons associated with a document at a point in time, this list is only valid for a given users version of a document as this state is only persisted in workflow itself when someone takes an action on a document
      Specified by:
      getAdHocRoutePersons in interface Document
      Returns:
      list of ad hoc route persons
    • setAdHocRoutePersons

      public void setAdHocRoutePersons(List<AdHocRoutePerson> adHocRoutePersons)
      Description copied from interface: Document
      setter method to set the list of ad hoc route persons associated with a document at a point in time, this list is only valid for a given users version of a document as this state is only persisted in workflow itself when someone takes an action on a document
      Specified by:
      setAdHocRoutePersons in interface Document
      Parameters:
      adHocRoutePersons -
    • getAdHocRouteWorkgroups

      public List<AdHocRouteWorkgroup> getAdHocRouteWorkgroups()
      Description copied from interface: Document
      getter method to get the list of ad hoc route workgroups associated with a document at a point in time, this list is only valid for a given users version of a document as this state is only persisted in workflow itself when someone takes an action on a document
      Specified by:
      getAdHocRouteWorkgroups in interface Document
      Returns:
      list of ad hoc route workgroups
    • setAdHocRouteWorkgroups

      public void setAdHocRouteWorkgroups(List<AdHocRouteWorkgroup> adHocRouteWorkgroups)
      Description copied from interface: Document
      setter method to set the list of ad hoc route workgroups associated with a document at a point in time, this list is only valid for a given users version of a document as this state is only persisted in workflow itself when someone takes an action on a document
      Specified by:
      setAdHocRouteWorkgroups in interface Document
      Parameters:
      adHocRouteWorkgroups -
    • getAdHocRouteNodeName

      public String getAdHocRouteNodeName()
      Returns null by default. Subclasses can override this to provide the node name to which any adhoc requests should be attached.
      Specified by:
      getAdHocRouteNodeName in interface Document
      Returns:
      the name of the node to attach adhoc requests toage
    • postProcessSave

      public void postProcessSave(DocumentEvent event)
      Description copied from interface: Document
      Do any work on the document after the save.
      Specified by:
      postProcessSave in interface Document
      Parameters:
      event - - indicates which document event was requested
    • prepareForSave

      public void prepareForSave(DocumentEvent event)
      Override this method with implementation specific prepareForSave logic
      Specified by:
      prepareForSave in interface Document
      Parameters:
      event - - indicates which document event was requested
    • validateBusinessRules

      public void validateBusinessRules(DocumentEvent event)
      Description copied from interface: Document
      Sends document off to the rules engine to verify business rules.
      Specified by:
      validateBusinessRules in interface Document
      Parameters:
      event - - indicates which document event was requested
    • logErrors

      protected void logErrors()
      This method logs errors.
    • generateSaveEvents

      public List<DocumentEvent> generateSaveEvents()
      Description copied from interface: Document
      Generate any necessary events required during the save event generation
      Specified by:
      generateSaveEvents in interface Document
      Returns:
      a list of document events that were triggered by the save event
    • doRouteStatusChange

      public void doRouteStatusChange(DocumentRouteStatusChange statusChangeEvent)
      Description copied from interface: Document
      Handle the doRouteStatusChange event from the post processor
      Specified by:
      doRouteStatusChange in interface Document
      Parameters:
      statusChangeEvent - status change event
    • getNoteTarget

      public GloballyUnique getNoteTarget()
      Returns the business object with which notes related to this document should be associated. By default, the DocumentHeader of this document will be returned as the note target.

      Sub classes can override this method if they want notes to be associated with something other than the document header. If this method is overridden, the getNoteType() method should be overridden to return NoteType.BUSINESS_OBJECT

      Specified by:
      getNoteTarget in interface Document
      Returns:
      Returns the documentBusinessObject.
    • getNoteType

      public NoteType getNoteType()
      Returns the NoteType to use for notes associated with this document. By default this returns NoteType.DOCUMENT_HEADER since notes are associated with the DocumentHeader record by default.

      The case in which this should be overridden is if getNoteTarget() is overridden to return an object other than the DocumentHeader.

      Specified by:
      getNoteType in interface Document
      Returns:
      the note type to use for notes associated with this document
    • addNote

      public void addNote(Note note)
      Description copied from interface: Document
      Adds the given Note to the document's list of Notes.
      Specified by:
      addNote in interface Document
      Parameters:
      note - the Note to add, must be non-null
    • removeNote

      public boolean removeNote(Note note)
      Description copied from interface: Document
      Removes the given note from the document's list of notes.
      Specified by:
      removeNote in interface Document
      Parameters:
      note - the note to remove from the document's list of notes, must be non-null
      Returns:
      true if the note was successfully removed, false if the list did not contain the given note
    • getNote

      public Note getNote(int index)
      Description copied from interface: Document
      Retrieves the note at the given index.
      Specified by:
      getNote in interface Document
      Parameters:
      index - the zero-based index of the note to retrieve
      Returns:
      the note located at the given index
    • getNotes

      public List<Note> getNotes()
      Description copied from interface: Document
      Returns a mutable list of all notes on the document.
      Specified by:
      getNotes in interface Document
      Returns:
      the list of notes associated with this document, if this document has no notes then an empty list will be returned
    • setNotes

      public void setNotes(List<Note> notes)
      Description copied from interface: Document
      Sets the document's list of notes to the given list.
      Specified by:
      setNotes in interface Document
      Parameters:
      notes - the list of notes to set on the document, must be non-null
    • getActionRequests

      public List<org.kuali.rice.kew.api.action.ActionRequest> getActionRequests()
      Description copied from interface: Document
      This method gets a list of the ActionRequest objects associated with this document.
      Specified by:
      getActionRequests in interface Document
      Returns:
      list of action requests
    • getSuperUserAnnotation

      public String getSuperUserAnnotation()
      Description copied from interface: Document
      This method gets the annotation to be attached to a super user action.
      Specified by:
      getSuperUserAnnotation in interface Document
      Returns:
      the super user annotation
    • setSuperUserAnnotation

      public void setSuperUserAnnotation(String superUserAnnotation)
      Description copied from interface: Document
      This method sets the annotation to be attached to a super user action.
      Specified by:
      setSuperUserAnnotation in interface Document
      Parameters:
      superUserAnnotation - the super user annotation
    • postLoad

      protected void postLoad()
      Loads the KRAD document header via the document header service.
    • prePersist

      protected void prePersist()
      Save the KRAD document header via the document header service.
      Overrides:
      prePersist in class DataObjectBase
    • postRemove

      protected void postRemove()
      This overridden method is used to delete the DocumentHeader object due to the system not being able to manage the DocumentHeader object via mapping files
    • getPessimisticLocks

      public List<PessimisticLock> getPessimisticLocks()
      Description copied from interface: Document
      This method gets a list of the PessimisticLock objects associated with this document
      Specified by:
      getPessimisticLocks in interface Document
      Returns:
      list of pessimistic locks
    • refreshPessimisticLocks

      public void refreshPessimisticLocks()
      Description copied from interface: Document
      This method updates the list of PessimisticLock objects on the document if changes could have been made
      Specified by:
      refreshPessimisticLocks in interface Document
    • setPessimisticLocks

      public void setPessimisticLocks(List<PessimisticLock> pessimisticLocks)
    • addPessimisticLock

      public void addPessimisticLock(PessimisticLock lock)
      Description copied from interface: Document
      This method adds a new PessimisticLock to the document NOTE: LOCKS ADDED VIA THIS METHOD WILL NOT BE SAVED WITH THE DOCUMENT
      Specified by:
      addPessimisticLock in interface Document
      Parameters:
      lock - - the lock to add to the document
    • getLockClearingMethodNames

      @Deprecated public List<String> getLockClearingMethodNames()
      Deprecated.
      Description copied from interface: Document
      This is a method that is used by Kuali Pessimistic Locking to get the names (method to call values) of the KNS KualiDocumentActionBase methods that should release locks
      Specified by:
      getLockClearingMethodNames in interface Document
      Returns:
      the list of method names of an action that should clear locks for the current user
    • getLockClearningMethodNames

      @Deprecated public List<String> getLockClearningMethodNames()
      Deprecated.
      Description copied from interface: Document
      Renamed:
      Specified by:
      getLockClearningMethodNames in interface Document
      Returns:
      the list of method names of an action that should clear locks for the current user
      See Also:
    • useCustomLockDescriptors

      public boolean useCustomLockDescriptors()
      This default implementation simply returns false to indicate that custom lock descriptors are not supported by DocumentBase. If custom lock descriptors are needed, the appropriate subclasses should override this method.
      Specified by:
      useCustomLockDescriptors in interface Document
      Returns:
      True if the document can generate custom lock descriptors, false otherwise.
      See Also:
    • getCustomLockDescriptor

      public String getCustomLockDescriptor(Person user)
      This default implementation just throws a PessimisticLockingException. Subclasses of DocumentBase that need support for custom lock descriptors should override this method.
      Specified by:
      getCustomLockDescriptor in interface Document
      Parameters:
      user - The user trying to establish the lock.
      Returns:
      A String representing the lock descriptor.
      See Also:
    • getAttachmentService

      protected AttachmentService getAttachmentService()
    • getNoteService

      protected NoteService getNoteService()
    • refreshReferenceObject

      @Deprecated public void refreshReferenceObject(String referenceObjectName)
      Deprecated.
      This is a KNS/OJB-related method. It should not be used on KRAD/JPA-based documents.
      Overrides this OJB method to accept the no-longer-bound documentHeader reference and perform the refresh via services instead of via OJB. For any other property, it works as before.
      Overrides:
      refreshReferenceObject in class PersistableBusinessObjectBaseAdapter