]> git.mxchange.org Git - jjobs-war.git/commitdiff
Continued with refacturing:
authorRoland Häder <roland@mxchange.org>
Tue, 19 Apr 2016 15:55:11 +0000 (17:55 +0200)
committerRoland Haeder <roland@mxchange.org>
Tue, 19 Apr 2016 18:23:39 +0000 (20:23 +0200)
- added general admin helper for just holding objects
- used that new helper for user instance to have auto-completition back
- updated properties

Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/jjobs/beans/helper/JobsAdminWebRequestController.java [new file with mode: 0644]
src/java/org/mxchange/jjobs/beans/helper/JobsAdminWebRequestHelper.java [new file with mode: 0644]
web/admin/user/admin_user_delete.xhtml
web/admin/user/admin_user_edit.xhtml
web/admin/user/admin_user_show.xhtml
web/admin/user/admin_user_unlock.xhtml

diff --git a/src/java/org/mxchange/jjobs/beans/helper/JobsAdminWebRequestController.java b/src/java/org/mxchange/jjobs/beans/helper/JobsAdminWebRequestController.java
new file mode 100644 (file)
index 0000000..a063cfd
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2016 Cho-Time GmbH
+ *
+ * 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.helper;
+
+import java.io.Serializable;
+import org.mxchange.jusercore.model.user.User;
+
+/**
+ * An interface for general bean helper
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+public interface JobsAdminWebRequestController extends Serializable {
+
+       /**
+        * Getter for user instance
+        * <p>
+        * @return User instance
+        */
+       User getUser ();
+
+       /**
+        * Setter for user instance
+        * <p>
+        * @param user User instance
+        */
+       void setUser (final User user);
+
+}
diff --git a/src/java/org/mxchange/jjobs/beans/helper/JobsAdminWebRequestHelper.java b/src/java/org/mxchange/jjobs/beans/helper/JobsAdminWebRequestHelper.java
new file mode 100644 (file)
index 0000000..01eff4e
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2016 Cho-Time GmbH
+ *
+ * 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.helper;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Named;
+import org.mxchange.jusercore.model.user.User;
+
+/**
+ * A general helper for beans
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+@Named ("adminHelper")
+@RequestScoped
+public class JobsAdminWebRequestHelper implements JobsAdminWebRequestController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 17_258_793_567_145_701L;
+
+       /**
+        * User instance
+        */
+       private User user;
+
+       /**
+        * Default constructor
+        */
+       public JobsAdminWebRequestHelper () {
+       }
+
+       @Override
+       public User getUser () {
+               return this.user;
+       }
+
+       @Override
+       public void setUser (final User user) {
+               this.user = user;
+       }
+
+}
index 176979d07028ff00e253582687157ed9619707b0..0fdcb19947c3ad782deec6f2e934d02d5b8c7027 100644 (file)
@@ -9,7 +9,7 @@
        >
 
        <f:metadata>
-               <f:viewParam name="userId" value="#{user}" converter="UserConverter" required="true" requiredMessage="#{msg.ERROR_PARAMETER_USER_ID_NOT_SET}" />
+               <f:viewParam name="userId" value="#{adminHelper.user}" converter="UserConverter" required="true" requiredMessage="#{msg.ERROR_PARAMETER_USER_ID_NOT_SET}" />
        </f:metadata>
 
        <ui:composition template="/WEB-INF/templates/admin/admin_base.tpl">
@@ -20,7 +20,7 @@
                </ui:define>
 
                <ui:define name="content">
-                       <h:outputText styleClass="errors" value="#{msg.ERROR_USER_ID_NOT_FOUND}" rendered="#{empty user}" />
+                       <h:outputText styleClass="errors" value="#{msg.ERROR_USER_ID_NOT_FOUND}" rendered="#{empty adminHelper.user}" />
 
                        Here goes your content.
                </ui:define>
