org.alfresco.service.cmr.repository.StoreRef Java Examples
The following examples show how to use
org.alfresco.service.cmr.repository.StoreRef.
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: AbstractLuceneIndexerAndSearcherFactory.java From alfresco-repository with GNU Lesser General Public License v3.0 | 7 votes |
@SuppressWarnings("unchecked") private LuceneIndexer getThreadLocalIndexer(StoreRef storeRef) { Map<StoreRef, LuceneIndexer> indexers = (Map<StoreRef, LuceneIndexer>) AlfrescoTransactionSupport.getResource(indexersKey); if (indexers == null) { indexers = new HashMap<StoreRef, LuceneIndexer>(); AlfrescoTransactionSupport.bindResource(indexersKey, indexers); } LuceneIndexer indexer = indexers.get(storeRef); if (indexer == null) { indexer = createIndexer(storeRef, GUID.generate()); indexers.put(storeRef, indexer); } return indexer; }
Example #2
Source File: LockServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * Get the locks given a store and query string. * * @param storeRef the store reference * @param query the query string * @return the locked nodes * @deprecated Uses search and does not report on ephemeral locks. */ @Deprecated private List<NodeRef> getLocks(StoreRef storeRef, String query) { List<NodeRef> result = new ArrayList<NodeRef>(); ResultSet resultSet = null; try { resultSet = this.searchService.query( storeRef, SearchService.LANGUAGE_LUCENE, query); result = resultSet.getNodeRefs(); } finally { if (resultSet != null) { resultSet.close(); } } return result; }
Example #3
Source File: RuleServiceImplTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
private void createNothingToDoScript(String scriptName) { NodeRef storeRootNodeRef = nodeService.getRootNode(new StoreRef("workspace://SpacesStore")); NodeRef scriptFolderRef = searchService.selectNodes(storeRootNodeRef, "/app:company_home/app:dictionary/app:scripts", null, namespaceService, false).get(0); try { FileInfo fileInfo = fileFolderService.create(scriptFolderRef, scriptName, ContentModel.TYPE_CONTENT); ContentWriter writer = fileFolderService.getWriter(fileInfo.getNodeRef()); assertNotNull("Writer is null", writer); // write some content String content = "function main(){}\nmain();"; writer.putContent(content); } catch (FileExistsException exc) { // file was created before } }
Example #4
Source File: ObjectIdLuceneBuilder.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 6 votes |
private <Q, S, E extends Throwable> String getValueAsString(LuceneQueryParserAdaptor<Q, S, E> lqpa, Serializable value) { String nodeRefStr = null; if(!NodeRef.isNodeRef((String)value)) { // assume the object id is the node guid StoreRef storeRef = getStore(lqpa); nodeRefStr = storeRef.toString() + "/" + (String)value; } else { nodeRefStr = (String)value; } Object converted = DefaultTypeConverter.INSTANCE.convert(dictionaryService.getDataType(DataTypeDefinition.NODE_REF), nodeRefStr); String asString = DefaultTypeConverter.INSTANCE.convert(String.class, converted); return asString; }
Example #5
Source File: ACLEntryAfterInvocationTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
public void testBasicDenyStore() throws Exception { runAs("andy"); Object o = new ClassWithMethods(); Method method = o.getClass().getMethod("echoStoreRef", new Class[] { StoreRef.class }); AdvisorAdapterRegistry advisorAdapterRegistry = GlobalAdvisorAdapterRegistry.getInstance(); ProxyFactory proxyFactory = new ProxyFactory(); proxyFactory.addAdvisor(advisorAdapterRegistry.wrap(new Interceptor("AFTER_ACL_NODE.sys:base.Read"))); proxyFactory.setTargetSource(new SingletonTargetSource(o)); Object proxy = proxyFactory.getProxy(); try { Object answer = method.invoke(proxy, new Object[] { rootNodeRef.getStoreRef() }); assertNotNull(answer); } catch (InvocationTargetException e) { } }
Example #6
Source File: GetNodesWithAspectCannedQueryFactory.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * Retrieve an unsorted instance of a {@link CannedQuery} based on parameters including * request for a total count (up to a given max) * * @param storeRef the store to search in, if requested * @param aspectQNames qnames of aspects to search for * @param pagingRequest skipCount, maxItems - optionally queryExecutionId and requestTotalCountMax * * @return an implementation that will execute the query */ public CannedQuery<NodeRef> getCannedQuery(StoreRef storeRef, Set<QName> aspectQNames, PagingRequest pagingRequest) { ParameterCheck.mandatory("aspectQNames", aspectQNames); ParameterCheck.mandatory("pagingRequest", pagingRequest); int requestTotalCountMax = pagingRequest.getRequestTotalCountMax(); // specific query params - context (parent) and inclusive filters (child types, property values) GetNodesWithAspectCannedQueryParams paramBean = new GetNodesWithAspectCannedQueryParams(storeRef, aspectQNames); // page details CannedQueryPageDetails cqpd = new CannedQueryPageDetails(pagingRequest.getSkipCount(), pagingRequest.getMaxItems(), CannedQueryPageDetails.DEFAULT_PAGE_NUMBER, CannedQueryPageDetails.DEFAULT_PAGE_COUNT); // no sort details - no sorting done // create query params holder CannedQueryParameters params = new CannedQueryParameters(paramBean, cqpd, null, requestTotalCountMax, pagingRequest.getQueryExecutionId()); // return canned query instance return getCannedQuery(params); }
Example #7
Source File: ExecuteAllRulesActionExecuterTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * Called at the beginning of all tests */ @Before protected void before() throws Exception { this.checkOutCheckInService = (CheckOutCheckInService) this.applicationContext.getBean("checkOutCheckInService"); this.nodeService = (NodeService)this.applicationContext.getBean("nodeService"); this.ruleService = (RuleService)this.applicationContext.getBean("ruleService"); this.actionService = (ActionService)this.applicationContext.getBean("actionService"); transactionHelper = (RetryingTransactionHelper)applicationContext.getBean("retryingTransactionHelper"); fileFolderService = applicationContext.getBean("fileFolderService", FileFolderService.class); contentService = applicationContext.getBean("contentService", ContentService.class); AuthenticationComponent authenticationComponent = (AuthenticationComponent)applicationContext.getBean("authenticationComponent"); authenticationComponent.setCurrentUser(authenticationComponent.getSystemUserName()); // 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); // Get the executer instance this.executer = (ExecuteAllRulesActionExecuter)this.applicationContext.getBean(ExecuteAllRulesActionExecuter.NAME); }
Example #8
Source File: TaggingServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * @see org.alfresco.service.cmr.tagging.TaggingService#deleteTag(org.alfresco.service.cmr.repository.StoreRef, java.lang.String) */ public void deleteTag(StoreRef storeRef, String tag) { // Lower the case of the tag tag = tag.toLowerCase(); // Find nodes which are tagged with the 'soon to be deleted' tag. List<NodeRef> taggedNodes = this.findTaggedNodes(storeRef, tag); // Clear the tag from the found nodes for (NodeRef taggedNode : taggedNodes) { this.removeTag(taggedNode, tag); } NodeRef tagNodeRef = getTagNodeRef(storeRef, tag); if (tagNodeRef != null) { this.categoryService.deleteCategory(tagNodeRef); } }
Example #9
Source File: DeletedNodesImpl.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 6 votes |
@Override public CollectionWithPagingInfo<Node> listDeleted(Parameters parameters) { PagingRequest pagingRequest = Util.getPagingRequest(parameters.getPaging()); NodeRef archiveStoreRootNodeRef = nodeService.getStoreArchiveNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); // Create canned query ArchivedNodesCannedQueryBuilder queryBuilder = new ArchivedNodesCannedQueryBuilder.Builder( archiveStoreRootNodeRef, pagingRequest).sortOrderAscending(false).build(); // Query the DB PagingResults<NodeRef> result = nodeArchiveService.listArchivedNodes(queryBuilder); Integer totalItems = result.getTotalResultCount().getFirst(); List<Node> nodesFound = new ArrayList<Node>(result.getPage().size()); Map mapUserInfo = new HashMap<>(); for (NodeRef nRef:result.getPage()) { Node foundNode = nodes.getFolderOrDocument(nRef, null, null, parameters.getInclude(), mapUserInfo); mapArchiveInfo(foundNode,mapUserInfo); nodesFound.add(foundNode); } return CollectionWithPagingInfo.asPaged(parameters.getPaging(), nodesFound, result.hasMoreItems(), (totalItems == null ? null : totalItems.intValue())); }
Example #10
Source File: AuditMethodInterceptorTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@SuppressWarnings("deprecation") @Override public void setUp() throws Exception { auditModelRegistry = (AuditModelRegistryImpl) ctx.getBean("auditModel.modelRegistry"); serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY); auditComponent = (AuditComponent) ctx.getBean("auditComponent"); auditService = serviceRegistry.getAuditService(); transactionService = serviceRegistry.getTransactionService(); transactionServiceImpl = (TransactionServiceImpl) ctx.getBean("transactionService"); nodeService = serviceRegistry.getNodeService(); searchService = serviceRegistry.getSearchService(); AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName()); nodeRef = nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); // Register the models URL modelUrlMnt11072 = ResourceUtils.getURL("classpath:alfresco/testaudit/alfresco-audit-test-mnt-11072.xml"); URL modelUrlMnt16748 = ResourceUtils.getURL("classpath:alfresco/testaudit/alfresco-audit-test-mnt-16748.xml"); auditModelRegistry.registerModel(modelUrlMnt11072); auditModelRegistry.registerModel(modelUrlMnt16748); auditModelRegistry.loadAuditModels(); }
Example #11
Source File: ConfigurableServiceImplTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Before public void before() throws Exception { this.nodeService = (NodeService)this.applicationContext.getBean("nodeService"); this.serviceRegistry = (ServiceRegistry)this.applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY); this.configurableService = (ConfigurableService)this.applicationContext.getBean("configurableService"); 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, ContentModel.ASSOC_CHILDREN, ContentModel.TYPE_CONTAINER).getChildRef(); }
Example #12
Source File: SOLRDAOTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
public void testGetNodesSimple() { long startTime = 0L; List<Transaction> txns = getTransactions(null, startTime, null, null, 500); List<Long> txnIds = toTxnIds(txns); NodeParameters nodeParameters = new NodeParameters(); nodeParameters.setTransactionIds(txnIds); nodeParameters.setStoreProtocol(StoreRef.PROTOCOL_WORKSPACE); nodeParameters.setStoreIdentifier(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE.getIdentifier()); List<Node> nodes = getNodes(nodeParameters); assertTrue("Expect 'some' nodes associated with txns", nodes.size() > 0); }
Example #13
Source File: StartWorkflowActionExecuterTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Before public void before() 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); }
Example #14
Source File: AlfrescoCoreAdminHandlerIT.java From SearchServices with GNU Lesser General Public License v3.0 | 6 votes |
@Test public void coreNamesAreTrimmed_oneCoreNameAtTime() { AlfrescoCoreAdminHandler spy = spy(new AlfrescoCoreAdminHandler() { @Override protected NamedList<Object> newCore(String coreName, int numShards, StoreRef storeRef, String templateName, int replicationFactor, int nodeInstance, int numNodes, String shardIds, Properties extraProperties) { // Do nothing here otherwise we cannot spy it return new SimpleOrderedMap<>(); } }); // First let's try a list of names, one by one final List<String> coreNames = asList( ARCHIVE_CORE_NAME + " ", // whitespace char at the end "\t " + ALFRESCO_CORE_NAME, // whitespace chars at the beginning " " + VERSION_CORE_NAME + " \t", // beginning and end " \t"); // empty name coreNames.forEach(spy::setupNewDefaultCores); verify(spy).newCore(eq(ARCHIVE_CORE_NAME), eq(1), eq(STORE_REF_MAP.get(ARCHIVE_CORE_NAME)), anyString(), eq(1), eq(1), eq(1), eq(null), eq(null)); verify(spy).newCore(eq(ALFRESCO_CORE_NAME), eq(1), eq(STORE_REF_MAP.get(ALFRESCO_CORE_NAME)), anyString(), eq(1), eq(1), eq(1), eq(null), eq(null)); verify(spy).newCore(eq(VERSION_CORE_NAME), eq(1), eq(STORE_REF_MAP.get(VERSION_CORE_NAME)), anyString(), eq(1), eq(1), eq(1), eq(null), eq(null)); }
Example #15
Source File: AuditMethodInterceptorTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * Test for <a href="https://issues.alfresco.com/jira/browse/MNT-16748">MNT-16748</a> <br> * Use {@link SearchService#query(StoreRef, String, String)} to perform a query. */ public void testAuditSearchServiceQuery() throws Exception { // Run as admin AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser(); // Perform a search @SuppressWarnings("unused") ResultSet rs = transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<ResultSet>() { @Override public ResultSet execute() throws Throwable { return searchService.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_XPATH, "/app:company_home"); } }, true, false); // Check the audit entries checkAuditEntries(APPLICATION_NAME_MNT_16748, SearchService.LANGUAGE_XPATH, "/app:company_home", 1); }
Example #16
Source File: ExporterComponentTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * Round-trip of export then import will result in the imported content having the same categories * assigned to it as for the exported content -- provided the source and destination stores are the same. */ @SuppressWarnings("unchecked") @Category(RedundantTests.class) @Test public void testRoundTripKeepsCategoriesWhenWithinSameStore() throws Exception { // Use a store ref that has the bootstrapped categories StoreRef storeRef = StoreRef.STORE_REF_WORKSPACE_SPACESSTORE; NodeRef rootNode = nodeService.getRootNode(storeRef); ChildAssociationRef contentChildAssocRef = createContentWithCategories(storeRef, rootNode); // Export/import File acpFile = exportContent(contentChildAssocRef.getParentRef()); FileInfo importFolderFileInfo = importContent(acpFile, rootNode); // Check categories NodeRef importedFileNode = fileFolderService.searchSimple(importFolderFileInfo.getNodeRef(), "test.txt"); assertNotNull("Couldn't find imported file: test.txt", importedFileNode); assertTrue(nodeService.hasAspect(importedFileNode, ContentModel.ASPECT_GEN_CLASSIFIABLE)); List<NodeRef> importedFileCategories = (List<NodeRef>) nodeService.getProperty(importedFileNode, ContentModel.PROP_CATEGORIES); assertCategoriesEqual(importedFileCategories, "Regions", "Software Document Classification"); }
Example #17
Source File: TaggingServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * Gets the node reference for a given tag. * <p> * Returns null if tag is not present and not created. * * @param storeRef store reference * @param tag tag * @param create create a node if one doesn't exist? * @return NodeRef tag node reference or null not exist */ private NodeRef getTagNodeRef(StoreRef storeRef, String tag, boolean create) { for (String forbiddenSequence : FORBIDDEN_TAGS_SEQUENCES) { if (create && tag.contains(forbiddenSequence)) { throw new IllegalArgumentException("Tag name must not contain " + StringEscapeUtils.escapeJava(forbiddenSequence) + " char sequence"); } } NodeRef tagNodeRef = null; Collection<ChildAssociationRef> results = this.categoryService.getRootCategories(storeRef, ContentModel.ASPECT_TAGGABLE, tag, create); if (!results.isEmpty()) { tagNodeRef = results.iterator().next().getChildRef(); } return tagNodeRef; }
Example #18
Source File: ShardStateBuilder.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 5 votes |
@SuppressWarnings("unchecked") public GeneratorT withAddedStoreRef(StoreRef aValue) { if (instance.getStoreRefs() == null) { instance.setStoreRefs(new HashSet<StoreRef>()); } ((HashSet<StoreRef>) instance.getStoreRefs()).add(aValue); return (GeneratorT) this; }
Example #19
Source File: MetadataEncryptorTests.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void setUp() throws Exception { ServiceRegistry serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY); transactionService = serviceRegistry.getTransactionService(); // txnHelper = transactionService.getRetryingTransactionHelper(); metadataEncryptor = (MetadataEncryptor)ctx.getBean("metadataEncryptor"); nodeService = serviceRegistry.getNodeService(); tenantService = (TenantService)ctx.getBean("tenantService"); dictionaryDAO = (DictionaryDAO)ctx.getBean("dictionaryDAO"); AuthenticationUtil.setRunAsUserSystem(); DictionaryBootstrap bootstrap = new DictionaryBootstrap(); List<String> bootstrapModels = new ArrayList<String>(); bootstrapModels.add("alfresco/model/dictionaryModel.xml"); bootstrapModels.add(TEST_MODEL); // List<String> labels = new ArrayList<String>(); // labels.add(TEST_BUNDLE); bootstrap.setModels(bootstrapModels); // bootstrap.setLabels(labels); bootstrap.setDictionaryDAO(dictionaryDAO); bootstrap.setTenantService(tenantService); bootstrap.bootstrap(); // create a first store directly RetryingTransactionCallback<NodeRef> createStoreWork = new RetryingTransactionCallback<NodeRef>() { public NodeRef execute() { StoreRef storeRef = nodeService.createStore( StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.nanoTime()); return nodeService.getRootNode(storeRef); } }; rootNodeRef = transactionService.getRetryingTransactionHelper().doInTransaction(createStoreWork); }
Example #20
Source File: Jackson2NodeRefDeserializer.java From alfresco-mvc with Apache License 2.0 | 5 votes |
@Override public NodeRef deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { String id = jp.getText(); if (NodeRef.isNodeRef(id)) { return new NodeRef(id); } return new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, id); }
Example #21
Source File: NodeDAOTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
public void testGetStoreId() throws Throwable { // Get all stores List<Pair<Long, StoreRef>> storePairs = nodeDAO.getStores(); // Check each one for (Pair<Long, StoreRef> storePair : storePairs) { StoreRef storeRef = storePair.getSecond(); // Check Pair<Long, StoreRef> checkStorePair = nodeDAO.getStore(storeRef); assertEquals("Store pair did not match. ", storePair, checkStorePair); } }
Example #22
Source File: ClassPathRepoTemplateLoader.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * Return an object wrapping a source for a template */ public Object findTemplateSource(String name) throws IOException { if (name.indexOf(StoreRef.URI_FILLER) != -1) { NodeRef ref = new NodeRef(name); if (this.nodeService.exists(ref) == true) { return new RepoTemplateSource(ref); } else { return null; } } else { //Fix a common problem: classpath resource paths should not start with "/" if (name.startsWith("/")) { name = name.substring(1); } ClassLoader classLoader = getClass().getClassLoader(); URL url = classLoader.getResource(name); return url == null ? null : new ClassPathTemplateSource(classLoader, name, encoding); } }
Example #23
Source File: DbNodeServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * Archives the node without the <b>cm:auditable</b> aspect behaviour */ private void archiveHierarchy(NodeHierarchyWalker walker, StoreRef archiveStoreRef) { policyBehaviourFilter.disableBehaviour(ContentModel.ASPECT_AUDITABLE); try { archiveHierarchyImpl(walker, archiveStoreRef); } finally { policyBehaviourFilter.enableBehaviour(ContentModel.ASPECT_AUDITABLE); } }
Example #24
Source File: LanguagesTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void setUp() throws Exception { serviceRegistry = (ServiceRegistry) ctx.getBean("ServiceRegistry"); transactionService = serviceRegistry.getTransactionService(); nodeService = serviceRegistry.getNodeService(); fileFolderService = serviceRegistry.getFileFolderService(); // start the transaction txn = transactionService.getUserTransaction(); txn.begin(); // downgrade integrity IntegrityChecker.setWarnInTransaction(); // authenticate AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); // create a test store StoreRef storeRef = nodeService .createStore(StoreRef.PROTOCOL_WORKSPACE, getName() + System.currentTimeMillis()); rootNodeRef = nodeService.getRootNode(storeRef); // create a folder to import into workingRootNodeRef = nodeService.createNode( rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName(NamespaceService.ALFRESCO_URI, "working root"), ContentModel.TYPE_FOLDER).getChildRef(); }
Example #25
Source File: ArchivedNodesGet.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 5 votes |
@Override protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache) { Map<String, Object> model = new HashMap<String, Object>(); // We want to get all nodes in the archive which were originally // contained in the following StoreRef. StoreRef storeRef = parseRequestForStoreRef(req); // Create paging ScriptPagingDetails paging = new ScriptPagingDetails(getIntParameter(req, MAX_ITEMS, DEFAULT_MAX_ITEMS_PER_PAGE), getIntParameter(req, SKIP_COUNT, 0)); PagingResults<NodeRef> result = getArchivedNodesFrom(storeRef, paging, req.getParameter(NAME_FILTER)); List<NodeRef> nodeRefs = result.getPage(); List<ArchivedNodeState> deletedNodes = new ArrayList<ArchivedNodeState>(nodeRefs.size()); for (NodeRef archivedNode : nodeRefs) { ArchivedNodeState state = ArchivedNodeState.create(archivedNode, serviceRegistry); deletedNodes.add(state); } // Now do the paging // ALF-19111. Note: Archived nodes CQ, supports Paging, // so no need to use the ModelUtil.page method to build the page again. model.put(DELETED_NODES, deletedNodes); // Because we haven't used ModelUtil.page method, we need to set the total items manually. paging.setTotalItems(deletedNodes.size()); model.put("paging", ModelUtil.buildPaging(paging)); return model; }
Example #26
Source File: RepoService.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 5 votes |
public List<Tag> getTags() { Set<Tag> tags = new TreeSet<Tag>(); for(String tag : taggingService.getTags(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE)) { tags.add(new Tag(null, taggingService.getTagNodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, tag).getId(), tag)); } return new ArrayList<Tag>(tags); }
Example #27
Source File: AbstractNodeDAOImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * Constructor. Set up various instance-specific members such as caches and locks. */ public AbstractNodeDAOImpl() { childAssocRetryingHelper = new RetryingCallbackHelper(); childAssocRetryingHelper.setRetryWaitMs(10); childAssocRetryingHelper.setMaxRetries(5); // Caches rootNodesCache = new EntityLookupCache<StoreRef, Node, Serializable>(new RootNodesCacheCallbackDAO()); nodesCache = new EntityLookupCache<Long, Node, NodeRef>(new NodesCacheCallbackDAO()); aspectsCache = new EntityLookupCache<NodeVersionKey, Set<QName>, Serializable>(new AspectsCallbackDAO()); propertiesCache = new EntityLookupCache<NodeVersionKey, Map<QName, Serializable>, Serializable>(new PropertiesCallbackDAO()); childByNameCache = new NullCache<ChildByNameKey, ChildAssocEntity>(); }
Example #28
Source File: RepoService.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 5 votes |
public List<Tag> getTags(NodeRef nodeRef) { Set<Tag> tags = new TreeSet<Tag>(); for(String tag : taggingService.getTags(nodeRef)) { tags.add(new Tag(null, taggingService.getTagNodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, tag).getId(), tag)); } return new ArrayList<Tag>(tags); }
Example #29
Source File: RepoTransferReceiverImplTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
private NodeRef getSummaryReportsParentFolder(String transferSummaryReportLocation) { NodeRef reportParentFolder = null; log.debug("Trying to find transfer summary report records folder: " + transferSummaryReportLocation); List<NodeRef> refs = searchService.selectNodes(nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE), transferSummaryReportLocation, null, namespaceService, false); if (refs.size() > 0) { reportParentFolder = refs.get(0); log.debug("Found transfer summary report records folder: " + reportParentFolder); } return reportParentFolder; }
Example #30
Source File: TaggingServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
public Pair<List<String>, Integer> getPagedTags(StoreRef storeRef, int fromTag, int pageSize) { ParameterCheck.mandatory("storeRef", storeRef); ParameterCheck.mandatory("fromTag", fromTag); ParameterCheck.mandatory("pageSize", pageSize); Collection<ChildAssociationRef> rootCategories = this.categoryService.getRootCategories(storeRef, ContentModel.ASPECT_TAGGABLE); final int totalCount = rootCategories.size(); final int startIndex = Math.max(fromTag, 0); final int endIndex = Math.min(fromTag + pageSize, totalCount); List<String> result = new ArrayList<String>(pageSize); int index = 0; // paging for not sorted tag names for (ChildAssociationRef rootCategory : rootCategories) { if (startIndex > index++) { continue; } String name = (String)this.nodeService.getProperty(rootCategory.getChildRef(), ContentModel.PROP_NAME); result.add(name); if (index == endIndex) { break; } } return new Pair<List<String>, Integer> (result, totalCount); }