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


Java NodeRef.getId方法代碼示例

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


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

示例1: encodeToString

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
private String encodeToString(Object o) throws UnsupportedEncodingException
{
    String ret = null;

    if (o instanceof NodeRef)
    {
        NodeRef nodeRef = (NodeRef) o;
        ret = (o != null ? nodeRef.getId() : null);
    }
    else
    {
        ret = (o != null ? o.toString() : null);
    }

    return ret;
}
 
開發者ID:Alfresco,項目名稱:alfresco-remote-api,代碼行數:17,代碼來源:PublicApiHttpClient.java

示例2: getReferenceableProperty

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
public static Serializable getReferenceableProperty(Node node, QName qname)
{
    NodeRef nodeRef = node.getNodeRef();
    if (qname.equals(ContentModel.PROP_STORE_PROTOCOL))
    {
        return nodeRef.getStoreRef().getProtocol();
    }
    else if (qname.equals(ContentModel.PROP_STORE_IDENTIFIER))
    {
        return nodeRef.getStoreRef().getIdentifier();
    }
    else if (qname.equals(ContentModel.PROP_NODE_UUID))
    {
        return nodeRef.getId();
    }
    else if (qname.equals(ContentModel.PROP_NODE_DBID))
    {
        return node.getId();
    }
    throw new IllegalArgumentException("Not sys:referenceable property: " + qname);
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:22,代碼來源:ReferenceablePropertiesEntity.java

示例3: executeImpl

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
/**
 * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action,
 *      org.alfresco.service.cmr.repository.NodeRef)
 */
@Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
{
    Set<NodeRef> nodeToTransfer = new HashSet<NodeRef>();
    nodeToTransfer.add(actionedUponNodeRef);
    TransferDefinition transferDef = new TransferDefinition();
    transferDef.setNodes(nodeToTransfer);
    //setting sync to true to generate the delete
    //transferDef.setSync(true);
    if (!transferService.targetExists(TARGET_NAME))
    {
        TransferTargetImpl newTarget = new TransferTargetImpl();
        newTarget.setEndpointProtocol("http");
        newTarget.setEndpointHost("localhost");
        newTarget.setEndpointPort(9090);
        newTarget.setEndpointPath("/alfresco-ftr/service/api/transfer");
        newTarget.setName(TARGET_NAME);
        newTarget.setTitle("FTR test title target");
        newTarget.setUsername("phil");
        newTarget.setPassword("phil".toCharArray());
        transferService.saveTransferTarget(newTarget);
        // get the created target and define the root
        // the root is implicitly defined has the root of the current node.
        // get underlying node ref corresponding to the target definition
        NodeRef transferTargetNodeRef = transferService.getTransferTarget(TARGET_NAME).getNodeRef();
        // Get the primary parent of the node the action is execute up on
        NodeRef rooTarget = nodeService.getPrimaryParent(actionedUponNodeRef).getParentRef();
        //Set the type to "fileTransferTarget" to transferTargetNodeRef and associate it to the root
        nodeService.setType(transferTargetNodeRef, TransferModel.TYPE_FILE_TRANSFER_TARGET);
        // create the association
        nodeService.createAssociation(transferTargetNodeRef, rooTarget, TransferModel.ASSOC_ROOT_FILE_TRANSFER);
    }

    fileFolderService.delete(actionedUponNodeRef);
    transferService.transfer(TARGET_NAME, transferDef, (Collection<TransferCallback>) null);
    //just simulate, therefore restore the node.
    NodeRef archivedNode = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE,actionedUponNodeRef.getId());
    nodeService.restoreNode(archivedNode, null,null, null);
}
 
開發者ID:Alfresco,項目名稱:alfresco-file-transfer-receiver,代碼行數:44,代碼來源:DeleteFileTransferActionExecuter.java

