| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| MaintenanceDocumentRule |
|
| 1.0;1 |
| 1 | /* | |
| 2 | * Copyright 2006-2008 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.rules; | |
| 17 | ||
| 18 | import org.kuali.rice.kns.document.Document; | |
| 19 | import org.kuali.rice.kns.document.MaintenanceDocument; | |
| 20 | import org.kuali.rice.kns.rule.event.ApproveDocumentEvent; | |
| 21 | ||
| 22 | ||
| 23 | public interface MaintenanceDocumentRule { | |
| 24 | ||
| 25 | /** | |
| 26 | * | |
| 27 | * Runs all business rules needed prior to saving. This includes both common rules for all maintenance documents, plus | |
| 28 | * class-specific business rules. | |
| 29 | * | |
| 30 | * This method will only return false if it fails the isValidForSave() test. Otherwise, it will always return positive | |
| 31 | * regardless of the outcome of the business rules. However, any error messages resulting from the business rules will still be | |
| 32 | * populated, for display to the consumer of this service. | |
| 33 | * | |
| 34 | * @see org.kuali.rice.kns.rule.SaveDocumentRule#processSaveDocument(org.kuali.rice.kns.document.Document) | |
| 35 | * | |
| 36 | */ | |
| 37 | public abstract boolean processSaveDocument(Document document); | |
| 38 | ||
| 39 | /** | |
| 40 | * | |
| 41 | * Runs all business rules needed prior to routing. This includes both common rules for all maintenance documents, plus | |
| 42 | * class-specific business rules. | |
| 43 | * | |
| 44 | * This method will return false if any business rule fails, or if the document is in an invalid state, and not routable (see | |
| 45 | * isDocumentValidForRouting()). | |
| 46 | * | |
| 47 | * @see org.kuali.rice.kns.rule.RouteDocumentRule#processRouteDocument(org.kuali.rice.kns.document.Document) | |
| 48 | */ | |
| 49 | public abstract boolean processRouteDocument(Document document); | |
| 50 | ||
| 51 | /** | |
| 52 | * Runs all business rules needed prior to approving. This includes both common rules for all maintenance documents, plus | |
| 53 | * class-specific business rules. | |
| 54 | * | |
| 55 | * This method will return false if any business rule fails, or if the document is in an invalid state, and not approvable (see | |
| 56 | * isDocumentValidForApproving()). | |
| 57 | * | |
| 58 | * @see org.kuali.rice.kns.rule.ApproveDocumentRule#processApproveDocument(org.kuali.rice.kns.rule.event.ApproveDocumentEvent) | |
| 59 | */ | |
| 60 | public abstract boolean processApproveDocument(ApproveDocumentEvent approveEvent); | |
| 61 | ||
| 62 | /** | |
| 63 | * | |
| 64 | * This method sets the convenience objects like newAccount and oldAccount, so you have short and easy handles to the new and | |
| 65 | * old objects contained in the maintenance document. | |
| 66 | * | |
| 67 | * It also calls the BusinessObjectBase.refresh(), which will attempt to load all sub-objects from the DB by their primary keys, | |
| 68 | * if available. | |
| 69 | * | |
| 70 | * @param document - the maintenanceDocument being evaluated | |
| 71 | * | |
| 72 | */ | |
| 73 | public void setupBaseConvenienceObjects(MaintenanceDocument document); | |
| 74 | ||
| 75 | /** | |
| 76 | * | |
| 77 | * This method should always be overriden if a subclass is created. | |
| 78 | * | |
| 79 | * The goal for this is to cast the oldBo and newBo into the correct types of the subclass. | |
| 80 | * | |
| 81 | */ | |
| 82 | public void setupConvenienceObjects(); | |
| 83 | ||
| 84 | } |