use of org.mycore.frontend.classeditor.json.MCRJSONCategory in project mycore by MyCoRe-Org.
the class CategoryDAOMock method createCategory.
private MCRJSONCategory createCategory(String rootID, String categID, MCRCategoryID parentID) {
MCRCategoryID id = new MCRCategoryID(rootID, categID);
Set<MCRLabel> labels = new HashSet<>();
labels.add(new MCRLabel("de", id + "_text", id + "_descr"));
labels.add(new MCRLabel("en", id + "_text", id + "_descr"));
MCRJSONCategory newCategory = new MCRJSONCategory();
newCategory.setId(id);
newCategory.setLabels(labels);
newCategory.setParentID(parentID);
return newCategory;
}
use of org.mycore.frontend.classeditor.json.MCRJSONCategory in project mycore by MyCoRe-Org.
the class MCRClassificationEditorResource method getCategory.
private String getCategory(MCRCategoryID id) {
if (!CATEGORY_DAO.exist(id)) {
throw new WebApplicationException(Status.NOT_FOUND);
}
MCRCategory category = CATEGORY_DAO.getCategory(id, 1);
if (!(category instanceof MCRJSONCategory)) {
category = new MCRJSONCategory(category);
}
Gson gson = MCRJSONManager.instance().createGson();
return gson.toJson(category);
}
use of org.mycore.frontend.classeditor.json.MCRJSONCategory in project mycore by MyCoRe-Org.
the class MCRCategUtils method newCategory.
public static MCRCategory newCategory(MCRCategoryID id, Set<MCRLabel> labels, MCRCategoryID mcrCategoryID) {
MCRJSONCategory category = new MCRJSONCategory();
category.setId(id);
category.setLabels(labels);
category.setParentID(mcrCategoryID);
return category;
}
Aggregations