本文整理汇总了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);
}
示例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() });
}
示例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());
}
示例4: setMetadataExtracterRegistry
import org.alfresco.repo.content.metadata.MetadataExtracterRegistry; //导入依赖的package包/类
/**
* @param metadataExtracterRegistry The metadataExtracterRegistry to set.
*/
public void setMetadataExtracterRegistry(MetadataExtracterRegistry metadataExtracterRegistry)
{
this.metadataExtracterRegistry = metadataExtracterRegistry;
}
示例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);
}
}
示例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);
}
示例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;
}
示例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();
}
示例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);
}