svn commit: r1062463 - in /ofbiz/trunk/applications/content/src/org/ofbiz/content/survey: PdfSurveyServices.java SurveyWrapper.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1062463 - in /ofbiz/trunk/applications/content/src/org/ofbiz/content/survey: PdfSurveyServices.java SurveyWrapper.java

mrisaliti
Author: mrisaliti
Date: Sun Jan 23 16:24:50 2011
New Revision: 1062463

URL: http://svn.apache.org/viewvc?rev=1062463&view=rev
Log:
Remove some java compilation warnings of SurveyWrapper/PdfSurveyServices (OFBIZ-4102)

Modified:
    ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/PdfSurveyServices.java
    ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/PdfSurveyServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/PdfSurveyServices.java?rev=1062463&r1=1062462&r2=1062463&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/PdfSurveyServices.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/PdfSurveyServices.java Sun Jan 23 16:24:50 2011
@@ -38,6 +38,7 @@ import javolution.util.FastMap;
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.GeneralException;
 import org.ofbiz.base.util.UtilDateTime;
+import org.ofbiz.base.util.UtilGenerics;
 import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.content.data.DataResourceWorker;
@@ -88,7 +89,7 @@ public class PdfSurveyServices {
             PdfReader pdfReader = new PdfReader(byteBuffer.array());
             PdfStamper pdfStamper = new PdfStamper(pdfReader, os);
             AcroFields acroFields = pdfStamper.getAcroFields();
-            Map acroFieldMap = acroFields.getFields();
+            Map<String, Object> acroFieldMap = UtilGenerics.checkMap(acroFields.getFields());
 
             String contentId = (String) context.get("contentId");
             GenericValue survey = null;
@@ -103,14 +104,13 @@ public class PdfSurveyServices {
             }
 
             // create a SurveyQuestionCategory to put the questions in
-            Map createCategoryResultMap = dispatcher.runSync("createSurveyQuestionCategory",
-                    UtilMisc.<String, Object>toMap("description", "From AcroForm in Content [" + contentId + "] for Survey [" + surveyId + "]", "userLogin", userLogin));
+            Map<String, Object> createCategoryResultMap = dispatcher.runSync("createSurveyQuestionCategory", UtilMisc.<String, Object>toMap("description", "From AcroForm in Content [" + contentId + "] for Survey [" + surveyId + "]", "userLogin", userLogin));
             String surveyQuestionCategoryId = (String) createCategoryResultMap.get("surveyQuestionCategoryId");
 
             pdfStamper.setFormFlattening(true);
-            Iterator i = acroFieldMap.keySet().iterator();
+            Iterator<String> i = acroFieldMap.keySet().iterator();
             while (i.hasNext()) {
-                String fieldName = (String) i.next();
+                String fieldName = i.next();
                 AcroFields.Item item = acroFields.getFieldItem(fieldName);
                 int type = acroFields.getFieldType(fieldName);
                 String value = acroFields.getField(fieldName);
@@ -178,10 +178,10 @@ public class PdfSurveyServices {
                     PdfObject typeValue = null;
                     PdfObject tuValue = null;
 
-                    Set dictKeys = dict.getKeys();
-                    Iterator dictKeyIter = dictKeys.iterator();
+                    Set<PdfName> dictKeys = UtilGenerics.checkSet(dict.getKeys());
+                    Iterator<PdfName> dictKeyIter = dictKeys.iterator();
                     while (dictKeyIter.hasNext()) {
-                        PdfName dictKeyName = (PdfName) dictKeyIter.next();
+                        PdfName dictKeyName = dictKeyIter.next();
                         PdfObject dictObject = dict.get(dictKeyName);
 
                         if ("/Type".equals(dictKeyName.toString())) {
@@ -233,7 +233,7 @@ public class PdfSurveyServices {
             return ServiceUtil.returnError(errMsg);
         }
 
-        Map results = ServiceUtil.returnSuccess();
+        Map<String, Object> results = ServiceUtil.returnSuccess();
         results.put("surveyId", surveyId);
         return results;
     }
@@ -242,10 +242,8 @@ public class PdfSurveyServices {
      *
      */
     public static Map<String, Object> buildSurveyResponseFromPdf(DispatchContext dctx, Map<String, ? extends Object> context) {
-
         String surveyResponseId = null;
         try {
-
             Delegator delegator = dctx.getDelegator();
             String partyId = (String)context.get("partyId");
             String surveyId = (String)context.get("surveyId");
@@ -269,18 +267,15 @@ public class PdfSurveyServices {
             PdfReader r = new PdfReader(byteBuffer.array());
             PdfStamper s = new PdfStamper(r,os);
             AcroFields fs = s.getAcroFields();
-            Map hm = fs.getFields();
-
-
+            Map<String, Object> hm = UtilGenerics.checkMap(fs.getFields());
             s.setFormFlattening(true);
-            Iterator i = hm.keySet().iterator();
+            Iterator<String> i = hm.keySet().iterator();
             while (i.hasNext()) {
-                String fieldName = (String)i.next();
+                String fieldName = i.next();
                 //AcroFields.Item item = fs.getFieldItem(fieldName);
                 //int type = fs.getFieldType(fieldName);
                 String value = fs.getField(fieldName);
-
-                List questions = delegator.findByAnd("SurveyQuestionAndAppl", UtilMisc.toMap("surveyId", surveyId, "externalFieldRef", fieldName));
+                List<GenericValue> questions = delegator.findByAnd("SurveyQuestionAndAppl", UtilMisc.toMap("surveyId", surveyId, "externalFieldRef", fieldName));
                 if (questions.size() == 0) {
                     Debug.logInfo("No question found for surveyId:" + surveyId + " and externalFieldRef:" + fieldName, module);
                     continue;
@@ -310,7 +305,7 @@ public class PdfSurveyServices {
             return ServiceUtil.returnError(errMsg);
         }
 
-        Map results = ServiceUtil.returnSuccess();
+        Map<String, Object> results = ServiceUtil.returnSuccess();
         results.put("surveyResponseId", surveyResponseId);
         return results;
     }
@@ -318,8 +313,7 @@ public class PdfSurveyServices {
     /**
      */
     public static Map<String, Object> getAcroFieldsFromPdf(DispatchContext dctx, Map<String, ? extends Object> context) {
-
-        Map acroFieldMap = FastMap.newInstance();
+        Map<String, Object> acroFieldMap = FastMap.newInstance();
         try {
             ByteArrayOutputStream os = new ByteArrayOutputStream();
             Delegator delegator = dctx.getDelegator();
@@ -327,8 +321,7 @@ public class PdfSurveyServices {
             PdfReader r = new PdfReader(byteBuffer.array());
             PdfStamper s = new PdfStamper(r,os);
             AcroFields fs = s.getAcroFields();
-            Map map = fs.getFields();
-
+            Map<String, Object> map = UtilGenerics.checkMap(fs.getFields());
             s.setFormFlattening(true);
 
             // Debug code to get the values for setting TDP
@@ -336,9 +329,9 @@ public class PdfSurveyServices {
     //        for (int i=0;i<sa.length;i++)
     //            Debug.log("Appearance="+sa[i]);
 
-            Iterator iter = map.keySet().iterator();
+            Iterator<String> iter = map.keySet().iterator();
             while (iter.hasNext()) {
-                String fieldName=(String)iter.next();
+                String fieldName = iter.next();
                 String parmValue = fs.getField(fieldName);
                 acroFieldMap.put(fieldName, parmValue);
             }
@@ -354,7 +347,7 @@ public class PdfSurveyServices {
             return ServiceUtil.returnError(ioe.getMessage());
         }
 
-    Map results = ServiceUtil.returnSuccess();
+    Map<String, Object> results = ServiceUtil.returnSuccess();
     results.put("acroFieldMap", acroFieldMap);
     return results;
     }
@@ -362,18 +355,16 @@ public class PdfSurveyServices {
     /**
      */
     public static Map<String, Object> setAcroFields(DispatchContext dctx, Map<String, ? extends Object> context) {
-
-        Map results = ServiceUtil.returnSuccess();
+        Map<String, Object> results = ServiceUtil.returnSuccess();
         Delegator delegator = dctx.getDelegator();
         try {
-            Map acroFieldMap = (Map)context.get("acroFieldMap");
+            Map<String, Object> acroFieldMap = UtilGenerics.checkMap(context.get("acroFieldMap"));
             ByteBuffer byteBuffer = getInputByteBuffer(context, delegator);
             PdfReader r = new PdfReader(byteBuffer.array());
             ByteArrayOutputStream baos = new ByteArrayOutputStream();
             PdfStamper s = new PdfStamper(r, baos);
             AcroFields fs = s.getAcroFields();
-            Map map = fs.getFields();
-
+            Map<String, Object> map = UtilGenerics.checkMap(fs.getFields());
             s.setFormFlattening(true);
 
             // Debug code to get the values for setting TDP
@@ -381,9 +372,9 @@ public class PdfSurveyServices {
     //      for (int i=0;i<sa.length;i++)
     //          Debug.log("Appearance="+sa[i]);
 
-            Iterator iter = map.keySet().iterator();
+            Iterator<String> iter = map.keySet().iterator();
             while (iter.hasNext()) {
-                String fieldName=(String)iter.next();
+                String fieldName = iter.next();
                 String fieldValue = fs.getField(fieldName);
                 Object obj = acroFieldMap.get(fieldName);
                 if (obj instanceof Date) {
@@ -399,8 +390,9 @@ public class PdfSurveyServices {
                     fieldValue=(String)obj;
                 }
 
-                if (UtilValidate.isNotEmpty(fieldValue))
+                if (UtilValidate.isNotEmpty(fieldValue)) {
                     fs.setField(fieldName, fieldValue);
+                }
             }
 
             s.close();
@@ -423,8 +415,7 @@ public class PdfSurveyServices {
             System.err.println(ioe.getMessage());
             results = ServiceUtil.returnError(ioe.getMessage());
         }
-
-    return results;
+        return results;
     }
 
 
@@ -434,7 +425,7 @@ public class PdfSurveyServices {
         Map<String, Object> context = UtilMisc.makeMapWritable(rcontext);
         Delegator delegator = dctx.getDelegator();
         //LocalDispatcher dispatcher = dctx.getDispatcher();
-        Map results = ServiceUtil.returnSuccess();
+        Map<String, Object> results = ServiceUtil.returnSuccess();
         String surveyResponseId = (String)context.get("surveyResponseId");
         String contentId = (String)context.get("contentId");
         String surveyId = null;
@@ -460,11 +451,11 @@ public class PdfSurveyServices {
             ByteArrayOutputStream baos = new ByteArrayOutputStream();
             PdfWriter.getInstance(document, baos);
 
-            List responses = delegator.findByAnd("SurveyResponseAnswer", UtilMisc.toMap("surveyResponseId", surveyResponseId));
-            Iterator iter = responses.iterator();
+            List<GenericValue> responses = delegator.findByAnd("SurveyResponseAnswer", UtilMisc.toMap("surveyResponseId", surveyResponseId));
+            Iterator<GenericValue> iter = responses.iterator();
             while (iter.hasNext()) {
                 String value = null;
-                GenericValue surveyResponseAnswer = (GenericValue) iter.next();
+                GenericValue surveyResponseAnswer = iter.next();
                 String surveyQuestionId = (String) surveyResponseAnswer.get("surveyQuestionId");
                 GenericValue surveyQuestion = delegator.findByPrimaryKey("SurveyQuestion", UtilMisc.toMap("surveyQuestionId", surveyQuestionId));
                 String questionType = surveyQuestion.getString("surveyQuestionTypeId");
@@ -506,25 +497,15 @@ public class PdfSurveyServices {
     public static Map<String, Object> buildSurveyQuestionsAndAnswers(DispatchContext dctx, Map<String, ? extends Object> context) {
         Delegator delegator = dctx.getDelegator();
         //LocalDispatcher dispatcher = dctx.getDispatcher();
-        Map results = ServiceUtil.returnSuccess();
+        Map<String, Object> results = ServiceUtil.returnSuccess();
         String surveyResponseId = (String)context.get("surveyResponseId");
-        String surveyId = null;
-        List qAndA = FastList.newInstance();
+        List<Object> qAndA = FastList.newInstance();
 
-        Document document = new Document();
         try {
-            if (UtilValidate.isNotEmpty(surveyResponseId)) {
-                GenericValue surveyResponse = delegator.findByPrimaryKey("SurveyResponse", UtilMisc.toMap("surveyResponseId", surveyResponseId));
-                if (surveyResponse != null) {
-                    surveyId = surveyResponse.getString("surveyId");
-                }
-            }
-
-            List responses = delegator.findByAnd("SurveyResponseAnswer", UtilMisc.toMap("surveyResponseId", surveyResponseId));
-            Iterator iter = responses.iterator();
+            List<GenericValue> responses = delegator.findByAnd("SurveyResponseAnswer", UtilMisc.toMap("surveyResponseId", surveyResponseId));
+            Iterator<GenericValue> iter = responses.iterator();
             while (iter.hasNext()) {
-                String value = null;
-                GenericValue surveyResponseAnswer = (GenericValue) iter.next();
+                GenericValue surveyResponseAnswer = iter.next();
                 String surveyQuestionId = (String) surveyResponseAnswer.get("surveyQuestionId");
                 GenericValue surveyQuestion = delegator.findByPrimaryKey("SurveyQuestion", UtilMisc.toMap("surveyQuestionId", surveyQuestionId));
                 qAndA.add(UtilMisc.toMap("question", surveyQuestion, "response", surveyResponseAnswer));
@@ -543,8 +524,8 @@ public class PdfSurveyServices {
     public static Map<String, Object> setAcroFieldsFromSurveyResponse(DispatchContext dctx, Map<String, ? extends Object> context) {
         Delegator delegator = dctx.getDelegator();
         LocalDispatcher dispatcher = dctx.getDispatcher();
-        Map results = ServiceUtil.returnSuccess();
-        Map acroFieldMap = FastMap.newInstance();
+        Map<String, Object> results = ServiceUtil.returnSuccess();
+        Map<String, Object> acroFieldMap = FastMap.newInstance();
         String surveyResponseId = (String)context.get("surveyResponseId");
         String acroFormContentId = null;
 
@@ -564,16 +545,16 @@ public class PdfSurveyServices {
                 }
             }
 
-            List responses = delegator.findByAnd("SurveyResponseAnswer", UtilMisc.toMap("surveyResponseId", surveyResponseId));
-            Iterator iter = responses.iterator();
+            List<GenericValue> responses = delegator.findByAnd("SurveyResponseAnswer", UtilMisc.toMap("surveyResponseId", surveyResponseId));
+            Iterator<GenericValue> iter = responses.iterator();
             while (iter.hasNext()) {
                 String value = null;
-                GenericValue surveyResponseAnswer = (GenericValue) iter.next();
+                GenericValue surveyResponseAnswer = iter.next();
                 String surveyQuestionId = (String) surveyResponseAnswer.get("surveyQuestionId");
 
                 GenericValue surveyQuestion = delegator.findByPrimaryKeyCache("SurveyQuestion", UtilMisc.toMap("surveyQuestionId", surveyQuestionId));
 
-                List surveyQuestionApplList = EntityUtil.filterByDate(delegator.findByAndCache("SurveyQuestionAppl", UtilMisc.toMap("surveyId", surveyId, "surveyQuestionId", surveyQuestionId), UtilMisc.toList("-fromDate")), false);
+                List<GenericValue> surveyQuestionApplList = EntityUtil.filterByDate(delegator.findByAndCache("SurveyQuestionAppl", UtilMisc.toMap("surveyId", surveyId, "surveyQuestionId", surveyQuestionId), UtilMisc.toList("-fromDate")), false);
                 GenericValue surveyQuestionAppl = EntityUtil.getFirst(surveyQuestionApplList);
 
                 String questionType = surveyQuestion.getString("surveyQuestionTypeId");
@@ -601,10 +582,10 @@ public class PdfSurveyServices {
 
         try {
             ModelService modelService = dispatcher.getDispatchContext().getModelService("setAcroFields");
-            Map ctx = modelService.makeValid(context, "IN");
+            Map<String, Object> ctx = modelService.makeValid(context, "IN");
             ctx.put("acroFieldMap", acroFieldMap);
             ctx.put("contentId", acroFormContentId);
-            Map map = dispatcher.runSync("setAcroFields", ctx);
+            Map<String, Object> map = dispatcher.runSync("setAcroFields", ctx);
             if (ServiceUtil.isError(map)) {
                 String errMsg = ServiceUtil.makeErrorMessage(map, null, null, null, null);
                 System.err.println(errMsg);
@@ -632,8 +613,7 @@ public class PdfSurveyServices {
     return results;
     }
 
-    public static ByteBuffer getInputByteBuffer(Map context, Delegator delegator) throws GeneralException {
-
+    public static ByteBuffer getInputByteBuffer(Map<String, ? extends Object> context, Delegator delegator) throws GeneralException {
         ByteBuffer inputByteBuffer = (ByteBuffer)context.get("inputByteBuffer");
 
         if (inputByteBuffer == null) {

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java?rev=1062463&r1=1062462&r2=1062463&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java Sun Jan 23 16:24:50 2011
@@ -65,14 +65,14 @@ public class SurveyWrapper {
     protected String responseId = null;
     protected String partyId = null;
     protected String surveyId = null;
-    protected Map templateContext = null;
-    protected Map passThru = null;
-    protected Map defaultValues = null;
+    protected Map<String, Object> templateContext = null;
+    protected Map<String, Object> passThru = null;
+    protected Map<String, Object> defaultValues = null;
     protected boolean edit = false;
 
     protected SurveyWrapper() {}
 
-    public SurveyWrapper(Delegator delegator, String responseId, String partyId, String surveyId, Map passThru, Map defaultValues) {
+    public SurveyWrapper(Delegator delegator, String responseId, String partyId, String surveyId, Map<String, Object> passThru, Map<String, Object> defaultValues) {
         this.delegator = delegator;
         this.responseId = responseId;
         this.partyId = partyId;
@@ -82,7 +82,7 @@ public class SurveyWrapper {
         this.checkParameters();
     }
 
-     public SurveyWrapper(Delegator delegator, String responseId, String partyId, String surveyId, Map passThru) {
+     public SurveyWrapper(Delegator delegator, String responseId, String partyId, String surveyId, Map<String, Object> passThru) {
          this(delegator, responseId, partyId, surveyId, passThru, null);
      }
 
@@ -100,7 +100,7 @@ public class SurveyWrapper {
      * Sets the pass-thru values (hidden form fields)
      * @param passThru
      */
-    public void setPassThru(Map passThru) {
+    public void setPassThru(Map<String, Object> passThru) {
         if (passThru != null) {
             this.passThru = FastMap.newInstance();
             this.passThru.putAll(passThru);
@@ -111,7 +111,7 @@ public class SurveyWrapper {
      * Sets the default values
      * @param defaultValues
      */
-    public void setDefaultValues(Map defaultValues) {
+    public void setDefaultValues(Map<String, Object> defaultValues) {
         if (defaultValues != null) {
             this.defaultValues = FastMap.newInstance();
             this.defaultValues.putAll(defaultValues);
@@ -170,19 +170,19 @@ public class SurveyWrapper {
     public void render(URL templateUrl, Writer writer) throws SurveyWrapperException {
         String responseId = this.getThisResponseId();
         GenericValue survey = this.getSurvey();
-        List surveyQuestionAndAppls = this.getSurveyQuestionAndAppls();
-        Map results = this.getResults(surveyQuestionAndAppls);
-        Map currentAnswers = null;
+        List<GenericValue> surveyQuestionAndAppls = this.getSurveyQuestionAndAppls();
+        Map<String, Object> results = this.getResults(surveyQuestionAndAppls);
+        Map<String, Object> currentAnswers = null;
         if (responseId != null && canUpdate()) {
             currentAnswers = this.getResponseAnswers(responseId);
         } else {
             currentAnswers = this.getResponseAnswers(null);
         }
 
-        Map sqaaWithColIdListByMultiRespId = FastMap.newInstance();
-        Iterator surveyQuestionAndApplIter = surveyQuestionAndAppls.iterator();
+        Map<String, Object> sqaaWithColIdListByMultiRespId = FastMap.newInstance();
+        Iterator<GenericValue> surveyQuestionAndApplIter = surveyQuestionAndAppls.iterator();
         while (surveyQuestionAndApplIter.hasNext()) {
-            GenericValue surveyQuestionAndAppl = (GenericValue) surveyQuestionAndApplIter.next();
+            GenericValue surveyQuestionAndAppl = surveyQuestionAndApplIter.next();
             String surveyMultiRespColId = surveyQuestionAndAppl.getString("surveyMultiRespColId");
             if (UtilValidate.isNotEmpty(surveyMultiRespColId)) {
                 String surveyMultiRespId = surveyQuestionAndAppl.getString("surveyMultiRespId");
@@ -284,12 +284,12 @@ public class SurveyWrapper {
     }
 
     // returns a list of SurveyQuestions (in order by sequence number) for the current Survey
-    public List getSurveyQuestionAndAppls() {
-        List questions = FastList.newInstance();
+    public List<GenericValue> getSurveyQuestionAndAppls() {
+        List<GenericValue> questions = FastList.newInstance();
 
         try {
-            Map fields = UtilMisc.toMap("surveyId", surveyId);
-            List order = UtilMisc.toList("sequenceNum", "surveyMultiRespColId");
+            Map<String, Object> fields = UtilMisc.<String, Object>toMap("surveyId", surveyId);
+            List<String> order = UtilMisc.<String>toList("sequenceNum", "surveyMultiRespColId");
             questions = delegator.findByAndCache("SurveyQuestionAndAppl", fields, order);
             if (questions != null) {
                 questions = EntityUtil.filterByDate(questions);
@@ -312,7 +312,7 @@ public class SurveyWrapper {
         }
 
         String responseId = null;
-        List responses = null;
+        List<GenericValue> responses = null;
         try {
             responses = delegator.findByAnd("SurveyResponse", UtilMisc.toMap("surveyId", surveyId, "partyId", partyId), UtilMisc.toList("-lastModifiedDate"));
         } catch (GenericEntityException e) {
@@ -344,8 +344,8 @@ public class SurveyWrapper {
         return responses;
     }
 
-    public List getSurveyResponses(GenericValue question) throws SurveyWrapperException {
-        List responses = null;
+    public List<GenericValue> getSurveyResponses(GenericValue question) throws SurveyWrapperException {
+        List<GenericValue> responses = null;
         try {
             responses = delegator.findByAnd("SurveyResponse", UtilMisc.toMap("surveyQuestionId", question.getString("surveyQuestionId")));
         } catch (GenericEntityException e) {
@@ -355,12 +355,11 @@ public class SurveyWrapper {
     }
 
     // returns a Map of answers keyed on SurveyQuestion ID from the most current SurveyResponse ID
-    public Map getResponseAnswers(String responseId) throws SurveyWrapperException {
-
-        Map answerMap = FastMap.newInstance();
+    public Map<String, Object> getResponseAnswers(String responseId) throws SurveyWrapperException {
+        Map<String, Object> answerMap = FastMap.newInstance();
 
         if (responseId != null) {
-            List answers = null;
+            List<GenericValue> answers = null;
             try {
                 answers = delegator.findByAnd("SurveyResponseAnswer", UtilMisc.toMap("surveyResponseId", responseId));
             } catch (GenericEntityException e) {
@@ -368,23 +367,23 @@ public class SurveyWrapper {
             }
 
             if (UtilValidate.isNotEmpty(answers)) {
-                Iterator i = answers.iterator();
+                Iterator<GenericValue> i = answers.iterator();
                 while (i.hasNext()) {
-                    GenericValue answer = (GenericValue) i.next();
-                    answerMap.put(answer.get("surveyQuestionId"), answer);
+                    GenericValue answer = i.next();
+                    answerMap.put(answer.getString("surveyQuestionId"), answer);
                 }
             }
         }
 
         // get the pass-thru (posted form data)
         if (UtilValidate.isNotEmpty(passThru)) {
-            Iterator i = passThru.keySet().iterator();
+            Iterator<String> i = passThru.keySet().iterator();
             while (i.hasNext()) {
                 String key = (String) i.next();
                 if (key.toUpperCase().startsWith("ANSWERS_")) {
                     int splitIndex = key.indexOf('_');
                     String questionId = key.substring(splitIndex+1);
-                    Map thisAnswer = FastMap.newInstance();
+                    Map<String, Object> thisAnswer = FastMap.newInstance();
                     String answer = (String) passThru.remove(key);
                     thisAnswer.put("booleanResponse", answer);
                     thisAnswer.put("currencyResponse", answer);
@@ -401,8 +400,8 @@ public class SurveyWrapper {
         return answerMap;
     }
 
-    public List getQuestionResponses(GenericValue question, int startIndex, int number) throws SurveyWrapperException {
-        List resp = null;
+    public List<GenericValue> getQuestionResponses(GenericValue question, int startIndex, int number) throws SurveyWrapperException {
+        List<GenericValue> resp = null;
         boolean beganTransaction = false;
         try {
             beganTransaction = TransactionUtil.begin();
@@ -437,13 +436,13 @@ public class SurveyWrapper {
         return resp;
     }
 
-    public Map getResults(List questions) throws SurveyWrapperException {
-        Map questionResults = FastMap.newInstance();
+    public Map<String, Object> getResults(List<GenericValue> questions) throws SurveyWrapperException {
+        Map<String, Object> questionResults = FastMap.newInstance();
         if (questions != null) {
-            Iterator i = questions.iterator();
+            Iterator<GenericValue> i = questions.iterator();
             while (i.hasNext()) {
-                GenericValue question = (GenericValue) i.next();
-                Map results = getResultInfo(question);
+                GenericValue question = i.next();
+                Map<String, Object> results = getResultInfo(question);
                 if (results != null) {
                     questionResults.put(question.getString("surveyQuestionId"), results);
                 }
@@ -453,8 +452,8 @@ public class SurveyWrapper {
     }
 
     // returns a map of question reqsults
-    public Map getResultInfo(GenericValue question) throws SurveyWrapperException {
-        Map resultMap = FastMap.newInstance();
+    public Map<String, Object> getResultInfo(GenericValue question) throws SurveyWrapperException {
+        Map<String, Object> resultMap = FastMap.newInstance();
 
         // special keys in the result:
         // "_q_type"      - question type (SurveyQuestionTypeId)
@@ -474,20 +473,24 @@ public class SurveyWrapper {
         // call the proper method based on the question type
         // note this will need to be updated as new types are added
         if ("OPTION".equals(questionType)) {
-            Map thisResult = getOptionResult(question);
+            Map<String, Object> thisResult = getOptionResult(question);
             if (thisResult != null) {
                 Long questionTotal = (Long) thisResult.remove("_total");
-                if (questionTotal == null) questionTotal = Long.valueOf(0);
+                if (questionTotal == null) {
+                    questionTotal = Long.valueOf(0);
+                }
                 // set the total responses
                 resultMap.put("_total", questionTotal);
 
                 // create the map of option info ("_total", "_percent")
-                Iterator i = thisResult.keySet().iterator();
+                Iterator<String> i = thisResult.keySet().iterator();
                 while (i.hasNext()) {
-                    Map optMap = FastMap.newInstance();
+                    Map<String, Object> optMap = FastMap.newInstance();
                     String optId = (String) i.next();
                     Long optTotal = (Long) thisResult.get(optId);
-                    if (optTotal == null) optTotal = Long.valueOf(0);
+                    if (optTotal == null) {
+                        optTotal = Long.valueOf(0);
+                    }
                     Long percent = Long.valueOf((long)(((double)optTotal.longValue() / (double)questionTotal.longValue()) * 100));
                     optMap.put("_total", optTotal);
                     optMap.put("_percent", percent);
@@ -674,8 +677,8 @@ public class SurveyWrapper {
         return result;
     }
 
-    private Map getOptionResult(GenericValue question) throws SurveyWrapperException {
-        Map result = FastMap.newInstance();
+    private Map<String, Object> getOptionResult(GenericValue question) throws SurveyWrapperException {
+        Map<String, Object> result = FastMap.newInstance();
         long total = 0;
 
         boolean beganTransaction = false;
@@ -746,6 +749,7 @@ public class SurveyWrapper {
         return eli;
     }
 
+    @SuppressWarnings("serial")
     protected class SurveyWrapperException extends GeneralException {
 
         public SurveyWrapperException() {