org.alfresco.service.cmr.repository.NodeRef Java Examples

The following examples show how to use org.alfresco.service.cmr.repository.NodeRef. 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: ExporterComponentTest.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * 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 #2
Source File: HiddenAspectTest.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("unused")
@Test
public void testCheckHidden() throws Exception
{
    String nodeName = GUID.generate();

    interceptor.setEnabled(false);

    try
    {
        // Create some nodes that should be hidden but aren't
        NodeRef node = fileFolderService.create(topNodeRef, nodeName, ContentModel.TYPE_FOLDER).getNodeRef();
        NodeRef node11 = fileFolderService.create(node, nodeName + ".11", ContentModel.TYPE_FOLDER).getNodeRef();
        NodeRef node12 = fileFolderService.create(node, ".12", ContentModel.TYPE_CONTENT).getNodeRef();
        NodeRef node21 = fileFolderService.create(node11, nodeName + ".21", ContentModel.TYPE_FOLDER).getNodeRef();
        NodeRef node22 = fileFolderService.create(node11, nodeName + ".22", ContentModel.TYPE_CONTENT).getNodeRef();
        NodeRef node31 = fileFolderService.create(node21, ".31", ContentModel.TYPE_FOLDER).getNodeRef();
        NodeRef node41 = fileFolderService.create(node31, nodeName + ".41", ContentModel.TYPE_CONTENT).getNodeRef();

        txn.commit();
    }
    finally
    {
        interceptor.setEnabled(true);
    }
}
 
Example #3
Source File: AbstractLockStoreTestBase.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Test
public void testSetAndGet()
{
    NodeRef ephemeralNodeRef = new NodeRef("workspace://SpacesStore/12345");
    LockState ephemeralLock = LockState.createLock(
                ephemeralNodeRef, LockType.NODE_LOCK, "owner", null, Lifetime.EPHEMERAL, null);
    
    NodeRef persistentNodeRef = new NodeRef("workspace://SpacesStore/5838743");
    LockState persistentLock = LockState.createLock(
                persistentNodeRef, LockType.NODE_LOCK, "owner", null, Lifetime.PERSISTENT, null);
    
    lockStore.set(ephemeralNodeRef, ephemeralLock);
    lockStore.set(persistentNodeRef, persistentLock);
    
    LockState newLockState = lockStore.get(ephemeralNodeRef);
    assertEquals(ephemeralLock, newLockState);
    
    newLockState = lockStore.get(persistentNodeRef);
    assertEquals(persistentLock, newLockState);
}
 
Example #4
Source File: AbstractArchivedNodeWebScript.java    From alfresco-remote-api with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * * This method gets all nodes from the archive which were originally
 * contained within the specified StoreRef.
 * 
 * @param storeRef mandatory store ref
 * @param paging mandatory paging
 * @param filter optional filter
 */
protected PagingResults<NodeRef> getArchivedNodesFrom(StoreRef storeRef, ScriptPagingDetails paging, String filter)
{
    NodeService nodeService = serviceRegistry.getNodeService();
    NodeRef archiveStoreRootNodeRef = nodeService.getStoreArchiveNode(storeRef);

    // Create canned query
    ArchivedNodesCannedQueryBuilder queryBuilder = new ArchivedNodesCannedQueryBuilder.Builder(
                archiveStoreRootNodeRef, paging).filter(filter)
                .sortOrderAscending(false).build();

    // Query the DB
    PagingResults<NodeRef> result = nodeArchiveService.listArchivedNodes(queryBuilder);

    return result;
}
 
Example #5
Source File: ImapServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public String getPathFromRepo(final ChildAssociationRef assocRef)
{
    return doAsSystem(new RunAsWork<String>()
    {
        @Override
        public String doWork() throws Exception
        {
            NodeRef ref = assocRef.getParentRef();
            String name = ((String) nodeService.getProperty(ref, ContentModel.PROP_NAME)).toLowerCase();
            ChildAssociationRef parent = nodeService.getPrimaryParent(ref);
            QName qname = parent.getQName();
            if (qname.equals(QName.createQName(NamespaceService.APP_MODEL_1_0_URI, "company_home")))
            {
                return "repository";
            }
            else
            {
                return getPathFromRepo(parent) + "/" + name;
            }
        }
    });
}
 
