org.alfresco.service.namespace.RegexQNamePattern Java Examples
The following examples show how to use
org.alfresco.service.namespace.RegexQNamePattern.
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: TemplateNode.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * @return Target associations for this Node. As a Map of assoc name to a List of TemplateNodes. */ public Map<String, List<TemplateNode>> getAssocs() { if (this.targetAssocs == null) { List<AssociationRef> refs = this.services.getNodeService().getTargetAssocs(this.nodeRef, RegexQNamePattern.MATCH_ALL); this.targetAssocs = new QNameMap<String, List<TemplateNode>>(this); for (AssociationRef ref : refs) { String qname = ref.getTypeQName().toString(); List<TemplateNode> nodes = this.targetAssocs.get(qname); if (nodes == null) { // first access for the list for this qname nodes = new ArrayList<TemplateNode>(4); this.targetAssocs.put(ref.getTypeQName().toString(), nodes); } nodes.add( new TemplateNode(ref.getTargetRef(), this.services, this.imageResolver) ); } } return this.targetAssocs; }
Example #2
Source File: ActionServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
private void populateCompositeActionCondition(NodeRef compositeNodeRef, CompositeActionCondition compositeActionCondition) { List<ChildAssociationRef> conditions = this.nodeService.getChildAssocs(compositeNodeRef, RegexQNamePattern.MATCH_ALL, ActionModel.ASSOC_COMPOSITE_ACTION_CONDITION); Boolean OR = (Boolean) this.nodeService.getProperty(compositeNodeRef, ActionModel.PROP_CONDITION_ANDOR); if (logger.isDebugEnabled()) { logger.debug("\tPopulating Composite Condition with subconditions, Condition OR = " + OR); } compositeActionCondition.setORCondition(OR == null ? false : OR.booleanValue()); for (ChildAssociationRef conditionNodeRef : conditions) { NodeRef actionNodeRef = conditionNodeRef.getChildRef(); ActionCondition currentCondition = createActionCondition(actionNodeRef); if (logger.isDebugEnabled()) logger.debug("\t\tAdding subcondition " + currentCondition.getActionConditionDefinitionName()); compositeActionCondition.addActionCondition(currentCondition); } }
Example #3
Source File: RemoteCredentialsServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Override public BaseCredentialsInfo getPersonCredentials(String remoteSystem) { NodeRef personContainer = getPersonContainer(remoteSystem, false); if (personContainer == null) return null; // Grab the children List<ChildAssociationRef> credentials = nodeService.getChildAssocs(personContainer, RemoteCredentialsModel.ASSOC_CREDENTIALS, RegexQNamePattern.MATCH_ALL); if (credentials.size() > 0) { NodeRef nodeRef = credentials.get(0).getChildRef(); return loadCredentials(remoteSystem, personContainer, nodeRef); } return null; }
Example #4
Source File: AbstractNodeRelation.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 6 votes |
protected QNamePattern getAssocTypeFromWhereElseAll(Parameters parameters) { QNamePattern assocTypeQNamePattern = RegexQNamePattern.MATCH_ALL; Query q = parameters.getQuery(); if (q != null) { MapBasedQueryWalker propertyWalker = new MapBasedQueryWalker(WHERE_PARAMS_ASSOC_TYPE, null); QueryHelper.walk(q, propertyWalker); String assocTypeQNameStr = propertyWalker.getProperty(Nodes.PARAM_ASSOC_TYPE, WhereClauseParser.EQUALS, String.class); if (assocTypeQNameStr != null) { assocTypeQNamePattern = nodes.getAssocType(assocTypeQNameStr); } } return assocTypeQNamePattern; }
Example #5
Source File: NodeSecondaryChildrenRelation.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 6 votes |
/** * List secondary children only * * @param parentNodeId String id of parent node */ @Override @WebApiDescription(title = "Return a paged list of secondary child nodes based on child assocs") public CollectionWithPagingInfo<Node> readAll(String parentNodeId, Parameters parameters) { NodeRef parentNodeRef = nodes.validateOrLookupNode(parentNodeId, null); QNamePattern assocTypeQNameParam = getAssocTypeFromWhereElseAll(parameters); List<ChildAssociationRef> childAssocRefs = null; if (assocTypeQNameParam.equals(RegexQNamePattern.MATCH_ALL)) { childAssocRefs = nodeService.getChildAssocs(parentNodeRef); } else { childAssocRefs = nodeService.getChildAssocs(parentNodeRef, assocTypeQNameParam, RegexQNamePattern.MATCH_ALL); } return listNodeChildAssocs(childAssocRefs, parameters, false, true); }
Example #6
Source File: AuthorityDAOImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
public void removeAuthorityFromZones(String authorityName, Set<String> zones) { if ((zones != null) && (zones.size() > 0)) { NodeRef authRef = getAuthorityOrNull(authorityName); List<ChildAssociationRef> results = nodeService.getParentAssocs(authRef, ContentModel.ASSOC_IN_ZONE, RegexQNamePattern.MATCH_ALL); for (ChildAssociationRef current : results) { NodeRef zoneRef = current.getParentRef(); Serializable value = nodeService.getProperty(zoneRef, ContentModel.PROP_NAME); if (value == null) { continue; } else { String testZone = DefaultTypeConverter.INSTANCE.convert(String.class, value); if (zones.contains(testZone)) { nodeService.removeChildAssociation(current); } } } } }
Example #7
Source File: ActionServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * Populate the details of the action from the node reference * * @param actionNodeRef the action node reference * @param action the action */ private void populateAction(NodeRef actionNodeRef, Action action) { // Populate the action properties populateActionProperties(actionNodeRef, action); // Set the parameters populateParameters(actionNodeRef, action); // Set the conditions List<ChildAssociationRef> conditions = this.nodeService.getChildAssocs(actionNodeRef, RegexQNamePattern.MATCH_ALL, ActionModel.ASSOC_CONDITIONS); if (logger.isDebugEnabled()) logger.debug("Retrieving " + (conditions == null ? " null" : conditions.size()) + " conditions"); if (conditions != null) { for (ChildAssociationRef condition : conditions) { NodeRef conditionNodeRef = condition.getChildRef(); action.addActionCondition(createActionCondition(conditionNodeRef)); } } }
Example #8
Source File: NodeBrowserPost.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 6 votes |
/** * Gets the current node associations * * @return associations */ public List<PeerAssociation> getAssocs(NodeRef nodeRef) { List<AssociationRef> refs = null; try { refs = getNodeService().getTargetAssocs(nodeRef, RegexQNamePattern.MATCH_ALL); } catch (UnsupportedOperationException err) { // some stores do not support associations // but we doesn't want NPE in code below refs = new ArrayList<AssociationRef>(); } List<PeerAssociation> assocs = new ArrayList<PeerAssociation>(refs.size()); for (AssociationRef ref : refs) { assocs.add(new PeerAssociation(ref.getTypeQName(), ref.getSourceRef(), ref.getTargetRef())); } return assocs; }
Example #9
Source File: ThumbnailServiceImplTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Test public void testDuplicationNames() throws Exception { checkTransformer(); NodeRef jpgOrig = createOriginalContent(this.folder, MimetypeMap.MIMETYPE_IMAGE_JPEG); ImageResizeOptions imageResizeOptions = new ImageResizeOptions(); imageResizeOptions.setWidth(64); imageResizeOptions.setHeight(64); imageResizeOptions.setResizeToThumbnail(true); ImageTransformationOptions imageTransformationOptions = new ImageTransformationOptions(); imageTransformationOptions.setResizeOptions(imageResizeOptions); // ThumbnailDetails createOptions = new ThumbnailDetails(); NodeRef thumbnail1 = this.thumbnailService.createThumbnail(jpgOrig, ContentModel.PROP_CONTENT, MimetypeMap.MIMETYPE_IMAGE_JPEG, imageTransformationOptions, "small"); assertNotNull(thumbnail1); checkRenditioned(jpgOrig, Collections.singletonList(new ExpectedAssoc(RegexQNamePattern.MATCH_ALL, "small", 1))); checkRendition("small", thumbnail1); // the origional thumbnail is returned if we are attempting to create a duplicate NodeRef duplicate = this.thumbnailService.createThumbnail(jpgOrig, ContentModel.PROP_CONTENT, MimetypeMap.MIMETYPE_IMAGE_JPEG, imageTransformationOptions, "small"); assertNotNull(duplicate); assertEquals(duplicate, thumbnail1); }
Example #10
Source File: CommentsLibJs.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 6 votes |
/** * Returns all comment nodes for a given node. * @return an array of comments. */ public static List<ChildAssociationRef> getComments(NodeRef node, ServiceRegistry services) { List<ChildAssociationRef> result = new ArrayList<ChildAssociationRef>(); NodeRef commentsFolder = getCommentsFolder(node, services); if (commentsFolder != null) { List<ChildAssociationRef> children = services.getNodeService().getChildAssocs(commentsFolder, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); if (!children.isEmpty()) { result = children; } } return result; }
Example #11
Source File: TransferServiceImpl2.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * Given the noderef of a group of transfer targets, return all the contained transfer targets. * @param groupNode NodeRef * @return Set<TransferTarget> */ private Set<TransferTarget> getTransferTargets(NodeRef groupNode) { Set<TransferTarget> result = new HashSet<TransferTarget>(); List<ChildAssociationRef>children = nodeService.getChildAssocs(groupNode, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); for(ChildAssociationRef child : children) { if(nodeService.getType(child.getChildRef()).equals(TransferModel.TYPE_TRANSFER_TARGET)) { TransferTargetImpl newTarget = new TransferTargetImpl(); mapTransferTarget(child.getChildRef(), newTarget); result.add(newTarget); } } return result; }
Example #12
Source File: NodeBrowserPost.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 6 votes |
/** * Gets the current source associations * * @return associations */ public List<PeerAssociation> getSourceAssocs(NodeRef nodeRef) { List<AssociationRef> refs = null; try { refs = getNodeService().getSourceAssocs(nodeRef, RegexQNamePattern.MATCH_ALL); } catch (UnsupportedOperationException err) { // some stores do not support associations // but we doesn't want NPE in code below refs = new ArrayList<AssociationRef>(); } List<PeerAssociation> assocs = new ArrayList<PeerAssociation>(refs.size()); for (AssociationRef ref : refs) { assocs.add(new PeerAssociation(ref.getTypeQName(), ref.getSourceRef(), ref.getTargetRef())); } return assocs; }
Example #13
Source File: DbNodeServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
public Collection<NodeRef> getParents(NodeRef nodeRef) throws InvalidNodeRefException { List<ChildAssociationRef> parentAssocs = getParentAssocs( nodeRef, RegexQNamePattern.MATCH_ALL, RegexQNamePattern.MATCH_ALL); // Copy into the set to avoid duplicates Set<NodeRef> parentNodeRefs = new HashSet<NodeRef>(parentAssocs.size()); for (ChildAssociationRef parentAssoc : parentAssocs) { NodeRef parentNodeRef = parentAssoc.getParentRef(); parentNodeRefs.add(parentNodeRef); } // Done return new ArrayList<NodeRef>(parentNodeRefs); }
Example #14
Source File: CommentsLibJs.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 6 votes |
/** * Returns the folder that contains all the comments. * * We currently use the fm:discussable aspect where we * add a "Comments" topic to it. */ public static NodeRef getCommentsFolder(NodeRef node, ServiceRegistry services) { //FIXME These methods are from the original JavaScript. Should use the (soon to arrive) CommentService. NodeRef result = null; if (services.getNodeService().hasAspect(node, ForumModel.ASPECT_DISCUSSABLE)) { List<ChildAssociationRef> forumFolders = services.getNodeService().getChildAssocs(node, ForumModel.ASSOC_DISCUSSION, RegexQNamePattern.MATCH_ALL); // The JavaScript was retrieving the first child under this child-assoc so we'll do the same. NodeRef forumFolder = forumFolders.get(0).getChildRef(); List<ChildAssociationRef> topicFolder = services.getNodeService().getChildAssocs(forumFolder, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, COMMENTS_TOPIC_NAME)); result = topicFolder.isEmpty() ? null : topicFolder.get(0).getChildRef(); } return result; }
Example #15
Source File: VirtualStoreImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Override public List<ChildAssociationRef> getChildAssocsByPropertyValue(Reference parentReference, QName propertyQName, Serializable value) { List<ChildAssociationRef> allAssociations = getChildAssocs(parentReference, RegexQNamePattern.MATCH_ALL, RegexQNamePattern.MATCH_ALL, Integer.MAX_VALUE, false); List<ChildAssociationRef> associations = new LinkedList<>(); for (ChildAssociationRef childAssociationRef : allAssociations) { Serializable propertyValue = environment.getProperty(childAssociationRef.getChildRef(), propertyQName); if ((value == null && propertyValue == null) || (value != null && value.equals(propertyValue))) { associations.add(childAssociationRef); } } return associations; }
Example #16
Source File: VirtualStoreImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Override public List<ChildAssociationRef> getChildAssocs(Reference parentReference, Set<QName> childNodeTypeQNames) { List<ChildAssociationRef> allAssociations = getChildAssocs(parentReference, RegexQNamePattern.MATCH_ALL, RegexQNamePattern.MATCH_ALL, Integer.MAX_VALUE, false); List<ChildAssociationRef> associations = new LinkedList<>(); for (ChildAssociationRef childAssociationRef : allAssociations) { QName childType = environment.getType(childAssociationRef.getChildRef()); if (childNodeTypeQNames.contains(childType)) { associations.add(childAssociationRef); } } return associations; }
Example #17
Source File: TemplateNode.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * @return Source associations for this Node. As a Map of assoc name to a List of TemplateNodes. */ public Map<String, List<TemplateNode>> getSourceAssocs() { if (this.sourceAssocs == null) { List<AssociationRef> refs = this.services.getNodeService().getSourceAssocs(this.nodeRef, RegexQNamePattern.MATCH_ALL); this.sourceAssocs = new QNameMap<String, List<TemplateNode>>(this); for (AssociationRef ref : refs) { String qname = ref.getTypeQName().toString(); List<TemplateNode> nodes = this.sourceAssocs.get(qname); if (nodes == null) { // first access for the list for this qname nodes = new ArrayList<TemplateNode>(4); this.sourceAssocs.put(ref.getTypeQName().toString(), nodes); } nodes.add( new TemplateNode(ref.getSourceRef(), this.services, this.imageResolver) ); } } return this.sourceAssocs; }
Example #18
Source File: RuleServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Override public int countRules(NodeRef nodeRef) { int ruleCount = 0; if (this.runtimeNodeService.exists(nodeRef) == true && checkNodeType(nodeRef) == true) { if (this.runtimeNodeService.hasAspect(nodeRef, RuleModel.ASPECT_RULES) == true) { NodeRef ruleFolder = getSavedRuleFolderRef(nodeRef); if (ruleFolder != null) { // Get the rules for this node List<ChildAssociationRef> ruleChildAssocRefs = this.runtimeNodeService.getChildAssocs(ruleFolder, RegexQNamePattern.MATCH_ALL, ASSOC_NAME_RULES_REGEX); ruleCount = ruleChildAssocRefs.size(); } } } return ruleCount; }
Example #19
Source File: NodeServiceImplTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * Tests get target associations by property value.</p> * See <b>MNT-14504</b> for more details. */ @Test public void testGetTargetAssocsByPropertyValue() { // Create a new versionable node NodeRef versionableNode = createNewVersionableNode(); QName propertyQName = PROP_1; Serializable propertyValue = VALUE_1; // Store the current details of the target associations List<AssociationRef> origAssocs = this.dbNodeService.getTargetAssocsByPropertyValue(versionableNode, RegexQNamePattern.MATCH_ALL, propertyQName, propertyValue); // Create a new version Version version = createVersion(versionableNode, this.versionProperties); List<AssociationRef> assocs = this.versionStoreNodeService.getTargetAssocsByPropertyValue(version.getFrozenStateNodeRef(), RegexQNamePattern.MATCH_ALL, propertyQName, propertyValue); assertNotNull(assocs); assertEquals(origAssocs.size(), assocs.size()); }
Example #20
Source File: ThumbnailServiceImplTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Test public void testCreateRenditionThumbnailFromImage() throws Exception { QName qname = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "doclib"); ThumbnailDefinition details = thumbnailService.getThumbnailRegistry().getThumbnailDefinition( qname.getLocalName()); assertEquals("doclib", details.getName()); assertEquals("image/png", details.getMimetype()); assertEquals("alfresco/thumbnail/thumbnail_placeholder_doclib.png", details.getPlaceHolderResourcePath()); checkTransformer(); NodeRef jpgOrig = createOriginalContent(this.folder, MimetypeMap.MIMETYPE_IMAGE_JPEG); NodeRef thumbnail0 = this.thumbnailService.createThumbnail(jpgOrig, ContentModel.PROP_CONTENT, MimetypeMap.MIMETYPE_IMAGE_JPEG, details.getTransformationOptions(), "doclib"); assertNotNull(thumbnail0); checkRenditioned(jpgOrig, Collections.singletonList(new ExpectedAssoc(RegexQNamePattern.MATCH_ALL, "doclib", 1))); checkRendition("doclib", thumbnail0); outputThumbnailTempContentLocation(thumbnail0, "jpg", "doclib test"); }
Example #21
Source File: ThumbnailServiceImplTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Test public void testCreateRenditionThumbnailFromPdf() throws Exception { QName qname = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "doclib"); ThumbnailDefinition details = thumbnailService.getThumbnailRegistry().getThumbnailDefinition( qname.getLocalName()); assertEquals("doclib", details.getName()); assertEquals("image/png", details.getMimetype()); assertEquals("alfresco/thumbnail/thumbnail_placeholder_doclib.png", details.getPlaceHolderResourcePath()); checkTransformer(); NodeRef pdfOrig = createOriginalContent(this.folder, MimetypeMap.MIMETYPE_PDF); NodeRef thumbnail0 = this.thumbnailService.createThumbnail(pdfOrig, ContentModel.PROP_CONTENT, MimetypeMap.MIMETYPE_IMAGE_JPEG, details.getTransformationOptions(), "doclib"); assertNotNull(thumbnail0); checkRenditioned(pdfOrig, Collections.singletonList(new ExpectedAssoc(RegexQNamePattern.MATCH_ALL, "doclib", 1))); checkRendition("doclib", thumbnail0); outputThumbnailTempContentLocation(thumbnail0, "jpg", "doclib test"); }
Example #22
Source File: MultilingualContentServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * Get the ML Container of the given node, allowing null * @param mlDocumentNodeRef the translation * @param allowNull true if a null value may be returned * @return Returns the <b>cm:mlContainer</b> or null if there isn't one * @throws AlfrescoRuntimeException if there is no container */ private NodeRef getMLContainer(NodeRef mlDocumentNodeRef, boolean allowNull) { NodeRef mlContainerNodeRef = null; List<ChildAssociationRef> parentAssocRefs = nodeService.getParentAssocs( mlDocumentNodeRef, ContentModel.ASSOC_MULTILINGUAL_CHILD, RegexQNamePattern.MATCH_ALL); if (parentAssocRefs.size() == 0) { if (!allowNull) { throw new AlfrescoRuntimeException( "No multilingual container exists for document node: " + mlDocumentNodeRef); } mlContainerNodeRef = null; } else if (parentAssocRefs.size() >= 1) { // Just get it ChildAssociationRef toKeepAssocRef = parentAssocRefs.get(0); mlContainerNodeRef = toKeepAssocRef.getParentRef(); } // Done return mlContainerNodeRef; }
Example #23
Source File: DocumentNavigator.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
public Iterator getChildAxisIterator(Object contextNode, String localName, String namespacePrefix, String namespaceURI) throws UnsupportedAxisException { // decode the localname localName = ISO9075.decode(localName); // MNT-10730 if (localName != null && (localName.equalsIgnoreCase("true") || localName.equalsIgnoreCase("false"))) { return Collections.singletonList(new Boolean(Boolean.parseBoolean(localName))).iterator(); } ChildAssociationRef assocRef = (ChildAssociationRef) contextNode; NodeRef childRef = assocRef.getChildRef(); QName qName = QName.createQName(namespaceURI, localName); List<? extends ChildAssociationRef> list = null; list = nodeService.getChildAssocs(childRef, RegexQNamePattern.MATCH_ALL, qName); // done return list.iterator(); }
Example #24
Source File: ActionServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * @see org.alfresco.service.cmr.action.ActionService#removeAllActions(org.alfresco.service.cmr.repository.NodeRef) */ public void removeAllActions(NodeRef nodeRef) { if (this.nodeService.exists(nodeRef) == true && this.nodeService.hasAspect(nodeRef, ActionModel.ASPECT_ACTIONS) == true) { List<ChildAssociationRef> actions = new ArrayList<ChildAssociationRef>(this.nodeService.getChildAssocs( getSavedActionFolderRef(nodeRef), RegexQNamePattern.MATCH_ALL, ActionModel.ASSOC_NAME_ACTIONS)); for (ChildAssociationRef action : actions) { this.nodeService.removeChild(getSavedActionFolderRef(nodeRef), action.getChildRef()); } } }
Example #25
Source File: SolrFacetServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * Gets a child NodeRef under the specified parent NodeRef linked by a child-assoc of the specified name. * * @param parent the parent whose child is sought. * @param assocName the name of the child-association. * @return the NodeRef of the requested child, if it exists. null if there is no match. */ private NodeRef getSingleChildNodeRef(NodeRef parent, QName assocName) { final List<ChildAssociationRef> assocs = nodeService.getChildAssocs(parent, RegexQNamePattern.MATCH_ALL, assocName, true); final NodeRef result; if (assocs == null || assocs.isEmpty()) { result = null; } else if (assocs.size() > 1) { final StringBuilder msg = new StringBuilder(); msg.append("Expected exactly one child node at: ") .append(parent).append("/").append(assocName) .append(" but found ") .append(assocs == null ? "<null assocs>" : assocs.size()); if (logger.isErrorEnabled()) { logger.error(msg.toString()); } result = assocs.get(0).getChildRef(); } else { result = assocs.get(0).getChildRef(); } return result; }
Example #26
Source File: ThumbnailServiceImplTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * Verifies that our long-running test setup passes with simple behavior of * a single thumbnail requested with no other concurrent work. * * @throws Exception */ @Test public void testLongRunningThumbnails() throws Exception { logger.debug("Starting testLongRunningThumbnails"); performLongRunningThumbnailTest( Collections.singletonList(ExpectedThumbnail.withName("imgpreview")), Collections.singletonList(new ExpectedAssoc(RegexQNamePattern.MATCH_ALL, "imgpreview", 1)), new EmptyLongRunningConcurrentWork(), 60, null); }
Example #27
Source File: ThumbnailServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Override public Map<String, FailedThumbnailInfo> getFailedThumbnails(NodeRef sourceNode) { Map<String, FailedThumbnailInfo> result = Collections.emptyMap(); if (nodeService.hasAspect(sourceNode, ContentModel.ASPECT_FAILED_THUMBNAIL_SOURCE)) { List<ChildAssociationRef> failedThumbnailChildren = nodeService.getChildAssocs(sourceNode, ContentModel.ASSOC_FAILED_THUMBNAIL, RegexQNamePattern.MATCH_ALL); result = new HashMap<String, FailedThumbnailInfo>(); for (ChildAssociationRef chAssRef : failedThumbnailChildren) { final QName failedThumbnailName = chAssRef.getQName(); NodeRef failedThumbnailNode = chAssRef.getChildRef(); Map<QName, Serializable> props = nodeService.getProperties(failedThumbnailNode); Date failureDateTime = (Date)props.get(ContentModel.PROP_FAILED_THUMBNAIL_TIME); int failureCount = (Integer)props.get(ContentModel.PROP_FAILURE_COUNT); final FailedThumbnailInfo failedThumbnailInfo = new FailedThumbnailInfo(failedThumbnailName.getLocalName(), failureDateTime, failureCount, failedThumbnailNode); result.put(failedThumbnailName.getLocalName(), failedThumbnailInfo); } } else { logger.debug(sourceNode + " does not have " + ContentModel.ASPECT_FAILED_THUMBNAIL_SOURCE + " aspect"); } return result; }
Example #28
Source File: ActionServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * Populates a composite action from a composite action node reference * * @param compositeNodeRef the composite action node reference * @param compositeAction the composite action */ public void populateCompositeAction(NodeRef compositeNodeRef, CompositeAction compositeAction) { populateAction(compositeNodeRef, compositeAction); List<ChildAssociationRef> actions = this.nodeService.getChildAssocs(compositeNodeRef, RegexQNamePattern.MATCH_ALL, ActionModel.ASSOC_ACTIONS); for (ChildAssociationRef action : actions) { NodeRef actionNodeRef = action.getChildRef(); compositeAction.addAction(createAction(actionNodeRef)); } }
Example #29
Source File: DownloadServiceIntegrationTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Test public void deleteAssociationAfterDownload() throws Exception { final NodeRef nodeRef; nodeRef = DOWNLOAD_SERVICE.createDownload(new NodeRef[] { level1Folder1 }, true); testNodes.addNodeRef(nodeRef); waitForDownload(nodeRef); TRANSACTION_HELPER.doInTransaction(new RetryingTransactionCallback<Void>() { @Override public Void execute() throws Throwable { try { // remove the target associations final List<AssociationRef> assocsList = NODE_SERVICE.getTargetAssocs(nodeRef, RegexQNamePattern.MATCH_ALL); Assert.assertEquals(1, assocsList.size()); NODE_SERVICE.removeAssociation(assocsList.get(0).getSourceRef(), assocsList .get(0).getTargetRef(), DownloadModel.ASSOC_REQUESTED_NODES); INTEGRITY_CHECKER.checkIntegrity(); } catch (Exception ex) { fail("The association should have been removed successfully from the target node."); } return null; } }); }
Example #30
Source File: RuleServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void setRulePosition(NodeRef nodeRef, NodeRef ruleNodeRef, int index) { NodeRef ruleFolder = getSavedRuleFolderRef(nodeRef); if (ruleFolder != null) { List<ChildAssociationRef> assocs = this.runtimeNodeService.getChildAssocs(ruleFolder, RegexQNamePattern.MATCH_ALL, ASSOC_NAME_RULES_REGEX); List<ChildAssociationRef> orderedAssocs = new ArrayList<ChildAssociationRef>(assocs.size()); ChildAssociationRef movedAssoc = null; for (ChildAssociationRef assoc : assocs) { NodeRef childNodeRef = assoc.getChildRef(); if (childNodeRef.equals(ruleNodeRef) == true) { movedAssoc = assoc; } else { orderedAssocs.add(assoc); } } if (movedAssoc != null) { orderedAssocs.add(index, movedAssoc); } index = 0; for (ChildAssociationRef orderedAssoc : orderedAssocs) { nodeService.setChildAssociationIndex(orderedAssoc, index); index++; } } }