Search in sources :

Example 1 with CfClasscontentkeyword

use of io.clownfish.clownfish.dbentities.CfClasscontentkeyword in project Clownfish by rawdog71.

the class RestContent method destroyContent.

private RestContentParameter destroyContent(RestContentParameter ucp) {
    try {
        String token = ucp.getToken();
        if (authtokenlist.checkValidToken(token)) {
            String apikey = ucp.getApikey();
            if (apikeyutil.checkApiKey(apikey, "RestService")) {
                CfClass clazz = cfclassService.findByName(ucp.getClassname());
                try {
                    CfClasscontent classcontent = cfclasscontentService.findByName(ucp.getContentname());
                    // Delete corresponding attributcontent entries
                    List<CfAttributcontent> attributcontentlistdummy = cfattributcontentService.findByClasscontentref(classcontent);
                    for (CfAttributcontent attributcontent : attributcontentlistdummy) {
                        cfattributcontentService.delete(attributcontent);
                    }
                    // Delete corresponding listcontent entries
                    List<CfListcontent> selectedcontent = cflistcontentService.findByClasscontentref(classcontent.getId());
                    for (CfListcontent listcontent : selectedcontent) {
                        cflistcontentService.delete(listcontent);
                    }
                    // Delete corresponding keywordcontent entries
                    List<CfClasscontentkeyword> keywordcontentdummy = cfclasscontentkeywordService.findByClassContentRef(classcontent.getId());
                    for (CfClasscontentkeyword keywordcontent : keywordcontentdummy) {
                        cfclasscontentkeywordService.delete(keywordcontent);
                    }
                    // Delete corresponding sitecontent entries
                    List<CfSitecontent> sitecontentdummy = cfsitecontentService.findByClasscontentref(classcontent.getId());
                    for (CfSitecontent sitecontent : sitecontentdummy) {
                        cfsitecontentService.delete(sitecontent);
                    }
                    cfclasscontentService.delete(classcontent);
                    try {
                        hibernateUtil.deleteContent(classcontent);
                    } catch (javax.persistence.NoResultException ex) {
                        LOGGER.warn(ex.getMessage());
                    }
                    ucp.setReturncode("OK");
                } catch (javax.persistence.NoResultException ex) {
                    ucp.setReturncode("Classcontent not found");
                }
            } else {
                ucp.setReturncode("Wrong API KEY");
            }
        } else {
            ucp.setReturncode("Invalid token");
        }
    } catch (javax.persistence.NoResultException ex) {
        ucp.setReturncode("NoResultException");
    }
    return ucp;
}
Also used : CfClasscontentkeyword(io.clownfish.clownfish.dbentities.CfClasscontentkeyword) CfClass(io.clownfish.clownfish.dbentities.CfClass) CfSitecontent(io.clownfish.clownfish.dbentities.CfSitecontent) CfListcontent(io.clownfish.clownfish.dbentities.CfListcontent) CfClasscontent(io.clownfish.clownfish.dbentities.CfClasscontent) CfAttributcontent(io.clownfish.clownfish.dbentities.CfAttributcontent)

Example 2 with CfClasscontentkeyword

use of io.clownfish.clownfish.dbentities.CfClasscontentkeyword in project Clownfish by rawdog71.

the class RestKeywordContent method deleteKeywordContent.

private RestKeywordContentParameter deleteKeywordContent(RestKeywordContentParameter iklp) {
    try {
        String token = iklp.getToken();
        if (authtokenlist.checkValidToken(token)) {
            String apikey = iklp.getApikey();
            if (apikeyutil.checkApiKey(apikey, "RestService")) {
                try {
                    CfClasscontentkeyword contentkeyword = cfclasscontentkeywordService.findByClasscontentRefAndKeywordRef(iklp.getContentref(), iklp.getKeywordref());
                    cfclasscontentkeywordService.delete(contentkeyword);
                    iklp.setReturncode("OK");
                } catch (javax.persistence.NoResultException ex) {
                    LOGGER.warn("ContentKeyword not found");
                    iklp.setReturncode("ContentKeyword not found");
                }
            } else {
                iklp.setReturncode("Wrong API KEY");
            }
        } else {
            iklp.setReturncode("Invalid token");
        }
    } catch (javax.persistence.NoResultException ex) {
        LOGGER.error("NoResultException");
        iklp.setReturncode("NoResultException");
    }
    return iklp;
}
Also used : CfClasscontentkeyword(io.clownfish.clownfish.dbentities.CfClasscontentkeyword)

