j2ee.compile.on.save=true
j2ee.deploy.on.save=true
j2ee.platform=1.7
-j2ee.platform.classpath=${j2ee.server.home}/modules/endorsed/javax.annotation-api.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar:${j2ee.server.home}/modules/javax.batch-api.jar:${j2ee.server.home}/modules/javax.security.auth.message-api.jar:${j2ee.server.home}/modules/javax.faces.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl-api.jar:${j2ee.server.home}/modules/javax.transaction-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jar:${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/javax.interceptor-api.jar:${j2ee.server.home}/modules/javax.inject.jar:${j2ee.server.home}/modules/javax.resource-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent-api.jar:${j2ee.server.home}/modules/javax.el.jar:${j2ee.server.home}/modules/javax.ejb-api.jar:${j2ee.server.home}/modules/javax.xml.rpc-api.jar:${j2ee.server.home}/modules/javax.security.jacc-api.jar:${j2ee.server.home}/modules/javax.json.jar:${j2ee.server.home}/modules/javax.xml.registry-api.jar:${j2ee.server.home}/modules/javax.websocket-api.jar:${j2ee.server.home}/modules/javax.management.j2ee-api.jar:${j2ee.server.home}/modules/javax.servlet-api.jar:${j2ee.server.home}/modules/javax.jms-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/javax.enterprise.deploy-api.jar:${j2ee.server.home}/modules/javax.ws.rs-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp-api.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/cdi-api.jar:${j2ee.server.home}/modules/javax.persistence.jar:${j2ee.server.middleware}/mq/lib/jaxm-api.jar
+j2ee.platform.classpath=${j2ee.server.home}/modules/endorsed/javax.annotation-api.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar:${j2ee.server.home}/modules/javax.batch-api.jar:${j2ee.server.home}/modules/javax.security.enterprise-api.jar:${j2ee.server.home}/modules/javax.security.enterprise.jar:${j2ee.server.home}/modules/javax.security.auth.message-api.jar:${j2ee.server.home}/modules/javax.faces.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl-api.jar:${j2ee.server.home}/modules/javax.transaction-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jar:${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/javax.interceptor-api.jar:${j2ee.server.home}/modules/javax.inject.jar:${j2ee.server.home}/modules/javax.resource-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent-api.jar:${j2ee.server.home}/modules/javax.el.jar:${j2ee.server.home}/modules/javax.ejb-api.jar:${j2ee.server.home}/modules/javax.xml.rpc-api.jar:${j2ee.server.home}/modules/javax.security.jacc-api.jar:${j2ee.server.home}/modules/javax.json.jar:${j2ee.server.home}/modules/javax.xml.registry-api.jar:${j2ee.server.home}/modules/javax.websocket-api.jar:${j2ee.server.home}/modules/javax.management.j2ee-api.jar:${j2ee.server.home}/modules/javax.servlet-api.jar:${j2ee.server.home}/modules/javax.jms-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/javax.enterprise.deploy-api.jar:${j2ee.server.home}/modules/javax.ws.rs-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp-api.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/cdi-api.jar:${j2ee.server.home}/modules/javax.persistence.jar:${j2ee.server.middleware}/mq/lib/jaxm-api.jar
j2ee.platform.embeddableejb.classpath=${j2ee.server.home}/lib/embedded/glassfish-embedded-static-shell.jar
j2ee.platform.wscompile.classpath=${j2ee.server.home}/modules/webservices-osgi.jar
j2ee.platform.wsgen.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar
import javax.persistence.Query;
import org.mxchange.jcontacts.exceptions.ContactAlreadyAddedException;
import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
-import org.mxchange.jjobs.database.BaseJobsDatabaseBean;
+import org.mxchange.jjobs.beans.ejb.BaseJobsEnterpriseBean;
/**
* An administrative contact EJB
* @author Roland Häder<roland@mxchange.org>
*/
@Stateless (name = "adminContact", description = "An administrative contact EJB")
-public class JobsAdminContactSessionBean extends BaseJobsDatabaseBean implements AdminContactSessionBeanRemote {
+public class JobsAdminContactSessionBean extends BaseJobsEnterpriseBean implements AdminContactSessionBeanRemote {
/**
* Serial number
import javax.persistence.NoResultException;
import javax.persistence.Query;
import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
-import org.mxchange.jjobs.database.BaseJobsDatabaseBean;
+import org.mxchange.jjobs.beans.ejb.BaseJobsEnterpriseBean;
/**
* A contact EJB
* @author Roland Häder<roland@mxchange.org>
*/
@Stateless (name = "contact", description = "A bean handling contact data")
-public class JobsContactSessionBean extends BaseJobsDatabaseBean implements ContactSessionBeanRemote {
+public class JobsContactSessionBean extends BaseJobsEnterpriseBean implements ContactSessionBeanRemote {
/**
* Serial number
import javax.ejb.EJB;
import javax.ejb.Stateless;
import org.mxchange.jcontacts.model.contact.ContactSessionBeanRemote;
-import org.mxchange.jjobs.database.BaseJobsDatabaseBean;
+import org.mxchange.jjobs.beans.ejb.BaseJobsEnterpriseBean;
import org.mxchange.jphone.exceptions.phone.PhoneNumberAlreadyLinkedException;
import org.mxchange.jphone.exceptions.phone.PhoneNumberNotLinkedException;
import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
* @author Roland Häder<roland@mxchange.org>
*/
@Stateless (name = "adminContactPhone", description = "An administrative bean handling contact's phone (fax, land-line and mobile) data")
-public class JobsAdminContactPhoneSessionBean extends BaseJobsDatabaseBean implements AdminContactsPhoneSessionBeanRemote {
+public class JobsAdminContactPhoneSessionBean extends BaseJobsEnterpriseBean implements AdminContactsPhoneSessionBeanRemote {
/**
* Serial number
import org.mxchange.jcontactsbusiness.exceptions.basicdata.BasicDataAlreadyAddedException;
import org.mxchange.jcontactsbusiness.model.employee.Employable;
import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter;
-import org.mxchange.jjobs.database.BaseJobsDatabaseBean;
+import org.mxchange.jjobs.beans.ejb.BaseJobsEnterpriseBean;
import org.mxchange.jusercore.model.user.User;
/**
* @author Roland Häder<roland@mxchange.org>
*/
@Stateless (name = "adminBasicCompanyData", description = "An administrative statless bean for handling business data (all)")
-public class JobsAdminBusinessDataSessionBean extends BaseJobsDatabaseBean implements AdminBasicCompanyDataSessionBeanRemote {
+public class JobsAdminBusinessDataSessionBean extends BaseJobsEnterpriseBean implements AdminBasicCompanyDataSessionBeanRemote {
/**
* Serial number
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.Query;
-import org.mxchange.jjobs.database.BaseJobsDatabaseBean;
+import org.mxchange.jjobs.beans.ejb.BaseJobsEnterpriseBean;
/**
* A stateless session bean for business data
* @author Roland Häder<roland@mxchange.org>
*/
@Stateless (name = "basicCompanyData", description = "A general statless bean for handling business data (all)")
-public class JobsBusinessDataSessionBean extends BaseJobsDatabaseBean implements BasicCompanyDataSessionBeanRemote {
+public class JobsBusinessDataSessionBean extends BaseJobsEnterpriseBean implements BasicCompanyDataSessionBeanRemote {
/**
* Serial number
import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
import org.mxchange.jcountry.model.data.Country;
-import org.mxchange.jjobs.database.BaseJobsDatabaseBean;
+import org.mxchange.jjobs.beans.ejb.BaseJobsEnterpriseBean;
import org.mxchange.jusercore.model.user.User;
/**
* @author Roland Häder<roland@mxchange.org>
*/
@Stateless (name = "adminBranchOffice", description = "An administrative statless bean for handling branch office data (all)")
-public class JobsAdminBranchOfficeSessionBean extends BaseJobsDatabaseBean implements AdminBranchOfficeSessionBeanRemote {
+public class JobsAdminBranchOfficeSessionBean extends BaseJobsEnterpriseBean implements AdminBranchOfficeSessionBeanRemote {
/**
* Serial number
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.Query;
-import org.mxchange.jjobs.database.BaseJobsDatabaseBean;
+import org.mxchange.jjobs.beans.ejb.BaseJobsEnterpriseBean;
/**
* A stateless session bean for general branch office purposes
* @author Roland Häder<roland@mxchange.org>
*/
@Stateless (name = "branchOffice", description = "A general statless bean for handling branch office data (all)")
-public class JobsBranchOfficeSessionBean extends BaseJobsDatabaseBean implements BranchOfficeSessionBeanRemote {
+public class JobsBranchOfficeSessionBean extends BaseJobsEnterpriseBean implements BranchOfficeSessionBeanRemote {
/**
* Serial number
import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
import org.mxchange.jcontactsbusiness.model.employee.Employable;
import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter;
-import org.mxchange.jjobs.database.BaseJobsDatabaseBean;
+import org.mxchange.jjobs.beans.ejb.BaseJobsEnterpriseBean;
import org.mxchange.jusercore.model.user.User;
/**
* @author Roland Häder<roland@mxchange.org>
*/
@Stateless (name = "adminDepartment", description = "An administrative statless bean for handling department data (all)")
-public class JobsAdminDepartmentSessionBean extends BaseJobsDatabaseBean implements AdminDepartmentSessionBeanRemote {
+public class JobsAdminDepartmentSessionBean extends BaseJobsEnterpriseBean implements AdminDepartmentSessionBeanRemote {
/**
* Serial number
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.Query;
-import org.mxchange.jjobs.database.BaseJobsDatabaseBean;
+import org.mxchange.jjobs.beans.ejb.BaseJobsEnterpriseBean;
/**
* A stateless session bean for general department purposes
* @author Roland Häder<roland@mxchange.org>
*/
@Stateless (name = "department", description = "A general statless bean for handling branch office data (all)")
-public class JobsDepartmentSessionBean extends BaseJobsDatabaseBean implements DepartmentSessionBeanRemote {
+public class JobsDepartmentSessionBean extends BaseJobsEnterpriseBean implements DepartmentSessionBeanRemote {
/**
* Serial number
import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
import org.mxchange.jcontactsbusiness.model.department.Department;
import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter;
-import org.mxchange.jcontactsbusiness.model.jobposition.JobPosition;
-import org.mxchange.jjobs.database.BaseJobsDatabaseBean;
+import org.mxchange.jcontactsbusiness.model.jobposition.HireableJobPosition;
+import org.mxchange.jjobs.beans.ejb.BaseJobsEnterpriseBean;
import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
import org.mxchange.jusercore.model.user.User;
* @author Roland Häder<roland@mxchange.org>
*/
@Stateless (name = "adminEmployee", description = "An administrative statless bean for handling company employees")
-public class JobsAdminCompanyEmployeeSessionBean extends BaseJobsDatabaseBean implements AdminCompanyEmployeeSessionBeanRemote {
+public class JobsAdminCompanyEmployeeSessionBean extends BaseJobsEnterpriseBean implements AdminEmployeeSessionBeanRemote {
/**
* Serial number
}
// Is headquarter set?
- if (employee.getEmployeeJobPosition() instanceof JobPosition) {
+ if (employee.getEmployeeJobPosition() instanceof HireableJobPosition) {
// Then make it managed
- final JobPosition jobPosition = this.createManaged(employee.getEmployeeJobPosition());
+ final HireableJobPosition jobPosition = this.createManaged(employee.getEmployeeJobPosition());
// Set it back
employee.setEmployeeJobPosition(jobPosition);
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.Query;
-import org.mxchange.jcontactsbusiness.exceptions.employee.CompanyEmployeeNotFoundException;
-import org.mxchange.jjobs.database.BaseJobsDatabaseBean;
+import org.mxchange.jjobs.beans.ejb.BaseJobsEnterpriseBean;
/**
* A stateless bean for general purposes for company employees.
* @author Roland Häder<roland@mxchange.org>
*/
@Stateless (name = "employee", description = "A general statless bean for handling company employees")
-public class JobsCompanyEmployeeSessionBean extends BaseJobsDatabaseBean implements CompanyEmployeeSessionBeanRemote {
+public class JobsCompanyEmployeeSessionBean extends BaseJobsEnterpriseBean implements EmployeeSessionBeanRemote {
/**
* Serial number
--- /dev/null
+/*
+ * Copyright (C) 2017, 2018 Free Software Foundation
+ *
+ * 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.jcontactsbusiness.model.headquarter;
+
+import java.text.MessageFormat;
+import java.util.Date;
+import java.util.List;
+import javax.ejb.EJB;
+import javax.ejb.Stateless;
+import org.mxchange.jcontactsbusiness.exceptions.headquarter.HeadquarterAlreadyAddedException;
+import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
+import org.mxchange.jcountry.model.data.Country;
+import org.mxchange.jjobs.beans.ejb.BaseJobsEnterpriseBean;
+import org.mxchange.jusercore.model.user.User;
+
+/**
+ * A stateless session bean for administrative branch office purposes
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Stateless (name = "adminHeadquarter", description = "An administrative statless bean for handling branch office data (all)")
+public class JobsAdminHeadquarterSessionBean extends BaseJobsEnterpriseBean implements AdminHeadquarterSessionBeanRemote {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 58_467_386_571_701L;
+
+ /**
+ * General branch office bean
+ */
+ @EJB (lookup = "java:global/jjobs-ejb/headquarter!org.mxchange.jcontactsbusiness.model.headquarter.HeadquarterSessionBeanRemote")
+ private HeadquarterSessionBeanRemote headquarterBean;
+
+ /**
+ * Default constructor
+ */
+ public JobsAdminHeadquarterSessionBean () {
+ // Call super constructor
+ super();
+ }
+
+ @Override
+ public Headquarter addHeadquarter (final Headquarter headquarter) throws HeadquarterAlreadyAddedException {
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addHeadquarter(): headquarter={1} - CALLED!", this.getClass().getSimpleName(), headquarter)); //NOI18N
+
+ // Validate parameter
+ if (null == headquarter) {
+ // Throw NPE
+ throw new NullPointerException("headquarter is null"); //NOI18N
+ } else if (headquarter.getHeadquarterId() instanceof Long) {
+ // Should not happen
+ throw new IllegalArgumentException("headquarter.branchId should not be set."); //NOI18N
+ } else if (this.isHeadquarterFound(headquarter)) {
+ // Already added, abort here
+ throw new HeadquarterAlreadyAddedException(headquarter);
+ }
+
+ // Add created timestamp
+ headquarter.setHeadquarterCreated(new Date());
+
+ // Is user instance set?
+ if (headquarter.getHeadquarterUserOwner() instanceof User) {
+ // Get managed instance back
+ final User managedUser = this.createManaged(headquarter.getHeadquarterUserOwner());
+
+ // Set it back in branch office
+ headquarter.setHeadquarterUserOwner(managedUser);
+ }
+
+ // Is user instance set?
+ if (headquarter.getHeadquarterCountry() instanceof Country) {
+ // Get managed instance back
+ final Country managedCountry = this.createManaged(headquarter.getHeadquarterCountry());
+
+ // Set it back in branch office
+ headquarter.setHeadquarterCountry(managedCountry);
+ }
+
+ // Set "created" timestamp on any number assigned
+ this.setAllPhoneEntriesCreated(headquarter);
+
+ // Get opening times
+ final List<OpeningTime> openingTimes = headquarter.getHeadquarterOpeningTimes();
+
+ // Debugging:
+ this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.addHeadquarter(): headquarter.headquarterOpeningTimes={1}", this.getClass().getSimpleName(), openingTimes));
+
+ // Is opening times set and not empty?
+ if ((openingTimes instanceof List) && (!openingTimes.isEmpty())) {
+ // Add created timestamp for all times
+ this.setAllOpeningTimesCreated(openingTimes);
+ } else {
+ // Set all to null
+ headquarter.setHeadquarterOpeningTimes(null);
+ }
+
+ // Persist it
+ this.getEntityManager().persist(headquarter);
+
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addHeadquarter(): headquarter.branchId={1} - EXIT!", this.getClass().getSimpleName(), headquarter.getHeadquarterId())); //NOI18N
+
+ // Return updated instance
+ return headquarter;
+ }
+
+ /**
+ * Checks if given branch office's address is already persisted. The whole
+ * (persisted) list is being loaded and each address is being matched
+ * against the given branch office's address.
+ * <p>
+ * @param headquarter Headquarter office being checked
+ * <p>
+ * @return Whether it has been found
+ */
+ private boolean isHeadquarterFound (final Headquarter headquarter) {
+ // Get whole list
+ final List<Headquarter> headquarters = this.headquarterBean.allHeadquarters();
+
+ // Default is not found
+ boolean isFound = false;
+
+ // Check all single addresses
+ for (final Headquarter hq : headquarters) {
+ // Is the same address found?
+ if (Headquarters.isSameAddress(hq, headquarter)) {
+ // Found one
+ isFound = true;
+ break;
+ }
+ }
+
+ // Return flag
+ return isFound;
+ }
+
+}
+++ /dev/null
-/*
- * Copyright (C) 2017, 2018 Free Software Foundation
- *
- * 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.jcontactsbusiness.model.headquarter;
-
-import java.text.MessageFormat;
-import java.util.Date;
-import java.util.List;
-import javax.ejb.EJB;
-import javax.ejb.Stateless;
-import org.mxchange.jcontactsbusiness.exceptions.headquarter.HeadquarterAlreadyAddedException;
-import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
-import org.mxchange.jcountry.model.data.Country;
-import org.mxchange.jjobs.database.BaseJobsDatabaseBean;
-import org.mxchange.jusercore.model.user.User;
-
-/**
- * A stateless session bean for administrative branch office purposes
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Stateless (name = "adminHeadquarter", description = "An administrative statless bean for handling branch office data (all)")
-public class JobsAdminHeadquarterSessionBean extends BaseJobsDatabaseBean implements AdminHeadquarterSessionBeanRemote {
-
- /**
- * Serial number
- */
- private static final long serialVersionUID = 58_467_386_571_701L;
-
- /**
- * General branch office bean
- */
- @EJB (lookup = "java:global/jjobs-ejb/headquarter!org.mxchange.jcontactsbusiness.model.headquarter.HeadquarterSessionBeanRemote")
- private HeadquarterSessionBeanRemote headquarterBean;
-
- /**
- * Default constructor
- */
- public JobsAdminHeadquarterSessionBean () {
- // Call super constructor
- super();
- }
-
- @Override
- public Headquarter addHeadquarter (final Headquarter headquarter) throws HeadquarterAlreadyAddedException {
- // Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addHeadquarter(): headquarter={1} - CALLED!", this.getClass().getSimpleName(), headquarter)); //NOI18N
-
- // Validate parameter
- if (null == headquarter) {
- // Throw NPE
- throw new NullPointerException("headquarter is null"); //NOI18N
- } else if (headquarter.getHeadquarterId() instanceof Long) {
- // Should not happen
- throw new IllegalArgumentException("headquarter.branchId should not be set."); //NOI18N
- } else if (this.isHeadquarterFound(headquarter)) {
- // Already added, abort here
- throw new HeadquarterAlreadyAddedException(headquarter);
- }
-
- // Add created timestamp
- headquarter.setHeadquarterCreated(new Date());
-
- // Is user instance set?
- if (headquarter.getHeadquarterUserOwner() instanceof User) {
- // Get managed instance back
- final User managedUser = this.createManaged(headquarter.getHeadquarterUserOwner());
-
- // Set it back in branch office
- headquarter.setHeadquarterUserOwner(managedUser);
- }
-
- // Is user instance set?
- if (headquarter.getHeadquarterCountry() instanceof Country) {
- // Get managed instance back
- final Country managedCountry = this.createManaged(headquarter.getHeadquarterCountry());
-
- // Set it back in branch office
- headquarter.setHeadquarterCountry(managedCountry);
- }
-
- // Set "created" timestamp on any number assigned
- this.setAllPhoneEntriesCreated(headquarter);
-
- // Get opening times
- final List<OpeningTime> openingTimes = headquarter.getHeadquarterOpeningTimes();
-
- // Debugging:
- this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.addHeadquarter(): headquarter.headquarterOpeningTimes={1}", this.getClass().getSimpleName(), openingTimes));
-
- // Is opening times set and not empty?
- if ((openingTimes instanceof List) && (!openingTimes.isEmpty())) {
- // Add created timestamp for all times
- this.setAllOpeningTimesCreated(openingTimes);
- } else {
- // Set all to null
- headquarter.setHeadquarterOpeningTimes(null);
- }
-
- // Persist it
- this.getEntityManager().persist(headquarter);
-
- // Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addHeadquarter(): headquarter.branchId={1} - EXIT!", this.getClass().getSimpleName(), headquarter.getHeadquarterId())); //NOI18N
-
- // Return updated instance
- return headquarter;
- }
-
- /**
- * Checks if given branch office's address is already persisted. The whole
- * (persisted) list is being loaded and each address is being matched
- * against the given branch office's address.
- * <p>
- * @param headquarter Headquarter office being checked
- * <p>
- * @return Whether it has been found
- */
- private boolean isHeadquarterFound (final Headquarter headquarter) {
- // Get whole list
- final List<Headquarter> headquarters = this.headquarterBean.allHeadquarters();
-
- // Default is not found
- boolean isFound = false;
-
- // Check all single addresses
- for (final Headquarter hq : headquarters) {
- // Is the same address found?
- if (Headquarters.isSameAddress(hq, headquarter)) {
- // Found one
- isFound = true;
- break;
- }
- }
-
- // Return flag
- return isFound;
- }
-
-}
--- /dev/null
+/*
+ * Copyright (C) 2017, 2018 Free Software Foundation
+ *
+ * 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.jcontactsbusiness.model.headquarter;
+
+import java.text.MessageFormat;
+import java.util.List;
+import javax.ejb.Stateless;
+import javax.persistence.Query;
+import org.mxchange.jjobs.beans.ejb.BaseJobsEnterpriseBean;
+
+/**
+ * A stateless session bean for general headquarter purposes
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Stateless (name = "headquarter", description = "A general statless bean for handling headquarter data (all)")
+public class JobsHeadquarterSessionBean extends BaseJobsEnterpriseBean implements HeadquarterSessionBeanRemote {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 58_467_386_571_701L;
+
+ @Override
+ @SuppressWarnings ("unchecked")
+ public List<Headquarter> allHeadquarters () {
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allHeadquarters: CALLED!", this.getClass().getSimpleName())); //NOI18N
+
+ // Get query
+ final Query query = this.getEntityManager().createNamedQuery("AllHeadquarters"); //NOI18N
+
+ // Get list from it
+ final List<Headquarter> list = query.getResultList();
+
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allHeadquarters: list.size()={1} - EXIT!", this.getClass().getSimpleName(), list.size())); //NOI18N
+
+ // Return it
+ return list;
+ }
+
+}
+++ /dev/null
-/*
- * Copyright (C) 2017, 2018 Free Software Foundation
- *
- * 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.jcontactsbusiness.model.headquarter;
-
-import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter;
-import java.text.MessageFormat;
-import java.util.List;
-import javax.ejb.Stateless;
-import javax.persistence.Query;
-import org.mxchange.jjobs.database.BaseJobsDatabaseBean;
-import org.mxchange.jcontactsbusiness.model.headquarter.HeadquarterSessionBeanRemote;
-
-/**
- * A stateless session bean for general headquarter purposes
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Stateless (name = "headquarter", description = "A general statless bean for handling headquarter data (all)")
-public class JobsHeadquarterSessionBean extends BaseJobsDatabaseBean implements HeadquarterSessionBeanRemote {
-
- /**
- * Serial number
- */
- private static final long serialVersionUID = 58_467_386_571_701L;
-
- @Override
- @SuppressWarnings ("unchecked")
- public List<Headquarter> allHeadquarters () {
- // Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allHeadquarters: CALLED!", this.getClass().getSimpleName())); //NOI18N
-
- // Get query
- final Query query = this.getEntityManager().createNamedQuery("AllHeadquarters"); //NOI18N
-
- // Get list from it
- final List<Headquarter> list = query.getResultList();
-
- // Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allHeadquarters: list.size()={1} - EXIT!", this.getClass().getSimpleName(), list.size())); //NOI18N
-
- // Return it
- return list;
- }
-
-}
import java.text.MessageFormat;
import java.util.Date;
import javax.ejb.Stateless;
-import org.mxchange.jjobs.database.BaseJobsDatabaseBean;
+import org.mxchange.jjobs.beans.ejb.BaseJobsEnterpriseBean;
/**
* A stateless session bean for administrative opening times purposes
* @author Roland Häder<roland@mxchange.org>
*/
@Stateless (name = "adminOpeningTimes", description = "An administrative statless bean for handling opening times")
-public class JobsAdminOpeningTimesSessionBean extends BaseJobsDatabaseBean implements AdminOpeningTimeSessionBeanRemote {
+public class JobsAdminOpeningTimesSessionBean extends BaseJobsEnterpriseBean implements AdminOpeningTimeSessionBeanRemote {
/**
* Serial number
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.Query;
-import org.mxchange.jjobs.database.BaseJobsDatabaseBean;
+import org.mxchange.jjobs.beans.ejb.BaseJobsEnterpriseBean;
/**
* A stateless session bean for general opening times purposes
* @author Roland Häder<roland@mxchange.org>
*/
@Stateless (name = "openingTimes", description = "A general statless bean for handling branch office data (all)")
-public class JobsOpeningTimesSessionBean extends BaseJobsDatabaseBean implements OpeningTimeSessionBeanRemote {
+public class JobsOpeningTimesSessionBean extends BaseJobsEnterpriseBean implements OpeningTimeSessionBeanRemote {
/**
* Serial number
import javax.persistence.NoResultException;
import javax.persistence.Query;
import org.mxchange.jcountry.exceptions.CountryAlreadyAddedException;
-import org.mxchange.jjobs.database.BaseJobsDatabaseBean;
+import org.mxchange.jjobs.beans.ejb.BaseJobsEnterpriseBean;
/**
* A stateless EJB for administrative country purposes
* @author Roland Häder<roland@mxchange.org>
*/
@Stateless (name = "adminCountry", description = "A stateless session-scoped bean for administrative country purposes")
-public class JobsAdminCountrySingletonBean extends BaseJobsDatabaseBean implements AdminCountrySessionBeanRemote {
+public class JobsAdminCountrySingletonBean extends BaseJobsEnterpriseBean implements AdminCountrySessionBeanRemote {
/**
* Serial number
import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.persistence.Query;
-import org.mxchange.jjobs.database.BaseJobsDatabaseBean;
+import org.mxchange.jjobs.beans.ejb.BaseJobsEnterpriseBean;
/**
* A singleton EJB for country informations
*/
@Startup
@Singleton (name = "country", description = "A singleton session-scoped bean for country informations")
-public class JobsCountrySingletonBean extends BaseJobsDatabaseBean implements CountrySingletonBeanRemote {
+public class JobsCountrySingletonBean extends BaseJobsEnterpriseBean implements CountrySingletonBeanRemote {
/**
* Serial number
import javax.mail.internet.InternetAddress;
import org.mxchange.jcontacts.model.contact.Contact;
import org.mxchange.jcontacts.model.contact.Contacts;
-import org.mxchange.jcontacts.model.contact.UserContact;
import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
-import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData;
import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
-import org.mxchange.jcontactsbusiness.model.branchoffice.BusinessBranchOffice;
-import org.mxchange.jcontactsbusiness.model.employee.BusinessEmployee;
+import org.mxchange.jcontactsbusiness.model.department.Department;
import org.mxchange.jcontactsbusiness.model.employee.Employable;
-import org.mxchange.jcontactsbusiness.model.headquarter.BusinessHeadquarter;
import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter;
+import org.mxchange.jcontactsbusiness.model.jobposition.HireableJobPosition;
import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
import org.mxchange.jcoreee.bean.ejb.BaseEnterpriseBean;
import org.mxchange.jcountry.model.data.Country;
-import org.mxchange.jcountry.model.data.CountryData;
import org.mxchange.jmailee.model.delivery.wrapper.EmailDeliveryWrapper;
import org.mxchange.jmailee.model.delivery.wrapper.WrapableEmailDelivery;
import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
import org.mxchange.jphone.model.phonenumbers.landline.LandLineNumbers;
import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
import org.mxchange.jphone.model.phonenumbers.mobile.MobileNumbers;
+import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
import org.mxchange.jphone.utils.PhoneUtils;
-import org.mxchange.jusercore.model.user.LoginUser;
import org.mxchange.jusercore.model.user.User;
import org.mxchange.jusercore.model.user.Users;
}
// Try to find it (should be there)
- final Contact managedContact = this.getEntityManager().find(UserContact.class, contact.getContactId());
+ final Contact managedContact = this.getEntityManager().find(contact.getClass(), contact.getContactId());
// Should be there
assert (managedContact instanceof Contact) : "managedContact is null"; //NOI18N
}
// Try to find it (should be there)
- final Country managedCountry = this.getEntityManager().find(CountryData.class, country.getCountryId());
+ final Country managedCountry = this.getEntityManager().find(country.getClass(), country.getCountryId());
// Should be there
assert (managedCountry instanceof Country) : "managedCountry is null"; //NOI18N
}
// Try to find it (should be there)
- final BasicData managedBasicData = this.getEntityManager().find(BusinessBasicData.class, basicData.getBasicDataId());
+ final BasicData managedBasicData = this.getEntityManager().find(basicData.getClass(), basicData.getBasicDataId());
// Should be there
assert (managedBasicData instanceof BasicData) : "managedBasicData is null"; //NOI18N
}
// Try to find it (should be there)
- final BranchOffice managedBranchOffice = this.getEntityManager().find(BusinessBranchOffice.class, headquarter.getBranchId());
+ final BranchOffice managedBranchOffice = this.getEntityManager().find(headquarter.getClass(), headquarter.getBranchId());
// Should be there
assert (managedBranchOffice instanceof BranchOffice) : "managedBranchOffice is null"; //NOI18N
return managedBranchOffice;
}
+ /**
+ * Get back a managed instance from given department
+ * <p>
+ * @param department Unmanaged/detached department instance
+ * <p>
+ * @return Managed department instance
+ */
+ protected Department createManaged (final Department department) {
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: department={1} - CALLED!", this.getClass().getSimpleName(), department)); //NOI18N
+
+ // user should not be null
+ if (null == department) {
+ // Abort here
+ throw new NullPointerException("department is null"); //NOI18N
+ } else if (department.getDepartmentId() == null) {
+ // Id is set
+ throw new NullPointerException("department.departmentId is null"); //NOI18N
+ } else if (department.getDepartmentId() < 1) {
+ // Id is set
+ throw new IllegalArgumentException(MessageFormat.format("department.departmentId={0} is invalid", department.getDepartmentId())); //NOI18N
+ }
+
+ // Try to find it (should be there)
+ final Department managedDepartment = this.getEntityManager().find(department.getClass(), department.getDepartmentId());
+
+ // Should be there
+ assert (managedDepartment instanceof Department) : "managedDepartment is null"; //NOI18N
+
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedDepartment={1} - EXIT!", this.getClass().getSimpleName(), managedDepartment)); //NOI18N
+
+ // Return it
+ return managedDepartment;
+ }
+
/**
* Get back a managed instance from given employee
* <p>
}
// Try to find it (should be there)
- final Employable managedEmployee = this.getEntityManager().find(BusinessEmployee.class, employee.getEmployeeId());
+ final Employable managedEmployee = this.getEntityManager().find(employee.getClass(), employee.getEmployeeId());
// Should be there
assert (managedEmployee instanceof Employable) : "managedEmployee is null"; //NOI18N
return managedEmployee;
}
+ /**
+ * Get back a managed instance from given jobPosition
+ * <p>
+ * @param jobPosition Unmanaged/detached job position instance
+ * <p>
+ * @return Managed job position instance
+ */
+ protected HireableJobPosition createManaged (final HireableJobPosition jobPosition) {
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: jobPosition={1} - CALLED!", this.getClass().getSimpleName(), jobPosition)); //NOI18N
+
+ // user should not be null
+ if (null == jobPosition) {
+ // Abort here
+ throw new NullPointerException("jobPosition is null"); //NOI18N
+ } else if (jobPosition.getJobPositionId() == null) {
+ // Id is set
+ throw new NullPointerException("jobPosition.jobPositionId is null"); //NOI18N
+ } else if (jobPosition.getJobPositionId() < 1) {
+ // Id is set
+ throw new IllegalArgumentException(MessageFormat.format("jobPosition.jobPositionId={0} is invalid", jobPosition.getJobPositionId())); //NOI18N
+ }
+
+ // Try to find it (should be there)
+ final HireableJobPosition managedJobPosition = this.getEntityManager().find(jobPosition.getClass(), jobPosition.getJobPositionId());
+
+ // Should be there
+ assert (managedJobPosition instanceof HireableJobPosition) : "managedJobPosition is null"; //NOI18N
+
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedJobPosition={1} - EXIT!", this.getClass().getSimpleName(), managedJobPosition)); //NOI18N
+
+ // Return it
+ return managedJobPosition;
+ }
+
/**
* Get back a managed instance from given headquarter
* <p>
}
// Try to find it (should be there)
- final Headquarter managedHeadquarter = this.getEntityManager().find(BusinessHeadquarter.class, headquarter.getHeadquarterId());
+ final Headquarter managedHeadquarter = this.getEntityManager().find(headquarter.getClass(), headquarter.getHeadquarterId());
// Should be there
assert (managedHeadquarter instanceof Headquarter) : "managedHeadquarter is null"; //NOI18N
return managedHeadquarter;
}
+ /**
+ * Get back a managed instance from given mobile provider
+ * <p>
+ * @param mobileProvider Unmanaged/detached mobile provider instance
+ * <p>
+ * @return Managed mobile provider instance
+ */
+ protected MobileProvider createManaged (final MobileProvider mobileProvider) {
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: mobileProvider={1} - CALLED!", this.getClass().getSimpleName(), mobileProvider)); //NOI18N
+
+ // user should not be null
+ if (null == mobileProvider) {
+ // Abort here
+ throw new NullPointerException("mobileProvider is null"); //NOI18N
+ } else if (mobileProvider.getProviderId() == null) {
+ // Id is set
+ throw new NullPointerException("mobileProvider.providerId is null"); //NOI18N
+ } else if (mobileProvider.getProviderId() < 1) {
+ // Id is set
+ throw new IllegalArgumentException(MessageFormat.format("mobileProvider.providerId={0} is invalid", mobileProvider.getProviderId())); //NOI18N
+ }
+
+ // Try to find it (should be there)
+ final MobileProvider managedMobileProvider = this.getEntityManager().find(mobileProvider.getClass(), mobileProvider.getProviderId());
+
+ // Should be there
+ assert (managedMobileProvider instanceof MobileProvider) : "managedMobileProvider is null"; //NOI18N
+
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedMobileProvider={1} - EXIT!", this.getClass().getSimpleName(), managedMobileProvider)); //NOI18N
+
+ // Return it
+ return managedMobileProvider;
+ }
+
/**
* Get back a managed instance from given user
* <p>
}
// Try to find it (should be there)
- final User managedUser = this.getEntityManager().find(LoginUser.class, user.getUserId());
+ final User managedUser = this.getEntityManager().find(user.getClass(), user.getUserId());
// Should be there
assert (managedUser instanceof User) : "managedUser is null"; //NOI18N
package org.mxchange.jjobs.model.addressbook;
import java.text.MessageFormat;
-import java.util.GregorianCalendar;
+import java.util.Date;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.NoResultException;
import org.mxchange.jaddressbook.model.addressbook.Addressbook;
import org.mxchange.jaddressbook.model.addressbook.UserAddressbook;
import org.mxchange.jaddressbook.model.addressbook.entry.AddressbookEntry;
-import org.mxchange.jjobs.database.BaseJobsDatabaseBean;
+import org.mxchange.jjobs.beans.ejb.BaseJobsEnterpriseBean;
import org.mxchange.jusercore.model.user.User;
/**
* @author Roland Häder<roland@mxchange.org>
*/
@Stateless (name = "addressbook", description = "A stateless bean for handling JJobs addressbooks")
-public class JobsAddressbookSessionBean extends BaseJobsDatabaseBean implements AddressbookSessionBeanRemote {
+public class JobsAddressbookSessionBean extends BaseJobsEnterpriseBean implements AddressbookSessionBeanRemote {
/**
* Serial number
}
// Add timestamp of creation
- addressbook.setAddressbookCreated(new GregorianCalendar());
+ addressbook.setAddressbookCreated(new Date());
// Persist it now
this.getEntityManager().persist(addressbook);
import java.text.MessageFormat;
import java.util.Date;
import javax.ejb.Stateless;
-import org.mxchange.jjobs.database.BaseJobsDatabaseBean;
+import org.mxchange.jjobs.beans.ejb.BaseJobsEnterpriseBean;
import org.mxchange.jphone.exceptions.mobileprovider.MobileProviderAlreadyAddedException;
/**
* @author Roland Häder<roland@mxchange.org>
*/
@Stateless (name = "adminMobileProvider", description = "A singleton session-scoped bean for mobile provider informations, admin-edition")
-public class JobsAdminMobileProviderSessionBean extends BaseJobsDatabaseBean implements AdminMobileProviderSessionBeanRemote {
+public class JobsAdminMobileProviderSessionBean extends BaseJobsEnterpriseBean implements AdminMobileProviderSessionBeanRemote {
/**
* Serial number
import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.persistence.Query;
-import org.mxchange.jjobs.database.BaseJobsDatabaseBean;
+import org.mxchange.jjobs.beans.ejb.BaseJobsEnterpriseBean;
/**
* A singleton EJB for mobile provider informations
*/
@Startup
@Singleton (name = "mobileProvider", description = "A singleton session-scoped bean for SMS provider informations")
-public class JobsMobileProviderSingletonBean extends BaseJobsDatabaseBean implements MobileProviderSingletonBeanRemote {
+public class JobsMobileProviderSingletonBean extends BaseJobsEnterpriseBean implements MobileProviderSingletonBeanRemote {
/**
* Serial number
import java.text.MessageFormat;
import java.util.Date;
import javax.ejb.Stateless;
-import org.mxchange.jjobs.database.BaseJobsDatabaseBean;
-import org.mxchange.jphone.model.phonenumbers.phone.AdminPhoneSessionBeanRemote;
+import org.mxchange.jjobs.beans.ejb.BaseJobsEnterpriseBean;
+import org.mxchange.jphone.model.phonenumbers.fax.FaxNumbers;
+import org.mxchange.jphone.model.phonenumbers.landline.LandLineNumbers;
+import org.mxchange.jphone.model.phonenumbers.mobile.MobileNumbers;
/**
* An EJB for administrative phone purposes
* @author Roland Häder<roland@mxchange.org>
*/
@Stateless (name = "adminPhone", description = "An administrative bean handling phone data")
-public class JobsAdminPhoneSessionBean extends BaseJobsDatabaseBean implements AdminPhoneSessionBeanRemote {
+public class JobsAdminPhoneSessionBean extends BaseJobsEnterpriseBean implements AdminPhoneSessionBeanRemote {
/**
* Serial number
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.Query;
-import org.mxchange.jjobs.database.BaseJobsDatabaseBean;
+import org.mxchange.jjobs.beans.ejb.BaseJobsEnterpriseBean;
import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
import org.mxchange.jphone.model.phonenumbers.fax.FaxNumber;
import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
* @author Roland Häder<roland@mxchange.org>
*/
@Stateless (name = "phone", description = "A bean handling phone data")
-public class JobsPhoneSessionBean extends BaseJobsDatabaseBean implements PhoneSessionBeanRemote {
+public class JobsPhoneSessionBean extends BaseJobsEnterpriseBean implements PhoneSessionBeanRemote {
/**
* Serial number
import javax.ejb.EJB;
import javax.ejb.Stateless;
import org.mxchange.jcontacts.model.contact.Contact;
-import org.mxchange.jjobs.database.BaseJobsDatabaseBean;
+import org.mxchange.jjobs.beans.ejb.BaseJobsEnterpriseBean;
import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException;
import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException;
import org.mxchange.jusercore.exceptions.UserNotFoundException;
import org.mxchange.jusercore.exceptions.UserStatusLockedException;
import org.mxchange.jusercore.exceptions.UserStatusUnconfirmedException;
import org.mxchange.jusercore.model.user.status.UserAccountStatus;
-import org.mxchange.juserlogincore.model.user.register.UserRegistrationSessionBeanRemote;
/**
* An administrative user EJB
* @author Roland Häder<roland@mxchange.org>
*/
@Stateless (name = "adminUser", description = "A bean handling the user data")
-public class JobsAdminUserSessionBean extends BaseJobsDatabaseBean implements AdminUserSessionBeanRemote {
+public class JobsAdminUserSessionBean extends BaseJobsEnterpriseBean implements AdminUserSessionBeanRemote {
/**
* Serial number
*/
private static final long serialVersionUID = 542_145_347_916L;
- /**
- * Registration EJB
- */
- @EJB
- private UserRegistrationSessionBeanRemote registerBean;
-
/**
* Regular user bean
*/
}
// Check if user is registered
- if (this.registerBean.isUserNameRegistered(user)) {
+ if (this.userBean.isUserNameRegistered(user)) {
// Abort here
throw new UserNameAlreadyRegisteredException(user);
- } else if (this.registerBean.isEmailAddressRegistered(user)) {
+ } else if (this.userBean.isEmailAddressRegistered(user)) {
// Abort here
throw new EmailAddressAlreadyRegisteredException(user);
}
import javax.persistence.Query;
import org.mxchange.jcontacts.model.contact.Contact;
import org.mxchange.jcontacts.model.contact.Contacts;
-import org.mxchange.jjobs.database.BaseJobsDatabaseBean;
+import org.mxchange.jjobs.beans.ejb.BaseJobsEnterpriseBean;
import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
import org.mxchange.jphone.model.phonenumbers.fax.FaxNumbers;
import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
* @author Roland Häder<roland@mxchange.org>
*/
@Stateless (name = "user", description = "A bean handling the user data")
-public class JobsUserSessionBean extends BaseJobsDatabaseBean implements UserSessionBeanRemote {
+public class JobsUserSessionBean extends BaseJobsEnterpriseBean implements UserSessionBeanRemote {
/**
* Serial number
import javax.jms.JMSException;
import javax.jms.ObjectMessage;
import javax.persistence.Query;
-import org.mxchange.jjobs.database.BaseJobsDatabaseBean;
+import org.mxchange.jjobs.beans.ejb.BaseJobsEnterpriseBean;
import org.mxchange.jusercore.model.user.User;
/**
* @author Roland Häder<roland@mxchange.org>
*/
@Stateless (name = "userActivity", description = "A stateless, session-scored user-activity bean.")
-public class JobsUserActivitySessionBean extends BaseJobsDatabaseBean implements UserActivityLogSessionBeanRemote {
+public class JobsUserActivityLogMessageBean extends BaseJobsEnterpriseBean implements UserActivityLogSessionBeanRemote {
/**
* Serial number
/**
* Default constructor
*/
- public JobsUserActivitySessionBean () {
+ public JobsUserActivityLogMessageBean () {
// Invoke super constructor
super("jms/jjobs-queue-factory", "jms/jjobs-user-activity-log"); //NOI18N
}
package org.mxchange.jusercore.model.user.activity;
import java.text.MessageFormat;
-import java.util.Arrays;
import java.util.List;
import javax.ejb.EJBException;
import javax.ejb.Stateless;
import javax.jms.JMSException;
import javax.jms.ObjectMessage;
import javax.persistence.Query;
-import org.mxchange.jcoreee.database.BaseDatabaseBean;
+import org.mxchange.jcoreee.bean.ejb.BaseEnterpriseBean;
import org.mxchange.jusercore.model.user.User;
/**
- * An EJB for user activity log. This class extends BaseDatabaseBean and not
+ * An EJB for user activity log. This class extends BaseEnterpriseBean and not
* project-specific "base class". The simple reason is that this class requires
* no email queue as no emails are ever being sent from this class.
* <p>
* @author Roland Häder<roland@mxchange.org>
*/
@Stateless (name = "userActivity", description = "A bean handling the user data")
-public class JobsUserActivitySessionBean extends BaseDatabaseBean implements UserActivityLogSessionBeanRemote {
+public class JobsUserActivitySessionBean extends BaseEnterpriseBean implements UserActivityLogSessionBeanRemote {
/**
* Serial number
return list;
}
- @Override
- @SuppressWarnings ("unchecked")
- public List<LogableUserActivity> fetchAllUsersActivityLogByMultipleType (final User user, final String[] activityTypes) {
- // Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.fetchAllUsersActivityLogByType: user={1},activityTypes={2} - CALLED!", this.getClass().getSimpleName(), user, Arrays.toString(activityTypes))); //NOI18N
-
- // Is user valid?
- if (null == user) {
- // Throw NPE
- throw new NullPointerException("user is null"); //NOI18N
- } else if (user.getUserId() == null) {
- // Throw again
- throw new NullPointerException("user.userId is null"); //NOI18N
- } else if (user.getUserId() < 1) {
- // Invalid id number
- throw new IllegalArgumentException(MessageFormat.format("user.userId{0} is not valid", user.getUserId())); //NOI18N
- } else if (null == activityTypes) {
- // Throw NPE again
- throw new NullPointerException("activityTypes is null"); //NOI18N
- } else if (activityTypes.length == 0) {
- // Should not be empty
- throw new IllegalArgumentException("activityTypes is empty"); //NOI18N
- }
-
- // Search for user's activity
- Query query = this.getEntityManager().createNamedQuery("FindUsersActivityByMultipleTypes", UserActivityLog.class); //NOI18N
-
- // Set parameters
- query.setParameter("activityUser", user); //NOI18N
- query.setParameter("activityTypes", Arrays.asList(activityTypes)); //NOI18N
-
- // Get list
- List<LogableUserActivity> list = query.getResultList();
-
- // Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.fetchAllUsersActivityLogByType: list.size()={1} - EXIT!", this.getClass().getSimpleName(), list.size())); //NOI18N
-
- // Return it
- return list;
- }
-
- @Override
- @SuppressWarnings ("unchecked")
- public List<LogableUserActivity> fetchAllUsersActivityLogByType (final User user, final String activityType) {
- // Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.fetchAllUsersActivityLogByType: user={1},activityType={2} - CALLED!", this.getClass().getSimpleName(), user, activityType)); //NOI18N
-
- // Is user valid?
- if (null == user) {
- // Throw NPE
- throw new NullPointerException("user is null"); //NOI18N
- } else if (user.getUserId() == null) {
- // Throw again
- throw new NullPointerException("user.userId is null"); //NOI18N
- } else if (user.getUserId() < 1) {
- // Invalid id number
- throw new IllegalArgumentException(MessageFormat.format("user.userId{0} is not valid", user.getUserId())); //NOI18N
- } else if (null == activityType) {
- // Throw NPE again
- throw new NullPointerException("activityType is null"); //NOI18N
- } else if (activityType.isEmpty()) {
- // Should not be empty
- throw new IllegalArgumentException("activityType is empty"); //NOI18N
- }
-
- // Search for user's activity
- Query query = this.getEntityManager().createNamedQuery("FindUsersActivityByType", UserActivityLog.class); //NOI18N
-
- // Set parameters
- query.setParameter("activityUser", user); //NOI18N
- query.setParameter("activityType", activityType); //NOI18N
-
- // Get list
- List<LogableUserActivity> list = query.getResultList();
-
- // Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.fetchAllUsersActivityLogByType: list.size()={1} - EXIT!", this.getClass().getSimpleName(), list.size())); //NOI18N
-
- // Return it
- return list;
- }
}
import javax.ejb.Stateless;
import javax.persistence.NoResultException;
import javax.persistence.Query;
-import org.mxchange.jjobs.database.BaseJobsDatabaseBean;
+import org.mxchange.jjobs.beans.ejb.BaseJobsEnterpriseBean;
import org.mxchange.jusercore.model.email_address.ChangeableEmailAddress;
import org.mxchange.jusercore.model.email_address.EmailAddressChange;
import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
* @author Roland Häder<roland@mxchange.org>
*/
@Stateless (name = "userEmailChange", description = "A bean handling user email changes")
-public class JobsUserEmailChangeSessionBean extends BaseJobsDatabaseBean implements UserEmailChangeSessionBeanRemote {
+public class JobsUserEmailChangeSessionBean extends BaseJobsEnterpriseBean implements UserEmailChangeSessionBeanRemote {
/**
* Serial number
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.Query;
-import org.mxchange.jjobs.database.BaseJobsDatabaseBean;
+import org.mxchange.jjobs.beans.ejb.BaseJobsEnterpriseBean;
import org.mxchange.jusercore.model.user.User;
/**
* @author Roland Häder<roland@mxchange.org>
*/
@Stateless (name = "userPasswordHistory", description = "A stateless EJB for user's password history. This bean does return the full user's password history and not limited. The application then needs to limit it to it's purpose.")
-public class JobsUserPasswordHistorySessionBean extends BaseJobsDatabaseBean implements UserPasswordHistorySessionBeanRemote {
+public class JobsUserPasswordHistorySessionBean extends BaseJobsEnterpriseBean implements UserPasswordHistorySessionBeanRemote {
/**
* Serial number
import java.text.MessageFormat;
import javax.ejb.EJB;
import javax.ejb.Stateless;
-import org.mxchange.jjobs.database.BaseJobsDatabaseBean;
+import org.mxchange.jjobs.beans.ejb.BaseJobsEnterpriseBean;
import org.mxchange.jusercore.exceptions.UserNotFoundException;
import org.mxchange.jusercore.exceptions.UserStatusLockedException;
import org.mxchange.jusercore.exceptions.UserStatusUnconfirmedException;
import org.mxchange.juserlogincore.container.login.LoginContainer;
import org.mxchange.juserlogincore.exceptions.UserPasswordMismatchException;
import org.mxchange.juserlogincore.login.UserLoginUtils;
-import org.mxchange.juserlogincore.model.user.register.UserRegistrationSessionBeanRemote;
/**
* A session EJB for user logins
* @author Roland Häder<roland@mxchange.org>
*/
@Stateless (name = "userLogin", description = "A bean handling the user login for Jobs project")
-public class JobsUserLoginSessionBean extends BaseJobsDatabaseBean implements UserLoginSessionBeanRemote {
+public class JobsUserLoginSessionBean extends BaseJobsEnterpriseBean implements UserLoginSessionBeanRemote {
/**
* Serial number
*/
private static final long serialVersionUID = 21_785_978_127_581_965L;
- /**
- * Registration EJB
- */
- @EJB
- private UserRegistrationSessionBeanRemote registerBean;
-
/**
* User EJB
*/
// Trace message
this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.loginUser: container={1} - CALLED!", this.getClass().getSimpleName(), container)); //NOI18N
- // Check some beans
- assert (this.userBean instanceof UserSessionBeanRemote) : "this.userBean is not set"; //NOI18N
- assert (this.registerBean instanceof UserRegistrationSessionBeanRemote) : "this.registerBean is not set"; //NOI18N
-
// user should not be null
if (null == container) {
// Abort here
}
// Is the account there?
- if (!this.registerBean.isUserNameRegistered(container.getUser())) {
+ if (!this.userBean.isUserNameRegistered(container.getUser())) {
// Not registered
throw new UserNotFoundException(container.getUser());
}
import javax.persistence.NoResultException;
import javax.persistence.Query;
import org.mxchange.jcontacts.model.contact.Contact;
-import org.mxchange.jjobs.database.BaseJobsDatabaseBean;
+import org.mxchange.jjobs.beans.ejb.BaseJobsEnterpriseBean;
import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException;
import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException;
import org.mxchange.jusercore.model.user.AdminUserSessionBeanRemote;
* @author Roland Häder<roland@mxchange.org>
*/
@Stateless (name = "userRegistration", description = "A bean handling the user registration")
-public class JobsUserRegistrationSessionBean extends BaseJobsDatabaseBean implements UserRegistrationSessionBeanRemote {
+public class JobsUserRegistrationSessionBean extends BaseJobsEnterpriseBean implements UserRegistrationSessionBeanRemote {
/**
* Serial number
return confirmationKey;
}
- @Override
- public boolean isEmailAddressRegistered (final User user) {
- // Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isEmailAddressRegistered: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
-
- // Check bean
- assert (this.userBean instanceof UserSessionBeanRemote) : "this.userBean is not set"; //NOI18N
-
- // user should not be null
- if (null == user) {
- // Abort here
- throw new NullPointerException("user is null"); //NOI18N
- }
-
- // Call other bean
- return this.userBean.isEmailAddressRegistered(user);
- }
-
- @Override
- public boolean isUserNameRegistered (final User user) {
- // Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isUserNameRegistered: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
-
- // Check bean
- assert (this.userBean instanceof UserSessionBeanRemote) : "this.userBean is not set"; //NOI18N
-
- // user should not be null
- if (null == user) {
- // Abort here
- throw new NullPointerException("user is null"); //NOI18N
- }
-
- // Call other bean
- return this.userBean.isUserNameRegistered(user);
- }
-
@Override
public User registerUser (final User user, final String baseUrl, final String randomPassword) throws UserNameAlreadyRegisteredException, EmailAddressAlreadyRegisteredException {
// Trace message
}
// Check if user is registered
- if (this.isUserNameRegistered(user)) {
+ if (this.userBean.isUserNameRegistered(user)) {
// Abort here
throw new UserNameAlreadyRegisteredException(user);
- } else if (this.isEmailAddressRegistered(user)) {
+ } else if (this.userBean.isEmailAddressRegistered(user)) {
// Abort here
throw new EmailAddressAlreadyRegisteredException(user);
}
import java.util.Locale;
import javax.ejb.EJB;
import javax.ejb.Stateless;
-import org.mxchange.jjobs.database.BaseJobsDatabaseBean;
+import org.mxchange.jjobs.beans.ejb.BaseJobsEnterpriseBean;
import org.mxchange.jusercore.exceptions.UserNotFoundException;
import org.mxchange.jusercore.exceptions.UserStatusConfirmedException;
import org.mxchange.jusercore.exceptions.UserStatusLockedException;
* @author Roland Häder<roland@mxchange.org>
*/
@Stateless (name = "userResendConfirmationLink", description = "A bean resending confirmation links")
-public class JobsResendLinkSessionBean extends BaseJobsDatabaseBean implements ResendLinkSessionBeanRemote {
+public class JobsResendLinkSessionBean extends BaseJobsEnterpriseBean implements ResendLinkSessionBeanRemote {
/**
* Serial number