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());
}
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);
}
}
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);
}
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);
}
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;
}
Aggregations