Package com.day.cq.wcm.api.designer

Examples of com.day.cq.wcm.api.designer.Designer


    @Override
    public List<Reference> findReferences(Resource resource) {
        ResourceResolver resourceResolver = resource.getResourceResolver();
        PageManager pageManager = resourceResolver.adaptTo(PageManager.class);
        Designer designer = resourceResolver.adaptTo(Designer.class);

        Page page = pageManager.getContainingPage(resource);
        if (page == null) {
            return Collections.emptyList();
        }

        Design design = designer.getDesign(page);
        if (design == null) {
            return Collections.emptyList();
        }

        return Collections.singletonList(new Reference(TYPE_DESIGN_PAGE,
View Full Code Here


     * @param adaptable a SlingHttpServletRequest
     * @return the current Design if the adaptable was a SlingHttpServletRequest, the default Design otherwise
     */
    private Design getCurrentDesign(Object adaptable) {
        Page currentPage = getCurrentPage(adaptable);
        Designer designer = getDesigner(adaptable);

        if (currentPage != null && designer != null) {
            return designer.getDesign(currentPage);
        }

        return null;
    }
View Full Code Here

        return null;
    }

    private Design getResourceDesign(Object adaptable) {
        Page resourcePage = getResourcePage(adaptable);
        Designer designer = getDesigner(adaptable);

        if (adaptable instanceof SlingHttpServletRequest) {
            SlingHttpServletRequest request = (SlingHttpServletRequest) adaptable;

            if (resourcePage != null && designer != null) {
                String resourceDesignKey = COM_DAY_CQ_WCM_TAGS_DEFINE_OBJECTS_TAG + resourcePage.getPath();
                Object cachedResourceDesign = request.getAttribute(resourceDesignKey);

                if (cachedResourceDesign != null) {
                    return (Design) cachedResourceDesign;
                } else {
                    Design resourceDesign = designer.getDesign(resourcePage);
                    request.setAttribute(resourceDesignKey, resourceDesign);

                    return resourceDesign;
                }
            }
        }

        if (adaptable instanceof Resource) {
            return designer != null ? designer.getDesign(resourcePage) : null;
        }

        return null;
    }
View Full Code Here

        if (page == null || StringUtils.isBlank(path)) {
            return "";
        }

        ResourceResolver resourceResolver = page.adaptTo(Resource.class).getResourceResolver();
        Designer designer = resourceResolver.adaptTo(Designer.class);

        if (designer == null) {
            return "";
        }

        final Design design = designer.getDesign(page);
        final Resource designResource = resourceResolver.getResource(design.getPath());

        if (design == null) {
            return "";
        }
View Full Code Here

TOP

Related Classes of com.day.cq.wcm.api.designer.Designer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.