本文整理汇总了Java中com.day.cq.wcm.api.Page.getParent方法的典型用法代码示例。如果您正苦于以下问题:Java Page.getParent方法的具体用法?Java Page.getParent怎么用?Java Page.getParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.day.cq.wcm.api.Page
的用法示例。
在下文中一共展示了Page.getParent方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getParentWithParentPageReturnsParent
import com.day.cq.wcm.api.Page; //导入方法依赖的package包/类
@Test
public void getParentWithParentPageReturnsParent() throws Exception {
Page target = aPage("/content/test/ko/foobar");
Page actual = target.getParent();
assertThat(actual, pageExistsAt("/content/test/ko"));
}
示例2: getParentIntWithZeroReturnsPageItself
import com.day.cq.wcm.api.Page; //导入方法依赖的package包/类
@Test
public void getParentIntWithZeroReturnsPageItself() throws Exception {
Page target = aPage("/content/test/ko/foobar");
Page actual = target.getParent(0);
assertThat(actual.adaptTo(Resource.class), resourceExistsAt(target.getPath()));
}
示例3: getParentIntWithOneReturnsPageParent
import com.day.cq.wcm.api.Page; //导入方法依赖的package包/类
@Test
public void getParentIntWithOneReturnsPageParent() throws Exception {
Page target = aPage("/content/test/ko/foobar");
Page actual = target.getParent(1);
assertThat(actual, pageExistsAt("/content/test/ko"));
}
示例4: getParentIntWithTwoReturnsPageParentsParent
import com.day.cq.wcm.api.Page; //导入方法依赖的package包/类
@Test
public void getParentIntWithTwoReturnsPageParentsParent() throws Exception {
Page target = aPage("/content/test/ko/foobar");
Page actual = target.getParent(2);
assertThat(actual, pageExistsAt("/content/test"));
}
示例5: getParentIntWithThreeReturnsNull
import com.day.cq.wcm.api.Page; //导入方法依赖的package包/类
@Test
public void getParentIntWithThreeReturnsNull() throws Exception {
Page target = aPage("/content/test/ko/foobar");
Page actual = target.getParent(3);
assertNull(actual);
}
示例6: findRootPage
import com.day.cq.wcm.api.Page; //导入方法依赖的package包/类
private Page findRootPage() {
Page page = currentPage;
while (true) {
Page parent = page.getParent();
if (parent == null) {
return page;
} else {
page = parent;
}
}
}
示例7: getCountries
import com.day.cq.wcm.api.Page; //导入方法依赖的package包/类
/**
* Returns the list of countries supported by the site
*/
private List<Country> getCountries(Page siteRoot) {
List<Country> countries = new ArrayList<Country>();
Page countryRoot = siteRoot.getParent(2);
if (countryRoot == null) {
return new ArrayList<Country>();
}
Iterator<Page> it = countryRoot.listChildren(new PageFilter());
while (it.hasNext()) {
Page countrypage = it.next();
countries.add(new Country(countrypage.getName(), getLanguages(countrypage, siteRoot)));
}
return countries;
}
示例8: findRoot
import com.day.cq.wcm.api.Page; //导入方法依赖的package包/类
/**
* Returns the root page of the site
* E.g.: /content/we-retail/us/en
* @param resourcePage the current Page
* @return root page or null if a root cannot be found
*/
public static Page findRoot(Page resourcePage) {
Page rootPage = resourcePage;
while(rootPage != null && !isRoot(rootPage)) {
rootPage = rootPage.getParent();
}
return rootPage;
}