KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > calipso > reportgenerator > common > ReportDataSourceSpec


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 JavaDoc;
8 import java.util.Map JavaDoc;
9 import java.util.HashMap JavaDoc;
10 import java.math.BigDecimal JavaDoc;
11
12 /**
13  * Representa al report data source
14  */

15 public class ReportDataSourceSpec implements Serializable JavaDoc {
16   private String JavaDoc expression;
17   private String JavaDoc externalClassName;
18   private String JavaDoc name;
19   private DataSourceDefinitionSourceTypeType sourceType;
20   private String JavaDoc externalSourceData;
21   private String JavaDoc externalConnectionString;
22   private String JavaDoc externalConnectionClassName;
23   private String JavaDoc externalConnectionDistributedUrl;
24   private String JavaDoc externalConnectionLocalUrl;
25   private String JavaDoc externalConnectionPassword;
26   private String JavaDoc externalConnectionUser;
27   private String JavaDoc datePattern;
28   private String JavaDoc dateTimePattern;
29   private String JavaDoc sheetName;
30   private String JavaDoc dataEndingCell;
31   private String JavaDoc 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 JavaDoc getExpression() {
54     return expression;
55   }
56
57   public String JavaDoc getExternalClassName() {
58     return externalClassName;
59   }
60
61   public String JavaDoc getName() {
62     return name;
63   }
64
65   public DataSourceDefinitionSourceTypeType getSourceType() {
66     return sourceType;
67   }
68
69   public String JavaDoc getExternalSourceData() {
70     return externalSourceData;
71   }
72
73   public String JavaDoc getExternalConnectionString() {
74     return externalConnectionString;
75   }
76
77   public Map JavaDoc getExternalConnectionValues(){
78     Map JavaDoc map = new HashMap JavaDoc();
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 JavaDoc getExternalConnectionClassName() {
89     return externalConnectionClassName;
90   }
91
92   public String JavaDoc getExternalConnectionDistributedUrl() {
93     return externalConnectionDistributedUrl;
94   }
95
96   public String JavaDoc getExternalConnectionLocalUrl() {
97     return externalConnectionLocalUrl;
98   }
99
100   public String JavaDoc getExternalConnectionPassword() {
101     return externalConnectionPassword;
102   }
103
104   public String JavaDoc getExternalConnectionUser() {
105     return externalConnectionUser;
106   }
107
108   public String JavaDoc getDatePattern() {
109     return datePattern;
110   }
111
112   public String JavaDoc getDateTimePattern() {
113     return dateTimePattern;
114   }
115
116   public String JavaDoc 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 JavaDoc getSheetName() {
128     return sheetName;
129   }
130
131   public String JavaDoc getDataEndingCell() {
132     return dataEndingCell;
133   }
134
135   public String JavaDoc getDataInitialCell() {
136     return dataInitialCell;
137   }
138
139 }
140
Popular Tags