001    /*
002     * Copyright 2009 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.osedu.org/licenses/ECL-2.0
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     */
016    package org.kuali.student.contract.model;
017    
018    import java.util.ArrayList;
019    import java.util.List;
020    
021    /**
022     *
023     * @author nwright
024     */
025    public class OrchestrationObjectField {
026    
027        private OrchestrationObject parent;
028        private String name;
029        private String type;
030    
031        public enum FieldTypeCategory {
032    
033            PRIMITIVE,
034            MAPPED_STRING,
035            DYNAMIC_ATTRIBUTE,
036            COMPLEX,
037            COMPLEX_INLINE,
038            LIST_OF_PRIMITIVE,
039            LIST_OF_MAPPED_STRING,
040            LIST_OF_COMPLEX,
041            LIST_OF_COMPLEX_INLINE;
042        }
043    
044        public OrchestrationObject getParent() {
045            return parent;
046        }
047    
048        public void setParent(OrchestrationObject parent) {
049            this.parent = parent;
050        }
051    
052        public void setName(String name) {
053            this.name = name;
054        }
055    
056        public String getName() {
057            return name;
058        }
059    
060        public String getPropertyName() {
061            return name.substring(0, 1).toLowerCase() + name.substring(1);
062        }
063    
064        public String getProperName() {
065            return name.substring(0, 1).toUpperCase() + name.substring(1);
066        }
067    
068        public void setType(String type) {
069            this.type = type;
070        }
071    
072        public String getType() {
073            return type;
074        }
075        private FieldTypeCategory fieldTypeCategory;
076    
077        public FieldTypeCategory getFieldTypeCategory() {
078            return fieldTypeCategory;
079        }
080    
081        public void setFieldTypeCategory(
082                FieldTypeCategory fieldTypeCategory) {
083            this.fieldTypeCategory = fieldTypeCategory;
084        }
085        private OrchestrationObject inlineObject;
086    
087        public OrchestrationObject getInlineObject() {
088            return inlineObject;
089        }
090    
091        public void setInlineObject(OrchestrationObject inlineObject) {
092            this.inlineObject = inlineObject;
093        }
094        private List<TypeStateConstraint> constraints;
095    
096        public List<TypeStateConstraint> getConstraints() {
097            if (constraints == null) {
098                constraints = new ArrayList();
099            }
100            return constraints;
101        }
102    
103        public void setConstraints(List<TypeStateConstraint> constraints) {
104            this.constraints = constraints;
105        }
106        private String defaultValue;
107    
108        public String getDefaultValue() {
109            return defaultValue;
110        }
111    
112        public void setDefaultValue(String defaultValue) {
113            this.defaultValue = defaultValue;
114        }
115        private String defaultValuePath;
116    
117        public String getDefaultValuePath() {
118            return defaultValuePath;
119        }
120    
121        public void setDefaultValuePath(String defaultValuePath) {
122            this.defaultValuePath = defaultValuePath;
123        }
124    
125        public String getFullyQualifiedName() {
126            //TODO: Get grand parent
127            StringBuffer buf = new StringBuffer();
128            buf.append(getParent().getName());
129            buf.append(".");
130            buf.append(getProperName());
131            return buf.toString();
132        }
133    
134        public enum WriteAccess {
135    
136            ALWAYS, NEVER, ON_CREATE;
137        }
138        private WriteAccess writeAccess;
139    
140        public WriteAccess getWriteAccess() {
141            return writeAccess;
142        }
143    
144        public void setWriteAccess(WriteAccess writeAccess) {
145            this.writeAccess = writeAccess;
146        }
147        private String lookup;
148    
149        public String getLookup() {
150            return lookup;
151        }
152    
153        public void setLookup(String lookup) {
154            this.lookup = lookup;
155        }
156        private List<String> additionalLookups;
157    
158        public List<String> getAdditionalLookups() {
159            return additionalLookups;
160        }
161    
162        public void setAdditionalLookups(List<String> additionalLookups) {
163            this.additionalLookups = additionalLookups;
164        }
165        private String lookupContextPath;
166    
167        public String getLookupContextPath() {
168            return lookupContextPath;
169        }
170    
171        public void setLookupContextPath(String lookupContextPath) {
172            this.lookupContextPath = lookupContextPath;
173        }
174        private Integer maxRecursions;
175    
176        public Integer getMaxRecursions() {
177            return maxRecursions;
178        }
179    
180        public void setMaxRecursions(Integer maxRecursions) {
181            this.maxRecursions = maxRecursions;
182        }
183    }