1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.mycore.frontend.classeditor.json;
20
21 import java.util.ArrayList;
22
23 import org.mycore.datamodel.classifications2.MCRCategory;
24 import org.mycore.datamodel.classifications2.MCRCategoryID;
25
26 import jakarta.ws.rs.WebApplicationException;
27
28 public class MCRJSONCategoriesSaveList {
29 ArrayList<CategorySaveElement> updateList = new ArrayList<>();
30
31 ArrayList<CategorySaveElement> deleteList = new ArrayList<>();
32
33 public void add(MCRCategory categ, MCRCategoryID parentID, int index, String status)
34 throws WebApplicationException {
35 if ("updated".equals(status)) {
36 updateList.add(new CategorySaveElement(categ, parentID, index));
37 } else if ("deleted".equals(status)) {
38 deleteList.add(new CategorySaveElement(categ, parentID, index));
39 } else {
40 throw new WebApplicationException("Unknown status.");
41 }
42 }
43
44 private class CategorySaveElement {
45 private MCRCategory categ;
46
47 private MCRCategoryID parentID;
48
49 private int index;
50
51 CategorySaveElement(MCRCategory categ, MCRCategoryID parentID, int index) {
52 this.categ = categ;
53 this.parentID = parentID;
54 this.index = index;
55 }
56 }
57
58 }