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


Java ContentData.getLocale方法代码示例

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


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

示例1: NodeContentData

import org.alfresco.service.cmr.repository.ContentData; //导入方法依赖的package包/类
/**
 * Construct
 */
public NodeContentData(NodeRef nodeRef, ContentData contentData)
{
    super(contentData.getContentUrl(), contentData.getMimetype(), contentData.getSize(),
            contentData.getEncoding(), contentData.getLocale());
    this.nodeRef = nodeRef;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:10,代码来源:NodeContentData.java

示例2: createContentDataEntity

import org.alfresco.service.cmr.repository.ContentData; //导入方法依赖的package包/类
/**
 * Translates the {@link ContentData} into persistable values using the helper DAOs
 */
protected ContentDataEntity createContentDataEntity(ContentData contentData)
{
    // Resolve the content URL
    Long contentUrlId = null;
    String contentUrl = contentData.getContentUrl();
    long size = contentData.getSize();
    if (contentUrl != null)
    {
        ContentUrlEntity contentUrlEntity = new ContentUrlEntity();
        contentUrlEntity.setContentUrl(contentUrl);
        contentUrlEntity.setSize(size);
        Pair<Long, ContentUrlEntity> pair = contentUrlCache.createOrGetByValue(contentUrlEntity, controlDAO);
        contentUrlId = pair.getFirst();
    }

    // Resolve the mimetype
    Long mimetypeId = null;
    String mimetype = contentData.getMimetype();
    if (mimetype != null)
    {
        mimetypeId = mimetypeDAO.getOrCreateMimetype(mimetype).getFirst();
    }
    // Resolve the encoding
    Long encodingId = null;
    String encoding = contentData.getEncoding();
    if (encoding != null)
    {
        encodingId = encodingDAO.getOrCreateEncoding(encoding).getFirst();
    }
    // Resolve the locale
    Long localeId = null;
    Locale locale = contentData.getLocale();
    if (locale != null)
    {
        localeId = localeDAO.getOrCreateLocalePair(locale).getFirst();
    }
    
    // Create ContentDataEntity
    ContentDataEntity contentDataEntity = createContentDataEntity(contentUrlId, mimetypeId, encodingId, localeId);
    // Done
    return contentDataEntity;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:46,代码来源:AbstractContentDataDAOImpl.java

示例3: updateContentDataEntity

import org.alfresco.service.cmr.repository.ContentData; //导入方法依赖的package包/类
/**
 * Translates the {@link ContentData} into persistable values using the helper DAOs
 */
protected int updateContentDataEntity(ContentDataEntity contentDataEntity, ContentData contentData)
{
    // Resolve the content URL
    Long oldContentUrlId = contentDataEntity.getContentUrlId();
    ContentUrlEntity contentUrlEntity = null;
    if(oldContentUrlId != null)
    {
        Pair<Long, ContentUrlEntity> entityPair = contentUrlCache.getByKey(oldContentUrlId);
        if (entityPair == null)
        {
            throw new DataIntegrityViolationException("No ContentUrl value exists for ID " + oldContentUrlId);
        }
        contentUrlEntity = entityPair.getSecond();
    }

    String oldContentUrl = (contentUrlEntity != null ? contentUrlEntity.getContentUrl() : null);
    String newContentUrl = contentData.getContentUrl();
    if (!EqualsHelper.nullSafeEquals(oldContentUrl, newContentUrl))
    {
        if (oldContentUrl != null)
        {
            // We have a changed value.  The old content URL has been dereferenced.
            registerDereferencedContentUrl(oldContentUrl);
        }
        if (newContentUrl != null)
        {
            if(contentUrlEntity == null)
            {
                contentUrlEntity = new ContentUrlEntity();
                contentUrlEntity.setContentUrl(newContentUrl);
            }
            Pair<Long, ContentUrlEntity> pair = contentUrlCache.getOrCreateByValue(contentUrlEntity);
            Long newContentUrlId = pair.getFirst();
            contentUrlEntity.setId(newContentUrlId);
            contentDataEntity.setContentUrlId(newContentUrlId);
        }
        else
        {
            contentDataEntity.setId(null);
            contentDataEntity.setContentUrlId(null);
        }
    }

    // Resolve the mimetype
    Long mimetypeId = null;
    String mimetype = contentData.getMimetype();
    if (mimetype != null)
    {
        mimetypeId = mimetypeDAO.getOrCreateMimetype(mimetype).getFirst();
    }
    // Resolve the encoding
    Long encodingId = null;
    String encoding = contentData.getEncoding();
    if (encoding != null)
    {
        encodingId = encodingDAO.getOrCreateEncoding(encoding).getFirst();
    }
    // Resolve the locale
    Long localeId = null;
    Locale locale = contentData.getLocale();
    if (locale != null)
    {
        localeId = localeDAO.getOrCreateLocalePair(locale).getFirst();
    }

    contentDataEntity.setMimetypeId(mimetypeId);
    contentDataEntity.setEncodingId(encodingId);
    contentDataEntity.setLocaleId(localeId);

    return updateContentDataEntity(contentDataEntity);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:75,代码来源:AbstractContentDataDAOImpl.java

示例4: getContent

import org.alfresco.service.cmr.repository.ContentData; //导入方法依赖的package包/类
@Override
public BinaryResource getContent(NodeRef nodeRef, Parameters parameters, boolean recordActivity)
{
    if (!nodeMatches(nodeRef, Collections.singleton(ContentModel.TYPE_CONTENT), null, false))
    {
        throw new InvalidArgumentException("NodeId of content is expected: " + nodeRef.getId());
    }

    Map<QName, Serializable> nodeProps = nodeService.getProperties(nodeRef);
    ContentData cd = (ContentData) nodeProps.get(ContentModel.PROP_CONTENT);
    String name = (String) nodeProps.get(ContentModel.PROP_NAME);

    org.alfresco.rest.framework.resource.content.ContentInfo ci = null;
    String mimeType = null;
    if (cd != null)
    {
        mimeType = cd.getMimetype();
        ci = new org.alfresco.rest.framework.resource.content.ContentInfoImpl(mimeType, cd.getEncoding(), cd.getSize(), cd.getLocale());
    }

    // By default set attachment header (with filename) unless attachment=false *and* content type is pre-configured as non-attach
    boolean attach = true;
    String attachment = parameters.getParameter("attachment");
    if (attachment != null)
    {
        Boolean a = Boolean.valueOf(attachment);
        if (!a)
        {
            if (nonAttachContentTypes.contains(mimeType))
            {
                attach = false;
            }
            else
            {
                logger.warn("Ignored attachment=false for "+nodeRef.getId()+" since "+mimeType+" is not in the whitelist for non-attach content types");
            }
        }
    }
    String attachFileName = (attach ? name : null);

    if (recordActivity)
    {
        final ActivityInfo activityInfo = getActivityInfo(getParentNodeRef(nodeRef), nodeRef);
        postActivity(Activity_Type.DOWNLOADED, activityInfo, true);
    }

    return new NodeBinaryResource(nodeRef, ContentModel.PROP_CONTENT, ci, attachFileName);
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:49,代码来源:NodesImpl.java


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