Java Code Examples for org.alfresco.service.cmr.repository.StoreRef#STORE_REF_ARCHIVE_SPACESSTORE

The following examples show how to use org.alfresco.service.cmr.repository.StoreRef#STORE_REF_ARCHIVE_SPACESSTORE . 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: StoreMapper.java    From alfresco-remote-api with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Work out which StoreRef this store belongs to.
 * @param String representing a store
 * @return StoreRef
 */
public StoreRef getStoreRef(String store)
{
    if (store != null && !store.isEmpty())
    {
        switch (store.toLowerCase())
        {
            case LIVE_NODES:
                return StoreRef.STORE_REF_WORKSPACE_SPACESSTORE;
            case VERSIONS:
                return STORE_REF_VERSION2_SPACESSTORE;
            case DELETED:
                return StoreRef.STORE_REF_ARCHIVE_SPACESSTORE;
            case HISTORY:
                return STORE_REF_HISTORY;
        }
    }
    throw new InvalidArgumentException(InvalidArgumentException.DEFAULT_MESSAGE_ID,
                new Object[] { ": scope allowed values: nodes,deleted-nodes,versions" });
}
 
Example 2
Source File: DeletedNodesImpl.java    From alfresco-remote-api with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Rendition getRendition(String archivedId, String renditionId, Parameters parameters)
{
    NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, archivedId);
    Rendition rendition = renditions.getRendition(nodeRef, renditionId, parameters);
    return rendition;
}
 
Example 3
Source File: LocalFeedTaskProcessor.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
private boolean canReadImpl(final String connectedUser, final NodeRef nodeRef) throws Exception
{
    // check for read permission
    long start = System.currentTimeMillis();

    try
    {
        // note: deleted node does not exist (hence no permission, although default permission check would return true which is problematic)
        final NodeRef checkNodeRef;
        NodeRef parentToCheckNodeRef = null;
        if (nodeService.exists(nodeRef))
        {
            checkNodeRef = nodeRef;
        }
        else
        {
            // TODO: require ghosting - this is temp workaround (we should not rely on archive - may be permanently deleted, ie. not archived or already purged)
            NodeRef archiveNodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, nodeRef.getId());
            if (!nodeService.exists(archiveNodeRef))
            {
                return false;
            }
            // MNT-10023
            if (permissionService.getInheritParentPermissions(archiveNodeRef))
            {
                ChildAssociationRef originalParentAssoc = (ChildAssociationRef) nodeService.getProperty(archiveNodeRef, ContentModel.PROP_ARCHIVED_ORIGINAL_PARENT_ASSOC);
                if (originalParentAssoc != null)
                {
                    parentToCheckNodeRef = originalParentAssoc.getParentRef();
                }
            }

            checkNodeRef = archiveNodeRef;
        }

        if (connectedUser.equals(""))
        {
            // site feed (public site)
            Set<AccessPermission> perms = permissionService.getAllSetPermissions(checkNodeRef);
            for (AccessPermission perm : perms)
            {
                if (perm.getAuthority().equals(PermissionService.ALL_AUTHORITIES) && 
                    perm.getAuthorityType().equals(AuthorityType.EVERYONE) && 
                    perm.getPermission().equals(PermissionService.READ_PERMISSIONS) && 
                    perm.getAccessStatus().equals(AccessStatus.ALLOWED))
                {
                    return true;
                }
            }

            if (parentToCheckNodeRef != null)
            {
                return canReadImpl(connectedUser, parentToCheckNodeRef);
            }

            return false;
        }
        else
        {
            // user feed
            boolean allow = AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Boolean>()
            {
                public Boolean doWork() throws Exception
                {
                    return (permissionService.hasPermission(checkNodeRef, PermissionService.READ) == AccessStatus.ALLOWED);
                }
            }, connectedUser);

            if (!allow && parentToCheckNodeRef != null)
            {
                allow = canReadImpl(connectedUser, parentToCheckNodeRef);
            }

            return allow;
        }
    }
    finally
    {
        if (logger.isDebugEnabled())
        {
            logger.debug("canRead: " + nodeRef + " in " + (System.currentTimeMillis() - start) + " msecs");
        }
    }
}
 
Example 4
Source File: RepoPrimaryManifestProcessorImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
protected void processNode(TransferManifestNormalNode node)
{
    if (log.isDebugEnabled())
    {
        log.debug("Processing node with incoming noderef of " + node.getNodeRef());
    }
    logComment("Primary Processing incoming node: " + node.getNodeRef() + " --  Source path = " + node.getParentPath() + "/" + node.getPrimaryParentAssoc().getQName());

    ChildAssociationRef primaryParentAssoc = node.getPrimaryParentAssoc();
    if (primaryParentAssoc == null)
    {
        error(node, MSG_NO_PRIMARY_PARENT_SUPPLIED);
    }

    CorrespondingNodeResolver.ResolvedParentChildPair resolvedNodes = nodeResolver.resolveCorrespondingNode(node
            .getNodeRef(), primaryParentAssoc, node.getParentPath());

    // Does a corresponding node exist in this repo?
    if (resolvedNodes.resolvedChild != null)
    {
        if (log.isTraceEnabled())
        {
            log.trace("REPO_PRIMARY_MANIFEST_PROCESSOR - node DOES exist!");
            logInvasionHierarchy(resolvedNodes.resolvedParent, resolvedNodes.resolvedChild, nodeService, log);
        }

        // Yes, the corresponding node does exist. Update it.
        if (log.isDebugEnabled())
        {
            log.debug("Incoming noderef " + node.getNodeRef() + " has been resolved to existing local noderef "
                    + resolvedNodes.resolvedChild);
        }
        update(node, resolvedNodes, primaryParentAssoc);

        if (log.isTraceEnabled())
        {
            log.trace("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
        }
    }
    else
    {
        // No, there is no corresponding node. 
        NodeRef archiveNodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, node.getNodeRef().getId());
        if (nodeService.exists(archiveNodeRef))
        {
            // We have found a node in the archive store that has the same
            // UUID as the one that we've been sent.    If it remains it may cause problems later on
            // We delete from the archive store and treat the new node as a create.
            if (log.isInfoEnabled())
            {
                log.info("Located an archived node with UUID matching transferred node: " + archiveNodeRef);
                log.info("Attempting to restore " + archiveNodeRef);
            }
            logComment("Delete node from archive: " + archiveNodeRef);
            nodeService.deleteNode(archiveNodeRef);
        }

        if (log.isDebugEnabled())
        {
            log.debug("Incoming noderef has no corresponding local noderef: " + node.getNodeRef());
        }

        if (log.isTraceEnabled())
        {
            log.trace("REPO_PRIMARY_MANIFEST_PROCESSOR - node DOES NOT esist yet! Name: '" + node.getProperties().get(ContentModel.PROP_NAME) + "', parentPath: '"
                    + node.getParentPath() + "'");
        }

        create(node, resolvedNodes, primaryParentAssoc);

        if (log.isTraceEnabled())
        {
            log.trace("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
        }
    }
}
 
Example 5
Source File: DeletedNodesImpl.java    From alfresco-remote-api with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public CollectionWithPagingInfo<Rendition> getRenditions(String archivedId, Parameters parameters)
{
    NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, archivedId);
    return renditions.getRenditions(nodeRef, parameters);
}