90ba1ed3f0ca113fd6b84feeb1a86d77ef7a2efa
[portal/sdk.git] /
1 /*
2  * ============LICENSE_START==========================================
3  * ONAP Portal SDK
4  * ===================================================================
5  * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6  * ===================================================================
7  *
8  * Unless otherwise specified, all software contained herein is licensed
9  * under the Apache License, Version 2.0 (the "License");
10  * you may not use this software except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *             http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  * Unless otherwise specified, all documentation contained herein is licensed
22  * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
23  * you may not use this documentation except in compliance with the License.
24  * You may obtain a copy of the License at
25  *
26  *             https://creativecommons.org/licenses/by/4.0/
27  *
28  * Unless required by applicable law or agreed to in writing, documentation
29  * distributed under the License is distributed on an "AS IS" BASIS,
30  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31  * See the License for the specific language governing permissions and
32  * limitations under the License.
33  *
34  * ============LICENSE_END============================================
35  *
36  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
37  */
38 package org.onap.portalsdk.analytics.scheduler;
39
40 import java.math.BigDecimal;
41 import java.sql.Connection;
42 import java.sql.ResultSet;
43 import java.sql.SQLException;
44 import java.sql.Statement;
45 import java.text.SimpleDateFormat;
46 import java.util.Date;
47 import java.util.UUID;
48
49 import org.onap.portalsdk.analytics.error.RaptorException;
50 import org.onap.portalsdk.analytics.error.ReportSQLException;
51 import org.onap.portalsdk.analytics.scheduler.SchedulerUtil.Executor;
52 import org.onap.portalsdk.analytics.system.Globals;
53
54 public class SendNotifications {
55         
56         SchedulerUtil schedulerUtil;
57         public SendEmail sendEmail;
58         
59         public SendNotifications() throws Exception {
60                 schedulerUtil = new SchedulerUtil();
61                 sendEmail = new SendEmail();
62                 sendEmail.setSchedulerUtil(schedulerUtil);
63                 init();
64         }
65
66                 
67         public  void deInit() throws SQLException {
68                 schedulerUtil.closeConnection();
69         }
70         
71         public  void init() throws SQLException, ReportSQLException {
72                 schedulerUtil.init();
73         }
74         
75         public void send_notification(String p_mail_server, String p_sender, String p_system_name, String p_system_url, int connectionTimeout) throws RaptorException, Exception {
76
77                 System.out.println(p_mail_server + " " + p_sender + " " + p_system_name + " " + p_system_url);
78                 int p_time_interval = Globals.getSchedulerInterval();
79                 int v_num_recs = 0;
80                 String v_gen_key;
81                 BigDecimal v_id = null;
82                 String v_url;
83                 String v_r_action = "report.download.pdf";
84                 String v_email_msg;
85                 String v_formfields;
86                 // String error_m;
87                 // int transfer_timeout_limit = 1800;
88                 // boolean v_attach_email_yn = true;
89                 int v_schedule_id;
90                 Date v_touch_date;
91                 // Exception for_rec;
92
93                 Connection conn = schedulerUtil.getConnection();
94                 Statement stat = conn.createStatement();
95                 
96                 String CNotificationsql = 
97                                 /*
98                                 "SELECT x.rep_id, x.schedule_id, x.conditional_yn, x.condition_large_sql, x.notify_type, x.max_row, x.initial_formfields, x.processed_formfields, r.title, x.user_id "
99                                 + "FROM ("
100                                         + "SELECT rs.rep_id, rs.schedule_id, rs.sched_user_id user_id, rs.conditional_yn, rs.condition_large_sql, "
101                                         + "rs.notify_type, rs.max_row, rs.initial_formfields, rs.processed_formfields "
102                                         + "FROM cr_report_schedule rs "
103                                         + "WHERE rs.enabled_yn='Y' "
104                                         + "AND rs.start_"
105                                         + "date <= sysdate "
106                                         + "AND  (rs.end_date >= sysdate or rs.end_date is null ) "
107                                         + "AND rs.run_date IS NOT NULL "
108                                         + ") x, cr_report r "
109                                 + "WHERE x.rep_id = r.rep_id ";
110                                  */
111                 
112                 Globals.getAvailableSchedules().replace("[currentDate]", Globals.getCurrentDateString());
113                                 
114                 
115                 ResultSet rs = stat.executeQuery(CNotificationsql);
116
117                 while (rs.next()) {
118                         
119                         v_schedule_id = rs.getInt("schedule_id");
120                         int offset = get_report_sched_offset(rs.getInt("rep_id"), v_schedule_id);
121                         
122                         if(offset >= p_time_interval) continue;
123
124                         
125                         v_touch_date = (Date) schedulerUtil.getSingleResult("select touch_date from cr_report_email_sent_log where schedule_id = " + v_schedule_id + " and log_id = (select max(log_id) from cr_report_email_sent_log where schedule_id = " + v_schedule_id + ")", "touch_date");
126                         if (v_touch_date != null) {
127                                 if (Math.abs(System.currentTimeMillis() - v_touch_date.getTime()) /1000 < (p_time_interval - 1)) {
128                                         return;
129                                 }
130                         }
131
132                         if ("Y".equals(rs.getString("conditional_yn"))) {
133
134                                 v_num_recs = (Integer) schedulerUtil.getSingleResult("select count(*) count from (" + rs.getString("condition_large_sql") + " )", "count");
135                         }
136
137                         if (v_num_recs > 0 || "N".equals(rs.getString("conditional_yn"))) {
138
139                                 v_gen_key = ("Z" + UUID.randomUUID()).toString().substring(0,24); // 25 character string
140                                 Object sequenceId = schedulerUtil.getSingleResult(Globals.getSequenceNextVal().replace("[sequenceName]", "seq_email_sent_log_id"), "id");
141                                 
142                                 if(sequenceId instanceof Long)
143                                         v_id = new BigDecimal((Long)sequenceId);
144                                 else if(sequenceId instanceof BigDecimal)
145                                         v_id = (BigDecimal)sequenceId;
146                                 
147                                 schedulerUtil.insertOrUpdate("insert into cr_report_email_sent_log (log_id, gen_key, schedule_id, rep_id, user_id, touch_date) values (" + v_id + ",'" + v_gen_key + "'," + rs.getInt("schedule_id") + "," + rs.getInt("rep_id") + "," + rs.getInt("user_id") + ", " + Globals.getCurrentDateString() + " )");
148
149                                 int notify_type = rs.getInt("notify_type");
150                                 if (notify_type == 4)
151                                         v_r_action = "report.download";
152                                 else if (notify_type == 2)
153                                         v_r_action = "report.download.pdf";
154                                 else if (notify_type == 3)
155                                         v_r_action = "report.csv.download";
156                                 else if (notify_type == 5)
157                                         v_r_action = "report.download.excel2007";
158                                 else if (notify_type == 6)
159                                         v_r_action = "download.all";
160
161                                 if (rs.getObject("processed_formfields") != null)
162                                         v_formfields = modify_formfields(v_schedule_id, rs.getString("processed_formFields"));
163                                 else
164                                         v_formfields = strip_formfields(v_schedule_id, rs.getString("initial_formfields"));
165
166                                 v_url = p_system_url + "&r_action=" + v_r_action + "&log_id=" + v_id + "&user_id=" + rs.getString("user_id") + "&pdfAttachmentKey=" + v_gen_key + "&download_limit=" + rs.getInt("max_row") + v_formfields;
167
168                                 boolean v_attach_email_yn = shouldSendAttachmentInEmail(v_schedule_id);
169
170                                 v_email_msg = "<html><body><p><b><u><i>" + p_system_name + " System Notification</i></u></b></p>" + "<p>Report <b>" + rs.getString("title") + "</b> is available for viewing.</p><p>You can view the report if it is attached. </br>"
171                                                 + "If it is not attached, or you have problem to open it, you can log into Business Direct and run the report.</p>" + "</body></html>";
172
173                                 if (rs.getInt("notify_type") != 6) {
174
175                                         sendEmail.sendEmail(p_mail_server, p_sender, p_system_name + " System Notification: Report " + rs.getString("title") + " generated", v_email_msg, v_url, rs.getInt("notify_type"), v_schedule_id, p_time_interval, v_attach_email_yn,connectionTimeout);
176
177                                 } else {
178
179                                         // may not necessary
180                                         schedulerUtil.insertOrUpdate("insert into cr_schedule_activity_log (SCHEDULE_ID, url, notes, run_time) values  (" + v_schedule_id + ",'" + v_url + "'," + "'Success: http request began.', " + Globals.getCurrentDateString() + " )");
181                                         schedulerUtil.insertOrUpdate("insert into cr_schedule_activity_log (SCHEDULE_ID, url, notes, run_time) values  (" + v_schedule_id + ",'" + v_url + "'," + "'Success: http response recieved. Code  resp.status_code '' desc '' resp.reason_phrase', " + Globals.getCurrentDateString() + " )");
182
183                                 }
184                                 
185                                 schedulerUtil.insertOrUpdate("update cr_report_schedule set run_date = " + Globals.getCurrentDateString() +" where schedule_id=" + v_schedule_id);
186                                 
187                                 schedulerUtil.insertOrUpdate("update cr_report_email_sent_log set sent_date= " + Globals.getCurrentDateString() +" , access_flag='N' where log_id=" + v_id);
188                                 schedulerUtil.insertOrUpdate("insert into cr_schedule_activity_log (SCHEDULE_ID, url, notes, run_time) values (" + v_schedule_id + ",'" + v_url + "','Success: Email Sent', " + Globals.getCurrentDateString() + " )");
189
190                         }
191
192                 }
193
194                    if(rs!=null) 
195                                 rs.close();
196                    if(stat!=null)
197                         stat.close();
198                 //conn.close();
199
200         }
201
202         private boolean shouldSendAttachmentInEmail(int v_schedule_id) throws SQLException, ReportSQLException {
203
204                 String l_boolean = (String) schedulerUtil.getSingleResult("SELECT ATTACHMENT_YN from cr_report_schedule where schedule_id  = " + v_schedule_id, "ATTACHMENT_YN");
205                 if ("Y".equals(l_boolean))
206                         return true;
207                 return false;
208         }
209
210         private String strip_formfields(int v_schedule_id, String p_formfields) throws SQLException, ReportSQLException {
211
212                 String v_formfields_insert = "";
213                 String v_formfields_generate = "";
214                 String v_name = "";
215                 String v_value = "";
216                 
217                 
218                 String[] column_values = schedulerUtil.cr_dissecturl(p_formfields, "&");
219                 
220                 for(String column_value : column_values){
221                         if(column_value == null || column_value.isEmpty())
222                                 continue;
223                         
224                         v_name = column_value.substring(0, column_value.indexOf('='));
225                         v_formfields_insert += column_value + "&";
226                         v_value = column_value.substring(column_value.indexOf('=') + 1);
227                         if (column_value.indexOf("_auto") > 0) {
228                                 v_formfields_generate = v_formfields_generate + v_name.substring(0, v_name.indexOf("_auto")) + "=" + v_value + "&";
229                         } else {
230                                 v_formfields_generate = v_formfields_generate + column_value + "&";
231                         }
232                 }
233                 
234                 schedulerUtil.insertOrUpdate("update CR_REPORT_SCHEDULE set processed_formfields ='" + v_formfields_insert + "' where schedule_id = " + v_schedule_id);
235
236                 return v_formfields_generate.substring(0, v_formfields_generate.length());
237
238         }
239
240         private String modify_formfields(int v_schedule_id, String p_formfields) throws SQLException, ReportSQLException {
241
242                 class Result {
243
244                         String v_formfields_insert = "";
245                         String v_formfields_generate = "";
246                         String v_name = "";
247                         String v_value = "";
248                         Date v_date;
249                         String v_hour = "";
250                         String v_hour_value = "";
251                 }
252
253                 final Result result = new Result();
254
255                 final String v_recurrence = (String) schedulerUtil.getSingleResult("select recurrence from cr_report_schedule where schedule_id = " + v_schedule_id, "recurrence");
256
257                 String[] column_values = schedulerUtil.cr_dissecturl(p_formfields, "&");
258                 
259                 for(String column_value : column_values){
260                         if (column_value == null)
261                                 column_value = "";
262
263                         if ("MONTHLY".equals(v_recurrence)) {
264                                 if (column_value.indexOf("_auto") > 0) {
265                                         result.v_name = column_value.substring(0, column_value.indexOf('='));
266                                         result.v_date = schedulerUtil.to_date(column_value.substring(column_value.indexOf('=') + 1), "mm/dd/yyyy");
267                                         result.v_value = schedulerUtil.add_months(result.v_date, 1).toString();
268
269                                         if (result.v_name.length() > 0) {
270                                                 result.v_formfields_insert = result.v_formfields_insert + result.v_name + "=" + result.v_value + "&";
271                                                 result.v_formfields_generate = result.v_formfields_generate + result.v_name.substring(0, result.v_name.indexOf("_auto")) + "=" + result.v_value + "&";
272                                         }
273                                 } else {
274                                         result.v_formfields_insert = result.v_formfields_insert + column_value + "&";
275                                         result.v_formfields_generate = result.v_formfields_generate + column_value + "&";
276                                 }
277
278                         } else if ("DAILY".equals(v_recurrence)) {
279                                 if (column_value.indexOf("_auto") > 0) {
280                                         result.v_name = column_value.substring(0, column_value.indexOf('='));
281                                         result.v_date = schedulerUtil.to_date(column_value.substring(column_value.indexOf('=') + 1), "mm/dd/yyyy");
282                                         result.v_value = schedulerUtil.add_months(result.v_date, 1).toString();
283
284                                         if (result.v_name.length() > 0) {
285                                                 result.v_formfields_insert = result.v_formfields_insert + result.v_name + "=" + result.v_value + "&";
286                                                 result.v_formfields_generate = result.v_formfields_generate + result.v_name.substring(0, result.v_name.indexOf("_auto")) + "=" + result.v_value + "&";
287                                         }
288                                 } else {
289                                         result.v_formfields_insert = result.v_formfields_insert + column_value + "&";
290                                         result.v_formfields_generate = result.v_formfields_generate + column_value + "&";
291                                 }
292
293                         } else if ("DAILY_MO_FR".equals(v_recurrence)) {
294                                 if (column_value.indexOf("_auto") > 0) {
295                                         result.v_name = column_value.substring(0, column_value.indexOf('='));
296                                         result.v_date = schedulerUtil.to_date(column_value.substring(column_value.indexOf('=') + 1), "mm/dd/yyyy");
297                                         SimpleDateFormat sdf = new SimpleDateFormat("EEE");
298                                         sdf.format(result.v_date);
299                                         if ("FRI".equals(result.v_date.toString())) {
300                                                 result.v_date = schedulerUtil.add_days(result.v_date, 3);
301                                         } else if ("SAT".equals(result.v_date.toString())) {
302                                                 result.v_date = schedulerUtil.add_days(result.v_date, 2);
303                                         } else {
304                                                 result.v_date = schedulerUtil.add_days(result.v_date, 1);
305                                         }
306                                         result.v_value = result.v_date.toString();
307                                         if (result.v_name.length() > 0) {
308                                                 result.v_formfields_insert = result.v_formfields_insert + result.v_name + "=" + result.v_value + "&";
309                                                 result.v_formfields_generate = result.v_formfields_generate + result.v_name.substring(0, result.v_name.indexOf("_auto")) + "=" + result.v_value + "&";
310                                         }
311
312                                 } else {
313                                         result.v_formfields_insert = result.v_formfields_insert + column_value + "&";
314                                         result.v_formfields_generate = result.v_formfields_generate + column_value + "&";
315                                 }
316
317                         } else if ("HOURLY".equals(v_recurrence)) {
318                                 
319                                 result.v_name = column_value.indexOf('=')>0?column_value.substring(0, column_value.indexOf('=')) : "";
320                                 if (column_value.indexOf("_auto") > 0) {
321                                         
322                                         
323                                         String[] column_values2 = schedulerUtil.cr_dissecturl(p_formfields, "&");
324                                         
325                                         for(String column_value2 : column_values2){
326                                                 
327                                                 String key = column_value2.substring(0, column_value2.indexOf("="));
328                                                 if(key.equals(result.v_name.substring(0, result.v_name.indexOf("_auto")))  || key.equals(result.v_name.substring(0, result.v_name.indexOf("_Hr")))){
329                                                         result.v_hour = column_value2;
330                                                 }
331                                         }
332                                         
333 //                                      schedulerUtil.getAndExecute("select c.column_value from table(CR_DISSECTURL(p_formfields)) c where substr(c.column_value, 1, instr(c.column_value, '=')-1) = substr(" + result.v_name + ",1,instr(" + result.v_name + ",'_auto')-1)||'_Hr'", new Executor() {
334 //
335 //                                              @Override
336 //                                              public void execute(ResultSet rs) throws SQLException {
337 //
338 //                                                      result.v_hour = rs.getString("column_value");
339 //                                              }
340 //
341 //                                      });
342
343                                         if (result.v_hour.length() > 0) {
344                                                 result.v_hour_value = result.v_hour.substring(result.v_hour.indexOf('=') + 1);
345                                         }
346
347                                         result.v_date = schedulerUtil.to_date(column_value.substring(column_value.indexOf('=') + 1) + " " + result.v_hour_value, "mm/dd/yyyy HH24:MI:SS");
348
349                                         result.v_value = schedulerUtil.to_date_str(schedulerUtil.add_hours(result.v_date, 1), "mm/dd/yyyy HH24");
350
351                                         if (result.v_name.length() > 0) {
352                                                 if (result.v_hour.length() > 0) {
353
354                                                         result.v_formfields_insert = result.v_formfields_insert + result.v_name + "=" + result.v_value.substring(0, 10) + "&" + result.v_name.substring(0, result.v_name.indexOf("_auto")) + "_Hr=" + result.v_value.substring(11, 13);
355                                                         result.v_formfields_generate = result.v_formfields_generate + result.v_name.substring(0, result.v_name.indexOf("_auto")) + "=" + result.v_value.substring(0, 10) + "&" + result.v_name.substring(0, result.v_name.indexOf("_auto")) + "_Hr="
356                                                                         + result.v_value.substring(11, 13) + "&";
357
358                                                 } else {
359                                                         result.v_formfields_insert = result.v_formfields_insert + result.v_name + "=" + result.v_value + "&";
360                                                         result.v_formfields_generate = result.v_formfields_generate + result.v_name.substring(0, result.v_name.indexOf("_auto")) + "=" + result.v_value + "&";
361                                                 }
362                                         }
363                                 }
364                                 if (column_value.indexOf("_Hr") <= 0) {
365                                         result.v_formfields_insert = result.v_formfields_insert + column_value + "&";
366                                         result.v_formfields_generate = result.v_formfields_generate + column_value + "&";
367                                 }
368                         } else if ("WEEKLY".equals(v_recurrence)) {
369
370                                 if (column_value.indexOf("_auto") > 0) {
371                                         result.v_name = column_value.substring(0, column_value.indexOf('='));
372                                         result.v_date = schedulerUtil.to_date(column_value.substring(column_value.indexOf('=') + 1), "mm/dd/yyyy");
373                                         result.v_value = schedulerUtil.add_days(result.v_date, 7).toString();
374
375                                         if (result.v_name.length() > 0) {
376                                                 result.v_formfields_insert = result.v_formfields_insert + result.v_name + "=" + result.v_value + "&";
377                                                 result.v_formfields_generate = result.v_formfields_generate + result.v_name.substring(0, result.v_name.indexOf("_auto")) + "=" + result.v_value + "&";
378                                         }
379
380                                 } else {
381                                         result.v_formfields_insert = result.v_formfields_insert + column_value + "&";
382                                         result.v_formfields_generate = result.v_formfields_generate + column_value + "&";
383                                 }
384
385                         } else {
386                                 if (column_value.indexOf("_auto") > 0) {
387                                         result.v_name = column_value.substring(0, column_value.indexOf('='));
388                                         result.v_date = schedulerUtil.to_date(column_value.substring(column_value.indexOf('=') + 1), "mm/dd/yyyy");
389                                         result.v_value = schedulerUtil.add_days(result.v_date, 7).toString();
390                                         if (result.v_name.length() > 0) {
391                                                 result.v_formfields_insert = result.v_formfields_insert + result.v_name + "=" + result.v_value + "&";
392                                                 result.v_formfields_generate = result.v_formfields_generate + result.v_name.substring(0, result.v_name.indexOf("_auto")) + "=" + result.v_value + "&";
393                                         }
394
395                                 } else {
396                                         result.v_formfields_insert = result.v_formfields_insert + column_value + "&";
397                                         result.v_formfields_generate = result.v_formfields_generate + column_value + "&";
398                                 }
399                         }
400                 }
401
402                 schedulerUtil.insertOrUpdate("update CR_REPORT_SCHEDULE set processed_formfields ='" + result.v_formfields_insert + "' where schedule_id =" + v_schedule_id);
403                 return "&" + result.v_formfields_generate.substring(0, result.v_formfields_generate.length());
404         }
405
406         private int get_report_sched_offset(int p_rep_id, int p_schedule_id) throws SQLException, ReportSQLException {
407
408                 class CrReportSchedule {
409
410                         Date run_date;
411                         String recurrence;
412                 }
413                 Date v_last_date = null;
414                 Date v_sysdate = new Date();
415
416                 final CrReportSchedule v_report_schedule_rec = new CrReportSchedule();
417
418                 schedulerUtil.getAndExecute("SELECT * FROM cr_report_schedule WHERE rep_id = " + p_rep_id + " and schedule_id = " + p_schedule_id, new Executor() {
419
420                         @Override
421                         public void execute(ResultSet rs) throws SQLException {
422
423                                 v_report_schedule_rec.recurrence = rs.getString("recurrence");
424                                 java.sql.Timestamp runDate = rs.getTimestamp("run_date");
425                                 v_report_schedule_rec.run_date = new Date(runDate.getTime()) ;
426                         }
427
428                 });
429
430                 if (v_report_schedule_rec.run_date == null || v_report_schedule_rec.run_date.compareTo(v_sysdate) > 0) {
431                         return Integer.MAX_VALUE;
432                 }
433
434                 Date v_next_date = v_report_schedule_rec.run_date;
435
436                 while (v_next_date.compareTo(v_sysdate) < 0) {
437                         
438                         if ("HOURLY".equals(v_report_schedule_rec.recurrence)) {
439                                 v_next_date = SchedulerUtil.add_hours(v_next_date, 1);
440                         } else if ("DAILY".equals(v_report_schedule_rec.recurrence)) {
441                                 v_next_date = SchedulerUtil.add_days(v_next_date, 1);
442                         } else if ("DAILY_MO_FR".equals(v_report_schedule_rec.recurrence)) {
443                                 SimpleDateFormat sdf = new SimpleDateFormat("EEE");
444                                 sdf.format(v_next_date);
445                                 if ("FRI".equals(v_next_date.toString())) {
446                                         v_next_date = SchedulerUtil.add_days(v_next_date, 3);
447                                 } else if ("SAT".equals(v_next_date.toString())) {
448                                         v_next_date = SchedulerUtil.add_days(v_next_date, 2);
449                                 } else {
450                                         v_next_date = SchedulerUtil.add_days(v_next_date, 1);
451                                 }
452                         } else if ("WEEKLY".equals(v_report_schedule_rec.recurrence)) {
453                                 v_next_date = SchedulerUtil.add_days(v_next_date, 7);
454                         } else if ("MONTHLY".equals(v_report_schedule_rec.recurrence)) {
455                                 v_next_date = SchedulerUtil.add_months(v_next_date, 1);
456                         } else {
457                                 break;
458                         }
459                         v_last_date = v_next_date;
460                 }
461
462                 if (SchedulerUtil.trunc_hour(v_last_date).compareTo(SchedulerUtil.trunc_hour(v_sysdate)) == 0) {
463                         return (int)(Math.abs (v_sysdate.getTime() - v_last_date.getTime()) / 1000);
464                 } else {
465                         // More than an hour
466                         return 3601;
467                 }
468         }
469
470         public SchedulerUtil getSchedulerUtil() {
471                 return schedulerUtil;
472         }
473
474         public void setSchedulerUtil(SchedulerUtil schedulerUtil) {
475                 this.schedulerUtil = schedulerUtil;
476         }
477
478 }