Example #6
Source File: AbstractLockStoreTestBase.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Test
public void testContains()
{
    NodeRef nodeRef1 = new NodeRef("workspace://SpacesStore/12345");
    LockState lock1 = LockState.createLock(nodeRef1, LockType.NODE_LOCK, "owner", null, Lifetime.EPHEMERAL, null);
    
    NodeRef nodeRef2 = new NodeRef("workspace://SpacesStore/5838743");
    LockState lock2 = LockState.createLock(nodeRef2, LockType.NODE_LOCK, "owner", null, Lifetime.PERSISTENT, null);
    
    NodeRef nodeRef3 = new NodeRef("workspace://SpacesStore/65752323");
    
    lockStore.set(nodeRef1, lock1);
    lockStore.set(nodeRef2, lock2);
    
    assertNotNull(lockStore.get(nodeRef1));
    assertNotNull(lockStore.get(nodeRef2));
    assertNull(lockStore.get(nodeRef3));
}
 
Example #7
Source File: TransferSummaryReportImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
private String getReportBaseName(NodeRef reportParentFolder)
{
    String prefixName = null;
    List<FileInfo> list = fileFolderService.list(reportParentFolder);
    for (FileInfo file : list)
    {
        if (file.getNodeRef().toString().contains(transferId))
        {
            // found the existing "destination" remote file
            Serializable name = nodeService.getProperty(file.getNodeRef(), ContentModel.PROP_NAME);
            if (name instanceof String)
            {
                String fileName = (String) name;
                if (fileName.lastIndexOf(".") > 0)
                {
                    prefixName = fileName.substring(0, fileName.lastIndexOf("."));
                }
            }
            break;
        }
    }
    return prefixName;
}
 
Example #8
Source File: SurfConfigFolderPatch.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public synchronized Collection<NodeRef> getNextWork()
{
    // Record the user folder node IDs
    final List<NodeRef> folderNodes = new ArrayList<NodeRef>(SHARED_SURF_CONFIG_BATCH_MAX_QUERY_RANGE);

    // Keep querying until we have enough results to give back
    int minResults = SHARED_SURF_CONFIG_BATCH_MAX_QUERY_RANGE / 2;
    while (currentId <= maxId && folderNodes.size() < minResults)
    {

        List<NodeRef> nodeIds = patchDAO.getChildrenOfTheSharedSurfConfigFolder(currentId, currentId + SHARED_SURF_CONFIG_BATCH_MAX_QUERY_RANGE);
        folderNodes.addAll(nodeIds);
        // Increment the minimum ID
        currentId += SHARED_SURF_CONFIG_BATCH_MAX_QUERY_RANGE;
    }
    // Preload the nodes for quicker access
    nodeDAO.cacheNodes(folderNodes);
    // Done
    return folderNodes;
}
 
Example #9
Source File: ActionsAspect.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * On add aspect policy behaviour
 * 
 * @param nodeRef NodeRef
 * @param aspectTypeQName QName
 */
public void onAddAspect(NodeRef nodeRef, QName aspectTypeQName)
{
    this.ruleService.disableRules(nodeRef);
    try
    {
        this.nodeService.createNode(
                nodeRef,
                ActionModel.ASSOC_ACTION_FOLDER,
                ActionModel.ASSOC_ACTION_FOLDER,
                ContentModel.TYPE_SYSTEM_FOLDER);
    }
    finally
    {
        this.ruleService.enableRules(nodeRef);
    }
}
 
Example #10
Source File: VersionServiceImplTest.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Test versioning many nodes in one go
 */
@Test
public void testVersioningManyNodes()
{
    NodeRef versionableNode = createNewVersionableNode();
    
    // Snap shot data
    String expectedVersionLabel = peekNextVersionLabel(versionableNode, versionProperties);  
    
    // Snap-shot the node created date-time
    long beforeVersionTime = ((Date)nodeService.getProperty(versionableNode, ContentModel.PROP_CREATED)).getTime();
    
    // Version the list of nodes created
    Collection<Version> versions = this.versionService.createVersion(
            this.versionableNodes.values(),
            this.versionProperties);
    
    // Check the returned versions are correct
    CheckVersionCollection(expectedVersionLabel, beforeVersionTime, versions);
    
    // TODO check the version histories
}
 
Example #11
Source File: FileImporterImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
public int loadFile(NodeRef container, File file) throws FileImporterException
{
    try
    {
        Counter counter = new Counter();
        create(counter, container, file, null, false, null);
        return counter.getCount();
    }
    catch (Throwable e)
    {
        throw new FileImporterException("Failed to load file: \n" +
                "   container: " + container + "\n" +
                "   file: " + file,
                e);
    }
}
 
