public List<EntityClass> getEntityClasses() { if (entityClasses == null) { if (applicationFilterMBean.getSelectedApplication() != null && applicationFilterMBean.getSelectedModule() == null && applicationFilterMBean.getSelectedPackage() == null) { Application application = applicationFilterMBean.getApplication(); entityClasses = entityClassBean.findByApplication(application); } else if (applicationFilterMBean.getSelectedModule() != null && applicationFilterMBean.getSelectedPackage() == null) { Module module = applicationFilterMBean.getModule(); entityClasses = entityClassBean.findByModule(module); } else if (applicationFilterMBean.getSelectedPackage() != null) { Package pack = applicationFilterMBean.getPackage(); entityClasses = entityClassBean.findByPackage(pack); } } return entityClasses; }
public String saveAndCreateNew() { this.entityClass.setApplication(applicationFilterMBean.getApplication()); this.entityClass.setModule(applicationFilterMBean.getModule()); this.entityClass.setPack(applicationFilterMBean.getPackage()); if (this.selectedDatabaseElement != null) { DatabaseElement databaseElement = databaseElementBean.find(this.selectedDatabaseElement); this.entityClass.setDatabaseElement(databaseElement); } entityClassBean.save(this.entityClass); return "entity_class_form?faces-redirect=true&appId=" + this.entityClass.getApplication().getId() + "&modId=" + this.entityClass.getModule().getId() + "&pkgId=" + this.entityClass.getPack().getId(); }
@PostConstruct public void load() { if (id != null && id > 0) { this.entityClass = entityClassBean.find(id); this.applicationFilterMBean.setSelectedApplication(this.entityClass.getApplication().getId()); if (this.entityClass.getModule() != null) { this.applicationFilterMBean.setSelectedModule(this.entityClass.getModule().getId()); } if (this.entityClass.getPack() != null) { this.applicationFilterMBean.setSelectedPackage(this.entityClass.getPack().getId()); } if (this.entityClass.getDatabaseElement() != null) { this.selectedDatabaseElement = this.entityClass.getDatabaseElement().getId(); } } else { this.entityClass = new EntityClass(); this.entityClass.setApplication(applicationFilterMBean.getApplication()); this.entityClass.setModule(applicationFilterMBean.getModule()); this.entityClass.setPack(applicationFilterMBean.getPackage()); } }