Search in sources :

Example 6 with OLATResourceManager

use of org.olat.resource.OLATResourceManager in project OpenOLAT by OpenOLAT.

the class JunitTestHelper method createAndPersistRepositoryEntry.

public static final RepositoryEntry createAndPersistRepositoryEntry(String initialAuthor, boolean membersOnly) {
    OLATResourceManager resourceManager = OLATResourceManager.getInstance();
    String resourceName = UUID.randomUUID().toString().replace("-", "").substring(0, 30);
    OLATResourceable ores = OresHelper.createOLATResourceableInstance(resourceName, CodeHelper.getForeverUniqueID());
    OLATResource r = resourceManager.createOLATResourceInstance(ores);
    resourceManager.saveOLATResource(r);
    return createAndPersistRepositoryEntry(initialAuthor, r, membersOnly);
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) OLATResourceManager(org.olat.resource.OLATResourceManager) OLATResource(org.olat.resource.OLATResource)

Example 7 with OLATResourceManager

use of org.olat.resource.OLATResourceManager in project openolat by klemens.

the class CatalogTest method createRepository.

private RepositoryEntry createRepository(String displayName, final Long resourceableId) {
    OLATResourceable resourceable = new OLATResourceable() {

        public String getResourceableTypeName() {
            return CourseModule.ORES_TYPE_COURSE;
        }

        public Long getResourceableId() {
            return resourceableId;
        }
    };
    OLATResourceManager rm = OLATResourceManager.getInstance();
    // create course and persist as OLATResourceImpl
    OLATResource r = rm.findResourceable(resourceable);
    if (r == null) {
        r = rm.createOLATResourceInstance(resourceable);
    }
    DBFactory.getInstance().saveObject(r);
    DBFactory.getInstance().intermediateCommit();
    RepositoryEntry d = RepositoryManager.getInstance().lookupRepositoryEntry(resourceable, false);
    if (d == null) {
        d = repositoryService.create("Rei Ayanami", "-", displayName, "Repo entry", r);
        DBFactory.getInstance().saveObject(d);
    }
    DBFactory.getInstance().intermediateCommit();
    return d;
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) OLATResourceManager(org.olat.resource.OLATResourceManager) OLATResource(org.olat.resource.OLATResource) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 8 with OLATResourceManager

use of org.olat.resource.OLATResourceManager in project openolat by klemens.

the class JunitTestHelper method createAndPersistRepositoryEntry.

public static final RepositoryEntry createAndPersistRepositoryEntry(String initialAuthor, boolean membersOnly) {
    OLATResourceManager resourceManager = OLATResourceManager.getInstance();
    String resourceName = UUID.randomUUID().toString().replace("-", "").substring(0, 30);
    OLATResourceable ores = OresHelper.createOLATResourceableInstance(resourceName, CodeHelper.getForeverUniqueID());
    OLATResource r = resourceManager.createOLATResourceInstance(ores);
    resourceManager.saveOLATResource(r);
    return createAndPersistRepositoryEntry(initialAuthor, r, membersOnly);
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) OLATResourceManager(org.olat.resource.OLATResourceManager) OLATResource(org.olat.resource.OLATResource)

Example 9 with OLATResourceManager

use of org.olat.resource.OLATResourceManager in project openolat by klemens.

the class RepositoryEntriesTest method createRepository.

private RepositoryEntry createRepository(String displayName) {
    OLATResourceManager rm = OLATResourceManager.getInstance();
    // create course and persist as OLATResourceImpl
    OLATResource r = rm.createOLATResourceInstance("DummyType");
    DBFactory.getInstance().saveObject(r);
    DBFactory.getInstance().intermediateCommit();
    RepositoryEntry d = repositoryService.create(displayName, "-", displayName, "Repo entry", r);
    DBFactory.getInstance().commit();
    return d;
}
Also used : OLATResourceManager(org.olat.resource.OLATResourceManager) OLATResource(org.olat.resource.OLATResource) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 10 with OLATResourceManager

use of org.olat.resource.OLATResourceManager in project openolat by klemens.

the class SharedFolderManager method createSharedFolder.

public SharedFolderFileResource createSharedFolder() {
    SharedFolderFileResource resource = new SharedFolderFileResource();
    VFSContainer rootContainer = FileResourceManager.getInstance().getFileResourceRootImpl(resource);
    if (rootContainer.createChildContainer(FOLDER_NAME) == null)
        return null;
    OLATResourceManager rm = OLATResourceManager.getInstance();
    OLATResource ores = rm.createOLATResourceInstance(resource);
    rm.saveOLATResource(ores);
    return resource;
}
Also used : SharedFolderFileResource(org.olat.fileresource.types.SharedFolderFileResource) VFSContainer(org.olat.core.util.vfs.VFSContainer) OLATResourceManager(org.olat.resource.OLATResourceManager) OLATResource(org.olat.resource.OLATResource)

Aggregations

OLATResourceManager (org.olat.resource.OLATResourceManager)32 OLATResource (org.olat.resource.OLATResource)30 OLATResourceable (org.olat.core.id.OLATResourceable)14 Identity (org.olat.core.id.Identity)12 RepositoryEntry (org.olat.repository.RepositoryEntry)12 Path (javax.ws.rs.Path)10 BaseSecurity (org.olat.basesecurity.BaseSecurity)10 CertificatesManager (org.olat.course.certificate.CertificatesManager)8 Date (java.util.Date)6 VFSContainer (org.olat.core.util.vfs.VFSContainer)6 Certificate (org.olat.course.certificate.Certificate)6 File (java.io.File)4 IOException (java.io.IOException)4 Consumes (javax.ws.rs.Consumes)4 PUT (javax.ws.rs.PUT)4 Produces (javax.ws.rs.Produces)4 Before (org.junit.Before)4 CollaborationTools (org.olat.collaboration.CollaborationTools)4 VFSLeaf (org.olat.core.util.vfs.VFSLeaf)4 Forum (org.olat.modules.fo.Forum)4