当前位置: 首页>>代码示例>>Java>>正文


Java Page类代码示例

本文整理汇总了Java中com.day.cq.wcm.api.Page的典型用法代码示例。如果您正苦于以下问题:Java Page类的具体用法?Java Page怎么用?Java Page使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Page类属于com.day.cq.wcm.api包,在下文中一共展示了Page类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import com.day.cq.wcm.api.Page; //导入依赖的package包/类
@Override
public IndexEntry create(String path, @Nonnull ResourceResolver resolver) {
  String[] indexRules = getIndexRules(PRIMARY_TYPE_VALUE);
  if (ArrayUtils.isNotEmpty(indexRules)) {
    PageManager pageManager = resolver.adaptTo(PageManager.class);
    if (pageManager != null) {
      Page page = pageManager.getPage(path);
      if (page != null) {
        IndexEntry ret = new IndexEntry("idx", "page", path);
        Resource res = page.getContentResource();
        if (res != null) {
          ret.addContent(getProperties(res, indexRules));
        }
        return ret;
      }
    }
  }
  else {
    LOG.warn("Could not load indexRules for " + PRIMARY_TYPE_VALUE);
  }
  return null;
}
 
开发者ID:deveth0,项目名称:elasticsearch-aem,代码行数:23,代码来源:PageContentBuilder.java

示例2: getLocalizedPage

import com.day.cq.wcm.api.Page; //导入依赖的package包/类
private Page getLocalizedPage(Page page, Page languageRoot) {
    Page localizedPage;
    String path = languageRoot.getPath();
    String relativePath = page.getPath();
    if (relativePath.startsWith(path)) {
        localizedPage = page;
    } else {
        String separator = "/";
        int i = relativePath.indexOf(separator);
        int occurrence = StringUtils.countMatches(path, separator) + 1;
        while (--occurrence > 0 && i != -1) {
            i = relativePath.indexOf(separator, i + 1);
        }
        relativePath = (i > 0) ? relativePath.substring(i) : "";
        path = path.concat(relativePath);
        PageManager pageManager = page.getPageManager();
        localizedPage = pageManager.getPage(path);
    }
    return localizedPage;
}
 
开发者ID:Adobe-Marketing-Cloud,项目名称:aem-core-wcm-components,代码行数:21,代码来源:LanguageNavigationImpl.java

示例3: populateTagListItems

import com.day.cq.wcm.api.Page; //导入依赖的package包/类
private void populateTagListItems() {
    listItems = new ArrayList<>();
    String[] tags = properties.get(PN_TAGS, new String[0]);
    boolean matchAny = properties.get(PN_TAGS_MATCH, TAGS_MATCH_ANY_VALUE).equals(TAGS_MATCH_ANY_VALUE);
    if (ArrayUtils.isNotEmpty(tags)) {
        Page rootPage = getRootPage(PN_TAGS_PARENT_PAGE);
        if (rootPage != null) {
            TagManager tagManager = resourceResolver.adaptTo(TagManager.class);
            if (tagManager != null) {
                RangeIterator<Resource> resourceRangeIterator = tagManager.find(rootPage.getPath(), tags, matchAny);
                if (resourceRangeIterator != null) {
                    while (resourceRangeIterator.hasNext()) {
                        Page containingPage = pageManager.getContainingPage(resourceRangeIterator.next());
                        if (containingPage != null) {
                            listItems.add(containingPage);
                        }
                    }
                }
            }
        }
    }
}
 
开发者ID:Adobe-Marketing-Cloud,项目名称:aem-core-wcm-components,代码行数:23,代码来源:ListImpl.java

示例4: isApplicable

import com.day.cq.wcm.api.Page; //导入依赖的package包/类
private boolean isApplicable(SlingHttpServletRequest request) {
	Object appliable = request.getAttribute(REQUEST_PROPERTY_AEM_DATALAYER_APPLICABLE);
	if (appliable == null) {
		Resource resource = request.getResource();
		PageManager pMgr = resource.getResourceResolver().adaptTo(PageManager.class);
		Page page = pMgr.getContainingPage(resource);
		AEMDataLayerConfig config = AEMDataLayerConfig.getDataLayerConfig(page);
		if (config != null) {
			DataLayer dataLayer = new DataLayer(config, page);
			request.setAttribute(DataLayerConstants.REQUEST_PROPERTY_AEM_DATALAYER, dataLayer);
			request.setAttribute(REQUEST_PROPERTY_AEM_DATALAYER_APPLICABLE, new Boolean(true));
			return true;
		} else {
			request.setAttribute(REQUEST_PROPERTY_AEM_DATALAYER_APPLICABLE, new Boolean(false));
			return false;
		}
	} else {
		return new Boolean(true).equals(appliable);
	}
}
 
