To search for Runtime Artifacts applying to specific criteria, you can use the DeployedRuntimeArtifactQuery on the QueryService.
With the Stardust DeployedRuntimeArtifactQuery you can create queries to search for DeployedRuntimeArtifacts matching specified attributes.
To restrict the query to currently active artifacts use the findActive
factory methods described below.
Use method findAll to create a query for finding all runtime artifacts.
public static DeployedRuntimeArtifactQuery findAll()
{
DeployedRuntimeArtifactQuery query = new DeployedRuntimeArtifactQuery();
return query;
}
Method findAllActive(Date activeAt) creates a query for finding all
currently active runtime artifacts ordered descending by a given date.
public static DeployedRuntimeArtifactQuery findAllActive(Date activeAt)
{
DeployedRuntimeArtifactQuery query = new DeployedRuntimeArtifactQuery(true);
query.where(VALID_FROM.lessOrEqual(activeAt.getTime()));
return query;
}
Use method findActive(String artifactType, Date activeAt) to create a
query for finding active runtime artifacts of a specified type ordered descending by a
given date.
public static DeployedRuntimeArtifactQuery findActive(String artifactType, Date activeAt)
{
DeployedRuntimeArtifactQuery query = findAllActive(activeAt);
query.where(ARTIFACT_TYPE_ID.isEqual(artifactType));
return query;
}
Method findActive(String artifactId, String artifactType, Date activeAt)
creates a query for finding the active runtime artifact specified by artifact id and of
the specified type.
public static DeployedRuntimeArtifactQuery findActive(String artifactId, String artifactType, Date activeAt)
{
DeployedRuntimeArtifactQuery query = findActive(artifactType, activeAt);
query.where(ARTIFACT_ID.isEqual(artifactId));
return query;
}
The queries created with the DeployedRuntimeArtifactQuery can be used on the QueryService to find all deployed runtime artifacts matching a specified criteria.
QueryService method getRuntimeArtifacts retrieves all
DeployedRuntimeArtifacts satisfying the criteria specified in the provided query.
@ExecutionPermission(id=ExecutionPermission.Id.readRuntimeArtifact) public DeployedRuntimeArtifacts getRuntimeArtifacts(DeployedRuntimeArtifactQuery query);
It returns the deployed runtime artifacts matching the specified criteria.
QueryService qs = serviceFactory.getQueryService();
DeployedRuntimeArtifacts runtimeArtifacts =
qs.getRuntimeArtifacts(DeployedRuntimeArtifactQuery.findAll());
DeployedRuntimeArtifacts runtimeArtifacts =
qs.getRuntimeArtifacts(DeployedRuntimeArtifactQuery.findAllActive(new Date()));
DeployedRuntimeArtifacts runtimeArtifacts =
qs.getRuntimeArtifacts(DeployedRuntimeArtifactQuery.findActive(BENCHMARK_ARTIFACT_TYPE_ID, new Date()));
DeployedRuntimeArtifacts runtimeArtifacts =
qs.getRuntimeArtifacts(DeployedRuntimeArtifactQuery.findActive(BENCHMARK_REF, BenchmarkDefinitionArtifactType.TYPE_ID, new Date()));