• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ResourceMetadata类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



ResourceMetadata类属于org.apache.sling.api.resource包,在下文中一共展示了ResourceMetadata类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-samples,代码行数:18,代码来源:SampleResource.java


示例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;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:24,代码来源:RadioComponent.java


示例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;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:27,代码来源:SelectComponent.java


示例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);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:23,代码来源:PageRelocatorTest.java


示例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;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:23,代码来源:FolderRelocatorTest.java


示例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"));
}
 
开发者ID:quatico-solutions,项目名称:aem-testing,代码行数:9,代码来源:ResourceTestDriver.java


示例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;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:8,代码来源:AbstractResourceImpl.java


示例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;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:31,代码来源:PageRelocatorTest.java


示例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);
}
 
开发者ID:hlta,项目名称:playweb,代码行数:14,代码来源:EntityResource.java


示例11: getResourceMetadata

import org.apache.sling.api.resource.ResourceMetadata; //导入依赖的package包/类
@Override
public ResourceMetadata getResourceMetadata() {
	throw new UnsupportedOperationException();
}
 
开发者ID:apache,项目名称:sling-org-apache-sling-query,代码行数:5,代码来源:PropertyResourceMock.java


示例12: getResourceMetadata

import org.apache.sling.api.resource.ResourceMetadata; //导入依赖的package包/类
public ResourceMetadata getResourceMetadata() {
    return this.metadata;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-samples,代码行数:4,代码来源:SampleResource.java


示例13: getResourceMetadata

import org.apache.sling.api.resource.ResourceMetadata; //导入依赖的package包/类
@Override
public ResourceMetadata getResourceMetadata() {
    ResourceMetadata metadata = new ResourceMetadata();
    metadata.setResolutionPath(getPath());
    return metadata;
}
 
开发者ID:TWCable,项目名称:jackalope,代码行数:7,代码来源:ItemResourceImpl.java


示例14: getComponentMetadata

import org.apache.sling.api.resource.ResourceMetadata; //导入依赖的package包/类
/**
 * @return the componentMetadata
 */
public ResourceMetadata getComponentMetadata() {
    return componentMetadata;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:7,代码来源:FieldComponent.java


示例15: getResourceMetadata

import org.apache.sling.api.resource.ResourceMetadata; //导入依赖的package包/类
@Override
public ResourceMetadata getResourceMetadata() {
    return meta;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:5,代码来源:AbstractResourceImpl.java


示例16: JsonResource

import org.apache.sling.api.resource.ResourceMetadata; //导入依赖的package包/类
public JsonResource(GenericList list, ResourceResolver resourceResolver, ResourceMetadata rm) {
    super(resourceResolver, rm, "acs-commons/components/utilities/genericlist/json");
    this.list = list;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:5,代码来源:GenericListJsonResourceProvider.java


示例17: SynthesizedResource

import org.apache.sling.api.resource.ResourceMetadata; //导入依赖的package包/类
public SynthesizedResource(ResourceResolver resourceResolver, ResourceMetadata rm, String resourceType, Map<String, Object> properties) {
    super(resourceResolver, rm, resourceType);

    putProperties(properties);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:6,代码来源:SynthesizedResource.java


示例18: getResourceMetadata

import org.apache.sling.api.resource.ResourceMetadata; //导入依赖的package包/类
public ResourceMetadata getResourceMetadata() {
    return metadata;
}
 
开发者ID:hlta,项目名称:playweb,代码行数:4,代码来源:EntityResource.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java InputStreamFileInput类代码示例发布时间:2022-05-22
下一篇:
Java LineAttributes类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap