Ejemplo n.º 1
0
  public void saveSelected() {

    if (getCurrent().getId() != null && getCurrent().getId() > 0) {

      getFacade().edit(current);

      UtilityController.addSuccessMessage("savedOldSuccessfully");
    } else {
      current.setCreatedAt(Calendar.getInstance(TimeZone.getTimeZone("IST")).getTime());
      current.setCreater(getSessionController().getLoggedUser());
      getFacade().create(current);
      UtilityController.addSuccessMessage("savedNewSuccessfully");
    }
    recreateModel();
    getItems();
  }
Ejemplo n.º 2
0
  /** Delete the current PackageItem */
  public void delete() {

    if (current != null) {
      current.setRetired(true);
      current.setRetiredAt(Calendar.getInstance(TimeZone.getTimeZone("IST")).getTime());
      current.setRetirer(getSessionController().getLoggedUser());
      getFacade().edit(current);
      UtilityController.addSuccessMessage("DeleteSuccessfull");
    } else {
      UtilityController.addSuccessMessage("NothingToDelete");
    }
    recreateModel();
    getItems();
    current = null;
    getCurrent();
  }
Ejemplo n.º 3
0
 /**
  * @param facesContext
  * @param component
  * @param object
  * @return
  */
 @Override
 public String getAsString(FacesContext facesContext, UIComponent component, Object object) {
   if (object == null) {
     return null;
   }
   if (object instanceof PackageItem) {
     PackageItem o = (PackageItem) object;
     return getStringKey(o.getId());
   } else {
     throw new IllegalArgumentException(
         "object "
             + object
             + " is of type "
             + object.getClass().getName()
             + "; expected type: "
             + PackageItemController.class.getName());
   }
 }
Ejemplo n.º 4
0
  public void addToPackage() {
    if (getCurrentPackege() == null) {
      UtilityController.addErrorMessage("Please select a package");
      return;
    }
    if (getCurrentItem() == null) {
      UtilityController.addErrorMessage("Please select an item");
      return;
    }
    PackageItem pi = new PackageItem();

    pi.setPackege(getCurrentPackege());
    pi.setItem(getCurrentItem());
    pi.setCreatedAt(Calendar.getInstance(TimeZone.getTimeZone("IST")).getTime());
    pi.setCreater(sessionController.loggedUser);
    getFacade().create(pi);
    UtilityController.addSuccessMessage("Added");
    recreateModel();
  }