Search in sources :

Example 56 with MCRCategoryID

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

the class MCRCategoryDAOImplTest method getRootCategories.

@Test
public void getRootCategories() {
    addWorldClassification();
    MCRCategoryID find = category.getId();
    List<MCRCategory> classes = DAO.getRootCategories();
    assertEquals("Result size does not match.", 1, classes.size());
    assertEquals("Returned MCRCategoryID does not match.", find, classes.get(0).getId());
}
Also used : MCRCategory(org.mycore.datamodel.classifications2.MCRCategory) MCRCategoryID(org.mycore.datamodel.classifications2.MCRCategoryID) Test(org.junit.Test)

Example 57 with MCRCategoryID

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

the class MCRTestCategoryMapper method addParentsToList.

@Override
protected void addParentsToList(MCRCategoryID childID, List<MCRCategoryID> list) {
    MCRCategoryID parent = parents.get(childID);
    if (parent != null) {
        list.add(parent);
        addParentsToList(parent, list);
    }
}
Also used : MCRCategoryID(org.mycore.datamodel.classifications2.MCRCategoryID)

Example 58 with MCRCategoryID

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

the class MCRWorkflowRuleParser method parseElement.

/* (non-Javadoc)
     * @see org.mycore.access.mcrimpl.MCRRuleParser#parseElement(org.jdom2.Element)
     */
@Override
protected MCRCondition<?> parseElement(Element e) {
    String field = e.getAttributeValue("field");
    String operator = e.getAttributeValue("operator");
    String value = e.getAttributeValue("value");
    boolean not = EQUALS_NOT.equals(operator);
    if (STATUS.equals(field)) {
        return new MCRCategoryCondition(STATUS, new MCRCategoryID(statusClassId.getRootID(), value), not);
    }
    return super.parseElement(e);
}
Also used : MCRCategoryID(org.mycore.datamodel.classifications2.MCRCategoryID)

Example 59 with MCRCategoryID

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

the class MCRClassificationUtils method isInCollection.

public static boolean isInCollection(String mcrId, String collection) {
    MCRObjectID mcrObjectID = MCRObjectID.getInstance(mcrId);
    MCRCategoryID collectionID = new MCRCategoryID(MCRConstants.COLLECTION_CLASS_ID.getRootID(), collection);
    MCRCategLinkReference reference = new MCRCategLinkReference(mcrObjectID);
    return LINK_SERVICE.isInCategory(reference, collectionID);
}
Also used : MCRCategoryID(org.mycore.datamodel.classifications2.MCRCategoryID) MCRObjectID(org.mycore.datamodel.metadata.MCRObjectID) MCRCategLinkReference(org.mycore.datamodel.classifications2.MCRCategLinkReference)

Example 60 with MCRCategoryID

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

the class MCRCreatorRuleStrategy method objectStatusIsSubmitted.

private static boolean objectStatusIsSubmitted(MCRObjectID mcrObjectID) {
    MCRCategLinkReference reference = new MCRCategLinkReference(mcrObjectID);
    boolean isSubmitted = false;
    if (SUBMITTED_CATEGORY == null) {
        return false;
    }
    String[] submittedCategoriesSplitted = SUBMITTED_CATEGORY.split(",");
    for (String submittedCategoryID : submittedCategoriesSplitted) {
        String categoryId = submittedCategoryID.trim();
        MCRCategoryID submittedCategory = MCRCategoryID.fromString(categoryId);
        if (LINK_SERVICE.isInCategory(reference, submittedCategory)) {
            isSubmitted = true;
        }
    }
    return isSubmitted;
}
Also used : MCRCategoryID(org.mycore.datamodel.classifications2.MCRCategoryID) MCRCategLinkReference(org.mycore.datamodel.classifications2.MCRCategLinkReference)

Aggregations

MCRCategoryID (org.mycore.datamodel.classifications2.MCRCategoryID)82 MCRCategory (org.mycore.datamodel.classifications2.MCRCategory)42 Test (org.junit.Test)14 MCRLabel (org.mycore.datamodel.classifications2.MCRLabel)13 Element (org.jdom2.Element)12 MCRCategLinkReference (org.mycore.datamodel.classifications2.MCRCategLinkReference)11 ArrayList (java.util.ArrayList)8 HashSet (java.util.HashSet)8 MCRCategoryDAO (org.mycore.datamodel.classifications2.MCRCategoryDAO)7 HashMap (java.util.HashMap)6 MCRException (org.mycore.common.MCRException)6 EntityManager (javax.persistence.EntityManager)5 Document (org.jdom2.Document)5 MCRCommand (org.mycore.frontend.cli.annotation.MCRCommand)5 JsonElement (com.google.gson.JsonElement)4 JsonObject (com.google.gson.JsonObject)4 Collection (java.util.Collection)4 LinkedList (java.util.LinkedList)4 MCRObjectID (org.mycore.datamodel.metadata.MCRObjectID)4 MCRJSONCategory (org.mycore.frontend.classeditor.json.MCRJSONCategory)4