use of it.vige.rubia.model.ForumInstance in project rubia-forums by flashboss.
the class ForumsModuleImpl method removeForumInstance.
@Override
public void removeForumInstance(int forumInstanceId) throws ModuleException {
try {
ForumInstance forumInstance = em.find(ForumInstance.class, forumInstanceId);
em.remove(forumInstance);
// it is required
em.flush();
// for clustered versions
} catch (Exception e) {
String errorMessage = "Cannot delete forum Instance";
throw new ModuleException(errorMessage, e);
}
}
use of it.vige.rubia.model.ForumInstance in project rubia-forums by flashboss.
the class AdminController method addCategory.
// ----actions---------------------------------------------------------------------------------------------------------------------------
/**
* adds a category
*
* @return the navigation state of the application
*/
@SecureActionForum
@Interceptors(AuthorizationListener.class)
public String addCategory() {
String navState = null;
boolean success = false;
try {
// get the forumInstanceId where this forum should be added
int forumInstanceId = userPreferences.getForumInstanceId();
// add this new category to the forum instance
ForumInstance forumInstance = forumsModule.findForumInstanceById(forumInstanceId);
forumsModule.createCategory(categoryName, forumInstance);
String start = getBundleMessage("ResourceJSF", "Category_created_0");
String end = getBundleMessage("ResourceJSF", "Category_created_1");
setMessage(FEEDBACK, start + " \"" + categoryName + "\" " + end);
success = true;
} catch (Exception e) {
handleException(e);
} finally {
if (success) {
// cleanup the state
cleanup();
}
}
return navState;
}
use of it.vige.rubia.model.ForumInstance in project rubia-forums by flashboss.
the class ForumsModuleImpl method createForumInstance.
/**
* @see it.vige.rubia.ForumsModule#createForumInstance(java.lang.Integer,
* java.lang.String)
*/
@Override
public ForumInstance createForumInstance(Integer indexInstance, String name) throws ModuleException {
try {
ForumInstance forumInstance = new ForumInstance();
forumInstance.setId(indexInstance);
forumInstance.setName(name);
em.persist(forumInstance);
// it is required
em.flush();
// for clustered versions
return forumInstance;
} catch (Exception e) {
String errorMessage = "Cannot create forum Instance";
throw new ModuleException(errorMessage, e);
}
}
Aggregations