001/**
002 * Copyright 2005-2016 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.krad.maintenance;
017
018import org.kuali.rice.krad.document.Document;
019import org.kuali.rice.krad.maintenance.Maintainable;
020
021/**
022 * Common interface for all maintenance documents.
023 */
024public interface MaintenanceDocument extends Document {
025
026    /**
027     * @return String containing the xml representation of the maintenance document
028     */
029    public String getXmlDocumentContents();
030
031    /**
032     * @return Maintainable which holds the new maintenance record
033     */
034    public Maintainable getNewMaintainableObject();
035
036    /**
037     * @return Maintainable which holds the old maintenance record
038     */
039    public Maintainable getOldMaintainableObject();
040
041    /**
042     * Sets the xml contents of the maintenance document
043     * 
044     * @param documentContents - String xml
045     */
046    public void setXmlDocumentContents(String documentContents);
047
048    /**
049     * @param newMaintainableObject - Initializes the new maintainable
050     */
051    public void setNewMaintainableObject(Maintainable newMaintainableObject);
052
053    /**
054     * @param newMaintainableObject - Initializes the old maintainable
055     */
056    public void setOldMaintainableObject(Maintainable oldMaintainableObject);
057
058    /**
059     * Returns a reference to the data object that this MaintenanceDocument is maintaining
060     */
061    public Object getDocumentDataObject();
062    
063    /**
064     * Builds the xml document string from the contents of the old and new maintainbles.
065     */
066    public void populateXmlDocumentContentsFromMaintainables();
067
068    /**
069     * Populates the old and new maintainables from the xml document contents string.
070     */
071    public void populateMaintainablesFromXmlDocumentContents();
072
073    /**
074     * @return boolean - indicates whether this is an edit or new maintenace document by the existence of an old maintainable
075     */
076    public boolean isOldDataObjectInDocument();
077
078    /**
079     * 
080     * Returns true if this maintenance document is creating a new Business Object, false if its an edit.
081     * 
082     */
083    public boolean isNew();
084
085    /**
086     * 
087     * Returns true if this maintenance document is editing an existing Business Object, false if its creating a new one.
088     * 
089     */
090    public boolean isEdit();
091
092    /**
093     * 
094     * Returns true if this maintenance document is creating a new Business Object out of an existing Business Object,
095     * for example, a new division vendor out of an existing parent vendor.
096     * 
097     */
098    public boolean isNewWithExisting();
099    
100    /**
101     * 
102     * A flag which indicates whether the primary keys have been cleared on a Copy-type of document. This will be true if the 'clear
103     * keys on a copy' has been done, and it will be false if not.
104     * 
105     * @return true if the primary keys have been cleared already, false if not.
106     * 
107     */
108    public boolean isFieldsClearedOnCopy();
109
110    /**
111     * 
112     * This method sets the value of the fieldsClearedOnCopy.
113     * 
114     * @param fieldsClearedOnCopy - true or false
115     * 
116     */
117    public void setFieldsClearedOnCopy(boolean keysClearedOnCopy);
118
119    /**
120     * 
121     * This method...
122     * @return
123     */
124    public boolean getDisplayTopicFieldInNotes();
125
126    /**
127     * 
128     * This method...
129     */
130    public void setDisplayTopicFieldInNotes(boolean displayTopicFieldInNotes);
131
132}