Author: doogie
Date: Sun May 3 20:35:52 2009 New Revision: 771124 URL: http://svn.apache.org/viewvc?rev=771124&view=rev Log: Several minor generics fixes. Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaSetField.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/SOAPEventHandler.java ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/EntityHttpUtil.java ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerBSFServiceEngine.java ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerContextMapper.java ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerServerEngine.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/text/TextFormRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeAction.java Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaSetField.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaSetField.java?rev=771124&r1=771123&r2=771124&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaSetField.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaSetField.java Sun May 3 20:35:52 2009 @@ -20,6 +20,7 @@ package org.ofbiz.service.eca; import org.w3c.dom.Element; +import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.string.FlexibleStringExpander; @@ -69,7 +70,7 @@ // check if target is a map and create/get from contaxt Map<String, Object> valueMap = null; if (UtilValidate.isNotEmpty(this.mapName) && context.containsKey(this.mapName)) { - valueMap = (Map<String, Object>) context.get(mapName); + valueMap = UtilGenerics.checkMap(context.get(mapName)); } else { valueMap = FastMap.newInstance(); } Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/SOAPEventHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/SOAPEventHandler.java?rev=771124&r1=771123&r2=771124&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/SOAPEventHandler.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/SOAPEventHandler.java Sun May 3 20:35:52 2009 @@ -42,6 +42,7 @@ import org.apache.axis.message.SOAPEnvelope; import org.apache.axis.server.AxisServer; import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilXml; import org.ofbiz.service.DispatchContext; @@ -187,7 +188,7 @@ List<Object> bodies = null; try { - bodies = reqEnv.getBodyElements(); + bodies = UtilGenerics.checkList(reqEnv.getBodyElements()); } catch (AxisFault e) { sendError(response, e); throw new EventHandlerException(e.getMessage(), e); @@ -203,7 +204,7 @@ String serviceName = body.getMethodName(); List<RPCParam> params = null; try { - params = body.getParams(); + params = UtilGenerics.checkList(body.getParams()); } catch (Exception e) { sendError(response, e); throw new EventHandlerException(e.getMessage(), e); Modified: ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/EntityHttpUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/EntityHttpUtil.java?rev=771124&r1=771123&r2=771124&view=diff ============================================================================== --- ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/EntityHttpUtil.java (original) +++ ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/EntityHttpUtil.java Sun May 3 20:35:52 2009 @@ -54,7 +54,7 @@ public static GenericValue makeValidValue(String entityName, boolean includePks, HttpServletRequest request) throws GeneralException { GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator"); - GenericValue value = delegator.makeValue(entityName, (Map) null); + GenericValue value = delegator.makeValue(entityName); ModelEntity model = value.getModelEntity(); Iterator<ModelField> it = includePks ? model.getFieldsIterator() : model.getNopksIterator(); Locale locale = UtilHttp.getLocale(request); Modified: ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerBSFServiceEngine.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerBSFServiceEngine.java?rev=771124&r1=771123&r2=771124&view=diff ============================================================================== --- ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerBSFServiceEngine.java (original) +++ ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerBSFServiceEngine.java Sun May 3 20:35:52 2009 @@ -23,6 +23,7 @@ import org.apache.bsf.BSFException; +import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.ModelService; @@ -48,7 +49,7 @@ public Map<String, Object> runSync(String localName, ModelService modelService, Map<String, Object> context) throws GenericServiceException { Object[] params = new Object[] { dispatcher.getLocalContext(localName), context }; try { - return (Map) WebslingerContainer.runEvent(modelService.engineName, modelService.location, paramNames, paramTypes, params); + return UtilGenerics.checkMap(WebslingerContainer.runEvent(modelService.engineName, modelService.location, paramNames, paramTypes, params)); } catch (IOException e) { throw (GenericServiceException) new GenericServiceException(e.getMessage()).initCause(e); } catch (BSFException e) { Modified: ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerContextMapper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerContextMapper.java?rev=771124&r1=771123&r2=771124&view=diff ============================================================================== --- ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerContextMapper.java (original) +++ ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerContextMapper.java Sun May 3 20:35:52 2009 @@ -126,7 +126,7 @@ Cache cache = delegator.getCache(); Set<String> suffixes; synchronized (WebslingerContextMapper.class) { - suffixes = (Set<String>) cache.get("WebslingerHostSuffix", null, "WebslingerContextMapper.Suffixes"); + suffixes = cache.get("WebslingerHostSuffix", null, "WebslingerContextMapper.Suffixes"); if (suffixes == null) { suffixes = new HashSet<String>(); for (GenericValue value: delegator.findList("WebslingerHostSuffix", null, null, null, null, false)) { Modified: ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerServerEngine.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerServerEngine.java?rev=771124&r1=771123&r2=771124&view=diff ============================================================================== --- ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerServerEngine.java (original) +++ ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerServerEngine.java Sun May 3 20:35:52 2009 @@ -24,6 +24,7 @@ import java.util.Collections; import java.util.Map; +import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.entity.GenericDelegator; import org.ofbiz.entity.GenericValue; @@ -49,7 +50,7 @@ try { GenericValue found = EntityUtil.getFirst(delegator.findByAndCache("WebslingerLayout", UtilMisc.toMap("webslingerServerId", modelService.location))); if (found == null) throw new GenericServiceException("Couldn't find server mapping for(" + modelService.location + ")"); - return (Map<String, Object>) WebslingerServletContext.invokeInVM(found.getString("hostName"), 8080, modelService.invoke, context); + return UtilGenerics.checkMap(WebslingerServletContext.invokeInVM(found.getString("hostName"), 8080, modelService.invoke, context)); } catch (RuntimeException e) { throw e; } catch (GenericServiceException e) { Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java?rev=771124&r1=771123&r2=771124&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java Sun May 3 20:35:52 2009 @@ -873,7 +873,7 @@ } } - List allOptionValues = checkField.getAllOptionValues(context, modelForm.getDelegator(context)); + List<ModelFormField.OptionValue> allOptionValues = checkField.getAllOptionValues(context, modelForm.getDelegator(context)); Iterator<ModelFormField.OptionValue> optionValueIter = allOptionValues.iterator(); items.append("["); while (optionValueIter.hasNext()) { @@ -918,7 +918,7 @@ public void renderRadioField(Appendable writer, Map<String, Object> context, RadioField radioField) throws IOException { ModelFormField modelFormField = radioField.getModelFormField(); ModelForm modelForm = modelFormField.getModelForm(); - List allOptionValues = radioField.getAllOptionValues(context, modelForm.getDelegator(context)); + List<ModelFormField.OptionValue> allOptionValues = radioField.getAllOptionValues(context, modelForm.getDelegator(context)); String currentValue = modelFormField.getEntry(context); String className = ""; String alert = "false"; Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/text/TextFormRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/text/TextFormRenderer.java?rev=771124&r1=771123&r2=771124&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/text/TextFormRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/text/TextFormRenderer.java Sun May 3 20:35:52 2009 @@ -109,7 +109,7 @@ ModelFormField modelFormField = dropDownField.getModelFormField(); ModelForm modelForm = modelFormField.getModelForm(); String currentValue = modelFormField.getEntry(context); - List allOptionValues = dropDownField.getAllOptionValues(context, modelForm.getDelegator(context)); + List<ModelFormField.OptionValue> allOptionValues = dropDownField.getAllOptionValues(context, modelForm.getDelegator(context)); // if the current value should go first, display it if (UtilValidate.isNotEmpty(currentValue) && "first-in-list".equals(dropDownField.getCurrent())) { String explicitDescription = dropDownField.getCurrentDescription(context); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java?rev=771124&r1=771123&r2=771124&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java Sun May 3 20:35:52 2009 @@ -211,7 +211,7 @@ * use the same tree definitions for many types of tree UIs */ public void renderTreeString(StringBuffer buf, Map<String, Object> context, TreeStringRenderer treeStringRenderer) throws GeneralException { - Map<String, Object> parameters = (Map<String, Object>) context.get("parameters"); + Map<String, Object> parameters = UtilGenerics.checkMap(context.get("parameters")); setWidgetBoundaryComments(context); ModelNode node = (ModelNode)nodeMap.get(rootNodeName); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeAction.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeAction.java?rev=771124&r1=771123&r2=771124&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeAction.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeAction.java Sun May 3 20:35:52 2009 @@ -297,7 +297,8 @@ List<? extends Map<String, ? extends Object>> lst = UtilGenerics.checkList(result.get(resultMapListName)); if (lst != null) { if (lst instanceof ListIterator) { - this.modelSubNode.setListIterator((ListIterator) lst); + ListIterator<? extends Map<String, ? extends Object>> listIt = UtilGenerics.cast(lst); + this.modelSubNode.setListIterator(listIt); } else { this.modelSubNode.setListIterator(lst.listIterator()); } |
Free forum by Nabble | Edit this page |