View Javadoc

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.ArrayList;
8   import java.util.List;
9   import org.kuali.rice.core.api.exception.RiceIllegalArgumentException;
10  import org.kuali.rice.core.api.exception.RiceIllegalStateException;
11  import org.kuali.rice.krms.api.repository.RuleManagementService;
12  import org.kuali.rice.krms.api.repository.reference.ReferenceObjectBinding;
13  
14  /**
15   * Mock impl just so I can plug this logic into the course rollover logic.
16   * @author nwright
17   */
18  public class KrmsRuleManagementCopyMethodsMockImpl implements KrmsRuleManagementCopyMethods {
19  
20      private RuleManagementService ruleManagementService;
21      
22      @Override
23      public List<ReferenceObjectBinding> deepCopyReferenceObjectBindingsFromTo(String fromReferenceDiscriminatorType,
24              String fromReferenceObjectId,
25              String toReferenceDiscriminatorType,
26              String toReferenceObjectId,
27              List<String> optionKeys)
28              throws RiceIllegalArgumentException,
29              RiceIllegalStateException {
30          _checkEmptyParam(fromReferenceDiscriminatorType, "fromReferenceDiscriminatorType");
31          _checkEmptyParam(fromReferenceObjectId, "fromReferenceObjectId");
32          _checkEmptyParam(toReferenceDiscriminatorType, "toReferenceDiscriminatorType");
33          _checkEmptyParam(toReferenceObjectId, "toReferenceObjectId");
34          List<ReferenceObjectBinding> list = new ArrayList<ReferenceObjectBinding>();
35          System.out.println("KrmsRuleManagementCopyMethodsMockImpl.deepCopyReferenceObjectBindingsFromTo () implementation does not really do any copying");
36          return list;
37      }
38  
39      @Override
40      public int deleteReferenceObjectBindingsCascade(String referenceDiscriminatorType, 
41      String referenceObjectId) 
42              throws RiceIllegalArgumentException, RiceIllegalStateException {
43          _checkEmptyParam(referenceDiscriminatorType, "referenceDiscriminatorType");
44          _checkEmptyParam(referenceObjectId, "referenceObjectId");
45          System.out.println("KrmsRuleManagementCopyMethodsMockImpl.deleteReferenceObjectBindingsCascade implementation does not really do any copying");
46          return 0;
47      }
48      
49      
50  
51      private void _checkEmptyParam(String param, String message)
52              throws RiceIllegalArgumentException {
53          if (param == null) {
54              throw new RiceIllegalArgumentException(message);
55          }
56          if (param.trim().isEmpty()) {
57              throw new RiceIllegalArgumentException(message);
58          }
59      }
60  
61      public RuleManagementService getRuleManagementService() {
62          return ruleManagementService;
63      }
64  
65      public void setRuleManagementService(RuleManagementService ruleManagementService) {
66          this.ruleManagementService = ruleManagementService;
67      }   
68      
69  }