import org.mxchange.jcontacts.phone.AdminContactsPhoneSessionBeanRemote;
import org.mxchange.jjobs.beans.BaseJobsController;
import org.mxchange.jjobs.beans.helper.JobsWebRequestController;
+import org.mxchange.jphone.events.cellphone.deleted.AdminCellphoneNumberDeletedEvent;
+import org.mxchange.jphone.events.cellphone.deleted.AdminDeletedCellphoneNumberEvent;
import org.mxchange.jphone.events.updated.AdminCellphoneNumberUpdatedEvent;
import org.mxchange.jphone.events.updated.AdminUpdatedCellphoneNumberEvent;
import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber;
@Inject
private JobsWebRequestController beanHelper;
+ /**
+ * Event being fired when an administrator has deleted cell phone number
+ */
+ @Inject
+ @Any
+ private Event<AdminDeletedCellphoneNumberEvent> cellPhoneNumberDeletedEvent;
+
/**
* Event being fired when an administrator has updated cell phone number
*/
}
}
+ @Override
+ public String deleteCellphoneData () {
+ // Is all data set
+ if (this.beanHelper.getCellPhoneNumber() == null) {
+ // Not set, throw NPE
+ throw new NullPointerException("this.cellphoneNumber is null"); //NOI18N
+ } else if (this.beanHelper.getCellPhoneNumber().getPhoneId() == null) {
+ // Throw NPE again
+ throw new NullPointerException("this.cellphoneNumber.phoneId is null"); //NOI18N
+ } else if (this.beanHelper.getCellPhoneNumber().getPhoneId() < 1) {
+ // Invalid number
+ throw new IllegalArgumentException(MessageFormat.format("this.cellphoneNumber.phoneId={0} is not valid", this.beanHelper.getCellPhoneNumber().getPhoneId())); //NOI18N
+ } else if (this.beanHelper.getCellPhoneNumber().getCellphoneProvider() == null) {
+ // Throw NPE
+ throw new NullPointerException("this.cellphoneNumber.cellphoneProvider is null"); //NOI18N
+ } else if (this.beanHelper.getCellPhoneNumber().getCellphoneProvider().getProviderId() == null) {
+ // ... throw again
+ throw new NullPointerException("this.cellphoneNumber.cellphoneProvider.providerId is null"); //NOI18N
+ } else if (this.beanHelper.getCellPhoneNumber().getCellphoneProvider().getProviderId() < 1) {
+ // Id not valid
+ throw new IllegalArgumentException(MessageFormat.format("this.cellphoneNumber.cellphoneProvider.providerId={0} is not valid.", this.beanHelper.getCellPhoneNumber().getCellphoneProvider().getProviderId())); //NOI18N
+ } else if (this.beanHelper.getCellPhoneNumber().getPhoneNumber() == null) {
+ // Throw NPE again
+ throw new NullPointerException("this.cellphoneNumber.phoneNumber is null"); //NOI18N
+ } else if (this.beanHelper.getCellPhoneNumber().getPhoneNumber() < 1) {
+ // Throw NPE again
+ throw new NullPointerException(MessageFormat.format("this.cellphoneNumber.phoneNumber={0} is not valid.", this.beanHelper.getCellPhoneNumber().getPhoneNumber())); //NOI18N
+ }
+
+ // Call EJB
+ this.adminPhoneBean.deleteCellphoneData(this.beanHelper.getCellPhoneNumber());
+
+ // Fire event
+ this.cellPhoneNumberDeletedEvent.fire(new AdminCellphoneNumberDeletedEvent(this.beanHelper.getCellPhoneNumber()));
+
+ // All fine, redirect
+ return "admin_list_cellphone?faces-redirect=true&includeViewParams=true"; //NOI18N
+ }
+
@Override
public String editCellphoneData () {
// Is all data set
</ui:define>
<ui:define name="content">
- Here goes your content.
+ <h:form id="form_delete_cellphone" rendered="#{not empty beanHelper.cellPhoneNumber}">
+ <div class="table">
+ <div class="table_header">
+ <h:outputText value="#{msg.ADMIN_DELETE_CELLPHONE_TITLE}" />
+ </div>
+
+ <div class="para">
+ <ui:include src="/WEB-INF/templates/admin/cellphone/admin_cellphone_data.tpl">
+ <ui:param name="isShowPage" value="#{false}" />
+ </ui:include>
+ </div>
+
+ <div class="para">
+ <h:outputText value="#{msg.ADMIN_DELETE_CELLPHONE_DATA_NOTICE}"
+ </div>
+
+ <div class="table_footer">
+ <h:commandButton styleClass="delete_button" type="submit" id="delete_cellphone" value="#{msg.BUTTON_ADMIN_DELETE_CELLPHONE}" action="#{adminPhoneController.deleteCellphoneData()}" />
+ </div>
+ </div>
+ </h:form>
+
+ <h:outputText styleClass="errors" value="#{msg.ERROR_ADMIN_BEAN_CELLPHONE_NUMBER_NOT_SET}" rendered="#{empty beanHelper.cellPhoneNumber}" />
</ui:define>
</ui:composition>
</html>