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