use of jakarta.annotation.PostConstruct in project OpenGrok by OpenGrok.
the class IncomingFilter method init.
@PostConstruct
public void init() {
try {
localAddresses.add(InetAddress.getLocalHost().getHostAddress());
for (InetAddress inetAddress : InetAddress.getAllByName("localhost")) {
localAddresses.add(inetAddress.getHostAddress());
}
} catch (IOException e) {
LOGGER.log(Level.SEVERE, "Could not get localhost addresses", e);
}
// Cache the tokens to avoid locking.
setTokens(RuntimeEnvironment.getInstance().getAuthenticationTokens());
RuntimeEnvironment.getInstance().registerListener(this);
}
use of jakarta.annotation.PostConstruct in project rubia-forums by flashboss.
the class ViewMyForumsMain method execute.
/**
*/
@PostConstruct
public void execute() {
try {
super.execute();
Collection<ForumBean> forums = getWatchedForums();
Date userLastLogin = getUserLastLoginDate(userModule, userProfileModule);
for (ForumBean currentForum : forums) {
// setup folderLook based on whats specified in the theme
String folderImage = themeHelper.getResourceForumURL();
// bundle key
String folderAlt = "No_new_posts";
if (forumsLastPosts != null && forumsLastPosts.containsKey(currentForum.getId())) {
PostBean lastPost = forumsLastPosts.get(currentForum.getId());
Date lastPostDate = lastPost.getCreateDate();
if (lastPostDate != null && userLastLogin != null && lastPostDate.compareTo(userLastLogin) > 0) {
// bundle key
folderAlt = "New_posts";
folderImage = themeHelper.getResourceForumNewURL();
}
}
if (currentForum.getStatus() == Constants.FORUM_LOCKED) {
folderImage = themeHelper.getResourceForumLockedURL();
// bundle key
folderAlt = "Forum_locked";
}
getForumImages().put(currentForum.getId(), folderImage);
getForumImageDescriptions().put(currentForum.getId(), folderAlt);
}
} catch (Exception e) {
log.error(e);
}
}
use of jakarta.annotation.PostConstruct in project rubia-forums by flashboss.
the class ViewTopic method execute.
/**
* This method gets topicId from parameters and tries to find topic with that
* id.
*/
@PostConstruct
public void execute() {
// parse input data
int topicId = -1;
Integer postId = -1;
String t = getParameter(p_topicId);
String p = getParameter(p_postId);
if (t != null && t.trim().length() > 0) {
topicId = parseInt(t);
}
try {
if (p != null && p.trim().length() > 0) {
postId = parseInt(p);
PostBean post = forumsModule.findPostById(postId);
topicId = post.getTopic().getId().intValue();
topic = post.getTopic();
}
refreshTopic(topicId);
} catch (Exception e) {
log.error(e);
}
}
use of jakarta.annotation.PostConstruct in project rubia-forums by flashboss.
the class ViewCategory method execute.
// ui actions supported by this
// bean----------------------------------------------------------------------------------------------------
/**
* this generates the category and its corresponding forums
*/
@PostConstruct
public void execute() {
try {
// try to extract categoryId
int categoryId = -1;
String c = getParameter(p_categoryId);
if (c != null && c.trim().length() > 0) {
categoryId = Integer.parseInt(c);
// Setting flag that category has been selected.
categorySelected = true;
}
// Luca Stancapiano start
// get the forumInstanceId where this forum should be added
int forumInstanceId = userPreferences.getForumInstanceId();
this.forumLastPosts = forumsModule.findLastPostsOfForums(forumInstanceId);
// setup category related data to be displayed
if (categoryId == -1) {
// process a default level category
// Luca Stancapiano
Collection<CategoryBean> cour = forumsModule.findCategoriesFetchForums(forumInstanceId);
if (cour != null) {
for (CategoryBean currentCategory : cour) processCategory(currentCategory);
}
} else {
// process the specifed category
CategoryBean currentCategory = forumsModule.findCategoryById(categoryId);
if (currentCategory != null) {
processCategory(currentCategory);
}
}
} catch (Exception e) {
handleException(e);
}
}
use of jakarta.annotation.PostConstruct in project rubia-forums by flashboss.
the class AdminController method startService.
/**
* Start the admin controller as service
*/
@PostConstruct
public void startService() {
try {
// load the selected category if a categoryid is found
// fetch the category to be edited/deleted
int categoryId = -1;
String cour = getParameter(p_categoryId);
if (cour != null && cour.trim().length() > 0) {
categoryId = parseInt(cour);
}
if (categoryId != -1) {
CategoryBean category = null;
try {
category = forumsModule.findCategoryById(categoryId);
} catch (ModuleException e) {
// Category was deleted
}
if (category != null) {
categoryName = category.getTitle();
selectedCategory = category.getId().intValue();
}
}
// load the selected forum is a forumid is found
// fetch the forum to be edited/deleted
int forumId = -1;
String forumIdStr = getParameter(p_forumId);
if (forumIdStr != null && forumIdStr.trim().length() > 0) {
forumId = parseInt(forumIdStr);
}
if (forumId != -1) {
ForumBean forum = null;
try {
forum = forumsModule.findForumById(forumId);
} catch (ModuleException e) {
// Forum was deleted
}
if (forum != null) {
forumName = forum.getName();
forumDescription = forum.getDescription();
selectedCategory = forum.getCategory().getId().intValue();
selectedForum = forum.getId().intValue();
}
}
// Checking for editModes flags
String editCatStr = getParameter(EDIT_CATEGORY);
if (editCatStr != null && editCatStr.trim().length() > 0) {
editCategoryMode = Boolean.valueOf(editCatStr).booleanValue();
}
String editForStr = getParameter(EDIT_FORUM);
if (editForStr != null && editForStr.trim().length() > 0) {
editForumMode = Boolean.valueOf(editForStr).booleanValue();
}
// Checking for addModes flags
String addCatStr = getParameter(ADD_CATEGORY);
if (addCatStr != null && addCatStr.trim().length() > 0) {
addCategoryMode = Boolean.valueOf(addCatStr).booleanValue();
}
String addForStr = getParameter(ADD_FORUM);
if (addForStr != null && addForStr.trim().length() > 0) {
addForumMode = Boolean.valueOf(addForStr).booleanValue();
}
} catch (Exception e) {
handleException(e);
}
}
Aggregations