示例4: updateContent

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
@Override
public Node updateContent(String fileNodeId, BasicContentInfo contentInfo, InputStream stream, Parameters parameters)
{
    if (contentInfo.getMimeType().toLowerCase().startsWith("multipart"))
    {
        throw new UnsupportedMediaTypeException("Cannot update using "+contentInfo.getMimeType());
    }

    final NodeRef nodeRef = validateNode(fileNodeId);

    if (! nodeMatches(nodeRef, Collections.singleton(ContentModel.TYPE_CONTENT), null, false))
    {
        throw new InvalidArgumentException("NodeId of content is expected: " + nodeRef.getId());
    }

    Boolean versionMajor = null;
    String str = parameters.getParameter(PARAM_VERSION_MAJOR);
    if (str != null)
    {
        versionMajor = new Boolean(str);
    }
    String versionComment = parameters.getParameter(PARAM_VERSION_COMMENT);

    String fileName = parameters.getParameter(PARAM_NAME);
    if (fileName != null)
    {
        // optionally rename, before updating the content
        nodeService.setProperty(nodeRef, ContentModel.PROP_NAME, fileName);
    }
    else
    {
        fileName = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
    }
    
    return updateExistingFile(null, nodeRef, fileName, contentInfo, stream, parameters, versionMajor, versionComment);
}
 
開發者ID:Alfresco,項目名稱:alfresco-remote-api,代碼行數:37,代碼來源:NodesImpl.java

示例5: testContentRecovery

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
public void testContentRecovery() throws Exception
{
    reauthenticate(USER_NAME, USER_PASSWORD);
    
    // create content
    NodeRef nodeRef = nodeService.createNode(testImapFolderNodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "content_recover"), ContentModel.TYPE_CONTENT).getChildRef();
    FileInfo fileInfo = fileFolderService.getFileInfo(nodeRef);
    
    // Outlook sets flags that indicates that a content was seen and deleted
    imapService.setFlag(fileInfo, Flags.Flag.DELETED, true);
    imapService.setFlag(fileInfo, Flags.Flag.SEEN, true);
    
    // delete a content
    fileFolderService.delete(nodeRef);
    
    // get archive node reference
    String storePath = "archive://SpacesStore";
    StoreRef storeRef = new StoreRef(storePath);
    NodeRef archivedNodeRef = new NodeRef(storeRef, nodeRef.getId());
   
    // restore a node and check flags
    Boolean value = false;
    if (nodeService.exists(archivedNodeRef))
    {
        NodeRef restoredNode = nodeService.restoreNode(archivedNodeRef, testImapFolderNodeRef, null, null);

        Map<QName, Serializable> props = nodeService.getProperties(restoredNode);

        if (props.containsKey(ImapModel.PROP_FLAG_DELETED) && props.containsKey(ImapModel.PROP_FLAG_SEEN))
        {
            value = !(Boolean) props.get(ImapModel.PROP_FLAG_DELETED) && !(Boolean) props.get(ImapModel.PROP_FLAG_SEEN);
        }
    }
    
    assertTrue("Can't set DELETED flag to false", value);
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:37,代碼來源:ImapServiceImplTest.java

示例6: createActionCondition

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
/**
 * Creates an action condition from an action condition node reference
 * 
 * @param conditionNodeRef the condition node reference
 * @return the action condition
 */