index 8c8523be10a9f49d87ebe7a60e9611a6a83f086a..4d3c97fe8aace47a02efc8a6a31bef75e91718f6 100644 (file)
@@ -9,7 +9,7 @@
        >
 
        <f:metadata>
-               <f:viewParam name="userId" value="#{user}" converter="UserConverter" required="true" requiredMessage="#{msg.ERROR_PARAMETER_USER_ID_NOT_SET}" />
+               <f:viewParam name="userId" value="#{adminHelper.user}" converter="UserConverter" required="true" requiredMessage="#{msg.ERROR_PARAMETER_USER_ID_NOT_SET}" />
        </f:metadata>
 
        <ui:composition template="/WEB-INF/templates/admin/admin_base.tpl">
@@ -20,7 +20,7 @@
                </ui:define>
 
                <ui:define name="content">
-                       <h:outputText styleClass="errors" value="#{msg.ERROR_USER_ID_NOT_FOUND}" rendered="#{empty user}" />
+                       <h:outputText styleClass="errors" value="#{msg.ERROR_USER_ID_NOT_FOUND}" rendered="#{empty adminHelper.user}" />
 
                        Here goes your content.
                </ui:define>
index 2e45ef7344c5235c9530b4de9d2d49511a8ddcc5..9d92637551fa8c2a788a64eeabc5ba5adbebf016 100644 (file)
@@ -9,7 +9,7 @@
        >
 
        <f:metadata>
-               <f:viewParam name="userId" value="#{user}" converter="UserConverter" required="true" requiredMessage="#{msg.ERROR_PARAMETER_USER_ID_NOT_SET}" />
+               <f:viewParam name="userId" value="#{adminHelper.user}" converter="UserConverter" required="true" requiredMessage="#{msg.ERROR_PARAMETER_USER_ID_NOT_SET}" />
        </f:metadata>
 
        <ui:composition template="/WEB-INF/templates/admin/admin_base.tpl">
                </ui:define>
 
                <ui:define name="content">
-                       <h:outputText styleClass="errors" value="#{msg.ERROR_USER_ID_NOT_FOUND}" rendered="#{empty user}" />
+                       <h:outputText styleClass="errors" value="#{msg.ERROR_USER_ID_NOT_FOUND}" rendered="#{empty adminHelper.user}" />
 
-                       <h:panelGrid id="user_profile" summary="#{msg.ADMIN_TABLE_SUMMARY_SHOW_USER}" headerClass="table_header_column" styleClass="table_big" columns="3" rendered="#{not empty user}">
+                       <h:panelGrid id="user_profile" summary="#{msg.ADMIN_TABLE_SUMMARY_SHOW_USER}" headerClass="table_header_column" styleClass="table_big" columns="3" rendered="#{not empty adminHelper.user}">
                                <f:facet name="header">
                                        <h:outputFormat value="#{msg.ADMIN_HEADER_SHOW_USER}">
-                                               <f:param value="#{user.userName}" />
-                                               <f:param value="#{user.userId}" />
+                                               <f:param value="#{adminHelper.user.userName}" />
+                                               <f:param value="#{adminHelper.user.userId}" />
                                        </h:outputFormat>
                                </f:facet>
 
                                <h:column>
                                        <h:outputLabel for="userId" styleClass="data_label" value="#{msg.ADMIN_SHOW_USER_ID}" />
 
-                                       <h:outputText id="userId" styleClass="data_field" value="#{user.userId}" />
+                                       <h:outputText id="userId" styleClass="data_field" value="#{adminHelper.user.userId}" />
                                </h:column>
 
                                <h:column>
                                        <h:outputLabel for="userName" styleClass="data_label" value="#{msg.ADMIN_SHOW_USER_NAME}" />
 
-                                       <h:outputText id="userName" styleClass="data_field" value="#{user.userName}" />
+                                       <h:outputText id="userName" styleClass="data_field" value="#{adminHelper.user.userName}" />
                                </h:column>
 
                                <h:column>
                                        <h:outputLabel for="userCreated" styleClass="data_label" value="#{msg.ADMIN_SHOW_USER_CREATED}" />
 
