Beispiel #1
0
  public void addDirectly() {
    JsfUtil.addSuccessMessage("1");
    try {

      current.setCreatedAt(Calendar.getInstance().getTime());
      current.setCreater(sessionController.loggedUser);

      getFacade().create(current);
      JsfUtil.addSuccessMessage(new MessageProvider().getValue("savedNewSuccessfully"));
      current = new MohArea();
    } catch (Exception e) {
      JsfUtil.addErrorMessage(e, "Error");
    }
  }
Beispiel #2
0
 public MohArea searchItem(String itemName, boolean createNewIfNotPresent) {
   MohArea searchedItem = null;
   items = new ListDataModel(getFacade().findAll("name", itemName, true));
   if (items.getRowCount() > 0) {
     items.setRowIndex(0);
     searchedItem = (MohArea) items.getRowData();
   } else if (createNewIfNotPresent) {
     searchedItem = new MohArea();
     searchedItem.setName(itemName);
     searchedItem.setCreatedAt(Calendar.getInstance().getTime());
     searchedItem.setCreater(sessionController.loggedUser);
     getFacade().create(searchedItem);
   }
   return searchedItem;
 }
Beispiel #3
0
 public void saveSelected() {
   if (sessionController.getPrivilege().isDemographyEdit() == false) {
     JsfUtil.addErrorMessage("You are not autherized to make changes to any content");
     return;
   }
   if (selectedItemIndex > 0) {
     getFacade().edit(current);
     JsfUtil.addSuccessMessage(new MessageProvider().getValue("savedOldSuccessfully"));
   } else {
     current.setCreatedAt(Calendar.getInstance().getTime());
     current.setCreater(sessionController.loggedUser);
     getFacade().create(current);
     JsfUtil.addSuccessMessage(new MessageProvider().getValue("savedNewSuccessfully"));
   }
   this.prepareSelect();
   recreateModel();
   getItems();
   selectText = "";
   selectedItemIndex = intValue(current.getId());
 }