public void updateCatalogEntry(String catalogId, String entryId, CCatalogEntry entry) throws InvalidConfigurationException { ValidationResponse vr = validator.validateCatalogEntry(entry); if (vr.getValidationErrors().size() > 0) { throw new InvalidConfigurationException(vr); } lock.lock(); try { CCatalog catalog = getCatalog(catalogId); CCatalogEntry current = getCatalogEntry(catalogId, entryId); if (current != null) { catalog.getEntries().remove(current); catalog.getEntries().add(entry); save(); } } finally { lock.unlock(); } }
public void createCatalog(CCatalog catalog) throws InvalidConfigurationException { lock.lock(); try { ValidationResponse vr = validator.validateCatalog(catalog); if (vr.getValidationErrors().size() > 0) { throw new InvalidConfigurationException(vr); } getConfiguration().getCatalogs().add(catalog); save(); } finally { lock.unlock(); } }
public void addCatalogEntry(String catalogId, CCatalogEntry catalogEntry) throws InvalidConfigurationException { CCatalog catalog = readCatalog(catalogId); catalogEntry.setId(idGenerator.generateId()); ValidationResponse vr = validator.validateCatalogEntry(catalogEntry); if (vr.getValidationErrors().size() > 0) { throw new InvalidConfigurationException(vr); } lock.lock(); try { catalog.addEntry(catalogEntry); save(); } finally { lock.unlock(); } }
public void createOrUpdateCatalog(CCatalog catalog) throws InvalidConfigurationException { ValidationResponse vr = validator.validateCatalog(catalog); if (vr.getValidationErrors().size() > 0) { throw new InvalidConfigurationException(vr); } lock.lock(); try { CCatalog current = getCatalog(catalog.getId()); if (current != null) { getConfiguration().getCatalogs().remove(current); } getConfiguration().getCatalogs().add(catalog); save(); } finally { lock.unlock(); } }