0% found this document useful (0 votes)
23 views9 pages

Impl JAVA

This document contains Java code for a class called UpdateOrderActionAttributesImpl that extends the UpdateOrderActionAttributesPHD class. It contains fields and methods for handling user interface elements like text fields, checkboxes, labels, and dropdowns related to updating order action attributes. Methods include handling events from the UI elements, retrieving and setting location details, and validating required fields before saving.

Uploaded by

Akanksha Shukla
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
Download as txt, pdf, or txt
0% found this document useful (0 votes)
23 views9 pages

Impl JAVA

This document contains Java code for a class called UpdateOrderActionAttributesImpl that extends the UpdateOrderActionAttributesPHD class. It contains fields and methods for handling user interface elements like text fields, checkboxes, labels, and dropdowns related to updating order action attributes. Methods include handling events from the UI elements, retrieving and setting location details, and validating required fields before saving.

Uploaded by

Akanksha Shukla
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1/ 9

/**

*
*/
package com.amdocs.oms.cust.activities;

import java.util.Date;
import javax.swing.ToolTipManager;
import amdocs.epi.util.params.StringHolder;
import com.amdocs.oms.activities.UpdateOrderActionAttributes;
import com.amdocs.oms.cust.common.CommonUtilities;
import com.amdocs.oms.cust.common.GUIConstants;
import com.amdocs.oms.cust.order.OrderingFrameworkImpl;
import com.amdocs.oms.phd.activities.UpdateOrderActionAttributesPHD;
import com.amdocs.uif.action.UifAction;
import com.amdocs.uif.action.UifCancellableActionEvent;
import com.amdocs.uif.action.UifSubmitAction;
import com.amdocs.uif.action.UifSubscribingAction;
import com.amdocs.uif.data.UifDataModel;
import com.amdocs.uif.data.UifTabularDataModel;
import com.amdocs.uif.event.UifEvent;
import com.amdocs.uif.widgets.UifCheckBox;
import com.amdocs.uif.widgets.UifComboBox;
import com.amdocs.uif.widgets.UifDateTime;
import com.amdocs.uif.widgets.UifLabel;
import com.amdocs.uif.widgets.UifTextField;
import com.amdocs.uif.workspace.UifForm;
import com.amdocs.uif.workspace.UifFormEvent;

/**
* @author kirilo
*
*/
/** Author: Daria Dudkin
* Supervisor: Yakir Fadida
* Change Date: 2/17/2014
* Change Number: Tef#1
* Change Description: disable return device when it owned and block the province
and locality in Cease or suspend or provide OA
* Task TS - OMS - CR000 - IL - Refactoring UOAA screen GUI side

*
-----------------------------------------------------------------------------------
----
* Author: Iyar Madmon
* Supervisor: Aviv Garama
* Change Date: 6/11/2014
* Change Number: Tef#2
* Change Description: Validate Similarity in acquisition types.
* Task TS - OMS - CR103 - IL - Triangulated - NPC validations
*
-----------------------------------------------------------------------------------
----
* Author: Iyar Madmon
* Supervisor: Aviv Garama
* Change Date: 6/12/2014
* Change Number: Tef#3
* Change Description: remove the isEnableReturnDevice method and moving the logic
to the uiff, by adding
* a binding to enable of the return device check
box
* TS - OMS - PR11 - IL - fix return device check box enabling
*
-----------------------------------------------------------------------------------
----
* Author: Shefali Shetty
* Supervisor: Shruti Chavan
* Change Date: 11/28/2014
* Change Number: Phase3#001
* Change Description: make Locality,Province invisible for Provide Wireline flow
and removed checkIfNextAllowed since its same as checkIfSaveAllowed
*
-----------------------------------------------------------------------------------
----
* Author: Emerson Ferreira
* Supervisor: Cesar Abe
* Change Date: 01 Sep 2015
* Change Number: TEF_GLX_P1 TA593
* Task Name: ReturnDevice checkbox
* -------------------------------------------------------------------------------
* Author: Matheus Colussi
* Supervisor: Cesar Abe
* Change Date: 08 Oct 2015
* Change Number: TEF_GLX#01
* Task Name: Fix for defect 8587
* -------------------------------------------------------------------------------
*/

public class UpdateOrderActionAttributesImpl extends UpdateOrderActionAttributesPHD


