]> git.mxchange.org Git - jjobs-war.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Wed, 24 Aug 2016 15:56:57 +0000 (17:56 +0200)
committerRoland Haeder <roland@mxchange.org>
Wed, 24 Aug 2016 19:55:17 +0000 (21:55 +0200)
- added controller (bean class + local interface) for user activity log

Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/jjobs/beans/user/activity/JobsUserActivityWebApplicationBean.java [new file with mode: 0644]
src/java/org/mxchange/jjobs/beans/user/activity/JobsUserActivityWebApplicationController.java [new file with mode: 0644]

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 (file)
index 0000000..55ee3f2
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2016 Roland Haeder<rhaeder@cho-time.de>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+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
+ * <p>
+ * @author Roland Haeder<rhaeder@cho-time.de>
+ */
+@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<LogableUserActivity> 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 (file)
index 0000000..d2e54bf
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2016 Roland Haeder<rhaeder@cho-time.de>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jjobs.beans.user.activity;
+
+import java.io.Serializable;
+import javax.ejb.Local;
+
+/**
+ * A controller (bean) interface for user activity log
+ * <p>
+ * @author Roland Haeder<rhaeder@cho-time.de>
+ */
+@Local
+public interface JobsUserActivityWebApplicationController extends Serializable {
+
+}