本文整理汇总了Java中org.apache.sling.api.resource.ResourceMetadata类的典型用法代码示例。如果您正苦于以下问题:Java ResourceMetadata类的具体用法?Java ResourceMetadata怎么用?Java ResourceMetadata使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResourceMetadata类属于org.apache.sling.api.resource包,在下文中一共展示了ResourceMetadata类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SampleResource
import org.apache.sling.api.resource.ResourceMetadata; //导入依赖的package包/类
public SampleResource(final ResourceResolver resourceResolver, final String path, final ValueMap valueMap) {
this.path = path;
this.resourceResolver = resourceResolver;
// Set the properties for the ValueMap
this.valueMap = valueMap;
// Other "universal" properties can be added here
this.valueMap.put(ResourceResolver.PROPERTY_RESOURCE_TYPE, RESOURCE_TYPE);
this.valueMap.put("generatedAt", new Date());
// Set the resolutionPath for this resource to the resource's path
this.metadata = new ResourceMetadata();
this.metadata.setResolutionPath(path);
new SampleResource.SampleValueMap("foo", 2, 3);
}
示例2: buildComponentResource
import org.apache.sling.api.resource.ResourceMetadata; //导入依赖的package包/类
@Override
public Resource buildComponentResource() {
AbstractResourceImpl component = (AbstractResourceImpl) super.buildComponentResource();
AbstractResourceImpl options = new AbstractResourceImpl("items", null, null, new ResourceMetadata());
component.addChild(options);
String defaultValue = getOption("default").orElse(null);
getOptions().forEach((value, name)->{
final ResourceMetadata meta = new ResourceMetadata();
final String nodeName = JcrUtil.escapeIllegalJcrChars(value);
if (value.equals(defaultValue)) {
meta.put("checked", true);
}
meta.put("name", getName());
meta.put("value", value);
meta.put("text", name);
AbstractResourceImpl option = new AbstractResourceImpl("option_"+nodeName, "granite/ui/components/foundation/form/radio", "granite/ui/components/foundation/form/field", meta);
options.addChild(option);
});
return component;
}
示例3: buildComponentResource
import org.apache.sling.api.resource.ResourceMetadata; //导入依赖的package包/类
@Override
public Resource buildComponentResource() {
AbstractResourceImpl component = (AbstractResourceImpl) super.buildComponentResource();
AbstractResourceImpl options = new AbstractResourceImpl("items", null, null, new ResourceMetadata());
component.addChild(options);
String defaultValue = getOption("default").orElse(null);
getOptions().forEach((value, name)->{
final ResourceMetadata meta = new ResourceMetadata();
final String nodeName = JcrUtil.escapeIllegalJcrChars(value);
if (value.equals(defaultValue)) {
meta.put("selected", true);
}
meta.put("value", value);
meta.put("text", name);
AbstractResourceImpl option = new AbstractResourceImpl(
"option_" + nodeName,
null,
null,
meta);
options.addChild(option);
});
return component;
}
示例4: initInstance
import org.apache.sling.api.resource.ResourceMetadata; //导入依赖的package包/类
private void initInstance(ProcessInstance instance, ResourceResolver rr) throws RepositoryException, DeserializeException {
Map<String, Object> values = new HashMap<>();
values.put("sourcePath", "/content/pageA");
values.put("destinationPath", "/content/pageB");
values.put("maxReferences", "0");
values.put("mode", PageRelocator.Mode.MOVE.toString());
values.put("publishMethod", PageRelocator.PublishMethod.SELF_MANAGED.toString());
values.put("createVerionsOnReplicate", "false");
values.put("updateStatus", "true");
values.put("dryRun", "false");
instance.init(rr, values);
AbstractResourceImpl processNode = new AbstractResourceImpl(instance.getPath(), null, null, new ResourceMetadata());
when(rr.getResource(instance.getPath())).thenReturn(processNode);
AbstractResourceImpl processContentNode = new AbstractResourceImpl(instance.getPath() + "/jcr:content", null, null, new ResourceMetadata());
when(rr.getResource(instance.getPath() + "/jcr:content")).thenReturn(processContentNode);
AbstractResourceImpl processResultNode = new AbstractResourceImpl(instance.getPath() + "/jcr:content/result", null, null, new ResourceMetadata());
when(rr.getResource(instance.getPath() + "/jcr:content/result")).thenReturn(processResultNode);
AbstractResourceImpl failuresNode = new AbstractResourceImpl(instance.getPath() + "/jcr:content/failures", null, null, new ResourceMetadata());
when(rr.getResource(instance.getPath() + "/jcr:content/failures")).thenReturn(processResultNode);
when(rr.getResource(instance.getPath() + "/jcr:content/failures/step1")).thenReturn(processResultNode);
}
示例5: getEnhancedMockResolver
import org.apache.sling.api.resource.ResourceMetadata; //导入依赖的package包/类
private ResourceResolver getEnhancedMockResolver() throws RepositoryException, LoginException {
ResourceResolver rr = getFreshMockResolver();
when(rr.hasChanges()).thenReturn(true);
AbstractResourceImpl mockFolderA = new AbstractResourceImpl("/content/folderA", "", "", new ResourceMetadata());
when(rr.getResource("/content/folderA")).thenReturn(mockFolderA);
AbstractResourceImpl mockFolderB = new AbstractResourceImpl("/content/folderB", "", "", new ResourceMetadata());
when(rr.getResource("/content/folderB")).thenReturn(mockFolderB);
AbstractResourceImpl mockFolder = new AbstractResourceImpl("/content", "", "", new ResourceMetadata());
when(rr.getResource("/content")).thenReturn(mockFolder);
mockFolder.addChild(mockFolderA);
mockFolder.addChild(mockFolderB);
Session ses = mock(Session.class);
when(rr.adaptTo(Session.class)).thenReturn(ses);
AccessControlManager acm = mock(AccessControlManager.class);
when(ses.getAccessControlManager()).thenReturn(acm);
when(acm.privilegeFromName(any())).thenReturn(mock(Privilege.class));
return rr;
}
示例6: getResourceMetaDataWithExistingResourceContainsResolutionPathOnly
import org.apache.sling.api.resource.ResourceMetadata; //导入依赖的package包/类
@Test
public void getResourceMetaDataWithExistingResourceContainsResolutionPathOnly() throws Exception {
Resource target = testObj.aResource("/content");
ResourceMetadata actual = target.getResourceMetadata();
assertEquals("/content", actual.get("sling.resolutionPath"));
}
示例7: AbstractResourceImpl
import org.apache.sling.api.resource.ResourceMetadata; //导入依赖的package包/类
public AbstractResourceImpl(String path, String resourceType, String resourceSuperType, ResourceMetadata metadata) {
children = new ArrayList<>();
this.path = path;
this.type = resourceType;
this.superType = resourceSuperType;
this.meta = metadata;
}
示例8: getResource
import org.apache.sling.api.resource.ResourceMetadata; //导入依赖的package包/类
@Override
public Resource getResource(ResourceResolver resourceResolver, String path) {
if (path == null) {
return null;
} else if (path.equals(ROOT)) {
// this would be a special case where the root resource is requested.
// return nothing for now.
return null;
} else {
String listPath;
if (path.endsWith(EXTENSION)) {
listPath = path.substring(ROOT.length(), path.length() - EXTENSION_LENGTH);
} else {
listPath = path.substring(ROOT.length());
}
String fullListPath = listRoot + listPath;
Page listPage = resourceResolver.adaptTo(PageManager.class).getPage(fullListPath);
if (listPage == null) {
return null;
} else {
GenericList list = listPage.adaptTo(GenericList.class);
if (list == null) {
return null;
} else {
ResourceMetadata rm = new ResourceMetadata();
rm.setResolutionPath(path);
return new JsonResource(list, resourceResolver, rm);
}
}
}
}
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:32,代码来源:GenericListJsonResourceProvider.java
示例9: getEnhancedMockResolver
import org.apache.sling.api.resource.ResourceMetadata; //导入依赖的package包/类
private ResourceResolver getEnhancedMockResolver(final boolean aclChecksPass) throws RepositoryException, LoginException {
ResourceResolver rr = getFreshMockResolver();
when(rr.hasChanges()).thenReturn(true);
AbstractResourceImpl pageA = new AbstractResourceImpl("/content/pageA", "cq:Page", "cq:Page", new ResourceMetadata());
when(rr.getResource("/content/pageA")).thenReturn(pageA);
AbstractResourceImpl pageAcontent = new AbstractResourceImpl("/content/pageA/jcr:content", "cq:PageContent", "cq:PageContent", new ResourceMetadata());
when(rr.getResource("/content/pageA/jcr:content")).thenReturn(pageAcontent);
AbstractResourceImpl pageB = new AbstractResourceImpl("/content/pageB", "cq:Page", "cq:Page", new ResourceMetadata());
when(rr.getResource("/content/pageB")).thenReturn(pageB);
AbstractResourceImpl content = new AbstractResourceImpl("/content", "cq:Page", "cq:Page", new ResourceMetadata());
AbstractResourceImpl pageBcontent = new AbstractResourceImpl("/content/pageB/jcr:content", "cq:PageContent", "cq:PageContent", new ResourceMetadata());
when(rr.getResource("/content/pageB/jcr:content")).thenReturn(pageBcontent);
when(rr.getResource("/content")).thenReturn(content);
content.addChild(pageA);
content.addChild(pageB);
AbstractResourceImpl processes = new AbstractResourceImpl(ProcessInstanceImpl.BASE_PATH, null, null, new ResourceMetadata());
when(rr.getResource(ProcessInstanceImpl.BASE_PATH)).thenReturn(processes);
Session ses = mock(Session.class);
when(rr.adaptTo(Session.class)).thenReturn(ses);
AccessControlManager acm = mock(AccessControlManager.class);
when(ses.getAccessControlManager()).thenReturn(acm);
when(acm.privilegeFromName(any())).thenReturn(mock(Privilege.class));
when(acm.hasPrivileges(any(), any())).thenReturn(aclChecksPass);
return rr;
}
示例10: EntityResource
import org.apache.sling.api.resource.ResourceMetadata; //导入依赖的package包/类
public EntityResource(Entity entity,String resourceType,
ResourceResolver resourceResolver, String path) {
super();
this.resourceResolver = resourceResolver;
this.entity = entity;
this.path = path;
this.resourceType = resourceType;
this.metadata = new ResourceMetadata();
metadata.setResolutionPath(path);
}
示例11: getResourceMetadata
import org.apache.sling.api.resource.ResourceMetadata; //导入依赖的package包/类
@Override
public ResourceMetadata getResourceMetadata() {
throw new UnsupportedOperationException();
}
示例12: getResourceMetadata
import org.apache.sling.api.resource.ResourceMetadata; //导入依赖的package包/类
public ResourceMetadata getResourceMetadata() {
return this.metadata;
}
示例13: getResourceMetadata
import org.apache.sling.api.resource.ResourceMetadata; //导入依赖的package包/类
@Override
public ResourceMetadata getResourceMetadata() {
ResourceMetadata metadata = new ResourceMetadata();
metadata.setResolutionPath(getPath());
return metadata;
}
示例14: getComponentMetadata
import org.apache.sling.api.resource.ResourceMetadata; //导入依赖的package包/类
/**
* @return the componentMetadata
*/
public ResourceMetadata getComponentMetadata() {
return componentMetadata;
}
示例15: getResourceMetadata
import org.apache.sling.api.resource.ResourceMetadata; //导入依赖的package包/类
@Override
public ResourceMetadata getResourceMetadata() {
return meta;
}