当前位置: 首页>>代码示例>>Java>>正文


Java Path.append方法代码示例

本文整理汇总了Java中org.alfresco.service.cmr.repository.Path.append方法的典型用法代码示例。如果您正苦于以下问题:Java Path.append方法的具体用法?Java Path.append怎么用?Java Path.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.alfresco.service.cmr.repository.Path的用法示例。


在下文中一共展示了Path.append方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: stringToPath

import org.alfresco.service.cmr.repository.Path; //导入方法依赖的package包/类
/**
 * Converts a String representation of a path to a Path
 * 
 * e.g "/{http://www.alfresco.org/model/application/1.0}company_home/{http://www.alfresco.org/model/application/1.0}dictionary/{http://www.alfresco.org/model/application/1.0}transfers/{http://www.alfresco.org/model/content/1.0}default/{http://www.alfresco.org/model/transfer/1.0}snapshotMe";
 * @param value the string representation of the path.
 * @return Path 
 */
public static Path stringToPath(String value)
{
    Path path = new Path();
    
    // pattern for QName e.g. /{stuff}stuff
    
    Pattern pattern = Pattern.compile("/\\{[a-zA-Z:./0-9]*\\}[^/]*");
    Matcher matcher = pattern.matcher(value);
    
    // This is the root node
    path.append(new SimplePathElement("/"));
           
    while ( matcher.find() )
    {
        String group = matcher.group();
        final String val = ISO9075.decode(group.substring(1));
        path.append(new SimplePathElement(val));
    }
    
    return path;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:29,代码来源:PathHelper.java

示例2: deleteNode

import org.alfresco.service.cmr.repository.Path; //导入方法依赖的package包/类
public void deleteNode(ChildAssociationRef relationshipRef) throws LuceneIndexException
{
    if (s_logger.isDebugEnabled())
    {
        NodeRef parentRef = relationshipRef.getParentRef();
        Path path = parentRef == null ? new Path() : nodeService.getPath(parentRef);
        path.append(new ChildAssocElement(relationshipRef));
        s_logger.debug("Delete node " + path + " " + relationshipRef.getChildRef());
    }
    checkAbleToDoWork(IndexUpdateStatus.SYNCRONOUS);
    try
    {
        if (!relationshipRef.getChildRef().getStoreRef().equals(store))
        {
            throw new LuceneIndexException("Delete node failed - node is not in the required store");
        }
        delete(relationshipRef.getChildRef());
    }
    catch (LuceneIndexException e)
    {
        setRollbackOnly();
        throw new LuceneIndexException("Delete node failed", e);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:ADMLuceneIndexerImpl.java

示例3: moveNode

import org.alfresco.service.cmr.repository.Path; //导入方法依赖的package包/类
/**
 * move transfer node to new parent.
 * @param childNode
 * @param newParent
 */
private void moveNode(TransferManifestNormalNode childNode, TransferManifestNormalNode newParent)
{
    List<ChildAssociationRef> currentParents = childNode.getParentAssocs();
    List<ChildAssociationRef> newParents = new ArrayList<ChildAssociationRef>();

    for (ChildAssociationRef parent : currentParents)
    {
        if (!parent.isPrimary())
        {
            newParents.add(parent);
        }
        else
        {
            ChildAssociationRef newPrimaryAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, newParent
                    .getNodeRef(), parent.getQName(), parent.getChildRef(), true, -1);
            newParents.add(newPrimaryAssoc);
            childNode.setPrimaryParentAssoc(newPrimaryAssoc);
            Path newParentPath = new Path();
            newParentPath.append(newParent.getParentPath());
            newParentPath.append(new Path.ChildAssocElement(newParent.getPrimaryParentAssoc()));
            childNode.setParentPath(newParentPath);
        }
    }
    childNode.setParentAssocs(newParents);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:31,代码来源:RepoTransferReceiverImplTest.java

示例4: getPath

import org.alfresco.service.cmr.repository.Path; //导入方法依赖的package包/类
/**
 * @throws UnsupportedOperationException always
 */
public Path getPath(NodeRef nodeRef) throws InvalidNodeRefException
{
    ChildAssociationRef childAssocRef = getPrimaryParent(nodeRef);
    Path path = new Path();
    path.append(new Path.ChildAssocElement(childAssocRef));
    return path;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:11,代码来源:NodeServiceImpl.java

示例5: createNode

import org.alfresco.service.cmr.repository.Path; //导入方法依赖的package包/类
public void createNode(ChildAssociationRef relationshipRef) throws LuceneIndexException
{
    if (s_logger.isDebugEnabled())
    {
        NodeRef parentRef = relationshipRef.getParentRef();
        Path path = parentRef == null ? new Path() : nodeService.getPath(parentRef);
        path.append(new ChildAssocElement(relationshipRef));
        s_logger.debug("Create node " + path + " " + relationshipRef.getChildRef());
    }
    checkAbleToDoWork(IndexUpdateStatus.SYNCRONOUS);
    try
    {
        NodeRef childRef = relationshipRef.getChildRef();
        if (!childRef.getStoreRef().equals(store))
        {
            throw new LuceneIndexException("Create node failed - node is not in the required store");
        }
        // If we have the root node we delete all other root nodes first
        if ((relationshipRef.getParentRef() == null) && tenantService.getBaseName(childRef).equals(nodeService.getRootNode(childRef.getStoreRef())))
        {
            addRootNodesToDeletionList();
            s_logger.warn("Detected root node addition: deleting all nodes from the index");
        }
        index(childRef);
    }
    catch (LuceneIndexException e)
    {
        setRollbackOnly();
        throw new LuceneIndexException("Create node failed", e);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:32,代码来源:ADMLuceneIndexerImpl.java

示例6: execute

import org.alfresco.service.cmr.repository.Path; //导入方法依赖的package包/类
@Override
public Path execute(NodeProtocol protocol, Reference reference) throws ProtocolMethodException
{
    Reference parent = protocol.getVirtualParentReference(reference);
    NodeRef nodeRef = protocol.getNodeRef(reference);
    Path nodeRefPath = environment.getPath(nodeRef);
    Path parentPath = parent.execute(this);
    parentPath.append(nodeRefPath.last());
    return parentPath;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:11,代码来源:GetPathMethod.java

示例7: getMappedPath

import org.alfresco.service.cmr.repository.Path; //导入方法依赖的package包/类
/**
 * Get mapped path
 */
public Path getMappedPath(Path from)
{
    Path to = new Path();

    /**
     * 
     */
    Path source = new Path();
    for (int i = 0; i < from.size(); i++)
    {
        // Source steps through each element of from.
        source.append(from.get(i));
        boolean replacePath = false;
        for (Pair<Path, Path> xx : getPathMap())
        {
            // Can't use direct equals because of mismatched node refs (which we don't care about)
            if (xx.getFirst().toString().equals(source.toString()))
            {
                to = xx.getSecond().subPath(xx.getSecond().size() - 1);
                replacePath = true;
                break;
            }
        }
        if (!replacePath)
        {
            to.append(from.get(i));
        }
    }

    return to;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:35,代码来源:UnitTestTransferManifestNodeFactory.java

示例8: newPath

import org.alfresco.service.cmr.repository.Path; //导入方法依赖的package包/类
@SuppressWarnings("serial")
private Path newPath(Path parent, final String name)
{
    Path path = new Path();
    if (parent != null)
    {
        for(Path.Element element: parent)
        {
            path.append(element);
        }
    }
    path.append(new Path.Element()
    {
        @Override
        public String getElementString()
        {
            return name;
        }

        @Override
        public Element getBaseNameElement(TenantService tenantService)
        {
           return this;
        }
    });
    return path;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:28,代码来源:NodeChangeTest.java

示例9: onSetUp

import org.alfresco.service.cmr.repository.Path; //导入方法依赖的package包/类
/**
 * @throws java.lang.Exception
 */
@Before
@Override
public void onSetUp() throws Exception
{
    super.onSetUp();
    serializer = (StandardNodeSnapshotSerializer) getApplicationContext().getBean("publishingPackageSerializer");
    normalNode1 = new TransferManifestNormalNode();
    normalNode1.setAccessControl(null);

    Set<QName> aspects = new HashSet<QName>();
    aspects.add(ContentModel.ASPECT_AUDITABLE);
    aspects.add(ContentModel.ASPECT_TITLED);
    normalNode1.setAspects(aspects);

    List<ChildAssociationRef> childAssocs = new ArrayList<ChildAssociationRef>();
    normalNode1.setChildAssocs(childAssocs);

    String guid = GUID.generate();
    NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, guid);
    normalNode1.setNodeRef(nodeRef);

    ChildAssociationRef primaryParentAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, new NodeRef(
            StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "MY_PARENT_NODEREF"), QName.createQName(
                    NamespaceService.CONTENT_MODEL_1_0_URI, "localname"), nodeRef, true, -1);
    List<ChildAssociationRef> parentAssocs = new ArrayList<ChildAssociationRef>();
    parentAssocs.add(primaryParentAssoc);
    normalNode1.setParentAssocs(parentAssocs);
    
    Path path = new Path();
    path.append(new Path.ChildAssocElement(primaryParentAssoc));
    normalNode1.setParentPath(path);
    
    normalNode1.setPrimaryParentAssoc(primaryParentAssoc);
    
    Map<QName,Serializable> props = new HashMap<QName, Serializable>();
    props.put(ContentModel.PROP_NAME, guid);
    normalNode1.setProperties(props);
    
    List<AssociationRef> sourceAssocs = new ArrayList<AssociationRef>();
    sourceAssocs.add(new AssociationRef(nodeRef, ContentModel.ASSOC_ATTACHMENTS, nodeRef));
    sourceAssocs.add(new AssociationRef(nodeRef, ContentModel.ASSOC_REFERENCES, nodeRef));
    normalNode1.setSourceAssocs(sourceAssocs);

    List<AssociationRef> targetAssocs = new ArrayList<AssociationRef>();
    targetAssocs.add(new AssociationRef(nodeRef, ContentModel.ASSOC_ATTACHMENTS, nodeRef));
    targetAssocs.add(new AssociationRef(nodeRef, ContentModel.ASSOC_REFERENCES, nodeRef));
    normalNode1.setTargetAssocs(targetAssocs);
    
    normalNode1.setType(ContentModel.TYPE_CONTENT);
    normalNode1.setAncestorType(ContentModel.TYPE_CONTENT);
    normalNode1.setUuid(guid);
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:56,代码来源:PublishingPackageSerializerTest.java


注:本文中的org.alfresco.service.cmr.repository.Path.append方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。