use of org.broadleafcommerce.cms.page.domain.PageTemplate in project BroadleafCommerce by BroadleafCommerce.
the class PageDaoImpl method readAllPageTemplates.
@Override
public List<PageTemplate> readAllPageTemplates() {
CriteriaBuilder builder = em.getCriteriaBuilder();
CriteriaQuery<PageTemplate> criteria = builder.createQuery(PageTemplate.class);
Root<PageTemplateImpl> template = criteria.from(PageTemplateImpl.class);
criteria.select(template);
try {
Query query = em.createQuery(criteria);
query.setHint(QueryHints.HINT_CACHEABLE, true);
return query.getResultList();
} catch (NoResultException e) {
return Collections.emptyList();
}
}
use of org.broadleafcommerce.cms.page.domain.PageTemplate in project BroadleafCommerce by BroadleafCommerce.
the class PageTemplateCustomPersistenceHandler method getFieldGroups.
protected List<FieldGroup> getFieldGroups(PersistencePackage pp, DynamicEntityDao dynamicEntityDao) {
String pageId = pp.getCustomCriteria()[1];
String pageTemplateId = pp.getCustomCriteria().length > 3 ? pp.getCustomCriteria()[3] : null;
if (pageId == null) {
return new ArrayList<FieldGroup>(0);
}
Page page = pageService.findPageById(Long.valueOf(pageId));
PageTemplate template = null;
if (pageTemplateId != null) {
template = pageService.findPageTemplateById(Long.valueOf(pageTemplateId));
}
return getFieldGroups(page, template);
}
use of org.broadleafcommerce.cms.page.domain.PageTemplate in project BroadleafCommerce by BroadleafCommerce.
the class AdminPageController method viewEntityForm.
@Override
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public String viewEntityForm(HttpServletRequest request, HttpServletResponse response, Model model, @PathVariable Map<String, String> pathVars, @PathVariable(value = "id") String id) throws Exception {
// Get the normal entity form for this item
String returnPath = super.viewEntityForm(request, response, model, pathVars, id);
EntityForm ef = (EntityForm) model.asMap().get("entityForm");
DynamicEntityFormInfo info = getDynamicForm(ef, id);
EntityForm dynamicForm;
if (info.getPropertyValue() != null) {
dynamicForm = getDynamicFieldTemplateForm(info, id, null);
} else {
dynamicForm = getEntityForm(info, null);
}
if (dynamicForm.getCeilingEntityClassname().equals(PageTemplate.class.getName())) {
dynamicForm.setTranslationCeilingEntity(Page.class.getName());
dynamicForm.setTranslationId(id);
}
ef.putDynamicFormInfo("pageTemplate", info);
ef.putDynamicForm("pageTemplate", dynamicForm);
// Mark the field that will drive this dynamic form
addOnChangeTrigger(ef);
ef.removeListGrid("additionalAttributes");
return returnPath;
}
Aggregations