Package org.jallinone.scheduler.activities.java

Examples of org.jallinone.scheduler.activities.java.EmployeeActivityVO


  /**
   * Callback method invoked when the user has clicked on the insert button
   * @param valueObject empty value object just created: the user can manage it to fill some attribute values
   */
  public void createValueObject(ValueObject valueObject) throws Exception {
    EmployeeActivityVO vo = (EmployeeActivityVO)valueObject;
    DetailEmployeeVO empVO = (DetailEmployeeVO)detailFrame.getForm().getVOModel().getValueObject();
    vo.setCompanyCodeSys01SCH06((String)grid.getOtherGridParams().get(ApplicationConsts.COMPANY_CODE_SYS01));
    vo.setProgressiveReg04SCH07((BigDecimal)grid.getOtherGridParams().get(ApplicationConsts.PROGRESSIVE_REG04));
    vo.setStartDateSCH07(new java.sql.Timestamp(System.currentTimeMillis()));
    vo.setEndDateSCH07(new java.sql.Timestamp(System.currentTimeMillis()));
    vo.setDurationSCH07(new BigDecimal(0));
    vo.setEmployeeCodeSCH01(empVO.getCompanyCodeSys01SCH01());
  }
View Full Code Here


  public Response insertRecords(int[] rowNumbers, ArrayList newValueObjects) throws Exception {
    ValueObject newValueObject = (ValueObject)newValueObjects.get(0);
    if (!checkTimes((EmployeeActivityVO)newValueObject)) {
      return new ErrorResponse(ClientSettings.getInstance().getResources().getResource("start time must be less than end time"));
    }
    EmployeeActivityVO vo = (EmployeeActivityVO)newValueObject;
    ScheduledActivityVO actVO = new ScheduledActivityVO();
    actVO.setCompanyCodeSys01SCH06(vo.getCompanyCodeSys01SCH06());
    actVO.setCompletionPercSCH06(new BigDecimal(0));
    actVO.setDescriptionSCH06(vo.getDescriptionSCH06());
    actVO.setEstimatedDurationSCH06(vo.getDurationSCH07());
    actVO.setEstimatedEndDateSCH06(vo.getEndDateSCH07());
    actVO.setPrioritySCH06(ApplicationConsts.PRIORITY_NORMAL);
    actVO.setStartDateSCH06(vo.getStartDateSCH07());
    actVO.setActivityTypeSCH06(vo.getActivityTypeSCH06());
    actVO.setActivityStateSCH06(ApplicationConsts.OPENED);
    Response res = ClientUtils.getData("insertScheduledActivity",actVO);
    if (res.isError())
      return res;
    actVO = (ScheduledActivityVO)((VOResponse)res).getVo();
    ScheduledEmployeeVO schEmpVO = new ScheduledEmployeeVO();
    schEmpVO.setCompanyCodeSys01SCH07(actVO.getCompanyCodeSys01SCH06());
    schEmpVO.setProgressiveReg04SCH07(vo.getProgressiveReg04SCH07());
    schEmpVO.setDurationSCH07(vo.getDurationSCH07());
    schEmpVO.setStartDateSCH07(actVO.getStartDateSCH06());
    schEmpVO.setEndDateSCH07(vo.getEndDateSCH07());
    schEmpVO.setProgressiveSch06SCH07(actVO.getProgressiveSCH06());
    ArrayList list = new ArrayList();
    list.add(schEmpVO);
    res = ClientUtils.getData("insertScheduledEmployees",list);
    if (res.isError())
      return res;
    vo.setProgressiveSCH06(actVO.getProgressiveSCH06());

    return res;
  }
