1 /**
2 * Copyright 2005-2012 The Kuali Foundation
3 *
4 * Licensed under the Educational Community License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/ecl2.php
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.kuali.rice.krad.maintenance;
17
18 import org.kuali.rice.krad.document.Document;
19
20 /**
21 * Common interface for all maintenance documents.
22 */
23 public interface MaintenanceDocument extends Document {
24
25 /**
26 * Get the XML representation of the maintenance document
27 *
28 * @return String containing the xml representation of the maintenance document
29 */
30 String getXmlDocumentContents();
31
32 /**
33 * Get the new maintainable object
34 *
35 * @return Maintainable which holds the new maintenance record
36 */
37 Maintainable getNewMaintainableObject();
38
39 /**
40 * Get the old maintainable object
41 *
42 * @return Maintainable which holds the old maintenance record
43 */
44 Maintainable getOldMaintainableObject();
45
46 /**
47 * Sets the xml contents of the maintenance document
48 *
49 * @param documentContents String xml
50 */
51 void setXmlDocumentContents(String documentContents);
52
53 /**
54 * Set the new maintainable object
55 *
56 * @param newMaintainableObject maintainable with the new maintenance record
57 */
58 void setNewMaintainableObject(Maintainable newMaintainableObject);
59
60 /**
61 * Set the old maintainable object
62 *
63 * @param oldMaintainableObject maintainable with the old maintenance record
64 */
65 void setOldMaintainableObject(Maintainable oldMaintainableObject);
66
67 /**
68 * Return the data object that this MaintenanceDocument is maintaining
69 *
70 * @return document data object instance
71 */
72 Object getDocumentDataObject();
73
74 /**
75 * Build the xml document string from the contents of the old and new maintainables.
76 */
77 void populateXmlDocumentContentsFromMaintainables();
78
79 /**
80 * Populates the old and new maintainables from the xml document contents string.
81 */
82 void populateMaintainablesFromXmlDocumentContents();
83
84 /**
85 * Check if maintenance document has old maintenance data
86
87 * @return true if this maintenance document has old data, false otherwise
88 */
89 boolean isOldDataObjectInDocument();
90
91 /**
92 * Check if maintenance document is creating a new Business Object
93 *
94 * @return true if this maintenance document is creating a new Business Object, false otherwise
95 */
96 boolean isNew();
97
98 /**
99 * 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 }