001/**
002 * Copyright 2005-2014 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 */
016/*
017 * To change this template, choose Tools | Templates
018 * and open the template in the editor.
019 */
020package org.kuali.rice.krms.impl.repository.mock;
021
022import org.kuali.rice.krms.api.repository.RuleManagementService;
023import org.kuali.rice.krms.api.repository.context.ContextDefinition;
024
025/**
026 *
027 * @author nwright
028 */
029public class KrmsContextLoader {
030
031    private RuleManagementService ruleManagementService = null;
032
033    public RuleManagementService getRuleManagementService() {
034        return ruleManagementService;
035    }
036
037    public void setRuleManagementService(RuleManagementService ruleManagementService) {
038        this.ruleManagementService = ruleManagementService;
039    }
040    
041    public void loadContext(String id, String namespace, String name, String typeId, String description) {
042//        CNTXT_ID      NMSPC_CD        NM      TYP_ID  ???? What kind of type  ACTV    VER_NBR DESC_TXT
043        ContextDefinition.Builder bldr = ContextDefinition.Builder.create(namespace, name);
044        bldr.setId(id);
045        bldr.setActive(true);
046        bldr.setTypeId(typeId);
047        bldr.setDescription(description);
048        this.getRuleManagementService().createContext(bldr.build());
049    }
050
051    public void load() {
052        loadContext("10000", "KS-SYS", "Course Requirements", "T1004", "Course Requirements");
053        loadContext("10001", "KS-SYS", "Program Requirements", "T1004", "Program Requirements");
054    }
055
056}