Search in sources :

Example 31 with MCRLabel

use of org.mycore.datamodel.classifications2.MCRLabel in project mycore by MyCoRe-Org.

the class MCRCategoryMapper method getMappingRule.

protected String getMappingRule(MCRCategoryID categoryID) {
    MCRCategory category = DAO.getCategory(categoryID, 0);
    // "x-mapper" was used in previous versions of mycore
    MCRLabel label = category.getLabel("x-mapping").orElse(category.getLabel("x-mapper").orElseThrow(() -> new MCRException("Category " + category + " does not hav a label for 'x-mapping'.")));
    return label.getText();
}
Also used : MCRCategory(org.mycore.datamodel.classifications2.MCRCategory) MCRException(org.mycore.common.MCRException) MCRLabel(org.mycore.datamodel.classifications2.MCRLabel)

Example 32 with MCRLabel

use of org.mycore.datamodel.classifications2.MCRLabel in project mycore by MyCoRe-Org.

the class MCRSolrCategoryDAO method setLabels.

@Override
public MCRCategory setLabels(MCRCategoryID id, Set<MCRLabel> labels) {
    MCRCategory category = super.setLabels(id, labels);
    MCRSolrClassificationUtil.reindex(category);
    return category;
}
Also used : MCRCategory(org.mycore.datamodel.classifications2.MCRCategory)

Example 33 with MCRLabel

use of org.mycore.datamodel.classifications2.MCRLabel in project mycore by MyCoRe-Org.

the class MCRSolrCategoryDAO method setLabel.

@Override
public MCRCategory setLabel(MCRCategoryID id, MCRLabel label) {
    MCRCategory category = super.setLabel(id, label);
    MCRSolrClassificationUtil.reindex(category);
    return category;
}
Also used : MCRCategory(org.mycore.datamodel.classifications2.MCRCategory)

Aggregations

MCRLabel (org.mycore.datamodel.classifications2.MCRLabel)30 MCRCategory (org.mycore.datamodel.classifications2.MCRCategory)14 MCRCategoryID (org.mycore.datamodel.classifications2.MCRCategoryID)11 HashSet (java.util.HashSet)8 Test (org.junit.Test)6 JsonObject (com.google.gson.JsonObject)4 Element (org.jdom2.Element)4 MCRException (org.mycore.common.MCRException)3 MCRLabelSetWrapper (org.mycore.frontend.classeditor.wrapper.MCRLabelSetWrapper)3 JsonElement (com.google.gson.JsonElement)2 URI (java.net.URI)2 ArrayList (java.util.ArrayList)2 MCRCategoryImpl (org.mycore.datamodel.classifications2.impl.MCRCategoryImpl)2 MCRCommand (org.mycore.frontend.cli.annotation.MCRCommand)2 JsonArray (com.google.gson.JsonArray)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 Optional (java.util.Optional)1 EntityManager (javax.persistence.EntityManager)1 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)1