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