开发者ID:PerficientDigital,项目名称:AEM-DataLayer,代码行数:21,代码来源:AEMDataLayerInterceptorFilter.java

示例5: extractPageDetails

import com.day.cq.wcm.api.Page; //导入依赖的package包/类
public Map<String, Object> extractPageDetails(Map<String, Object> pathInfo,PageManager pageManager, Resource componentResource, String currentPage) throws Exception{
    Map<String, Object> pageDetails = new HashMap<>();
    String path = pathInfo.get(PATH_DETAILS_LIST_PATH_PROPERTY_NAME).toString();
    Page page = pageManager.getPage(path);
    if (null != page){
        pageDetails = extractBasicPageDetails(page, componentResource, currentPage);

        Collection<Map<String, Object>> paths = (Collection<Map<String,Object>>)pathInfo.get(PATH_DETAILS_LIST_PATHS_PROPERTY_NAME);
        if(paths != null) {
            Collection<Map<String, Object>> pageChildrenDetails = new ArrayList<>();
            for (Map<String, Object> childPathInfo : paths) {
                pageChildrenDetails.add(extractPageDetails(childPathInfo, pageManager, componentResource, currentPage));
            }
            pageDetails.put(PAGE_LIST_CONTEXT_PROPERTY_NAME,pageChildrenDetails);
        }
    }
    return pageDetails;
}
 
开发者ID:DantaFramework,项目名称:AEM,代码行数:19,代码来源:AddPageDetailsContextProcessor.java

示例6: extractPathList

import com.day.cq.wcm.api.Page; //导入依赖的package包/类
/**
 * Takes page, filter, depth, the current page path, and extracts a list of children paths
 *
 * @param page The page to extract the list of children paths from
 * @param filter The filter
 * @param depth The depth to recurse on
 * @param currentPage The path of the current page to flag is_current_page
 * @return extractedPaths This is a Collection of Map of Page Object
 */
public static Collection<Map<String, Object>> extractPathList(Page page, Filter<Page> filter, int depth, String currentPage) {
    Collection<Map<String, Object>> pathList = new ArrayList<>();
    Iterator<Page> children = page.listChildren(filter);
    if (depth > 0) {
        while (children.hasNext()) {
            Page child = children.next();
            Map<String, Object> currentPath = new HashMap<>();
            Collection<Map<String, Object>> childPaths = extractPathList(child, filter, depth - 1, currentPage);
            String path = child.getPath();
            currentPath.put(PATH_DETAILS_LIST_PATH_PROPERTY_NAME, path);
            currentPath.put(PATH_DETAILS_LIST_PATHS_PROPERTY_NAME, childPaths);
            if (path.equals(currentPage)) {
                currentPath.put(IS_CURRENT_PAGE,true);
            }
            pathList.add(currentPath);
        }
    }
    return pathList;
}
 
开发者ID:DantaFramework,项目名称:AEM,代码行数:29,代码来源:TraversedListUtils.java

示例7: pageExistsAt

import com.day.cq.wcm.api.Page; //导入依赖的package包/类
public static Matcher<Page> pageExistsAt(String path) {
	return new TypeSafeMatcher<Page>() {
		
		@Override
		protected boolean matchesSafely(Page actual) {
			if (actual == null || actual.getContentResource() == null) {
				return false;
			}
			Resource resource = actual.adaptTo(Resource.class);
			ValueMap content  = actual.getContentResource().adaptTo(ValueMap.class);
			return resource != null
			       && !resource.isResourceType(Resource.RESOURCE_TYPE_NON_EXISTING)
			       && ResourceType.PAGE_CONTENT_TYPE.getName().equals(actual.getProperties().get(ResourceProperty.PRIMARY_TYPE))
			       && StringUtils.isNotBlank(actual.getTemplate().getPath())
			       && path.endsWith(content.get(ResourceProperty.TITLE).toString())
			       && path.equals(resource.getPath());
			
		}
		
		@Override
		public void describeTo(Description description) {
			description.appendText(MessageFormat.format("Page with valid jcr:resourceType at {0} should exist.", path));
		}
	};
}
 
开发者ID:quatico-solutions,项目名称:aem-testing,代码行数:26,代码来源:AemMatchers.java

示例8: updateDataLayer

