From: Roland Häder Date: Wed, 24 Aug 2016 15:56:57 +0000 (+0200) Subject: Please cherry-pick: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=bd8e0cd39477151e8fad601e8ff5f4048aa2ab80;p=jjobs-war.git Please cherry-pick: - added controller (bean class + local interface) for user activity log Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/jjobs/beans/user/activity/JobsUserActivityWebApplicationBean.java b/src/java/org/mxchange/jjobs/beans/user/activity/JobsUserActivityWebApplicationBean.java new file mode 100644 index 00000000..55ee3f20 --- /dev/null +++ b/src/java/org/mxchange/jjobs/beans/user/activity/JobsUserActivityWebApplicationBean.java @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2016 Roland Haeder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package org.mxchange.jjobs.beans.user.activity; + +import java.util.LinkedList; +import java.util.List; +import javax.enterprise.context.ApplicationScoped; +import javax.faces.view.facelets.FaceletException; +import javax.inject.Named; +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; +import org.mxchange.jjobs.beans.BaseJobsController; +import org.mxchange.jusercore.model.user.activity.LogableUserActivity; +import org.mxchange.jusercore.model.user.activity.UserActivityLogSessionBeanRemote; + +/** + * A controller (bean) for user activity log + *

+ * @author Roland Haeder + */ +@Named ("userActivityController") +@ApplicationScoped +public class JobsUserActivityWebApplicationBean extends BaseJobsController implements JobsUserActivityWebApplicationController { + + /** + * Serial number + */ + private static final long serialVersionUID = 192_586_376_717_856_904L; + + /** + * "Cache" for activity log per user + */ + private final List activityList; + + /** + * EJB for user activity log + */ + private UserActivityLogSessionBeanRemote userActivityBean; + + /** + * Default constructor + */ + public JobsUserActivityWebApplicationBean () { + // Try to get EJB instance + try { + // Get initial context + Context context = new InitialContext(); + + // Try to lookup + this.userActivityBean = (UserActivityLogSessionBeanRemote) context.lookup("java:global/jlandingpage-ejb/userActivity!org.mxchange.jusercore.model.user.activity.UserActivityLogSessionBeanRemote"); //NOI18N + } catch (final NamingException e) { + // Throw again + throw new FaceletException(e); + } + + // Init cache + this.activityList = new LinkedList<>(); + } + +} diff --git a/src/java/org/mxchange/jjobs/beans/user/activity/JobsUserActivityWebApplicationController.java b/src/java/org/mxchange/jjobs/beans/user/activity/JobsUserActivityWebApplicationController.java new file mode 100644 index 00000000..d2e54bfc --- /dev/null +++ b/src/java/org/mxchange/jjobs/beans/user/activity/JobsUserActivityWebApplicationController.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2016 Roland Haeder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package org.mxchange.jjobs.beans.user.activity; + +import java.io.Serializable; +import javax.ejb.Local; + +/** + * A controller (bean) interface for user activity log + *

+ * @author Roland Haeder + */ +@Local +public interface JobsUserActivityWebApplicationController extends Serializable { + +}