001 /**
002 * Copyright 2005-2013 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 */
016 package org.kuali.rice.krad.maintenance;
017
018 import org.kuali.rice.krad.document.Document;
019
020 /**
021 * Common interface for all maintenance documents.
022 */
023 public interface MaintenanceDocument extends Document {
024
025 /**
026 * Get the XML representation of the maintenance document
027 *
028 * @return String containing the xml representation of the maintenance document
029 */
030 String getXmlDocumentContents();
031
032 /**
033 * Get the new maintainable object
034 *
035 * @return Maintainable which holds the new maintenance record
036 */
037 Maintainable getNewMaintainableObject();
038
039 /**
040 * Get the old maintainable object
041 *
042 * @return Maintainable which holds the old maintenance record
043 */
044 Maintainable getOldMaintainableObject();
045
046 /**
047 * Sets the xml contents of the maintenance document
048 *
049 * @param documentContents String xml
050 */
051 void setXmlDocumentContents(String documentContents);
052
053 /**
054 * Set the new maintainable object
055 *
056 * @param newMaintainableObject maintainable with the new maintenance record
057 */
058 void setNewMaintainableObject(Maintainable newMaintainableObject);
059
060 /**
061 * Set the old maintainable object
062 *
063 * @param oldMaintainableObject maintainable with the old maintenance record
064 */
065 void setOldMaintainableObject(Maintainable oldMaintainableObject);
066
067 /**
068 * Return the data object that this MaintenanceDocument is maintaining
069 *
070 * @return document data object instance
071 */
072 Object getDocumentDataObject();
073
074 /**
075 * Build the xml document string from the contents of the old and new maintainables.
076 */
077 void populateXmlDocumentContentsFromMaintainables();
078
079 /**
080 * Populates the old and new maintainables from the xml document contents string.
081 */
082 void populateMaintainablesFromXmlDocumentContents();
083
084 /**
085 * Check if maintenance document has old maintenance data
086
087 * @return true if this maintenance document has old data, false otherwise
088 */
089 boolean isOldDataObjectInDocument();
090
091 /**
092 * Check if maintenance document is creating a new Business Object
093 *
094 * @return true if this maintenance document is creating a new Business Object, false otherwise
095 */
096 boolean isNew();
097
098 /**
099 * Check if maintenance document is editing an existing Business Object
100 *
101 * @return true if this maintenance document is editing an existing Business Object, false otherwise
102 */
103 boolean isEdit();
104
105 /**
106 * Check if maintenance document is creating a new Business Object out of an existing Business Object
107 *
108 * <p>
109 * For example, a new division vendor out of an existing parent vendor.
110 * </p>
111 *
112 * @return true if maintenance document is creating a new Business Object out of an existing Business object, false otherwise
113 */
114 boolean isNewWithExisting();
115
116 /**
117 * Check if fields are cleared on copy
118 *
119 * <p>
120 * For copy action the primary keys need to be cleared. This flag indicates if the clearing has occurred.
121 * </p>
122 *
123 * @return true if the primary keys have been cleared already, false otherwise
124 */
125 boolean isFieldsClearedOnCopy();
126
127 /**
128 * Set the keys cleared on copy flag
129 *
130 * @param keysClearedOnCopy
131 *
132 */
133 void setFieldsClearedOnCopy(boolean keysClearedOnCopy);
134
135 /**
136 * Check if the topic field should be displayed in the notes section
137 *
138 * @return true if the topic field should be displayed in the notes section, false otherwise
139 */
140 boolean isDisplayTopicFieldInNotes();
141
142 /**
143 * Set the display topic field in notes flag
144 *
145 * @parm displayTopicFieldInNotes
146 */
147 void setDisplayTopicFieldInNotes(boolean displayTopicFieldInNotes);
148
149 }