View Full Code Here

   * Method invoked when the user has clicked on delete button and the grid is in READONLY mode.
   * @param persistentObjects value objects to delete (related to the currently selected rows)
   * @return an ErrorResponse value object in case of errors, VOResponse if the operation is successfully completed
   */
  public Response deleteRecords(ArrayList persistentObjects) throws Exception {
    EmployeeActivityVO vo = null;
    ScheduledActivityPK pk = null;
    ArrayList rows = new ArrayList();
    for(int i=0;i<persistentObjects.size();i++) {
      vo = (EmployeeActivityVO)persistentObjects.get(i);
      pk = new ScheduledActivityPK(
        vo.getCompanyCodeSys01SCH06(),
        vo.getProgressiveSCH06()
      );
      rows.add(pk);
    }

    return ClientUtils.getData("deleteScheduledActivities",rows);
View Full Code Here

   * @param oldValue old cell value (before cell editing)
   * @param newValue new cell value (just edited)
   * @return <code>true</code> if cell value is valid, <code>false</code> otherwise
   */
  public boolean validateCell(int rowNumber,String attributeName,Object oldValue,Object newValue) {
    EmployeeActivityVO vo = (EmployeeActivityVO)grid.getVOListTableModel().getObjectForRow(rowNumber);
    if (attributeName.equals("activityTypeSCH06") && newValue!=null) {
      if (newValue.equals(ApplicationConsts.ACT_ABSENCE)) {
        vo.setDescriptionSCH06(ClientSettings.getInstance().getResources().getResource("absence"));
      }
      else if (newValue.equals(ApplicationConsts.ACT_HOLIDAY)) {
        vo.setDescriptionSCH06(ClientSettings.getInstance().getResources().getResource("holiday"));
      }
      else if (newValue.equals(ApplicationConsts.ACT_ILLNESS)) {
        vo.setDescriptionSCH06(ClientSettings.getInstance().getResources().getResource("illness"));
      }
    }

    if ((attributeName.equals("endDateSCH07")) &&
        newValue!=null && vo.getStartDateSCH07()!=null) {
      vo.setDurationSCH07(new BigDecimal(
        (((java.util.Date)newValue).getTime()-vo.getStartDateSCH07().getTime())/1000/60
      ));
    }
    else if ((attributeName.equals("startDateSCH07")) &&
        newValue!=null && vo.getEndDateSCH07()!=null) {
      vo.setDurationSCH07(new BigDecimal(
        (vo.getEndDateSCH07().getTime()-((java.util.Date)newValue).getTime())/1000/60
      ));
    }



View Full Code Here

              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);
              }
