01: /*
02: * Copyright 2006 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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.core.maintenance.rules;
17:
18: import org.kuali.core.document.Document;
19: import org.kuali.core.document.MaintenanceDocument;
20: import org.kuali.core.rule.event.ApproveDocumentEvent;
21:
22: public interface MaintenanceDocumentRule {
23:
24: /**
25: *
26: * Runs all business rules needed prior to saving. This includes both common rules for all maintenance documents, plus
27: * class-specific business rules.
28: *
29: * This method will only return false if it fails the isValidForSave() test. Otherwise, it will always return positive
30: * regardless of the outcome of the business rules. However, any error messages resulting from the business rules will still be
31: * populated, for display to the consumer of this service.
32: *
33: * @see org.kuali.core.rule.SaveDocumentRule#processSaveDocument(org.kuali.core.document.Document)
34: *
35: */
36: public abstract boolean processSaveDocument(Document document);
37:
38: /**
39: *
40: * Runs all business rules needed prior to routing. This includes both common rules for all maintenance documents, plus
41: * class-specific business rules.
42: *
43: * This method will return false if any business rule fails, or if the document is in an invalid state, and not routable (see
44: * isDocumentValidForRouting()).
45: *
46: * @see org.kuali.core.rule.RouteDocumentRule#processRouteDocument(org.kuali.core.document.Document)
47: */
48: public abstract boolean processRouteDocument(Document document);
49:
50: /**
51: * Runs all business rules needed prior to approving. This includes both common rules for all maintenance documents, plus
52: * class-specific business rules.
53: *
54: * This method will return false if any business rule fails, or if the document is in an invalid state, and not approvable (see
55: * isDocumentValidForApproving()).
56: *
57: * @see org.kuali.core.rule.ApproveDocumentRule#processApproveDocument(org.kuali.core.rule.event.ApproveDocumentEvent)
58: */
59: public abstract boolean processApproveDocument(
60: 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: }
|