001: /*
002: * Copyright 2005-2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.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/ecl1.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.core.maintenance;
017:
018: import java.util.Collection;
019: import java.util.List;
020: import java.util.Map;
021:
022: import org.kuali.core.bo.BusinessObject;
023: import org.kuali.core.bo.DocumentHeader;
024: import org.kuali.core.bo.PersistableBusinessObject;
025: import org.kuali.core.datadictionary.DataDictionaryDefinitionBase;
026: import org.kuali.core.document.MaintenanceDocument;
027: import org.kuali.core.document.MaintenanceLock;
028: import org.kuali.core.lookup.SelectiveReferenceRefresher;
029:
030: /**
031: * This interface defines basic methods that all maintainable objects must provide.
032: */
033: public interface Maintainable extends java.io.Serializable,
034: SelectiveReferenceRefresher {
035:
036: /**
037: * This is a hook to allow the document to override the generic document title.
038: *
039: * @return String document title
040: */
041: public String getDocumentTitle(MaintenanceDocument document);
042:
043: /**
044: * Sets the financial document number
045: *
046: * @param documentNumber - the Document's documentNumber
047: *
048: */
049: public void setDocumentNumber(String documentNumber);
050:
051: /**
052: * Returns instance of the business object that is being maintained.
053: */
054: public PersistableBusinessObject getBusinessObject();
055:
056: /**
057: * @return the locking representation(s) of this document, which are reproducible given the same keys and the same maintainable object
058: */
059: public List<MaintenanceLock> generateMaintenanceLocks();
060:
061: /**
062: * Returns a string that will be displayed as title on the maintenance screen.
063: */
064: public String getMaintainableTitle();
065:
066: /**
067: * Retrieves the status of the boNotesEnabled
068: */
069: public boolean isBoNotesEnabled();
070:
071: /**
072: * Returns a list of Section objects that specify how to render the view for the maintenance object.
073: *
074: * @param oldMaintainable - If this is the new maintainable, the old is passed in for reference
075: * @return
076: */
077: public List getSections(Maintainable oldMaintainable);
078:
079: /**
080: * Populates the business object based on key/value pairs.
081: */
082: public Map populateBusinessObject(Map fieldValues);
083:
084: /**
085: * Called from a lookup return by the maintenance action.
086: */
087: public void refresh(String refreshCaller, Map fieldValues,
088: MaintenanceDocument document);
089:
090: /**
091: * Sets an instance of a business object to be maintained.
092: */
093: public void setBusinessObject(PersistableBusinessObject object);
094:
095: /**
096: * Sets the maintenance action - new, edit, or copy
097: */
098: public void setMaintenanceAction(String maintenanceAction);
099:
100: /**
101: * Returns the maintenance action - new, edit, or copy
102: */
103: public String getMaintenanceAction();
104:
105: /**
106: * Indicates to maintainable whether or not to set default values.
107: *
108: * @param generateDefault
109: */
110: public void setGenerateDefaultValues(boolean generateDefault);
111:
112: /**
113: *
114: * Indicates whether default values are set on this maintainable.
115: *
116: * @return
117: */
118: public boolean isGenerateDefaultValues();
119:
120: /**
121: * Indicates to maintainable whether or not to set default values for blank required fields.
122: *
123: * @param generateBlankRequiredValues
124: */
125: public void setGenerateBlankRequiredValues(
126: boolean generateBlankRequiredValues);
127:
128: /**
129: *
130: * Indicates whether default values should be generated for blank required fields on this maintainable.
131: *
132: * @return
133: */
134: public boolean isGenerateBlankRequiredValues();
135:
136: public Class getBoClass();
137:
138: public void setBoClass(Class boClass);
139:
140: /**
141: *
142: * This method is a hook to do any necessary pre-save processing.
143: *
144: */
145: public void prepareForSave();
146:
147: /**
148: *
149: * This method is a hook to do any necessary post-load processing.
150: *
151: */
152: public void processAfterRetrieve();
153:
154: /**
155: *
156: * This method is a hook to do any necessary post-copy processing.
157: *
158: */
159: public void processAfterCopy();
160:
161: /**
162: * This method is a hook to do any necessary post-edit processing, which is to say that it is called when a document is about to be edited;
163: * this is therefore a hook to write any code to modify the business object before it is displayed to the end user to edit.
164: */
165: public void processAfterEdit();
166:
167: /**
168: *
169: * This method will cause the Maintainable implementation to save/store the relevant business object(s). This typically is
170: * called only after the maint document has gone through state to final.
171: *
172: */
173: public void saveBusinessObject();
174:
175: /**
176: * Populates the new collection lines based on key/value pairs.
177: *
178: * @param fieldValues
179: * @return
180: */
181: public Map populateNewCollectionLines(Map fieldValues);
182:
183: /**
184: * Gets the holder for the "add line" for a collection on the business object
185: *
186: * @param collectionName
187: * @return
188: */
189: public PersistableBusinessObject getNewCollectionLine(
190: String collectionName);
191:
192: /**
193: * Adds the new line for the given collection to the business object's collection.
194: *
195: * @param collectionName
196: */
197: public void addNewLineToCollection(String collectionName);
198:
199: /**
200: *
201: * This methods will do the setting of some attributes that might be necessary
202: * if we're creating a new business object using on an existing business object.
203: * For example, create a division Vendor based on an existing parent Vendor.
204: * (Please see VendorMaintainableImpl.java)
205: */
206: public void setupNewFromExisting();
207:
208: /**
209: * Indicates whether inactive records for the given collection should be display.
210: *
211: * @param collectionName - name of the collection (or sub-collection) to check inactive record display setting
212: * @return true if inactive records should be displayed, false otherwise
213: */
214: public boolean getShowInactiveRecords(String collectionName);
215:
216: /**
217: * Returns the Map used to control the state of inactive record collection display. Exposed for setting from the
218: * maintenance jsp.
219: */
220: public Map<String, Boolean> getInactiveRecordDisplay();
221:
222: /**
223: * Indicates to maintainble whether or not inactive records should be displayed for the given collection name.
224: *
225: * @param collectionName - name of the collection (or sub-collection) to set inactive record display setting
226: * @param showInactive - true to display inactive, false to not display inactive records
227: */
228: public void setShowInactiveRecords(String collectionName,
229: boolean showInactive);
230:
231: public void addMultipleValueLookupResults(
232: MaintenanceDocument document, String collectionName,
233: Collection<PersistableBusinessObject> rawValues);
234:
235: /**
236: * method to integrate with workflow, where we will actually handle the transitions of status for documents
237: */
238: public void handleRouteStatusChange(DocumentHeader documentHeader);
239:
240: public List<String> getDuplicateIdentifierFieldsFromDataDictionary(
241: String docTypeName, String collectionName);
242:
243: public List<String> getMultiValueIdentifierList(
244: Collection maintCollection,
245: List<String> duplicateIdentifierFields);
246:
247: public boolean hasBusinessObjectExisted(BusinessObject bo,
248: List<String> existingIdentifierList,
249: List<String> duplicateIdentifierFields);
250:
251: }
|