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.document;
017:
018: import java.io.Serializable;
019: import java.lang.reflect.InvocationTargetException;
020: import java.util.List;
021:
022: import org.kuali.core.bo.DocumentHeader;
023: import org.kuali.core.bo.PersistableBusinessObject;
024: import org.kuali.core.exceptions.IllegalObjectStateException;
025: import org.kuali.core.rule.event.KualiDocumentEvent;
026:
027: import edu.iu.uis.eden.exception.WorkflowException;
028:
029: import edu.iu.uis.eden.clientapp.vo.ActionTakenEventVO;
030: import edu.iu.uis.eden.clientapp.vo.DocumentRouteLevelChangeVO;
031: import edu.iu.uis.eden.clientapp.vo.DocumentRouteStatusChangeVO;
032:
033: /**
034: * This is the Document interface. All entities that are regarded as "eDocs" in the system, including Maintenance documents and
035: * Transaction Processing documents should implement this interface as it defines methods that are necessary to interact with the
036: * underlying frameworks and components (i.e. attachments, workflow, etc).
037: */
038: public interface Document extends PersistableBusinessObject {
039: /**
040: * This retrieves the standard <code>DocumentHeader</code> object, which contains standard meta-data about a document.
041: *
042: * @return document header since all docs will have a document header
043: */
044: public DocumentHeader getDocumentHeader();
045:
046: /**
047: * Sets the associated <code>DocumentHeader</code> for this document.
048: *
049: * @param documentHeader
050: */
051: public void setDocumentHeader(DocumentHeader documentHeader);
052:
053: /**
054: * All documents have a document header id. This is the quick accessor to that unique identifier and should return the same
055: * value as documentHeader.getDocumentHeaderId().
056: *
057: * @return doc header id
058: */
059: public String getDocumentNumber();
060:
061: /**
062: * setter for document header id
063: *
064: * @param documentHeaderId
065: */
066: public void setDocumentNumber(String documentHeaderId);
067:
068: /**
069: * This is the method to integrate with workflow, where we will actually populate the workflow defined data structure(s) so that
070: * workflow can routed based on this data. This method is responsible for passing over the proper Kuali (client system) data
071: * that will be used by workflow to determine how the document is actually routed.
072: */
073: public void populateDocumentForRouting();
074:
075: /**
076: * This is a method where we can get the xml of a document that the workflow system will use to base it's routing and search
077: * attributes on.
078: *
079: * @return the document serialized to an xml string
080: */
081: public String serializeDocumentToXml();
082:
083: /**
084: * This method is used to get the xml that should be used in a Route Report. In it's default implementation this will call the
085: * methods prepareForSave() and populateDocumentForRouting().
086: */
087: public String getXmlForRouteReport();
088:
089: /**
090: * method to integrate with workflow, where we will actually handle the transitions of status for documents
091: *
092: */
093: public void handleRouteStatusChange();
094:
095: /**
096: * method to integrate with workflow, where we will actually handle the transitions of levels for documents
097: */
098: public void handleRouteLevelChange(
099: DocumentRouteLevelChangeVO levelChangeEvent);
100:
101: /**
102: * method to integrate with workflow where we will be able to perform logic for an action taken being performed on a document
103: */
104: public void doActionTaken(ActionTakenEventVO event);
105:
106: /**
107: * Getter method to get the document title as it will appear in and be searchable in workflow.
108: */
109: public String getDocumentTitle();
110:
111: /**
112: * getter method to get the list of ad hoc route persons associated with a document at a point in time, this list is only valid
113: * for a given users version of a document as this state is only persisted in workflow itself when someone takes an action on a
114: * document
115: */
116: public List getAdHocRoutePersons();
117:
118: /**
119: * getter method to get the list of ad hoc route workgroups associated with a document at a point in time, this list is only
120: * valid for a given users version of a document as this state is only persisted in workflow itself when someone takes an action
121: * on a document
122: */
123: public List getAdHocRouteWorkgroups();
124:
125: /**
126: * setter method to set the list of ad hoc route persons associated with a document at a point in time, this list is only valid
127: * for a given users version of a document as this state is only persisted in workflow itself when someone takes an action on a
128: * document
129: *
130: * @param adHocRoutePersons
131: */
132: public void setAdHocRoutePersons(List adHocRoutePersons);
133:
134: /**
135: * setter method to set the list of ad hoc route workgroups associated with a document at a point in time, this list is only
136: * valid for a given users version of a document as this state is only persisted in workflow itself when someone takes an action
137: * on a document
138: *
139: * @param adHocRouteWorkgroups
140: */
141: public void setAdHocRouteWorkgroups(List adHocRouteWorkgroups);
142:
143: /**
144: * This method provides a hook that will be called before the document is saved. This method is useful for applying document
145: * level data to children. For example, if someone changes data at the document level, and that data needs to be propagated to
146: * child objects or child lists of objects, you can use this method to update the child object or iterate through the list of
147: * child objects and apply the document level data to them. Any document that follows this paradigm will need to make use of
148: * this method to apply all of those changes.
149: */
150: public void prepareForSave();
151:
152: /**
153: * Sends document off to the rules engine to verify business rules.
154: *
155: * @param document - document to validate
156: * @param event - indicates which document event was requested
157: * @throws ValidationException - containing the MessageMap from the validation session.
158: */
159: public void validateBusinessRules(KualiDocumentEvent event);
160:
161: /**
162: * Do any work on the document that requires the KualiDocumentEvent before the save.
163: *
164: * @param event - indicates which document event was requested
165: */
166: public void prepareForSave(KualiDocumentEvent event);
167:
168: /**
169: * Do any work on the document after the save.
170: *
171: * @param event - indicates which document event was requested
172: */
173: public void postProcessSave(KualiDocumentEvent event);
174:
175: /**
176: * This method provides a hook that will be called after a document is retrieved, but before it is returned from the
177: * DocumentService.
178: */
179: public void processAfterRetrieve();
180:
181: /**
182: * This method returns whether or not this document can be copied.
183: *
184: * @return True if it can be copied, false if not.
185: */
186: public boolean getAllowsCopy();
187:
188: /**
189: * Generate any necessary events required during the save event generation
190: *
191: */
192: public List generateSaveEvents();
193:
194: /**
195: * Handle the doRouteStatusChange event from the post processor
196: *
197: */
198: public void doRouteStatusChange(
199: DocumentRouteStatusChangeVO statusChangeEvent)
200: throws Exception;
201:
202: /**
203: * This is a helper to return BO for use by notes, it allows both maintenance and transactional to have consistent
204: * notes paths without the tag or action knowing what kind of document they are
205: *
206: * @return "this" unless overriden
207: */
208: public PersistableBusinessObject getDocumentBusinessObject();
209:
210: }
|