use of org.gluu.persist.model.base.SimpleBranch in project oxCore by GluuFederation.
the class MetricService method removeExpiredMetricEntries.
public void removeExpiredMetricEntries(final Date expirationDate, final ApplicationType applicationType, int count, int chunkSize) {
createApplicationBaseBranch(applicationType);
final Set<String> keepBaseDnForPeriod = getBaseDnForPeriod(applicationType, expirationDate, new Date());
// Remove expired entries
for (final String baseDnForPeriod : keepBaseDnForPeriod) {
DefaultBatchOperation<MetricEntry> metricEntryBatchOperation = new DefaultBatchOperation<MetricEntry>() {
@Override
public boolean collectSearchResult(int size) {
return false;
}
@Override
public void performAction(List<MetricEntry> entries) {
for (MetricEntry metricEntry : entries) {
remove(metricEntry);
}
}
};
getExpiredMetricEntries(metricEntryBatchOperation, applicationType, baseDnForPeriod, expirationDate, count, chunkSize);
}
if (!getEntryManager().hasBranchesSupport(buildDn(null, null, applicationType))) {
DefaultBatchOperation<SimpleBranch> batchOperation = new DefaultBatchOperation<SimpleBranch>() {
@Override
public boolean collectSearchResult(int size) {
return false;
}
@Override
public void performAction(List<SimpleBranch> objects) {
String baseDn = buildDn(null, null, applicationType);
Set<String> periodBranchesStrings = new HashSet<String>();
for (SimpleBranch periodBranch : objects) {
if (!StringHelper.equalsIgnoreCase(baseDn, periodBranch.getDn())) {
periodBranchesStrings.add(periodBranch.getDn());
}
}
periodBranchesStrings.removeAll(keepBaseDnForPeriod);
// Remove expired months
for (String baseDnForPeriod : periodBranchesStrings) {
removeBranch(baseDnForPeriod);
}
}
};
findAllPeriodBranches(batchOperation, applicationType, count, chunkSize);
}
}
use of org.gluu.persist.model.base.SimpleBranch in project oxTrust by GluuFederation.
the class PushApplicationService method addBranch.
public void addBranch() {
SimpleBranch branch = new SimpleBranch();
branch.setOrganizationalUnitName("application");
branch.setDn(getDnForPushApplication(null));
ldapEntryManager.persist(branch);
}
use of org.gluu.persist.model.base.SimpleBranch in project oxTrust by GluuFederation.
the class PushDeviceService method addBranch.
public void addBranch() {
SimpleBranch branch = new SimpleBranch();
branch.setOrganizationalUnitName("device");
branch.setDn(getDnForPushDevice(null));
ldapEntryManager.persist(branch);
}
use of org.gluu.persist.model.base.SimpleBranch in project oxCore by GluuFederation.
the class MetricService method removeExpiredMetricEntries.
public void removeExpiredMetricEntries(final Date expirationDate, final ApplicationType applicationType, final String applianceInum, int sizeLimit, int chunkSize) {
final Set<String> keepBaseDnForPeriod = getBaseDnForPeriod(applicationType, applianceInum, expirationDate, new Date());
// Remove expired entries
for (final String baseDnForPeriod : keepBaseDnForPeriod) {
DefaultBatchOperation<MetricEntry> metricEntryBatchOperation = new DefaultBatchOperation<MetricEntry>() {
@Override
public boolean collectSearchResult(int size) {
return false;
}
@Override
public void performAction(List<MetricEntry> entries) {
for (MetricEntry metricEntry : entries) {
remove(metricEntry);
}
}
};
getExpiredMetricEntries(metricEntryBatchOperation, baseDnForPeriod, expirationDate, sizeLimit, chunkSize);
}
DefaultBatchOperation<SimpleBranch> batchOperation = new DefaultBatchOperation<SimpleBranch>() {
@Override
public boolean collectSearchResult(int size) {
return false;
}
@Override
public void performAction(List<SimpleBranch> objects) {
String baseDn = buildDn(null, null, applicationType, applianceInum);
Set<String> periodBranchesStrings = new HashSet<String>();
for (SimpleBranch periodBranch : objects) {
if (!StringHelper.equalsIgnoreCase(baseDn, periodBranch.getDn())) {
periodBranchesStrings.add(periodBranch.getDn());
}
}
periodBranchesStrings.removeAll(keepBaseDnForPeriod);
// Remove expired months
for (String baseDnForPeriod : periodBranchesStrings) {
removeBranch(baseDnForPeriod);
}
}
};
findAllPeriodBranches(batchOperation, applicationType, applianceInum, sizeLimit, chunkSize);
}
use of org.gluu.persist.model.base.SimpleBranch in project oxAuth by GluuFederation.
the class ClientAuthorizationsService method addBranch.
public void addBranch() {
SimpleBranch branch = new SimpleBranch();
branch.setOrganizationalUnitName("authorizations");
branch.setDn(createDn(null));
ldapEntryManager.persist(branch);
}
Aggregations