public static void main(String[] args) { try { PersonSrvsRegionManager ssrMgr = new PersonSrvsRegionManager(); List regnList = ssrMgr.getSubscribedSrvsRegions("1", "2", "B"); PersonAction action = new PersonAction(); List locnsList = action.prepareLocationFormList(regnList); SubscribeServiceForm form = new SubscribeServiceForm(); form.populateForm(locnsList); List locnForms = form.getLocns(); System.out.println("Getting the results from the form : "); for (int x = 0; x < locnForms.size(); x++) { LocationForm form1 = (LocationForm) locnForms.get(x); System.out.println(form1.getRegionId1()); System.out.println(form1.getRegionId2()); System.out.println(form1.getRegionName1()); System.out.println(form1.getRegionName2()); } } catch (Exception ex) { ex.printStackTrace(); } }
public ActionForward editSubServiceLocation( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // If user pressed 'Cancel' button, // return to home page CommonLogger.logDebug(log, "In PersonAction:editSubServiceLocation() "); if (isCancelled(request)) { return mapping.findForward("home"); } try { String personId = request.getParameter(BSIConstants.PERSON_ID); String serviceId = request.getParameter(BSIConstants.SERVICE_ID); String serviceName = request.getParameter(BSIConstants.SERVICE_NAME); String personType = request.getParameter(BSIConstants.PERSON_TYPE); CommonLogger.logInfo( log, "Executing the editSubServiceLocation action for the person id:" + personId + ",serviceId = " + serviceId + ",serviceName = " + serviceName + " personType=" + personType); PersonSrvsRegionManager ssrMgr = new PersonSrvsRegionManager(); List regnList = ssrMgr.getSubscribedSrvsRegions(personId, serviceId, personType); /* //Get the service properties. ServiceManager svsMgr = new ServiceManager(); Set propertySet = svsMgr.getServiceProperties(serviceId); //Get service propety values */ SubscribeServiceForm subForm = (SubscribeServiceForm) form; /* * LocationForm locForm = null; ServiceRegion svsRegn = null; String * countryId = null; String countryName = null; String stateId = * null; String stateName = null; String locationId = null; String * locationName = null; List locnsList = new ArrayList(); * * for (int z=0;z<serviceRegnList.size();z++) { locForm = new * LocationForm(); * * svsRegn = (ServiceRegion)serviceRegnList.get(z); //Get the list * of all countries. countryId = * svsRegn.getCountry().getId().toString(); countryName = * svsRegn.getCountry().getName(); * * stateId = svsRegn.getState().getId().toString(); stateName = * svsRegn.getState().getName(); locationId = * svsRegn.getLocation().getId().toString(); locationName = * svsRegn.getLocation().getName(); * * locForm.setCountryId(countryId); * locForm.setCountryName(countryName); locForm.setStateId(stateId); * locForm.setStateName(stateName); * locForm.setLocationId(locationId); * locForm.setLocationName(locationName); locnsList.add(locForm); } */ List locnsLit = prepareLocationFormList(regnList); subForm.populateForm(locnsLit); List countryList = getCountriesList(); request.setAttribute(BSIConstants.COUNTRY_LIST, countryList); } catch (BSIException ex1) { ActionErrors errors = new ActionErrors(); CommonLogger.logDebug( log, "In SupplierAction:edit() \n exception occured. Exception message is " + ex1.getMessage()); errors.add( ActionErrors.GLOBAL_MESSAGE, new ActionMessage(ex1.getErrorCode(), ex1.getMessage())); saveErrors(request, errors); } catch (Exception ex2) { throw ex2; } finally { request.setAttribute(BSIConstants.ACTION_TYPE, BSIConstants.EDIT); } return mapping.findForward("success"); }