{
protected UifTextField inputSalesCode;

protected UifCheckBox chkIsReturnDevice;

protected UifTabularDataModel provinceTDM;

protected UifDataModel retrieveLocationDetailsInputDM;

protected UifDataModel retrieveLocationDetailsOutputDM;

protected UifDataModel retrivalModeEnumDM;

protected UifDataModel customerDetailsVDM;

protected UifDataModel controlStatesDM;

protected UifTabularDataModel isReturnDeviceCheckboxMapTDM;

protected UifLabel lblProvince;

protected UifComboBox cmbProvince;

protected UifLabel lblLocality;

protected UifComboBox cmbLocality;

protected UifSubmitAction retrieveLocationDetails;


protected UifLabel lblSales;

protected UifSubscribingAction saveAndValidateActivityData;

protected UifSubscribingAction saveActivityData;

public static final String LOCATION_INFO_MISSING_CN =


"LOCATION_INFO_MISSING";

public static final String NON_SIMILIAR_ACQUISITION_TYPES_CN =


"NON_SIMILIAR_ACQUISITION_TYPES"; // Tef#2

//GLX #1 - Start
protected UifDateTime dtFutureResumeDate;
protected UifCheckBox cbFutureResumeDate;
protected UifDateTime dtStartDate;
public static final String suspendOrderActionType = "SU";
public UifDataModel actionType;
//GLX #1 - End

/**
* Description: this method will be called every time the selected value in
* the Province drop down is changed. and by that refreshing the localities
* list of valid values.
*
* @param UifEvent
* event
*/
public void cmbProvince_PostValueChange(UifEvent event) {
if (((UifComboBox) event.getSource()).getSelectedIndex() != -1) {
cmbLocality.setEnabled(true);
cmbLocality.setEditable(true);
} else {
cmbLocality.setEnabled(false);
cmbLocality.setEditable(false);
}

UpdateOrderActionAttributesSdoVDM.setStringValue("LocationX9", null);
}

// start Tef#1
public void cmbProvince_EnableProv() {
if ((Boolean) this.UpdateOrderActionAttributesSdoVDM
.getValue("IsToBlockProvAndLocaGroupX9")) {
cmbProvince.setEnabled(true);
cmbProvince.setEditable(true);
} else {
cmbProvince.setEnabled(false);
cmbProvince.setEditable(false);
cmbLocality.setEnabled(false);
cmbLocality.setEditable(false);
}

/**
* Description: this method is in charge of setting the action's input.
*
* @param UifCancellableActionEvent
* event
*/
public void retrieveLocationDetails_ActionStart(
UifCancellableActionEvent event) {
retrivalModeEnumDM.setValue("Value", "KeysOnly");
retrieveLocationDetailsInputDM.setValue("RetrivalModeX9",
retrivalModeEnumDM);
}

/**
* method to include ToolTip when needed.
*
* @version TEF_GLX_P1 TA593
*
* @author Emerson Ferreira
* @since 02/09/2015
*
* @param event
*/
public void form_PostOpen(UifFormEvent event) {
super.form_postOpen(event);

cmbProvince_EnableProv();

Boolean isNotOwned = Boolean


.valueOf(this.UpdateOrderActionAttributesSdoVDM
.getStringValue("IsNotOwnedDeviceX9"));
if (!isNotOwned) {
ToolTipManager.sharedInstance().setInitialDelay(0);
ToolTipManager.sharedInstance().setDismissDelay(5000);
chkIsReturnDevice
.setToolTipText(getString("IS_OWNED_OR_DONT_HAVE_DEVI
CE_MSG"));
ToolTipManager.sharedInstance().setEnabled(true);
}

String productType = String


.valueOf(this.UpdateOrderActionAttributesSdoVDM
.getStringValue("ProductTypeX9"));

if (productType != null && productType.equalsIgnoreCase("OTT")) {


chkIsReturnDevice.setVisible(false);
}

setDatesForFutureOrder();
}

/**
* The method iterates over each active SDO and checks whether mandatory
* fields were populated for saving
*
* @param N
* /A
*
* @return boolean
*/
protected boolean checkIfSaveAllowed(StringHolder errorMessageHolder) {
UifTabularDataModel sdos = (UifTabularDataModel) getContainingForm()
.getDataset().getDataModelByName("stepInstancesTDM");

int sdosCount = sdos.getRecordCount();


String province, locality;
for (int i = 0; i < sdosCount; i++) {
// check only for the active steps
if (!((Boolean) sdos.getValueAt(i, "Active"))) {
continue;
}

// get locality info


province = sdos.getStringValueAt(i, "StepDataObject:ProvinceX9");
locality = sdos.getStringValueAt(i, "StepDataObject:LocationX9");

String checkIfWireline = ((com.amdocs.uif.data.UifDataModel) this


.getTopLevelForm().getDataset()
.getDataModelByName("InstallationAddressDM"))
.getStringValue("AddressIDX9");

String actionType =
this.UpdateOrderActionAttributesSdoVDM.getValue("OrderAction:OrderActionDetails:Act
ionType:ValueAsString").toString();

// return false in case of not populated


if ((CommonUtilities.isEmpty(province) || CommonUtilities
.isEmpty(locality)) && checkIfWireline == null) {
if(!actionType.equalsIgnoreCase("SA"))
{
errorMessageHolder
.setValue(getString(LOCATION_INFO_MISSING
_CN));
return false;
}
}
}

return true;
}

/**
* Method returns action for saving and validating activity
**/
public UifAction getSaveAndValidateActivityAction() {
return saveAndValidateActivityData;
}

/**
* Method returns action for saving activity
**/
public UifAction getSaveActivityAction() {
return saveActivityData;
}

/**
* The method is called once "Save" button is clicked Checks if all
* mandatory parameters were populated for "Save" action
*
* @param UifCancellableActionEvent
* event
*
* @return N/A
*/
public void saveActivityData_ActionStart(UifCancellableActionEvent event) {
onHoldNavigation.setEnabled(false);
saveActivityData.setEnabled(true);

StringHolder errorMessageHolder = new StringHolder();


// check if next allowed
if (!checkIfSaveAllowed(errorMessageHolder)
|| !
validateSimilarityOfAcquisitionType(errorMessageHolder)) {
getWorkspace().alert((String) errorMessageHolder.getValue());
event.setCancel(true);
saveActivityData.setEnabled(false);
}

onHoldNavigation.setEnabled(true);
}

/**
* The method is called once "Next" button is clicked Checks if all
* mandatory parameters were populated for "Next" action
*
* @param UifCancellableActionEvent
* event
*
* @return N/A
*/
public void saveAndValidateActivityData_ActionStart(
UifCancellableActionEvent event) {
onHoldNavigation.setEnabled(false);
saveActivityData.setEnabled(true);

StringHolder errorMessageHolder = new StringHolder();


// check if next allowed
if (!checkIfSaveAllowed(errorMessageHolder)
|| !
validateSimilarityOfAcquisitionType(errorMessageHolder)) {
getWorkspace().alert((String) errorMessageHolder.getValue());
event.setCancel(true);
saveAndValidateActivityData.setEnabled(false);
}

onHoldNavigation.setEnabled(true);
}

// start Tef#2
/**
* The method validates that there aren't both "purchased" and
* "triangulated" acquisition types in one order. Relevant only for cease
* and change and in a return device situation. The method is called both
* from "saveActivityData_ActionStart" and
* "saveAndValidateActivityData_ActionStart".
*/
private boolean validateSimilarityOfAcquisitionType(
StringHolder errorMessageHolder) {
String designatedAcquisitionType = null;
UifDataModel curStepInstDM;
String curAcquisitionType;
Boolean isReturnDevice;
Boolean isPurchasedOrTriangulated;

boolean isOACeaseOrChange = Boolean


.valueOf(UpdateOrderActionAttributesSdoVDM
.getStringValue("IsOACeaseOrChangeX9"));
if (!isOACeaseOrChange) {
return true;
}

for (int i = 0; i < this.stepInstancesVTDM.getRecordCount(); i++) {


curStepInstDM = stepInstancesVTDM.getAt(i);
if (!(Boolean) curStepInstDM.getValue("Active")) {
continue;
}

curAcquisitionType = curStepInstDM
.getStringValue("StepDataObject:AcquisitionTypeX9");
isReturnDevice = (Boolean) curStepInstDM
.getValue("StepDataObject:ReturnDeviceX9");
isPurchasedOrTriangulated =
GUIConstants.ACQUISITION_TYPE_PURCHASED
.equals(curAcquisitionType)
|| GUIConstants.ACQUISITION_TYPE_TRIANGULATED
.equals(curAcquisitionType);

if (!(curAcquisitionType != null && isPurchasedOrTriangulated &&


isReturnDevice)) {
continue;
}

if (designatedAcquisitionType == null) {
designatedAcquisitionType = curAcquisitionType;
} else if (!designatedAcquisitionType.equals(curAcquisitionType))
{
errorMessageHolder
.setValue(getString(NON_SIMILIAR_ACQUISITION_TY
PES_CN));
return false;
}
}
return true;
}

/**
* @param event
* The event object.
*/

// Phase3#001-start
public void form_PreLoad(UifFormEvent event) {
// TODO Auto-generated method stub
super.form_PreLoad(event);
//(getWorkspace().findForms(null, null,
"com.amdocs.crm.common.contextmanager.ContextManagerUtilityForm", null)[0]);
if (((com.amdocs.uif.data.UifDataModel) this.getTopLevelForm()
.getDataset().getDataModelByName("InstallationAddressDM"))
.getStringValue("AddressIDX9") != null) {
lblLocality.setVisible(false);
lblProvince.setVisible(false);
cmbProvince.setVisible(false);
cmbLocality.setVisible(false);

} else {
lblLocality.setVisible(true);
lblProvince.setVisible(true);
cmbProvince.setVisible(true);
cmbLocality.setVisible(true);
cmbProvince.setRequired(true);
cmbLocality.setRequired(true);
}
}// Phase3#001-end

/**
* @param event
* The event object.
*/
public void form_PostDataModelsCreate(UifFormEvent event) {
// TODO Auto-generated method stub
super.form_PostDataModelsCreate(event);
}

// end Tef#2

// Start TEF_GLX#01

@Override
public void cmbReason_PostValueChange(UifEvent event) {

Object fieldValue = this.cmbReason.getSelectedValue();


Object reasonId = this.UpdateOrderActionAttributesSdoVDM
.getValue("ReasonID:Reason:ValueAsString");
Object reasonText = this.UpdateOrderActionAttributesSdoVDM
.getValue("ReasonFreeText");

if (null != reasonId) {
if (null == fieldValue) {
this.cmbReason.setSelectedValue(reasonId);
this.txtaReasonText.setEditable(true);
this.txtaReasonText.setEnabled(true);
if ((null != reasonText) && (!reasonText.equals(""))) {
this.UpdateOrderActionAttributesSdoVDM.setValue(
"ReasonFreeText", reasonText.toString());
}
}
}

if (null == fieldValue) {
if ((this.txtaReasonText.getText() != null) && (null !=
reasonText)
&& (reasonText.equals(""))) {
this.UpdateOrderActionAttributesSdoVDM.setValue(
"ReasonFreeText", null);
}

this.cmbReason.setSelectedValue(null);
this.txtaReasonText.setEditable(false);
this.txtaReasonText.setEnabled(false);
} else {
this.txtaReasonText.setEditable(true);
this.txtaReasonText.setEnabled(true);
}
}

// End TEF_GLX#01

private void setDatesForFutureOrder()


{
calculatedDM.setValue("minSRDDate",
calculatedDM.getValue("applicationDate"));
}

//GLX #1 - Start
/**
*
*/
/*private void setDatesForFutureOrder() {

UifDataModel validSRDDate = (UifDataModel)


UpdateOrderActionAttributesSdoVDM.getValue("ValidSRDDateIntervalX9");
if(validSRDDate != null && !validSRDDate.isEmpty())
{
Date minSRDDate = (Date) validSRDDate.getValue("FromDateX9");
Date maxSRDDate = (Date) validSRDDate.getValue("ToDateX9");

calculatedDM.setValue("minSRDDate", minSRDDate);
calculatedDM.setValue("maxSRDDate", maxSRDDate);

dtServiceRequiredDate.setDate(minSRDDate);

dtDueDate.setDate(minSRDDate);
}
}*/

/**
* @param event The event object.
*/
public void dtServiceRequiredDate_PostValueChange(UifEvent event)
{
super.dtServiceRequiredDate_PostValueChange(event);
onHoldNavigation.setEnabled(true);
}
//GLX #1 - End

You might also like