Search in sources :

Example 1 with WikiResource

use of org.olat.fileresource.types.WikiResource in project openolat by klemens.

the class WikiHandler method importResource.

@Override
public RepositoryEntry importResource(Identity initialAuthor, String initialAuthorAlt, String displayname, String description, boolean withReferences, Locale locale, File file, String filename) {
    WikiResource wikiResource = new WikiResource();
    OLATResource resource = OLATResourceManager.getInstance().findOrPersistResourceable(wikiResource);
    File rootDirectory = WikiManager.getInstance().getWikiRootContainer(resource).getBasefile();
    WikiManager.getInstance().importWiki(file, filename, rootDirectory);
    RepositoryEntry re = CoreSpringFactory.getImpl(RepositoryService.class).create(initialAuthor, null, WikiManager.WIKI_RESOURCE_FOLDER_NAME, displayname, description, resource, RepositoryEntry.ACC_OWNERS);
    DBFactory.getInstance().commit();
    return re;
}
Also used : WikiResource(org.olat.fileresource.types.WikiResource) OLATResource(org.olat.resource.OLATResource) RepositoryEntry(org.olat.repository.RepositoryEntry) File(java.io.File) RepositoryService(org.olat.repository.RepositoryService)

Example 2 with WikiResource

use of org.olat.fileresource.types.WikiResource in project openolat by klemens.

the class WikiHandler method createResource.

@Override
public RepositoryEntry createResource(Identity initialAuthor, String displayname, String description, Object createObject, Locale locale) {
    RepositoryService repositoryService = CoreSpringFactory.getImpl(RepositoryService.class);
    WikiResource wikiResource = WikiManager.getInstance().createWiki();
    OLATResource resource = OLATResourceManager.getInstance().findOrPersistResourceable(wikiResource);
    RepositoryEntry re = repositoryService.create(initialAuthor, null, WikiManager.WIKI_RESOURCE_FOLDER_NAME, displayname, description, resource, RepositoryEntry.ACC_OWNERS);
    DBFactory.getInstance().commit();
    return re;
}
Also used : WikiResource(org.olat.fileresource.types.WikiResource) OLATResource(org.olat.resource.OLATResource) RepositoryEntry(org.olat.repository.RepositoryEntry) RepositoryService(org.olat.repository.RepositoryService)

Example 3 with WikiResource

use of org.olat.fileresource.types.WikiResource in project openolat by klemens.

the class WikiManager method createWiki.

// ---- end controller factory -----
/**
 * @return the new created resource
 */
public WikiResource createWiki() {
    WikiResource resource = new WikiResource();
    createFolders(resource);
    OLATResourceManager rm = getResourceManager();
    OLATResource ores = rm.createOLATResourceInstance(resource);
    rm.saveOLATResource(ores);
    return resource;
}
Also used : WikiResource(org.olat.fileresource.types.WikiResource) OLATResourceManager(org.olat.resource.OLATResourceManager) OLATResource(org.olat.resource.OLATResource)

Example 4 with WikiResource

use of org.olat.fileresource.types.WikiResource in project OpenOLAT by OpenOLAT.

the class WikiHandler method importResource.

@Override
public RepositoryEntry importResource(Identity initialAuthor, String initialAuthorAlt, String displayname, String description, boolean withReferences, Locale locale, File file, String filename) {
    WikiResource wikiResource = new WikiResource();
    OLATResource resource = OLATResourceManager.getInstance().findOrPersistResourceable(wikiResource);
    File rootDirectory = WikiManager.getInstance().getWikiRootContainer(resource).getBasefile();
    WikiManager.getInstance().importWiki(file, filename, rootDirectory);
    RepositoryEntry re = CoreSpringFactory.getImpl(RepositoryService.class).create(initialAuthor, null, WikiManager.WIKI_RESOURCE_FOLDER_NAME, displayname, description, resource, RepositoryEntry.ACC_OWNERS);
    DBFactory.getInstance().commit();
    return re;
}
Also used : WikiResource(org.olat.fileresource.types.WikiResource) OLATResource(org.olat.resource.OLATResource) RepositoryEntry(org.olat.repository.RepositoryEntry) File(java.io.File) RepositoryService(org.olat.repository.RepositoryService)

Example 5 with WikiResource

use of org.olat.fileresource.types.WikiResource in project OpenOLAT by OpenOLAT.

the class WikiHandler method createResource.

@Override
public RepositoryEntry createResource(Identity initialAuthor, String displayname, String description, Object createObject, Locale locale) {
    RepositoryService repositoryService = CoreSpringFactory.getImpl(RepositoryService.class);
    WikiResource wikiResource = WikiManager.getInstance().createWiki();
    OLATResource resource = OLATResourceManager.getInstance().findOrPersistResourceable(wikiResource);
    RepositoryEntry re = repositoryService.create(initialAuthor, null, WikiManager.WIKI_RESOURCE_FOLDER_NAME, displayname, description, resource, RepositoryEntry.ACC_OWNERS);
    DBFactory.getInstance().commit();
    return re;
}
Also used : WikiResource(org.olat.fileresource.types.WikiResource) OLATResource(org.olat.resource.OLATResource) RepositoryEntry(org.olat.repository.RepositoryEntry) RepositoryService(org.olat.repository.RepositoryService)

Aggregations

WikiResource (org.olat.fileresource.types.WikiResource)6 OLATResource (org.olat.resource.OLATResource)6 RepositoryEntry (org.olat.repository.RepositoryEntry)4 RepositoryService (org.olat.repository.RepositoryService)4 File (java.io.File)2 OLATResourceManager (org.olat.resource.OLATResourceManager)2