use of org.olat.core.logging.AssertException in project OpenOLAT by OpenOLAT.
the class ForumManager method deleteForum.
/**
* @param forumKey
*/
public void deleteForum(Long forumKey) {
Forum foToDel = loadForum(forumKey);
if (foToDel == null)
throw new AssertException("forum to delete was not found: key=" + forumKey);
// delete properties, messages and the forum itself
doDeleteForum(foToDel);
// delete directory for messages with attachments
deleteForumContainer(forumKey);
}
use of org.olat.core.logging.AssertException in project OpenOLAT by OpenOLAT.
the class ForumStreamedRTFFormatter method writeToFile.
/**
* @param append
* @param buff
*/
private void writeToFile(StringBuilder buff) {
try {
StringBuilder out = new StringBuilder();
int len = buff.length();
for (int i = 0; i < len; i++) {
char c = buff.charAt(i);
int val = c;
if (val > 127) {
out.append("\\u").append(String.valueOf(val)).append("?");
} else {
out.append(c);
}
}
String encoded = out.toString();
exportStream.putNextEntry(new ZipEntry(path + "/" + fileName));
IOUtils.write(encoded, exportStream, "UTF-8");
exportStream.closeEntry();
} catch (UnsupportedEncodingException ueEx) {
throw new AssertException("could not encode stream from forum export file: " + ueEx);
} catch (IOException e) {
throw new AssertException("could not write to forum export file: " + e);
}
}
use of org.olat.core.logging.AssertException in project OpenOLAT by OpenOLAT.
the class ProjectGroupManagerImpl method getAccountManagerGroupFor.
@Override
public BusinessGroup getAccountManagerGroupFor(CoursePropertyManager cpm, CourseNode courseNode, ICourse course, String groupName, String groupDescription, Identity identity) {
BusinessGroup accountManagerGroup = null;
try {
Long groupKey = null;
Property accountManagerGroupProperty = cpm.findCourseNodeProperty(courseNode, null, null, ProjectBrokerCourseNode.CONF_ACCOUNTMANAGER_GROUP_KEY);
// Check if account-manager-group-key-property already exist
if (accountManagerGroupProperty != null) {
groupKey = accountManagerGroupProperty.getLongValue();
log.debug("accountManagerGroupProperty=" + accountManagerGroupProperty + " groupKey=" + groupKey);
}
log.debug("groupKey=" + groupKey);
if (groupKey != null) {
accountManagerGroup = businessGroupService.loadBusinessGroup(groupKey);
log.debug("load businessgroup=" + accountManagerGroup);
if (accountManagerGroup != null) {
return accountManagerGroup;
} else {
if (accountManagerGroupProperty != null) {
cpm.deleteProperty(accountManagerGroupProperty);
}
groupKey = null;
log.warn("ProjectBroker: Account-manager does no longer exist, create a new one", null);
}
} else {
log.debug("No group for project-broker exist => create a new one");
RepositoryEntry re = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
accountManagerGroup = businessGroupService.createBusinessGroup(identity, groupName, groupDescription, -1, -1, false, false, re);
int i = 2;
while (accountManagerGroup == null) {
// group with this name exist already, try another name
accountManagerGroup = businessGroupService.createBusinessGroup(identity, groupName + " _" + i, groupDescription, -1, -1, false, false, re);
i++;
}
log.debug("createAndPersistBusinessGroup businessgroup=" + accountManagerGroup);
if (accountManagerGroupProperty != null) {
accountManagerGroupProperty.setLongValue(accountManagerGroup.getKey());
cpm.updateProperty(accountManagerGroupProperty);
} else {
saveAccountManagerGroupKey(accountManagerGroup.getKey(), cpm, courseNode);
}
log.debug("created account-manager default businessgroup=" + accountManagerGroup);
}
} catch (AssertException e) {
log.error("", e);
if (tryToRepareAccountManagerProperty(cpm, courseNode)) {
accountManagerGroup = getAccountManagerGroupFor(cpm, courseNode, course, groupName, groupDescription, identity);
}
}
return accountManagerGroup;
}
use of org.olat.core.logging.AssertException in project OpenOLAT by OpenOLAT.
the class CourseEditorTreeModel method addCourseNode.
/**
* append new course
* @param newNode
* @param parentNode
*/
public CourseEditorTreeNode addCourseNode(CourseNode newNode, CourseNode parentNode) {
// update editor tree model
CourseEditorTreeNode ctnParent = (CourseEditorTreeNode) getNodeById(parentNode.getIdent());
if (ctnParent == null)
throw new AssertException("Corrupt CourseEditorTreeModel.");
CourseEditorTreeNode newCetn = new CourseEditorTreeNode(newNode);
newCetn.setNewnode(true);
newCetn.setDirty(true);
ctnParent.addChild(newCetn);
log.debug("addCourseNode - nodeId: " + newNode.getIdent());
return newCetn;
}
use of org.olat.core.logging.AssertException in project OpenOLAT by OpenOLAT.
the class CourseEditorTreeModel method removeCourseNode.
/**
* @deprecated REVIEW:pb: no longer used? it is not referenced from java, and
* also not found in velocity *.html
* @param courseNode
*/
public void removeCourseNode(CourseNode courseNode) {
CourseEditorTreeNode cetNode = (CourseEditorTreeNode) getNodeById(courseNode.getIdent());
if (cetNode == null)
throw new AssertException("Corrupt CourseEditorTreeModel.");
cetNode.removeFromParent();
}
Aggregations