本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}