Search in sources :

Example 6 with CfKeywordlistcontent

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;
}
Also used : CfKeywordlist(io.clownfish.clownfish.dbentities.CfKeywordlist) CfSitekeywordlist(io.clownfish.clownfish.dbentities.CfSitekeywordlist) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) CfKeywordlistcontent(io.clownfish.clownfish.dbentities.CfKeywordlistcontent) ArrayList(java.util.ArrayList) CfKeyword(io.clownfish.clownfish.dbentities.CfKeyword)

Example 7 with CfKeywordlistcontent

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;
}
Also used : CfKeywordlist(io.clownfish.clownfish.dbentities.CfKeywordlist) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) CfKeywordlistcontent(io.clownfish.clownfish.dbentities.CfKeywordlistcontent) ArrayList(java.util.ArrayList) CfKeyword(io.clownfish.clownfish.dbentities.CfKeyword)

Example 8 with CfKeywordlistcontent

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()));
    }
}
Also used : CfKeywordlist(io.clownfish.clownfish.dbentities.CfKeywordlist) CfKeywordlistcontent(io.clownfish.clownfish.dbentities.CfKeywordlistcontent)

Example 9 with CfKeywordlistcontent

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);
        }
    }
}
Also used : CfKeywordlistcontent(io.clownfish.clownfish.dbentities.CfKeywordlistcontent) CfKeyword(io.clownfish.clownfish.dbentities.CfKeyword) CfKeywordlistcontentPK(io.clownfish.clownfish.dbentities.CfKeywordlistcontentPK)

Example 10 with CfKeywordlistcontent

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;
}
Also used : TypedQuery(javax.persistence.TypedQuery) CfKeywordlistcontent(io.clownfish.clownfish.dbentities.CfKeywordlistcontent) Session(org.hibernate.Session)

Aggregations

CfKeywordlistcontent (io.clownfish.clownfish.dbentities.CfKeywordlistcontent)12 CfKeyword (io.clownfish.clownfish.dbentities.CfKeyword)5 CfKeywordlist (io.clownfish.clownfish.dbentities.CfKeywordlist)4 TypedQuery (javax.persistence.TypedQuery)4 Session (org.hibernate.Session)4 ArrayList (java.util.ArrayList)3 CfKeywordlistcontentPK (io.clownfish.clownfish.dbentities.CfKeywordlistcontentPK)2 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 Gson (com.google.gson.Gson)1 RestKeywordListOutput (io.clownfish.clownfish.datamodels.RestKeywordListOutput)1 CfSitekeywordlist (io.clownfish.clownfish.dbentities.CfSitekeywordlist)1 IOException (java.io.IOException)1 PrintWriter (java.io.PrintWriter)1