View Javadoc
1   /**
2    * Copyright 2005-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.krms.builder;
17  
18  import org.kuali.rice.krms.dto.PropositionEditor;
19  import org.kuali.student.core.krms.dto.KSPropositionEditor;
20  import org.slf4j.Logger;
21  import org.slf4j.LoggerFactory;
22  
23  import java.util.HashMap;
24  import java.util.List;
25  import java.util.Map;
26  
27  /**
28   * @author Kuali Student Team
29   */
30  public class SimpleTextComponentBuilder implements ComponentBuilder<PropositionEditor>{
31  
32      private static final Logger LOG = LoggerFactory.getLogger(SimpleTextComponentBuilder.class);
33  
34      private static final String TEXT_KEY = "kuali.term.parameter.type.free.text";
35  
36      @Override
37      public void initialize(PropositionEditor propositionEditor) {
38  
39      }
40  
41      @Override
42      public List<String> getComponentIds() {
43          return null;
44      }
45  
46      @Override
47      public void resolveTermParameters(PropositionEditor propositionEditor, Map<String, String> termParameters) {
48          String text = termParameters.get(TEXT_KEY);
49          propositionEditor.setTermParameter(text);
50      }
51  
52      @Override
53      public Map<String, String> buildTermParameters(PropositionEditor propositionEditor) {
54          Map<String, String> termParameters = new HashMap<String, String>();
55          termParameters.put(TEXT_KEY, propositionEditor.getTermParameter());
56  
57          LOG.info("{}", termParameters);
58  
59          return termParameters;
60      }
61  
62      @Override
63      public void onSubmit(PropositionEditor propositionEditor) {
64          //To change body of implemented methods use File | Settings | File Templates.
65      }
66  
67      @Override
68      public void validate(PropositionEditor propositionEditor) {
69          //To change body of implemented methods use File | Settings | File Templates.
70      }
71  }