Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
MaintenanceDocumentRule |
|
| 1.0;1 |
1 | /** | |
2 | * Copyright 2005-2011 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.krad.document.Document; | |
19 | import org.kuali.rice.kns.document.MaintenanceDocument; | |
20 | import org.kuali.rice.krad.rule.event.ApproveDocumentEvent; | |
21 | ||
22 | /** | |
23 | * Rule event interface for implementing business rules against a <code>MaintenanceDocument</code> | |
24 | * | |
25 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
26 | */ | |
27 | public interface MaintenanceDocumentRule { | |
28 | ||
29 | /** | |
30 | * Runs all business rules needed prior to saving. This includes both common rules for all maintenance documents, | |
31 | * plus class-specific business rules. | |
32 | * | |
33 | * Will only return false if it fails the isValidForSave() test. Otherwise, it will always return positive | |
34 | * regardless of the outcome of the business rules. However, any error messages resulting from the business rules | |
35 | * will still be populated, for display to the consumer of this service. | |
36 | * | |
37 | * @see org.kuali.rice.krad.rule.SaveDocumentRule#processSaveDocument(org.kuali.rice.krad.document.Document) | |
38 | */ | |
39 | public abstract boolean processSaveDocument(Document document); | |
40 | ||
41 | /** | |
42 | * Runs all business rules needed prior to routing. This includes both common rules for all maintenance documents, | |
43 | * plus class-specific business rules. | |
44 | * | |
45 | * Will return false if any business rule fails, or if the document is in an invalid state, and not routable (see | |
46 | * isDocumentValidForRouting()). | |
47 | * | |
48 | * @see org.kuali.rice.krad.rule.RouteDocumentRule#processRouteDocument(org.kuali.rice.krad.document.Document) | |
49 | */ | |
50 | public abstract boolean processRouteDocument(Document document); | |
51 | ||
52 | /** | |
53 | * Runs all business rules needed prior to approving. This includes both common rules for all maintenance documents, | |
54 | * plus class-specific business rules. | |
55 | * | |
56 | * Will return false if any business rule fails, or if the document is in an invalid state, and not approvable (see | |
57 | * isDocumentValidForApproving()). | |
58 | * | |
59 | * @see org.kuali.rice.krad.rule.ApproveDocumentRule#processApproveDocument(org.kuali.rice.krad.rule.event.ApproveDocumentEvent) | |
60 | */ | |
61 | public abstract boolean processApproveDocument(ApproveDocumentEvent approveEvent); | |
62 | ||
63 | /** | |
64 | * 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 | |
68 | * primary keys, if available. | |
69 | * | |
70 | * @param document - the maintenanceDocument being evaluated | |
71 | */ | |
72 | public void setupBaseConvenienceObjects(MaintenanceDocument document); | |
73 | ||
74 | /** | |
75 | * Should always be overriden if a subclass is created. | |
76 | * | |
77 | * The goal for this is to cast the oldBo and newBo into the correct types of the subclass. | |
78 | */ | |
79 | public void setupConvenienceObjects(); | |
80 | } |