-                                       <h:outputText id="userCreated" styleClass="data_field" value="#{user.userCreated.time}">
+                                       <h:outputText id="userCreated" styleClass="data_field" value="#{adminHelper.user.userCreated.time}">
                                                <f:convertDateTime for="userCreated" type="both" />
                                        </h:outputText>
                                </h:column>
@@ -53,7 +53,7 @@
                                <h:column>
                                        <h:outputLabel for="userUpdated" styleClass="data_label" value="#{msg.ADMIN_SHOW_USER_UPDATED}" />
 
-                                       <h:outputText id="userUpdated" styleClass="data_field" value="#{user.userUpdated.time}">
+                                       <h:outputText id="userUpdated" styleClass="data_field" value="#{adminHelper.user.userUpdated.time}">
                                                <f:convertDateTime for="userUpdated" type="both" />
                                        </h:outputText>
                                </h:column>
                                <h:column>
                                        <h:outputLabel for="userAccountStatus" styleClass="data_label" value="#{msg.ADMIN_SHOW_USER_ACCOUNT_STATUS}" />
 
-                                       <h:outputText id="userAccountStatus" styleClass="data_field #{user.userAccountStatus.styleClass}" value="#{msg[user.userAccountStatus.messageKey]}" />
+                                       <h:outputText id="userAccountStatus" styleClass="data_field #{adminHelper.user.userAccountStatus.styleClass}" value="#{msg[adminHelper.user.userAccountStatus.messageKey]}" />
                                </h:column>
 
                                <h:column>
                                        <h:outputLabel for="userProfileMode" styleClass="data_label" value="#{msg.ADMIN_SHOW_USER_PROFILE_MODE}" />
 
-                                       <h:outputText id="userProfileMode" styleClass="data_field" value="#{msg[user.userProfileMode.messageKey]}" />
+                                       <h:outputText id="userProfileMode" styleClass="data_field" value="#{msg[adminHelper.user.userProfileMode.messageKey]}" />
                                </h:column>
 
                                <h:column>
                                        <h:outputLabel for="userLastLocked" styleClass="data_label" value="#{msg.ADMIN_SHOW_USER_LAST_LOCKED}" />
 
-                                       <h:outputText id="userLastLocked" styleClass="data_field" value="#{user.userLastLocked.time}">
+                                       <h:outputText id="userLastLocked" styleClass="data_field" value="#{adminHelper.user.userLastLocked.time}">
                                                <f:convertDateTime for="userLastLocked" type="both" />
                                        </h:outputText>
                                </h:column>
                                <h:column>
                                        <h:outputLabel for="lastLockedReason" styleClass="data_label" value="#{msg.ADMIN_SHOW_USER_LAST_LOCKED_REASON}" />
 
-                                       <h:outputText id="lastLockedReason" styleClass="data_field" value="#{user.lastLockedReason}" />
+                                       <h:outputText id="lastLockedReason" styleClass="data_field" value="#{adminHelper.user.lastLockedReason}" />
                                </h:column>
 
                                <h:column>
                                        <h:outputLabel for="contactCreated" styleClass="data_label" value="#{msg.ADMIN_SHOW_USER_CONTACT_CREATED}" />
 
-                                       <h:outputText id="contactCreated" styleClass="data_field" value="#{user.userContact.contactCreated.time}">
+                                       <h:outputText id="contactCreated" styleClass="data_field" value="#{adminHelper.user.userContact.contactCreated.time}">
                                                <f:convertDateTime for="contactCreated" type="both" />
                                        </h:outputText>
                                </h:column>
@@ -95,7 +95,7 @@
                                <h:column>
                                        <h:outputLabel for="contactUpdated" styleClass="data_label" value="#{msg.ADMIN_SHOW_USER_CONTACT_UPDATED}" />
 