import com.day.cq.wcm.api.Page; //导入依赖的package包/类
@Override
public void updateDataLayer(DataLayer dataLayer) {

	com.perficient.aem.datalayer.api.Product product = new com.perficient.aem.datalayer.api.Product();
	ProductInfo productInfo = product.getProductInfo();
	productInfo.setDescription(productData.getDescription());
	productInfo.setProductID(productData.getPath());
	productInfo.setProductImage(dataLayer.getConfig().getUrlPrefix() + productData.getImageUrl());
	productInfo.setProductName(productData.getTitle());
	productInfo.setProductThumbnail(dataLayer.getConfig().getUrlPrefix() + productData.getThumbnailUrl());
	Page page = dataLayer.getAEMPage();
	productInfo.setProductURL(DataLayerUtil.getSiteUrl(page, dataLayer.getConfig()));
	productInfo.setSku(productData.getSKU());
	product.setProductInfo(productInfo);
	product.addAttribute("displayType", "productgrid/item");
	dataLayer.addProduct(product);

	Component component = new Component();
	component.getComponentInfo().setComponentID(resource.getPath());
	component.addAttribute("type", "productgrid/item");
	component.addAttribute("productID", productData.getPath());
	dataLayer.addComponent(component);
}
 
开发者ID:PerficientDigital,项目名称:AEM-DataLayer,代码行数:24,代码来源:ProductGridItem.java

示例9: updateDataLayer

import com.day.cq.wcm.api.Page; //导入依赖的package包/类
@Override
public void updateDataLayer(DataLayer dataLayer) {

	com.perficient.aem.datalayer.api.Product product = new com.perficient.aem.datalayer.api.Product();
	ProductInfo productInfo = product.getProductInfo();
	productInfo.setDescription(productData.getDescription());
	productInfo.setProductID(productData.getPath());
	productInfo.setProductImage(dataLayer.getConfig().getUrlPrefix() + productData.getImageUrl());
	productInfo.setProductName(productData.getTitle());
	productInfo.setProductThumbnail(dataLayer.getConfig().getUrlPrefix() + productData.getThumbnailUrl());
	Page page = resource.getResourceResolver().adaptTo(PageManager.class).getContainingPage(resource);
	productInfo.setProductURL(DataLayerUtil.getSiteUrl(page, dataLayer.getConfig()));
	productInfo.setSku(productData.getSKU());
	product.setProductInfo(productInfo);
	dataLayer.addProduct(product);
	
	Component component = new Component();
	component.getComponentInfo().setComponentID(resource.getPath());
	component.addAttribute("type", "product");
	dataLayer.addComponent(component);
}
 
开发者ID:PerficientDigital,项目名称:AEM-DataLayer,代码行数:22,代码来源:ProductComponent.java

示例10: getDataLayerConfig

import com.day.cq.wcm.api.Page; //导入依赖的package包/类
/**
 * Retrieves the DataLayer config for the page or none if it is not
 * configured for that page or any inherited page.
 * 
 * @param page
 *            the page for which to get the data layer configuration
 * @return the DataLayer configuration
 */
public static AEMDataLayerConfig getDataLayerConfig(Page page) {
	if (page != null) {
		log.trace("Finding Digital Data config for {}", page.getPath());
		InheritanceValueMap properties = new HierarchyNodeInheritanceValueMap(page.getContentResource());
		String[] cloudServices = properties.getInherited(PN_CLOUD_SERVICE_CONFIGS, new String[0]);
		for (String cloudService : cloudServices) {
			if (cloudService.startsWith(AEM_DATALAYER_CONFIG_PATH)) {
				Page cloudServicePage = page.getPageManager().getContainingPage(cloudService);
				if (cloudServicePage != null) {
					return cloudServicePage.getContentResource().adaptTo(AEMDataLayerConfig.class);
				} else {
					log.warn("Cloud service not found at {}", cloudService);
				}
			}
		}
		log.warn("No Digital Data config found for {}", page.getPath());
	}
	return null;

}
 
开发者ID:PerficientDigital,项目名称:AEM-DataLayer,代码行数:29,代码来源:AEMDataLayerConfig.java

示例11: extractPathListCP

import com.day.cq.wcm.api.Page; //导入依赖的package包/类
/**
 * Takes page, filter, depth, the current page path, excluded path, and extracts a list of children paths except the excluded path
 *
 * @param page The page to extract the list of children paths from
 * @param filter The filter
 * @param depth The depth to recurse on
 * @param currentPage The path of the current page to flag is_current_page
 * @param removeCurrentPage The path to be excluded
 * @return extractedPaths This is a Collection of Map of Page Object
 */
public static Collection<Map<String, Object>> extractPathListCP(Page page, Filter<Page> filter, int depth, String currentPage, boolean removeCurrentPage) {
    Collection<Map<String, Object>> pathList = new ArrayList<>();
    Iterator<Page> children = page.listChildren(filter);
    if (depth > 0) {
        while (children.hasNext()) {
            Page child = children.next();
            Map<String, Object> currentPath = new HashMap<>();
            Collection<Map<String, Object>> childPaths = extractPathList(child, filter, depth - 1, currentPage);
            String path = child.getPath();

            if (!path.equals(currentPage)) {
                currentPath.put(PATH_DETAILS_LIST_PATH_PROPERTY_NAME, path);
                currentPath.put(PATH_DETAILS_LIST_PATHS_PROPERTY_NAME, childPaths);
                pathList.add(currentPath);
            } else if (!removeCurrentPage) {
                currentPath.put(PATH_DETAILS_LIST_PATH_PROPERTY_NAME, path);
                currentPath.put(PATH_DETAILS_LIST_PATHS_PROPERTY_NAME, childPaths);
                currentPath.put(IS_CURRENT_PAGE, true);
                pathList.add(currentPath);
            }
        }
    }
    return pathList;
}
 
