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


Java ContentExistsException类代码示例

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


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

示例1: testConcurrentWriteDetection

import org.alfresco.repo.content.ContentExistsException; //导入依赖的package包/类
/**
 * Checks that the store disallows concurrent writers to be issued to the same URL.
 */
@SuppressWarnings("unused")
@Test
public void testConcurrentWriteDetection() throws Exception
{
    ByteBuffer buffer = ByteBuffer.wrap("Something".getBytes());
    ContentStore store = getStore();

    ContentContext firstContentCtx = ContentStore.NEW_CONTENT_CONTEXT;
    ContentWriter firstWriter = store.getWriter(firstContentCtx);
    String contentUrl = firstWriter.getContentUrl();

    ContentContext secondContentCtx = new ContentContext(null, contentUrl);
    try
    {
        ContentWriter secondWriter = store.getWriter(secondContentCtx);
        fail("Store must disallow more than one writer onto the same content URL: " + store);
    }
    catch (ContentExistsException e)
    {
        // expected
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:FileContentStoreTest.java

示例2: testSpoofedContent

import org.alfresco.repo.content.ContentExistsException; //导入依赖的package包/类
/**
 * Ensure that the store is able to produce readers for spoofed text.
 * 
 * @since 5.1
 */
@Test
public void testSpoofedContent() throws Exception
{
    String url = SpoofedTextContentReader.createContentUrl(Locale.ENGLISH, 0L, 1024L);
    ContentContext ctx = new ContentContext(null, url);
    try
    {
        store.getWriter(ctx);
        fail("FileContentStore should report that all 'spoof' content exists.");
    }
    catch (ContentExistsException e)
    {
        // Expected
    }
    assertFalse("Deletion should be 'false'.", store.delete(url));
    assertTrue("All spoofed content already exists!", store.exists(url));
    ContentReader reader = store.getReader(url);
    assertTrue(reader instanceof SpoofedTextContentReader);
    assertEquals(1024L, reader.getContentString().getBytes("UTF-8").length);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:FileContentStoreTest.java

示例3: getWriter

import org.alfresco.repo.content.ContentExistsException; //导入依赖的package包/类
/**
 *
 * {@inheritDoc}
 */
@Override
public ContentWriter getWriter(final ContentContext context)
{
    if (!this.isWriteSupported())
    {
        LOGGER.debug("Write requests are not supported for this store:\n\tStore:   {}\n\tContext: {}", this, context);
        throw new UnsupportedOperationException("Write operations are not supported by this store: " + this);
    }

    final String contentUrl = context.getContentUrl();
    if (contentUrl != null)
    {
        if (!this.isContentUrlSupported(contentUrl))
        {
            LOGGER.debug("Specific writer content URL is unsupported: \n\tStore:   {}\n\tContext: {}", this, context);
            throw new UnsupportedContentUrlException(this, contentUrl);
        }
        else if (this.exists(contentUrl))
        {
            LOGGER.debug("The content location is already used: \n\tStore:   {}\n\tContext: {}", this, context);
            throw new ContentExistsException(this, contentUrl);
        }
    }

    return this.backingStore.getWriter(context);
}
 
开发者ID:Acosix,项目名称:alfresco-simple-content-stores,代码行数:31,代码来源:CommonFacadingContentStore.java


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