Search in sources :

Example 11 with CfKeywordlist

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

the class RestKeywordList method insertKeywordList.

private RestKeywordListParameter insertKeywordList(RestKeywordListParameter iklp) {
    try {
        String token = iklp.getToken();
        if (authtokenlist.checkValidToken(token)) {
            String apikey = iklp.getApikey();
            if (apikeyutil.checkApiKey(apikey, "RestService")) {
                try {
                    CfKeywordlist keywordlist = cfkeywordlistService.findByName(iklp.getKeywordlist().trim().replaceAll("\\s+", "_"));
                    LOGGER.warn("Duplicate Keywordlist");
                    iklp.setReturncode("Duplicate Keywordlist");
                } catch (javax.persistence.NoResultException ex) {
                    CfKeywordlist newkeywordlist = new CfKeywordlist();
                    newkeywordlist.setName(iklp.getKeywordlist().trim().replaceAll("\\s+", "_"));
                    CfKeywordlist newkeywordlist2 = cfkeywordlistService.create(newkeywordlist);
                    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 : CfKeywordlist(io.clownfish.clownfish.dbentities.CfKeywordlist)

Aggregations

CfKeywordlist (io.clownfish.clownfish.dbentities.CfKeywordlist)11 CfKeywordlistcontent (io.clownfish.clownfish.dbentities.CfKeywordlistcontent)4 CfKeyword (io.clownfish.clownfish.dbentities.CfKeyword)3 CfSitekeywordlist (io.clownfish.clownfish.dbentities.CfSitekeywordlist)3 ArrayList (java.util.ArrayList)3 TypedQuery (javax.persistence.TypedQuery)3 Session (org.hibernate.Session)3 CfAssetlist (io.clownfish.clownfish.dbentities.CfAssetlist)2 CfClasscontent (io.clownfish.clownfish.dbentities.CfClasscontent)2 CfDatasource (io.clownfish.clownfish.dbentities.CfDatasource)2 CfList (io.clownfish.clownfish.dbentities.CfList)2 CfSiteassetlist (io.clownfish.clownfish.dbentities.CfSiteassetlist)2 CfSitecontent (io.clownfish.clownfish.dbentities.CfSitecontent)2 CfSitedatasource (io.clownfish.clownfish.dbentities.CfSitedatasource)2 CfSitelist (io.clownfish.clownfish.dbentities.CfSitelist)2 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 FacesMessage (javax.faces.application.FacesMessage)2 Gson (com.google.gson.Gson)1 CfDiv (io.clownfish.clownfish.datamodels.CfDiv)1