attribute2dbField.put("dismissalDateSCH01","DISMISSAL_DATE");
attribute2dbField.put("managerCompanyCodeSys01SCH01","COMPANY_CODE_SYS01_MAN_SCH01");
attribute2dbField.put("assistantCompanyCodeSys01SCH01","COMPANY_CODE_SYS01_ASS_SCH01");
// insert into SCH01...
Response res = CustomizeQueryUtil.insertTable(
conn,
new UserSessionParameters(username),
vo,
"SCH01_EMPLOYEES",
attribute2dbField,
"Y",
"N",
null,
true,
customizedFields
);
Response answer = new VOResponse(vo);
// retrieve default company calendar settings...
Response calRes = loadPars.loadCompanyParams(vo.getCompanyCodeSys01SCH01(),serverLanguageId,username);
if (calRes.isError()) {
throw new Exception(calRes.getErrorMessage());
}
CompanyParametersVO compCalVO = (CompanyParametersVO)((VOResponse)calRes).getVo();
Calendar cal = Calendar.getInstance();
cal.set(cal.DAY_OF_MONTH,1);
cal.set(cal.MONTH,0);
cal.set(cal.YEAR,0);
cal.set(cal.HOUR_OF_DAY,8);
cal.set(cal.MINUTE,0);
cal.set(cal.SECOND,0);
cal.set(cal.MILLISECOND,0);
Timestamp morningStartHour = compCalVO.getMorningStartHourSCH02();
if (morningStartHour==null)
morningStartHour = new java.sql.Timestamp(cal.getTimeInMillis());
Timestamp morningEndHour = compCalVO.getMorningStartHourSCH02();
cal.set(cal.HOUR_OF_DAY,12);
if (morningEndHour==null)
morningEndHour = new java.sql.Timestamp(cal.getTimeInMillis());
cal.set(cal.HOUR_OF_DAY,13);
Timestamp afternoonStartHour = compCalVO.getMorningStartHourSCH02();
if (afternoonStartHour==null)
afternoonStartHour= new java.sql.Timestamp(cal.getTimeInMillis());
cal.set(cal.HOUR_OF_DAY,17);
Timestamp afternoonEndHour = compCalVO.getMorningStartHourSCH02();
if (afternoonEndHour==null)
afternoonEndHour = new java.sql.Timestamp(cal.getTimeInMillis());
// insert employee calendar, according to the company calendar default settings...
EmployeeCalendarVO calVO = new EmployeeCalendarVO();
calVO.setCompanyCodeSys01SCH02(vo.getCompanyCodeSys01SCH01());
calVO.setProgressiveReg04SCH02(vo.getProgressiveReg04SCH01());
calVO.setMorningStartHourSCH02(DateUtils.setTime(morningStartHour));
calVO.setMorningEndHourSCH02(DateUtils.setTime(morningEndHour));
calVO.setAfternoonStartHourSCH02(DateUtils.setTime(afternoonStartHour));
calVO.setAfternoonEndHourSCH02(DateUtils.setTime(afternoonEndHour));
calVO.setDayOfWeekSCH02(String.valueOf(Calendar.MONDAY));
ArrayList list = new ArrayList();
list.add(calVO);
calRes = calbean.insertEmployeeCalendars(list,serverLanguageId,username);
if (calRes.isError()) {
throw new Exception(calRes.getErrorMessage());
}
calVO.setDayOfWeekSCH02(String.valueOf(Calendar.TUESDAY));
list.clear();
list.add(calVO);
calRes = calbean.insertEmployeeCalendars(list,serverLanguageId,username);
if (calRes.isError()) {
throw new Exception(calRes.getErrorMessage());
}
calVO.setDayOfWeekSCH02(String.valueOf(Calendar.WEDNESDAY));
list.clear();
list.add(calVO);
calRes = calbean.insertEmployeeCalendars(list,serverLanguageId,username);
if (calRes.isError()) {
throw new Exception(calRes.getErrorMessage());
}
calVO.setDayOfWeekSCH02(String.valueOf(Calendar.THURSDAY));
list.clear();
list.add(calVO);
calRes = calbean.insertEmployeeCalendars(list,serverLanguageId,username);
if (calRes.isError()) {
throw new Exception(calRes.getErrorMessage());
}
calVO.setDayOfWeekSCH02(String.valueOf(Calendar.FRIDAY));
list.clear();
list.add(calVO);
calRes = calbean.insertEmployeeCalendars(list,serverLanguageId,username);
if (calRes.isError()) {
throw new Exception(calRes.getErrorMessage());
}
if (answer.isError()) throw new Exception(answer.getErrorMessage()); else return (VOResponse)answer;
}
catch (Throwable ex) {