當前位置: 首頁>>代碼示例>>Java>>正文


Java MetadataExtracterRegistry類代碼示例

本文整理匯總了Java中org.alfresco.repo.content.metadata.MetadataExtracterRegistry的典型用法代碼示例。如果您正苦於以下問題:Java MetadataExtracterRegistry類的具體用法?Java MetadataExtracterRegistry怎麽用?Java MetadataExtracterRegistry使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MetadataExtracterRegistry類屬於org.alfresco.repo.content.metadata包,在下文中一共展示了MetadataExtracterRegistry類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testUnknownProperties

import org.alfresco.repo.content.metadata.MetadataExtracterRegistry; //導入依賴的package包/類
public void testUnknownProperties()
{
    MetadataExtracterRegistry registry = (MetadataExtracterRegistry) applicationContext.getBean("metadataExtracterRegistry");
    TestUnknownMetadataExtracter extracterUnknown = new TestUnknownMetadataExtracter();
    extracterUnknown.setRegistry(registry);
    extracterUnknown.register();
    // Now add some content with a binary mimetype
    ContentWriter cw = this.contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true);
    cw.setMimetype(MimetypeMap.MIMETYPE_BINARY);
    cw.putContent("Content for " + getName());
    
    ActionImpl action = new ActionImpl(null, ID, SetPropertyValueActionExecuter.NAME, null);
    executer.execute(action, this.nodeRef);
    
    // The unkown properties should be present
    Serializable prop1 = nodeService.getProperty(nodeRef, PROP_UNKNOWN_1);
    Serializable prop2 = nodeService.getProperty(nodeRef, PROP_UNKNOWN_2);
    
    assertNotNull("Unknown property is null", prop1);
    assertNotNull("Unknown property is null", prop2);
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:22,代碼來源:ContentMetadataExtracterTest.java

示例2: onSetUpInTransaction

import org.alfresco.repo.content.metadata.MetadataExtracterRegistry; //導入依賴的package包/類
@Override
protected void onSetUpInTransaction() throws Exception
{
    this.nodeService = (NodeService) this.applicationContext.getBean("nodeService");
    this.contentService = (ContentService) this.applicationContext.getBean("contentService");
    this.dictionaryService = (DictionaryService) this.applicationContext.getBean("dictionaryService");
    this.mimetypeService = (MimetypeService) this.applicationContext.getBean("mimetypeService");
    this.metadataExtracterRegistry  = (MetadataExtracterRegistry) this.applicationContext.getBean("metadataExtracterRegistry");
    
    AuthenticationComponent authenticationComponent = (AuthenticationComponent)applicationContext.getBean("authenticationComponent");
    authenticationComponent.setSystemUserAsCurrentUser();

    // Create the store and get the root node
    this.testStoreRef = this.nodeService.createStore(
            StoreRef.PROTOCOL_WORKSPACE,
            "Test_" + System.currentTimeMillis());
    this.rootNodeRef = this.nodeService.getRootNode(this.testStoreRef);

    // Create the node used for tests
    this.nodeRef = this.nodeService.createNode(
            this.rootNodeRef, ContentModel.ASSOC_CHILDREN,
            QName.createQName("{test}testnode"),
            ContentModel.TYPE_CONTENT).getChildRef();

    // Setup the content from the PDF test data
    ContentWriter cw = this.contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true);
    cw.setMimetype(MimetypeMap.MIMETYPE_PDF);
    cw.putContent(AbstractContentTransformerTest.loadQuickTestFile("pdf"));

    // Get the executer instance
    this.executer = new ContentMetadataEmbedder();
    this.executer.setNodeService(nodeService);
    this.executer.setContentService(contentService);
    this.executer.setMetadataExtracterRegistry(metadataExtracterRegistry);
    this.executer.setApplicableTypes(new String[] { ContentModel.TYPE_CONTENT.toString() });
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:37,代碼來源:ContentMetadataEmbedderTest.java

示例3: testFailingEmbedder

import org.alfresco.repo.content.metadata.MetadataExtracterRegistry; //導入依賴的package包/類
/**
 * Test that a failing embedder does not destroy the original content
 */