Example #12
Source File: MailActionExecuter.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
public NodeRef getPerson(final String user)
{
    NodeRef person = null;
    String domain = tenantService.getPrimaryDomain(user); // get primary tenant 
    if (domain != null) 
    { 
        person = TenantUtil.runAsTenant(new TenantRunAsWork<NodeRef>()
        {
            public NodeRef doWork() throws Exception
            {
                return personService.getPerson(user);
            }
        }, domain);
    }
    else
    {
        person = personService.getPerson(user);
    }
    return person;
}
 
Example #13
Source File: CommentsApiTest.java    From alfresco-remote-api with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * REPO-828 (MNT-16401)
 * @throws Exception
 */
public void testDeleteCommentPostActivity() throws Exception
{
    permissionService.setPermission(sitePage, USER_TWO, PermissionService.ALL_PERMISSIONS, true);
    postLookup.execute();
    feedGenerator.execute();
    int activityNumStart = activityService.getSiteFeedEntries(SITE_SHORT_NAME).size();
    Response response = addComment(sitePage, USER_TWO, 200);
    postLookup.execute();
    feedGenerator.execute();
    int activityNumNext = activityService.getSiteFeedEntries(SITE_SHORT_NAME).size();
    assertEquals("The activity feeds were not generated after adding a comment", activityNumStart + 1, activityNumNext);
    JSONObject jsonResponse = parseResponseJSON(response);
    String nodeRefComment = getOrNull(jsonResponse, JSON_KEY_NODEREF);
    NodeRef commentNodeRef = new NodeRef(nodeRefComment);
    deleteComment(commentNodeRef, sitePage, USER_TWO, 200);
    activityNumStart = activityNumNext;
    postLookup.execute();
    feedGenerator.execute();
    activityNumNext = activityService.getSiteFeedEntries(SITE_SHORT_NAME).size();
    assertEquals("The activity feeds were not generated after deleting a comment", activityNumStart + 1, activityNumNext);
}
 
Example #14
Source File: ContentUsageImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
private boolean alreadyCreated(NodeRef nodeRef)
{
    Set<NodeRef> createdNodes = (Set<NodeRef>)AlfrescoTransactionSupport.getResource(KEY_CREATED_NODES);
    if (createdNodes != null)
    {
        for (NodeRef createdNodeRef : createdNodes)
        {
            if (createdNodeRef.equals(nodeRef))
            {
                if (logger.isDebugEnabled()) logger.debug("alreadyCreated: nodeRef="+nodeRef);
                return true;
            }
        }
    }
    return false;
}
 
Example #15
Source File: TaggingServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * @see org.alfresco.service.cmr.tagging.TaggingService#addTagScope(org.alfresco.service.cmr.repository.NodeRef)
 */
public void addTagScope(NodeRef nodeRef)
{
    if (this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_TAGSCOPE) == false)
    {
        // Add the tag scope aspect
        this.nodeService.addAspect(nodeRef, ContentModel.ASPECT_TAGSCOPE, null);
        
        // Refresh the tag scope
        refreshTagScope(nodeRef, false);
    }        
}
 
Example #16
Source File: NodeRefPathExpressionTest.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected void assertResolvablePath(String path, String toName)
{
    NodeRefPathExpression pathExpression = nodeRefPathExpressionFactory.createInstance();

    pathExpression.setPath(path);

    NodeRef nodeRef = pathExpression.resolve();
    assertNotNull(nodeRef);
    Serializable theName = nodeService.getProperty(nodeRef,
                                                   ContentModel.PROP_NAME);
    assertEquals("Unexpected name for path " + pathExpression,
                 toName,
                 theName);
}
 
Example #17
Source File: GetChildrenCannedQuery.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
private boolean includeAspects(NodeRef nodeRef, Set<QName> inclusiveAspects, Set<QName> exclusiveAspects)
{
    if (inclusiveAspects == null && exclusiveAspects == null)
    {
        return true;
    }

    Set<QName> nodeAspects = nodeService.getAspects(nodeRef);
    if (inclusiveAspects != null) 
    {
        Set<QName> includedIntersect = new HashSet<QName>(nodeAspects);
        includedIntersect.retainAll(inclusiveAspects);
        if (includedIntersect.isEmpty()) 
        {
            return false;
        }
    }
    if (exclusiveAspects != null)
    {
        Set<QName> excludedIntersect = new HashSet<QName>(nodeAspects);
        excludedIntersect.retainAll(exclusiveAspects);
        if (excludedIntersect.isEmpty() == false)
        {
            return false;
        }
    }
    return true;
    
}
 
