ItEr54S09AdaptacionServiciosRESTItEr53S10: Moved the creation of the MaterialCategory entities from XXController to XXModel.
This change will be necessary when we add the attribute generateCode to that entity.
This commit is contained in:
parent
eecea3e7e2
commit
17f2005e2d
3 changed files with 6 additions and 5 deletions
|
|
@ -36,7 +36,7 @@ import org.zkoss.ganttz.util.MutableTreeModel;
|
|||
*/
|
||||
public interface IMaterialsModel {
|
||||
|
||||
void addMaterialCategory(MaterialCategory parent, MaterialCategory child) throws ValidationException;
|
||||
void addMaterialCategory(MaterialCategory parent, String categoryName) throws ValidationException;
|
||||
|
||||
void addMaterialToMaterialCategory(MaterialCategory materialCategory);
|
||||
|
||||
|
|
|
|||
|
|
@ -248,14 +248,13 @@ public class MaterialsController extends
|
|||
throw new WrongValueException(txtCategory, _("cannot be null or empty"));
|
||||
}
|
||||
|
||||
final MaterialCategory category = MaterialCategory.create(_(categoryName));
|
||||
MaterialCategory parent = null;
|
||||
final Treeitem treeitem = categoriesTree.getSelectedItem();
|
||||
if (treeitem != null) {
|
||||
parent = (MaterialCategory) treeitem.getValue();
|
||||
}
|
||||
try {
|
||||
materialsModel.addMaterialCategory(parent, category);
|
||||
materialsModel.addMaterialCategory(parent, categoryName);
|
||||
txtCategory.setValue("");
|
||||
reloadCategoriesTree(treeitem);
|
||||
} catch (ValidationException e) {
|
||||
|
|
|
|||
|
|
@ -121,8 +121,10 @@ public class MaterialsModel implements IMaterialsModel {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void addMaterialCategory(MaterialCategory parent, MaterialCategory child) throws ValidationException {
|
||||
Validate.notNull(child);
|
||||
public void addMaterialCategory(MaterialCategory parent, String categoryName) throws ValidationException {
|
||||
Validate.notNull(categoryName);
|
||||
|
||||
MaterialCategory child = MaterialCategory.create(_(categoryName));
|
||||
|
||||
final MaterialCategory materialCategory = findMaterialCategory(child);
|
||||
if (materialCategory != null) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue