Search in sources :

Example 6 with OpenMeetingsManager

use of org.olat.modules.openmeetings.manager.OpenMeetingsManager in project OpenOLAT by OpenOLAT.

the class OpenMeetingsCourseNode method cleanupOnDelete.

@Override
public void cleanupOnDelete(ICourse course) {
    super.cleanupOnDelete(course);
    // load configuration
    OpenMeetingsManager provider = CoreSpringFactory.getImpl(OpenMeetingsManager.class);
    // remove meeting
    OLATResourceable ores = OresHelper.createOLATResourceableInstance(course.getResourceableTypeName(), course.getResourceableId());
    try {
        provider.deleteAll(null, ores, getIdent());
    } catch (OpenMeetingsException e) {
        log.error("A room could not be deleted for course node: " + getIdent() + " of course:" + course, e);
    }
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) OpenMeetingsException(org.olat.modules.openmeetings.manager.OpenMeetingsException) OpenMeetingsManager(org.olat.modules.openmeetings.manager.OpenMeetingsManager)

Example 7 with OpenMeetingsManager

use of org.olat.modules.openmeetings.manager.OpenMeetingsManager in project OpenOLAT by OpenOLAT.

the class OpenMeetingsCourseNode method isConfigValid.

@Override
public StatusDescription isConfigValid() {
    if (oneClickStatusCache != null) {
        return oneClickStatusCache[0];
    }
    StatusDescription sd = StatusDescription.NOERROR;
    if (groupMgr != null) {
        OpenMeetingsManager openMeetingsManager = CoreSpringFactory.getImpl(OpenMeetingsManager.class);
        Long roomId = openMeetingsManager.getRoomId(null, groupMgr.getCourseResource(), getIdent());
        if (roomId == null) {
            String shortKey = "error.noroom.short";
            String longKey = "error.noroom.long";
            String[] params = new String[] { getShortTitle() };
            String translPackage = Util.getPackageName(OpenMeetingsRoomEditController.class);
            sd = new StatusDescription(StatusDescription.ERROR, shortKey, longKey, params, translPackage);
            sd.setDescriptionForUnit(getIdent());
            // set which pane is affected by error
            sd.setActivateableViewIdentifier(CPEditController.PANE_TAB_CPCONFIG);
        }
    }
    return sd;
}
Also used : StatusDescription(org.olat.course.editor.StatusDescription) OpenMeetingsManager(org.olat.modules.openmeetings.manager.OpenMeetingsManager)

Example 8 with OpenMeetingsManager

use of org.olat.modules.openmeetings.manager.OpenMeetingsManager in project OpenOLAT by OpenOLAT.

the class OpenMeetingsWebService method getPortrait.

/**
 * Retrieves the portrait of an user
 * @response.representation.200.mediaType application/octet-stream
 * @response.representation.200.doc The portrait as image
 * @response.representation.404.doc The identity or the portrait not found
 * @param identityToken The identity key of the user being searched
 * @param request The REST request
 * @return The image
 */
@GET
@Path("{identityToken}/portrait")
@Produces({ "image/jpeg", "image/jpg", MediaType.APPLICATION_OCTET_STREAM })
public Response getPortrait(@PathParam("identityToken") String identityToken, @Context Request request) {
    try {
        OpenMeetingsModule module = CoreSpringFactory.getImpl(OpenMeetingsModule.class);
        if (!module.isEnabled()) {
            return Response.serverError().status(Status.FORBIDDEN).build();
        }
        OpenMeetingsManager omm = CoreSpringFactory.getImpl(OpenMeetingsManager.class);
        Long identityKey = omm.getIdentityKey(identityToken);
        if (identityKey == null) {
            return Response.serverError().status(Status.NOT_FOUND).build();
        }
        String username = CoreSpringFactory.getImpl(UserManager.class).getUsername(identityKey);
        if (username == null) {
            return Response.serverError().status(Status.NOT_FOUND).build();
        }
        File portrait = DisplayPortraitManager.getInstance().getBigPortrait(username);
        if (portrait == null || !portrait.exists()) {
            return Response.serverError().status(Status.NOT_FOUND).build();
        }
        Date lastModified = new Date(portrait.lastModified());
        Response.ResponseBuilder response = request.evaluatePreconditions(lastModified);
        if (response == null) {
            response = Response.ok(portrait).lastModified(lastModified).cacheControl(cc);
        }
        return response.build();
    } catch (Throwable e) {
        throw new WebApplicationException(e);
    }
}
Also used : Response(javax.ws.rs.core.Response) WebApplicationException(javax.ws.rs.WebApplicationException) UserManager(org.olat.user.UserManager) OpenMeetingsModule(org.olat.modules.openmeetings.OpenMeetingsModule) OpenMeetingsManager(org.olat.modules.openmeetings.manager.OpenMeetingsManager) File(java.io.File) Date(java.util.Date) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 9 with OpenMeetingsManager

use of org.olat.modules.openmeetings.manager.OpenMeetingsManager in project openolat by klemens.

the class CollaborationTools method deleteTools.

/**
 * delete all CollaborationTools stuff from the database, which is related to
 * the calling OLATResourceable.
 */
public void deleteTools(BusinessGroup businessGroupTodelete) {
    NarrowedPropertyManager npm = NarrowedPropertyManager.getInstance(ores);
    /*
		 * delete the forum, if existing
		 */
    ForumManager fom = ForumManager.getInstance();
    Property forumKeyProperty = npm.findProperty(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_FORUM);
    if (forumKeyProperty != null) {
        // if there was a forum, delete it
        Long forumKey = forumKeyProperty.getLongValue();
        if (forumKey == null)
            throw new AssertException("property had no longValue, prop:" + forumKeyProperty);
        fom.deleteForum(forumKey);
    }
    /*
		 * delete the folder, if existing
		 */
    OlatRootFolderImpl vfsContainer = new OlatRootFolderImpl(getFolderRelPath(), null);
    File fFolderRoot = vfsContainer.getBasefile();
    if (fFolderRoot.exists()) {
        FileUtils.deleteDirsAndFiles(fFolderRoot, true, true);
    }
    /*
		 * delete the wiki if existing
		 */
    VFSContainer rootContainer = WikiManager.getInstance().getWikiRootContainer(ores);
    if (rootContainer != null)
        rootContainer.delete();
    /*
		 * Delete calendar if exists
		 */
    if (businessGroupTodelete != null) {
        CoreSpringFactory.getImpl(ImportToCalendarManager.class).deleteGroupImportedCalendars(businessGroupTodelete);
        CoreSpringFactory.getImpl(CalendarManager.class).deleteGroupCalendar(businessGroupTodelete);
    }
    /*
		 * delete chatRoom
		 */
    // no cleanup needed, automatically done when last user exits the room
    /*
		 * delete all Properties defining enabled/disabled CollabTool XY and the
		 * news content
		 */
    npm.deleteProperties(null, null, PROP_CAT_BG_COLLABTOOLS, null);
    /*
		 * Delete OpenMeetings room
		 */
    OpenMeetingsModule omModule = CoreSpringFactory.getImpl(OpenMeetingsModule.class);
    if (omModule.isEnabled()) {
        OpenMeetingsManager omManager = CoreSpringFactory.getImpl(OpenMeetingsManager.class);
        try {
            omManager.deleteAll(ores, null, null);
        } catch (OpenMeetingsException e) {
            log.error("A room could not be deleted for group: " + ores, e);
        }
    }
    /*
		 * and last but not least the cache is reseted
		 */
    cacheToolStates.clear();
    this.dirty = true;
}
Also used : AssertException(org.olat.core.logging.AssertException) VFSContainer(org.olat.core.util.vfs.VFSContainer) OpenMeetingsModule(org.olat.modules.openmeetings.OpenMeetingsModule) ImportToCalendarManager(org.olat.commons.calendar.manager.ImportToCalendarManager) ImportToCalendarManager(org.olat.commons.calendar.manager.ImportToCalendarManager) CalendarManager(org.olat.commons.calendar.CalendarManager) OlatRootFolderImpl(org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl) ForumManager(org.olat.modules.fo.manager.ForumManager) OpenMeetingsException(org.olat.modules.openmeetings.manager.OpenMeetingsException) NarrowedPropertyManager(org.olat.properties.NarrowedPropertyManager) Property(org.olat.properties.Property) File(java.io.File) OpenMeetingsManager(org.olat.modules.openmeetings.manager.OpenMeetingsManager)

Example 10 with OpenMeetingsManager

use of org.olat.modules.openmeetings.manager.OpenMeetingsManager in project openolat by klemens.

the class OpenMeetingsCourseNode method cleanupOnDelete.

@Override
public void cleanupOnDelete(ICourse course) {
    super.cleanupOnDelete(course);
    // load configuration
    OpenMeetingsManager provider = CoreSpringFactory.getImpl(OpenMeetingsManager.class);
    // remove meeting
    OLATResourceable ores = OresHelper.createOLATResourceableInstance(course.getResourceableTypeName(), course.getResourceableId());
    try {
        provider.deleteAll(null, ores, getIdent());
    } catch (OpenMeetingsException e) {
        log.error("A room could not be deleted for course node: " + getIdent() + " of course:" + course, e);
    }
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) OpenMeetingsException(org.olat.modules.openmeetings.manager.OpenMeetingsException) OpenMeetingsManager(org.olat.modules.openmeetings.manager.OpenMeetingsManager)

Aggregations

OpenMeetingsManager (org.olat.modules.openmeetings.manager.OpenMeetingsManager)10 OpenMeetingsModule (org.olat.modules.openmeetings.OpenMeetingsModule)6 File (java.io.File)4 OpenMeetingsException (org.olat.modules.openmeetings.manager.OpenMeetingsException)4 Date (java.util.Date)2 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 WebApplicationException (javax.ws.rs.WebApplicationException)2 Response (javax.ws.rs.core.Response)2 CalendarManager (org.olat.commons.calendar.CalendarManager)2 ImportToCalendarManager (org.olat.commons.calendar.manager.ImportToCalendarManager)2 OlatRootFolderImpl (org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl)2 OLATResourceable (org.olat.core.id.OLATResourceable)2 AssertException (org.olat.core.logging.AssertException)2 VFSContainer (org.olat.core.util.vfs.VFSContainer)2 StatusDescription (org.olat.course.editor.StatusDescription)2 ForumManager (org.olat.modules.fo.manager.ForumManager)2 OpenMeetingsRoom (org.olat.modules.openmeetings.model.OpenMeetingsRoom)2 NarrowedPropertyManager (org.olat.properties.NarrowedPropertyManager)2