001: /**********************************************************************************
002: * $URL:https://source.sakaiproject.org/svn/osp/trunk/reports/api/src/java/org/theospi/portfolio/reports/model/ReportDefinitionParam.java $
003: * $Id:ReportDefinitionParam.java 9134 2006-05-08 20:28:42Z chmaurer@iupui.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2005, 2006 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the "License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.theospi.portfolio.reports.model;
021:
022: import org.sakaiproject.metaobj.shared.model.Id;
023:
024: public class ReportDefinitionParam {
025: private String idString = null;
026:
027: /** the reportDefParamId for the report definition parameter */
028: private Id reportDefParamId;
029:
030: /** the identifier to the report definition for the paramater */
031: private ReportDefinition reportDefinition;
032:
033: /** the name of the param as presented to the user */
034: private String title;
035:
036: /** the parameter name of the report definition parameter */
037: private String paramName;
038:
039: /** the description for the report definition parameter */
040: private String description;
041:
042: /** the type for the report definition Parameter parameter
043: * This is defined as "int", "float", "String", "date"
044: */
045: private String type;
046:
047: public static final String TYPE_STRING = "string";
048: public static final String TYPE_INT = "int";
049: public static final String TYPE_FLOAT = "float";
050: public static final String TYPE_DATE = "date";
051:
052: /** the valueType for the report definition Parameter
053: * fillin, set, sql, static (multiset and multisql are to be supported later)
054: */
055: private String valueType;
056:
057: public static final String VALUE_TYPE_FILLIN = "fillin";
058: public static final String VALUE_TYPE_ONE_OF_SET = "set";
059: public static final String VALUE_TYPE_MULTI_OF_SET = "multiset";
060: public static final String VALUE_TYPE_ONE_OF_QUERY = "sql";
061: public static final String VALUE_TYPE_MULTI_OF_QUERY = "multisql";
062: public static final String VALUE_TYPE_STATIC = "static";
063:
064: /** the type for the report definition Parameter
065: * This is validation rules for fillin parameters,
066: * a set of strings for sets (both value and title),
067: * the query if the value type is a sql query,
068: * or the static value
069: */
070: private String value;
071:
072: /**
073: * the getter for the reportDefParamId property
074: * @return String the unique identifier
075: */
076: public Id getReportDefParamId() {
077: return reportDefParamId;
078: }
079:
080: /**
081: * the setter for the reportDefParamId property. This is set by the bean
082: * and by hibernate.
083: * @param reportDefId String
084: */
085: public void setReportDefParamId(Id reportDefParamId) {
086: this .reportDefParamId = reportDefParamId;
087: }
088:
089: /**
090: * return the id as a string. return the actual id if there is one then
091: * the configured definition id if not
092: * @return String
093: */
094: public String getIdString() {
095: if (reportDefParamId == null) {
096: if (idString == null)
097: generateIdString();
098: return idString;
099: }
100: return reportDefParamId.getValue();
101: }
102:
103: public void setIdString(String idString) {
104: this .idString = idString;
105: }
106:
107: protected void generateIdString() {
108: idString = String.valueOf(reportDefinition
109: .getReportDefinitionParams().indexOf(this ));
110: }
111:
112: /**
113: * the getter for the ReportDefinition property
114: * @return String the unique identifier
115: */
116: public ReportDefinition getReportDefinition() {
117: return reportDefinition;
118: }
119:
120: /**
121: * the setter for the ReportDefinition property. This is set by the bean
122: * and by hibernate.
123: * @param ReportDefinition String
124: */
125: public void setReportDefinition(ReportDefinition reportDefinition) {
126: this .reportDefinition = reportDefinition;
127: }
128:
129: /**
130: * the getter for the title property
131: * @return String the title
132: */
133: public String getTitle() {
134: return title;
135: }
136:
137: /**
138: * the setter for the title property. This is set by the bean
139: * and by hibernate.
140: * @param title String
141: */
142: public void setTitle(String title) {
143: this .title = title;
144: }
145:
146: /**
147: * the getter for the paramName property
148: * @return String the paramName
149: */
150: public String getParamName() {
151: return paramName;
152: }
153:
154: /**
155: * the setter for the paramName property. This is set by the bean
156: * and by hibernate.
157: * @param paramName String
158: */
159: public void setParamName(String paramName) {
160: this .paramName = paramName;
161: }
162:
163: /**
164: * the getter for the description property
165: * @return String the description
166: */
167: public String getDescription() {
168: return description;
169: }
170:
171: /**
172: * the setter for the description property. This is set by the bean
173: * and by hibernate.
174: * @param description String
175: */
176: public void setDescription(String description) {
177: this .description = description;
178: }
179:
180: /**
181: * the getter for the type property
182: * @return String the type
183: */
184: public String getType() {
185: return type;
186: }
187:
188: /**
189: * the setter for the type property. This is set by the bean
190: * and by hibernate.
191: * @param type String
192: */
193: public void setType(String type) {
194: this .type = type.trim();
195: }
196:
197: /**
198: * the getter for the valueType property
199: * @return String the valueType
200: */
201: public String getValueType() {
202: return valueType;
203: }
204:
205: /**
206: * the setter for the valueType property. This is set by the bean
207: * and by hibernate.
208: * @param valueType String
209: */
210: public void setValueType(String valueType) {
211: this .valueType = valueType.trim();
212: }
213:
214: /**
215: * the getter for the value property
216: * @return String the value
217: */
218: public String getValue() {
219: return value;
220: }
221:
222: /**
223: * the setter for the value property. This is set by the bean
224: * and by hibernate.
225: * @param value String
226: */
227: public void setValue(String value) {
228: this.value = value.trim();
229: }
230: }
|