1 /*
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
4 */
5 package org.kuali.rice.krms.impl.util;
6
7 import java.util.List;
8 import org.kuali.rice.core.api.exception.RiceIllegalArgumentException;
9 import org.kuali.rice.core.api.exception.RiceIllegalStateException;
10 import org.kuali.rice.krms.api.repository.reference.ReferenceObjectBinding;
11 import org.kuali.student.r2.common.exceptions.*;
12
13 /**
14 * These are the copy methods to be used to copy rules from one object to another.
15 *
16 * For now this will just be a simple interface for a hunk of code that does the copying.
17 * Later we will evaluate if we can/should push this into the KRMS rules service proper.
18 *
19 * Note: This file refers to multiple methods but there is just one right now.
20 * We will see as we move through the use cases if this single method is fine grained enough
21 * to copy the rules we need to copy and just those rules.
22 *
23 * @author nwright
24 */
25 public interface KrmsRuleManagementCopyMethods {
26
27 /**
28 * Does a deep copy of all the bindings and rules associated with those
29 * bindings.
30 *
31 * This is expected to be used in the following use cases:
32 * (1) Copy rules from Canonical course to course offering
33 * (2) Rollover rules from previous course offering to newly rolled over course offering
34 * (3) Copy rules down from course offering to activity offering so they can be overridden at the activity offering level
35 *
36 * @param fromReferenceDiscriminatorType the ref object uri of the existing reference object
37 * @param fromReferenceObjectId the id of the reference object
38 * @param toReferenceDiscriminatorType the simple class name of the new reference object
39 * @param toReferenceObjectId the id of the reference object
40 * @param optionKeys configuration defined keys that control details of the copying
41 * @return the list of newly created reference object bindings
42 * @throws RiceIllegalArgumentException if any of the parameters are null or invalid
43 * @throws RiceIllegalStateException if they copy run into a data condition that it cannot handle
44 */
45 public List<ReferenceObjectBinding> deepCopyReferenceObjectBindingsFromTo(String fromReferenceDiscriminatorType,
46 String fromReferenceObjectId,
47 String toReferenceDiscriminatorType,
48 String toReferenceObjectId,
49 List<String> optionKeys)
50 throws RiceIllegalArgumentException, RiceIllegalStateException, PermissionDeniedException, MissingParameterException, InvalidParameterException, OperationFailedException;
51
52 /**
53 * Delete the rules associated with the specified reference object. This deletes the binding and
54 * cascades to agendas, rules, propositions and terms as needed.
55 *
56 * @param referenceDiscriminatorType the ref object uri of the reference object who's rules are to be deleted
57 * @param referenceObjectId the id of the reference object
58 * @return the number of reference object bindings that were deleted
59 * @throws RiceIllegalArgumentException if any of the parameters are null or invalid
60 * @throws RiceIllegalStateException if the delete runs into a data condition that it cannot handle
61 */
62 public int deleteReferenceObjectBindingsCascade (String referenceDiscriminatorType,
63 String referenceObjectId)
64 throws RiceIllegalArgumentException, RiceIllegalStateException;
65 }