-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patha5
250 lines (219 loc) · 8.42 KB
/
a5
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
Enter file contents here
private void doJuridictionAction(
HttpServletRequest request,
HttpServletResponse response)
throws IVisionException {
String methodName = "IVisionActionServlet.doJuridictionAction";
BusinessRequest brequest = getBusinessRequest(request);
UserContext currentContext = getUserContext(request);
String currentLanguage=null;
if(currentContext!=null)
{
currentLanguage =
currentContext.getString(UserContext.USER_LANGUAGE);
}
TraceManager.debug(methodName + " = langue : " + currentLanguage);
LogManager.log(currentContext, LogManager.EnumLogManager.LOG_ENTER.getValue(), methodName, "");
//928362 : IVN - 20424 : 20141208 : Start
if(currentContext != null && !(BusinessCodesResourceProvider.C249_ADMINISTRATOR.equalsIgnoreCase(currentContext.getString(UserContext.USER_TYPE))
|| BusinessCodesResourceProvider.C249_LOCAL_ADMINISTRATOR.equalsIgnoreCase(currentContext.getString(UserContext.USER_TYPE)))){
LogManager
.log(currentContext,
LogManager.EnumLogManager.LOG_MESSAGE_DEBUG
.getValue(), methodName,
"Current User is neither Admin nor Local Admin.Redirecting user to login page.");
outputXML(
response,
new IVisionException(
new IVisionError("E15131", methodName)).toXML(
methodName,
"doPost",
currentLanguage));
}else
//928362 : IVN - 20424 : 20141208 : Start
// Check the session validity
if (checkSessionValidity(request, response)) {
String actionType =
request.getParameter(ActionsResource.ACTION_TYPE);
// Juridiction Permissions Action Invocation
if (ActionsResource
.JURIDICTION_PERMISSIONS_ACTION
.equals(actionType)) {
JuridictionPermissionsService permissionsService =
new JuridictionPermissionsService();
IVisionServiceResponse serviceResponse =
permissionsService.doJuridiction(
request,
response,
brequest);
if (ApplicationSettingsResourceProvider
.SERVICE_RESPONSE_DIRECT
.equals(serviceResponse.getResponseType())) {
returnResponse(serviceResponse);
}
else if (
ApplicationSettingsResourceProvider
.SERVICE_RESPONSE_EXCEPTION
.equals(
serviceResponse.getResponseType())) {
outputXML(
serviceResponse.getResponse(),
serviceResponse.getStringResponse());
}
}
// Juridiction Action Invocation
else if (ActionsResource.JURIDICTION_ACTION.equals(actionType)) {
JuridictionService juridictionService =
new JuridictionService();
IVisionServiceResponse serviceResponse =
juridictionService.doJuridiction(
request,
response,
brequest);
if (ApplicationSettingsResourceProvider
.SERVICE_RESPONSE_DIRECT
.equals(serviceResponse.getResponseType())) {
returnResponse(serviceResponse);
}
else if (
ApplicationSettingsResourceProvider
.SERVICE_RESPONSE_EXCEPTION
.equals(
serviceResponse.getResponseType())) {
outputXML(
serviceResponse.getResponse(),
serviceResponse.getStringResponse());
}
}
/* 913500 : IVN-13467 : 20130506 : Start */
// jurisdiction User Maintenance action invocation
else if (ActionsResource.JURIDICTION_MAINTENANCE_ACTION.equals(actionType)) {
JuridictionMaintenanceService maintenanceService =
new JuridictionMaintenanceService();
IVisionServiceResponse serviceResponse =
maintenanceService.doJuridiction(
request,
response,
brequest);
if (ApplicationSettingsResourceProvider
.SERVICE_RESPONSE_DIRECT
.equals(serviceResponse.getResponseType())) {
returnResponse(serviceResponse);
}
else if (
ApplicationSettingsResourceProvider
.SERVICE_RESPONSE_EXCEPTION
.equals(
serviceResponse.getResponseType())) {
outputXML(
serviceResponse.getResponse(),
serviceResponse.getStringResponse());
}
}
//966027 : IVN-20839 : 20140725 : Jurisdiction : Fetching no of branches assigned to user : - Starts
else if (ActionsResource.JURIDICTION_FETCH_BRANCH_ACTION.equals(actionType)){
String userUpdated =
request.getParameter(ActionsResource.USER_ID);
TechnicalSession technicalSession = null;
String userBranchNo = null;
List<String> userBranchNumber = null;
Map<String, String> localHashMap = new HashMap<String, String>();
localHashMap.put(UserContext.USER_ID, userUpdated);
try{
technicalSession = TechnicalService.getTechnicalSessionHandle();
}catch (Exception e) {
LogManager.log(currentContext, LogManager.EnumLogManager.LOG_EXCEPTION.getValue(), methodName,
"Unable to fetch Technical Session bean handle :"+e.getMessage());
throw new IVisionException(
new IVisionError("E00000", e.getMessage()));
}
if(null != technicalSession){
userBranchNumber = technicalSession.getUserBranchNumbers(localHashMap);
userBranchNo = String.valueOf(userBranchNumber.size());
}
IVisionServiceResponse serviceResponse = new IVisionServiceResponse();
serviceResponse.setIVisionServiceResponse(
request,
response,
userBranchNo,
ApplicationSettingsResourceProvider.SERVICE_RESPONSE_DIRECT,
ApplicationSettingsResourceProvider.HTML_RESPONSE_FORMAT,
brequest.getUserContext());
returnResponse(serviceResponse);
//966027 : IVN-20839 : 20140725 : Jurisdiction : Fetching no of branches assigned to user : - Ends
/* 913500 : IVN-13467 : 20130506 : End */
// Juridiction Menu Action Invocation
}else {
//966027 : IVN-20839 : 20140725 : Jurisdiction : Setting brchCode in user context - Starts
String branchCode = request.getParameter("brchCode");
if (branchCode != null) {
currentContext.put(UserContext.BRANCH_CODE,branchCode);
User user = GetCommonService.getUserWebFunc(branchCode, currentContext.getString(UserContext.USER_ID));
String pcUserType = user.getPc_user_type();
currentContext.put(UserContext.PC_USER_TYPE, pcUserType);
}
if (branchCode != null && currentContext.getString(UserContext.PC_ACTIVE_FLAG) != null) {
TechnicalSession technicalSession = null;
String data = null;
try{
technicalSession = TechnicalService.getTechnicalSessionHandle();
}catch (Exception e) {
LogManager.log(currentContext, LogManager.EnumLogManager.LOG_EXCEPTION.getValue(), methodName,
"Unable to fetch Technical Session bean handle :"+e.getMessage());
throw new IVisionException(
new IVisionError("E00000", e.getMessage()));
}
if(null != technicalSession){
data = technicalSession.getParameterP130Data(currentContext,branchCode);
}
currentContext.put(UserContext.BACKEND_TYPE, data);
LogManager.log(currentContext, LogManager.EnumLogManager.LOG_MESSAGE_DEBUG.getValue(), methodName, "set UserContext BACKEND_TYPE = " + data);
}
//966027 : IVN-20839 : 20140725 : Jurisdiction : Setting brchCode in user context - Ends
JuridictionMenuService menuService =
new JuridictionMenuService();
IVisionServiceResponse serviceResponse =
menuService.doJuridiction(request, response, brequest);
if (ApplicationSettingsResourceProvider
.SERVICE_RESPONSE_DIRECT
.equals(serviceResponse.getResponseType())) {
returnResponse(serviceResponse);
}
// Dispatch the request to the Juridiction Manu Page
else if (
ApplicationSettingsResourceProvider
.SERVICE_RESPONSE_DISPATCH
.equals(
serviceResponse.getResponseType())) {
try {
dispatchRequest(
serviceResponse.getStringResponse(),
serviceResponse.getRequest(),
serviceResponse.getResponse());
}
catch (IVisionException ie) {
TraceManager.error(
"Cannot dispatch the request to the Juridiction Menu Page.");
}
}
}
}
//--------------------------------------------------------
// The validation of session has failed, hence we must
// dispatch the request to the Login page:
//--------------------------------------------------------
else {
//return XML-RPC flow error for authentification failure
TraceManager.trace(
"In " + methodName + ", authentification failure",
TraceManager.TRACER_SERVLET_TYPE,
TraceManager.TRACER_PUBLIC_LEVEL);
outputXML(
response,
new IVisionException(
new IVisionError("E15001", methodName)).toXML(
methodName,
"doPost",
currentLanguage));
}
}