use of jakarta.annotation.PostConstruct in project faces by jakartaee.
the class Spec329 method init.
@PostConstruct
public void init() {
entityList = new ArrayList<>();
entityList.add(new Spec329Entity("one"));
entityList.add(new Spec329Entity("two"));
entityList.add(new Spec329Entity("three"));
selectItemList = new ArrayList<>();
selectItemList.add(new SelectItem("value1", "label1"));
selectItemList.add(new SelectItem("value2", "label2"));
selectItemList.add(new SelectItem("value3", "label3"));
}
use of jakarta.annotation.PostConstruct in project faces by jakartaee.
the class UserBean method init.
@PostConstruct
private void init() {
ApplicationAssociate appAss = ApplicationAssociate.getInstance(extContext);
firstName = "" + appAss.getFaceletFactory().getRefreshPeriod();
}
use of jakarta.annotation.PostConstruct in project rubia-forums by flashboss.
the class ModeratorAction method execute.
@PostConstruct
public void execute() {
try {
// trying to get forumId from request parameter
int forumId = -1;
String f = getParameter(p_forumId);
if (f != null && f.trim().length() > 0) {
forumId = parseInt(f);
}
checkboxes = new HashMap<Integer, Boolean>();
// grab the data to be displayed for this page
if (forumId != -1) {
// setup the business objects like the forum, topics etc that
// will
// be displayed
forum = forumsModule.findForumById(forumId);
} else {
// trying to get forumId from topicId read from request
String t = getParameter(p_topicId);
if (t != null && t.trim().length() > 0) {
TopicBean topic = forumsModule.findTopicById(parseInt(t));
forum = topic.getForum();
} else {
String p = getParameter(p_postId);
if (p != null && p.trim().length() > 0) {
PostBean post = forumsModule.findPostById(parseInt(p));
TopicBean topic = post.getTopic();
forum = topic.getForum();
}
}
}
if (forum != null) {
topics = forumsModule.findTopics(forum);
topicsDataModel = new ListDataModel<TopicBean>(topics);
}
} catch (ModuleException e) {
log.error(e);
}
}
use of jakarta.annotation.PostConstruct in project rubia-forums by flashboss.
the class ViewMyForumsEditAllForums method execute.
/**
*/
@PostConstruct
public void execute() {
Collection<ForumBean> forums = getWatchedForums();
try {
// get the forumInstanceId where this forum should be added
int forumInstanceId = userPreferences.getForumInstanceId();
forumWatches = forumsModule.findForumWatches(getUser(userModule), forumInstanceId);
} catch (Exception e) {
handleException(e);
setForumWatches(new HashMap<Integer, ForumWatchBean>(0));
}
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 = (PostBean) 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() == FORUM_LOCKED) {
folderImage = themeHelper.getResourceForumLockedURL();
// bundle key
folderAlt = "Forum_locked";
}
getForumImages().put(currentForum.getId(), folderImage);
getForumImageDescriptions().put(currentForum.getId(), folderAlt);
}
try {
String t = getRequestParameter(p_forumId);
if (t != null && t.trim().length() > 0) {
forumId = parseInt(t);
} else {
forumId = -1;
}
if (forumId != -1) {
watch = forumsModule.findForumWatchByUserAndForum(getUser(userModule), forumId);
}
} catch (Exception e) {
handleException(e);
forumId = -1;
watch = null;
}
}
use of jakarta.annotation.PostConstruct in project rubia-forums by flashboss.
the class ViewForum method execute.
/**
*/
@PostConstruct
public void execute() {
// parse the input parameters
int forumId = -1;
String f = getParameter(p_forumId);
if (f != null && f.trim().length() > 0) {
forumId = parseInt(f);
}
// ForumsModule is stored as a final variable so that anonymous
// class
// could use it.
final ForumsModule fm = forumsModule;
// grab the data to be displayed for this page
if (forumId != -1) {
// be displayed
try {
forum = fm.findForumById(forumId);
// Getting sticky topics for this page
Collection<TopicBean> stickies = getStickyThreads();
// Getting announcements
Collection<TopicBean> announcements = getAnnouncements();
TopicRequestBean topicRequestBean = new TopicRequestBean();
TopicBean topicBean = new TopicBean();
topicBean.setForum(forum);
topicBean.setType(NORMAL);
topicRequestBean.setTopic(topicBean);
topicRequestBean.setPerPage(MAX_VALUE);
normalThreads = fm.findTopicsDesc(topicRequestBean);
normalThreadsDataModel = new ListDataModel<TopicBean>(normalThreads);
Collection<TopicBean> listOfTopics = new LinkedList<TopicBean>();
listOfTopics.addAll(stickies);
listOfTopics.addAll(announcements);
listOfTopics.addAll(normalThreads);
// Getting sticky topics for this page
topicLastPosts = fm.findLastPostsOfTopics(listOfTopics);
// topic minipaging
for (TopicBean cour : listOfTopics) {
if (cour.getReplies() > 0) {
PageNavigator topicNav = new PageNavigator(cour.getReplies() + 1, // this
userPreferences.getPostsPerTopic(), // current page of the navigator
0) {
/**
*/
private static final long serialVersionUID = 6277599446838264687L;
protected Collection<Integer> initializePage() {
return null;
}
};
topicNavigator.put(cour.getId(), topicNav);
}
}
} catch (ModuleException e) {
handleException(e);
}
}
}
Aggregations