本文整理汇总了Java中org.alfresco.service.namespace.NamespaceService类的典型用法代码示例。如果您正苦于以下问题:Java NamespaceService类的具体用法?Java NamespaceService怎么用?Java NamespaceService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NamespaceService类属于org.alfresco.service.namespace包,在下文中一共展示了NamespaceService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.alfresco.service.namespace.NamespaceService; //导入依赖的package包/类
@Override
public void setUp() throws Exception
{
AuthenticationUtil.setRunAsUserSystem();
nodeService = (NodeService)ctx.getBean("NodeService");
assertNotNull("nodeService", nodeService);
authorityService = (AuthorityService)ctx.getBean("AuthorityService");
assertNotNull("authorityService", authorityService);
ChildApplicationContextFactory emailSubsystem = (ChildApplicationContextFactory) ctx.getBean("InboundSMTP");
assertNotNull("emailSubsystem", emailSubsystem);
ApplicationContext emailCtx = emailSubsystem.getApplicationContext();
emailService = (EmailService)emailCtx.getBean("emailService");
assertNotNull("emailService", emailService);
personService = (PersonService)emailCtx.getBean("PersonService");
assertNotNull("personService", personService);
namespaceService = (NamespaceService)emailCtx.getBean("NamespaceService");
assertNotNull("namespaceService", namespaceService);
searchService = (SearchService)emailCtx.getBean("SearchService");
assertNotNull("searchService", searchService);
folderEmailMessageHandler = (FolderEmailMessageHandler) emailCtx.getBean("folderEmailMessageHandler");
assertNotNull("folderEmailMessageHandler", folderEmailMessageHandler);
transactionHelper = (RetryingTransactionHelper) emailCtx.getBean("retryingTransactionHelper");
assertNotNull("transactionHelper", transactionHelper);
}
示例2: makeRenditionNode
import org.alfresco.service.namespace.NamespaceService; //导入依赖的package包/类
private NodeRef makeRenditionNode(NodeRef parent, String title, String name, String mimetype)
{
Map<QName, Serializable> props = new HashMap<QName, Serializable>();
props.put(ContentModel.PROP_NAME, name);
props.put(ContentModel.PROP_TITLE, title);
QName assocQName = QName.createQName(NamespaceService.RENDITION_MODEL_1_0_URI, name);
ChildAssociationRef assoc = nodeService.createNode(parent, RenditionModel.ASSOC_RENDITION,
assocQName, ContentModel.TYPE_THUMBNAIL, props);
NodeRef childRef = assoc.getChildRef();
if (!nodeService.hasAspect(parent, RenditionModel.ASPECT_RENDITIONED))
{
nodeService.addAspect(parent, RenditionModel.ASPECT_RENDITIONED, null);
}
ContentWriter writer = contentService.getWriter(childRef, ContentModel.PROP_CONTENT, true);
writer.setMimetype(mimetype);
writer.setEncoding("UTF-8");
writer.putContent("Dummy "+name+" content");
return childRef;
}
示例3: createFolderNode
import org.alfresco.service.namespace.NamespaceService; //导入依赖的package包/类
private NodeRef createFolderNode(NodeRef parentFolderNodeRef, String nameValue)
{
if (nameValue != null)
{
Map<QName, Serializable> folderProps = new HashMap<QName, Serializable>();
folderProps.put(ContentModel.PROP_NAME, nameValue);
return this.nodeService.createNode(
parentFolderNodeRef,
ContentModel.ASSOC_CONTAINS,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, nameValue),
ContentModel.TYPE_FOLDER,
folderProps).getChildRef();
}
return null;
}
示例4: createPdfDocumentAsCurrentlyAuthenticatedUser
import org.alfresco.service.namespace.NamespaceService; //导入依赖的package包/类
private NodeRef createPdfDocumentAsCurrentlyAuthenticatedUser(final String nodeName)
{
Map<QName, Serializable> props = new HashMap<QName, Serializable>();
props.put(ContentModel.PROP_NAME, nodeName);
NodeRef result = nodeService.createNode(testFolder,
ContentModel.ASSOC_CONTAINS,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, nodeName),
ContentModel.TYPE_CONTENT,
props).getChildRef();
File file = loadQuickPdfFile();
// Set the content
ContentWriter writer = contentService.getWriter(result, ContentModel.PROP_CONTENT, true);
writer.setMimetype(MimetypeMap.MIMETYPE_PDF);
writer.setEncoding("UTF-8");
writer.putContent(file);
return result;
}
示例5: testLastThumbnailModificationDataContentCopy
import org.alfresco.service.namespace.NamespaceService; //导入依赖的package包/类
/**
* See REPO-2257, MNT-17661
*/
public void testLastThumbnailModificationDataContentCopy() throws Exception
{
final NodeRef pdfOrig = createOriginalContent(this.folder, MimetypeMap.MIMETYPE_PDF);
QName qname = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "doclib");
ThumbnailDefinition details = thumbnailService.getThumbnailRegistry().getThumbnailDefinition(qname.getLocalName());
NodeRef thumbnail = this.thumbnailService.createThumbnail(pdfOrig, ContentModel.PROP_CONTENT, MimetypeMap.MIMETYPE_IMAGE_JPEG,
details.getTransformationOptions(), "doclib");
assertNotNull(thumbnail);
setComplete();
endTransaction();
Thread.sleep(1000);
// Get initial value of property "Last thumbnail modification data"
List<String>lastThumbnailData = (List<String>)this.secureNodeService.getProperty(pdfOrig, ContentModel.PROP_LAST_THUMBNAIL_MODIFICATION_DATA);
assertNotNull(lastThumbnailData);
assertEquals(1, lastThumbnailData.size());
assertTrue(lastThumbnailData.get(0).contains("doclib:"));
final NodeRef pdfCopy = copyService.copy(pdfOrig, this.folder, ContentModel.ASSOC_CONTAINS, QName.createQName("copyOfOriginal"));
List<String> lastThumbnailDataCopy = (List<String>)this.secureNodeService.getProperty(pdfCopy, ContentModel.PROP_LAST_THUMBNAIL_MODIFICATION_DATA);
assertNull(lastThumbnailDataCopy);
}
示例6: registerRuleTrigger
import org.alfresco.service.namespace.NamespaceService; //导入依赖的package包/类
/**
* @see org.alfresco.repo.rule.ruletrigger.RuleTrigger#registerRuleTrigger()
*/
public void registerRuleTrigger()
{
if (isClassBehaviour == true)
{
this.policyComponent.bindClassBehaviour(
QName.createQName(NamespaceService.ALFRESCO_URI, POLICY_NAME),
this,
new JavaBehaviour(this, POLICY_NAME));
}
else
{
this.policyComponent.bindAssociationBehaviour(
QName.createQName(NamespaceService.ALFRESCO_URI, POLICY_NAME),
this,
new JavaBehaviour(this, POLICY_NAME));
}
}
示例7: getXPathName
import org.alfresco.service.namespace.NamespaceService; //导入依赖的package包/类
public static String getXPathName(QName qName, NamespacePrefixResolver nspr)
{
Collection<String> prefixes = nspr.getPrefixes(qName.getNamespaceURI());
if (prefixes.size() == 0)
{
throw new NamespaceException("A namespace prefix is not registered for uri " + qName.getNamespaceURI());
}
String prefix = prefixes.iterator().next();
if (prefix.equals(NamespaceService.DEFAULT_PREFIX))
{
return ISO9075.encode(qName.getLocalName());
}
else
{
return prefix + ":" + ISO9075.encode(qName.getLocalName());
}
}
示例8: testNoOldRenditionAndNoDestinationSpecifiedAndParentIsNotSource
import org.alfresco.service.namespace.NamespaceService; //导入依赖的package包/类
public void testNoOldRenditionAndNoDestinationSpecifiedAndParentIsNotSource()
{
String localName = "Foo";
QName assocName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, localName);
NodeRef parent = new NodeRef("http://test/parentId");
ChildAssociationRef parentAssoc = makeAssoc(parent, destination, assocName, false);
Map<QName, Serializable> indexProps = Collections.singletonMap(ContentModel.PROP_IS_INDEXED, (Serializable) Boolean.FALSE);
when(nodeService.createNode(parent, ContentModel.ASSOC_CONTAINS, assocName, ContentModel.TYPE_CONTENT, indexProps))
.thenReturn(parentAssoc);
RenditionLocation location = new RenditionLocationImpl(parent, null, localName);
RenditionNodeManager manager = new RenditionNodeManager(source, null, location, definition, nodeService, renditionService, behaviourFilter);
ChildAssociationRef result = manager.findOrCreateRenditionNode();
assertEquals(parentAssoc, result);
// Check the rendition association is created.
verify(nodeService).addChild(source, destination, RenditionModel.ASSOC_RENDITION, renditionName);
}
示例9: onSetUpInTransaction
import org.alfresco.service.namespace.NamespaceService; //导入依赖的package包/类
/**
* Called at the begining of all tests
*/
@SuppressWarnings("deprecation")
@Override
protected void onSetUpInTransaction() throws Exception
{
this.nodeService = (NodeService)this.applicationContext.getBean("nodeService");
this.namespaceService = (NamespaceService)this.applicationContext.getBean("namespaceService");
this.personService = (PersonService)this.applicationContext.getBean("personService");
AuthenticationComponent authenticationComponent = (AuthenticationComponent)applicationContext.getBean("authenticationComponent");
authenticationComponent.setCurrentUser(authenticationComponent.getSystemUserName());
// Create the store and get the root node
rootNodeRef = nodeService.getRootNode(new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"));
this.nodeRef = this.nodeService.createNode(
this.rootNodeRef,
ContentModel.ASSOC_CHILDREN,
QName.createQName("{test}testnode"),
ContentModel.TYPE_CONTENT).getChildRef();
// Get the executer instance
this.executer = (StartWorkflowActionExecuter)this.applicationContext.getBean(StartWorkflowActionExecuter.NAME);
}
示例10: processStartType
import org.alfresco.service.namespace.NamespaceService; //导入依赖的package包/类
/**
* Process start of a node definition
*
* @param xpp XmlPullParser
* @param typeDef TypeDefinition
* @param parserContext ParserContext
* @throws XmlPullParserException
* @throws IOException
*/
private void processStartType(XmlPullParser xpp, TypeDefinition typeDef, ParserContext parserContext)
throws XmlPullParserException, IOException
{
ParentContext parent = (ParentContext)parserContext.elementStack.peek();
NodeContext node = new NodeContext(typeDef.getName(), parent, typeDef);
// Extract child name if explicitly defined
String childName = xpp.getAttributeValue(NamespaceService.REPOSITORY_VIEW_1_0_URI, VIEW_CHILD_NAME_ATTR);
if (childName != null && childName.length() > 0)
{
node.setChildName(childName);
}
// Extract import id if explicitly defined
String importId = xpp.getAttributeValue(NamespaceService.REPOSITORY_VIEW_1_0_URI, VIEW_ID_ATTR);
if (importId != null && importId.length() > 0)
{
node.setImportId(importId);
}
parserContext.elementStack.push(node);
if (logger.isDebugEnabled())
logger.debug(indentLog("Pushed " + node, parserContext.elementStack.size() -1));
}
示例11: checkTaskQueryTaskCompleted
import org.alfresco.service.namespace.NamespaceService; //导入依赖的package包/类
protected void checkTaskQueryTaskCompleted(String workflowInstanceId, WorkflowTask theTask, WorkflowTask startTask)
{
List<String> expectedTasks = Arrays.asList(theTask.getId(), startTask.getId());
checkProcessIdQuery(workflowInstanceId, expectedTasks, WorkflowTaskState.COMPLETED);
// Adhoc task should only be returned
QName taskName = QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "adhocTask");
checkTaskNameQuery(taskName, Arrays.asList(theTask.getId()), WorkflowTaskState.COMPLETED, workflowInstanceId);
// Completed adhocTask is assigned to USER2
checkActorIdQuery(USER2, Arrays.asList(theTask.getId()), WorkflowTaskState.COMPLETED, null);
// Workflow is still active, both tasks will be returned
checkIsActiveQuery(expectedTasks, WorkflowTaskState.COMPLETED, workflowInstanceId);
// Both tasks have custom property set
checkTaskPropsQuery(expectedTasks, WorkflowTaskState.COMPLETED, null);
}
示例12: setUp
import org.alfresco.service.namespace.NamespaceService; //导入依赖的package包/类
@Override
protected void setUp() throws Exception
{
super.setUp();
ApplicationContext appContext = getServer().getApplicationContext();
namespaceService = (NamespaceService) appContext.getBean("NamespaceService");
workflowService = (WorkflowService) appContext.getBean("WorkflowService");
MutableAuthenticationService authenticationService = (MutableAuthenticationService) appContext.getBean("AuthenticationService");
PersonService personService = (PersonService) appContext.getBean("PersonService");
SearchService searchService = (SearchService) appContext.getBean("SearchService");
FileFolderService fileFolderService = (FileFolderService) appContext.getBean("FileFolderService");
nodeService = (NodeService) appContext.getBean("NodeService");
// for the purposes of the tests make sure workflow engine is enabled/visible.
WorkflowAdminServiceImpl workflowAdminService = (WorkflowAdminServiceImpl) appContext.getBean("workflowAdminService");
this.wfTestHelper = new WorkflowTestHelper(workflowAdminService, getEngine(), true);
AuthorityService authorityService = (AuthorityService) appContext.getBean("AuthorityService");
personManager = new TestPersonManager(authenticationService, personService, nodeService);
groupManager = new TestGroupManager(authorityService);
authenticationComponent = (AuthenticationComponent) appContext.getBean("authenticationComponent");
dictionaryService = (DictionaryService) appContext.getBean("dictionaryService");
personManager.createPerson(USER1);
personManager.createPerson(USER2);
personManager.createPerson(USER3);
authenticationComponent.setSystemUserAsCurrentUser();
groupManager.addUserToGroup(GROUP, USER2);
packageRef = workflowService.createPackage(null);
NodeRef companyHome = searchService.selectNodes(nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE), COMPANY_HOME, null, namespaceService, false).get(0);
contentNodeRef = fileFolderService.create(companyHome, TEST_CONTENT + System.currentTimeMillis(), ContentModel.TYPE_CONTENT).getNodeRef();
authenticationComponent.clearCurrentSecurityContext();
}
示例13: initStaticData
import org.alfresco.service.namespace.NamespaceService; //导入依赖的package包/类
@BeforeClass public static void initStaticData() throws Exception
{
AUTHORITY_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("AuthorityService", AuthorityService.class);
NAMESPACE_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("namespaceService", NamespaceService.class);
NODE_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("NodeService", NodeService.class);
NODE_ARCHIVE_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("nodeArchiveService", NodeArchiveService.class);
SITE_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("siteService", SiteService.class);
COCI_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("checkOutCheckInService", CheckOutCheckInService.class);
TRANSACTION_HELPER = APP_CONTEXT_INIT.getApplicationContext().getBean("retryingTransactionHelper", RetryingTransactionHelper.class);
PERMISSION_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("permissionServiceImpl", PermissionService.class);
AUTHENTICATION_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("authenticationService", MutableAuthenticationService.class);
PERSON_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("PersonService", PersonService.class);
FILE_FOLDER_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("FileFolderService",FileFolderService.class);
AUTHENTICATION_COMPONENT = APP_CONTEXT_INIT.getApplicationContext().getBean("authenticationComponent",AuthenticationComponent.class);
LOCK_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("lockService",LockService.class);
// We'll create this test content as admin.
final String admin = AuthenticationUtil.getAdminUserName();
TEST_SITE_NAME = GUID.generate();
TEST_SUB_SITE_NAME = GUID.generate();
final QName subSiteType = QName.createQName("testsite", "testSubsite", NAMESPACE_SERVICE);
STATIC_TEST_SITES.createSite("sitePreset", TEST_SITE_NAME, "siteTitle", "siteDescription", SiteVisibility.PUBLIC, admin);
STATIC_TEST_SITES.createSite("sitePreset", TEST_SUB_SITE_NAME, "siteTitle", "siteDescription", SiteVisibility.PUBLIC, subSiteType, admin);
TEST_SITE_WITH_MEMBERS = STATIC_TEST_SITES.createTestSiteWithUserPerRole(SiteServiceImplMoreTest.class.getSimpleName(), "sitePreset", SiteVisibility.PUBLIC, admin);
}
示例14: setUp
import org.alfresco.service.namespace.NamespaceService; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void setUp() throws Exception
{
ConfigurableApplicationContext appContext = loadContext();
this.repo = (RepositoryService) appContext.getBean("activitiRepositoryService");
this.runtime = (RuntimeService) appContext.getBean("activitiRuntimeService");
ServiceRegistry serviceRegistry = (ServiceRegistry) appContext.getBean(ServiceRegistry.SERVICE_REGISTRY);
authenticationComponent = (AuthenticationComponent) appContext.getBean("authenticationComponent");
TransactionService transactionService = serviceRegistry.getTransactionService();
nodeService = serviceRegistry.getNodeService();
txnHelper = transactionService.getRetryingTransactionHelper();
// authenticate
authenticationComponent.setSystemUserAsCurrentUser();
StoreRef storeRef = nodeService.createStore(
StoreRef.PROTOCOL_WORKSPACE,
"test-" + getName() + "-" + System.currentTimeMillis());
NodeRef rootNodeRef = nodeService.getRootNode(storeRef);
// Create a node to work on
workingNodeRef = nodeService.createNode(
rootNodeRef,
ContentModel.ASSOC_CHILDREN,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, getName()),
ContentModel.TYPE_CMOBJECT).getChildRef();
String resource = "org/alfresco/repo/workflow/activiti/testTransaction.bpmn20.xml";
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
InputStream input= classLoader.getResourceAsStream(resource);
this.deployment = repo.createDeployment()
.addInputStream(resource, input)
.deploy();
}
示例15: createFolderNode
import org.alfresco.service.namespace.NamespaceService; //导入依赖的package包/类
private TransferManifestNormalNode createFolderNode(String folderName) throws Exception
{
TransferManifestNormalNode node = new TransferManifestNormalNode();
String uuid = GUID.generate();
NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, uuid);
node.setNodeRef(nodeRef);
node.setUuid(uuid);
node.setType(ContentModel.TYPE_FOLDER);
NodeRef parentFolder = repositoryHelper.getGuestHome();
String nodeName = folderName == null ? uuid + ".folder" + getNameSuffix() : folderName;
List<ChildAssociationRef> parents = new ArrayList<ChildAssociationRef>();
ChildAssociationRef primaryAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, parentFolder, QName
.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, nodeName), node.getNodeRef(), true, -1);
parents.add(primaryAssoc);
node.setParentAssocs(parents);
node.setParentPath(nodeService.getPath(parentFolder));
node.setPrimaryParentAssoc(primaryAssoc);
Map<QName, Serializable> props = new HashMap<QName, Serializable>();
props.put(ContentModel.PROP_NODE_UUID, uuid);
props.put(ContentModel.PROP_NAME, nodeName);
node.setProperties(props);
return node;
}