Search in sources :

Example 6 with SimpleBranch

use of org.xdi.ldap.model.SimpleBranch in project oxTrust by GluuFederation.

the class ResourceSetService method addBranch.

public void addBranch() {
    SimpleBranch branch = new SimpleBranch();
    branch.setOrganizationalUnitName("resource_sets");
    branch.setDn(getDnForResourceSet(null));
    ldapEntryManager.persist(branch);
}
Also used : SimpleBranch(org.xdi.ldap.model.SimpleBranch)

Example 7 with SimpleBranch

use of org.xdi.ldap.model.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);
}
Also used : SimpleBranch(org.xdi.ldap.model.SimpleBranch)

Example 8 with SimpleBranch

use of org.xdi.ldap.model.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);
}
Also used : SimpleBranch(org.xdi.ldap.model.SimpleBranch)

Example 9 with SimpleBranch

use of org.xdi.ldap.model.SimpleBranch in project oxCore by GluuFederation.

the class MetricService method removeExpiredMetricEntries.

public void removeExpiredMetricEntries(int batchSize, final Date expirationDate, final ApplicationType applicationType, final String applianceInum) {
    final Set<String> keepBaseDnForPeriod = getBaseDnForPeriod(applicationType, applianceInum, expirationDate, new Date());
    // Remove expired entries
    for (final String baseDnForPeriod : keepBaseDnForPeriod) {
        BatchOperation<MetricEntry> metricEntryBatchOperation = new BatchOperation<MetricEntry>(ldapEntryManager) {

            @Override
            protected List<MetricEntry> getChunkOrNull(int batchSize) {
                return getExpiredMetricEntries(this, batchSize, baseDnForPeriod, expirationDate);
            }

            @Override
            protected void performAction(List<MetricEntry> objects) {
                for (MetricEntry metricEntry : objects) {
                    remove(metricEntry);
                }
            }
        };
        metricEntryBatchOperation.iterateAllByChunks(batchSize);
    }
    BatchOperation<SimpleBranch> batchOperation = new BatchOperation<SimpleBranch>(ldapEntryManager) {

        @Override
        protected List<SimpleBranch> getChunkOrNull(int batchSize) {
            return findAllPeriodBranches(this, batchSize, applicationType, applianceInum);
        }

        @Override
        protected 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);
            }
        }
    };
    batchOperation.iterateAllByChunks(batchSize);
}
Also used : SimpleBranch(org.xdi.ldap.model.SimpleBranch) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List) BatchOperation(org.gluu.site.ldap.persistence.BatchOperation) MetricEntry(org.xdi.model.metric.ldap.MetricEntry) Date(java.util.Date) HashSet(java.util.HashSet)

Example 10 with SimpleBranch

use of org.xdi.ldap.model.SimpleBranch in project oxAuth by GluuFederation.

the class PairwiseIdentifierService method addBranch.

public void addBranch(final String userInum) {
    SimpleBranch branch = new SimpleBranch();
    branch.setOrganizationalUnitName("pairwiseIdentifiers");
    branch.setDn(getBaseDnForPairwiseIdentifiers(userInum));
    ldapEntryManager.persist(branch);
}
Also used : SimpleBranch(org.xdi.ldap.model.SimpleBranch)

Aggregations

SimpleBranch (org.xdi.ldap.model.SimpleBranch)12 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 BatchOperation (org.gluu.site.ldap.persistence.BatchOperation)1 MetricEntry (org.xdi.model.metric.ldap.MetricEntry)1