use of org.olat.core.util.vfs.VFSLeaf in project OpenOLAT by OpenOLAT.
the class GTASampleSolutionsEditController method updateModel.
private void updateModel() {
List<Solution> solutionList = gtaManager.getSolutions(courseEnv, gtaNode);
List<SolutionRow> rows = new ArrayList<>(solutionList.size());
for (Solution solution : solutionList) {
String filename = solution.getFilename();
String author = null;
VFSItem item = solutionContainer.resolve(filename);
if (item instanceof MetaTagged) {
MetaInfo metaInfo = ((MetaTagged) item).getMetaInfo();
if (metaInfo != null && metaInfo.getAuthorIdentityKey() != null) {
author = userManager.getUserDisplayName(metaInfo.getAuthorIdentityKey());
}
}
DownloadLink downloadLink = null;
if (item instanceof VFSLeaf) {
downloadLink = uifactory.addDownloadLink("file_" + (++linkCounter), filename, null, (VFSLeaf) item, solutionTable);
}
rows.add(new SolutionRow(solution, author, downloadLink));
}
solutionModel.setObjects(rows);
solutionTable.reset();
}
use of org.olat.core.util.vfs.VFSLeaf in project OpenOLAT by OpenOLAT.
the class PFPeekviewController method addItems.
private void addItems(VFSContainer container, List<VFSLeaf> allLeafs) {
// exclude files which are also excluded in FolderComponent
for (VFSItem vfsItem : container.getItems(attachmentExcludeFilter)) {
if (vfsItem instanceof VFSLeaf) {
// add leaf to our list
VFSLeaf leaf = (VFSLeaf) vfsItem;
allLeafs.add(leaf);
} else if (vfsItem instanceof VFSContainer) {
// do it recursively for all children
VFSContainer childContainer = (VFSContainer) vfsItem;
addItems(childContainer, allLeafs);
} else {
// hu?
}
}
}
use of org.olat.core.util.vfs.VFSLeaf in project OpenOLAT by OpenOLAT.
the class OfficeDocumentTest method testWordOpenXMLDocument.
@Test
public void testWordOpenXMLDocument() throws IOException, DocumentException, DocumentAccessException, URISyntaxException {
URL docUrl = OfficeDocumentTest.class.getResource("Test_word_indexing.docx");
Assert.assertNotNull(docUrl);
VFSLeaf doc = new VFSJavaIOFile(new File(docUrl.toURI()));
WordOOXMLDocument document = new WordOOXMLDocument();
FileContent content = document.readContent(doc);
Assert.assertNotNull(content);
String body = content.getContent();
Assert.assertTrue(body.contains("Document compatibility test"));
Assert.assertTrue(body.contains("They prefer to start writing a document at home in desktop or laptop computer"));
}
use of org.olat.core.util.vfs.VFSLeaf in project OpenOLAT by OpenOLAT.
the class OfficeDocumentTest method testPowerPointOpenXMLDocument.
@Test
public void testPowerPointOpenXMLDocument() throws IOException, DocumentException, DocumentAccessException, URISyntaxException {
URL docUrl = OfficeDocumentTest.class.getResource("Test_ppt_indexing.pptx");
Assert.assertNotNull(docUrl);
VFSLeaf doc = new VFSJavaIOFile(new File(docUrl.toURI()));
PowerPointOOXMLDocument document = new PowerPointOOXMLDocument();
FileContent content = document.readContent(doc);
Assert.assertNotNull(content);
String body = content.getContent();
Assert.assertTrue(body.contains("Here is some text"));
}
use of org.olat.core.util.vfs.VFSLeaf in project OpenOLAT by OpenOLAT.
the class OfficeDocumentTest method testPowerPointDocument.
@Test
public void testPowerPointDocument() throws IOException, DocumentException, DocumentAccessException, URISyntaxException {
URL docUrl = OfficeDocumentTest.class.getResource("Test_ppt_indexing.ppt");
Assert.assertNotNull(docUrl);
VFSLeaf doc = new VFSJavaIOFile(new File(docUrl.toURI()));
PowerPointDocument document = new PowerPointDocument();
FileContent content = document.readContent(doc);
Assert.assertNotNull(content);
String body = content.getContent();
Assert.assertTrue(body.contains("Sample Powerpoint Slide"));
}
Aggregations