當前位置: 首頁>>代碼示例>>Java>>正文


Java NodeRef.getStoreRef方法代碼示例

本文整理匯總了Java中org.alfresco.service.cmr.repository.NodeRef.getStoreRef方法的典型用法代碼示例。如果您正苦於以下問題:Java NodeRef.getStoreRef方法的具體用法?Java NodeRef.getStoreRef怎麽用?Java NodeRef.getStoreRef使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.alfresco.service.cmr.repository.NodeRef的用法示例。


在下文中一共展示了NodeRef.getStoreRef方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: selectNodeByNodeRef

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
@Override
protected NodeEntity selectNodeByNodeRef(NodeRef nodeRef)
{
    StoreEntity store = new StoreEntity();
    StoreRef storeRef = nodeRef.getStoreRef();
    store.setProtocol(storeRef.getProtocol());
    store.setIdentifier(storeRef.getIdentifier());
    
    NodeEntity node = new NodeEntity();
    // Store
    node.setStore(store);
    // UUID
    String uuid = nodeRef.getId();
    if (uuid.length() > 36)
    {
        return null;            // Avoid DB2 query failure if someone passes in a made-up UUID
    }
    node.setUuid(uuid);
    
    return template.selectOne(SELECT_NODE_BY_NODEREF, node);
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:22,代碼來源:NodeDAOImpl.java

示例2: removeArchivedRenditionsFrom

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
protected List<ChildAssociationRef> removeArchivedRenditionsFrom(final NodeRef sourceNode,
        final List<ChildAssociationRef> renditionAssocs)
{
    // This is a workaround for a bug in the NodeService (no JIRA number yet) whereby a call to
    // nodeService.getChildAssocs can return all children, including children in the archive store.
    final List<ChildAssociationRef> result = new ArrayList<>();

    // check if there even is an archive for the store of the node
    final NodeRef archivedNode = this.nodeArchiveService.getStoreArchiveNode(sourceNode.getStoreRef());
    final StoreRef archiveStore = archivedNode != null ? archivedNode.getStoreRef() : null;

    for (final ChildAssociationRef chAssRef : renditionAssocs)
    {
        // If the rendition has *not* been deleted, then it should remain in the result list.
        final StoreRef renditionStoreRef = chAssRef.getChildRef().getStoreRef();
        if (!EqualsHelper.nullSafeEquals(archiveStore, renditionStoreRef))
        {
            result.add(chAssRef);
        }
    }

    return result;
}
 
開發者ID:AFaust,項目名稱:alfresco-better-trashmanagement,代碼行數:24,代碼來源:ArchiveSupportingRenditionServiceImpl.java

示例3: getHeadVersion

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
/**
 * Get the head version given a node reference
 *
 * @param nodeRef   the node reference
 * @return          the 'head' version
 */
private Version getHeadVersion(NodeRef nodeRef)
{
    Version version = null;
    StoreRef storeRef = nodeRef.getStoreRef();

    NodeRef versionHistoryNodeRef = getVersionHistoryNodeRef(nodeRef);
    if (versionHistoryNodeRef != null)
    {
        List<ChildAssociationRef> versionsAssoc = this.dbNodeService.getChildAssocs(versionHistoryNodeRef, RegexQNamePattern.MATCH_ALL, VersionModel.CHILD_QNAME_VERSIONS);
        for (ChildAssociationRef versionAssoc : versionsAssoc)
        {
            NodeRef versionNodeRef = versionAssoc.getChildRef();
            List<AssociationRef> successors = this.dbNodeService.getTargetAssocs(versionNodeRef, VersionModel.ASSOC_SUCCESSOR);
            if (successors.size() == 0)
            {
                String storeProtocol = (String)this.dbNodeService.getProperty(
                        versionNodeRef,
                        QName.createQName(NAMESPACE_URI, VersionModel.PROP_FROZEN_NODE_STORE_PROTOCOL));
                String storeId = (String)this.dbNodeService.getProperty(
                        versionNodeRef,
                        QName.createQName(NAMESPACE_URI, VersionModel.PROP_FROZEN_NODE_STORE_ID));
                StoreRef versionStoreRef = new StoreRef(storeProtocol, storeId);
                if (storeRef.equals(versionStoreRef) == true)
                {
                    version = getVersion(versionNodeRef);
                }
            }
        }
    }

    return version;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:39,代碼來源:VersionServiceImpl.java

示例4: getLatestVersion

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
private Version getLatestVersion(NodeRef nodeRef)
{
    Version version = null;
    StoreRef storeRef = nodeRef.getStoreRef();

    NodeRef versionHistoryNodeRef = getVersionHistoryNodeRef(nodeRef);
    if (versionHistoryNodeRef != null)
    {
        List<ChildAssociationRef> versionsAssoc = this.dbNodeService.getChildAssocs(versionHistoryNodeRef, RegexQNamePattern.MATCH_ALL, VersionModel.CHILD_QNAME_VERSIONS);
        for (ChildAssociationRef versionAssoc : versionsAssoc)
        {
            NodeRef versionNodeRef = versionAssoc.getChildRef();
            List<AssociationRef> predecessors = this.dbNodeService.getSourceAssocs(versionNodeRef, VersionModel.ASSOC_SUCCESSOR);
            if (predecessors.size() == 0)
            {
                String storeProtocol = (String)this.dbNodeService.getProperty(
                        versionNodeRef,
                        QName.createQName(NAMESPACE_URI, VersionModel.PROP_FROZEN_NODE_STORE_PROTOCOL));
                String storeId = (String)this.dbNodeService.getProperty(
                        versionNodeRef,
                        QName.createQName(NAMESPACE_URI, VersionModel.PROP_FROZEN_NODE_STORE_ID));
                StoreRef versionStoreRef = new StoreRef(storeProtocol, storeId);
                if (storeRef.equals(versionStoreRef) == true)
                {
                    version = getVersion(versionNodeRef);
                }
            }
        }
    }

    return version;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:33,代碼來源:VersionServiceImpl.java

示例5: stringifyRepositoryLocation

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
@Override
public String stringifyRepositoryLocation(RepositoryNodeRef repositoryNodeRef) throws ReferenceEncodingException
{
    NodeRef nodeRef = repositoryNodeRef.getNodeRef();
    StoreRef storeRef = nodeRef.getStoreRef();

    return NODE + DELIMITER + storeRef.getProtocol() + DELIMITER + storeRef.getIdentifier() + DELIMITER
                + nodeRef.getId();
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:10,代碼來源:PlainStringifier.java

示例6: hash

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
@Override
public Pair<String, String> hash(NodeRef nodeRef)
{
    String uuid = nodeRef.getId();

    if (uuid.length() != 36)
    {
        throw new RuntimeException("Invalid noderf id length " + uuid);
    }

    String bigInt16String = uuid.replaceAll("-",
                                            "");
    if (bigInt16String.length() != 32)
    {
        throw new RuntimeException("Invalid noderf id format " + uuid);
    }

    BigInteger bigIntId = new BigInteger(bigInt16String,
                                         16);
    StoreRef storeRef = nodeRef.getStoreRef();
    String storeProtocolHash = storeProtocolStore.hash(storeRef.getProtocol());
    String storeIdHash = storeIdStore.hash(storeRef.getIdentifier());
    if (storeProtocolHash == null || storeIdHash == null)
    {
        throw new RuntimeException("Missing hash for " + storeRef);
    }
    String storeHash = storeProtocolHash + storeIdHash;
    return new Pair<String, String>(storeHash,
                                    bigIntId.toString(radix));

}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:32,代碼來源:NodeRefRadixHasher.java

示例7: propagateNodeRefMutations

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
@Override
public Reference propagateNodeRefMutations(NodeRef mutatedNodeRef, Reference reference)
{
    StoreRef storeRef = mutatedNodeRef.getStoreRef();
    String storeId = storeRef.getIdentifier();
    String protocol = storeRef.getProtocol();

    if (Version2Model.STORE_ID.equals(storeId) || VersionModel.STORE_ID.equals(storeId)
                || VersionBaseModel.STORE_PROTOCOL.equals(protocol))
    {
        Resource resource = reference.getResource();
        if (resource instanceof RepositoryResource)
        {
            RepositoryResource repositoryResource = (RepositoryResource) resource;
            RepositoryLocation location = repositoryResource.getLocation();
            if (location instanceof RepositoryNodeRef)
            {
                RepositoryNodeRef repositoryNodeRef = (RepositoryNodeRef) location;
                NodeRef nodeRef = repositoryNodeRef.getNodeRef();
                NodeRef nodeRefPropagation = new NodeRef(mutatedNodeRef.getStoreRef(),
                                                         nodeRef.getId());
                Resource resourcePropagation = new RepositoryResource(new RepositoryNodeRef(nodeRefPropagation));

                return new Reference(reference.getEncoding(),
                                     reference.getProtocol(),
                                     resourcePropagation,
                                     reference.getParameters());
            }
        }
    }

    // default branch

    return reference;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:36,代碼來源:NodeProtocol.java

示例8: getRootNode

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
@Override
public NodeRef getRootNode(NodeService nodeService, SearchService searchService, NamespaceService namespaceService, String rootPath, NodeRef rootNodeRef)
{
    ParameterCheck.mandatory("NodeService", nodeService);
    ParameterCheck.mandatory("SearchService", searchService);
    ParameterCheck.mandatory("NamespaceService", namespaceService);
    ParameterCheck.mandatory("RootPath", rootPath);
    ParameterCheck.mandatory("RootNodeRef", rootNodeRef);

    // String username = AuthenticationUtil.getFullyAuthenticatedUser();
    StoreRef storeRef = rootNodeRef.getStoreRef();

    AuthenticationUtil.RunAsWork<NodeRef> action = new GetRootNode(nodeService, searchService, namespaceService, rootPath, rootNodeRef, storeRef);
    return getBaseName(AuthenticationUtil.runAs(action, AuthenticationUtil.getSystemUserName()));
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:16,代碼來源:MultiTServiceImpl.java

示例9: getArchivedNode

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
public NodeRef getArchivedNode(NodeRef originalNodeRef)
{
    StoreRef orginalStoreRef = originalNodeRef.getStoreRef();
    NodeRef archiveRootNodeRef = nodeService.getStoreArchiveNode(orginalStoreRef);
    // create the likely location of the archived node
    NodeRef archivedNodeRef = new NodeRef(
            archiveRootNodeRef.getStoreRef(),
            originalNodeRef.getId());
    return archivedNodeRef;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:11,代碼來源:NodeArchiveServiceImpl.java

示例10: getNode

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
protected NodeRef getNode(NodeRef rootNodeRef, String path)
{
    RepositoryLocation repositoryLocation = new RepositoryLocation(rootNodeRef.getStoreRef(), path, RepositoryLocation.LANGUAGE_PATH);
    String[] pathElements = repositoryLocation.getPathElements();
    
    NodeRef nodeRef = rootNodeRef;
    if (pathElements.length > 0)
    {
        nodeRef = resolveQNamePath(rootNodeRef, pathElements);
    }
    
    return nodeRef;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:14,代碼來源:MessageServiceImpl.java

示例11: Location

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
/**
 * Construct
 * 
 * @param nodeRef NodeRef
 */
public Location(NodeRef nodeRef)
{
    ParameterCheck.mandatory("Node Ref", nodeRef);
    this.storeRef = nodeRef.getStoreRef();
    this.nodeRef = nodeRef;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:12,代碼來源:Location.java

示例12: restore

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
private void restore(NodeRef origfolderOrContentRef)
{
    NodeRef archiveRootNode = nodeService.getStoreArchiveNode(this.rootNodeRef.getStoreRef());
    
    NodeRef archiveNodeRef = new NodeRef(archiveRootNode.getStoreRef(), origfolderOrContentRef.getId());
    nodeService.restoreNode(archiveNodeRef, null, null, null);
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:8,代碼來源:UserUsageTest.java

示例13: testRestoreDeletedItems

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
/**
 * This test method restores some deleted nodes from the archive store.
 */
public void testRestoreDeletedItems() throws Exception
{
    AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
    
    JSONObject archivedNodesJson = getArchivedNodes();
    JSONObject dataJsonObj = archivedNodesJson.getJSONObject("data");
    JSONArray archivedNodesArray = dataJsonObj.getJSONArray(AbstractArchivedNodeWebScript.DELETED_NODES);
    
    int archivedNodesLength = archivedNodesArray.length();
    assertTrue("Insufficient archived nodes for test to run.", archivedNodesLength > 1);
    
    // Take a specific archived node and restore it.
    JSONObject firstArchivedNode = archivedNodesArray.getJSONObject(0);
    
    // So we have identified a specific Node in the archive that we want to restore.
    String nodeRefString = firstArchivedNode.getString(AbstractArchivedNodeWebScript.NODEREF);
    assertTrue("nodeRef string is invalid", NodeRef.isNodeRef(nodeRefString));
    NodeRef nodeRef = new NodeRef(nodeRefString);
    
    // This is not the StoreRef where the node originally lived e.g. workspace://SpacesStore
    // This is its current StoreRef i.e. archive://SpacesStore
    final StoreRef currentStoreRef = nodeRef.getStoreRef();
    
    String restoreUrl = getArchiveUrl(currentStoreRef) + "/" + nodeRef.getId();
    
    
    int archivedNodesCountBeforeRestore = getArchivedNodesCount();

    // Send the PUT REST call.
    String jsonString = new JSONStringer().object()
        .key("restoreLocation").value("")
        .endObject()
    .toString();
    Response rsp = sendRequest(new PutRequest(restoreUrl, jsonString, "application/json"), 200);
    
    assertEquals("Expected archive to shrink by one", archivedNodesCountBeforeRestore - 1, getArchivedNodesCount());
}
 
開發者ID:Alfresco,項目名稱:alfresco-remote-api,代碼行數:41,代碼來源:NodeArchiveServiceRestApiTest.java

示例14: makeUrl

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
private String makeUrl(NodeRef node, String locatorName)
{
    StoreRef storeRef = node.getStoreRef();
    StringBuilder url = new StringBuilder("/api/");
    url.append(storeRef.getProtocol()).append("/")
    .append(storeRef.getIdentifier()).append("/")
    .append(node.getId()).append("/")
    .append("nodelocator").append("/")
    .append(locatorName);
    return url.toString();
}
 
開發者ID:Alfresco,項目名稱:alfresco-remote-api,代碼行數:12,代碼來源:NodeLocatorWebScriptTest.java

示例15: afterVersionRevert

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
@Override
public void afterVersionRevert(NodeRef nodeRef, Version version)
{
    NodeRef versionNodeRef = version.getFrozenStateNodeRef();
    if (!this.nodeService.hasAspect(versionNodeRef, ForumModel.ASPECT_DISCUSSABLE))
    {
        return;
    }
    
    // Get the discussion assoc references from the version store
    List<ChildAssociationRef> childAssocRefs = this.nodeService.getChildAssocs(VersionUtil.convertNodeRef(versionNodeRef), ForumModel.ASSOC_DISCUSSION,
            RegexQNamePattern.MATCH_ALL);
    for (ChildAssociationRef childAssocRef : childAssocRefs)
    {
        // Get the child reference
        NodeRef childRef = childAssocRef.getChildRef();
        NodeRef referencedNode = (NodeRef) this.dbNodeService.getProperty(childRef, ContentModel.PROP_REFERENCE);

        if (referencedNode != null && this.nodeService.exists(referencedNode) == false)
        {
            StoreRef orginalStoreRef = referencedNode.getStoreRef();
            NodeRef archiveRootNodeRef = this.nodeService.getStoreArchiveNode(orginalStoreRef);
            if (archiveRootNodeRef == null)
            {
                // Store doesn't support archiving
                continue;
            }
            NodeRef archivedNodeRef = new NodeRef(archiveRootNodeRef.getStoreRef(), referencedNode.getId());

            if (!this.nodeService.exists(archivedNodeRef) || !nodeService.hasAspect(archivedNodeRef, ContentModel.ASPECT_ARCHIVED))
            {
                // Node doesn't support archiving or it was deleted within parent node.
                continue;
            }

            NodeRef existingChild = this.nodeService.getChildByName(nodeRef, childAssocRef.getTypeQName(), this.nodeService
                    .getProperty(archivedNodeRef, ContentModel.PROP_NAME).toString());
            if (existingChild != null)
            {
                this.nodeService.deleteNode(existingChild);
            }

            this.nodeService.restoreNode(archivedNodeRef, null, null, null);
        }
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:47,代碼來源:DiscussableAspect.java


注:本文中的org.alfresco.service.cmr.repository.NodeRef.getStoreRef方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。