Author: jonesde
Date: Fri Feb 20 17:41:48 2009 New Revision: 746303 URL: http://svn.apache.org/viewvc?rev=746303&view=rev Log: No functional changes, just type/generics cleanups Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java?rev=746303&r1=746302&r2=746303&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java Fri Feb 20 17:41:48 2009 @@ -40,6 +40,7 @@ import org.ofbiz.base.util.SSLUtil; import org.ofbiz.base.util.StringUtil; import org.ofbiz.base.util.UtilFormatOut; +import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilHttp; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilObject; @@ -299,7 +300,7 @@ // after security check but before running the event, see if a post-login redirect has completed and we have data from the pre-login request form to use now // we know this is the case if the _PREVIOUS_PARAM_MAP_ attribute is there, but the _PREVIOUS_REQUEST_ attribute has already been removed if (request.getSession().getAttribute("_PREVIOUS_PARAM_MAP_FORM_") != null && request.getSession().getAttribute("_PREVIOUS_REQUEST_") == null) { - Map<String, Object> previousParamMap = (Map<String, Object>) request.getSession().getAttribute("_PREVIOUS_PARAM_MAP_FORM_"); + Map<String, Object> previousParamMap = UtilGenerics.checkMap(request.getSession().getAttribute("_PREVIOUS_PARAM_MAP_FORM_"), String.class, Object.class); for (Map.Entry<String, Object> previousParamEntry: previousParamMap.entrySet()) { request.setAttribute(previousParamEntry.getKey(), previousParamEntry.getValue()); } @@ -407,7 +408,7 @@ if (Debug.infoOn()) Debug.logInfo("[Doing Previous Request]: " + previousRequest + " sessionId=" + UtilHttp.getSessionId(request), module); // note that the previous form parameters are not setup (only the URL ones here), they will be found in the session later and handled when the old request redirect comes back - Map<String, Object> previousParamMap = (Map<String, Object>) request.getSession().getAttribute("_PREVIOUS_PARAM_MAP_URL_"); + Map<String, Object> previousParamMap = UtilGenerics.checkMap(request.getSession().getAttribute("_PREVIOUS_PARAM_MAP_URL_"), String.class, Object.class); String queryString = UtilHttp.urlEncodeArgs(previousParamMap, false); String redirectTarget = previousRequest; if (UtilValidate.isNotEmpty(queryString)) { Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?rev=746303&r1=746302&r2=746303&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java Fri Feb 20 17:41:48 2009 @@ -23,7 +23,6 @@ import java.text.DateFormat; import java.text.NumberFormat; import java.util.HashMap; -import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Locale; @@ -63,9 +62,6 @@ import org.ofbiz.service.ModelParam; import org.ofbiz.service.ModelService; import org.ofbiz.widget.form.ModelForm.UpdateArea; -import org.owasp.esapi.ESAPI; -import org.owasp.esapi.Encoder; -import org.owasp.esapi.codecs.Codec; import org.w3c.dom.Element; import bsh.EvalError; @@ -684,7 +680,7 @@ // if isError is TRUE and useRequestParameters is not FALSE (ie is null or TRUE) then parameters will be used if ((Boolean.TRUE.equals(isError) && !Boolean.FALSE.equals(useRequestParameters)) || (Boolean.TRUE.equals(useRequestParameters))) { //Debug.logInfo("Getting entry, isError true so getting from parameters for field " + this.getName() + " of form " + this.modelForm.getName(), module); - Map parameters = (Map) context.get("parameters"); + Map<String, Object> parameters = UtilGenerics.checkMap(context.get("parameters"), String.class, Object.class); String parameterName = this.getParameterName(context); if (parameters != null && parameters.get(parameterName) != null) { Object parameterValue = parameters.get(parameterName); @@ -999,7 +995,7 @@ } // search for a localized label for the field's name - Map uiLabelMap = (Map) context.get("uiLabelMap"); + Map<String, String> uiLabelMap = UtilGenerics.checkMap(context.get("uiLabelMap"), String.class, String.class); if (uiLabelMap != null) { String titleFieldName = "FormFieldTitle_" + this.name; String localizedName = (String) uiLabelMap.get(titleFieldName); @@ -1503,11 +1499,9 @@ noCurrentSelectedKey = FlexibleStringExpander.getInstance(element.getAttribute("no-current-selected-key")); // read all option and entity-options sub-elements, maintaining order - List childElements = UtilXml.childElementList(element); + List<? extends Element> childElements = UtilXml.childElementList(element); if (childElements.size() > 0) { - Iterator childElementIter = childElements.iterator(); - while (childElementIter.hasNext()) { - Element childElement = (Element) childElementIter.next(); + for (Element childElement: childElements) { if ("option".equals(childElement.getTagName())) { this.addOptionSource(new SingleOption(childElement, this)); } else if ("list-options".equals(childElement.getTagName())) { @@ -1524,15 +1518,13 @@ public List<OptionValue> getAllOptionValues(Map<String, Object> context, GenericDelegator delegator) { List<OptionValue> optionValues = new LinkedList<OptionValue>(); - Iterator optionSourceIter = this.optionSources.iterator(); - while (optionSourceIter.hasNext()) { - OptionSource optionSource = (OptionSource) optionSourceIter.next(); + for (OptionSource optionSource: this.optionSources) { optionSource.addOptionValues(optionValues, context, delegator); } return optionValues; } - public static String getDescriptionForOptionKey(String key, List allOptionValues) { + public static String getDescriptionForOptionKey(String key, List<OptionValue> allOptionValues) { if (UtilValidate.isEmpty(key)) { return ""; } @@ -1541,9 +1533,7 @@ return key; } - Iterator optionValueIter = allOptionValues.iterator(); - while (optionValueIter.hasNext()) { - OptionValue optionValue = (OptionValue) optionValueIter.next(); + for (OptionValue optionValue: allOptionValues) { if (key.equals(optionValue.getKey())) { return optionValue.getDescription(); } @@ -1676,22 +1666,18 @@ this.cache = !"false".equals(entityOptionsElement.getAttribute("cache")); this.filterByDate = entityOptionsElement.getAttribute("filter-by-date"); - List constraintElements = UtilXml.childElementList(entityOptionsElement, "entity-constraint"); + List<? extends Element> constraintElements = UtilXml.childElementList(entityOptionsElement, "entity-constraint"); if (UtilValidate.isNotEmpty(constraintElements)) { this.constraintList = new LinkedList<EntityFinderUtil.ConditionExpr>(); - Iterator constraintElementIter = constraintElements.iterator(); - while (constraintElementIter.hasNext()) { - Element constraintElement = (Element) constraintElementIter.next(); + for (Element constraintElement: constraintElements) { constraintList.add(new EntityFinderUtil.ConditionExpr(constraintElement)); } } - List orderByElements = UtilXml.childElementList(entityOptionsElement, "entity-order-by"); + List<? extends Element> orderByElements = UtilXml.childElementList(entityOptionsElement, "entity-order-by"); if (UtilValidate.isNotEmpty(orderByElements)) { this.orderByList = new LinkedList<String>(); - Iterator orderByElementIter = orderByElements.iterator(); - while (orderByElementIter.hasNext()) { - Element orderByElement = (Element) orderByElementIter.next(); + for (Element orderByElement: orderByElements) { orderByList.add(orderByElement.getAttribute("field-name")); } } @@ -1713,9 +1699,7 @@ EntityCondition findCondition = null; if (UtilValidate.isNotEmpty(this.constraintList)) { List<EntityCondition> expandedConditionList = new LinkedList<EntityCondition>(); - Iterator constraintIter = constraintList.iterator(); - while (constraintIter.hasNext()) { - EntityFinderUtil.Condition condition = (EntityFinderUtil.Condition) constraintIter.next(); + for (EntityFinderUtil.Condition condition: constraintList) { expandedConditionList.add(condition.createCondition(context, this.entityName, delegator)); } findCondition = EntityCondition.makeCondition(expandedConditionList); @@ -1738,9 +1722,7 @@ } } - Iterator valueIter = values.iterator(); - while (valueIter.hasNext()) { - GenericValue value = (GenericValue) valueIter.next(); + for (GenericValue value: values) { // add key and description with string expansion, ie expanding ${} stuff, passing locale explicitly to expand value string because it won't be found in the Entity MapStack<String> localContext = MapStack.create(context); localContext.push(value); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java?rev=746303&r1=746302&r2=746303&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java Fri Feb 20 17:41:48 2009 @@ -20,7 +20,6 @@ import java.io.IOException; import java.util.HashMap; -import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -76,7 +75,7 @@ protected ModelMenuItem parentMenuItem; protected ModelMenuCondition condition; protected boolean disabled = false; - protected List actions; + protected List<ModelMenuAction> actions; protected String align; protected String alignStyle; @@ -162,10 +161,8 @@ // permissionChecker = new EntityPermissionChecker(permissionElement); // read in add item defs, add/override one by one using the menuItemList and menuItemMap - List itemElements = UtilXml.childElementList(fieldElement, "menu-item"); - Iterator itemElementIter = itemElements.iterator(); - while (itemElementIter.hasNext()) { - Element itemElement = (Element) itemElementIter.next(); + List<? extends Element> itemElements = UtilXml.childElementList(fieldElement, "menu-item"); + for (Element itemElement: itemElements) { ModelMenuItem modelMenuItem = new ModelMenuItem(itemElement, this); modelMenuItem = this.addUpdateMenuItem(modelMenuItem); //Debug.logInfo("Added item " + modelMenuItem.getName() + " from def, mapName=" + modelMenuItem.getMapName(), module); |
Free forum by Nabble | Edit this page |