Example 3 with CfClasscontentkeyword

use of io.clownfish.clownfish.dbentities.CfClasscontentkeyword in project Clownfish by rawdog71.

the class CfClasscontentKeywordDAOImpl method findByKeywordRef.

@Override
public List<CfClasscontentkeyword> findByKeywordRef(Long id) {
    Session session = this.sessionFactory.getCurrentSession();
    TypedQuery query = (TypedQuery) session.getNamedQuery("CfClasscontentkeyword.findByKeywordref");
    query.setParameter("keywordref", id);
    List<CfClasscontentkeyword> cfcontentkeywordlist = query.getResultList();
    return cfcontentkeywordlist;
}
Also used : CfClasscontentkeyword(io.clownfish.clownfish.dbentities.CfClasscontentkeyword) TypedQuery(javax.persistence.TypedQuery) Session(org.hibernate.Session)

Example 4 with CfClasscontentkeyword

use of io.clownfish.clownfish.dbentities.CfClasscontentkeyword in project Clownfish by rawdog71.

the class CfClasscontentKeywordDAOImpl method findAll.

@Override
public List<CfClasscontentkeyword> findAll() {
    Session session = this.sessionFactory.getCurrentSession();
    TypedQuery query = (TypedQuery) session.getNamedQuery("CfClasscontentkeyword.findAll");
    List<CfClasscontentkeyword> cfcontentkeywordlist = query.getResultList();
    return cfcontentkeywordlist;
}
Also used : CfClasscontentkeyword(io.clownfish.clownfish.dbentities.CfClasscontentkeyword) TypedQuery(javax.persistence.TypedQuery) Session(org.hibernate.Session)

Example 5 with CfClasscontentkeyword

use of io.clownfish.clownfish.dbentities.CfClasscontentkeyword in project Clownfish by rawdog71.

the class CfClasscontentKeywordDAOImpl method findByClassContentRef.

@Override
public List<CfClasscontentkeyword> findByClassContentRef(Long id) {
    Session session = this.sessionFactory.getCurrentSession();
    TypedQuery query = (TypedQuery) session.getNamedQuery("CfClasscontentkeyword.findByClasscontentref");
    query.setParameter("classcontentref", id);
    List<CfClasscontentkeyword> cfcontentkeywordlist = query.getResultList();
    return cfcontentkeywordlist;
}
Also used : CfClasscontentkeyword(io.clownfish.clownfish.dbentities.CfClasscontentkeyword) TypedQuery(javax.persistence.TypedQuery) Session(org.hibernate.Session)

Aggregations

CfClasscontentkeyword (io.clownfish.clownfish.dbentities.CfClasscontentkeyword)17 ArrayList (java.util.ArrayList)7 CfListcontent (io.clownfish.clownfish.dbentities.CfListcontent)4 TypedQuery (javax.persistence.TypedQuery)4 Session (org.hibernate.Session)4 CfAttributcontent (io.clownfish.clownfish.dbentities.CfAttributcontent)3 CfClass (io.clownfish.clownfish.dbentities.CfClass)3 CfClasscontent (io.clownfish.clownfish.dbentities.CfClasscontent)3 CfKeyword (io.clownfish.clownfish.dbentities.CfKeyword)3 Map (java.util.Map)3 CfAsset (io.clownfish.clownfish.dbentities.CfAsset)2 CfSitecontent (io.clownfish.clownfish.dbentities.CfSitecontent)2 CfAssetService (io.clownfish.clownfish.serviceinterface.CfAssetService)2 CfClassService (io.clownfish.clownfish.serviceinterface.CfClassService)2 CfClasscontentKeywordService (io.clownfish.clownfish.serviceinterface.CfClasscontentKeywordService)2 CfClasscontentService (io.clownfish.clownfish.serviceinterface.CfClasscontentService)2 CfKeywordService (io.clownfish.clownfish.serviceinterface.CfKeywordService)2 CfListService (io.clownfish.clownfish.serviceinterface.CfListService)2 CfListcontentService (io.clownfish.clownfish.serviceinterface.CfListcontentService)2 IOException (java.io.IOException)2