Example #18
Source File: FormRestApiGet_Test.java    From alfresco-remote-api with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void testGetFormForNonExistentNode() throws Exception
{
    // Create a NodeRef with all digits changed to an 'x' char - 
    // this should make for a non-existent node.
    String missingId = this.referencingDocNodeRef.getId().replaceAll("\\d", "x");
    NodeRef missingNodeRef = new NodeRef(this.referencingDocNodeRef.getStoreRef(), 
                missingId);
    
    JSONObject jsonPostData = createItemJSON(missingNodeRef);
    String jsonPostString = jsonPostData.toString();
    Response rsp = sendRequest(new PostRequest(FORM_DEF_URL, 
                jsonPostString, APPLICATION_JSON), 404);
    assertEquals("application/json;charset=UTF-8", rsp.getContentType());
}
 
Example #19
Source File: ContentInfo.java    From alfresco-remote-api with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected void streamContentImpl(WebScriptRequest req, WebScriptResponse res, 
        ContentReader reader, NodeRef nodeRef, QName propertyQName, 
        boolean attach, Date modified, String eTag, String attachFileName)
        throws IOException
{
    delegate.setAttachment(req, res, attach, attachFileName);

    // establish mimetype
    String mimetype = reader.getMimetype();
    String extensionPath = req.getExtensionPath();
    if (mimetype == null || mimetype.length() == 0)
    {
        mimetype = MimetypeMap.MIMETYPE_BINARY;
        int extIndex = extensionPath.lastIndexOf('.');
        if (extIndex != -1)
        {
            String ext = extensionPath.substring(extIndex + 1);
            mimetype = mimetypeService.getMimetype(ext);
        }
    }

    // set mimetype for the content and the character encoding + length for the stream
    res.setContentType(mimetype);
    res.setContentEncoding(reader.getEncoding());
    res.setHeader("Content-Length", Long.toString(reader.getSize()));

    // set caching
    Cache cache = new Cache();
    cache.setNeverCache(false);
    cache.setMustRevalidate(true);
    cache.setMaxAge(0L);
    cache.setLastModified(modified);
    cache.setETag(eTag);
    res.setCache(cache);
}
 
Example #20
Source File: JSONConversionComponent.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Handles the work of converting aspects to JSON.
 * 
 * @param nodeRef NodeRef
 * @param useShortQNames boolean
 * @return JSONArray
 */
@SuppressWarnings("unchecked")
protected JSONArray apsectsToJSON(NodeRef nodeRef, boolean useShortQNames)
{
    JSONArray aspectsJSON = new JSONArray();
    
    Set<QName> aspects = this.nodeService.getAspects(nodeRef);
    for (QName aspect : aspects)
    {
        aspectsJSON.add(nameToString(aspect, useShortQNames));
    }
    
    return aspectsJSON;
}
 
Example #21
Source File: AFTSRangeQueryIT.java    From SearchServices with GNU Lesser General Public License v3.0 5 votes vote down vote up
@BeforeClass
public static void beforeClass() throws Exception
{
    TestDataProvider dataProvider = new TestDataProvider(h);

    @SuppressWarnings("unchecked")
    Pair<String, String> [] ratingsAndCreators = new Pair[] {
            new Pair<>("someTest", "Mario"),
            new Pair<>("test", "Luigi"),
            new Pair<>("firstString", "Wario")
    };

    TEST_ROOT_NODEREF = dataProvider.getRootNode();

    range(0, ratingsAndCreators.length)
            .forEach(dbId -> {
                String rating = ratingsAndCreators[dbId].getFirst();
                String creator = ratingsAndCreators[dbId].getSecond();

                Map<QName, PropertyValue> properties = new HashMap<>();
                properties.put(PROP_CREATOR, new StringPropertyValue(creator));
                properties.put(PROP_RATING_SCHEME, new StringPropertyValue(rating));

                addNode(getCore(),
                        dataModel, 1, dbId, 1,
                        TYPE_CONTENT, null, properties, null,
                        "the_owner_of_this_node_is" + creator,
                        null,
                        new NodeRef[]{ TEST_ROOT_NODEREF },
                        new String[]{ "/" + dataProvider.qName("a_qname_for_node_" + creator) },
                        dataProvider.newNodeRef(), true);
            });
}
 