View Full Code Here

      g.setColor(Color.black);
      g.drawString(String.valueOf(i)+":00",2,i*hourH+12);
    }

    // fill in all appointments that are absences...
    EmployeeActivityVO vo = null;
    int startW = 0;
    Calendar day = Calendar.getInstance();
    day.setTime(currentDay);
    appointments.clear();
    for(int i=0;i<rows.size();i++) {
      vo = (EmployeeActivityVO)rows.get(i);
      if (!vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_ABSENCE) &&
          !vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_HOLIDAY) &&
          !vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_ILLNESS))
        continue;
      if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_CALL_OUT))
        g.setColor(new Color(240,200,200));
      else if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_APPOINTMENT))
        g.setColor(new Color(250,210,200));
      else if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_PHONE_CALL))
        g.setColor(new Color(240,210,200));
      else if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_MEETING))
        g.setColor(new Color(250,220,200));
      else if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_SEND_EMAIL))
        g.setColor(new Color(240,220,200));
      else if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_SEND_FAX))
        g.setColor(new Color(250,230,200));
      else if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_ABSENCE))
        g.setColor(new Color(230,230,230));
      else if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_HOLIDAY))
        g.setColor(new Color(220,220,220));
      else if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_ILLNESS))
        g.setColor(new Color(225,225,225));
      else
        g.setColor(new Color(240,230,200));

      cal.setTime(vo.getStartDateSCH07());
      startH = 0;
      startM = 0;
      if (cal.get(cal.DAY_OF_MONTH)==day.get(day.DAY_OF_MONTH)) {
        startH = cal.get(cal.HOUR_OF_DAY);
        startM = cal.get(cal.MINUTE);
      }

      cal.setTime(vo.getEndDateSCH07());
      endH = 24;
      endM = 60;
      if (cal.get(cal.DAY_OF_MONTH)==day.get(day.DAY_OF_MONTH)) {
        endH = cal.get(cal.HOUR_OF_DAY);
        endM = cal.get(cal.MINUTE);
      }

      g.fillRect(
        hourW,
        startH*hourH+startM*hourH/60,
        getWidth()-hourW,
        (endH-startH)*hourH-startM*hourH/60+endM*hourH/60
      );
      g.setColor(Color.gray);
      g.drawRect(
        hourW,
        startH*hourH+startM*hourH/60,
        getWidth()-hourW,
        (endH-startH)*hourH-startM*hourH/60+endM*hourH/60
      );
      g.setColor(Color.black);
      g.drawString(
        sdf.format(vo.getStartDateSCH07())+" - "+vo.getDescriptionSCH06(),
        hourW+3,
        startH*hourH+startM*hourH/60+14
      );
      appointments.put(new int[]{
        hourW,
        startH*hourH+startM*hourH/60,
        getWidth()-hourW,
        endH*hourH+endM*hourH/60
      },vo);
    }

    // fill in all appointments that are not absences...
    for(int i=0;i<rows.size();i++) {
      vo = (EmployeeActivityVO)rows.get(i);
      if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_ABSENCE) ||
          vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_HOLIDAY) ||
          vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_ILLNESS))
        continue;
      if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_CALL_OUT))
        g.setColor(new Color(240,200,200));
      else if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_APPOINTMENT))
        g.setColor(new Color(250,210,200));
      else if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_PHONE_CALL))
        g.setColor(new Color(240,210,200));
      else if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_MEETING))
        g.setColor(new Color(250,220,200));
      else if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_SEND_EMAIL))
        g.setColor(new Color(240,220,200));
      else if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_SEND_FAX))
        g.setColor(new Color(250,230,200));
      else if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_ABSENCE))
        g.setColor(new Color(230,230,230));
      else if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_HOLIDAY))
        g.setColor(new Color(220,220,220));
      else if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_ILLNESS))
        g.setColor(new Color(225,225,225));
      else
        g.setColor(new Color(240,230,200));

      cal.setTime(vo.getStartDateSCH07());
      startH = 0;
      startM = 0;
      if (cal.get(cal.DAY_OF_MONTH)==day.get(day.DAY_OF_MONTH)) {
        startH = cal.get(cal.HOUR_OF_DAY);
        startM = cal.get(cal.MINUTE);
      }

      cal.setTime(vo.getEndDateSCH07());
      endH = 24;
      endM = 60;
      if (cal.get(cal.DAY_OF_MONTH)==day.get(day.DAY_OF_MONTH)) {
        endH = cal.get(cal.HOUR_OF_DAY);
        endM = cal.get(cal.MINUTE);
      }

      startW = getNextW(startW,startH*hourH+startM*hourH/60,endH*hourH+endM*hourH/60);

      g.fillRect(
        hourW+startW,
        startH*hourH+startM*hourH/60,
        appW,
        (endH-startH)*hourH-startM*hourH/60+endM*hourH/60
      );
      g.setColor(Color.gray);
      g.drawRect(
        hourW+startW,
        startH*hourH+startM*hourH/60,
        appW,
        (endH-startH)*hourH-startM*hourH/60+endM*hourH/60
      );
      g.setColor(Color.black);
      g.drawString(
        sdf.format(vo.getStartDateSCH07())+" - "+vo.getDescriptionSCH06(),
        hourW+startW+3,
        startH*hourH+startM*hourH/60+14
      );
      appointments.put(new int[]{
        hourW+startW,
View Full Code Here

      return;
    }

    java.util.List rows = ((VOListResponse)res).getRows();
    if (rows.size()>0) {
      EmployeeActivityVO vo = (EmployeeActivityVO)rows.get(0);
      Calendar cal = Calendar.getInstance();
      cal.setTime(vo.getStartDateSCH07());
      calendar.setCalendar(cal);
      cal.setTime(vo.getStartDateSCH07());
      cal.set(cal.DAY_OF_MONTH,cal.get(cal.DAY_OF_MONTH)+1);
      cal.set(cal.HOUR_OF_DAY,0);
      cal.set(cal.MINUTE,0);
      cal.set(cal.SECOND,0);
      cal.set(cal.MILLISECOND,0);
      controlFromDate.setValue(cal.getTime());
      day.setCurrentDay(vo.getStartDateSCH07());
    }
    else {
      JOptionPane.showMessageDialog(
          ClientUtils.getParentFrame(this),
          ClientSettings.getInstance().getResources().getResource("no appointment found"),
View Full Code Here

TOP

Related Classes of org.jallinone.scheduler.activities.java.EmployeeActivityVO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.