use of org.olat.core.logging.AssertException in project openolat by klemens.
the class CollaborationTools method getForum.
public Forum getForum() {
final ForumManager fom = ForumManager.getInstance();
final NarrowedPropertyManager npm = NarrowedPropertyManager.getInstance(ores);
Property forumProperty = npm.findProperty(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_FORUM);
Forum forum;
if (forumProperty != null) {
forum = fom.loadForum(forumProperty.getLongValue());
} else {
forum = coordinatorManager.getCoordinator().getSyncer().doInSync(ores, new SyncerCallback<Forum>() {
@Override
public Forum execute() {
Forum aforum;
Long forumKey;
Property forumKeyProperty = npm.findProperty(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_FORUM);
if (forumKeyProperty == null) {
// First call of forum, create new forum and save
aforum = fom.addAForum();
forumKey = aforum.getKey();
if (log.isDebug()) {
log.debug("created new forum in collab tools: foid::" + forumKey.longValue() + " for ores::" + ores.getResourceableTypeName() + "/" + ores.getResourceableId());
}
forumKeyProperty = npm.createPropertyInstance(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_FORUM, null, forumKey, null, null);
npm.saveProperty(forumKeyProperty);
} else {
// Forum does already exist, load forum with key from properties
forumKey = forumKeyProperty.getLongValue();
aforum = fom.loadForum(forumKey);
if (aforum == null) {
throw new AssertException("Unable to load forum with key " + forumKey.longValue() + " for ores " + ores.getResourceableTypeName() + " with key " + ores.getResourceableId());
}
if (log.isDebug()) {
log.debug("loading forum in collab tools from properties: foid::" + forumKey.longValue() + " for ores::" + ores.getResourceableTypeName() + "/" + ores.getResourceableId());
}
}
return aforum;
}
});
}
return forum;
}
use of org.olat.core.logging.AssertException in project openolat by klemens.
the class BaseSecurityManager method findSecurityGroupByName.
/**
* @see org.olat.basesecurity.Manager#findSecurityGroupByName(java.lang.String)
*/
@Override
public SecurityGroup findSecurityGroupByName(String securityGroupName) {
StringBuilder sb = new StringBuilder();
sb.append("select sgi from ").append(NamedGroupImpl.class.getName()).append(" as ngroup ").append(" inner join ngroup.securityGroup sgi").append(" where ngroup.groupName=:groupName");
List<SecurityGroup> group = dbInstance.getCurrentEntityManager().createQuery(sb.toString(), SecurityGroup.class).setParameter("groupName", securityGroupName).setHint("org.hibernate.cacheable", Boolean.TRUE).getResultList();
int size = group.size();
if (size == 0)
return null;
if (size != 1)
throw new AssertException("non unique name in namedgroup: " + securityGroupName);
SecurityGroup sg = group.get(0);
return sg;
}
use of org.olat.core.logging.AssertException in project openolat by klemens.
the class WimbaClassroomProvider method removeClassroom.
@Override
public boolean removeClassroom(String roomId, VCConfiguration config) {
if (!existsClassroom(roomId, config))
return true;
if (!loginAdmin())
throw new AssertException("Cannot login to Wimba Classroom. Please check module configuration and Wimba Classroom connectivity");
// first delete recordings
Map<String, String> mapRecordings = listRecordings(roomId);
for (String key : mapRecordings.keySet()) {
removeClassroomRecording(key);
}
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("function", "deleteClass");
parameters.put("target", PREFIX + roomId);
String raw = sendRequest(parameters);
WimbaResponse response = getResponseDocument(raw);
boolean success = evaluateOk(response);
if (!success)
handleError(response.getStatus(), null);
return success;
}
use of org.olat.core.logging.AssertException in project openolat by klemens.
the class WimbaClassroomProvider method setPreviewMode.
public boolean setPreviewMode(String roomId, boolean enabled, boolean isRecording) {
if (!loginAdmin())
throw new AssertException("Cannot login to Wimba Classroom. Please check module configuration and Wimba Classroom connectivity");
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("function", "modifyClass");
parameters.put("target", isRecording ? roomId : PREFIX + roomId);
parameters.put("preview", param(enabled));
String raw = sendRequest(parameters);
WimbaResponse response = getResponseDocument(raw);
boolean success = evaluateOk(response);
if (!success)
handleError(response.getStatus(), null);
return success;
}
use of org.olat.core.logging.AssertException in project openolat by klemens.
the class AdobeConnectProvider method removeClassroom.
@Override
public boolean removeClassroom(String roomId, VCConfiguration config) {
if (!existsClassroom(roomId, config))
return true;
if (!loginAdmin())
throw new AssertException("Cannot login to Adobe Connect. Please check module configuration and that Adobe Connect is available.");
String scoId = getScoIdFor(roomId);
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("action", "sco-delete");
parameters.put("sco-id", scoId);
Document responseDoc = getResponseDocument(sendRequest(parameters));
if (!evaluateOk(responseDoc))
return false;
logout();
return true;
}
Aggregations