コード例 #1
0
  @PostConstruct
  public void controllerSetup() {
    logger.debug("Start init of EntityController");
    ExternalContext extContext = FacesContext.getCurrentInstance().getExternalContext();
    String entity = extContext.getRequestParameterMap().get("entityClassName");
    this.setEntityClassName(entity);
    ejb.setEntityClass(this.getEntityClassName());
    this.entityClass = ejb.getEntityClass();
    Properties props = this.ejb.getEntityProperties(this.getEntityClass());

    if (props != null) {
      columns = new ArrayList<ColumnModel>();
      Enumeration<?> i = props.keys();

      while (i.hasMoreElements()) {
        String key = (String) i.nextElement();
        columns.add(new ColumnModel(props.getProperty(key), key));
      }
    }

    this.getLazyDataModel().setEntityClass(entity);
    this.getLazyDataModel().init();
    logger.debug("Data filled for entity " + entity);
    this.setCurrentEntity(null);
  }
コード例 #2
0
 public String delete() {
   ejb.remove(this.getCurrentEntity());
   updateTable(null);
   return "";
 }
コード例 #3
0
 public String save() {
   ejb.update(this.getCurrentEntity());
   updateTable(this.getCurrentEntity());
   return "";
 }