Search in sources :

Example 1 with UserDao

use of org.apache.openmeetings.db.dao.user.UserDao in project openmeetings by apache.

the class Admin method reportUploads.

private void reportUploads(StringBuilder report, boolean cleanup) throws IOException {
    long sectionSize = OmFileHelper.getSize(OmFileHelper.getUploadDir());
    report.append("Upload totally allocates: ").append(OmFileHelper.getHumanSize(sectionSize)).append("\n");
    // Profiles
    WebApplicationContext ctx = getApplicationContext();
    UserDao udao = ctx.getBean(UserDao.class);
    CleanupEntityUnit profile = CleanupHelper.getProfileUnit(udao);
    long restSize = sectionSize - profile.getSizeTotal();
    report.append("\t\tprofiles: ").append(profile.getHumanTotal()).append("\n");
    report.append(REP_INVALID).append(profile.getHumanInvalid()).append("\n");
    report.append(REP_DELETED).append(profile.getHumanDeleted()).append("\n");
    report.append(REP_MISSING).append(profile.getMissing()).append("\n");
    if (cleanup) {
        profile.cleanup();
    }
    CleanupUnit imp = CleanupHelper.getImportUnit();
    restSize -= imp.getSizeTotal();
    report.append("\t\timport: ").append(OmFileHelper.getHumanSize(imp.getSizeTotal())).append("\n");
    if (cleanup) {
        imp.cleanup();
    }
    CleanupUnit back = CleanupHelper.getBackupUnit();
    restSize -= back.getSizeTotal();
    report.append("\t\tbackup: ").append(OmFileHelper.getHumanSize(back.getSizeTotal())).append("\n");
    if (cleanup) {
        back.cleanup();
    }
    // Files
    FileItemDao fileDao = ctx.getBean(FileItemDao.class);
    CleanupEntityUnit files = CleanupHelper.getFileUnit(fileDao);
    restSize -= files.getSizeTotal();
    report.append("\t\tfiles: ").append(files.getHumanTotal()).append("\n");
    report.append(REP_INVALID).append(files.getHumanInvalid()).append("\n");
    report.append(REP_DELETED).append(files.getHumanDeleted()).append("\n");
    report.append(REP_MISSING).append(files.getMissing()).append("\n");
    report.append("\t\trest: ").append(OmFileHelper.getHumanSize(restSize)).append("\n");
    if (cleanup) {
        files.cleanup();
    }
}
Also used : UserDao(org.apache.openmeetings.db.dao.user.UserDao) FileItemDao(org.apache.openmeetings.db.dao.file.FileItemDao) WebApplicationContext(org.springframework.web.context.WebApplicationContext)

Aggregations

FileItemDao (org.apache.openmeetings.db.dao.file.FileItemDao)1 UserDao (org.apache.openmeetings.db.dao.user.UserDao)1 WebApplicationContext (org.springframework.web.context.WebApplicationContext)1