use of javax.interceptor.Interceptors in project rubia-forums by flashboss.
the class ViewMyForumsBase method execute.
/**
* @throws Exception
* an error exception is launched
*/
@SecureActionForum
@Interceptors(AuthorizationListener.class)
public void execute() throws Exception {
Collection<Topic> topics = getWatchedTopics();
// minipaging
if (topics != null) {
for (Topic courTopic : topics) {
if (courTopic.getReplies() > 0) {
PageNavigator topicNav = new PageNavigator(courTopic.getReplies() + 1, // this
getUserPreferences().getPostsPerTopic(), // current page of the navigator
0) {
/**
*/
private static final long serialVersionUID = 1L;
protected Collection<Integer> initializePage() {
return null;
}
};
topicNavigator.put(courTopic.getId(), topicNav);
}
}
}
}
use of javax.interceptor.Interceptors in project rubia-forums by flashboss.
the class ViewMyForumsMain method getWatchedTopics.
/**
* @return the watched topics
*/
@SecureActionForum
@Interceptors(AuthorizationListener.class)
public Collection<Topic> getWatchedTopics() {
if (watchedTopics == null) {
try {
Date lastLoginDate = getUserLastLoginDate(userModule, userProfileModule);
if (lastLoginDate == null) {
return watchedTopics;
}
// get the forumInstanceId where this forum should be added
int forumInstanceId = userPreferences.getForumInstanceId();
watchedTopics = forumsModule.findTopicWatchedByUser(getUser(userModule), lastLoginDate, forumInstanceId);
} catch (Exception e) {
handleException(e);
}
}
return watchedTopics;
}
use of javax.interceptor.Interceptors 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 javax.interceptor.Interceptors in project rubia-forums by flashboss.
the class AdminController method editCategory.
/**
* edit category
*
* @return the navigation state of the application
*/
@SecureActionForum
@Interceptors(AuthorizationListener.class)
public String editCategory() {
String navState = null;
boolean success = false;
try {
int categoryId = -1;
String cour = ForumUtil.getParameter(p_categoryId);
if (cour != null && cour.trim().length() > 0) {
categoryId = Integer.parseInt(cour);
}
// grab the category from the module and set the title
Category category = forumsModule.findCategoryById(categoryId);
category.setTitle(categoryName);
forumsModule.update(category);
String start = getBundleMessage("ResourceJSF", "Category_updated_0");
String end = getBundleMessage("ResourceJSF", "Category_updated_1");
setMessage(FEEDBACK, start + " \"" + categoryName + "\" " + end);
navState = "";
success = true;
} catch (Exception e) {
handleException(e);
} finally {
if (success) {
// cleanup the state
cleanup();
}
}
return navState;
}
use of javax.interceptor.Interceptors in project rubia-forums by flashboss.
the class EditPost method start.
// action processing
// methods-----------------------------------------------------------------------------------------------------
/**
* @return the navigation state of the application
*/
@SecureActionForum
@Interceptors(AuthorizationListener.class)
public String start() {
String navState = null;
try {
int postId = -1;
String p = getParameter(p_postId);
if (p != null && p.trim().length() > 0) {
postId = parseInt(p);
}
// grab the post information
if (postId != -1) {
// re-initialize this controller to edit the specified post
cleanup();
// get the post from the module
Post post = forumsModule.findPostById(postId);
Topic topic = post.getTopic();
// set the selected post's topic id
topicId = topic.getId().intValue();
this.postId = postId;
// set the subject of the post
subject = post.getMessage().getSubject();
// set the message of the post
message = post.getMessage().getText();
// set the topicType
topicType = topic.getType();
// setup poll related information
setupPoll(topic.getPoll());
attachments = forumsModule.findAttachments(post);
// setup the attachment related information
List<Post> posts = forumsModule.findPostsByTopicId(topic);
isFirstPost = false;
if (posts.get(0).getId().intValue() == post.getId().intValue()) {
isFirstPost = true;
}
}
navState = START_EDIT_POST;
} catch (Exception e) {
handleException(e);
}
return navState;
}
Aggregations