Example #22
Source File: DiscussionServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public TopicInfo getTopic(NodeRef parentNodeRef, String topicName) 
{
   NodeRef topic = nodeService.getChildByName(parentNodeRef, ContentModel.ASSOC_CONTAINS, topicName);
   if (topic != null)
   {
      return buildTopic(topic, parentNodeRef, topicName);
   }
   return null;
}
 
Example #23
Source File: TestControllerAdvice.java    From alfresco-mvc with Apache License 2.0 5 votes vote down vote up
@Override
public NodeRef beforeBodyWrite(NodeRef body, MethodParameter returnType, MediaType selectedContentType,
		Class<? extends HttpMessageConverter<?>> selectedConverterType, ServerHttpRequest request,
		ServerHttpResponse response) {

	response.getHeaders().add("TEST_ADVICE_APPLIED", "true");
	return new NodeRef("a://a/b");

}
 
Example #24
Source File: TagsImpl.java    From alfresco-remote-api with GNU Lesser General Public License v3.0 5 votes vote down vote up
public NodeRef validateTag(StoreRef storeRef, String tagId)
{
	NodeRef tagNodeRef = nodes.validateNode(storeRef, tagId);
	if(tagNodeRef == null)
	{
		throw new EntityNotFoundException(tagId);
	}
	return tagNodeRef;
}
 
Example #25
Source File: NodeRefNetworkFile.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Create a network file object with the specified file/directory name.
 * 
 * @param name File name string.
 * @param node NodeRef
 */
public NodeRefNetworkFile(String name, NodeRef node)
{
    super( name);
    
    m_nodeRef = node;
}
 
Example #26
Source File: AbstractContextAwareRepoEvent.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected void deleteNode(NodeRef nodeRef)
{
    retryingTransactionHelper.doInTransaction(() -> {
        nodeService.deleteNode(nodeRef);
        return null;
    });
}
 
Example #27
Source File: TaskFormPersister.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
* {@inheritDoc}
 */
@Override
protected boolean addTransientAssociation(String fieldName, List<NodeRef> values)
{
    if (PackageItemsFieldProcessor.KEY.equals(fieldName))
    {
        updater.addPackageItems(values);
        return true;
    }
    
    return false;
}
 
Example #28
Source File: QuickShareLinksImpl.java    From alfresco-remote-api with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Rendition getRendition(String sharedId, String renditionId)
{
    checkEnabled();
    checkValidShareId(sharedId);

    try
    {
        Pair<String, NodeRef> pair = quickShareService.getTenantNodeRefFromSharedId(sharedId);

        String networkTenantDomain = pair.getFirst();
        final NodeRef nodeRef = pair.getSecond();

        return TenantUtil.runAsSystemTenant(() ->
        {
            Parameters params = getParamsWithCreatedStatus();
            return renditions.getRendition(nodeRef, renditionId, params);

        }, networkTenantDomain);
    }
    catch (InvalidSharedIdException ex)
    {
        logger.warn("Unable to find: " + sharedId);
        throw new EntityNotFoundException(sharedId);
    }
    catch (InvalidNodeRefException inre)
    {
        logger.warn("Unable to find: " + sharedId + " [" + inre.getNodeRef() + "]");
        throw new EntityNotFoundException(sharedId);
    }
}
 
Example #29
Source File: RenditionService2Impl.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Returns the hash code of source node's content url on the rendition node (node may be null) if it does not exist.
 * Used work out if a rendition should be replaced. {@code -2} is returned if the rendition does not exist or was
 * not created by RenditionService2. {@code -1} is returned if there was no source content or the rendition failed.
 */
private int getRenditionContentHashCode(NodeRef renditionNode)
{
    if ( renditionNode == null || !nodeService.hasAspect(renditionNode, RenditionModel.ASPECT_RENDITION2))
    {
        return RENDITION2_DOES_NOT_EXIST;
    }

    Serializable hashCode = nodeService.getProperty(renditionNode, PROP_RENDITION_CONTENT_HASH_CODE);
    return hashCode == null
            ? SOURCE_HAS_NO_CONTENT
            : (int)hashCode;
}
 
Example #30
Source File: DownloadsImpl.java    From alfresco-remote-api with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected void checkNodeIdsReadPermission(NodeRef[] zipContentNodeRefs)
{
    for (NodeRef nodeRef : zipContentNodeRefs)
    {
        if (permissionService.hasReadPermission(nodeRef).equals(AccessStatus.DENIED)){
            throw new PermissionDeniedException();
        }
    }
}