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.dto;
17  
18  import org.kuali.rice.krms.api.repository.term.TermDefinitionContract;
19  import org.kuali.rice.krms.api.repository.term.TermParameterDefinitionContract;
20  import org.kuali.rice.krms.api.repository.term.TermSpecificationDefinition;
21  import org.kuali.rice.krms.api.repository.term.TermSpecificationDefinitionContract;
22  
23  import java.io.Serializable;
24  import java.util.ArrayList;
25  import java.util.List;
26  
27  /**
28   * @author Kuali Student Team
29   */
30  public class TermEditor implements TermDefinitionContract, Serializable {
31  
32      private String id;
33      private TermSpecificationDefinitionContract specification;
34      private String description;
35      private List<TermParameterEditor> parameters;
36      private Long versionNumber;
37  
38      public TermEditor(){
39          super();
40      }
41  
42      public TermEditor(TermDefinitionContract contract){
43          this.id = contract.getId();
44          //this.specification = contract.getSpecification();
45          this.description = contract.getDescription();
46          if(contract.getParameters() != null){
47              parameters = new ArrayList<TermParameterEditor>();
48              for (TermParameterDefinitionContract parameter : contract.getParameters()){
49                  parameters.add(new TermParameterEditor(parameter));
50              }
51          }
52          this.setSpecification(contract.getSpecification());
53          this.versionNumber = contract.getVersionNumber();
54      }
55  
56      public void setId(String id) {
57          this.id = id;
58      }
59  
60      public void setSpecification(TermSpecificationDefinitionContract specification) {
61          this.specification = specification;
62      }
63  
64      public void setDescription(String description) {
65          this.description = description;
66      }
67  
68      public void setParameters(List<TermParameterEditor> parameters) {
69          this.parameters = parameters;
70      }
71  
72      public void setVersionNumber(Long versionNumber) {
73          this.versionNumber = versionNumber;
74      }
75  
76      @Override
77      public TermSpecificationDefinitionContract getSpecification() {
78          return this.specification;
79      }
80  
81      @Override
82      public String getDescription() {
83          return this.description;
84      }
85  
86      @Override
87      public List<? extends TermParameterDefinitionContract> getParameters() {
88          return this.parameters;
89      }
90  
91      public List<TermParameterEditor> getEditorParameters() {
92          if (this.parameters == null){
93              this.parameters = new ArrayList<TermParameterEditor>();
94          }
95          return this.parameters;
96      }
97  
98      @Override
99      public String getId() {
100         return this.id;
101     }
102 
103     @Override
104     public Long getVersionNumber() {
105         return this.versionNumber;
106     }
107 }