use of org.olat.core.util.vfs.version.VFSRevision in project OpenOLAT by OpenOLAT.
the class DeletedFileListController method loadModel.
private void loadModel(UserRequest ureq) {
Collection<String> names = new HashSet<String>();
for (Versions deletedFile : deletedFiles) {
if (deletedFile.getCreator() != null && !"-".equals(deletedFile.getCreator())) {
names.add(deletedFile.getCreator());
}
VFSRevision lastRevision = getLastRevision(deletedFile);
if (lastRevision != null && lastRevision.getAuthor() != null && !"-".equals(lastRevision.getAuthor())) {
names.add(lastRevision.getAuthor());
}
}
Map<String, String> mappedFullnames = userManager.getUserDisplayNamesByUserName(names);
DeletedFileListDataModel model = new DeletedFileListDataModel(deletedFiles, mappedFullnames, ureq.getLocale());
deletedFilesListTableCtr.setTableDataModel(model);
}
use of org.olat.core.util.vfs.version.VFSRevision in project OpenOLAT by OpenOLAT.
the class DeletedFileListController method renderVersionsAsHtml.
private String renderVersionsAsHtml(List<Versions> versions) {
StringBuilder sb = new StringBuilder();
sb.append("<ul>");
for (Versions version : versions) {
VFSRevision lastRevision = getLastRevision(version);
if (lastRevision != null) {
sb.append("<li>").append(lastRevision.getName()).append("</li>");
}
}
sb.append("</ul>");
return sb.toString();
}
use of org.olat.core.util.vfs.version.VFSRevision in project OpenOLAT by OpenOLAT.
the class RevisionListController method getSelectedRevisions.
private List<VFSRevision> getSelectedRevisions(BitSet objectMarkers) {
List<VFSRevision> allVersions = versionedFile.getVersions().getRevisions();
List<VFSRevision> results = new ArrayList<VFSRevision>();
for (int i = objectMarkers.nextSetBit(0); i >= 0; i = objectMarkers.nextSetBit(i + 1)) {
if (i >= 0 && i < allVersions.size()) {
VFSRevision elem = allVersions.get(i);
results.add(elem);
}
}
return results;
}
use of org.olat.core.util.vfs.version.VFSRevision in project openolat by klemens.
the class VersionMaintenanceForm method calculateOrphanSize.
public final void calculateOrphanSize() {
long size = 0l;
List<OrphanVersion> orphans = versionsManager.orphans();
for (OrphanVersion orphan : orphans) {
List<VFSRevision> revisions = orphan.getVersions().getRevisions();
if (revisions != null) {
for (VFSRevision revision : revisions) {
size += revision.getSize();
}
}
}
String unit = "KB";
double humanSize = size / 1024.0d;
if (humanSize > 1024) {
humanSize /= 1024;
unit = "MB";
}
DecimalFormat sizeFormat = new DecimalFormat("#0.#", new DecimalFormatSymbols(Locale.ENGLISH));
String readableSize = sizeFormat.format(humanSize) + " " + unit;
if (orphanSizeEl != null && !isDisposed()) {
orphanSizeEl.setValue(readableSize);
}
}
use of org.olat.core.util.vfs.version.VFSRevision in project openolat by klemens.
the class DeletedFileListController method loadModel.
private void loadModel(UserRequest ureq) {
Collection<String> names = new HashSet<String>();
for (Versions deletedFile : deletedFiles) {
if (deletedFile.getCreator() != null && !"-".equals(deletedFile.getCreator())) {
names.add(deletedFile.getCreator());
}
VFSRevision lastRevision = getLastRevision(deletedFile);
if (lastRevision != null && lastRevision.getAuthor() != null && !"-".equals(lastRevision.getAuthor())) {
names.add(lastRevision.getAuthor());
}
}
Map<String, String> mappedFullnames = userManager.getUserDisplayNamesByUserName(names);
DeletedFileListDataModel model = new DeletedFileListDataModel(deletedFiles, mappedFullnames, ureq.getLocale());
deletedFilesListTableCtr.setTableDataModel(model);
}
Aggregations