private ActionCondition createActionCondition(NodeRef conditionNodeRef)
{
    if (logger.isDebugEnabled())
        logger.debug("\tCreateActionCondition: Retrieving Conditions from repository");

    Map<QName, Serializable> properties = this.nodeService.getProperties(conditionNodeRef);
    QName conditionType = this.nodeService.getType(conditionNodeRef);

    ActionCondition condition = null;
    if (ActionModel.TYPE_COMPOSITE_ACTION_CONDITION.equals(conditionType) == false)
    {
        condition = new ActionConditionImpl(conditionNodeRef.getId(), (String) properties
                    .get(ActionModel.PROP_DEFINITION_NAME));
    }
    else
    {
        if (logger.isDebugEnabled())
        {
            logger.debug("\tRetrieving Composite Condition from repository");
        }

        // Create a composite condition
        CompositeActionCondition compositeCondition = new CompositeActionConditionImpl(GUID.generate());
        populateCompositeActionCondition(conditionNodeRef, compositeCondition);

        condition = compositeCondition;
    }

    Boolean invert = (Boolean) this.nodeService.getProperty(conditionNodeRef, ActionModel.PROP_CONDITION_INVERT);
    condition.setInvertCondition(invert == null ? false : invert.booleanValue());

    populateParameters(conditionNodeRef, condition);
    return condition;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:41,代碼來源:ActionServiceImpl.java

示例7: getWait

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
private void getWait(NodeRef node, String thumbnailName)
    throws Exception
{
    String url = "/api/node/" + node.getStoreRef().getProtocol() + "/" + node.getStoreRef().getIdentifier() + "/" + node.getId() + "/content/thumbnails/" + thumbnailName;
   
    int retries = 50;
    int tries = 0;
    while (true)
    {
        if (tries >= retries)
        {
            fail("Thumbnail never gets created " + thumbnailName);
        }
        
        Response response = sendRequest(new GetRequest(url), 0);
        if (response.getStatus() == 200)
        {
            break;
        }
        else if (response.getStatus() == 500)
        {
            System.out.println("Error during getWait: " + response.getContentAsString());
            fail("A 500 status was found whilst waiting for the thumbnail to be processed");
        }
        else
        {
            Thread.sleep(100);
        }
        
        tries++;
    }        
}
 
開發者ID:Alfresco,項目名稱:alfresco-remote-api,代碼行數:33,代碼來源:ThumbnailServiceTest.java

示例8: getDocument

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
/**
 * @deprecated note: currently required for backwards compat' (Favourites API)
 */
@Override
public Document getDocument(NodeRef nodeRef)
{
    Type type = getType(nodeRef);
    if ((type != null) && type.equals(Type.DOCUMENT))
    {
        Map<QName, Serializable> properties = nodeService.getProperties(nodeRef);

        Document doc = new Document(nodeRef, getParentNodeRef(nodeRef), properties, null, sr);

        doc.setVersionLabel((String) properties.get(ContentModel.PROP_VERSION_LABEL));
        ContentData cd = (ContentData) properties.get(ContentModel.PROP_CONTENT);
        if (cd != null)
        {
            doc.setSizeInBytes(BigInteger.valueOf(cd.getSize()));
            doc.setMimeType((cd.getMimetype()));
        }

        setCommonProps(doc, nodeRef, properties);
        return doc;
    }
    else
    {
        throw new InvalidArgumentException("Node is not a file: "+nodeRef.getId());
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-remote-api,代碼行數:30,代碼來源:NodesImpl.java

示例9: 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

示例10: 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

示例11: getName

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
@Override
public NodeRef getName(NodeRef nodeRef)
{
    if (nodeRef == null)
    {
        return null;
    }

    return new NodeRef(nodeRef.getStoreRef().getProtocol(), getName(nodeRef.getStoreRef().getIdentifier()), nodeRef.getId());
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:11,代碼來源:MultiTServiceImpl.java

示例12: 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

示例13: getVersion

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
/**
 * Constructs the a version object to contain the version information from the version node ref.
 *
 * @param versionRef  the version reference
 * @return            object containing verison data
 */
@Override
protected Version getVersion(NodeRef versionRef)
{
    if (versionRef == null)
    {
        return null;
    }
    Map<String, Serializable> versionProperties = new HashMap<String, Serializable>();
    
    // Get the standard node details and get the meta data
    Map<QName, Serializable> nodeProperties = this.dbNodeService.getProperties(versionRef);
    
    if (logger.isTraceEnabled())
    {
        logger.trace("getVersion: " + versionRef + " nodeProperties=\n" + nodeProperties.keySet());
    }
    
    // TODO consolidate with VersionUtil.convertFrozenToOriginalProps
    
    for (QName key : nodeProperties.keySet())
    {
        Serializable value = nodeProperties.get(key);
        
        String keyName = key.getLocalName();
        int idx = keyName.indexOf(Version2Model.PROP_METADATA_PREFIX);
        if (idx == 0)
        {
            // versioned metadata property - additional (optional) metadata, set during versioning
            versionProperties.put(keyName.substring(Version2Model.PROP_METADATA_PREFIX.length()), value);
        }
        else
        {
           if (key.equals(Version2Model.PROP_QNAME_VERSION_DESCRIPTION))
           {
               versionProperties.put(Version.PROP_DESCRIPTION, (String)value);
           }
           else if (key.equals(Version2Model.PROP_QNAME_VERSION_LABEL))
           {
               versionProperties.put(VersionBaseModel.PROP_VERSION_LABEL, (String)value);
           }
           else
           {
               if (keyName.equals(Version.PROP_DESCRIPTION) || 
                   keyName.equals(VersionBaseModel.PROP_VERSION_LABEL))
               {
                   // ignore reserved localname (including cm:description, cm:versionLabel)
               }
               else
               {
                   // all other properties
                   versionProperties.put(keyName, value);
               }
           }
        }
    }
    
    // Create and return the version object
    NodeRef newNodeRef = new NodeRef(new StoreRef(Version2Model.STORE_PROTOCOL, Version2Model.STORE_ID), versionRef.getId());
    Version result = new VersionImpl(versionProperties, newNodeRef);
    
    if (logger.isTraceEnabled())
    {
        logger.trace("getVersion: " + versionRef + " versionProperties=\n" + versionProperties.keySet());
    }
    
    // done
    return result;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:75,代碼來源:Version2ServiceImpl.java

示例14: addTag

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
public Tag addTag(NodeRef nodeRef, String tag)
  {
NodeRef tagNodeRef = taggingService.addTag(nodeRef, tag);
return new Tag(nodeRef.getId(), tagNodeRef.getId(), tag);
  }
 
開發者ID:Alfresco,項目名稱:alfresco-remote-api,代碼行數:6,代碼來源:RepoService.java

示例15: executePendingRuleImpl

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
private void executePendingRuleImpl(PendingRuleData pendingRule) 
{
    Set<ExecutedRuleData> executedRules =
           (Set<ExecutedRuleData>) AlfrescoTransactionSupport.getResource(KEY_RULES_EXECUTED);

    NodeRef actionedUponNodeRef = pendingRule.getActionedUponNodeRef();
    Rule rule = pendingRule.getRule();
    
    boolean isSystemUser = false;
    if (!(AuthenticationUtil.isRunAsUserTheSystemUser()) && (rule.getAction()!=null) && (rule.getAction() instanceof ActionImpl))
    {
        isSystemUser = AuthenticationUtil.SYSTEM_USER_NAME.equals(((ActionImpl) rule.getAction()).getRunAsUser());
    }
		
    NodeRef ruleNodeRef = rule.getNodeRef();
    if (!ruleNodeRef.getStoreRef().equals(actionedUponNodeRef.getStoreRef()) && !nodeService.exists(ruleNodeRef))
    {
        NodeRef newRuleNodeRef = new NodeRef(actionedUponNodeRef.getStoreRef(), ruleNodeRef.getId());
        if (nodeService.exists(newRuleNodeRef))
        {
            ruleNodeRef = newRuleNodeRef;
        }
        
    }
    final NodeRef finalRuleNodeRef = ruleNodeRef;
    // update all associations and actions
    rule = AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Rule>()
    {
        public Rule doWork() throws Exception
        {
            return getRule(finalRuleNodeRef);
        }
    }, AuthenticationUtil.getSystemUserName());

    if (executedRules == null || canExecuteRule(executedRules, actionedUponNodeRef, rule) == true)
    {
        if (isSystemUser)
        {
            final Rule fRule = rule;
            final NodeRef fActionedUponNodeRef = actionedUponNodeRef;
            final Set<ExecutedRuleData> fExecutedRules = executedRules;
            AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Void>()
            {
                public Void doWork() throws Exception
                {
                    executeRule(fRule, fActionedUponNodeRef, fExecutedRules);
                    return null;
                }
            }, AuthenticationUtil.getSystemUserName());
        }
        else
        {
            executeRule(rule, actionedUponNodeRef, executedRules);
        }
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:58,代碼來源:RuleServiceImpl.java


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