package org.mxchange.jjobs.beans.phone;
import java.text.MessageFormat;
-import java.util.Calendar;
+import java.util.Date;
import java.util.List;
import java.util.Objects;
-import javax.annotation.PostConstruct;
+import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.event.Event;
import javax.enterprise.event.Observes;
import javax.enterprise.inject.Any;
-import javax.faces.view.facelets.FaceletException;
import javax.inject.Inject;
import javax.inject.Named;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import org.mxchange.jcountry.data.Country;
-import org.mxchange.jjobs.beans.BaseJobsController;
-import org.mxchange.jjobs.beans.helper.JobsWebRequestHelperController;
+import org.mxchange.jcountry.model.data.Country;
+import org.mxchange.jjobs.beans.BaseJobsBean;
import org.mxchange.jphone.events.fax.created.ObservableCreatedFaxNumberEvent;
import org.mxchange.jphone.events.fax.deleted.AdminDeletedFaxNumberEvent;
import org.mxchange.jphone.events.fax.deleted.AdminFaxNumberDeletedEvent;
import org.mxchange.jphone.events.mobile.remove.AdminRemoveMobileNumberFromListEvent;
import org.mxchange.jphone.events.mobile.updated.AdminMobileNumberUpdatedEvent;
import org.mxchange.jphone.events.mobile.updated.AdminUpdatedMobileNumberEvent;
-import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
-import org.mxchange.jphone.phonenumbers.fax.FaxNumber;
-import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
-import org.mxchange.jphone.phonenumbers.landline.LandLineNumber;
-import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
-import org.mxchange.jphone.phonenumbers.mobile.MobileNumber;
-import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
-import org.mxchange.jphone.phonenumbers.phone.AdminPhoneSessionBeanRemote;
+import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
+import org.mxchange.jphone.model.phonenumbers.fax.FaxNumber;
+import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
+import org.mxchange.jphone.model.phonenumbers.landline.LandLineNumber;
+import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
+import org.mxchange.jphone.model.phonenumbers.mobile.MobileNumber;
+import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
+import org.mxchange.jphone.model.phonenumbers.phone.AdminPhoneSessionBeanRemote;
/**
* Administrative controller (bean) for phone numbers
*/
@Named ("adminPhoneController")
@RequestScoped
-public class JobsAdminPhoneWebRequestBean extends BaseJobsController implements JobsAdminPhoneWebRequestController {
-
- /**
- * Call-stack position
- */
- private static final short THREAD_STACK = 5;
+public class JobsAdminPhoneWebRequestBean extends BaseJobsBean implements JobsAdminPhoneWebRequestController {
/**
* Serial number
/**
* Remote EJB for phone number (administrative)
*/
+ @EJB (lookup = "java:global/jjobs-ejb/adminPhone!org.mxchange.jphone.model.phonenumbers.phone.AdminPhoneSessionBeanRemote")
private AdminPhoneSessionBeanRemote adminPhoneBean;
- /**
- * Bean helper
- */
- @Inject
- private JobsWebRequestHelperController beanHelper;
-
/**
* fax number
*/
* Generic hone controller
*/
@Inject
- private JobsPhoneWebApplicationController phoneController;
+ private JobsPhoneWebRequestController phoneController;
/**
* Country (for dial prefix)
/**
* When the phone entry has been created (persisted)
*/
- private Calendar phoneEntryCreated;
+ private Date phoneEntryCreated;
/**
* When the phone entry has been updated
*/
- private Calendar phoneEntryUpdated;
+ private Date phoneEntryUpdated;
/**
* Phone id (aka primary key)
public JobsAdminPhoneWebRequestBean () {
// Call super constructor
super();
-
- // String caller = MessageFormat.format("{0}.{1}", Thread.currentThread().getStackTrace()[3].getClassName(), Thread.currentThread().getStackTrace()[3].getMethodName());
- // System.out.println(MessageFormat.format("{0}: Constructed, caller: {1}", this.getClass().getSimpleName(), caller));
}
/**
* @return Phone entry created timestamp
*/
@SuppressWarnings ("ReturnOfDateField")
- public Calendar getPhoneEntryCreated () {
+ public Date getPhoneEntryCreated () {
return this.phoneEntryCreated;
}
* @param phoneEntryCreated Phone entry created timestamp
*/
@SuppressWarnings ("AssignmentToDateFieldFromParameter")
- public void setPhoneEntryCreated (final Calendar phoneEntryCreated) {
+ public void setPhoneEntryCreated (final Date phoneEntryCreated) {
this.phoneEntryCreated = phoneEntryCreated;
}
* @return Phone entry updated timestamp
*/
@SuppressWarnings ("ReturnOfDateField")
- public Calendar getPhoneEntryUpdated () {
+ public Date getPhoneEntryUpdated () {
return this.phoneEntryUpdated;
}
* @param phoneEntryUpdated Phone entry updated timestamp
*/
@SuppressWarnings ("AssignmentToDateFieldFromParameter")
- public void setPhoneEntryUpdated (final Calendar phoneEntryUpdated) {
+ public void setPhoneEntryUpdated (final Date phoneEntryUpdated) {
this.phoneEntryUpdated = phoneEntryUpdated;
}
this.phoneNumber = phoneNumber;
}
- /**
- * Post-construction method
- */
- @PostConstruct
- public void init () {
- // Try it
- try {
- // Get initial context
- Context context = new InitialContext();
-
- // Try to lookup the beans
- this.adminPhoneBean = (AdminPhoneSessionBeanRemote) context.lookup("java:global/jjobs-ejb/adminPhone!org.mxchange.jphone.phonenumbers.phone.AdminPhoneSessionBeanRemote"); //NOI18N
- } catch (final NamingException e) {
- // Throw it again
- throw new FaceletException(e);
- }
- }
-
/**
* Returns an instance of a DialableFaxNumber from all fields stored in this
* bean.