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.dto; 017 018import org.kuali.rice.krms.api.repository.term.TermDefinitionContract; 019import org.kuali.rice.krms.api.repository.term.TermParameterDefinitionContract; 020import org.kuali.rice.krms.api.repository.term.TermSpecificationDefinition; 021import org.kuali.rice.krms.api.repository.term.TermSpecificationDefinitionContract; 022 023import java.io.Serializable; 024import java.util.ArrayList; 025import java.util.List; 026 027/** 028 * @author Kuali Student Team 029 */ 030public class TermEditor implements TermDefinitionContract, Serializable { 031 032 private String id; 033 private TermSpecificationDefinitionContract specification; 034 private String description; 035 private List<TermParameterEditor> parameters; 036 private Long versionNumber; 037 038 public TermEditor(){ 039 super(); 040 } 041 042 public TermEditor(TermDefinitionContract contract){ 043 this.id = contract.getId(); 044 //this.specification = contract.getSpecification(); 045 this.description = contract.getDescription(); 046 if(contract.getParameters() != null){ 047 parameters = new ArrayList<TermParameterEditor>(); 048 for (TermParameterDefinitionContract parameter : contract.getParameters()){ 049 parameters.add(new TermParameterEditor(parameter)); 050 } 051 } 052 this.setSpecification(contract.getSpecification()); 053 this.versionNumber = contract.getVersionNumber(); 054 } 055 056 public void setId(String id) { 057 this.id = id; 058 } 059 060 public void setSpecification(TermSpecificationDefinitionContract specification) { 061 this.specification = specification; 062 } 063 064 public void setDescription(String description) { 065 this.description = description; 066 } 067 068 public void setParameters(List<TermParameterEditor> parameters) { 069 this.parameters = parameters; 070 } 071 072 public void setVersionNumber(Long versionNumber) { 073 this.versionNumber = versionNumber; 074 } 075 076 @Override 077 public TermSpecificationDefinitionContract getSpecification() { 078 return this.specification; 079 } 080 081 @Override 082 public String getDescription() { 083 return this.description; 084 } 085 086 @Override 087 public List<? extends TermParameterDefinitionContract> getParameters() { 088 return this.parameters; 089 } 090 091 public List<TermParameterEditor> getEditorParameters() { 092 if (this.parameters == null){ 093 this.parameters = new ArrayList<TermParameterEditor>(); 094 } 095 return this.parameters; 096 } 097 098 @Override 099 public String getId() { 100 return this.id; 101 } 102 103 @Override 104 public Long getVersionNumber() { 105 return this.versionNumber; 106 } 107}