1 package com.calipso.reportgenerator.common; 2 3 import com.calipso.reportgenerator.reportdefinitions.DataSourceDefinition; 4 import com.calipso.reportgenerator.reportdefinitions.types.DataSourceDefinitionSourceTypeType; 5 import com.calipso.reportgenerator.reportdefinitions.types.ReportDataType; 6 7 import java.io.Serializable ; 8 import java.util.Map ; 9 import java.util.HashMap ; 10 import java.math.BigDecimal ; 11 12 15 public class ReportDataSourceSpec implements Serializable { 16 private String expression; 17 private String externalClassName; 18 private String name; 19 private DataSourceDefinitionSourceTypeType sourceType; 20 private String externalSourceData; 21 private String externalConnectionString; 22 private String externalConnectionClassName; 23 private String externalConnectionDistributedUrl; 24 private String externalConnectionLocalUrl; 25 private String externalConnectionPassword; 26 private String externalConnectionUser; 27 private String datePattern; 28 private String dateTimePattern; 29 private String sheetName; 30 private String dataEndingCell; 31 private String dataInitialCell; 32 33 34 public void fillFrom(DataSourceDefinition dataSourceDefinition) { 35 expression = dataSourceDefinition.getExpression(); 36 externalClassName = dataSourceDefinition.getExternalClassName(); 37 name = dataSourceDefinition.getName(); 38 sourceType = dataSourceDefinition.getSourceType(); 39 externalSourceData = dataSourceDefinition.getExternalSourceData(); 40 externalConnectionString = dataSourceDefinition.getExternalConnectionString(); 41 externalConnectionClassName = dataSourceDefinition.getExternalConnectionClassName(); 42 externalConnectionDistributedUrl = dataSourceDefinition.getExternalConnectionDistributedUrl(); 43 externalConnectionLocalUrl = dataSourceDefinition.getExternalConnectionLocalUrl(); 44 externalConnectionPassword = dataSourceDefinition.getExternalConnectionPassword(); 45 externalConnectionUser = dataSourceDefinition.getExternalConnectionUser(); 46 datePattern = dataSourceDefinition.getDatePattern(); 47 dateTimePattern = dataSourceDefinition.getDateTimePattern(); 48 sheetName = dataSourceDefinition.getSheetName(); 49 dataEndingCell = dataSourceDefinition.getDataEndingCell(); 50 dataInitialCell = dataSourceDefinition.getDataInitialCell(); 51 } 52 53 public String getExpression() { 54 return expression; 55 } 56 57 public String getExternalClassName() { 58 return externalClassName; 59 } 60 61 public String getName() { 62 return name; 63 } 64 65 public DataSourceDefinitionSourceTypeType getSourceType() { 66 return sourceType; 67 } 68 69 public String getExternalSourceData() { 70 return externalSourceData; 71 } 72 73 public String getExternalConnectionString() { 74 return externalConnectionString; 75 } 76 77 public Map getExternalConnectionValues(){ 78 Map map = new HashMap (); 79 map.put("ExternalConnectionString",getExternalConnectionString()); 80 map.put("DatabaseConfigurationClassName",getExternalConnectionClassName()); 81 map.put("DatabaseConfigurationLocalUrl",getExternalConnectionLocalUrl()); 82 map.put("DatabaseConfigurationDistributedUrl",getExternalConnectionDistributedUrl()); 83 map.put("DatabaseConfigurationUser",getExternalConnectionUser()); 84 map.put("DatabaseConfigurationPassword",getExternalConnectionPassword()); 85 return map; 86 } 87 88 public String getExternalConnectionClassName() { 89 return externalConnectionClassName; 90 } 91 92 public String getExternalConnectionDistributedUrl() { 93 return externalConnectionDistributedUrl; 94 } 95 96 public String getExternalConnectionLocalUrl() { 97 return externalConnectionLocalUrl; 98 } 99 100 public String getExternalConnectionPassword() { 101 return externalConnectionPassword; 102 } 103 104 public String getExternalConnectionUser() { 105 return externalConnectionUser; 106 } 107 108 public String getDatePattern() { 109 return datePattern; 110 } 111 112 public String getDateTimePattern() { 113 return dateTimePattern; 114 } 115 116 public String getPattern(int dataType) { 117 switch(dataType){ 118 case ReportDataType.DATETIME_TYPE: 119 return this.getDateTimePattern(); 120 case ReportDataType.DATE_TYPE: 121 return this.getDatePattern(); 122 default: 123 return ""; 124 } 125 } 126 127 public String getSheetName() { 128 return sheetName; 129 } 130 131 public String getDataEndingCell() { 132 return dataEndingCell; 133 } 134 135 public String getDataInitialCell() { 136 return dataInitialCell; 137 } 138 139 } 140 | Popular Tags |