All pastes #764610 Raw Edit

hashmap testi

public text v1 · immutable
·published 2007-11-07 12:30 UTC
rendered paste body
package com.JASPartners.web.functions;

import java.util.*;

import org.apache.log4j.Logger;

import com.JASPartners.jastransactionservice.JASTransaction;

public class JASAccountsLedgerFunction extends JASTransaction {
	
	private static Logger logger = Logger.getLogger(JASQuestionFunction.class);
	
	public HashMap postProcess(HashMap resultSet) {
		logger.debug("JASAccountsLedgerFunction.postProcess(HashMap resultSet) called.");
		
		if (resultSet.containsKey("accountsLedger")) {
			logger.debug("found \"accountsLedger\" in resultSet");
			
			HashMap totalSum;
			
			Vector sumList = (Vector)resultSet.get("accountsLedger");
			Iterator listIterator = sumList.iterator();
			Double net_sum = null;
			logger.debug("Iterating through accountsLedger");
			while(listIterator.hasNext()){
		      totalSum = (HashMap)listIterator.next();
		      
				if (totalSum.get("net_sum") != null && !((String)totalSum.get("net_sum")).equals("")) {
					net_sum += new Double((String)totalSum.get("net_sum"));
				}
				
		    }
			resultSet.put("net_sum", net_sum);
		}
		
		return super.postProcess(resultSet);
	}

}