-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommonDaoImpl.java
More file actions
127 lines (91 loc) · 4.15 KB
/
CommonDaoImpl.java
File metadata and controls
127 lines (91 loc) · 4.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
package Frameworkpackage;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
public class CommonDaoImpl extends CommonFunctions{
public LinkedHashMap<String,Object> getReportdetails(String reportId,Connection con) throws Exception
{
LinkedHashMap<String,Object> reportDetails=new LinkedHashMap<>();
ArrayList<Object> parameters = new ArrayList<>();
String query="select * from report where report_id=?";
parameters.add(reportId);
reportDetails=getMapReturnObject(parameters, query, con);
query="select * from report_parameters where report_id=?";
List<LinkedHashMap<String,Object>> paramters= getListOfLinkedHashHashMap(parameters, query, con);
List<LinkedHashMap<String,Object>> paramtersWithOptions=new ArrayList<>();
for(LinkedHashMap<String,Object> lhm: paramters)
{
query="select * from parameters_options where parameter_id=?";
parameters.clear();
parameters.add(lhm.get("parameter_id"));
List<LinkedHashMap<String,Object>> parameterOptions= getListOfLinkedHashHashMap(parameters, query, con);
LinkedHashMap paramNew=new LinkedHashMap<>();
lhm.put("parameterOptions", parameterOptions);
paramNew.putAll(lhm);
paramtersWithOptions.add(paramNew);
}
reportDetails.put("paramtersWithOptions", paramtersWithOptions);
parameters.clear();
parameters.add(reportId);
query="select * from report_columns where report_id=?";
reportDetails.put("columns", getListOfLinkedHashHashMap(parameters, query, con));
return reportDetails;
}
public List<LinkedHashMap<String, Object>> getReportParameters(String reportId,Connection con) throws Exception
{
ArrayList<Object> parameters = new ArrayList<>();
String query="select * from report_parameters where report_id=?";
parameters.add(reportId);
return getListOfLinkedHashHashMap(parameters, query, con);
}
public List<LinkedHashMap<String, Object>> getReportColumns(String reportId,Connection con) throws Exception
{
ArrayList<Object> parameters = new ArrayList<>();
String query="select * from report_columns where report_id=?";
parameters.add(reportId);
return getListOfLinkedHashHashMap(parameters, query, con);
}
public List<String> getListOfColumns(String report_id, Connection con) throws ClassNotFoundException, SQLException {
ArrayList<Object> parameters = new ArrayList<>();
parameters.add(report_id);
String query="select column_value from report_columns where report_id=?";
return getListOfString(parameters, query, con);
}
public long removeAllExistingRoles(long userId, Connection conWithF) throws SQLException {
ArrayList<Object> parameters = new ArrayList<>();
parameters.add(userId);
return insertUpdateDuablDB("update acl_user_role_rlt set activate_flag=0 where user_id=?", parameters,
conWithF);
}
public List<LinkedHashMap<String, Object>> getEmployeeMaster(String appId,Connection con) throws ClassNotFoundException, SQLException
{
ArrayList<Object> parameters=new ArrayList<>();
parameters.add(appId);
return getListOfLinkedHashHashMap(parameters, "select * from tbl_user_mst where activate_flag=1 and app_id=?", con);
}
public long addUserRoleMapping(long userId, Long roleId,String roleName, Connection conWithF) throws SQLException {
ArrayList<Object> parameters = new ArrayList<>();
parameters.add(userId);
parameters.add(roleId);
return insertUpdateDuablDB("insert into acl_user_role_rlt values (default,?,?,1,sysdate(),null)", parameters,
conWithF);
}
public List<LinkedHashMap<String, Object>> getUserRoleDetails(long roleId, Connection con)
throws SQLException, ClassNotFoundException {
ArrayList<Object> parameters = new ArrayList<>();
parameters.add(roleId);
return getListOfLinkedHashHashMap(parameters,
"select\r\n"
+ " *\r\n"
+ "from\r\n"
+ " tbl_user_mst user,\r\n"
+ " acl_user_role_rlt userrole \r\n"
+ "where\r\n"
+ " user.user_id = ? \r\n"
+ " and user.user_id = userrole.user_id \r\n"
+ " and userrole.activate_flag = 1",
con);
}
}