org.alfresco.repo.nodelocator.CompanyHomeNodeLocator Java Examples
The following examples show how to use
org.alfresco.repo.nodelocator.CompanyHomeNodeLocator.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GetMethodRegressionTest.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 6 votes |
@Before public void setUp() throws Exception { applicationContext = ApplicationContextHelper.getApplicationContext(); ServiceRegistry registry = (ServiceRegistry) applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY); davHelper = (WebDAVHelper) applicationContext.getBean(WebDAVHelper.BEAN_NAME); auditRegistry = (AuditModelRegistryImpl) applicationContext.getBean(AUDIT_REGISTRY_BEAN_NAME); auditService = registry.getAuditService(); fileFolderService = registry.getFileFolderService(); transactionService = registry.getTransactionService(); testingMethod = new GetMethod(); mockResponse = new MockHttpServletResponse(); restartTransaction(TransactionActionEnum.ACTION_NONE); AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); companyHomeNodeRef = registry.getNodeLocatorService().getNode(CompanyHomeNodeLocator.NAME, null, null); rootTestFolder = fileFolderService.create(companyHomeNodeRef, ROOT_TEST_FOLDER_NAME, ContentModel.TYPE_FOLDER).getNodeRef(); }
Example #2
Source File: PolicyComponentTransactionTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Override protected void setUp() throws Exception { applicationContext = ApplicationContextHelper.getApplicationContext(); // initialise policy test model DictionaryBootstrap bootstrap = new DictionaryBootstrap(); List<String> bootstrapModels = new ArrayList<String>(); bootstrapModels.add(TEST_MODEL); bootstrap.setModels(bootstrapModels); bootstrap.setDictionaryDAO((DictionaryDAO)applicationContext.getBean("dictionaryDAO")); bootstrap.setTenantService((TenantService)applicationContext.getBean("tenantService")); bootstrap.bootstrap(); // retrieve policy component this.policyComponent = (PolicyComponent)applicationContext.getBean("policyComponent"); this.behaviourFilter = (BehaviourFilter) applicationContext.getBean("policyBehaviourFilter"); this.trxService = (TransactionService) applicationContext.getBean("transactionComponent"); this.nodeService = (NodeService) applicationContext.getBean("nodeService"); this.nodeLocatorService = (NodeLocatorService) applicationContext.getBean("nodeLocatorService"); this.authenticationComponent = (AuthenticationComponent)applicationContext.getBean("authenticationComponent"); this.authenticationComponent.setSystemUserAsCurrentUser(); // Register Policy if (sideEffectDelegate == null) { sideEffectDelegate = policyComponent.registerClassPolicy(SideEffectTestPolicy.class); // Bind Behaviour to side effect policy QName policyName = QName.createQName(TEST_NAMESPACE, "sideEffect"); Behaviour baseBehaviour = new JavaBehaviour(this, "sideEffectTest", NotificationFrequency.TRANSACTION_COMMIT); this.policyComponent.bindClassBehaviour(policyName, BASE_TYPE, baseBehaviour); } this.companyHome = nodeLocatorService.getNode(CompanyHomeNodeLocator.NAME, null, null); createAndEnableBehaviours(); }
Example #3
Source File: UpdateTagScopesActionExecuterTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * Creates simple hierarchy with documents tagged on the first layer only * * @param registry - {@link ServiceRegistry} instance * @param createdTagScopes - {@link List}<{@link NodeRef}> instance which contains all tag scope folders */ private void createTestContent(ServiceRegistry registry, List<NodeRef> createdTagScopes) { NodeRef rootNode = registry.getNodeLocatorService().getNode(CompanyHomeNodeLocator.NAME, null, null); NodeRef currentParent = rootNode; for (int i = 0; i < TAGSCOPE_LAYERS; i++) { FileInfo newFolder = fileFolderService.create(currentParent, String.format(TEST_FOLDER_NAME_PATTERN, i), ContentModel.TYPE_FOLDER); currentParent = newFolder.getNodeRef(); if (null != createdTagScopes) { createdTagScopes.add(currentParent); } nodeService.addAspect(currentParent, ContentModel.ASPECT_TAGSCOPE, null); for (int j = 0; j < TEST_DOCUMENTS_AMOUNT; j++) { FileInfo newDocument = fileFolderService.create(currentParent, String.format(TEST_DOCUMENT_NAME_PATTERN, i, j), ContentModel.TYPE_CONTENT); nodeService.addAspect(newDocument.getNodeRef(), ContentModel.ASPECT_TAGGABLE, null); if (0 == i) { for (int k = 0; k < TEST_TAGS_AMOUNT; k++) { String tagName = String.format(TEST_TAG_NAME_PATTERN, k, j, i); testTags.add(tagName); taggingService.addTag(newDocument.getNodeRef(), tagName); } } } } }
Example #4
Source File: ScriptUtils.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
/** * Use the Node Locator Service to find the a node reference from a number of possible locator types. * This method is responsible for determining the locator type and then calling the Service as the * Service does not know how to guess which locator to use. * <p> * This service supports 'virtual' nodes including the following: * <p> * alfresco://company/home The Company Home root node<br> * alfresco://user/home The User Home node under Company Home<br> * alfresco://company/shared The Shared node under Company Home<br> * alfresco://sites/home The Sites home node under Company Home<br> * workspace://.../... Any standard NodeRef<br> * /app:company_home/cm:... XPath QName style node reference<br> * * @param reference The node reference - See above for list of possible node references supported. * * @return ScriptNode representing the node or null if not found */ public ScriptNode resolveNodeReference(final String reference) { if (reference == null) { throw new IllegalArgumentException("Node 'reference' argument is mandatory."); } final NodeLocatorService locatorService = this.services.getNodeLocatorService(); NodeRef nodeRef = null; switch (reference) { case "alfresco://company/home": nodeRef = locatorService.getNode(CompanyHomeNodeLocator.NAME, null, null); break; case "alfresco://user/home": nodeRef = locatorService.getNode(UserHomeNodeLocator.NAME, null, null); break; case "alfresco://company/shared": nodeRef = locatorService.getNode(SharedHomeNodeLocator.NAME, null, null); break; case "alfresco://sites/home": nodeRef = locatorService.getNode(SitesHomeNodeLocator.NAME, null, null); break; default: if (reference.indexOf("://") > 0) { NodeRef ref = new NodeRef(reference); if (this.services.getNodeService().exists(ref) && this.services.getPermissionService().hasPermission(ref, PermissionService.READ) == AccessStatus.ALLOWED) { nodeRef = ref; } } else if (reference.startsWith("/")) { final Map<String, Serializable> params = new HashMap<>(1, 1.0f); params.put(XPathNodeLocator.QUERY_KEY, reference); nodeRef = locatorService.getNode(XPathNodeLocator.NAME, null, params); } break; } return nodeRef != null ? (ScriptNode)new ValueConverter().convertValueForScript(this.services, getScope(), null, nodeRef) : null; }
Example #5
Source File: NodeLocatorWebScriptTest.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 4 votes |
public void testCompanyHomeNodeLocator() throws Exception { String url = baseURL + CompanyHomeNodeLocator.NAME; checkNodeLocator(url, companyHome); }
Example #6
Source File: CustomContentModelIT.java From alfresco-sdk with Apache License 2.0 | 2 votes |
/** * Get the node reference for the /Company Home top folder in Alfresco. * Use the standard node locator service. * * @return the node reference for /Company Home */ private NodeRef getCompanyHomeNodeRef() { return getServiceRegistry().getNodeLocatorService().getNode(CompanyHomeNodeLocator.NAME, null, null); }
Example #7
Source File: CustomContentModelIT.java From alfresco-sdk with Apache License 2.0 | 2 votes |
/** * Get the node reference for the /Company Home top folder in Alfresco. * Use the standard node locator service. * * @return the node reference for /Company Home */ private NodeRef getCompanyHomeNodeRef() { return getServiceRegistry().getNodeLocatorService().getNode(CompanyHomeNodeLocator.NAME, null, null); }