public void testFailingEmbedder()
{
    MetadataExtracterRegistry registry = (MetadataExtracterRegistry) applicationContext.getBean("metadataExtracterRegistry");
    FailingEmbedder embedder = new FailingEmbedder(Arrays.asList(MimetypeMap.MIMETYPE_PDF));
    embedder.setRegistry(registry);
    embedder.setDictionaryService(this.dictionaryService);
    embedder.setMimetypeService(this.mimetypeService);
    embedder.register();
    
    String myCreator = "Embedded creator";

    // Get the old props
    Map<QName, Serializable> props = this.nodeService.getProperties(this.nodeRef);
    props.put(ContentModel.PROP_AUTHOR, myCreator);
    this.nodeService.setProperties(this.nodeRef, props);

    // Execute the action
    ActionImpl action = new ActionImpl(null, ID, SetPropertyValueActionExecuter.NAME, null);
    
    ContentReader origReader = this.contentService.getReader(this.nodeRef, ContentModel.PROP_CONTENT);
    long origSize = origReader.getSize();
    assertTrue(origSize > 0);

    this.executer.execute(action, this.nodeRef);
    
    ContentReader embeddedReader = this.contentService.getReader(this.nodeRef, ContentModel.PROP_CONTENT);
    
    assertEquals("The original content should remain unchanged on embed failures", origSize, embeddedReader.getSize());
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:33,代碼來源:ContentMetadataEmbedderTest.java

示例4: setMetadataExtracterRegistry

import org.alfresco.repo.content.metadata.MetadataExtracterRegistry; //導入依賴的package包/類
/**
 * @param metadataExtracterRegistry The metadataExtracterRegistry to set.
 */
public void setMetadataExtracterRegistry(MetadataExtracterRegistry metadataExtracterRegistry)
{
    this.metadataExtracterRegistry = metadataExtracterRegistry;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:8,代碼來源:ContentMetadataExtracter.java

示例5: testNullExtractedValues_ALF1823

import org.alfresco.repo.content.metadata.MetadataExtracterRegistry; //導入依賴的package包/類
/**
 * Ensure that missing raw values result in node properties being removed
 * when running with {@link ContentMetadataExtracter#setCarryAspectProperties(boolean)}
 * set to <tt>false</tt>.
 */
public void testNullExtractedValues_ALF1823()
{
    MetadataExtracterRegistry registry = (MetadataExtracterRegistry) applicationContext.getBean("metadataExtracterRegistry");
    TestNullPropMetadataExtracter extractor = new TestNullPropMetadataExtracter();
    extractor.setRegistry(registry);
    extractor.register();
    // Now set the title and description
    nodeService.setProperty(nodeRef, ContentModel.PROP_TITLE, "TITLE");
    nodeService.setProperty(nodeRef, ContentModel.PROP_DESCRIPTION, "DESCRIPTION");
    // Now add some content with a binary mimetype
    ContentWriter cw = this.contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true);
    cw.setMimetype(MimetypeMap.MIMETYPE_BINARY);
    cw.putContent("Content for " + getName());
    
    ActionImpl action = new ActionImpl(null, ID, SetPropertyValueActionExecuter.NAME, null);
    executer.execute(action, this.nodeRef);
    
    // cm:titled properties should be present
    Serializable title = nodeService.getProperty(nodeRef, ContentModel.PROP_TITLE);
    Serializable descr = nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION);
    
    assertNotNull("cm:title property is null", title);
    assertNotNull("cm:description property is null", descr);
    
    try
    {
        // Now change the setting to remove unset aspect properties
        executer.setCarryAspectProperties(false);
        // Extract again
        executer.execute(action, this.nodeRef);
        
        // cm:titled properties should *NOT* be present
        title = nodeService.getProperty(nodeRef, ContentModel.PROP_TITLE);
        descr = nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION);
        
        assertNull("cm:title property is not null", title);
        assertNull("cm:description property is not null", descr);
    }
    finally
    {
        executer.setCarryAspectProperties(true);
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:49,代碼來源:ContentMetadataExtracterTest.java

示例6: setUp

import org.alfresco.repo.content.metadata.MetadataExtracterRegistry; //導入依賴的package包/類
@Override
protected void setUp() throws Exception
{
    // Detect any dangling transactions as there is a lot of direct UserTransaction manipulation
    if (AlfrescoTransactionSupport.getTransactionReadState() != TxnReadState.TXN_NONE)
    {
        throw new IllegalStateException(
                "There should not be any transactions when starting test: " +
                AlfrescoTransactionSupport.getTransactionId() + " started at " +
                new Date(AlfrescoTransactionSupport.getTransactionStartTime()));
    }
    
    // Get services
    this.taggingService = (TaggingService)ctx.getBean("TaggingService");
    this.nodeService = (NodeService) ctx.getBean("NodeService");
    this.contentService = (ContentService) ctx.getBean("ContentService");
    
    this.transactionService = (TransactionService)ctx.getBean("transactionComponent");
    this.auditService = (AuditService)ctx.getBean("auditService");
    this.authenticationComponent = (AuthenticationComponent)ctx.getBean("authenticationComponent");
    
    this.executer = (ContentMetadataExtracter) ctx.getBean("extract-metadata");
    executer.setEnableStringTagging(true);
    executer.setTaggingService(taggingService);
    
    if (init == false)
    {
        this.transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>(){

            @Override
            public Void execute() throws Throwable
            {
                // Authenticate as the system user
                authenticationComponent.setSystemUserAsCurrentUser();
                
                // Create the store and get the root node
                ContentMetadataExtracterTagMappingTest.storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
                ContentMetadataExtracterTagMappingTest.rootNode = nodeService.getRootNode(ContentMetadataExtracterTagMappingTest.storeRef);
            
                // Create the required tagging category
                NodeRef catContainer = nodeService.createNode(ContentMetadataExtracterTagMappingTest.rootNode, ContentModel.ASSOC_CHILDREN, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "categoryContainer"), ContentModel.TYPE_CONTAINER).getChildRef();        
                NodeRef catRoot = nodeService.createNode(
                        catContainer, 
                        ContentModel.ASSOC_CHILDREN, 
                        QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "categoryRoot"), 
                        ContentModel.TYPE_CATEGORYROOT).getChildRef();
                nodeService.createNode(
                       catRoot, 
                       ContentModel.ASSOC_CATEGORIES, 
                       ContentModel.ASPECT_TAGGABLE, 
                       ContentModel.TYPE_CATEGORY).getChildRef();
                
                MetadataExtracterRegistry registry = (MetadataExtracterRegistry) ctx.getBean("metadataExtracterRegistry");
                extractor = new TagMappingMetadataExtracter();
                extractor.setRegistry(registry);
                extractor.register();
                
                init = true;
                return null;
            }});
        
    }
    
    // We want to know when tagging actions have finished running
    asyncOccurs = (new TaggingServiceImplTest()).new AsyncOccurs();
    ((PolicyComponent)ctx.getBean("policyComponent")).bindClassBehaviour(
          AsynchronousActionExecutionQueuePolicies.OnAsyncActionExecute.QNAME,
          ActionModel.TYPE_ACTION,
          new JavaBehaviour(asyncOccurs, "onAsyncActionExecute", NotificationFrequency.EVERY_EVENT)
    );

    // We do want action tracking whenever the tag scope updater runs
    UpdateTagScopesActionExecuter updateTagsAction = 
        (UpdateTagScopesActionExecuter)ctx.getBean("update-tagscope");
    updateTagsAction.setTrackStatus(true);
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:77,代碼來源:ContentMetadataExtracterTagMappingTest.java

