use of org.gluu.model.metric.ldap.MetricEntry in project oxCore by GluuFederation.
the class LdapEntryReporter method addMandatoryAttributes.
private void addMandatoryAttributes(MetricService metricService, Date startTime, Date endTime, List<MetricEntry> metricEntries, Date creationTime) {
String nodeIndetifier = metricService.getNodeIndetifier();
ApplicationType applicationType = metricService.getApplicationType();
for (MetricEntry metricEntry : metricEntries) {
String id = metricService.getUiqueIdentifier();
String dn = metricService.buildDn(id, creationTime, applicationType);
metricEntry.setId(id);
metricEntry.setDn(dn);
metricEntry.setApplicationType(applicationType);
metricEntry.setNodeIndetifier(nodeIndetifier);
metricEntry.setStartDate(startTime);
metricEntry.setEndDate(endTime);
metricEntry.setCreationDate(creationTime);
metricEntry.setExpirationDate(DateUtils.addDays(creationTime, metricService.getEntryLifetimeInDays()));
int ttl = (int) ((metricEntry.getExpirationDate().getTime() - creationTime.getTime()) / 1000L);
metricEntry.setTtl(ttl);
}
}
use of org.gluu.model.metric.ldap.MetricEntry in project oxCore by GluuFederation.
the class MetricService method getExpiredMetricEntries.
public List<MetricEntry> getExpiredMetricEntries(DefaultBatchOperation<MetricEntry> batchOperation, ApplicationType applicationType, String baseDnForPeriod, Date expirationDate, int count, int chunkSize) {
Filter expiratioStartDateFilter = Filter.createLessOrEqualFilter("oxStartDate", getEntryManager().encodeTime(baseDnForPeriod, expirationDate));
Filter expiratioFilter = expiratioStartDateFilter;
if (applicationType != null) {
Filter applicationTypeFilter = Filter.createEqualityFilter("oxMetricType", applicationType.getValue());
expiratioFilter = Filter.createANDFilter(expiratioStartDateFilter, applicationTypeFilter);
}
List<MetricEntry> metricEntries = getEntryManager().findEntries(baseDnForPeriod, MetricEntry.class, expiratioFilter, SearchScope.SUB, new String[] { "uniqueIdentifier" }, batchOperation, 0, count, chunkSize);
return metricEntries;
}
Aggregations