Search in sources :

Example 6 with MCRCategoryDAO

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

the class MCRXMLFunctions method isCategoryID.

/**
 * @param classificationId
 * @param categoryId
 * @return
 */
public static boolean isCategoryID(String classificationId, String categoryId) {
    MCRCategory category = null;
    try {
        MCRCategoryID categID = MCRCategoryID.fromString(classificationId + ":" + categoryId);
        MCRCategoryDAO dao = MCRCategoryDAOFactory.getInstance();
        category = dao.getCategory(categID, 0);
    } catch (Throwable e) {
        LOGGER.error("Could not determine state for classification id {} and category id {}", classificationId, categoryId, e);
    }
    return category != null;
}
Also used : MCRCategory(org.mycore.datamodel.classifications2.MCRCategory) MCRCategoryDAO(org.mycore.datamodel.classifications2.MCRCategoryDAO) MCRCategoryID(org.mycore.datamodel.classifications2.MCRCategoryID)

Aggregations

MCRCategory (org.mycore.datamodel.classifications2.MCRCategory)6 MCRCategoryDAO (org.mycore.datamodel.classifications2.MCRCategoryDAO)6 MCRCategoryID (org.mycore.datamodel.classifications2.MCRCategoryID)4 ArrayList (java.util.ArrayList)2 Lists (com.google.common.collect.Lists)1 IOException (java.io.IOException)1 Collection (java.util.Collection)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 Optional (java.util.Optional)1 Collectors (java.util.stream.Collectors)1 LogManager (org.apache.logging.log4j.LogManager)1 Logger (org.apache.logging.log4j.Logger)1 SolrClient (org.apache.solr.client.solrj.SolrClient)1 SolrServerException (org.apache.solr.client.solrj.SolrServerException)1 SolrInputDocument (org.apache.solr.common.SolrInputDocument)1 Document (org.jdom2.Document)1 Before (org.junit.Before)1 MCRConfiguration (org.mycore.common.config.MCRConfiguration)1 MCRStreamContent (org.mycore.common.content.MCRStreamContent)1