001/**
002 * Copyright 2005-2018 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.kns.rules;
017
018import org.kuali.rice.krad.document.Document;
019import org.kuali.rice.kns.document.MaintenanceDocument;
020import org.kuali.rice.krad.rules.rule.event.ApproveDocumentEvent;
021
022/**
023 * Rule event interface for implementing business rules against a <code>MaintenanceDocument</code>
024 *
025 * @author Kuali Rice Team (rice.collab@kuali.org)
026 *
027 * @deprecated Use {@link org.kuali.rice.krad.rules.MaintenanceDocumentRule}.
028 */
029@Deprecated
030public interface MaintenanceDocumentRule {
031
032    /**
033     * Runs all business rules needed prior to saving. This includes both common rules for all maintenance documents,
034     * plus class-specific business rules.
035     *
036     * Will only return false if it fails the isValidForSave() test. Otherwise, it will always return positive
037     * regardless of the outcome of the business rules. However, any error messages resulting from the business rules
038     * will still be populated, for display to the consumer of this service.
039     *
040     * @see org.kuali.rice.krad.rules.rule.SaveDocumentRule#processSaveDocument(org.kuali.rice.krad.document.Document)
041     */
042    public abstract boolean processSaveDocument(Document document);
043
044    /**
045     * Runs all business rules needed prior to routing. This includes both common rules for all maintenance documents,
046     * plus class-specific business rules.
047     *
048     * Will return false if any business rule fails, or if the document is in an invalid state, and not routable (see
049     * isDocumentValidForRouting()).
050     *
051     * @see org.kuali.rice.krad.rules.rule.RouteDocumentRule#processRouteDocument(org.kuali.rice.krad.document.Document)
052     */
053    public abstract boolean processRouteDocument(Document document);
054
055    /**
056     * Runs all business rules needed prior to approving. This includes both common rules for all maintenance documents,
057     * plus class-specific business rules.
058     *
059     * Will return false if any business rule fails, or if the document is in an invalid state, and not approvable (see
060     * isDocumentValidForApproving()).
061     *
062     * @see org.kuali.rice.krad.rules.rule.ApproveDocumentRule#processApproveDocument(org.kuali.rice.krad.rules.rule.event.ApproveDocumentEvent)
063     */
064    public abstract boolean processApproveDocument(ApproveDocumentEvent approveEvent);
065
066    /**
067     * Sets the convenience objects like newAccount and oldAccount, so you have short and easy handles to the new and
068     * old objects contained in the maintenance document.
069     *
070     * It also calls the BusinessObjectBase.refresh(), which will attempt to load all sub-objects from the DB by their
071     * primary keys, if available.
072     *
073     * @param document - the maintenanceDocument being evaluated
074     */
075    public void setupBaseConvenienceObjects(MaintenanceDocument document);
076
077    /**
078     * Should always be overriden if a subclass is created.
079     *
080     * The goal for this is to cast the oldBo and newBo into the correct types of the subclass.
081     */
082    public void setupConvenienceObjects();
083}