当前位置: 首页>>代码示例>>Java>>正文


Java Asset.getRenditions方法代码示例

本文整理汇总了Java中com.day.cq.dam.api.Asset.getRenditions方法的典型用法代码示例。如果您正苦于以下问题:Java Asset.getRenditions方法的具体用法?Java Asset.getRenditions怎么用?Java Asset.getRenditions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.day.cq.dam.api.Asset的用法示例。


在下文中一共展示了Asset.getRenditions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getRendition

import com.day.cq.dam.api.Asset; //导入方法依赖的package包/类
/**
 * Gets the rendition which matches against the constructor's Regex pattern.
 * <p>
 * If no matches are made and an Original exists, returns the Original.
 * <p>
 * If no matches are made and an Original doesn't exist, return the first Rendition.
 *
 * @param asset Asset whose Renditions will be selected.
 * @return The first rendition whose name matches the supplied pattern (via constructor).
 */
@Override
public final Rendition getRendition(final Asset asset) {

    final List<Rendition> renditions = asset.getRenditions();
    final Pattern p = getPattern();

    boolean hasOriginal = asset.getOriginal() != null;
    boolean hasRenditions = renditions.size() > 0;

    for (final Rendition rendition : renditions) {
        final Matcher m = p.matcher(rendition.getName());

        if (m.find()) {
            return rendition;
        }
    }

    if (hasOriginal) {
        return asset.getOriginal();
    } else if (hasRenditions) {
        return renditions.get(0);
    } else {
        return null;
    }
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:36,代码来源:RenditionPatternPicker.java

示例2: getRenditionsWithExistingRenditionsIsNotEmpty

import com.day.cq.dam.api.Asset; //导入方法依赖的package包/类
@Test
public void getRenditionsWithExistingRenditionsIsNotEmpty() throws Exception {
	Asset target = anAsset("/libs/quatico/base/templates/backend/thumbnail.png");
	
	List<Rendition> actual = target.getRenditions();
	
	assertFalse(actual.isEmpty());
}
 
开发者ID:quatico-solutions,项目名称:aem-testing,代码行数:9,代码来源:AssetTestDriver.java

示例3: getAWebRendition

import com.day.cq.dam.api.Asset; //导入方法依赖的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


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