001    package org.kuali.rice.krms.dto;
002    
003    import org.kuali.rice.krms.api.repository.term.TermDefinitionContract;
004    import org.kuali.rice.krms.api.repository.term.TermParameterDefinitionContract;
005    import org.kuali.rice.krms.api.repository.term.TermSpecificationDefinition;
006    import org.kuali.rice.krms.api.repository.term.TermSpecificationDefinitionContract;
007    
008    import java.io.Serializable;
009    import java.util.ArrayList;
010    import java.util.List;
011    
012    /**
013     * Created with IntelliJ IDEA.
014     * User: SW
015     * Date: 2013/03/05
016     * Time: 5:16 PM
017     * To change this template use File | Settings | File Templates.
018     */
019    public class TermEditor implements TermDefinitionContract, Serializable {
020    
021        private String id;
022        private TermSpecificationDefinitionContract specification;
023        private String description;
024        private List<TermParameterEditor> parameters;
025        private Long versionNumber;
026    
027        public TermEditor(){
028            super();
029        }
030    
031        public TermEditor(TermDefinitionContract contract){
032            this.id = contract.getId();
033            //this.specification = contract.getSpecification();
034            this.description = contract.getDescription();
035            if(contract.getParameters() != null){
036                parameters = new ArrayList<TermParameterEditor>();
037                for (TermParameterDefinitionContract parameter : contract.getParameters()){
038                    parameters.add(new TermParameterEditor(parameter));
039                }
040            }
041            this.setSpecification(contract.getSpecification());
042            this.versionNumber = contract.getVersionNumber();
043        }
044    
045        public void setId(String id) {
046            this.id = id;
047        }
048    
049        public void setSpecification(TermSpecificationDefinitionContract specification) {
050            this.specification = specification;
051        }
052    
053        public void setDescription(String description) {
054            this.description = description;
055        }
056    
057        public void setParameters(List<TermParameterEditor> parameters) {
058            this.parameters = parameters;
059        }
060    
061        public void setVersionNumber(Long versionNumber) {
062            this.versionNumber = versionNumber;
063        }
064    
065        @Override
066        public TermSpecificationDefinitionContract getSpecification() {
067            return this.specification;
068        }
069    
070        @Override
071        public String getDescription() {
072            return this.description;
073        }
074    
075        @Override
076        public List<? extends TermParameterDefinitionContract> getParameters() {
077            return this.parameters;
078        }
079    
080        public List<TermParameterEditor> getEditorParameters() {
081            return this.parameters;
082        }
083    
084        @Override
085        public String getId() {
086            return this.id;
087        }
088    
089        @Override
090        public Long getVersionNumber() {
091            return this.versionNumber;
092        }
093    }