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


Java JcrUtils.getNodes方法代码示例

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


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

示例1: getArtifactsByChecksum

import org.apache.jackrabbit.commons.JcrUtils; //导入方法依赖的package包/类
@Override
public List<ArtifactMetadata> getArtifactsByChecksum( String repositoryId, String checksum )
    throws MetadataRepositoryException
{
    List<ArtifactMetadata> artifacts;

    String q = getArtifactQuery( repositoryId ) + " AND ([sha1] = $checksum OR [md5] = $checksum)";

    try
    {
        Query query = getJcrSession().getWorkspace().getQueryManager().createQuery( q, Query.JCR_SQL2 );
        ValueFactory valueFactory = getJcrSession().getValueFactory();
        query.bindValue( "checksum", valueFactory.createValue( checksum ) );
        QueryResult result = query.execute();

        artifacts = new ArrayList<>();
        for ( Node n : JcrUtils.getNodes( result ) )
        {
            artifacts.add( getArtifactFromNode( repositoryId, n ) );
        }
    }
    catch ( RepositoryException e )
    {
        throw new MetadataRepositoryException( e.getMessage(), e );
    }
    return artifacts;
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:28,代码来源:JcrMetadataRepository.java

示例2: getArtifacts

import org.apache.jackrabbit.commons.JcrUtils; //导入方法依赖的package包/类
@Override
public List<ArtifactMetadata> getArtifacts( String repositoryId )
    throws MetadataRepositoryException
{
    List<ArtifactMetadata> artifacts;

    String q = getArtifactQuery( repositoryId );

    try
    {
        Query query = getJcrSession().getWorkspace().getQueryManager().createQuery( q, Query.JCR_SQL2 );
        QueryResult result = query.execute();

        artifacts = new ArrayList<>();
        for ( Node n : JcrUtils.getNodes( result ) )
        {
            if ( n.isNodeType( ARTIFACT_NODE_TYPE ) )
            {
                artifacts.add( getArtifactFromNode( repositoryId, n ) );
            }
        }
    }
    catch ( RepositoryException e )
    {
        throw new MetadataRepositoryException( e.getMessage(), e );
    }
    return artifacts;
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:29,代码来源:JcrMetadataRepository.java

示例3: getArtifactsByDateRange

import org.apache.jackrabbit.commons.JcrUtils; //导入方法依赖的package包/类
@Override
public List<ArtifactMetadata> getArtifactsByDateRange( String repoId, Date startTime, Date endTime )
    throws MetadataRepositoryException
{
    List<ArtifactMetadata> artifacts;

    String q = getArtifactQuery( repoId );

    if ( startTime != null )
    {
        q += " AND [whenGathered] >= $start";
    }
    if ( endTime != null )
    {
        q += " AND [whenGathered] <= $end";
    }

    try
    {
        Query query = getJcrSession().getWorkspace().getQueryManager().createQuery( q, Query.JCR_SQL2 );
        ValueFactory valueFactory = getJcrSession().getValueFactory();
        if ( startTime != null )
        {
            query.bindValue( "start", valueFactory.createValue( createCalendar( startTime ) ) );
        }
        if ( endTime != null )
        {
            query.bindValue( "end", valueFactory.createValue( createCalendar( endTime ) ) );
        }
        QueryResult result = query.execute();

        artifacts = new ArrayList<>();
        for ( Node n : JcrUtils.getNodes( result ) )
        {
            artifacts.add( getArtifactFromNode( repoId, n ) );
        }
    }
    catch ( RepositoryException e )
    {
        throw new MetadataRepositoryException( e.getMessage(), e );
    }
    return artifacts;
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:44,代码来源:JcrMetadataRepository.java

示例4: getProjectReferences

import org.apache.jackrabbit.commons.JcrUtils; //导入方法依赖的package包/类
@Override
public Collection<ProjectVersionReference> getProjectReferences( String repositoryId, String namespace,
                                                                 String projectId, String projectVersion )
    throws MetadataResolutionException
{

    List<ProjectVersionReference> references = new ArrayList<>();

    // TODO: bind variables instead
    String q = "SELECT * FROM [archiva:dependency] WHERE ISDESCENDANTNODE([/repositories/" + repositoryId +
        "/content]) AND [groupId]='" + namespace + "' AND [artifactId]='" + projectId + "'";
    if ( projectVersion != null )
    {
        q += " AND [version]='" + projectVersion + "'";
    }
    try
    {
        Query query = getJcrSession().getWorkspace().getQueryManager().createQuery( q, Query.JCR_SQL2 );
        QueryResult result = query.execute();

        for ( Node n : JcrUtils.getNodes( result ) )
        {
            n = n.getParent(); // dependencies grouping element

            n = n.getParent(); // project version
            String usedByProjectVersion = n.getName();

            n = n.getParent(); // project
            String usedByProject = n.getName();

            n = n.getParent(); // namespace
            String usedByNamespace = n.getProperty( "namespace" ).getString();

            ProjectVersionReference ref = new ProjectVersionReference();
            ref.setNamespace( usedByNamespace );
            ref.setProjectId( usedByProject );
            ref.setProjectVersion( usedByProjectVersion );
            ref.setReferenceType( ProjectVersionReference.ReferenceType.DEPENDENCY );
            references.add( ref );
        }
    }
    catch ( RepositoryException e )
    {
        throw new MetadataResolutionException( e.getMessage(), e );
    }

    return references;
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:49,代码来源:JcrMetadataRepository.java

示例5: getProjectReferences

import org.apache.jackrabbit.commons.JcrUtils; //导入方法依赖的package包/类
@Override
public Collection<ProjectVersionReference> getProjectReferences( String repositoryId, String namespace,
                                                                 String projectId, String projectVersion )
    throws MetadataResolutionException
{

    List<ProjectVersionReference> references = new ArrayList<>();

    // TODO: bind variables instead
    String q = "SELECT * FROM [archiva:dependency] WHERE ISDESCENDANTNODE([/repositories/" + repositoryId
        + "/content]) AND [groupId]='" + namespace + "' AND [artifactId]='" + projectId + "'";
    if ( projectVersion != null )
    {
        q += " AND [version]='" + projectVersion + "'";
    }
    try
    {
        Query query = getJcrSession().getWorkspace().getQueryManager().createQuery( q, Query.JCR_SQL2 );
        QueryResult result = query.execute();

        for ( Node n : JcrUtils.getNodes( result ) )
        {
            n = n.getParent(); // dependencies grouping element

            n = n.getParent(); // project version
            String usedByProjectVersion = n.getName();

            n = n.getParent(); // project
            String usedByProject = n.getName();

            n = n.getParent(); // namespace
            String usedByNamespace = n.getProperty( "namespace" ).getString();

            ProjectVersionReference ref = new ProjectVersionReference();
            ref.setNamespace( usedByNamespace );
            ref.setProjectId( usedByProject );
            ref.setProjectVersion( usedByProjectVersion );
            ref.setReferenceType( ProjectVersionReference.ReferenceType.DEPENDENCY );
            references.add( ref );
        }
    }
    catch ( RepositoryException e )
    {
        throw new MetadataResolutionException( e.getMessage(), e );
    }

    return references;
}
 
开发者ID:apache,项目名称:archiva,代码行数:49,代码来源:JcrMetadataRepository.java


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