/* saves a newly added category to the org database */ public boolean addCategory(String name) { if (!_orgDataSet.isKnownNonHumanCategoryName(name)) { NonHumanCategory category = new NonHumanCategory(name); storeSimpleFieldValues(category); category.addSubCategory("None"); String newID = _orgDataSet.addNonHumanCategory(category); if (_rm.successful(newID)) { _sb.setNhResourcesChoice(newID); return true; } else _msgPanel.error(_msgPanel.format(newID)); } else addDuplicationError("Category"); return false; }
/* saves a newly added resource to the org database */ public boolean addResource(String name) { if (!_orgDataSet.isKnownNonHumanResourceName(name)) { String catID = (String) cbbCategory.getSelected(); NonHumanCategory category = _orgDataSet.getNonHumanCategory(catID); String subCat = (String) cbbSubCategory.getSelected(); NonHumanResource resource = _sb.getSelectedNonHumanResource(); if (resource == null) resource = new NonHumanResource(); resource.setName(name); resource.setCategory(category); resource.setSubCategory(subCat); resource.setDescription((String) txtDesc.getText()); resource.setNotes((String) txtNotes.getText()); String newID = _orgDataSet.addNonHumanResource(resource); if (_rm.successful(newID)) { updateSelectedResource(resource, false); _sb.setNhResourcesChoice(newID); return true; } else _msgPanel.error(_msgPanel.format(newID)); } else addDuplicationError("Resource"); return false; }