-                                       <h:outputText id="contactUpdated" styleClass="data_field" value="#{user.userContact.contactUpdated.time}">
+                                       <h:outputText id="contactUpdated" styleClass="data_field" value="#{adminHelper.user.userContact.contactUpdated.time}">
                                                <f:convertDateTime for="contactUpdated" type="both" />
                                        </h:outputText>
                                </h:column>
                                <h:column>
                                        <h:outputLabel for="isOwnContact" styleClass="data_label" value="#{msg.ADMIN_SHOW_USER_IS_OWN_CONTACT}" />
 
-                                       <h:outputText id="isOwnContact" styleClass="data_field" value="#{user.userContact.isOwnContact()}" />
+                                       <h:outputText id="isOwnContact" styleClass="data_field" value="#{adminHelper.user.userContact.isOwnContact()}" />
                                </h:column>
 
                                <h:column>
                                        <h:outputLabel for="contactGender" styleClass="data_label" value="#{msg.ADMIN_SHOW_USER_GENDER}" />
 
-                                       <h:outputText id="contactGender" styleClass="data_field" value="#{msg[user.userContact.contactGender.messageKey]}" />
+                                       <h:outputText id="contactGender" styleClass="data_field" value="#{msg[adminHelper.user.userContact.contactGender.messageKey]}" />
                                </h:column>
 
                                <h:column>
                                        <h:outputLabel for="contactTitle" styleClass="data_label" value="#{msg.ADMIN_SHOW_USER_TITLE}" />
 
-                                       <h:outputText id="contactTitle" styleClass="data_field" value="#{user.userContact.contactTitle}" />
+                                       <h:outputText id="contactTitle" styleClass="data_field" value="#{adminHelper.user.userContact.contactTitle}" />
                                </h:column>
 
                                <h:column>
                                        <h:outputLabel for="contactFirstName" styleClass="data_label" value="#{msg.ADMIN_SHOW_USER_FIRST_NAME}" />
 
-                                       <h:outputText id="contactFirstName" styleClass="data_field" value="#{user.userContact.contactFirstName}" />
+                                       <h:outputText id="contactFirstName" styleClass="data_field" value="#{adminHelper.user.userContact.contactFirstName}" />
                                </h:column>
 
                                <h:column>
                                        <h:outputLabel for="contactFamilyName" styleClass="data_label" value="#{msg.ADMIN_SHOW_USER_FAMILY_NAME}" />
 
-                                       <h:outputText id="contactFamilyName" styleClass="data_field" value="#{user.userContact.contactFamilyName}" />
+                                       <h:outputText id="contactFamilyName" styleClass="data_field" value="#{adminHelper.user.userContact.contactFamilyName}" />
                                </h:column>
 
                                <h:column>
                                        <h:outputLabel for="contactStreet" styleClass="data_label" value="#{msg.ADMIN_SHOW_USER_STREET}" />
 
-                                       <h:outputText id="contactStreet" styleClass="data_field" value="#{user.userContact.contactStreet}" />
+                                       <h:outputText id="contactStreet" styleClass="data_field" value="#{adminHelper.user.userContact.contactStreet}" />
                                </h:column>
 
                                <h:column>
                                        <h:outputLabel for="contactHouseNumber" styleClass="data_label" value="#{msg.ADMIN_SHOW_USER_HOUSE_NUMBER}" />
 
-                                       <h:outputText id="contactHouseNumber" styleClass="data_field" value="#{user.userContact.contactHouseNumber}" />
+                                       <h:outputText id="contactHouseNumber" styleClass="data_field" value="#{adminHelper.user.userContact.contactHouseNumber}" />
                                </h:column>
 
                                <h:column>
                                        <h:outputLabel for="contactZipCode" styleClass="data_label" value="#{msg.ADMIN_SHOW_USER_ZIP_CODE}" />
 
