@Override public CategoryDimension build(GenericFactory<CategoryDimension> factory) { if (model == null) model = new CategoryDimension(); model.setDescription(description); model.setName(name); List<CategorizedApplicationBean> applications = getCategorizedApplications(); for (CategorizedApplicationBean categorizedApplicationBean : applications) { CategorizedApplication catapp = categorizedApplicationBean.getModel(); if (catapp != null) model.addCategorizedApplication(catapp); } return model; }
@Override public CategoryDimensionBean load(CategoryDimension model) { if (model == null) throw new IllegalStateException(); this.model = model; this.name = model.getName(); this.description = model.getDescription(); this.id = model.getId(); Set<Category> cats = model.getCategories(); for (Category category : cats) { categories.add(new CategoryBean().load(category)); } return this; }