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

Java DamConstants类代码示例

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

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



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

示例1: all

import com.day.cq.dam.api.DamConstants; //导入依赖的package包/类
private void all(Session session, Iterator<Resource> items) {

        while (items.hasNext()) {
            Resource res = items.next();
            if (NameConstants.NT_PAGE.equals(res.getResourceType()) || DamConstants.NT_DAM_ASSET.equals(res.getResourceType())) {
                if (!this.includeNonActivated) {
                    ReplicationStatus status = replicator.getReplicationStatus(session, res.getPath());
                    if (status != null && (status.isActivated())) {
                        add(res.getPath(), null);
                    }
                } else {
                    add(res.getPath(), null);
                }
            }
            all(session, res.listChildren());
        }
    }
 
开发者ID:mwmd,项目名称:ease,代码行数:18,代码来源:IndexServiceImpl.java


示例2: getSubAssets

import com.day.cq.dam.api.DamConstants; //导入依赖的package包/类
public Collection<Asset> getSubAssets() {
    if (head == null) {
        throw new UnsupportedOperationException();
    }
    Resource subassets = frozenResource.getChild(DamConstants.SUBASSETS_FOLDER);
    if (subassets != null) {
        Stream<Resource> subs = StreamSupport.stream(
                subassets.getChildren().spliterator(), false
        );

        return subs.map(r -> {
            try {
                return createFrozenAsset(
                        frozenResource.getResourceResolver(),
                        r.getPath());
            } catch (RepositoryException ex) {
                LOG.error("Error retrieving subasset from "+r.getPath(), ex);
            }
            return null;
        }).collect(Collectors.toList());
    } else {
        return Collections.EMPTY_LIST;
    }
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:25,代码来源:FrozenAsset.java


示例3: addAssetData

import com.day.cq.dam.api.DamConstants; //导入依赖的package包/类
/**
 * Derives and adds Asset related information to the map representing the hit.
 *
 * @param hit
 * @param map
 * @return
 * @throws javax.jcr.RepositoryException
 */
private static Map<String, Object> addAssetData(final Asset asset, final Hit hit, Map<String, Object> map)
        throws RepositoryException {

    String title = asset.getName();

    if (StringUtils.isNotBlank(asset.getMetadataValue(DamConstants.DC_TITLE))) {
        title = asset.getMetadataValue(DamConstants.DC_TITLE);
    }

    // Excerpt
    String excerpt = hit.getExcerpt();
    if (StringUtils.isBlank(hit.getExcerpt())) {
        excerpt = StringUtils.stripToEmpty(asset.getMetadataValue(DamConstants.DC_DESCRIPTION));
        if (excerpt.length() > MAX_EXCERPT_LENGTH) {
            excerpt = StringUtils.substring(excerpt, 0, (MAX_EXCERPT_LENGTH - ELLIPSE_LENGTH)) + "...";
        }
    }

    map.put(CF_PATH, asset.getPath());
    map.put(CF_NAME, asset.getName());
    map.put(CF_TITLE, title);
    map.put(CF_EXCERPT, excerpt);
    map.put(CF_MIMETYPE, asset.getMimeType());
    map.put(CF_SIZE, getSize(asset));
    map.put(CF_CACHE_KILLER, getCacheKiller(asset));
    map.put(CF_TYPE, "Asset");
    map.put(CF_LAST_MODIFIED, getLastModified(asset));

    return map;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:39,代码来源:ContentFinderHitBuilder.java


示例4: findAssets

import com.day.cq.dam.api.DamConstants; //导入依赖的package包/类
/**
 * Find all assets under the Task contentPath that have a dam:status of approved or rejected.
 *
 * @param resourceResolver the resource resolver used to find the Assets to move.
 * @param contentPath      the DAM contentPath which the task covers.
 * @return the resources representing dam:Assets for which dam:status is set to approved or rejected
 */
private Iterator<Resource> findAssets(ResourceResolver resourceResolver, String contentPath) {
    Map<String, String> params = new HashMap<String, String>();
    params.put("type", DamConstants.NT_DAM_ASSET);
    params.put("path", contentPath);
    params.put("property", REL_PN_DAM_STATUS);
    params.put("property.1_value", APPROVED);
    params.put("property.2_value", REJECTED);
    params.put("p.offset", "0");
    params.put("p.limit", "-1");

    Query query = queryBuilder.createQuery(PredicateGroup.create(params),
            resourceResolver.adaptTo(Session.class));

    if (log.isDebugEnabled()) {
        log.debug("Found [ {} ] assets under [ {} ] that were reviewed and require processing.",
                query.getResult().getHits().size(),
                contentPath);
    }

    return query.getResult().getResources();
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:29,代码来源:ReviewTaskAssetMoverHandler.java


示例5: testGetPayloadProperties_Asset

import com.day.cq.dam.api.DamConstants; //导入依赖的package包/类
@Test
public void testGetPayloadProperties_Asset() throws Exception {

    // set up jcr properties
    mockJcrProperties();

    Resource payloadRes = mock(Resource.class);
    Resource mdRes = mock(Resource.class);
    when(payloadRes.getResourceType()).thenReturn("dam:Asset");

    when(payloadRes.getChild(JcrConstants.JCR_CONTENT + "/" + DamConstants.METADATA_FOLDER)).thenReturn(mdRes);

    // mock valueMap
    when(mdRes.getValueMap()).thenReturn(vmap);
    Map<String, String> props = SendTemplatedEmailUtils.getPayloadProperties(payloadRes, sdf);

    assertEquals(props.get(PN_CALENDAR), CALENDAR_TOSTRING);
    assertEquals(props.get(PN_TITLE), STR_TOSTRING);
    assertEquals(props.get(PN_LONG), LONG_TOSTRING);
    assertEquals(props.get(PN_STR_ARRAY), STR_ARRAY_TOSTRING);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:22,代码来源:SendTemplatedEmailUtilsTest.java


示例6: test_with_rendition_arg_getting_no_rendition_is_noop

import com.day.cq.dam.api.DamConstants; //导入依赖的package包/类
@Test
public void test_with_rendition_arg_getting_no_rendition_is_noop() throws Exception {
    String path = "/content/dam/some/path.ext";

    WorkItem workItem = mock(WorkItem.class);
    WorkflowData data = mock(WorkflowData.class);
    when(workItem.getWorkflowData()).thenReturn(data);
    when(data.getPayloadType()).thenReturn(WorkflowHelper.TYPE_JCR_PATH);
    when(data.getPayload()).thenReturn(path);

    Resource resource = mock(Resource.class);
    Asset asset = mock(Asset.class);
    when(resource.adaptTo(Asset.class)).thenReturn(asset);
    when(resource.getResourceType()).thenReturn(DamConstants.NT_DAM_ASSET);

    when(resourceResolver.getResource(path)).thenReturn(resource);

    MetaDataMap metaData = new SimpleMetaDataMap();
    metaData.put("PROCESS_ARGS", "renditionName:test");

    process.execute(workItem, workflowSession, metaData, workflowHelper);

    verifyZeroInteractions(harness);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:25,代码来源:RenditionModifyingProcessTest.java


示例7: testGetTitleOrName

import com.day.cq.dam.api.DamConstants; //导入依赖的package包/类
@Test
public void testGetTitleOrName() {
    Asset assetWithTitle = mock(Asset.class);
    String title = RandomStringUtils.randomAlphanumeric(10);
    when(assetWithTitle.getMetadataValue(DamConstants.DC_TITLE)).thenReturn(title);
    assertEquals(title, DAMFunctions.getTitleOrName(assetWithTitle));

    Asset assetWithoutTitle = mock(Asset.class);
    String name = RandomStringUtils.randomAlphanumeric(10);
    when(assetWithoutTitle.getName()).thenReturn(name);
    assertEquals(name, DAMFunctions.getTitleOrName(assetWithoutTitle));

    verify(assetWithTitle, only()).getMetadataValue(DamConstants.DC_TITLE);
    verify(assetWithoutTitle).getMetadataValue(DamConstants.DC_TITLE);
    verify(assetWithoutTitle).getName();
    verifyNoMoreInteractions(assetWithoutTitle);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:18,代码来源:DAMFunctionsTest.java


示例8: getAWebRendition

import com.day.cq.dam.api.DamConstants; //导入依赖的package包/类
/**
 * Given an {@link Asset}, this method will return the first web {@link Rendition} it finds in the asset's renditions list.
 *
 * @param asset the asset for which to retrieve the web rendition
 * @return the rendition, if found, {@code null} otherwise
 */
private Rendition getAWebRendition(Asset asset) {
    List<Rendition> renditions = asset.getRenditions();
    for (Rendition rendition : renditions) {
        if (rendition.getName().startsWith(DamConstants.PREFIX_ASSET_WEB)) {
            return rendition;
        }
    }
    return null;
}
 
开发者ID:Adobe-Marketing-Cloud,项目名称:aem-core-wcm-components,代码行数:16,代码来源:AdaptiveImageServlet.java


示例9: initModel

import com.day.cq.dam.api.DamConstants; //导入依赖的package包/类
@PostConstruct
protected void initModel() {
    super.initModel();
    boolean altValueFromDAM = properties.get(PN_ALT_VALUE_FROM_DAM, currentStyle.get(PN_ALT_VALUE_FROM_DAM, true));
    boolean titleValueFromDAM = properties.get(PN_TITLE_VALUE_FROM_DAM, currentStyle.get(PN_TITLE_VALUE_FROM_DAM, true));
    displayPopupTitle = properties.get(PN_DISPLAY_POPUP_TITLE, currentStyle.get(PN_DISPLAY_POPUP_TITLE, true));
    if (StringUtils.isNotEmpty(fileReference)) {
        // the image is coming from DAM
        final Resource assetResource = request.getResourceResolver().getResource(fileReference);
        if (assetResource != null) {
            Asset asset = assetResource.adaptTo(Asset.class);
            if (asset != null) {
                if (!isDecorative && altValueFromDAM) {
                    String damDescription = asset.getMetadataValue(DamConstants.DC_DESCRIPTION);
                    if(StringUtils.isEmpty(damDescription)) {
                        damDescription = asset.getMetadataValue(DamConstants.DC_TITLE);
                    }
                    if (StringUtils.isNotEmpty(damDescription)) {
                        alt = damDescription;
                    }
                }
                if (titleValueFromDAM) {
                    String damTitle = asset.getMetadataValue(DamConstants.DC_TITLE);
                    if (StringUtils.isNotEmpty(damTitle)) {
                        title = damTitle;
                    }
                }
            } else {
                LOGGER.error("Unable to adapt resource '{}' used by image '{}' to an asset.", fileReference,
                        request.getResource().getPath());
            }
        } else {
            LOGGER.error("Unable to find resource '{}' used by image '{}'.", fileReference, request.getResource().getPath());
        }
    }
    if (hasContent) {
        disableLazyLoading = currentStyle.get(PN_DESIGN_LAZY_LOADING_ENABLED, true);
        srcUriTemplate = request.getContextPath() + Text.escapePath(baseResourcePath) + DOT + AdaptiveImageServlet.DEFAULT_SELECTOR +
                SRC_URI_TEMPLATE_WIDTH_VAR + DOT + extension +
                (inTemplate ? templateRelativePath : "") + (lastModifiedDate > 0 ? "/" + lastModifiedDate + DOT + extension : "");
        buildJson();
    }
}
 
开发者ID:Adobe-Marketing-Cloud,项目名称:aem-core-wcm-components,代码行数:44,代码来源:ImageImpl.java


示例10: getPayloadProperties

import com.day.cq.dam.api.DamConstants; //导入依赖的package包/类
/***
 * Tests whether the payload is a DAM asset or a cq:Page for DAM asset
 * returns all properties at the metadata node for DAM assets for cq:Page
 * returns all properties at the jcr:content node The Map<String, String>
 * that is returned contains string representations of each of the
 * respective properties
 * 
 * @param payloadRes
 *            the payload as a resource
 * @param sdf
 *            used by the method to transform Date properties into Strings
 * @return Map<String, String> String representation of jcr properties
 */
protected static final Map<String, String> getPayloadProperties(Resource payloadRes, SimpleDateFormat sdf) {

    Map<String, String> emailParams = new HashMap<String, String>();

    if (payloadRes == null) {
        return emailParams;
    }

    // Check if the payload is an asset
    if (DamUtil.isAsset(payloadRes)) {

        // get metadata resource
        Resource mdRes = payloadRes.getChild(JcrConstants.JCR_CONTENT + "/" + DamConstants.METADATA_FOLDER);

        Map<String, String> assetMetadata = getJcrKeyValuePairs(mdRes, sdf);
        emailParams.putAll(assetMetadata);

    } else {
        // check if the payload is a page
        Page payloadPage = payloadRes.adaptTo(Page.class);

        if (payloadPage != null) {
            Map<String, String> pageContent = getJcrKeyValuePairs(payloadPage.getContentResource(), sdf);
            emailParams.putAll(pageContent);
        }
    }

    return emailParams;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:43,代码来源:SendTemplatedEmailUtils.java


示例11: addMimeType

import com.day.cq.dam.api.DamConstants; //导入依赖的package包/类
public static Map<String, String> addMimeType(final SlingHttpServletRequest request, Map<String, String> map) {
    final boolean isAsset = isAsset(request);
    final String prefix = getPropertyPrefix(request);

    if (isAsset && has(request, CF_MIMETYPE)) {
        map.put(GROUP_MIMETYPE + "_group.1_property.operation", "like");
        map.put(GROUP_MIMETYPE + "_group.1_property", prefix + DamConstants.DC_FORMAT);
        map.put(GROUP_MIMETYPE + "_group.1_property.value", "%" + get(request, CF_MIMETYPE) + "%");
    }

    return map;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:13,代码来源:GQLToQueryBuilderConverter.java


示例12: isAsset

import com.day.cq.dam.api.DamConstants; //导入依赖的package包/类
/**
 * Checks of the query param node type is that of a DAM Asset
 *
 * @param request
 * @return
 */
public static boolean isAsset(final SlingHttpServletRequest request) {
    if (has(request, CF_TYPE)) {
        String nodeType = get(request, CF_TYPE);
        return StringUtils.equals(nodeType, DamConstants.NT_DAM_ASSET);
    }
    return false;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:14,代码来源:GQLToQueryBuilderConverter.java


示例13: getPropertyPrefix

import com.day.cq.dam.api.DamConstants; //导入依赖的package包/类
public static String getPropertyPrefix(final SlingHttpServletRequest request) {
    final boolean isPage = isPage(request);
    final boolean isAsset = isAsset(request);

    String prefix = "";
    if (isPage) {
        prefix = JcrConstants.JCR_CONTENT + "/";
    } else if (isAsset) {
        prefix = JcrConstants.JCR_CONTENT + "/" + DamConstants.METADATA_FOLDER + "/";
    }

    return prefix;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:14,代码来源:GQLToQueryBuilderConverter.java


示例14: writeAssets

import com.day.cq.dam.api.DamConstants; //导入依赖的package包/类
private void writeAssets(final XMLStreamWriter stream, final Resource assetFolder, final ResourceResolver resolver)
        throws XMLStreamException {
    for (Iterator<Resource> children = assetFolder.listChildren(); children.hasNext();) {
        Resource assetFolderChild = children.next();
        if (assetFolderChild.isResourceType(DamConstants.NT_DAM_ASSET)) {
            Asset asset = assetFolderChild.adaptTo(Asset.class);

            if (damAssetTypes.contains(asset.getMimeType())) {
                writeAsset(asset, stream, resolver);
            }
        } else {
            writeAssets(stream, assetFolderChild, resolver);
        }
    }
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:16,代码来源:SiteMapServlet.java


示例15: isAsset

import com.day.cq.dam.api.DamConstants; //导入依赖的package包/类
public boolean isAsset(Resource r) {
    String nodeType = r.getValueMap().get(JcrConstants.JCR_PRIMARYTYPE, String.class);
    return DamConstants.NT_DAM_ASSET.equals(nodeType);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:5,代码来源:AssetReport.java


示例16: getTitleOrName

import com.day.cq.dam.api.DamConstants; //导入依赖的package包/类
/**
 * Return the title or name of the asset, if the title is not defined.
 * 
 * @param asset the asset
 * @return the asset title or name
 */
@Function
public static String getTitleOrName(Asset asset) {
    String title = asset.getMetadataValue(DamConstants.DC_TITLE);
    return StringUtils.isNotBlank(title) ? title : asset.getName();
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:12,代码来源:DAMFunctions.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java EC2Api类代码示例发布时间:2022-05-22
下一篇:
Java BlockEntityComparator类代码示例发布时间: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