-                                       <h:outputText id="contactZipCode" styleClass="data_field" value="#{user.userContact.contactZipCode}" />
+                                       <h:outputText id="contactZipCode" styleClass="data_field" value="#{adminHelper.user.userContact.contactZipCode}" />
                                </h:column>
 
                                <h:column>
                                        <h:outputLabel for="contactCity" styleClass="data_label" value="#{msg.ADMIN_SHOW_USER_CITY}" />
 
-                                       <h:outputText id="contactCity" styleClass="data_field" value="#{user.userContact.contactCity}" />
+                                       <h:outputText id="contactCity" styleClass="data_field" value="#{adminHelper.user.userContact.contactCity}" />
                                </h:column>
 
                                <h:column>
                                        <h:outputLabel for="contactEmailAddress" styleClass="data_label" value="#{msg.ADMIN_SHOW_USER_EMAIL_ADDRESS}" />
 
-                                       <h:outputLink id="contactEmailAddress" styleClass="data_field" value="mailto:#{user.userContact.contactEmailAddress}">
-                                               <h:outputText value="#{user.userContact.contactEmailAddress}" />
+                                       <h:outputLink id="contactEmailAddress" styleClass="data_field" value="mailto:#{adminHelper.user.userContact.contactEmailAddress}">
+                                               <h:outputText value="#{adminHelper.user.userContact.contactEmailAddress}" />
                                        </h:outputLink>
                                </h:column>
 
                                <h:column>
                                        <h:outputLabel for="contactBirthday" styleClass="data_label" value="#{msg.ADMIN_SHOW_USER_BIRTHDAY}" />
 
-                                       <h:outputText id="contactBirthday" styleClass="data_field" value="#{user.userContact.contactBirthday.time}">
+                                       <h:outputText id="contactBirthday" styleClass="data_field" value="#{adminHelper.user.userContact.contactBirthday.time}">
                                                <f:convertDateTime for="contactBirthday" type="date" />
                                        </h:outputText>
                                </h:column>
                        </h:panelGrid>
 
                        <ui:include src="/WEB-INF/templates/admin/user/admin_user_links.tpl">
-                               <ui:param name="user" value="#{user}" />
+                               <ui:param name="user" value="#{adminHelper.user}" />
                        </ui:include>
 
                        <ui:include src="/WEB-INF/templates/admin/cellphone/admin_cellphone_add_show.tpl">
-                               <ui:param name="cellphoneNumber" value="#{user.userContact.contactCellphoneNumber}" />
-                               <ui:param name="user" value="#{user}" />
+                               <ui:param name="cellphoneNumber" value="#{adminHelper.user.userContact.contactCellphoneNumber}" />
+                               <ui:param name="user" value="#{adminHelper.user}" />
                        </ui:include>
                </ui:define>
        </ui:composition>
index da2dd766efe89e2428861ab06a0f74d86472b0ed..fe96f5512baed7fceab3e970ce1e017cb8e154d7 100644 (file)
@@ -9,7 +9,7 @@
        >
 
        <f:metadata>
-               <f:viewParam name="userId" value="#{user}" converter="UserConverter" required="true" requiredMessage="#{msg.ERROR_PARAMETER_USER_ID_NOT_SET}" />
+               <f:viewParam name="userId" value="#{adminHelper.user}" converter="UserConverter" required="true" requiredMessage="#{msg.ERROR_PARAMETER_USER_ID_NOT_SET}" />
        </f:metadata>
 
        <ui:composition template="/WEB-INF/templates/admin/admin_base.tpl">
@@ -20,7 +20,7 @@
                </ui:define>
 
                <ui:define name="content">
-                       <h:outputText styleClass="errors" value="#{msg.ERROR_USER_ID_NOT_FOUND}" rendered="#{empty user}" />
+                       <h:outputText styleClass="errors" value="#{msg.ERROR_USER_ID_NOT_FOUND}" rendered="#{empty adminHelper.user}" />
 
                        Here goes your content.
                </ui:define>