Search in sources :

Example 11 with CfKeywordlistcontent

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

the class RestKeywordListContent method insertKeywordListContent.

private RestKeywordListContentParameter insertKeywordListContent(RestKeywordListContentParameter iklp) {
    try {
        String token = iklp.getToken();
        if (authtokenlist.checkValidToken(token)) {
            String apikey = iklp.getApikey();
            if (apikeyutil.checkApiKey(apikey, "RestService")) {
                try {
                    CfKeywordlistcontent keywordlistcontent = cfkeywordlistcontentService.findByKeywordrefAndKeywordlistref(iklp.getKeywordref(), iklp.getKeywordlistref());
                    LOGGER.warn("Duplicate Keywordlistcontent");
                    iklp.setReturncode("Duplicate Keywordlistcontent");
                } catch (javax.persistence.NoResultException ex) {
                    CfKeywordlistcontent newkeywordlistcontent = new CfKeywordlistcontent();
                    newkeywordlistcontent.setCfKeywordlistcontentPK(new CfKeywordlistcontentPK(iklp.getKeywordlistref(), iklp.getKeywordref()));
                    CfKeywordlistcontent newkeywordliscontent2 = cfkeywordlistcontentService.create(newkeywordlistcontent);
                    iklp.setReturncode("OK");
                }
            } 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 : CfKeywordlistcontent(io.clownfish.clownfish.dbentities.CfKeywordlistcontent) CfKeywordlistcontentPK(io.clownfish.clownfish.dbentities.CfKeywordlistcontentPK)

Example 12 with CfKeywordlistcontent

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

the class RestKeywordListContent method deleteKeywordListContent.

private RestKeywordListContentParameter deleteKeywordListContent(RestKeywordListContentParameter iklp) {
    try {
        String token = iklp.getToken();
        if (authtokenlist.checkValidToken(token)) {
            String apikey = iklp.getApikey();
            if (apikeyutil.checkApiKey(apikey, "RestService")) {
                try {
                    CfKeywordlistcontent keywordlistcontent = cfkeywordlistcontentService.findByKeywordrefAndKeywordlistref(iklp.getKeywordref(), iklp.getKeywordlistref());
                    cfkeywordlistcontentService.delete(keywordlistcontent);
                    iklp.setReturncode("OK");
                } catch (javax.persistence.NoResultException ex) {
                    LOGGER.warn("Keywordlistcontent not found");
                    iklp.setReturncode("Keywordlistcontent 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 : CfKeywordlistcontent(io.clownfish.clownfish.dbentities.CfKeywordlistcontent)

Aggregations

CfKeywordlistcontent (io.clownfish.clownfish.dbentities.CfKeywordlistcontent)12 CfKeyword (io.clownfish.clownfish.dbentities.CfKeyword)5 CfKeywordlist (io.clownfish.clownfish.dbentities.CfKeywordlist)4 TypedQuery (javax.persistence.TypedQuery)4 Session (org.hibernate.Session)4 ArrayList (java.util.ArrayList)3 CfKeywordlistcontentPK (io.clownfish.clownfish.dbentities.CfKeywordlistcontentPK)2 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 Gson (com.google.gson.Gson)1 RestKeywordListOutput (io.clownfish.clownfish.datamodels.RestKeywordListOutput)1 CfSitekeywordlist (io.clownfish.clownfish.dbentities.CfSitekeywordlist)1 IOException (java.io.IOException)1 PrintWriter (java.io.PrintWriter)1