1 21 package com.jaspersoft.jasperserver.war.dto; 22 23 import java.util.LinkedHashMap ; 24 import java.util.List ; 25 import java.util.Map ; 26 27 import com.jaspersoft.jasperserver.api.metadata.common.domain.DataType; 28 import com.jaspersoft.jasperserver.api.metadata.common.domain.InputControl; 29 import com.jaspersoft.jasperserver.api.metadata.common.domain.ResourceReference; 30 import com.jaspersoft.jasperserver.war.common.JasperServerConstImpl; 31 32 36 public class InputControlWrapper extends BaseDTO 37 { 38 39 public static final String TYPE_DESCRIPTION_BOOLEAN = "input.control.type.boolean"; 40 public static final String TYPE_DESCRIPTION_SINGLE_VALUE = "input.control.type.single.value"; 41 public static final String TYPE_DESCRIPTION_SINGLE_SELECT_LOV = "input.control.type.single.select.lov"; 42 public static final String TYPE_DESCRIPTION_SINGLE_SELECT_LOV_RADIO = "input.control.type.single.select.lov.radio"; 43 public static final String TYPE_DESCRIPTION_SINGLE_SELECT_QUERY = "input.control.type.single.select.query"; 44 public static final String TYPE_DESCRIPTION_SINGLE_SELECT_QUERY_RADIO = "input.control.type.single.select.query.radio"; 45 public static final String TYPE_DESCRIPTION_MULTI_VALUE = "input.control.type.multi.value"; 46 public static final String TYPE_DESCRIPTION_MULTI_SELECT_LOV = "input.control.type.multi.select.lov"; 47 public static final String TYPE_DESCRIPTION_MULTI_SELECT_LOV_CHECKBOX = "input.control.type.multi.select.lov.checkbox"; 48 public static final String TYPE_DESCRIPTION_MULTI_SELECT_QUERY = "input.control.type.multi.select.query"; 49 public static final String TYPE_DESCRIPTION_MULTI_SELECT_QUERY_CHECKBOX = "input.control.type.multi.select.query.checkbox"; 50 51 52 private InputControl inputControl; 53 private ResourceReference inputControlURI; private String oldInputControlURI; 55 private String source; 56 private List existingPathList; 57 private String existingPath; 58 private String listItemLabel; 59 private String listItemValue; 60 private String [] itemsToDelete; 61 private static Map supportedControlTypes; 62 private static Map supportedDataTypes; 63 private String visibleColumns; 64 private String dtMaxLength; 65 private String dtDecimals; 66 private boolean located; 67 private boolean suggested; 68 private Object parentFlowObject; 69 private String newVisibleColumn; 70 private List allResources; 71 72 public List getAllResources() { 73 return allResources; 74 } 75 76 public void setAllResources(List allResources) { 77 this.allResources = allResources; 78 } 79 80 public Object getParentFlowObject() { 81 return parentFlowObject; 82 } 83 84 public void setParentFlowObject(Object parentFlowObject) { 85 this.parentFlowObject = parentFlowObject; 86 } 87 88 public boolean isLocated() { 89 return located; 90 } 91 92 public void setLocated(boolean located) { 93 this.located = located; 94 } 95 96 public boolean isSuggested() { 97 return suggested; 98 } 99 100 public void setSuggested(boolean suggested) { 101 this.suggested = suggested; 102 } 103 104 public InputControlWrapper(){ 105 } 106 107 public InputControlWrapper(InputControl inputControl) 108 { 109 this.inputControl = inputControl; 110 } 111 112 public Map getSupportedControlTypes(){ 113 if(supportedControlTypes==null){ 114 supportedControlTypes=new LinkedHashMap (); 115 supportedControlTypes.put(String.valueOf(InputControl.TYPE_BOOLEAN), TYPE_DESCRIPTION_BOOLEAN); 116 supportedControlTypes.put(String.valueOf(InputControl.TYPE_SINGLE_VALUE), TYPE_DESCRIPTION_SINGLE_VALUE); 117 supportedControlTypes.put(String.valueOf(InputControl.TYPE_SINGLE_SELECT_LIST_OF_VALUES), TYPE_DESCRIPTION_SINGLE_SELECT_LOV); 119 supportedControlTypes.put(String.valueOf(InputControl.TYPE_SINGLE_SELECT_LIST_OF_VALUES_RADIO), TYPE_DESCRIPTION_SINGLE_SELECT_LOV_RADIO); 120 supportedControlTypes.put(String.valueOf(InputControl.TYPE_MULTI_SELECT_LIST_OF_VALUES), TYPE_DESCRIPTION_MULTI_SELECT_LOV); 121 supportedControlTypes.put(String.valueOf(InputControl.TYPE_MULTI_SELECT_LIST_OF_VALUES_CHECKBOX), TYPE_DESCRIPTION_MULTI_SELECT_LOV_CHECKBOX); 122 supportedControlTypes.put(String.valueOf(InputControl.TYPE_SINGLE_SELECT_QUERY), TYPE_DESCRIPTION_SINGLE_SELECT_QUERY); 123 supportedControlTypes.put(String.valueOf(InputControl.TYPE_SINGLE_SELECT_QUERY_RADIO), TYPE_DESCRIPTION_SINGLE_SELECT_QUERY_RADIO); 124 supportedControlTypes.put(String.valueOf(InputControl.TYPE_MULTI_SELECT_QUERY), TYPE_DESCRIPTION_MULTI_SELECT_QUERY); 125 supportedControlTypes.put(String.valueOf(InputControl.TYPE_MULTI_SELECT_QUERY_CHECKBOX), TYPE_DESCRIPTION_MULTI_SELECT_QUERY_CHECKBOX); 126 } 127 return supportedControlTypes; 128 } 129 130 public Map getSupportedDataTypes(){ 131 if(supportedDataTypes==null){ 132 supportedDataTypes=new LinkedHashMap (); 133 supportedDataTypes.put(String.valueOf(DataType.TYPE_TEXT),JasperServerConstImpl.getTypeText()); 134 supportedDataTypes.put(String.valueOf(DataType.TYPE_NUMBER),JasperServerConstImpl.getTypeNumber()); 135 supportedDataTypes.put(String.valueOf(DataType.TYPE_DATE),JasperServerConstImpl.getTypeDate()); 136 supportedDataTypes.put(String.valueOf(DataType.TYPE_DATE_TIME),JasperServerConstImpl.getTypeDateTime()); 137 } 138 return supportedDataTypes; 139 } 140 141 public InputControl getInputControl() 142 { 143 return inputControl; 144 } 145 146 public void setInputControl(InputControl inputControl) 147 { 148 this.inputControl = inputControl; 149 } 150 151 public String getSource() 152 { 153 return source; 154 } 155 156 public void setSource(String source) 157 { 158 this.source = source; 159 } 160 161 public List getExistingPathList() 162 { 163 return existingPathList; 164 } 165 166 public void setExistingPathList(List existingPathList) 167 { 168 this.existingPathList = existingPathList; 169 } 170 171 public String getExistingPath() 172 { 173 return existingPath; 174 } 175 176 public void setExistingPath(String existingPath) 177 { 178 this.existingPath = existingPath; 179 } 180 181 public String getListItemLabel() 182 { 183 return listItemLabel; 184 } 185 186 public void setListItemLabel(String listItemLabel) 187 { 188 this.listItemLabel = listItemLabel; 189 } 190 191 public String getListItemValue() 192 { 193 return listItemValue; 194 } 195 196 public void setListItemValue(String listItemValue) 197 { 198 this.listItemValue = listItemValue; 199 } 200 201 public String [] getItemsToDelete() 202 { 203 return itemsToDelete; 204 } 205 206 public void setItemsToDelete(String [] itemsToDelete) 207 { 208 this.itemsToDelete = itemsToDelete; 209 } 210 211 public String getVisibleColumns() 212 { 213 return visibleColumns; 214 } 215 216 public void setVisibleColumns(String visibleColumns) 217 { 218 this.visibleColumns = visibleColumns; 219 } 220 221 public String getDtDecimals() 222 { 223 return dtDecimals; 224 } 225 226 public void setDtDecimals(String dtDecimals) 227 { 228 this.dtDecimals = dtDecimals; 229 int decimals=0; 230 try { 231 decimals = Integer.parseInt(dtMaxLength); 232 } catch (NumberFormatException e) { 233 } 235 ((DataType) inputControl.getDataType().getLocalResource()).setDecimals(new Integer (decimals)); 236 } 237 238 public String getDtMaxLength() 239 { 240 return dtMaxLength; 241 } 242 243 public void setDtMaxLength(String dtMaxLength) 244 { 245 this.dtMaxLength = dtMaxLength; 246 int maxLength=0; 247 try { 248 maxLength = Integer.parseInt(dtMaxLength); 249 } catch (NumberFormatException e) { 250 } 252 ((DataType) inputControl.getDataType().getLocalResource()).setMaxLength(new Integer (maxLength)); 253 } 254 255 public boolean isLovType(){ 256 return isMultiSelectLovType() || isSingleSelectLovType(); 257 } 258 public boolean isQueryType(){ 259 return isSingleSelectQueryType() || isMultiSelectQueryType(); 260 } 261 public boolean isDataType(){ 262 return isSingleValueType() || isMultiValueType(); 263 } 264 public boolean isBooleanType(){ 265 return InputControl.TYPE_BOOLEAN==inputControl.getType(); 266 } 267 public boolean isMultiSelectLovType(){ 268 return InputControl.TYPE_MULTI_SELECT_LIST_OF_VALUES==inputControl.getType() 269 || inputControl.getType() == InputControl.TYPE_MULTI_SELECT_LIST_OF_VALUES_CHECKBOX; 270 } 271 272 public boolean isSingleSelectLovType(){ 273 return InputControl.TYPE_SINGLE_SELECT_LIST_OF_VALUES == inputControl.getType() 274 || InputControl.TYPE_SINGLE_SELECT_LIST_OF_VALUES_RADIO == inputControl.getType(); 275 } 276 277 public boolean isMultiSelectQueryType(){ 278 return InputControl.TYPE_MULTI_SELECT_QUERY==inputControl.getType() 279 || inputControl.getType() == InputControl.TYPE_MULTI_SELECT_QUERY_CHECKBOX; 280 } 281 public boolean isMultiValueType(){ 282 return InputControl.TYPE_MULTI_VALUE==inputControl.getType(); 283 } 284 285 public boolean isMulti() { 286 return isMultiValueType() || isMultiSelectLovType() || isMultiSelectQueryType(); 287 } 288 289 public boolean isSingleSelectQueryType() { 290 return InputControl.TYPE_SINGLE_SELECT_QUERY == inputControl.getType() 291 || InputControl.TYPE_SINGLE_SELECT_QUERY_RADIO == inputControl.getType(); 292 } 293 294 public boolean isSingleValueType(){ 295 return InputControl.TYPE_SINGLE_VALUE==inputControl.getType(); 296 } 297 298 public ResourceReference getInputControlURI() 299 { 300 return inputControlURI; 301 } 302 303 public void setInputControlURI(ResourceReference inputControlURI) 304 { 305 this.inputControlURI = inputControlURI; 306 } 307 308 public String getOldInputControlURI() 309 { 310 return oldInputControlURI; 311 } 312 313 public void setOldInputControlURI(String oldInputControlURI) 314 { 315 this.oldInputControlURI = oldInputControlURI; 316 } 317 318 public String getNewVisibleColumn() 319 { 320 return newVisibleColumn; 321 } 322 323 public void setNewVisibleColumn(String newVisibleColumn) 324 { 325 this.newVisibleColumn = newVisibleColumn; 326 } 327 } 328 | Popular Tags |