Coverage Report - org.kuali.rice.kns.document.Document
 
Classes in this File Line Coverage Branch Coverage Complexity
Document
N/A
N/A
1
 
 1  
 /*
 2  
  * Copyright 2005-2007 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.kns.document;
 17  
 
 18  
 import java.util.List;
 19  
 import java.util.Map;
 20  
 
 21  
 import org.kuali.rice.kew.dto.ActionTakenEventDTO;
 22  
 import org.kuali.rice.kew.dto.DocumentRouteLevelChangeDTO;
 23  
 import org.kuali.rice.kew.dto.DocumentRouteStatusChangeDTO;
 24  
 import org.kuali.rice.kim.bo.Person;
 25  
 import org.kuali.rice.kns.bo.AdHocRoutePerson;
 26  
 import org.kuali.rice.kns.bo.AdHocRouteWorkgroup;
 27  
 import org.kuali.rice.kns.bo.DocumentHeader;
 28  
 import org.kuali.rice.kns.bo.PersistableBusinessObject;
 29  
 import org.kuali.rice.kns.document.authorization.PessimisticLock;
 30  
 import org.kuali.rice.kns.exception.ValidationException;
 31  
 import org.kuali.rice.kns.rule.event.KualiDocumentEvent;
 32  
 import org.kuali.rice.kns.service.DocumentSerializerService;
 33  
 import org.kuali.rice.kns.util.documentserializer.PropertySerializabilityEvaluator;
 34  
 import org.kuali.rice.kns.web.struts.action.KualiDocumentActionBase;
 35  
 import org.kuali.rice.kns.workflow.KualiDocumentXmlMaterializer;
 36  
 
 37  
 
 38  
 /**
 39  
  * This is the Document interface. All entities that are regarded as "eDocs" in the system, including Maintenance documents and
 40  
  * Transaction Processing documents should implement this interface as it defines methods that are necessary to interact with the
 41  
  * underlying frameworks and components (i.e. attachments, workflow, etc).
 42  
  */
 43  
 public interface Document extends PersistableBusinessObject{
 44  
     /**
 45  
      * This retrieves the standard <code>DocumentHeader</code> object, which contains standard meta-data about a document.
 46  
      * 
 47  
      * @return document header since all docs will have a document header
 48  
      */
 49  
     public DocumentHeader getDocumentHeader();
 50  
 
 51  
     /**
 52  
      * Sets the associated <code>DocumentHeader</code> for this document.
 53  
      * 
 54  
      * @param documentHeader
 55  
      */
 56  
     public void setDocumentHeader(DocumentHeader documentHeader);
 57  
 
 58  
     /**
 59  
      * All documents have a document header id. This is the quick accessor to that unique identifier and should return the same
 60  
      * value as documentHeader.getDocumentHeaderId().
 61  
      * 
 62  
      * @return doc header id
 63  
      */
 64  
     public String getDocumentNumber();
 65  
 
 66  
     /**
 67  
      * setter for document header id
 68  
      * 
 69  
      * @param documentHeaderId
 70  
      */
 71  
     public void setDocumentNumber(String documentHeaderId);
 72  
 
 73  
     /**
 74  
      * This is the method to integrate with workflow, where we will actually populate the workflow defined data structure(s) so that
 75  
      * workflow can routed based on this data. This method is responsible for passing over the proper Kuali (client system) data
 76  
      * that will be used by workflow to determine how the document is actually routed.
 77  
      */
 78  
     public void populateDocumentForRouting();
 79  
 
 80  
     /**
 81  
      * 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
 82  
      * attributes on.
 83  
      * 
 84  
      * @return the document serialized to an xml string
 85  
      */
 86  
     public String serializeDocumentToXml();
 87  
     
 88  
     /**
 89  
      * 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
 90  
      * methods prepareForSave() and populateDocumentForRouting().
 91  
      */
 92  
     public String getXmlForRouteReport();
 93  
     
 94  
     /**
 95  
      * method to integrate with workflow, where we will actually handle the transitions of levels for documents
 96  
      */
 97  
     public void doRouteLevelChange(DocumentRouteLevelChangeDTO levelChangeEvent);
 98  
     
 99  
     /**
 100  
      * method to integrate with workflow where we will be able to perform logic for an action taken being performed on a document
 101  
      */
 102  
     public void doActionTaken(ActionTakenEventDTO event);
 103  
     
 104  
     /**
 105  
      * This method will be called after the Workflow engine has completely finished processing a document.
 106  
      * 
 107  
      * @param successfullyProcessed - true if the document was processed successfully, false otherwise
 108  
      */
 109  
     public void afterWorkflowEngineProcess(boolean successfullyProcessed);
 110  
     
 111  
     /**
 112  
      * This method will be called before the Workflow engine has begun processing a document.
 113  
      */
 114  
     public void beforeWorkflowEngineProcess();
 115  
     
 116  
     /**
 117  
      * This method will be called before the Workflow engine has begun processing a document.
 118  
      */
 119  
     public List<Long> getWorkflowEngineDocumentIdsToLock();
 120  
 
 121  
     /**
 122  
      * Getter method to get the document title as it will appear in and be searchable in workflow.
 123  
      */
 124  
     public String getDocumentTitle();
 125  
 
 126  
     /**
 127  
      * 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
 128  
      * for a given users version of a document as this state is only persisted in workflow itself when someone takes an action on a
 129  
      * document
 130  
      */
 131  
     public List<AdHocRoutePerson> getAdHocRoutePersons();
 132  
 
 133  
     /**
 134  
      * getter method to get the list of ad hoc route workgroups associated with a document at a point in time, this list is only
 135  
      * valid for a given users version of a document as this state is only persisted in workflow itself when someone takes an action
 136  
      * on a document
 137  
      */
 138  
     public List<AdHocRouteWorkgroup> getAdHocRouteWorkgroups();
 139  
 
 140  
     /**
 141  
      * 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
 142  
      * for a given users version of a document as this state is only persisted in workflow itself when someone takes an action on a
 143  
      * document
 144  
      * 
 145  
      * @param adHocRoutePersons
 146  
      */
 147  
     public void setAdHocRoutePersons(List<AdHocRoutePerson> adHocRoutePersons);
 148  
 
 149  
     /**
 150  
      * setter method to set the list of ad hoc route workgroups associated with a document at a point in time, this list is only
 151  
      * valid for a given users version of a document as this state is only persisted in workflow itself when someone takes an action
 152  
      * on a document
 153  
      * 
 154  
      * @param adHocRouteWorkgroups
 155  
      */
 156  
     public void setAdHocRouteWorkgroups(List<AdHocRouteWorkgroup> adHocRouteWorkgroups);
 157  
 
 158  
     /**
 159  
      * This method provides a hook that will be called before the document is saved. This method is useful for applying document
 160  
      * level data to children. For example, if someone changes data at the document level, and that data needs to be propagated to
 161  
      * child objects or child lists of objects, you can use this method to update the child object or iterate through the list of
 162  
      * child objects and apply the document level data to them. Any document that follows this paradigm will need to make use of
 163  
      * this method to apply all of those changes.
 164  
      */
 165  
     public void prepareForSave();
 166  
 
 167  
     /**
 168  
      * Sends document off to the rules engine to verify business rules.
 169  
      * 
 170  
      * @param document - document to validate
 171  
      * @param event - indicates which document event was requested
 172  
      * @throws ValidationException - containing the MessageMap from the validation session.
 173  
      */
 174  
     public void validateBusinessRules(KualiDocumentEvent event);
 175  
     
 176  
     /**
 177  
      * Do any work on the document that requires the KualiDocumentEvent before the save.
 178  
      * 
 179  
      * @param event - indicates which document event was requested
 180  
      */
 181  
     public void prepareForSave(KualiDocumentEvent event);
 182  
     
 183  
     /**
 184  
      * Do any work on the document after the save.
 185  
      * 
 186  
      * @param event - indicates which document event was requested
 187  
      */
 188  
     public void postProcessSave(KualiDocumentEvent event);
 189  
     
 190  
     /**
 191  
      * This method provides a hook that will be called after a document is retrieved, but before it is returned from the
 192  
      * DocumentService.
 193  
      */
 194  
     public void processAfterRetrieve();
 195  
 
 196  
     /**
 197  
      * This method returns whether or not this document can be copied.
 198  
      * 
 199  
      * @return True if it can be copied, false if not.
 200  
      */
 201  
     public boolean getAllowsCopy();
 202  
     
 203  
     /**
 204  
      * Generate any necessary events required during the save event generation
 205  
      * 
 206  
      */
 207  
     public List generateSaveEvents();
 208  
     
 209  
    /**
 210  
      * Handle the doRouteStatusChange event from the post processor
 211  
      * 
 212  
      */
 213  
     public void doRouteStatusChange(DocumentRouteStatusChangeDTO statusChangeEvent);
 214  
     
 215  
     
 216  
     /**
 217  
      * This is a helper to return BO for use by notes, it allows both maintenance and transactional to have consistent 
 218  
      * notes paths without the tag or action knowing what kind of document they are
 219  
      * 
 220  
      * @return "this" unless overriden
 221  
      */
 222  
     public PersistableBusinessObject getDocumentBusinessObject();
 223  
     
 224  
     /**
 225  
      * This method gets a list of the {@link PessimisticLock} objects associated with this document
 226  
      * 
 227  
      */
 228  
     public List<PessimisticLock> getPessimisticLocks();
 229  
     
 230  
     /**
 231  
      * This method updates the list of {@link PessimisticLock} objects on the document if changes could
 232  
      * have been made
 233  
      */
 234  
     public void refreshPessimisticLocks();
 235  
     
 236  
     /**
 237  
      * This method adds a new {@link PessimisticLock} to the document
 238  
      * 
 239  
      * NOTE: LOCKS ADDED VIA THIS METHOD WILL NOT BE SAVED WITH THE DOCUMENT
 240  
      * 
 241  
      * @param lock - the lock to add to the document
 242  
      */
 243  
     public void addPessimisticLock(PessimisticLock lock);
 244  
     
 245  
     /**
 246  
      * This is a method that is used by Kuali Pessimistic Locking to get the names (method to call values)
 247  
      * of the {@link KualiDocumentActionBase} methods that should release locks
 248  
      * 
 249  
      * @return the list of method names of an action that should clear locks for the current user
 250  
      */
 251  
     public List<String> getLockClearningMethodNames();
 252  
     /**
 253  
      * Returns an evaluator object that determines whether a given property relative to the root object ({@link #wrapDocumentWithMetadataForXmlSerialization()}
 254  
      * is serializable during the document serialization process.
 255  
      * 
 256  
      * @return a fully initialized evaluator object, ready to be used for workflow routing
 257  
      * 
 258  
      * @see DocumentSerializerService
 259  
      * @see #wrapDocumentWithMetadataForXmlSerialization()
 260  
      */
 261  
     
 262  
     public String getBasePathToDocumentDuringSerialization();
 263  
     
 264  
     /**
 265  
      * Returns an evaluator object that determines whether a given property relative to the root object ({@link #wrapDocumentWithMetadataForXmlSerialization()}
 266  
      * is serializable during the document serialization process.
 267  
      * 
 268  
      * @return a fully initialized evaluator object, ready to be used for workflow routing
 269  
      * 
 270  
      * @see DocumentSerializerService
 271  
      * @see #wrapDocumentWithMetadataForXmlSerialization()
 272  
      */
 273  
     public PropertySerializabilityEvaluator getDocumentPropertySerizabilityEvaluator();
 274  
     
 275  
     /**
 276  
      * This method will return the root object to be serialized for workflow routing.  If necessary, this method will wrap this document object with a wrapper (i.e. contains a reference back to this document).  This
 277  
      * wrapper may also contain references to additional objects that provide metadata useful to the workflow engine.
 278  
      * 
 279  
      * If no wrappers are necessary, then this object may return "this"
 280  
      * 
 281  
      * @return a wrapper object (most likely containing a reference to "this"), or "this" itself.
 282  
      * @see KualiDocumentXmlMaterializer
 283  
      */
 284  
     public Object wrapDocumentWithMetadataForXmlSerialization();
 285  
     
 286  
     /**
 287  
      * This method returns whether or not this document supports custom lock descriptors for pessimistic locking.
 288  
      * 
 289  
      * @return True if the document can generate custom lock descriptors, false otherwise.
 290  
      * @see #getCustomLockDescriptor(Map, Person)
 291  
      */
 292  
     public boolean useCustomLockDescriptors();
 293  
     
 294  
     /**
 295  
      * Generates a custom lock descriptor for pessimistic locking. This method should not be called unless {@link #useCustomLockDescriptors()} returns true.
 296  
      * 
 297  
      * @param user The user trying to establish the lock.
 298  
      * @return A String representing the lock descriptor.
 299  
      * @see #useCustomLockDescriptors()
 300  
      * @see org.kuali.rice.kns.service.PessimisticLockService
 301  
      * @see org.kuali.rice.kns.service.impl.PessimisticLockServiceImpl
 302  
      */
 303  
     public String getCustomLockDescriptor(Person user);
 304  
 }