开发者ID:DantaFramework,项目名称:AEM,代码行数:35,代码来源:TraversedListUtils.java

示例12: findCities

import com.day.cq.wcm.api.Page; //导入依赖的package包/类
public List<City> findCities(String basePath, String relPath) {
	List<City> cities = new ArrayList<>();
	Resource resource = resourceResolver.getResource(basePath);

	Page page = resourceResolver.adaptTo(PageManager.class).getContainingPage(resource);
	Iterator<Page> cityPages = page.listChildren();
	while (cityPages.hasNext()) {
		Page cityPage = cityPages.next();
		ValueMap cityProps = cityPage.getContentResource().getValueMap();
		City city = new City();
		city.name = cityProps.get("jcr:title", String.class);
		city.id = cityPage.getName();
		Resource cityView = cityPage.getContentResource().getChild(relPath);
		Download download = new Download(cityView.getChild("image"));
		city.imageSrc = download.getHref();

		cities.add(city);

	}
	return cities;

}
 
开发者ID:sinnerschrader,项目名称:aem-react,代码行数:23,代码来源:CityFinderModel.java

示例13: getSearchContentResource

import com.day.cq.wcm.api.Page; //导入依赖的package包/类
private Resource getSearchContentResource(SlingHttpServletRequest request, Page currentPage) {
    Resource searchContentResource = null;
    RequestPathInfo requestPathInfo = request.getRequestPathInfo();
    Resource resource = request.getResource();
    String relativeContentResource = requestPathInfo.getSuffix();
    if (StringUtils.startsWith(relativeContentResource, "/")) {
        relativeContentResource = StringUtils.substring(relativeContentResource, 1);
    }
    if (StringUtils.isNotEmpty(relativeContentResource)) {
        searchContentResource = resource.getChild(relativeContentResource);
        if (searchContentResource == null) {
            PageManager pageManager = resource.getResourceResolver().adaptTo(PageManager.class);
            if (pageManager != null) {
                Template template = currentPage.getTemplate();
                if (template != null) {
                    Resource templateResource = request.getResourceResolver().getResource(template.getPath());
                    if (templateResource != null) {
                        searchContentResource = templateResource.getChild(NN_STRUCTURE + "/" + relativeContentResource);
                    }
                }
            }
        }
    }
    return searchContentResource;
}
 
开发者ID:Adobe-Marketing-Cloud,项目名称:aem-core-wcm-components,代码行数:26,代码来源:SearchResultServlet.java

示例14: getItems

import com.day.cq.wcm.api.Page; //导入依赖的package包/类
private List<NavigationItem> getItems(Page root) {
    List<NavigationItem> pages = new ArrayList<>();
    if (root.getDepth() < structureDepth) {
        Iterator<Page> it = root.listChildren(new PageFilter());
        while (it.hasNext()) {
            Page page = it.next();
            boolean active = currentPage.getPath().equals(page.getPath()) || currentPage.getPath().startsWith(page.getPath() + "/");
            String title = page.getNavigationTitle();
            if (title == null) {
                title = page.getTitle();
            }
            List<NavigationItem> children = getItems(page);
            int level = page.getDepth() - startLevel;
            Page localizedPage = getLocalizedPage(currentPage, page);
            if (localizedPage != null) {
                page = localizedPage;
            }
            pages.add(new LanguageNavigationItemImpl(page, active, request, level, children, title));
        }
    }

    return pages;
}
 
开发者ID:Adobe-Marketing-Cloud,项目名称:aem-core-wcm-components,代码行数:24,代码来源:LanguageNavigationImpl.java

示例15: getSiteName

import com.day.cq.wcm.api.Page; //导入依赖的package包/类
@Override
public String getSiteName() {
    Page page = findRootPage();

    String pageTitle = page.getPageTitle();
    if (StringUtils.isNotBlank(pageTitle)) {
        return pageTitle;
    }

    Resource content = page.getContentResource();
    if (content == null) {
        return null;
    }
    String title = content.getValueMap().get(JcrConstants.JCR_TITLE, String.class);
    if (StringUtils.isBlank(title)) {
        return null;
    }
    return title;
}
 
开发者ID:Adobe-Marketing-Cloud,项目名称:aem-core-wcm-components,代码行数:20,代码来源:SocialMediaHelperImpl.java


注:本文中的com.day.cq.wcm.api.Page类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。