本文整理汇总了Java中com.day.cq.wcm.api.WCMException类的典型用法代码示例。如果您正苦于以下问题:Java WCMException类的具体用法?Java WCMException怎么用?Java WCMException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WCMException类属于com.day.cq.wcm.api包,在下文中一共展示了WCMException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: delete
import com.day.cq.wcm.api.WCMException; //导入依赖的package包/类
@Override
public void delete(Resource resource, boolean shallow, boolean autoSave) throws WCMException {
if (resource == null) return;
Node node = resource.adaptTo(Node.class);
if (node == null) return;
try {
session.removeItem(node.getPath());
if (autoSave) {
session.save();
}
}
catch (RepositoryException e) {
throw new WCMException("Could not delete resource.", e);
}
}
开发者ID:TWCable,项目名称:jackalope,代码行数:18,代码来源:PageManagerImpl.java
示例2: move
import com.day.cq.wcm.api.WCMException; //导入依赖的package包/类
@Override
public Page move(final Page page, final String destination, final String beforeName, final boolean shallow,
final boolean resolveConflict, final String[] adjustRefs) throws WCMException {
try {
if (rr == null) {
throw new RuntimeException("Resource resolver was null");
}
if (replicator == null) {
throw new RuntimeException("Replicator was not changed out -- will not work properly");
}
replicator.replicate(null, ReplicationActionType.DEACTIVATE, page.getPath());
replicator.replicate(null, ReplicationActionType.ACTIVATE, destination + "/" + page.getName());
return page;
} catch (ReplicationException ex) {
throw new RuntimeException(ex);
}
}
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:21,代码来源:MockPageManager.java
示例3: createBlueprint
import com.day.cq.wcm.api.WCMException; //导入依赖的package包/类
/**
* Static method to create a new blueprint.
*
* @param name The name for the new blueprint.
* @param title The title/jcr:title.
* @param sitePath Path of the current site's location
*/
protected void createBlueprint(String name, String title, String sitePath) throws RepositoryException, WCMException {
logger.info("Creating blueprint '{}' ({}) for {}", title, name, sitePath);
Page blueprintPage = pageManager.create("/etc/blueprints", name, "", title);
Node jcrContentNode = blueprintPage.getContentResource().adaptTo(Node.class);
jcrContentNode.setProperty("cq:template", "/libs/wcm/msm/templates/blueprint");
jcrContentNode.setProperty("sitePath", sitePath);
jcrContentNode.setProperty("sling:resourceType", "wcm/msm/components/blueprint");
jcrContentNode.setProperty("thumbnailRotate", "0");
Node dialogNode = jcrContentNode.addNode("dialog", "cq:Dialog");
dialogNode.setProperty("title", title + " Blueprint");
Node items1Node = dialogNode.addNode("items","cq:WidgetCollection");
Node tabsNode = items1Node.addNode("tabs", "cq:TabPanel");
Node items2Node = tabsNode.addNode("items", "cq:WidgetCollection");
Node tabLanNode = items2Node.addNode("tab_lan", "cq:Widget");
tabLanNode.setProperty("path", "/libs/wcm/msm/templates/blueprint/defaults/language_tab.infinity.json");
tabLanNode.setProperty("xtype", "cqinclude");
Node tabChapNode = items2Node.addNode("tab_chap", "cq:Widget");
tabChapNode.setProperty("path", "/libs/wcm/msm/templates/blueprint/defaults/chapters_tab.infinity.json");
tabChapNode.setProperty("xtype", "cqinclude");
Node tabLcNode = items2Node.addNode("tab_lc", "cq:Widget");
tabLcNode.setProperty("path", "/libs/wcm/msm/templates/blueprint/defaults/livecopy_tab.infinity.json");
tabLcNode.setProperty("xtype", "cqinclude");
}
开发者ID:HS2-SOLUTIONS,项目名称:hs2-aem-commons,代码行数:40,代码来源:OnDeployScriptBase.java
示例4: getOrCreateLogDir
import com.day.cq.wcm.api.WCMException; //导入依赖的package包/类
private Page getOrCreateLogDir(ResourceResolver resolver) throws WCMException {
PageManager pageManager = resolver.adaptTo(PageManager.class);
Page historyPage = pageManager.getPage(HISTORY_PATH);
if (historyPage == null) {
boolean autoCommit = true;
historyPage = pageManager
.create("/etc/cqsm", "history", "/apps/cqsm/core/templates/historyTemplate", "History",
autoCommit);
}
return historyPage;
}
开发者ID:Cognifide,项目名称:APM,代码行数:12,代码来源:HistoryImpl.java
示例5: create
import com.day.cq.wcm.api.WCMException; //导入依赖的package包/类
@Override
public Page create(String parentPath, String pageName, String template, String title,
boolean autoSave) throws WCMException {
if (parentPath == null) throw new IllegalArgumentException("Parent path can't be null.");
if (pageName == null && title == null)
throw new IllegalArgumentException("Page and title name can't be both null.");
if (template != null && !template.isEmpty())
throw new UnsupportedOperationException("Templates are not supported.");
try {
Node parent = JcrUtils.getOrCreateByPath(parentPath, JcrConstants.NT_UNSTRUCTURED, session);
if (pageName == null || pageName.isEmpty())
pageName = JcrUtil.createValidName(title, JcrUtil.HYPHEN_LABEL_CHAR_MAPPING);
if (!JcrUtil.isValidName(pageName)) throw new IllegalArgumentException("Illegal page name: " + pageName);
Node pageNode = parent.addNode(pageName, JcrConstants.CQ_PAGE);
Node contentNode = pageNode.addNode("jcr:content", JcrConstants.CQ_PAGE_CONTENT);
if (title != null && !title.isEmpty()) contentNode.setProperty("jcr:title", title);
if (autoSave) {
session.save();
}
return getPage(pageNode.getPath());
}
catch (RepositoryException e) {
throw new WCMException("Unable to create page", e);
}
}
开发者ID:TWCable,项目名称:jackalope,代码行数:31,代码来源:PageManagerImpl.java
示例6: create
import com.day.cq.wcm.api.WCMException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public final Page create(final ResourceResolver resourceResolver, String bucketSegment,
final String name, final String... paths) throws WCMException,
RepositoryException {
final Session session = resourceResolver.adaptTo(Session.class);
final PageManager pageManager = resourceResolver.adaptTo(PageManager.class);
String bucketPath = "/etc/workflow/packages";
if (StringUtils.isNotBlank(bucketSegment)) {
bucketPath += "/" + bucketSegment;
}
final Node shardNode = JcrUtils.getOrCreateByPath(bucketPath,
NT_SLING_FOLDER, NT_SLING_FOLDER, session, false);
final Page page = pageManager.create(shardNode.getPath(), JcrUtil.createValidName(name),
WORKFLOW_PACKAGE_TEMPLATE, name, false);
final Resource contentResource = page.getContentResource();
Node node = JcrUtil.createPath(contentResource.getPath() + "/" + NN_VLT_DEFINITION, NT_VLT_DEFINITION, session);
node = JcrUtil.createPath(node.getPath() + "/filter", JcrConstants.NT_UNSTRUCTURED, session);
JcrUtil.setProperty(node, SLING_RESOURCE_TYPE, FILTER_RESOURCE_TYPE);
int i = 0;
Node resourceNode = null;
for (final String path : paths) {
if (path != null) {
resourceNode = JcrUtil.createPath(node.getPath() + "/resource_" + i++,
JcrConstants.NT_UNSTRUCTURED, session);
JcrUtil.setProperty(resourceNode, "root", path);
JcrUtil.setProperty(resourceNode, "rules", this.getIncludeRules(path));
JcrUtil.setProperty(resourceNode, SLING_RESOURCE_TYPE, FILTER_RESOURCE_RESOURCE_TYPE);
}
}
session.save();
return page;
}
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:42,代码来源:WorkflowPackageManagerImpl.java
示例7: getSearchRootPagePath
import com.day.cq.wcm.api.WCMException; //导入依赖的package包/类
private String getSearchRootPagePath(Resource searchResource, Page currentPage, ValueMap contentPolicyMap) {
String searchRootPagePath = null;
ValueMap valueMap = searchResource.getValueMap();
String searchRoot = valueMap.get(Search.PN_SEARCH_ROOT, contentPolicyMap.get(Search.PN_SEARCH_ROOT, String.class));
PageManager pageManager = currentPage.getPageManager();
if (StringUtils.isNotEmpty(searchRoot) && pageManager != null) {
Page rootPage = pageManager.getPage(searchRoot);
if (rootPage != null) {
Page searchRootLanguageRoot = languageManager.getLanguageRoot(rootPage.getContentResource());
Page currentPageLanguageRoot = languageManager.getLanguageRoot(currentPage.getContentResource());
RangeIterator liveCopiesIterator = null;
try {
liveCopiesIterator = relationshipManager.getLiveRelationships(currentPage.adaptTo(Resource.class), null, null);
} catch (WCMException e) {
// ignore it
}
if (searchRootLanguageRoot != null && currentPageLanguageRoot != null && !searchRootLanguageRoot.equals
(currentPageLanguageRoot)) {
// check if there's a language copy of the search root
Page languageCopySearchRoot = pageManager.getPage(ResourceUtil.normalize(currentPageLanguageRoot.getPath() + "/" +
getRelativePath(searchRootLanguageRoot, rootPage)));
if (languageCopySearchRoot != null) {
rootPage = languageCopySearchRoot;
}
} else if (liveCopiesIterator != null) {
while (liveCopiesIterator.hasNext()) {
LiveRelationship relationship = (LiveRelationship) liveCopiesIterator.next();
if (currentPage.getPath().startsWith(relationship.getTargetPath() + "/")) {
Page liveCopySearchRoot = pageManager.getPage(relationship.getTargetPath());
if (liveCopySearchRoot != null) {
rootPage = liveCopySearchRoot;
break;
}
}
}
}
searchRootPagePath = rootPage.getPath();
}
}
return searchRootPagePath;
}
开发者ID:Adobe-Marketing-Cloud,项目名称:aem-core-wcm-components,代码行数:42,代码来源:SearchResultServlet.java
示例8: getItems
import com.day.cq.wcm.api.WCMException; //导入依赖的package包/类
@Override
public List<NavigationItem> getItems() {
if (items == null) {
PageManager pageManager = currentPage.getPageManager();
Page rootPage = pageManager.getPage(navigationRootPage);
if (rootPage != null) {
NavigationRoot navigationRoot = new NavigationRoot(rootPage, structureDepth);
Page navigationRootLanguageRoot = languageManager.getLanguageRoot(navigationRoot.page.getContentResource());
Page currentPageLanguageRoot = languageManager.getLanguageRoot(currentPage.getContentResource());
RangeIterator liveCopiesIterator = null;
try {
liveCopiesIterator = relationshipManager.getLiveRelationships(navigationRoot.page.adaptTo(Resource.class), null, null);
} catch (WCMException e) {
// ignore it
}
if (navigationRootLanguageRoot != null && currentPageLanguageRoot != null && !navigationRootLanguageRoot.equals
(currentPageLanguageRoot)) {
// check if there's a language copy of the navigation root
Page languageCopyNavigationRoot = pageManager.getPage(ResourceUtil.normalize(currentPageLanguageRoot.getPath() + "/" +
getRelativePath(navigationRootLanguageRoot, navigationRoot.page)));
if (languageCopyNavigationRoot != null) {
navigationRoot = new NavigationRoot(languageCopyNavigationRoot, structureDepth);
}
} else if (liveCopiesIterator != null) {
while (liveCopiesIterator.hasNext()) {
LiveRelationship relationship = (LiveRelationship) liveCopiesIterator.next();
if (currentPage.getPath().startsWith(relationship.getTargetPath() + "/")) {
Page liveCopyNavigationRoot = pageManager.getPage(relationship.getTargetPath());
if (liveCopyNavigationRoot != null) {
navigationRoot = new NavigationRoot(liveCopyNavigationRoot, structureDepth);
break;
}
}
}
}
items = getItems(navigationRoot, navigationRoot.page);
if (!skipNavigationRoot) {
boolean isSelected = checkSelected(navigationRoot.page);
NavigationItemImpl root = new NavigationItemImpl(navigationRoot.page, isSelected, request, 0, items);
items = new ArrayList<>();
items.add(root);
}
} else {
items = Collections.emptyList();
}
}
return items;
}
开发者ID:Adobe-Marketing-Cloud,项目名称:aem-core-wcm-components,代码行数:49,代码来源:NavigationImpl.java
示例9: init
import com.day.cq.wcm.api.WCMException; //导入依赖的package包/类
@BeforeClass
public static void init() throws WCMException {
AEM_CONTEXT.registerAdapter(ResourceResolver.class, ContentPolicyManager.class,
(Function<ResourceResolver, ContentPolicyManager>) resourceResolver -> contentPolicyManager
);
AEM_CONTEXT.load().json("/navigation/test-conf.json", "/conf");
AEM_CONTEXT.registerService(LanguageManager.class, new MockLanguageManager());
LiveRelationshipManager relationshipManager = mock(LiveRelationshipManager.class);
when(relationshipManager.getLiveRelationships(any(Resource.class), any(String.class), any(RolloutManager.Trigger.class))).then(
invocation -> {
Object[] arguments = invocation.getArguments();
Resource resource = (Resource) arguments[0];
if ("/content/navigation-blueprint".equals(resource.getPath())) {
LiveRelationship liveRelationship = mock(LiveRelationship.class);
when(liveRelationship.getTargetPath()).thenReturn("/content/navigation-livecopy");
final ArrayList<LiveRelationship> relationships = new ArrayList<>();
relationships.add(liveRelationship);
final Iterator iterator = relationships.iterator();
return new RangeIterator() {
int index = 0;
@Override
public void skip(long skipNum) {
}
@Override
public long getSize() {
return relationships.size();
}
@Override
public long getPosition() {
return index;
}
@Override
public boolean hasNext() {
return iterator.hasNext();
}
@Override
public Object next() {
index++;
return iterator.next();
}
};
}
return null;
}
);
AEM_CONTEXT.registerService(LiveRelationshipManager.class, relationshipManager);
}
开发者ID:Adobe-Marketing-Cloud,项目名称:aem-core-wcm-components,代码行数:55,代码来源:NavigationImplTest.java
示例10: move
import com.day.cq.wcm.api.WCMException; //导入依赖的package包/类
@Override
public Page move(Page page, String destination, String beforeName, boolean shallow, boolean resolveConflicts,
String[] adjustRefs) throws WCMException {
throw new UnsupportedOperationException();
}
开发者ID:TWCable,项目名称:jackalope,代码行数:6,代码来源:PageManagerImpl.java
示例11: copy
import com.day.cq.wcm.api.WCMException; //导入依赖的package包/类
@Override
public Page copy(Page page, String destination, String beforeName, boolean shallow, boolean resolveConflict) throws WCMException {
return copy(page, destination, beforeName, shallow, resolveConflict, false);
}
开发者ID:TWCable,项目名称:jackalope,代码行数:5,代码来源:PageManagerImpl.java
示例12: order
import com.day.cq.wcm.api.WCMException; //导入依赖的package包/类
@Override
public void order(Page page, String beforeName) throws WCMException {
order(page, beforeName, true);
}
开发者ID:TWCable,项目名称:jackalope,代码行数:5,代码来源:PageManagerImpl.java
示例13: createRevision
import com.day.cq.wcm.api.WCMException; //导入依赖的package包/类
@Override
public Revision createRevision(Page page) throws WCMException {
throw new UnsupportedOperationException();
}
开发者ID:TWCable,项目名称:jackalope,代码行数:5,代码来源:PageManagerImpl.java
示例14: getRevisions
import com.day.cq.wcm.api.WCMException; //导入依赖的package包/类
@Override
public Collection<Revision> getRevisions(String s, Calendar calendar) throws WCMException {
throw new UnsupportedOperationException();
}
开发者ID:TWCable,项目名称:jackalope,代码行数:5,代码来源:PageManagerImpl.java
示例15: getChildRevisions
import com.day.cq.wcm.api.WCMException; //导入依赖的package包/类
@Override
public Collection<Revision> getChildRevisions(String s, Calendar calendar) throws WCMException {
throw new UnsupportedOperationException();
}
开发者ID:TWCable,项目名称:jackalope,代码行数:5,代码来源:PageManagerImpl.java
示例16: restore
import com.day.cq.wcm.api.WCMException; //导入依赖的package包/类
@Override
public Page restore(String s, String s1) throws WCMException {
throw new UnsupportedOperationException();
}
开发者ID:TWCable,项目名称:jackalope,代码行数:5,代码来源:PageManagerImpl.java
示例17: restoreTree
import com.day.cq.wcm.api.WCMException; //导入依赖的package包/类
@Override
public Page restoreTree(String s, Calendar calendar) throws WCMException {
throw new UnsupportedOperationException();
}
开发者ID:TWCable,项目名称:jackalope,代码行数:5,代码来源:PageManagerImpl.java
示例18: touch
import com.day.cq.wcm.api.WCMException; //导入依赖的package包/类
@Override
public void touch(Node node, boolean b, Calendar calendar, boolean b1) throws WCMException {
throw new UnsupportedOperationException();
}
开发者ID:TWCable,项目名称:jackalope,代码行数:5,代码来源:PageManagerImpl.java
示例19: lock
import com.day.cq.wcm.api.WCMException; //导入依赖的package包/类
@Override
public void lock() throws WCMException {
throw new UnsupportedOperationException();
}
开发者ID:TWCable,项目名称:jackalope,代码行数:5,代码来源:PageImpl.java
示例20: unlock
import com.day.cq.wcm.api.WCMException; //导入依赖的package包/类
@Override
public void unlock() throws WCMException {
throw new UnsupportedOperationException();
}
开发者ID:TWCable,项目名称:jackalope,代码行数:5,代码来源:PageImpl.java
注:本文中的com.day.cq.wcm.api.WCMException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论