001/**
002 * Copyright 2005-2013 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 */
016package org.kuali.rice.krms.builder;
017
018import org.kuali.rice.krms.dto.PropositionEditor;
019import org.kuali.student.core.krms.dto.KSPropositionEditor;
020import org.slf4j.Logger;
021import org.slf4j.LoggerFactory;
022
023import java.util.HashMap;
024import java.util.List;
025import java.util.Map;
026
027/**
028 * @author Kuali Student Team
029 */
030public class SimpleTextComponentBuilder implements ComponentBuilder<PropositionEditor>{
031
032    private static final Logger LOG = LoggerFactory.getLogger(SimpleTextComponentBuilder.class);
033
034    private static final String TEXT_KEY = "kuali.term.parameter.type.free.text";
035
036    @Override
037    public void initialize(PropositionEditor propositionEditor) {
038
039    }
040
041    @Override
042    public List<String> getComponentIds() {
043        return null;
044    }
045
046    @Override
047    public void resolveTermParameters(PropositionEditor propositionEditor, Map<String, String> termParameters) {
048        String text = termParameters.get(TEXT_KEY);
049        propositionEditor.setTermParameter(text);
050    }
051
052    @Override
053    public Map<String, String> buildTermParameters(PropositionEditor propositionEditor) {
054        Map<String, String> termParameters = new HashMap<String, String>();
055        termParameters.put(TEXT_KEY, propositionEditor.getTermParameter());
056
057        LOG.info("{}", termParameters);
058
059        return termParameters;
060    }
061
062    @Override
063    public void onSubmit(PropositionEditor propositionEditor) {
064        //To change body of implemented methods use File | Settings | File Templates.
065    }
066
067    @Override
068    public void validate(PropositionEditor propositionEditor) {
069        //To change body of implemented methods use File | Settings | File Templates.
070    }
071}