Search in sources :

Example 1 with RepositoryEntryUpgrade

use of org.olat.upgrade.model.RepositoryEntryUpgrade in project openolat by klemens.

the class OLATUpgrade_10_0_0 method upgradeRepositoryEntries.

private boolean upgradeRepositoryEntries(UpgradeManager upgradeManager, UpgradeHistoryData uhd) {
    if (!uhd.getBooleanDataValue(TASK_REPOENTRIES)) {
        int counter = 0;
        List<RepositoryEntryUpgrade> repoEntries;
        do {
            repoEntries = findRepositoryEntries(counter, BATCH_SIZE);
            for (RepositoryEntryUpgrade repoEntry : repoEntries) {
                processRepositoryEntry(repoEntry);
            }
            counter += repoEntries.size();
            log.audit("Repository entries processed: " + repoEntries.size() + ", total processed (" + counter + ")");
            dbInstance.commitAndCloseSession();
        } while (repoEntries.size() == BATCH_SIZE);
        uhd.setBooleanDataValue(TASK_REPOENTRIES, true);
        upgradeManager.setUpgradesHistory(uhd, VERSION);
    }
    return true;
}
Also used : RepositoryEntryUpgrade(org.olat.upgrade.model.RepositoryEntryUpgrade)

Example 2 with RepositoryEntryUpgrade

use of org.olat.upgrade.model.RepositoryEntryUpgrade in project openolat by klemens.

the class OLATUpgrade_7_1_1 method queryEntries.

public List<RepositoryEntryUpgrade> queryEntries(int firstResult) {
    StringBuilder sb = new StringBuilder();
    sb.append("select v from ").append(RepositoryEntryUpgrade.class.getName()).append(" v inner join fetch v.olatResource as res order by v.key asc");
    DBQuery dbquery = DBFactory.getInstance().createQuery(sb.toString());
    dbquery.setFirstResult(firstResult);
    dbquery.setMaxResults(REPO_ENTRIES_BATCH_SIZE);
    @SuppressWarnings("unchecked") List<RepositoryEntryUpgrade> entries = dbquery.list();
    return entries;
}
Also used : RepositoryEntryUpgrade(org.olat.upgrade.model.RepositoryEntryUpgrade) DBQuery(org.olat.core.commons.persistence.DBQuery)

Example 3 with RepositoryEntryUpgrade

use of org.olat.upgrade.model.RepositoryEntryUpgrade in project openolat by klemens.

the class OLATUpgrade_7_1_1 method migrateSecurityGroups.

// fxdiff VCRP-1: access control repository entry
private void migrateSecurityGroups(UpgradeManager upgradeManager, UpgradeHistoryData uhd) {
    if (!uhd.getBooleanDataValue(MIGRATE_SECURITY_GROUP)) {
        log.audit("+-----------------------------------------------------------------------------+");
        log.audit("+... Migrate the repository entry security groups from business groups     ...+");
        log.audit("+-----------------------------------------------------------------------------+");
        int counter = 0;
        List<RepositoryEntryUpgrade> entries;
        do {
            entries = queryEntries(counter);
            for (RepositoryEntryUpgrade entry : entries) {
                createRepoEntrySecurityGroups(entry);
                migrateRepoEntrySecurityGroups(entry);
            }
            counter += entries.size();
            log.audit("Processed entries: " + entries.size());
        } while (entries.size() == REPO_ENTRIES_BATCH_SIZE);
        log.audit("+... Migration processed " + counter + " repository entries     ...+");
        uhd.setBooleanDataValue(MIGRATE_SECURITY_GROUP, true);
        upgradeManager.setUpgradesHistory(uhd, VERSION);
    }
}
Also used : RepositoryEntryUpgrade(org.olat.upgrade.model.RepositoryEntryUpgrade)

Example 4 with RepositoryEntryUpgrade

use of org.olat.upgrade.model.RepositoryEntryUpgrade in project OpenOLAT by OpenOLAT.

the class OLATUpgrade_7_1_1 method queryEntries.

public List<RepositoryEntryUpgrade> queryEntries(int firstResult) {
    StringBuilder sb = new StringBuilder();
    sb.append("select v from ").append(RepositoryEntryUpgrade.class.getName()).append(" v inner join fetch v.olatResource as res order by v.key asc");
    DBQuery dbquery = DBFactory.getInstance().createQuery(sb.toString());
    dbquery.setFirstResult(firstResult);
    dbquery.setMaxResults(REPO_ENTRIES_BATCH_SIZE);
    @SuppressWarnings("unchecked") List<RepositoryEntryUpgrade> entries = dbquery.list();
    return entries;
}
Also used : RepositoryEntryUpgrade(org.olat.upgrade.model.RepositoryEntryUpgrade) DBQuery(org.olat.core.commons.persistence.DBQuery)

Example 5 with RepositoryEntryUpgrade

use of org.olat.upgrade.model.RepositoryEntryUpgrade in project OpenOLAT by OpenOLAT.

the class OLATUpgrade_7_1_1 method migrateSecurityGroups.

// fxdiff VCRP-1: access control repository entry
private void migrateSecurityGroups(UpgradeManager upgradeManager, UpgradeHistoryData uhd) {
    if (!uhd.getBooleanDataValue(MIGRATE_SECURITY_GROUP)) {
        log.audit("+-----------------------------------------------------------------------------+");
        log.audit("+... Migrate the repository entry security groups from business groups     ...+");
        log.audit("+-----------------------------------------------------------------------------+");
        int counter = 0;
        List<RepositoryEntryUpgrade> entries;
        do {
            entries = queryEntries(counter);
            for (RepositoryEntryUpgrade entry : entries) {
                createRepoEntrySecurityGroups(entry);
                migrateRepoEntrySecurityGroups(entry);
            }
            counter += entries.size();
            log.audit("Processed entries: " + entries.size());
        } while (entries.size() == REPO_ENTRIES_BATCH_SIZE);
        log.audit("+... Migration processed " + counter + " repository entries     ...+");
        uhd.setBooleanDataValue(MIGRATE_SECURITY_GROUP, true);
        upgradeManager.setUpgradesHistory(uhd, VERSION);
    }
}
Also used : RepositoryEntryUpgrade(org.olat.upgrade.model.RepositoryEntryUpgrade)

Aggregations

RepositoryEntryUpgrade (org.olat.upgrade.model.RepositoryEntryUpgrade)10 Group (org.olat.basesecurity.Group)4 SecurityGroup (org.olat.basesecurity.SecurityGroup)4 HashSet (java.util.HashSet)2 Policy (org.olat.basesecurity.Policy)2 DBQuery (org.olat.core.commons.persistence.DBQuery)2 EPMapPolicy (org.olat.portfolio.manager.EPMapPolicy)2 BGResourceRelation (org.olat.upgrade.model.BGResourceRelation)2 EPMapUpgradeToGroupRelation (org.olat.upgrade.model.EPMapUpgradeToGroupRelation)2 RepositoryEntryUpgradeToGroupRelation (org.olat.upgrade.model.RepositoryEntryUpgradeToGroupRelation)2