protected void updateEntityFields(ActionContext actionContext, IGTEntity entity) throws GTClientException { ConnectionSetupResultAForm form = (ConnectionSetupResultAForm) actionContext.getActionForm(); IGTConnectionSetupResultEntity result = (IGTConnectionSetupResultEntity) entity; IGTConnectionSetupParamEntity param = (IGTConnectionSetupParamEntity) result.getFieldValue(IGTConnectionSetupResultEntity.SETUP_PARAMETERS); Short status = form.getStatusShort(); if (IGTConnectionSetupResultEntity.STATUS_FAILURE.equals(status) || IGTConnectionSetupResultEntity.STATUS_NOT_DONE.equals(status)) { param.setFieldValue( IGTConnectionSetupParamEntity.ORIGINAL_LOCATION, form.getOriginalLocation()); param.setFieldValue( IGTConnectionSetupParamEntity.SERVICING_ROUTER, form.getServicingRouter()); param.setFieldValue( IGTConnectionSetupParamEntity.SECURITY_PASSWORD, form.getSecurityPassword()); } else if (IGTConnectionSetupResultEntity.STATUS_SUCCESS.equals(status)) { OperationContext opCon = OperationContext.getOperationContext(actionContext.getRequest()); List gridMasterList = (List) opCon.getAttribute(GRIDMASTER_LIST); List routerList = (List) opCon.getAttribute(ROUTER_LIST); Collection gridMasterUids = StaticCtrlUtils.getUids(gridMasterList); Collection routerUids = StaticCtrlUtils.getUids(routerList); result.setFieldValue(IGTConnectionSetupResultEntity.AVAILABLE_GRIDMASTERS, gridMasterUids); result.setFieldValue(IGTConnectionSetupResultEntity.AVAILABLE_ROUTERS, routerUids); } else { throw new java.lang.IllegalStateException( "Illegal STATUS for connectionSetupResult:" + status); } }
public ActionForward restoreSettings( ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws GTClientException { // @todo: use javaScript to do this (havent time to work out the code for setting the select // field now) try { ConnectionSetupResultAForm form = (ConnectionSetupResultAForm) actionForm; form.setCurrentLocation(form.getOriginalLocation()); form.setServicingRouter(form.getOriginalServicingRouter()); return update(mapping, actionForm, request, response); } catch (Throwable t) { throw new GTClientException("Error restoring original connectionSetup settings", t); } }