in log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/controller/CatalogController.java [81:105]
public ResponseEntity<?> saveCatalog() {
CatalogData catalogData = new CatalogData();
List<Attribute> attributes = new ArrayList<>();
for (AttributeModel attributeModel : attributeService.getAttributes()) {
attributes.add(attributeModelConverter.convert(attributeModel));
}
catalogData.setAttributes(attributes);
List<Event> events = new ArrayList<>();
for (EventModel eventModel : eventService.getEvents()) {
events.add(eventModelConverter.convert(eventModel));
}
catalogData.setEvents(events);
List<Category> categories = new ArrayList<>();
for (CategoryModel categoryModel : categoryService.getCategories()) {
categories.add(categoryModelConverter.convert(categoryModel));
}
catalogData.setCategories(categories);
List<Product> products = new ArrayList<>();
for (ProductModel productModel : productService.getProducts()) {
products.add(productModelConverter.convert(productModel));
}
catalogData.setProducts(products);
catalogDao.write(catalogData);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}