use of io.clownfish.clownfish.dbentities.CfKeywordlistcontent in project Clownfish by rawdog71.
the class SiteUtil method getSiteKeywordlibrary.
public Map getSiteKeywordlibrary(CfSite cfsite, Map sitecontentmap) {
List<CfSitekeywordlist> sitekeywordlibrary = new ArrayList<>();
sitekeywordlibrary.addAll(cfsitekeywordlistService.findBySiteref(cfsite.getId()));
HashMap<String, ArrayList> keywordlibraryMap = new HashMap<>();
for (CfSitekeywordlist sitekeywordlist : sitekeywordlibrary) {
CfKeywordlist cfkeywordlist = cfkeywordlistService.findById(sitekeywordlist.getCfSitekeywordlistPK().getKeywordlistref());
List<CfKeywordlistcontent> keywordlist = new ArrayList<>();
keywordlist.addAll(cfkeywordlistcontentService.findByKeywordlistref(cfkeywordlist.getId()));
ArrayList<CfKeyword> dummykeywordlist = new ArrayList<>();
for (CfKeywordlistcontent keywordcontent : keywordlist) {
CfKeyword keyword = cfkeywordService.findById(keywordcontent.getCfKeywordlistcontentPK().getKeywordref());
dummykeywordlist.add(keyword);
}
keywordlibraryMap.put(cfkeywordlist.getName(), dummykeywordlist);
}
sitecontentmap.put("KeywordLibrary", keywordlibraryMap);
return sitecontentmap;
}
use of io.clownfish.clownfish.dbentities.CfKeywordlistcontent in project Clownfish by rawdog71.
the class SiteUtil method getSiteKeywordlibrary.
public Map getSiteKeywordlibrary(List<CfKeywordlist> keywordlibrary_list, Map sitecontentmap) {
HashMap<String, ArrayList> keywordlibraryMap = new HashMap<>();
for (CfKeywordlist cfkeywordlist : keywordlibrary_list) {
List<CfKeywordlistcontent> keywordlist = new ArrayList<>();
keywordlist.addAll(cfkeywordlistcontentService.findByKeywordlistref(cfkeywordlist.getId()));
ArrayList<CfKeyword> dummykeywordlist = new ArrayList<>();
for (CfKeywordlistcontent keywordcontent : keywordlist) {
CfKeyword keyword = cfkeywordService.findById(keywordcontent.getCfKeywordlistcontentPK().getKeywordref());
dummykeywordlist.add(keyword);
}
keywordlibraryMap.put(cfkeywordlist.getName(), dummykeywordlist);
}
sitecontentmap.put("KeywordLibrary", keywordlibraryMap);
return sitecontentmap;
}
use of io.clownfish.clownfish.dbentities.CfKeywordlistcontent in project Clownfish by rawdog71.
the class SiteTreeBean method onSelectLayoutKeywordlibrary.
/**
* Selects a Keywordlibrary
* @param event
*/
public void onSelectLayoutKeywordlibrary(SelectEvent event) {
CfKeywordlist selected_keywordlist = (CfKeywordlist) event.getObject();
previewKeywordlistOutput.clear();
for (CfKeywordlistcontent keywordlistcontent : cfkeywordlistcontentService.findByKeywordlistref(selected_keywordlist.getId())) {
previewKeywordlistOutput.add(cfkeywordService.findById(keywordlistcontent.getCfKeywordlistcontentPK().getKeywordref()));
}
}
use of io.clownfish.clownfish.dbentities.CfKeywordlistcontent 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.CfKeywordlistcontent in project Clownfish by rawdog71.
the class CfKeywordlistcontentDAOImpl method findByKeywordrefAndKeywordlistref.
@Override
public CfKeywordlistcontent findByKeywordrefAndKeywordlistref(long keywordref, long keywordlistref) {
Session session = this.sessionFactory.getCurrentSession();
TypedQuery query = (TypedQuery) session.getNamedQuery("CfKeywordlistcontent.findByKeywordrefAndKeywordlistref");
query.setParameter("keywordref", keywordref);
query.setParameter("keywordlistref", keywordlistref);
CfKeywordlistcontent cfcontent = (CfKeywordlistcontent) query.getSingleResult();
return cfcontent;
}
Aggregations