001: package com.calipso.reportgenerator.common;
002:
003: import com.calipso.reportgenerator.reportdefinitions.DataSourceDefinition;
004: import com.calipso.reportgenerator.reportdefinitions.types.DataSourceDefinitionSourceTypeType;
005: import com.calipso.reportgenerator.reportdefinitions.types.ReportDataType;
006:
007: import java.io.Serializable;
008: import java.util.Map;
009: import java.util.HashMap;
010: import java.math.BigDecimal;
011:
012: /**
013: * Representa al report data source
014: */
015: public class ReportDataSourceSpec implements Serializable {
016: private String expression;
017: private String externalClassName;
018: private String name;
019: private DataSourceDefinitionSourceTypeType sourceType;
020: private String externalSourceData;
021: private String externalConnectionString;
022: private String externalConnectionClassName;
023: private String externalConnectionDistributedUrl;
024: private String externalConnectionLocalUrl;
025: private String externalConnectionPassword;
026: private String externalConnectionUser;
027: private String datePattern;
028: private String dateTimePattern;
029: private String sheetName;
030: private String dataEndingCell;
031: private String dataInitialCell;
032:
033: public void fillFrom(DataSourceDefinition dataSourceDefinition) {
034: expression = dataSourceDefinition.getExpression();
035: externalClassName = dataSourceDefinition.getExternalClassName();
036: name = dataSourceDefinition.getName();
037: sourceType = dataSourceDefinition.getSourceType();
038: externalSourceData = dataSourceDefinition
039: .getExternalSourceData();
040: externalConnectionString = dataSourceDefinition
041: .getExternalConnectionString();
042: externalConnectionClassName = dataSourceDefinition
043: .getExternalConnectionClassName();
044: externalConnectionDistributedUrl = dataSourceDefinition
045: .getExternalConnectionDistributedUrl();
046: externalConnectionLocalUrl = dataSourceDefinition
047: .getExternalConnectionLocalUrl();
048: externalConnectionPassword = dataSourceDefinition
049: .getExternalConnectionPassword();
050: externalConnectionUser = dataSourceDefinition
051: .getExternalConnectionUser();
052: datePattern = dataSourceDefinition.getDatePattern();
053: dateTimePattern = dataSourceDefinition.getDateTimePattern();
054: sheetName = dataSourceDefinition.getSheetName();
055: dataEndingCell = dataSourceDefinition.getDataEndingCell();
056: dataInitialCell = dataSourceDefinition.getDataInitialCell();
057: }
058:
059: public String getExpression() {
060: return expression;
061: }
062:
063: public String getExternalClassName() {
064: return externalClassName;
065: }
066:
067: public String getName() {
068: return name;
069: }
070:
071: public DataSourceDefinitionSourceTypeType getSourceType() {
072: return sourceType;
073: }
074:
075: public String getExternalSourceData() {
076: return externalSourceData;
077: }
078:
079: public String getExternalConnectionString() {
080: return externalConnectionString;
081: }
082:
083: public Map getExternalConnectionValues() {
084: Map map = new HashMap();
085: map.put("ExternalConnectionString",
086: getExternalConnectionString());
087: map.put("DatabaseConfigurationClassName",
088: getExternalConnectionClassName());
089: map.put("DatabaseConfigurationLocalUrl",
090: getExternalConnectionLocalUrl());
091: map.put("DatabaseConfigurationDistributedUrl",
092: getExternalConnectionDistributedUrl());
093: map.put("DatabaseConfigurationUser",
094: getExternalConnectionUser());
095: map.put("DatabaseConfigurationPassword",
096: getExternalConnectionPassword());
097: return map;
098: }
099:
100: public String getExternalConnectionClassName() {
101: return externalConnectionClassName;
102: }
103:
104: public String getExternalConnectionDistributedUrl() {
105: return externalConnectionDistributedUrl;
106: }
107:
108: public String getExternalConnectionLocalUrl() {
109: return externalConnectionLocalUrl;
110: }
111:
112: public String getExternalConnectionPassword() {
113: return externalConnectionPassword;
114: }
115:
116: public String getExternalConnectionUser() {
117: return externalConnectionUser;
118: }
119:
120: public String getDatePattern() {
121: return datePattern;
122: }
123:
124: public String getDateTimePattern() {
125: return dateTimePattern;
126: }
127:
128: public String getPattern(int dataType) {
129: switch (dataType) {
130: case ReportDataType.DATETIME_TYPE:
131: return this .getDateTimePattern();
132: case ReportDataType.DATE_TYPE:
133: return this .getDatePattern();
134: default:
135: return "";
136: }
137: }
138:
139: public String getSheetName() {
140: return sheetName;
141: }
142:
143: public String getDataEndingCell() {
144: return dataEndingCell;
145: }
146:
147: public String getDataInitialCell() {
148: return dataInitialCell;
149: }
150:
151: }
|