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.ArrayList; 008import java.util.List; 009import org.kuali.rice.core.api.exception.RiceIllegalArgumentException; 010import org.kuali.rice.core.api.exception.RiceIllegalStateException; 011import org.kuali.rice.krms.api.repository.RuleManagementService; 012import org.kuali.rice.krms.api.repository.reference.ReferenceObjectBinding; 013 014/** 015 * Mock impl just so I can plug this logic into the course rollover logic. 016 * @author nwright 017 */ 018public class KrmsRuleManagementCopyMethodsMockImpl implements KrmsRuleManagementCopyMethods { 019 020 private RuleManagementService ruleManagementService; 021 022 @Override 023 public List<ReferenceObjectBinding> deepCopyReferenceObjectBindingsFromTo(String fromReferenceDiscriminatorType, 024 String fromReferenceObjectId, 025 String toReferenceDiscriminatorType, 026 String toReferenceObjectId, 027 List<String> optionKeys) 028 throws RiceIllegalArgumentException, 029 RiceIllegalStateException { 030 _checkEmptyParam(fromReferenceDiscriminatorType, "fromReferenceDiscriminatorType"); 031 _checkEmptyParam(fromReferenceObjectId, "fromReferenceObjectId"); 032 _checkEmptyParam(toReferenceDiscriminatorType, "toReferenceDiscriminatorType"); 033 _checkEmptyParam(toReferenceObjectId, "toReferenceObjectId"); 034 List<ReferenceObjectBinding> list = new ArrayList<ReferenceObjectBinding>(); 035 System.out.println("KrmsRuleManagementCopyMethodsMockImpl.deepCopyReferenceObjectBindingsFromTo () implementation does not really do any copying"); 036 return list; 037 } 038 039 @Override 040 public int deleteReferenceObjectBindingsCascade(String referenceDiscriminatorType, 041 String referenceObjectId) 042 throws RiceIllegalArgumentException, RiceIllegalStateException { 043 _checkEmptyParam(referenceDiscriminatorType, "referenceDiscriminatorType"); 044 _checkEmptyParam(referenceObjectId, "referenceObjectId"); 045 System.out.println("KrmsRuleManagementCopyMethodsMockImpl.deleteReferenceObjectBindingsCascade implementation does not really do any copying"); 046 return 0; 047 } 048 049 050 051 private void _checkEmptyParam(String param, String message) 052 throws RiceIllegalArgumentException { 053 if (param == null) { 054 throw new RiceIllegalArgumentException(message); 055 } 056 if (param.trim().isEmpty()) { 057 throw new RiceIllegalArgumentException(message); 058 } 059 } 060 061 public RuleManagementService getRuleManagementService() { 062 return ruleManagementService; 063 } 064 065 public void setRuleManagementService(RuleManagementService ruleManagementService) { 066 this.ruleManagementService = ruleManagementService; 067 } 068 069}