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


Java ImporterContentCache类代码示例

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


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

示例1: onCreateInTxn

import org.alfresco.service.cmr.view.ImporterContentCache; //导入依赖的package包/类
private void onCreateInTxn()
{       
    final File viewFile = ImporterBootstrap.getFile(contentViewLocation);
    ImportPackageHandler acpHandler = new ACPImportPackageHandler(viewFile, null);
    Location location = new Location(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
    location.setPath(getParentPath());

    final ImporterBinding binding = new ImporterBinding()
    {
        @Override
        public String getValue(String key)
        {
            return bundle.getString(key);
        }

        @Override
        public UUID_BINDING getUUIDBinding()
        {
            return UUID_BINDING.CREATE_NEW;
        }

        @Override
        public QName[] getExcludedClasses()
        {
            return null;
        }

        @Override
        public boolean allowReferenceWithinTransaction()
        {
            return false;
        }
        
        @Override
        public ImporterContentCache getImportConentCache()
        {
            return null;
        }
    };

    importerService.importView(acpHandler, location, binding, (ImporterProgress) null);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:43,代码来源:DynamicCreateRepositoryLocation.java

示例2: importContent

import org.alfresco.service.cmr.view.ImporterContentCache; //导入依赖的package包/类
/**
 * Import Node Content.
 * <p>
 * The content URL, if present, will be a local URL.  This import copies the content
 * from the local URL to a server-assigned location.
 *
 * @param nodeRef containing node
 * @param propertyName the name of the content-type property
 * @param importContentData the identifier of the content to import
 */
private void importContent(NodeRef nodeRef, QName propertyName, String importContentData)
{
    ImporterContentCache contentCache = (binding == null) ? null : binding.getImportConentCache();
    
    // bind import content data description
    importContentData = bindPlaceHolder(importContentData, binding);
    if (importContentData != null && importContentData.length() > 0)
    {
        DataTypeDefinition dataTypeDef = dictionaryService.getDataType(DataTypeDefinition.CONTENT);
        ContentData contentData = (ContentData)DefaultTypeConverter.INSTANCE.convert(dataTypeDef, importContentData);
        String contentUrl = contentData.getContentUrl();
        if (contentUrl != null && contentUrl.length() > 0)
        {
            Map<QName, Serializable> propsBefore = null;
            if (contentUsageImpl != null && contentUsageImpl.getEnabled())
            {
                propsBefore = nodeService.getProperties(nodeRef);
            }

            if (contentCache != null)
            {
                // import content from source
                ContentData cachedContentData = contentCache.getContent(streamHandler, contentData);
                nodeService.setProperty(nodeRef, propertyName, cachedContentData);
            }
            else
            {
                // import the content from the import source file
                InputStream contentStream = streamHandler.importStream(contentUrl);
                ContentWriter writer = contentService.getWriter(nodeRef, propertyName, true);
                writer.setEncoding(contentData.getEncoding());
                writer.setMimetype(contentData.getMimetype());
                writer.putContent(contentStream);
            }
                                
            if (contentUsageImpl != null && contentUsageImpl.getEnabled())
            {
                // Since behaviours for content nodes have all been disabled,
                // it is necessary to update the user's usage stats.
                Map<QName, Serializable> propsAfter = nodeService.getProperties(nodeRef);
                contentUsageImpl.onUpdateProperties(nodeRef, propsBefore, propsAfter);
            }
            
            reportContentCreated(nodeRef, contentUrl);
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:58,代码来源:ImporterComponent.java

示例3: getImportConentCache

import org.alfresco.service.cmr.view.ImporterContentCache; //导入依赖的package包/类
@Override
public ImporterContentCache getImportConentCache()
{
    return null;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:6,代码来源:FileSourceImporter.java

示例4: testImportFoldersUuidBindingNullUuidNullLocationPath

import org.alfresco.service.cmr.view.ImporterContentCache; //导入依赖的package包/类
public void testImportFoldersUuidBindingNullUuidNullLocationPath() throws Exception
{
    Location location = new Location(storeRef);
     
    InputStream test1 = getClass().getClassLoader().getResourceAsStream("org/alfresco/repo/importer/import_folders.xml");
    InputStreamReader testReader1 = new InputStreamReader(test1, "UTF-8");
    try
    {
        importerService.importView(testReader1, location, new ImporterBinding()
        {
            
            @Override
            public String getValue(String key)
            {
                return null;
            }
            
            @Override
            public UUID_BINDING getUUIDBinding()
            {
                return UUID_BINDING.UPDATE_EXISTING;
            }
            
            @Override
            public ImporterContentCache getImportConentCache()
            {
                return null;
            }
            
            @Override
            public QName[] getExcludedClasses()
            {
                return null;
            }
            
            @Override
            public boolean allowReferenceWithinTransaction()
            {
                return true;
            }
        }, new ImportTimerProgress());
    }
    finally
    {
        testReader1.close();
    }
    
    //  - root        
    //      - Main folder  
    //          - sub folder 
    //              - sub folder 1
    //              - sub folder 2
    //      - Archive folder
    
    NodeRef rootNodeRef = nodeService.getRootNode(storeRef);
    List<ChildAssociationRef> childAssocs = nodeService.getChildAssocs(
            rootNodeRef,
            RegexQNamePattern.MATCH_ALL,
            new RegexQNamePattern(NamespaceService.CONTENT_MODEL_1_0_URI, "main folder"));
    assertEquals("'main folder' path not found", 1, childAssocs.size());
    
    NodeRef mainFolderNode = childAssocs.get(0).getChildRef();
    childAssocs = nodeService.getChildAssocs(mainFolderNode);
    assertEquals("'sub folder' path not found", 1, childAssocs.size());
    
    NodeRef subFolderNode = childAssocs.get(0).getChildRef();
    childAssocs = nodeService.getChildAssocs(subFolderNode);                
    assertEquals("'subsub folder' path not found", 2, childAssocs.size());
    
    childAssocs = nodeService.getChildAssocs(
            rootNodeRef,
            RegexQNamePattern.MATCH_ALL,
            new RegexQNamePattern(NamespaceService.CONTENT_MODEL_1_0_URI, "ArchiveFolder"));
    assertEquals("'ArchiveFolder' path not found", 1, childAssocs.size());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:76,代码来源:ImporterComponentTest.java

示例5: importSite

import org.alfresco.service.cmr.view.ImporterContentCache; //导入依赖的package包/类
private void importSite(final String siteId, final NodeRef siteNodeRef)
{
    ImportPackageHandler acpHandler = new SiteImportPackageHandler(siteSurfConfig, siteId);
    Location location = new Location(siteNodeRef);
    ImporterBinding binding = new ImporterBinding()
    {
        @Override
        public String getValue(String key)
        {
            if (key.equals("siteId"))
            {
                return siteId;
            }
            return null;
        }

        @Override
        public UUID_BINDING getUUIDBinding()
        {
            return UUID_BINDING.CREATE_NEW;
        }

        @Override
        public QName[] getExcludedClasses()
        {
            return null;
        }

        @Override
        public boolean allowReferenceWithinTransaction()
        {
            return false;
        }

        @Override
        public ImporterContentCache getImportConentCache()
        {
            return null;
        }
    };
    importerService.importView(acpHandler, location, binding, (ImporterProgress)null);
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:43,代码来源:SitesImpl.java


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