use of io.clownfish.clownfish.dbentities.CfStylesheet in project Clownfish by rawdog71.
the class CfStylesheetDAOImpl method findById.
@Override
public CfStylesheet findById(Long id) {
Session session = this.sessionFactory.getCurrentSession();
TypedQuery query = (TypedQuery) session.getNamedQuery("CfStylesheet.findById");
query.setParameter("id", id);
CfStylesheet cfstylesheet = (CfStylesheet) query.getSingleResult();
return cfstylesheet;
}
use of io.clownfish.clownfish.dbentities.CfStylesheet in project Clownfish by rawdog71.
the class CfStylesheetDAOImpl method findAll.
@Override
public List<CfStylesheet> findAll() {
Session session = this.sessionFactory.getCurrentSession();
TypedQuery query = (TypedQuery) session.getNamedQuery("CfStylesheet.findAll");
List<CfStylesheet> cftempaltelist = query.getResultList();
return cftempaltelist;
}
use of io.clownfish.clownfish.dbentities.CfStylesheet in project Clownfish by rawdog71.
the class SiteTreeBean method onSelect.
public void onSelect(NodeSelectEvent event) {
selectedNode = event.getTreeNode();
selectedSite = (CfSite) selectedNode.getData();
classcontentlist = cfclasscontentService.findByMaintenance(true);
if (null != selectedSite.getTemplateref()) {
CfTemplate template = cftemplateService.findById(selectedSite.getTemplateref().longValue());
int idx = templatelist.getTemplateListe().indexOf(template);
selectedTemplate = templatelist.getTemplateListe().get(idx);
iframeurl = selectedSite.getName() + "?preview=true";
selectedDiv = null;
showContent = false;
showDatalist = false;
showAsset = false;
showAssetLibrary = false;
showKeywordLibrary = false;
if (template.isLayout()) {
contenteditable = true;
FacesMessage message = new FacesMessage("LAYOUT TEMPLATE");
FacesContext.getCurrentInstance().addMessage(null, message);
// List<CfLayoutcontent> layoutcontent = cflayoutcontentService.findBySiteref(selectedSite.getId());
layout = new CfLayout(template.getName());
Document doc = Jsoup.parse(template.getContent());
Elements divs = doc.getElementsByAttribute("template");
for (Element div : divs) {
String contents = div.attr("contents");
String datalists = div.attr("datalists");
String assets = div.attr("assets");
String assetlists = div.attr("assetlists");
String keywordlists = div.attr("keywordlists");
CfDiv cfdiv = new CfDiv();
cfdiv.setId(div.attr("id"));
cfdiv.setName(div.attr("template"));
if (!contents.isEmpty()) {
cfdiv.getContentArray().addAll(ClownfishUtil.toList(contents.split(",")));
}
if (!datalists.isEmpty()) {
cfdiv.getContentlistArray().addAll(ClownfishUtil.toList(datalists.split(",")));
}
if (!assets.isEmpty()) {
cfdiv.getAssetArray().addAll(ClownfishUtil.toList(assets.split(",")));
}
if (!assetlists.isEmpty()) {
cfdiv.getAssetlistArray().addAll(ClownfishUtil.toList(assetlists.split(",")));
}
if (!keywordlists.isEmpty()) {
cfdiv.getKeywordlistArray().addAll(ClownfishUtil.toList(keywordlists.split(",")));
}
layout.getDivArray().put(div.attr("id"), cfdiv);
}
} else {
contenteditable = false;
selected_contentclass = null;
selected_datalisttclass = null;
selected_asset = null;
selected_assetlist = null;
selected_keywordlist = null;
}
} else {
selectedTemplate = null;
}
if (null != selectedSite.getStylesheetref()) {
CfStylesheet styleshet = cfstylesheetService.findById(selectedSite.getStylesheetref().longValue());
int idx = stylesheetlist.getStylesheetListe().indexOf(styleshet);
selectedStylesheet = stylesheetlist.getStylesheetListe().get(idx);
} else {
selectedStylesheet = null;
}
if (null != selectedSite.getJavascriptref()) {
CfJavascript javascript = cfjavascriptService.findById(selectedSite.getJavascriptref().longValue());
int idx = javascriptlist.getJavascriptListe().indexOf(javascript);
selectedJavascript = javascriptlist.getJavascriptListe().get(idx);
} else {
selectedJavascript = null;
}
selectedDatasources.clear();
List<CfSitedatasource> selectedSiteDatasources = cfsitedatasourceService.findBySiteref(selectedSite.getId());
for (CfSitedatasource sitedatasource : selectedSiteDatasources) {
CfDatasource ds = cfdatasourceService.findById(sitedatasource.getCfSitedatasourcePK().getDatasourceref());
selectedDatasources.add(ds);
}
selectedContentlist.clear();
List<CfSitelist> selectedSitecontentlist = cfsitelistService.findBySiteref(selectedSite.getId());
for (CfSitelist sitelist : selectedSitecontentlist) {
CfList cl = cflistService.findById(sitelist.getCfSitelistPK().getListref());
selectedContentlist.add(cl);
}
selectedClasscontentlist.clear();
List<CfSitecontent> selectedClasscontentliste = cfsitecontentService.findBySiteref(selectedSite.getId());
for (CfSitecontent sitecontent : selectedClasscontentliste) {
CfClasscontent cc = cfclasscontentService.findById(sitecontent.getCfSitecontentPK().getClasscontentref());
selectedClasscontentlist.add(cc);
}
selectedAssetlist.clear();
List<CfSiteassetlist> selectedAssetliste = cfsiteassetlistService.findBySiteref(selectedSite.getId());
for (CfSiteassetlist siteassetlist : selectedAssetliste) {
CfAssetlist csa = cfassetlistService.findById(siteassetlist.getCfSiteassetlistPK().getAssetlistref());
selectedAssetlist.add(csa);
}
selectedKeywordlist.clear();
List<CfSitekeywordlist> selectedKeywordliste = cfsitekeywordlistService.findBySiteref(selectedSite.getId());
for (CfSitekeywordlist sitekeywordlist : selectedKeywordliste) {
CfKeywordlist kwl = cfkeywordlistService.findById(sitekeywordlist.getCfSitekeywordlistPK().getKeywordlistref());
selectedKeywordlist.add(kwl);
}
siteName = selectedSite.getName();
siteTitle = selectedSite.getTitle();
siteDescription = selectedSite.getDescription();
sitejob = selectedSite.isJob();
sitesearchrelevant = selectedSite.isSearchrelevant();
sitemap = selectedSite.isSitemap();
sitestatic = selectedSite.isStaticsite();
aliaspath = selectedSite.getAliaspath();
sitehtmlcompression = selectedSite.getHtmlcompression();
characterEncoding = selectedSite.getCharacterencoding();
contentType = selectedSite.getContenttype();
locale = selectedSite.getLocale();
saprfclist = cfsitesaprfcService.findBySiteref(selectedSite.getId());
newButtonDisabled = true;
FacesMessage message = new FacesMessage("Selected " + selectedSite.getName());
FacesContext.getCurrentInstance().addMessage(null, message);
}
use of io.clownfish.clownfish.dbentities.CfStylesheet in project Clownfish by rawdog71.
the class StylesheetList method onCreate.
@Override
public void onCreate(ActionEvent actionEvent) {
try {
if (!stylesheetName.isBlank()) {
CfStylesheet newstylesheet = new CfStylesheet();
newstylesheet.setName(stylesheetName);
newstylesheet.setContent("//" + stylesheetName);
cfstylesheetService.create(newstylesheet);
stylesheetListe = cfstylesheetService.findAll();
stylesheetName = "";
selectedStylesheet = newstylesheet;
onSelect(null);
onCheckOut(null);
} else {
FacesMessage message = new FacesMessage("Please enter stylesheet name");
FacesContext.getCurrentInstance().addMessage(null, message);
}
} catch (ConstraintViolationException ex) {
LOGGER.error(ex.getMessage());
}
}
use of io.clownfish.clownfish.dbentities.CfStylesheet in project Clownfish by rawdog71.
the class StylesheetList method onCheckOut.
@Override
public void onCheckOut(ActionEvent actionEvent) {
if (null != selectedStylesheet) {
boolean canCheckout = false;
CfStylesheet checkstylesheet = cfstylesheetService.findById(selectedStylesheet.getId());
BigInteger co = checkstylesheet.getCheckedoutby();
if (null != co) {
if (co.longValue() == 0) {
canCheckout = true;
}
} else {
canCheckout = true;
}
if (canCheckout) {
selectedStylesheet.setCheckedoutby(BigInteger.valueOf(loginbean.getCfuser().getId()));
selectedStylesheet.setContent(getContent());
cfstylesheetService.edit(checkstylesheet);
difference = stylesheetUtility.hasDifference(selectedStylesheet);
checkedout = true;
showDiff = false;
FacesMessage message = new FacesMessage("Checked Out " + selectedStylesheet.getName());
FacesContext.getCurrentInstance().addMessage(null, message);
} else {
access = false;
FacesMessage message = new FacesMessage("could not Checked Out " + selectedStylesheet.getName());
FacesContext.getCurrentInstance().addMessage(null, message);
}
}
}
Aggregations