l5m-tools 0.0.2.beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.document +5 -0
- data/Gemfile +15 -0
- data/LICENSE.txt +20 -0
- data/README +19 -0
- data/README.rdoc +19 -0
- data/Rakefile +54 -0
- data/VERSION +1 -0
- data/bin/duplicate-app +3 -0
- data/bin/l5m +7 -0
- data/bin/make-app +3 -0
- data/bin/set_env.sh +19 -0
- data/bin/svn.tool +3 -0
- data/info +0 -0
- data/l5m-tools.gemspec +83 -0
- data/lib/l5m-tools/application.rb +41 -0
- data/lib/l5m-tools/array.rb +13 -0
- data/lib/l5m-tools/env.rb +8 -0
- data/lib/l5m-tools/ignore/svn_ingore.yaml +21 -0
- data/lib/l5m-tools/l5m-tools-module.rb +12 -0
- data/lib/l5m-tools/string.rb +7 -0
- data/lib/l5m-tools/svn.rb +109 -0
- data/lib/l5m-tools/template/Template.jsp +443 -0
- data/lib/l5m-tools/template/TemplateBaseAbstractWorker.java +187 -0
- data/lib/l5m-tools/template/TemplateServicerImpl.java +216 -0
- data/lib/l5m-tools/template/TemplateWorker.java +653 -0
- data/lib/l5m-tools/template/frt.jsp +445 -0
- data/lib/l5m-tools/template/ms2.jsp +443 -0
- data/lib/l5m-tools/template/rad.jsp +443 -0
- data/lib/l5m-tools/template/ttv2.jsp +693 -0
- data/lib/l5m-tools/tools.rb +69 -0
- data/lib/l5m-tools.rb +20 -0
- data/test/helper.rb +18 -0
- data/test/test_l5m-tools.rb +34 -0
- metadata +133 -0
@@ -0,0 +1,216 @@
|
|
1
|
+
package com.l5m.!REPLACE_STYLE!.engine.servicer;
|
2
|
+
|
3
|
+
import java.sql.SQLException;
|
4
|
+
import java.util.HashSet;
|
5
|
+
import java.util.Set;
|
6
|
+
|
7
|
+
import com.l5m.common.bean.DataSourceBeanBase;
|
8
|
+
import com.l5m.common.bean.GeneralAvailabilityModule;
|
9
|
+
import com.l5m.common.util.dcnds.QHTCommonUtil;
|
10
|
+
import com.l5m.customtags.beans.BaseServicerParaBean;
|
11
|
+
import com.l5m.customtags.tags.utils.GenerateTagUtil;
|
12
|
+
import com.l5m.!REPLACE_STYLE!.engine.worker.UserCompanyWorker;
|
13
|
+
/**
|
14
|
+
* make sure code as clear as possible.
|
15
|
+
* don't make another one think.
|
16
|
+
* if you can't do it, get away.
|
17
|
+
* SortBeanListUtil can sort bean list.
|
18
|
+
* GroupBeanListUtil can group a bean list to map, or .....
|
19
|
+
* Use DAO Util to retrieve data, update... utils.
|
20
|
+
* don't write sql in servicer
|
21
|
+
*
|
22
|
+
* @author Ronghai
|
23
|
+
*
|
24
|
+
*/
|
25
|
+
public class !REPLACE_ME_FILE!ServicerImpl extends BaseServicerParaBean.AbstractBaseServicer{
|
26
|
+
private static final long serialVersionUID = 1L;
|
27
|
+
public static enum PANEL {
|
28
|
+
REPORT("REPORT") ,
|
29
|
+
Help("Help"), DataAvailability("Data Availability")
|
30
|
+
; //Total Day/Prime * LSD/C3
|
31
|
+
private final String label;
|
32
|
+
private boolean enable;
|
33
|
+
PANEL(){
|
34
|
+
this.label = this.name();
|
35
|
+
this.enable = true;
|
36
|
+
}
|
37
|
+
PANEL(String label){
|
38
|
+
this.label = label;
|
39
|
+
this.enable = true;
|
40
|
+
}
|
41
|
+
PANEL(String label,boolean enable){
|
42
|
+
this.label = label;
|
43
|
+
this.enable = enable;
|
44
|
+
}
|
45
|
+
public String getLabel() {
|
46
|
+
return label;
|
47
|
+
}
|
48
|
+
public boolean isEnable() {
|
49
|
+
return enable;
|
50
|
+
}
|
51
|
+
public int panelIndex(){
|
52
|
+
return this.ordinal();
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
@Override
|
60
|
+
public void clearCache() {
|
61
|
+
super.clearCache();
|
62
|
+
this.servicerParamBean.setPanelIndex(PANEL.Help.panelIndex());
|
63
|
+
|
64
|
+
System.gc();
|
65
|
+
}
|
66
|
+
|
67
|
+
|
68
|
+
@Override
|
69
|
+
public void handlePaginator(int panelIndex) {
|
70
|
+
if (this.servicerParamBean.getPaginatorStateBean(panelIndex) == null) {
|
71
|
+
this.servicerParamBean.setPaginatorStateBean(GenerateTagUtil.initPaginatorStateBean("PaginatorStateBeanTag"), panelIndex);
|
72
|
+
this.servicerParamBean.getPaginatorStateBean(panelIndex).setRowsPerPage(1);
|
73
|
+
}
|
74
|
+
|
75
|
+
|
76
|
+
if(panelIndex == PANEL.DataAvailability.panelIndex() || panelIndex == PANEL.Help.panelIndex() ){
|
77
|
+
}else{
|
78
|
+
int size = 0;
|
79
|
+
this.servicerParamBean.getPaginatorStateBean(panelIndex).setCollectionSize(size);
|
80
|
+
}
|
81
|
+
|
82
|
+
if (!this.servicerParamBean.getPaginatorStateBean(panelIndex).checkCurrentPageIndexIsLegal()) {
|
83
|
+
this.servicerParamBean.getPaginatorStateBean(panelIndex).setCurrentPageIndex(0);
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
@Override
|
88
|
+
public void init( ) {
|
89
|
+
super.init();
|
90
|
+
try {
|
91
|
+
this.servicerParamBean = new BaseServicerParaBean(this.dh, this.companyId, this.groupId , this.userId, this.userCompanyId, PANEL.values().length);
|
92
|
+
this.servicerParamBean.initDisplayAndSortBy();
|
93
|
+
try{
|
94
|
+
this.initTimeSpan();
|
95
|
+
}catch(Exception e){
|
96
|
+
e.printStackTrace();
|
97
|
+
this.servicerParamBean.initTimeSpan();
|
98
|
+
}
|
99
|
+
}catch(Exception e){
|
100
|
+
e.printStackTrace();
|
101
|
+
}
|
102
|
+
|
103
|
+
//How many tabes.... init here
|
104
|
+
this.servicerParamBean.initTabbedPanel("SOURCE");
|
105
|
+
|
106
|
+
|
107
|
+
/*
|
108
|
+
String[] columns = new String[]{"COLUMNS"};
|
109
|
+
//decimal
|
110
|
+
this.servicerParamBean.setReportDecimalControlList(GenerateTagUtil.initDecimal(columns, new int[]{3,3,0,0,0,0}), PANEL.REPORT.panelIndex());
|
111
|
+
|
112
|
+
|
113
|
+
//display
|
114
|
+
this.servicerParamBean.setColumnsMap(QHTCommonUtil.array2Map(columns), PANEL.REPORT.panelIndex());
|
115
|
+
Set<String> set = new HashSet<String>();
|
116
|
+
for (String s : columns) { set.add(s); }
|
117
|
+
this.servicerParamBean.setSelectedColumns(set, PANEL.REPORT.panelIndex());
|
118
|
+
this.servicerParamBean.setDisplayController( GenerateTagUtil.getSelectedValueBoolean( this.servicerParamBean.getColumnsMap( PANEL.REPORT.panelIndex() ) , set) , PANEL.REPORT.panelIndex());
|
119
|
+
|
120
|
+
//sort
|
121
|
+
this.servicerParamBean.setSortingKeysModuleStateBean(GenerateTagUtil.initSortKeyModule(columns, "sortKey", new int[]{0}, new boolean[]{true}), PANEL.REPORT.panelIndex());
|
122
|
+
*/
|
123
|
+
}
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
public void initGeneralAvailabilityModule() {
|
130
|
+
DataSourceBeanBase dataSourceBean = null;
|
131
|
+
try {
|
132
|
+
dataSourceBean = UserCompanyWorker.getDataSourceBean(dh, companyId);
|
133
|
+
} catch (SQLException e1) {
|
134
|
+
e1.printStackTrace();
|
135
|
+
} catch (ClassNotFoundException e1) {
|
136
|
+
e1.printStackTrace();
|
137
|
+
}
|
138
|
+
this.session.setAttribute(UserCompanyWorker.DATA_SOURCE_BEAN, dataSourceBean);
|
139
|
+
boolean[] displaySetting = new boolean[GeneralAvailabilityModule.GROUP_COUNT];
|
140
|
+
if (dataSourceBean != null) {
|
141
|
+
displaySetting[GeneralAvailabilityModule.GROUP_MP] = dataSourceBean.hasMP() ;
|
142
|
+
displaySetting[GeneralAvailabilityModule.GROUP_TNS] = dataSourceBean.hasTNS() ;
|
143
|
+
displaySetting[GeneralAvailabilityModule.GROUP_MIT] = true;
|
144
|
+
displaySetting[GeneralAvailabilityModule.GROUP_ACM_MIT] = true;
|
145
|
+
if (dataSourceBean.hasMXM()) {
|
146
|
+
displaySetting[GeneralAvailabilityModule.GROUP_MXM] = true;
|
147
|
+
}
|
148
|
+
}
|
149
|
+
try {
|
150
|
+
this.generalAvailabilityModule = new GeneralAvailabilityModule(this.dh, this.groupId, companyId, dataSourceBean, displaySetting);
|
151
|
+
} catch (SQLException e) {
|
152
|
+
e.printStackTrace();
|
153
|
+
} catch (ClassNotFoundException e) {
|
154
|
+
e.printStackTrace();
|
155
|
+
}
|
156
|
+
}
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
@SuppressWarnings("unchecked")
|
167
|
+
private void initTimeSpan() throws ClassNotFoundException, SQLException {
|
168
|
+
this.servicerParamBean.initTimeSpan();
|
169
|
+
}
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
public void retrieveData() throws SQLException, ClassNotFoundException, CloneNotSupportedException {
|
174
|
+
// don't write sql in this method,
|
175
|
+
// when retrieve something from database, you can create a DAO Util. Use a better name to identifine it, and another programmer aslo can use the DAO Util.
|
176
|
+
// all parameters passed into DAO Utill, should be wrapped in a parameterBean. if you add an additional parameter, you don't need modify/adjust the method.
|
177
|
+
// you can add a new attribute in your parameter bean, and use it in DAOUtil
|
178
|
+
//
|
179
|
+
|
180
|
+
}
|
181
|
+
|
182
|
+
|
183
|
+
@Override
|
184
|
+
public void updateDisplay(){
|
185
|
+
// nothing to do, here, don't use this method to update display or something.
|
186
|
+
//
|
187
|
+
// for flat report, you can use FlatViewUtil to generate.
|
188
|
+
//
|
189
|
+
|
190
|
+
}
|
191
|
+
|
192
|
+
@Override
|
193
|
+
public void sort(int ...panelIndexes){
|
194
|
+
if( panelIndexes == null || panelIndexes .length == 0){
|
195
|
+
panelIndexes = new int[]{this.getPanelIndex() } ;
|
196
|
+
}
|
197
|
+
/*for( int p : panelIndexes){
|
198
|
+
this.servicerParamBean.sort (p);
|
199
|
+
}*/
|
200
|
+
this.servicerParamBean.parseSort(panelIndexes);
|
201
|
+
//use SortBeanListUtil to sort bean list.
|
202
|
+
// Generelly application has two different data struct. bean list or dataTable.
|
203
|
+
// every application can convert to bean list or dataTable.
|
204
|
+
// don't use map to store result except map is better.
|
205
|
+
|
206
|
+
}
|
207
|
+
|
208
|
+
|
209
|
+
@Override
|
210
|
+
public void processFilter() {
|
211
|
+
}
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
}
|