The following example API usage demonstrates how to retrieve a list of partitions in an audit trail.
A partition is a logical separation in the audit trail database used to support multi-tenancy. In this context the term does not refer to a database partition.
This example uses internal API (ForkingServiceFactory and IJobManager)
to get the list of partitions in an audit trail.
public List<String> listPartitions()
{
ForkingServiceFactory factory = (ForkingServiceFactory) Parameters.instance().get(
EngineProperties.FORKING_SERVICE_HOME);
IJobManager jobManager = factory.getJobManager();
if (null!= jobManager)
{
final List<String> result = newArrayList();
jobManager.performSynchronousJob(new Procedure<Void>()
{
@Override
protected void invoke()
{
for (Iterator<IAuditTrailPartition> i = AuditTrailPartitionBean.findAll(); i.hasNext(); )
{
IAuditTrailPartition partition = i.next();
result.add(partition.getId());
}
Collections.sort(result);
}
});
return result;
}
else
{
trace.warn("Not able to list partitions, the component is not fully configured.");
return emptyList();
}
}