* @return an ErrorResponse value object in case of errors, VOResponse if the operation is successfully completed
*/
public Response insertRecord(ValueObject newPersistentObject) throws Exception {
Response response = super.insertRecord(newPersistentObject);
if (!response.isError()) {
ScheduledActivityVO vo = (ScheduledActivityVO)((VOResponse)response).getVo();
ScheduledEmployeeVO schEmpVO = new ScheduledEmployeeVO();
schEmpVO.setCompanyCodeSys01SCH07(vo.getCompanyCodeSys01SCH06());
schEmpVO.setDescriptionSYS10(empVO.getTaskDescriptionSYS10());
schEmpVO.setDurationSCH07(vo.getEstimatedDurationSCH06());
schEmpVO.setEmployeeCodeSCH01(empVO.getEmployeeCodeSCH01());
schEmpVO.setEndDateSCH07(vo.getEstimatedEndDateSCH06());
schEmpVO.setProgressiveReg04SCH07(empVO.getProgressiveReg04SCH01());
schEmpVO.setProgressiveSch06SCH07(vo.getProgressiveSCH06());
schEmpVO.setStartDateSCH07(vo.getStartDateSCH06());
schEmpVO.setTaskCodeREG07(empVO.getTaskCodeReg07SCH01());
ArrayList list = new ArrayList();
list.add(schEmpVO);
Response res = ClientUtils.getData("insertScheduledEmployees",list);
if (res.isError())
return res;
else
setEmployeeVO(empVO);
}
return response;
}
};
ScheduledActivityVO vo = (ScheduledActivityVO)c.getDetailFrame().getMainForm().getVOModel().getValueObject();
int h = newApp[1]/hourH;
int m = (newApp[1]-h*hourH)*69/hourH;
Calendar cal = Calendar.getInstance();
cal.setTime(currentDay);
cal.set(cal.HOUR_OF_DAY,h);
cal.set(cal.MINUTE,m);
vo.setStartDateSCH06(new java.sql.Timestamp(cal.getTimeInMillis()));
h = newApp[3]/hourH;
m = (newApp[3]-h*hourH)*60/hourH;
cal.setTime(currentDay);
cal.set(cal.HOUR_OF_DAY,h);
cal.set(cal.MINUTE,m);
vo.setEstimatedEndDateSCH06(new java.sql.Timestamp(cal.getTimeInMillis()));
vo.setEstimatedDurationSCH06(new BigDecimal((vo.getEstimatedEndDateSCH06().getTime()-vo.getStartDateSCH06().getTime())/60000));
c.getDetailFrame().getMainForm().getForm().pull();
newApp = null;
repaint();
}
public void mouseClicked(MouseEvent e) {
if (SwingUtilities.isLeftMouseButton(e) &&
(e.getClickCount()==1 || e.getClickCount()==2)) {
Enumeration en = appointments.keys();
int[] app = null;
selectedApp = null;
while(en.hasMoreElements()) {
app = (int[])en.nextElement();
if (e.getX()>=app[0] && e.getX()<=app[2] && e.getY()>=app[1] && e.getY()<=app[3]) {
selectedApp = app;
break;
}
}
Day.this.repaint();
if (selectedApp!=null && e.getClickCount()==2) {
EmployeeActivityVO vo = (EmployeeActivityVO)appointments.get(selectedApp);
ScheduledActivityController c = new ScheduledActivityController(null,null,new ScheduledActivityPK(
vo.getCompanyCodeSys01SCH06(),
vo.getProgressiveSCH06()
),false) {
public void afterInsertData() {
super.afterInsertData();
setEmployeeVO(empVO);
}