protected void prepLists(ActionContext actionContext, boolean reloaded) throws GTClientException { try { OperationContext opCon = OperationContext.getOperationContext(actionContext.getRequest()); List gridMasterList = (List) opCon.getAttribute(GRIDMASTER_LIST); if (reloaded || (gridMasterList == null)) { IGTConnectionSetupResultEntity result = (IGTConnectionSetupResultEntity) getEntity(actionContext); gridMasterList = (List) result.getFieldEntities(IGTConnectionSetupResultEntity.AVAILABLE_GRIDMASTERS); List routerList = (List) result.getFieldEntities(IGTConnectionSetupResultEntity.AVAILABLE_ROUTERS); if (gridMasterList == null) throw new NullPointerException("gridMasterList is null"); // 20030422AH if (routerList == null) throw new NullPointerException("routerList is null"); // 20030422AH opCon.setAttribute(GRIDMASTER_LIST, gridMasterList); opCon.setAttribute(ROUTER_LIST, routerList); ConnectionSetupResultAForm form = (ConnectionSetupResultAForm) actionContext.getActionForm(); String initRoutersOrder = StaticUtils.initialOrderString(routerList.size()); String initMastersOrder = StaticUtils.initialOrderString(gridMasterList.size()); form.setAvailableGridMastersOrder(initMastersOrder); form.setAvailableRoutersOrder(initRoutersOrder); } } catch (Throwable t) { throw new GTClientException( "Error prepping GridMaster and Router lists in OperationContext", t); } }
protected void arrangeLists(ActionContext actionContext) throws GTClientException { try { ConnectionSetupResultAForm form = (ConnectionSetupResultAForm) actionContext.getActionForm(); // IGTConnectionSetupResultEntity result = // (IGTConnectionSetupResultEntity)getEntity(actionContext); Short status = form.getStatusShort(); if (IGTConnectionSetupResultEntity.STATUS_SUCCESS.equals(status)) { OperationContext opCon = OperationContext.getOperationContext(actionContext.getRequest()); List gridMasterList = (List) opCon.getAttribute(GRIDMASTER_LIST); if (gridMasterList == null) throw new NullPointerException("gridMasterList (inOpCon"); // 20030422AH List routerList = (List) opCon.getAttribute(ROUTER_LIST); if (routerList == null) throw new NullPointerException("routerList (in opCon)"); // 20030422AH StaticUtils.arrangeList(gridMasterList, form.getAvailableGridMastersOrder()); StaticUtils.arrangeList(routerList, form.getAvailableRoutersOrder()); form.setAvailableGridMastersOrder(StaticUtils.initialOrderString(gridMasterList.size())); form.setAvailableRoutersOrder(StaticUtils.initialOrderString(routerList.size())); } } catch (Throwable t) { throw new GTClientException( "Error processing order of availableRouters and availableGridMasters", t); } }