public Object executeTask(Object object) throws Exception { Map incomingRequest = (Map) object; Object result = null; try { if (incomingRequest.containsKey("InspectionLine_icInspNo")) { PuridiomProcessLoader processLoader = new PuridiomProcessLoader((String) incomingRequest.get("organizationId")); PuridiomProcess process = processLoader.loadProcess("inspection-update-line-row.xml"); Object inspCritNoObj = incomingRequest.get("InspectionLine_critNo"); String inspectCode = (String) incomingRequest.get("InspectionLine_inspectCode"); if (!HiltonUtility.isEmpty(inspectCode)) { if (inspCritNoObj instanceof String[]) { int arraySize = ((String[]) inspCritNoObj).length; Set keySet = incomingRequest.keySet(); for (int i = 0; i < arraySize; i++) { Map updateParameters = new HashMap(); updateParameters.put("userId", incomingRequest.get("userId")); updateParameters.put("userTimeZone", incomingRequest.get("userTimeZone")); updateParameters.put("organizationId", incomingRequest.get("organizationId")); updateParameters.put("dbsession", incomingRequest.get("dbsession")); updateParameters.put( "InspectionLine_icInspNo", incomingRequest.get("InspectionLine_icInspNo")); updateParameters.put( "InspectionLine_icInspLine", incomingRequest.get("InspectionLine_icInspLine")); Iterator iterator = keySet.iterator(); while (iterator.hasNext()) { String key = (String) iterator.next(); if (key.indexOf("InspectionLine_") == 0) { Object obj = incomingRequest.get(key); if (obj instanceof String[]) { String arrayObj[] = (String[]) obj; updateParameters.put(key, arrayObj[i]); } } } updateParameters.put( "InspectionLine_inspectCode", incomingRequest.get("InspectionLine_inspectCode")); process.executeProcess(updateParameters); } } else { incomingRequest.put( "InspectionLine_icInspNo", incomingRequest.get("InspectionLine_icInspNo")); incomingRequest.put( "InspectionLine_icInspLine", incomingRequest.get("InspectionLine_icInspLine")); incomingRequest.put("InspectionLine_seqNo", "1"); process.executeProcess(incomingRequest); } } } else { throw new Exception("The value for InspectionLine_icInspNo was not found."); } this.setStatus(Status.SUCCEEDED); } catch (Exception e) { this.setStatus(Status.FAILED); throw e; } return result; }
/* (non-Javadoc) * @see com.tsagate.puridiom.process.ITask#executeTask(java.lang.Object) */ public Object executeTask(Object object) throws Exception { Map incomingRequest = (Map) object; Object result = null; try { if (incomingRequest.containsKey("InspectionStd_standardCode")) { PuridiomProcessLoader processLoader = new PuridiomProcessLoader((String) incomingRequest.get("organizationId")); PuridiomProcess process = processLoader.loadProcess("inspectionstd-update-std-row.xml"); Object inspObj = incomingRequest.get("InspectionStd_inspectCode"); if (inspObj instanceof String[]) { int arraySize = ((String[]) inspObj).length; Set keySet = incomingRequest.keySet(); for (int i = 0; i < arraySize; i++) { Map updateParameters = new HashMap(); updateParameters.put("userId", incomingRequest.get("userId")); updateParameters.put("userTimeZone", incomingRequest.get("userTimeZone")); updateParameters.put("organizationId", incomingRequest.get("organizationId")); updateParameters.put("dbsession", incomingRequest.get("dbsession")); updateParameters.put( "InspectionStd_icInspStd", incomingRequest.get("InspectionStd_icInspStd")); updateParameters.put( "InspectionStd_standardCode", incomingRequest.get("InspectionStd_standardCode")); updateParameters.put( "InspectionStd_description", incomingRequest.get("InspectionStd_description")); updateParameters.put("InspectionStd_cgdNo", incomingRequest.get("InspectionStd_cgdNo")); updateParameters.put( "InspectionStd_cgdRev", incomingRequest.get("InspectionStd_cgdRev")); updateParameters.put( "InspectionStd_inspectType", incomingRequest.get("InspectionStd_inspectType")); updateParameters.put( "InspectionStd_defaultFlag", incomingRequest.get("InspectionStd_defaultFlag_" + i)); updateParameters.put("InspectionStd_owner", incomingRequest.get("InspectionStd_owner")); updateParameters.put( "InspectionStd_status", incomingRequest.get("InspectionStd_status")); updateParameters.put( "InspectionStd_dateEntered", incomingRequest.get("InspectionStd_dateEntered")); updateParameters.put( "InspectionStd_dateExpires", incomingRequest.get("InspectionStd_dateExpires")); Iterator iterator = keySet.iterator(); while (iterator.hasNext()) { String key = (String) iterator.next(); if (key.indexOf("InspectionStd_") == 0) { Object obj = incomingRequest.get(key); System.out.println(key + "=" + obj); if (obj instanceof String[]) { String arrayObj[] = (String[]) obj; updateParameters.put(key, arrayObj[i]); System.out.println(key + "=" + arrayObj[i]); } } } process.executeProcess(updateParameters); } } else { incomingRequest.put( "InspectionStd_defaultFlag", incomingRequest.get("InspectionStd_defaultFlag_0")); process.executeProcess(incomingRequest); } } else { throw new Exception("Unable to find Standard Code"); } this.setStatus(Status.SUCCEEDED); } catch (Exception e) { this.setStatus(Status.FAILED); throw e; } return result; }