示例7: setMetadataExtracterRegistry

import org.alfresco.repo.content.metadata.MetadataExtracterRegistry; //導入依賴的package包/類
/**
 * Sets the Metadata Extractor Registry to be used to
 *  decide what extractors exist
 */
public void setMetadataExtracterRegistry(
     MetadataExtracterRegistry metadataExtracterRegistry) {
   this.metadataExtracterRegistry = metadataExtracterRegistry;
}
 
開發者ID:Alfresco,項目名稱:alfresco-remote-api,代碼行數:9,代碼來源:MimetypesGet.java

示例8: setUp

import org.alfresco.repo.content.metadata.MetadataExtracterRegistry; //導入依賴的package包/類
@Override
protected void setUp() throws Exception
{
    // Detect any dangling transactions as there is a lot of direct UserTransaction manipulation
    if (AlfrescoTransactionSupport.getTransactionReadState() != TxnReadState.TXN_NONE)
    {
        throw new IllegalStateException(
                "There should not be any transactions when starting test: " +
                AlfrescoTransactionSupport.getTransactionId() + " started at " +
                new Date(AlfrescoTransactionSupport.getTransactionStartTime()));
    }
    
    // Get services
    this.taggingService = (TaggingService)ctx.getBean("TaggingService");
    this.nodeService = (NodeService) ctx.getBean("NodeService");
    this.contentService = (ContentService) ctx.getBean("ContentService");
    
    this.transactionService = (TransactionService)ctx.getBean("transactionComponent");
    this.auditService = (AuditService)ctx.getBean("auditService");
    this.authenticationComponent = (AuthenticationComponent)ctx.getBean("authenticationComponent");
    
    this.executer = (ContentMetadataExtracter) ctx.getBean("extract-metadata");
    executer.setEnableStringTagging(true);
    executer.setTaggingService(taggingService);
    
    if (init == false)
    {
        this.transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>(){

            @Override
            public Void execute() throws Throwable
            {
                // Authenticate as the system user
                authenticationComponent.setSystemUserAsCurrentUser();
                
                // Create the store and get the root node
                ContentMetadataExtracterTagMappingTest.storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
                ContentMetadataExtracterTagMappingTest.rootNode = nodeService.getRootNode(ContentMetadataExtracterTagMappingTest.storeRef);
            
                // Create the required tagging category
                NodeRef catContainer = nodeService.createNode(ContentMetadataExtracterTagMappingTest.rootNode, ContentModel.ASSOC_CHILDREN, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "categoryContainer"), ContentModel.TYPE_CONTAINER).getChildRef();        
                NodeRef catRoot = nodeService.createNode(
                        catContainer, 
                        ContentModel.ASSOC_CHILDREN, 
                        QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "categoryRoot"), 
                        ContentModel.TYPE_CATEGORYROOT).getChildRef();
                nodeService.createNode(
                       catRoot, 
                       ContentModel.ASSOC_CATEGORIES, 
                       ContentModel.ASPECT_TAGGABLE, 
                       ContentModel.TYPE_CATEGORY).getChildRef();
                
                MetadataExtracterRegistry registry = (MetadataExtracterRegistry) ctx.getBean("metadataExtracterRegistry");
                extractor = new TagMappingMetadataExtracter();
                extractor.setRegistry(registry);
                extractor.register();
                
                init = true;
                return null;
            }});
        
    }
    
    // We want to know when tagging actions have finished running
    asyncOccurs = (new TaggingServiceImplTest()).new AsyncOccurs();
    ((PolicyComponent)ctx.getBean("policyComponent")).bindClassBehaviour(
          AsynchronousActionExecutionQueuePolicies.OnAsyncActionExecute.QNAME,
          ActionModel.TYPE_ACTION,
          new JavaBehaviour(asyncOccurs, "onAsyncActionExecute", NotificationFrequency.EVERY_EVENT)
    );

    // We do want action tracking whenever the tag scope updater runs
    UpdateTagScopesActionExecuter updateTagsAction = 
        (UpdateTagScopesActionExecuter)ctx.getBean("update-tagscope");
    updateTagsAction.setTrackStatus(true);

    // Create the folders and documents to be tagged
    createTestDocumentsAndFolders();
}
 
開發者ID:Alfresco,項目名稱:community-edition-old,代碼行數:80,代碼來源:ContentMetadataExtracterTagMappingTest.java

示例9: getMetadataExtracterRegistry

import org.alfresco.repo.content.metadata.MetadataExtracterRegistry; //導入依賴的package包/類
/**
 * Return the Metadata Extracter Registry
 * 
 * @param context Faces Context
 * @return the MetadataExtracterRegistry
 */
public static MetadataExtracterRegistry getMetadataExtracterRegistry(FacesContext context)
{
   return (MetadataExtracterRegistry)FacesContextUtils.getRequiredWebApplicationContext(
         context).getBean(METADATA_EXTACTER_REGISTRY);
}
 
開發者ID:Alfresco,項目名稱:community-edition-old,代碼行數:12,代碼來源:Repository.java


注:本文中的org.alfresco.repo.content.metadata.MetadataExtracterRegistry類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。