예제 #1
0
 private void sendNotification() {
   ConfigurationDataManager cdm = ConfigurationDataManager.getInstance();
   if (current.getTimeOffStatusid().equals(cdm.getDefaultStatus())) {
     cdm.updateConfigurationData();
     MailUtil.sendNewTimeOffRequestEmail(
         current.getEmployeeid().getName(), current.getStart(), current.getEnd());
     if (!cdm.isAdmin()) {
       cdm.clearData();
     }
   }
 }
예제 #2
0
  public List<TimeOff> getActiveTimeOffs() {
    List<TimeOff> all_items = ejbFacade.findAll();
    activeTimeOffs = new ArrayList();

    for (TimeOff to : all_items) {
      if (to.getEmployeeid().getIsActive()) {
        activeTimeOffs.add(to);
      }
    }
    Collections.sort(activeTimeOffs, Collections.reverseOrder());
    return activeTimeOffs;
  }
예제 #3
0
  public void prepareCreate(Employee empl, TimeOffStatus to) {
    super.prepareCreate();
    if (current != null) {
      TimeOffStatus status = null;
      if (to == null) {
        ConfigurationDataManager configDM = ConfigurationDataManager.getInstance();

        configDM.updateTimeOffStatusData();
        status = configDM.getDefaultStatus();
      } else {
        status = to;
      }
      current.setEmployeeid(empl);
      current.setTimeOffStatusid(status);
    }
  }
예제 #4
0
 public void createOrUpdate() {
   if (current.getPkid() != null) {
     super.update();
   } else {
     super.create();
   }
   sendNotification();
 }
예제 #5
0
 @Override
 public String getAsString(FacesContext facesContext, UIComponent component, Object object) {
   if (object == null) {
     return null;
   }
   if (object instanceof TimeOff) {
     TimeOff o = (TimeOff) object;
     return getStringKey(o.getPkid());
   } else {
     throw new IllegalArgumentException(
         "object "
             + object
             + " is of type "
             + object.getClass().getName()
             + "; expected type: "
             + TimeOff.class.getName());
   }
 }