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);
}
}
}
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;
}
Aggregations