Search in sources :

Example 91 with MetaTagged

use of org.olat.core.commons.modules.bc.meta.tagged.MetaTagged in project openolat by klemens.

the class GTANotifications method getAuthor.

private String getAuthor(File file, VFSContainer container) {
    String author = null;
    VFSItem item = container.resolve(file.getName());
    if (item instanceof MetaTagged) {
        MetaInfo info = ((MetaTagged) item).getMetaInfo();
        if (info != null) {
            String username = info.getAuthor();
            if (username != null) {
                author = userManager.getUserDisplayName(username);
            }
        }
    }
    return author == null ? "" : author;
}
Also used : MetaTagged(org.olat.core.commons.modules.bc.meta.tagged.MetaTagged) MetaInfo(org.olat.core.commons.modules.bc.meta.MetaInfo) VFSItem(org.olat.core.util.vfs.VFSItem)

Example 92 with MetaTagged

use of org.olat.core.commons.modules.bc.meta.tagged.MetaTagged in project openolat by klemens.

the class ConvertToGTACourseNode method convertMetada.

private void convertMetada(VFSContainer source, VFSContainer target, String name, TaskDefinition taskDef, Solution solDef) {
    VFSItem sourceItem = source.resolve(name);
    VFSItem targetItem = target.resolve(name);
    if (sourceItem instanceof MetaTagged && targetItem instanceof MetaTagged) {
        MetaTagged taggedSource = (MetaTagged) sourceItem;
        MetaInfo metaSource = taggedSource.getMetaInfo();
        MetaTagged taggedTarget = (MetaTagged) targetItem;
        MetaInfo metaTarget = taggedTarget.getMetaInfo();
        if (metaSource != null) {
            if (taskDef != null) {
                if (StringHelper.containsNonWhitespace(metaSource.getTitle())) {
                    taskDef.setTitle(metaSource.getTitle());
                }
                taskDef.setDescription(metaSource.getComment());
            }
            if (solDef != null) {
                if (StringHelper.containsNonWhitespace(metaSource.getTitle())) {
                    solDef.setTitle(metaSource.getTitle());
                }
            }
            if (metaTarget != null) {
                metaTarget.copyValues(metaSource);
                metaTarget.write();
            }
        }
    }
}
Also used : MetaTagged(org.olat.core.commons.modules.bc.meta.tagged.MetaTagged) MetaInfo(org.olat.core.commons.modules.bc.meta.MetaInfo) VFSItem(org.olat.core.util.vfs.VFSItem)

Aggregations

MetaTagged (org.olat.core.commons.modules.bc.meta.tagged.MetaTagged)92 MetaInfo (org.olat.core.commons.modules.bc.meta.MetaInfo)86 VFSLeaf (org.olat.core.util.vfs.VFSLeaf)58 VFSItem (org.olat.core.util.vfs.VFSItem)48 VFSContainer (org.olat.core.util.vfs.VFSContainer)34 File (java.io.File)16 OutputStream (java.io.OutputStream)14 Versionable (org.olat.core.util.vfs.version.Versionable)12 IOException (java.io.IOException)10 InputStream (java.io.InputStream)10 ArrayList (java.util.ArrayList)10 Date (java.util.Date)10 MediaResource (org.olat.core.gui.media.MediaResource)10 VFSMediaResource (org.olat.core.util.vfs.VFSMediaResource)10 VFSSecurityCallback (org.olat.core.util.vfs.callbacks.VFSSecurityCallback)8 BufferedOutputStream (java.io.BufferedOutputStream)6 ByteArrayInputStream (java.io.ByteArrayInputStream)6 Test (org.junit.Test)6 OlatRootFolderImpl (org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl)6 NotFoundMediaResource (org.olat.core.gui.media.NotFoundMediaResource)6