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


Java ContentUrlKeyEntity类代码示例

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


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

示例1: createContentUrlEntity

import org.alfresco.repo.domain.contentdata.ContentUrlKeyEntity; //导入依赖的package包/类
@Override
protected ContentUrlEntity createContentUrlEntity(String contentUrl, long size, ContentUrlKeyEntity contentUrlKeyEntity)
{
    ContentUrlEntity contentUrlEntity = new ContentUrlEntity();
    contentUrlEntity.setContentUrl(contentUrl);
    contentUrlEntity.setSize(size);
    contentUrlEntity.setOrphanTime(null);
    /* Long id = (Long) */ template.insert(INSERT_CONTENT_URL, contentUrlEntity);
    /*contentUrlEntity.setId(id);*/

    if(contentUrlKeyEntity != null)
    {
        template.insert(INSERT_SYMMETRIC_KEY, contentUrlKeyEntity);
    }

    // Done
    return contentUrlEntity;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:19,代码来源:ContentDataDAOImpl.java

示例2: updateContentUrlEntity

import org.alfresco.repo.domain.contentdata.ContentUrlKeyEntity; //导入依赖的package包/类
@Override
protected int updateContentUrlEntity(ContentUrlEntity existing, ContentUrlEntity entity)
{
    int ret = 0;

    ContentUrlKeyEntity existingContentUrlKey = existing.getContentUrlKey();
    ContentUrlKeyEntity contentUrlKey = entity.getContentUrlKey();
    contentUrlKey.setContentUrlId(existing.getId());
    if(existingContentUrlKey == null)
    {
        ret = template.insert(INSERT_SYMMETRIC_KEY, contentUrlKey);
    }
    else if (!EqualsHelper.nullSafeEquals(existingContentUrlKey, contentUrlKey))
    {
        ret = template.update(UPDATE_SYMMETRIC_KEY, contentUrlKey);
    }

    return ret;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:ContentDataDAOImpl.java

示例3: getSymmetricKeysByMasterKeyAlias

import org.alfresco.repo.domain.contentdata.ContentUrlKeyEntity; //导入依赖的package包/类
@Override
public List<ContentUrlKeyEntity> getSymmetricKeysByMasterKeyAlias(String masterKeyAlias, long fromId, int maxResults)
{
    ContentUrlKeyEntity entity = new ContentUrlKeyEntity();
    entity.setMasterKeyAlias(masterKeyAlias);
    entity.setId(fromId);
    List<ContentUrlKeyEntity> results = template.selectList(SELECT_SYMMETRIC_KEYS_BY_MASTER_KEY, 
            entity, new RowBounds(0, maxResults));
    return results;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:11,代码来源:ContentDataDAOImpl.java

示例4: getReader

import org.alfresco.repo.domain.contentdata.ContentUrlKeyEntity; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public ContentReader getReader(final String contentUrl)
{
    ContentReader reader;
    final ContentReader backingReader = super.getReader(contentUrl);
    if (backingReader != null && backingReader.exists())
    {
        final String effectiveContentUrl = backingReader.getContentUrl();
        final ContentUrlEntity urlEntity = this.contentDataDAO.getContentUrl(effectiveContentUrl);
        if (urlEntity == null)
        {
            throw new ContentIOException("Missing content URL entity for " + effectiveContentUrl);
        }
        final ContentUrlKeyEntity urlKeyEntity = urlEntity.getContentUrlKey();
        if (urlKeyEntity != null)
        {
            try
            {
                final Key key;
                final EncryptedKey encryptedKey = urlKeyEntity.getEncryptedKey();

                if (!EqualsHelper.nullSafeEquals(this.masterKeyStoreId, encryptedKey.getMasterKeystoreId())
                        || !EqualsHelper.nullSafeEquals(this.masterKeyAlias, encryptedKey.getMasterKeyAlias()))
                {
                    throw new ContentIOException(
                            "Content encryption key was encrypted with a master key from a different master key store / with a different key alias");
                }

                final ByteBuffer ekBuffer = encryptedKey.getByteBuffer();
                try (final ByteBufferByteChannel ekChannel = new ByteBufferByteChannel(ekBuffer))
                {
                    try (final DecryptingReadableByteChannel dkChannel = new DecryptingReadableByteChannel(ekChannel,
                            this.masterPrivateKey))
                    {
                        // due to overhead the key should always have fewer bytes than the encrypted key
                        final ByteBuffer dkBuffer = ByteBuffer.allocate(ekBuffer.capacity());
                        dkChannel.read(dkBuffer);

                        dkBuffer.flip();
                        final byte[] keyBytes = new byte[dkBuffer.remaining()];
                        dkBuffer.get(keyBytes);

                        key = new SecretKeySpec(keyBytes, encryptedKey.getAlgorithm());
                    }
                }

                reader = new DecryptingContentReaderFacade(backingReader, key, urlKeyEntity.getUnencryptedFileSize());
            }
            catch (final DecoderException | IOException e)
            {
                LOGGER.error("Error loading symmetric content encryption key", e);
                throw new ContentIOException("Error loading symmetric content encryption key", e);
            }
        }
        else
        {
            reader = backingReader;
        }
    }
    else
    {
        reader = backingReader;
    }
    return reader;
}
 
开发者ID:Acosix,项目名称:alfresco-simple-content-stores,代码行数:69,代码来源:EncryptingContentStore.java


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