Search in sources :

Example 1 with CfKeywordlistcontentPK

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

the class KeywordContentList method onChangeContent.

public void onChangeContent(AjaxBehaviorEvent event) {
    // Delete listcontent first
    List<CfKeywordlistcontent> keywordList = cfkeywordlistcontentService.findByKeywordlistref(selectedKeywordlist.getId());
    for (CfKeywordlistcontent content : keywordList) {
        cfkeywordlistcontentService.delete(content);
    }
    // Add selected listcontent
    if (!selectedKeywordcontent.isEmpty()) {
        for (CfKeyword selected : selectedKeywordcontent) {
            CfKeywordlistcontent keywordlistcontent = new CfKeywordlistcontent();
            CfKeywordlistcontentPK cflistcontentPK = new CfKeywordlistcontentPK();
            cflistcontentPK.setKeywordlistref(selectedKeywordlist.getId());
            cflistcontentPK.setKeywordref(selected.getId());
            keywordlistcontent.setCfKeywordlistcontentPK(cflistcontentPK);
            cfkeywordlistcontentService.create(keywordlistcontent);
        }
    }
}
Also used : CfKeywordlistcontent(io.clownfish.clownfish.dbentities.CfKeywordlistcontent) CfKeyword(io.clownfish.clownfish.dbentities.CfKeyword) CfKeywordlistcontentPK(io.clownfish.clownfish.dbentities.CfKeywordlistcontentPK)

Example 2 with CfKeywordlistcontentPK

use of io.clownfish.clownfish.dbentities.CfKeywordlistcontentPK 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)

Aggregations

CfKeywordlistcontent (io.clownfish.clownfish.dbentities.CfKeywordlistcontent)2 CfKeywordlistcontentPK (io.clownfish.clownfish.dbentities.CfKeywordlistcontentPK)2 CfKeyword (io.clownfish.clownfish.dbentities.CfKeyword)1