Class MaintenanceDocumentBase

java.lang.Object
org.kuali.rice.krad.bo.DataObjectBase
org.kuali.rice.krad.bo.PersistableBusinessObjectBaseAdapter
org.kuali.rice.krad.document.DocumentBase
org.kuali.rice.krad.maintenance.MaintenanceDocumentBase
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, org.kuali.rice.core.api.mo.common.GloballyUnique, org.kuali.rice.core.api.mo.common.Versioned, Document, SessionDocument, MaintenanceDocument

@Entity public class MaintenanceDocumentBase extends DocumentBase implements MaintenanceDocument, SessionDocument
Document class for all maintenance documents which wraps the maintenance object in a Maintainable that is also used for various callbacks

The maintenance xml structure will be: <maintainableDocumentContents maintainableImplClass="className"> <oldMaintainableObject>... </oldMaintainableObject> <newMaintainableObject>... </newMaintainableObject> </maintainableDocumentContents> Maintenance Document

Author:
Kuali Rice Team (rice.collab@kuali.org)
See Also:
  • Field Details

    • SUB_OBJECT_MATERIALIZATION_DEPTH

      protected static final int SUB_OBJECT_MATERIALIZATION_DEPTH
      See Also:
    • MAINTAINABLE_IMPL_CLASS

      public static final String MAINTAINABLE_IMPL_CLASS
      See Also:
    • OLD_MAINTAINABLE_TAG_NAME

      public static final String OLD_MAINTAINABLE_TAG_NAME
      See Also:
    • NEW_MAINTAINABLE_TAG_NAME

      public static final String NEW_MAINTAINABLE_TAG_NAME
      See Also:
    • MAINTENANCE_ACTION_TAG_NAME

      public static final String MAINTENANCE_ACTION_TAG_NAME
      See Also:
    • NOTES_TAG_NAME

      public static final String NOTES_TAG_NAME
      See Also:
    • oldMaintainableObject

      protected Maintainable oldMaintainableObject
    • newMaintainableObject

      protected Maintainable newMaintainableObject
    • xmlDocumentContents

      protected String xmlDocumentContents
    • fieldsClearedOnCopy

      protected boolean fieldsClearedOnCopy
    • displayTopicFieldInNotes

      protected boolean displayTopicFieldInNotes
    • attachmentPropertyName

      protected String attachmentPropertyName
    • attachmentListPropertyName

      protected String attachmentListPropertyName
    • attachmentCollectionName

      protected String attachmentCollectionName
    • attachment

      protected org.kuali.rice.krad.bo.DocumentAttachment attachment
    • attachments

      protected List<org.kuali.rice.krad.bo.MultiDocumentAttachment> attachments
  • Constructor Details

    • MaintenanceDocumentBase

      public MaintenanceDocumentBase()
    • MaintenanceDocumentBase

      public MaintenanceDocumentBase(String documentTypeName)
      Initializies the maintainables.
  • Method Details

    • getDocumentTitle

      public String getDocumentTitle()
      Builds out the document title for maintenance documents

      This will get loaded into the flex doc and passed into workflow. It will be searchable.

      Specified by:
      getDocumentTitle in interface Document
      Overrides:
      getDocumentTitle in class DocumentBase
      Returns:
      document title
    • isOldMaintainableInDocument

      protected boolean isOldMaintainableInDocument(Document xmlDocument)
      Check if oldMaintainable is specified in the XML of the maintenance document
      Parameters:
      xmlDocument - Maintenance document in XML form
      Returns:
      true if an oldMainainable exists in the xmlDocument, false otherwise
    • isOldDataObjectInDocument

      public boolean isOldDataObjectInDocument()
      Description copied from interface: MaintenanceDocument
      Check if maintenance document has old maintenance data
      Specified by:
      isOldDataObjectInDocument in interface MaintenanceDocument
      Returns:
      true if this maintenance document has old data, false otherwise
    • isNew

      public boolean isNew()
      Description copied from interface: MaintenanceDocument
      Check if maintenance document is creating a new Business Object
      Specified by:
      isNew in interface MaintenanceDocument
      Returns:
      true if this maintenance document is creating a new Business Object, false otherwise
    • isEdit

      public boolean isEdit()
      Description copied from interface: MaintenanceDocument
      Check if maintenance document is editing an existing Business Object
      Specified by:
      isEdit in interface MaintenanceDocument
      Returns:
      true if this maintenance document is editing an existing Business Object, false otherwise
    • isNewWithExisting

      public boolean isNewWithExisting()
      Description copied from interface: MaintenanceDocument
      Check if maintenance document is creating a new Business Object out of an existing Business Object

      For example, a new division vendor out of an existing parent vendor.

      Specified by:
      isNewWithExisting in interface MaintenanceDocument
      Returns:
      true if maintenance document is creating a new Business Object out of an existing Business object, false otherwise
    • populateMaintainablesFromXmlDocumentContents

      public void populateMaintainablesFromXmlDocumentContents()
      Description copied from interface: MaintenanceDocument
      Populates the old and new maintainables from the xml document contents string.
      Specified by:
      populateMaintainablesFromXmlDocumentContents in interface MaintenanceDocument
    • getMaintenanceAction

      protected String getMaintenanceAction(Document xmlDocument, String oldOrNewElementName)
      This method is a lame containment of ugly DOM walking code. This is ONLY necessary because of the version conflicts between Xalan.jar in 2.6.x and 2.7. As soon as we can upgrade to 2.7, this will be switched to using XPath, which is faster and much easier on the eyes.
      Parameters:
      oldOrNewElementName - - String oldMaintainableObject or newMaintainableObject
      Returns:
      the value of the element, or null if none was there
    • getDataObjectFromXML

      protected Object getDataObjectFromXML(String maintainableTagName)
      Get data object from XML

      Retrieves substring of document contents from maintainable tag name. Then use xml service to translate xml into a business object.

      Parameters:
      maintainableTagName - the xml tag name of the maintainable
      Returns:
      data object
    • populateXmlDocumentContentsFromMaintainables

      public void populateXmlDocumentContentsFromMaintainables()
      Populates the xml document contents from the maintainables.
      Specified by:
      populateXmlDocumentContentsFromMaintainables in interface MaintenanceDocument
      See Also:
    • doRouteStatusChange

      public void doRouteStatusChange(org.kuali.rice.kew.framework.postprocessor.DocumentRouteStatusChange statusChangeEvent)
      Description copied from interface: Document
      Handle the doRouteStatusChange event from the post processor
      Specified by:
      doRouteStatusChange in interface Document
      Overrides:
      doRouteStatusChange in class DocumentBase
      Parameters:
      statusChangeEvent - status change event
      See Also:
    • getWorkflowEngineDocumentIdsToLock

      public List<String> getWorkflowEngineDocumentIdsToLock()
      Description copied from class: DocumentBase
      The default implementation returns no additional ids for the workflow engine to lock prior to processing.
      Specified by:
      getWorkflowEngineDocumentIdsToLock in interface Document
      Overrides:
      getWorkflowEngineDocumentIdsToLock in class DocumentBase
      Returns:
      additional document IDs to lock prior to processing
    • 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
      Overrides:
      prepareForSave in class DocumentBase
    • 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
      Overrides:
      processAfterRetrieve in class DocumentBase
    • getNewMaintainableObject

      public Maintainable getNewMaintainableObject()
      Description copied from interface: MaintenanceDocument
      Get the new maintainable object
      Specified by:
      getNewMaintainableObject in interface MaintenanceDocument
      Returns:
      Maintainable which holds the new maintenance record
    • setNewMaintainableObject

      public void setNewMaintainableObject(Maintainable newMaintainableObject)
      Description copied from interface: MaintenanceDocument
      Set the new maintainable object
      Specified by:
      setNewMaintainableObject in interface MaintenanceDocument
      Parameters:
      newMaintainableObject - maintainable with the new maintenance record
    • getOldMaintainableObject

      public Maintainable getOldMaintainableObject()
      Description copied from interface: MaintenanceDocument
      Get the old maintainable object
      Specified by:
      getOldMaintainableObject in interface MaintenanceDocument
      Returns:
      Maintainable which holds the old maintenance record
    • setOldMaintainableObject

      public void setOldMaintainableObject(Maintainable oldMaintainableObject)
      Description copied from interface: MaintenanceDocument
      Set the old maintainable object
      Specified by:
      setOldMaintainableObject in interface MaintenanceDocument
      Parameters:
      oldMaintainableObject - maintainable with the old maintenance record
    • setDocumentNumber

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

      public final boolean isFieldsClearedOnCopy()
      Description copied from interface: MaintenanceDocument
      Check if fields are cleared on copy

      For copy action the primary keys need to be cleared. This flag indicates if the clearing has occurred.

      Specified by:
      isFieldsClearedOnCopy in interface MaintenanceDocument
      Returns:
      true if the primary keys have been cleared already, false otherwise
    • setFieldsClearedOnCopy

      public final void setFieldsClearedOnCopy(boolean fieldsClearedOnCopy)
      Description copied from interface: MaintenanceDocument
      Set the keys cleared on copy flag
      Specified by:
      setFieldsClearedOnCopy in interface MaintenanceDocument
      Parameters:
      fieldsClearedOnCopy -
    • getXmlDocumentContents

      public String getXmlDocumentContents()
      Description copied from interface: MaintenanceDocument
      Get the XML representation of the maintenance document
      Specified by:
      getXmlDocumentContents in interface MaintenanceDocument
      Returns:
      String containing the xml representation of the maintenance document
    • setXmlDocumentContents

      public void setXmlDocumentContents(String xmlDocumentContents)
      Description copied from interface: MaintenanceDocument
      Sets the xml contents of the maintenance document
      Specified by:
      setXmlDocumentContents in interface MaintenanceDocument
      Parameters:
      xmlDocumentContents - String xml
    • 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
      Overrides:
      getAllowsCopy in class DocumentBase
      Returns:
      True if it can be copied, false if not.
    • isDisplayTopicFieldInNotes

      public boolean isDisplayTopicFieldInNotes()
      Description copied from interface: MaintenanceDocument
      Check if the topic field should be displayed in the notes section
      Specified by:
      isDisplayTopicFieldInNotes in interface MaintenanceDocument
      Returns:
      true if the topic field should be displayed in the notes section, false otherwise
    • setDisplayTopicFieldInNotes

      public void setDisplayTopicFieldInNotes(boolean displayTopicFieldInNotes)
      Description copied from interface: MaintenanceDocument
      Set the display topic field in notes flag
      Specified by:
      setDisplayTopicFieldInNotes in interface MaintenanceDocument
    • serializeDocumentToXml

      public String serializeDocumentToXml()
      Overridden to avoid serializing the xml twice, because of the xmlDocumentContents property of this object
      Specified by:
      serializeDocumentToXml in interface Document
      Overrides:
      serializeDocumentToXml in class DocumentBase
      Returns:
      the document serialized to an xml string
    • prepareForSave

      public void prepareForSave(DocumentEvent event)
      Description copied from class: DocumentBase
      Override this method with implementation specific prepareForSave logic
      Specified by:
      prepareForSave in interface Document
      Overrides:
      prepareForSave in class DocumentBase
      Parameters:
      event - - indicates which document event was requested
    • refreshAttachment

      @Deprecated protected void refreshAttachment()
      Deprecated.
      The attachment BO is proxied in OJB. For some reason when an attachment does not yet exist, refreshReferenceObject is not returning null and the proxy cannot be materialized. So, this method exists to properly handle the proxied attachment BO. This is a hack and should be removed post JPA migration.
    • refreshAttachmentList

      @Deprecated protected void refreshAttachmentList()
      Deprecated.
    • populateAttachmentForBO

      @Deprecated public void populateAttachmentForBO()
      Deprecated.
    • populateDocumentAttachment

      @Deprecated public void populateDocumentAttachment()
      Deprecated.
    • populateAttachmentListForBO

      @Deprecated public void populateAttachmentListForBO()
      Deprecated.
    • populateAttachmentBeforeSave

      @Deprecated public void populateAttachmentBeforeSave()
      Deprecated.
    • populateDocumentAttachmentList

      @Deprecated public void populateDocumentAttachmentList()
      Deprecated.
    • populateBoAttachmentListBeforeSave

      @Deprecated public void populateBoAttachmentListBeforeSave()
      Deprecated.
    • deleteDocumentAttachment

      @Deprecated public void deleteDocumentAttachment()
      Deprecated.
    • deleteDocumentAttachmentList

      @Deprecated public void deleteDocumentAttachmentList()
      Deprecated.
    • validateBusinessRules

      public void validateBusinessRules(DocumentEvent event)
      Explicitly NOT calling super here. This is a complete override of the validation rules behavior.
      Specified by:
      validateBusinessRules in interface Document
      Overrides:
      validateBusinessRules in class DocumentBase
      Parameters:
      event - - indicates which document event was requested
      See Also:
    • checkForLockingDocument

      protected void checkForLockingDocument(boolean throwExceptionIfLocked)
    • postProcessSave

      public void postProcessSave(DocumentEvent event)
      this needs to happen after the document itself is saved, to preserve consistency of the ver_nbr and in the case of initial save, because this can't be saved until the document is saved initially
      Specified by:
      postProcessSave in interface Document
      Overrides:
      postProcessSave in class DocumentBase
      Parameters:
      event - - indicates which document event was requested
      See Also:
    • getDocumentDataObject

      public Object getDocumentDataObject()
      Description copied from interface: MaintenanceDocument
      Return the data object that this MaintenanceDocument is maintaining
      Specified by:
      getDocumentDataObject in interface MaintenanceDocument
      Returns:
      document data object instance
      See Also:
    • getNoteTarget

      public org.kuali.rice.core.api.mo.common.GloballyUnique getNoteTarget()

      The Note target for maintenance documents is determined by whether or not the underlying Maintainable supports business object notes or not. This is determined via a call to Maintainable.isNotesEnabled(). The note target is then derived as follows:

      • If the Maintainable supports business object notes, delegate to getDocumentDataObject().
      • Otherwise, delegate to the default implementation of getNoteTarget on the superclass which will effectively return a reference to the DocumentHeader.
      Specified by:
      getNoteTarget in interface Document
      Overrides:
      getNoteTarget in class DocumentBase
      Returns:
      Returns the documentBusinessObject.
      See Also:
    • getNoteType

      public org.kuali.rice.krad.util.NoteType getNoteType()
      The NoteType for maintenance documents is determined by whether or not the underlying Maintainable supports business object notes or not. This is determined via a call to Maintainable.isNotesEnabled(). The NoteType is then derived as follows:
      Specified by:
      getNoteType in interface Document
      Overrides:
      getNoteType in class DocumentBase
      Returns:
      the note type to use for notes associated with this document
      See Also:
    • getDocumentPropertySerizabilityEvaluator

      public PropertySerializabilityEvaluator getDocumentPropertySerizabilityEvaluator()
      Description copied from class: DocumentBase
      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
      Overrides:
      getDocumentPropertySerizabilityEvaluator in class DocumentBase
      Returns:
      a fully initialized evaluator object, ready to be used for workflow routing
      See Also:
    • getAttachment

      public org.kuali.rice.krad.bo.DocumentAttachment getAttachment()
    • setAttachment

      public void setAttachment(org.kuali.rice.krad.bo.DocumentAttachment attachment)
    • getAttachments

      public List<org.kuali.rice.krad.bo.MultiDocumentAttachment> getAttachments()
    • setAttachments

      public void setAttachments(List<org.kuali.rice.krad.bo.MultiDocumentAttachment> attachments)
    • getAttachmentPropertyName

      public String getAttachmentPropertyName()
    • isAttachmentPropertyNameRootLevel

      public boolean isAttachmentPropertyNameRootLevel()
    • isAttachmentListPropertyNameRootLevel

      public boolean isAttachmentListPropertyNameRootLevel()
    • setAttachmentPropertyName

      public void setAttachmentPropertyName(String attachmentPropertyName)
    • getAttachmentListPropertyName

      public String getAttachmentListPropertyName()
    • setAttachmentListPropertyName

      public void setAttachmentListPropertyName(String attachmentListPropertyName)
    • getAttachmentCollectionName

      public String getAttachmentCollectionName()
    • setAttachmentCollectionName

      public void setAttachmentCollectionName(String attachmentCollectionName)
    • isSessionDocument

      public boolean isSessionDocument()
      This method to check whether the document class implements SessionDocument TODO: move to KNS maintenance document base
      Returns:
      true if the document is a session document
    • useCustomLockDescriptors

      public boolean useCustomLockDescriptors()
      Returns whether or not the new maintainable object supports custom lock descriptors. Will always return false if the new maintainable is null.
      Specified by:
      useCustomLockDescriptors in interface Document
      Overrides:
      useCustomLockDescriptors in class DocumentBase
      Returns:
      True if the document can generate custom lock descriptors, false otherwise.
      See Also:
    • getCustomLockDescriptor

      public String getCustomLockDescriptor(org.kuali.rice.kim.api.identity.Person user)
      Returns the custom lock descriptor generated by the new maintainable object, if defined. Will throw a PessimisticLockingException if the new maintainable is null.
      Specified by:
      getCustomLockDescriptor in interface Document
      Overrides:
      getCustomLockDescriptor in class DocumentBase
      Parameters:
      user - The user trying to establish the lock.
      Returns:
      A String representing the lock descriptor.
      See Also:
    • getDocumentDictionaryService

      protected DocumentDictionaryService getDocumentDictionaryService()
    • getMaintenanceDocumentService

      protected MaintenanceDocumentService getMaintenanceDocumentService()
    • getDocumentService

      protected DocumentService getDocumentService()
    • getWorkflowDocumentService

      protected org.kuali.rice.kew.api.document.WorkflowDocumentService getWorkflowDocumentService()
    • getBusinessObjectSerializerService

      protected org.kuali.rice.krad.service.BusinessObjectSerializerService getBusinessObjectSerializerService()
      Returns:
      the service used for serializing maintained business / data objects
    • checkAllowsRecordDeletion

      protected boolean checkAllowsRecordDeletion()
    • checkMaintenanceAction

      protected boolean checkMaintenanceAction()
    • checkDeletePermission

      protected boolean checkDeletePermission(Object dataObject)