001/*
002 * To change this template, choose Tools | Templates
003 * and open the template in the editor.
004 */
005package org.kuali.rice.krms.impl.util;
006
007import java.util.List;
008import org.kuali.rice.core.api.exception.RiceIllegalArgumentException;
009import org.kuali.rice.core.api.exception.RiceIllegalStateException;
010import org.kuali.rice.krms.api.repository.reference.ReferenceObjectBinding;
011import org.kuali.student.r2.common.exceptions.*;
012
013/**
014 * These are the copy methods to be used to copy rules from one object to another.
015 * 
016 * For now this will just be a simple interface for a hunk of code that does the copying.
017 * Later we will evaluate if we can/should push this into the KRMS rules service proper.
018 * 
019 * Note: This file refers to multiple methods but there is just one right now.
020 * We will see as we move through the use cases if this single method is fine grained enough
021 * to copy the rules we need to copy and just those rules.
022 * 
023 * @author nwright
024 */
025public interface KrmsRuleManagementCopyMethods {
026
027    /**
028     * Does a deep copy of all the bindings and rules associated with those 
029     * bindings.
030     * 
031     * This is expected to be used in the following use cases:
032     * (1) Copy rules from Canonical course to course offering
033     * (2) Rollover rules from previous course offering to newly rolled over course offering
034     * (3) Copy rules down from course offering to activity offering so they can be overridden at the activity offering level
035     * 
036     * @param fromReferenceDiscriminatorType the ref object uri of the existing reference object
037     * @param fromReferenceObjectId the id of the reference object
038     * @param toReferenceDiscriminatorType the simple class name of the new reference object
039     * @param toReferenceObjectId the id of the reference object
040     * @param optionKeys configuration defined keys that control details of the copying
041     * @return the list of newly created reference object bindings
042     * @throws RiceIllegalArgumentException if any of the parameters are null or invalid
043     * @throws RiceIllegalStateException if they copy run into a data condition that it cannot handle
044     */
045    public List<ReferenceObjectBinding> deepCopyReferenceObjectBindingsFromTo(String fromReferenceDiscriminatorType,
046            String fromReferenceObjectId,
047            String toReferenceDiscriminatorType,
048            String toReferenceObjectId,
049            List<String> optionKeys)
050            throws RiceIllegalArgumentException, RiceIllegalStateException, PermissionDeniedException, MissingParameterException, InvalidParameterException, OperationFailedException;
051    
052    /**
053     * Delete the rules associated with the specified reference object.  This deletes the binding and 
054     * cascades to agendas, rules, propositions and terms as needed.
055     * 
056     * @param referenceDiscriminatorType the ref object uri of the reference object who's rules are to be deleted
057     * @param referenceObjectId the id of the reference object
058     * @return the number of reference object bindings that were deleted
059     * @throws RiceIllegalArgumentException if any of the parameters are null or invalid
060     * @throws RiceIllegalStateException  if the delete runs into a data condition that it cannot handle
061     */
062    public int deleteReferenceObjectBindingsCascade (String referenceDiscriminatorType,
063            String referenceObjectId) 
064            throws RiceIllegalArgumentException, RiceIllegalStateException;
065}