Author: erwan
Date: Sat Mar 17 13:03:31 2012 New Revision: 1301931 URL: http://svn.apache.org/viewvc?rev=1301931&view=rev Log: Changes from while to for each loops in content component Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementEvents.java ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementWorker.java ofbiz/trunk/applications/content/src/org/ofbiz/content/blog/BlogRssServices.java ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocEvents.java ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocServices.java ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServicesComplex.java ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java ofbiz/trunk/applications/content/src/org/ofbiz/content/content/UploadContentAndImage.java ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutEvents.java ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/PdfSurveyServices.java ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/EditRenderSubContentCacheTransform.java Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementEvents.java?rev=1301931&r1=1301930&r2=1301931&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementEvents.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementEvents.java Sat Mar 17 13:03:31 2012 @@ -99,16 +99,12 @@ public class ContentManagementEvents { } */ - Iterator<Map<String, Object>> it = valueList.iterator(); int counter = 0; - while (it.hasNext()) { - Map<String, Object> map = it.next(); + for(Map<String, Object> map : valueList) { String contentId = (String)map.get("contentId"); //Integer idxObj = (Integer)contentIdLookup.get(contentId); //int idx = idxObj.intValue(); - Iterator<String []> itPubPt = permittedPublishPointList.iterator(); - while (itPubPt.hasNext()) { - String [] pubArr = itPubPt.next(); + for(String [] pubArr : permittedPublishPointList) { String pubContentId = pubArr[0]; String pubValue = (String)map.get(pubContentId); String paramName = Integer.toString(counter) + "_" + pubContentId; @@ -212,11 +208,8 @@ public class ContentManagementEvents { // make a map of the values that are passed in using the top subSite as the key. // Content can only be linked to one subsite under a top site (ends with "_MASTER") - Set<String> keySet = paramMap.keySet(); - Iterator<String> itKeySet = keySet.iterator(); Map<String, String> siteIdLookup = FastMap.newInstance(); - while (itKeySet.hasNext()) { - String param = itKeySet.next(); + for(String param : paramMap.keySet()) { int pos = param.indexOf("select_"); //if (Debug.infoOn()) Debug.logInfo("in updatePublishLinks, param:" + param + " pos:" + pos , module); if (pos >= 0) { @@ -228,7 +221,6 @@ public class ContentManagementEvents { //if (Debug.infoOn()) Debug.logInfo("in updatePublishLinks, siteIdLookup:" + siteIdLookup , module); // Loop thru all the possible subsites - Iterator<Object []> it = origPublishedLinkList.iterator(); Timestamp nowTimestamp = UtilDateTime.nowTimestamp(); // int counter = 0; String responseMessage = null; @@ -236,18 +228,15 @@ public class ContentManagementEvents { // String permissionMessage = null; boolean statusIdUpdated = false; Map<String, Object> results = null; - while (it.hasNext()) { - Object [] arr = it.next(); + for(Object [] arr : origPublishedLinkList) { //if (Debug.infoOn()) Debug.logInfo("in updatePublishLinks, arr:" + Arrays.asList(arr) , module); String contentId = (String)arr[0]; // main (2nd level) site id String origSubContentId = null; List<Object []> origSubList = UtilGenerics.checkList(arr[1]); // Timestamp topFromDate = (Timestamp)arr[3]; Timestamp origFromDate = null; - Iterator<Object []> itOrigSubPt = origSubList.iterator(); + for(Object [] pubArr : origSubList) { // see if a link already exists by looking for non-null fromDate - while (itOrigSubPt.hasNext()) { - Object [] pubArr = itOrigSubPt.next(); //if (Debug.infoOn()) Debug.logInfo("in updatePublishLinks, pubArr:" + Arrays.asList(pubArr) , module); Timestamp fromDate = (Timestamp)pubArr[2]; origSubContentId = null; @@ -267,9 +256,7 @@ public class ContentManagementEvents { // disable existing link if (UtilValidate.isNotEmpty(origSubContentId) && origFromDate != null) { List<GenericValue> oldActiveValues = delegator.findByAnd("ContentAssoc", UtilMisc.toMap("contentId", targContentId, "contentIdTo", origSubContentId, "contentAssocTypeId", "PUBLISH_LINK", "thruDate", null)); - Iterator<GenericValue> iterOldActive = oldActiveValues.iterator(); - while (iterOldActive.hasNext()) { - GenericValue cAssoc = iterOldActive.next(); + for(GenericValue cAssoc : oldActiveValues) { cAssoc.set("thruDate", nowTimestamp); cAssoc.store(); //if (Debug.infoOn()) Debug.logInfo("in updatePublishLinks, deactivating:" + cAssoc , module); @@ -323,16 +310,12 @@ public class ContentManagementEvents { } else if (UtilValidate.isNotEmpty(origSubContentId)) { // if no current link is passed in, look to see if there is an existing link(s) that must be disabled List<GenericValue> oldActiveValues = delegator.findByAnd("ContentAssoc", UtilMisc.toMap("contentId", targContentId, "contentIdTo", origSubContentId, "contentAssocTypeId", "PUBLISH_LINK", "thruDate", null)); - Iterator<GenericValue> iterOldActive = oldActiveValues.iterator(); - while (iterOldActive.hasNext()) { - GenericValue cAssoc = iterOldActive.next(); + for(GenericValue cAssoc : oldActiveValues) { cAssoc.set("thruDate", nowTimestamp); cAssoc.store(); } oldActiveValues = delegator.findByAnd("ContentAssoc", UtilMisc.toMap("contentId", targContentId, "contentIdTo", contentId, "contentAssocTypeId", "PUBLISH_LINK", "thruDate", null)); - iterOldActive = oldActiveValues.iterator(); - while (iterOldActive.hasNext()) { - GenericValue cAssoc = iterOldActive.next(); + for(GenericValue cAssoc : oldActiveValues) { cAssoc.set("thruDate", nowTimestamp); cAssoc.store(); } Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java?rev=1301931&r1=1301930&r2=1301931&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java Sat Mar 17 13:03:31 2012 @@ -367,9 +367,7 @@ public class ContentManagementServices { try { if (contentPurposeList != null) { Set<String> contentPurposeSet = UtilMisc.makeSetWritable(contentPurposeList); - Iterator<String> iter = contentPurposeSet.iterator(); - while (iter.hasNext()) { - String contentPurposeTypeId = iter.next(); + for(String contentPurposeTypeId : contentPurposeSet) { GenericValue contentPurpose = delegator.makeValue("ContentPurpose", UtilMisc.toMap("contentId", contentId, "contentPurposeTypeId", contentPurposeTypeId)); contentPurpose.create(); } @@ -497,14 +495,12 @@ public class ContentManagementServices { return ServiceUtil.returnError(e.toString()); } - Iterator<GenericValue> siteRoleIter = siteRoles.iterator(); - while (siteRoleIter.hasNext()) { + for(GenericValue roleType : siteRoles) { Map<String, Object> serviceContext = FastMap.newInstance(); serviceContext.put("partyId", partyId); serviceContext.put("contentId", siteContentId); serviceContext.put("userLogin", userLogin); Debug.logInfo("updateSiteRoles, serviceContext(0):" + serviceContext, module); - GenericValue roleType = siteRoleIter.next(); String siteRole = (String)roleType.get("roleTypeId"); // BLOG_EDITOR, BLOG_ADMIN, etc. String cappedSiteRole = ModelUtil.dbNameToVarName(siteRole); if (Debug.infoOn()) { @@ -797,9 +793,7 @@ public class ContentManagementServices { String partyId = (String)serviceContext.get("partyId"); Map<String, Object> findMap = UtilMisc.<String, Object>toMap("partyId", partyId); List<GenericValue> userLoginList = delegator.findByAnd("UserLogin", findMap); - Iterator<GenericValue> iter = userLoginList.iterator(); - while (iter.hasNext()) { - GenericValue partyUserLogin = iter.next(); + for(GenericValue partyUserLogin : userLoginList) { String partyUserLoginId = partyUserLogin.getString("userLoginId"); serviceContext.put("contentId", partyUserLoginId); // author contentId dispatcher.runSync("createContentRole", serviceContext); @@ -829,9 +823,7 @@ public class ContentManagementServices { } catch (GenericEntityException e) { return ServiceUtil.returnError(e.toString()); } - Iterator<GenericValue> siteRoleIter = siteRoles.iterator(); - while (siteRoleIter.hasNext()) { - GenericValue roleType = siteRoleIter.next(); + for(GenericValue roleType : siteRoles) { String siteRole = (String)roleType.get("roleTypeId"); // BLOG_EDITOR, BLOG_ADMIN, etc. String cappedSiteRole = ModelUtil.dbNameToVarName(siteRole); //if (Debug.infoOn()) Debug.logInfo("updateSiteRoles, cappediteRole(1):" + cappedSiteRole, module); @@ -1186,9 +1178,7 @@ public class ContentManagementServices { thisContent.set("contentTypeId", contentTypeId); thisContent.store(); List<GenericValue> kids = ContentWorker.getAssociatedContent(thisContent, "from", UtilMisc.toList("SUB_CONTENT"), null, null, null); - Iterator<GenericValue> iter = kids.iterator(); - while (iter.hasNext()) { - GenericValue kidContent = iter.next(); + for(GenericValue kidContent : kids) { if (contentTypeId.equals("OUTLINE_NODE")) { updateOutlineNodeChildren(kidContent, false, context); } else { @@ -1229,18 +1219,14 @@ public class ContentManagementServices { thisContent.set("contentTypeId", "OUTLINE_NODE"); thisContent.store(); List<GenericValue> kids = ContentWorker.getAssociatedContent(thisContent, "from", UtilMisc.toList("SUB_CONTENT"), null, null, null); - Iterator<GenericValue> iter = kids.iterator(); - while (iter.hasNext()) { - GenericValue kidContent = iter.next(); + for(GenericValue kidContent : kids) { if (contentTypeId.equals("OUTLINE_NODE")) { updateOutlineNodeChildren(kidContent, true, context); } else { kidContent.put("contentTypeId", "PAGE_NODE"); kidContent.store(); List<GenericValue> kids2 = ContentWorker.getAssociatedContent(kidContent, "from", UtilMisc.toList("SUB_CONTENT"), null, null, null); - Iterator<GenericValue> iter2 = kids2.iterator(); - while (iter2.hasNext()) { - GenericValue kidContent2 = iter2.next(); + for(GenericValue kidContent2 : kids2) { updatePageNodeChildren(kidContent2, context); } } @@ -1311,9 +1297,7 @@ public class ContentManagementServices { //if (contentTypeId == null || contentTypeId.equals("OUTLINE_DOCUMENT") || contentTypeId.equals("DOCUMENT")) { List<GenericValue> kids = ContentWorker.getAssociatedContent(content, "from", UtilMisc.toList("SUB_CONTENT"), null, null, null); - Iterator<GenericValue> iter = kids.iterator(); - while (iter.hasNext()) { - GenericValue kidContent = iter.next(); + for(GenericValue kidContent : kids) { updatePageNodeChildren(kidContent, context); } //} @@ -1355,9 +1339,7 @@ public class ContentManagementServices { if (contentTypeId == null || contentTypeId.equals("DOCUMENT") || contentTypeId.equals("OUTLINE_NODE")) { //if (contentTypeId == null || contentTypeId.equals("DOCUMENT")) { List<GenericValue> kids = ContentWorker.getAssociatedContent(content, "from", UtilMisc.toList("SUB_CONTENT"), null, null, null); - Iterator<GenericValue> iter = kids.iterator(); - while (iter.hasNext()) { - GenericValue kidContent = iter.next(); + for(GenericValue kidContent : kids) { updateOutlineNodeChildren(kidContent, forceOutline, context); } } @@ -1650,10 +1632,8 @@ public class ContentManagementServices { Timestamp orderCreatedDate = (Timestamp) orderHeader.get("orderDate"); context.put("orderCreatedDate", orderCreatedDate); List<GenericValue> orderItemList = orderHeader.getRelated("OrderItem"); - Iterator<GenericValue> orderItemIter = orderItemList.iterator(); ModelService subscriptionModel = dispatcher.getDispatchContext().getModelService("updateContentSubscriptionByProduct"); - while (orderItemIter.hasNext()) { - GenericValue orderItem = orderItemIter.next(); + for(GenericValue orderItem : orderItemList) { BigDecimal qty = orderItem.getBigDecimal("quantity"); String productId = (String) orderItem.get("productId"); List<GenericValue> productContentList = delegator.findByAnd("ProductContent", UtilMisc.toMap("productId", productId, "productContentTypeId", "ONLINE_ACCESS")); @@ -1727,9 +1707,7 @@ public class ContentManagementServices { result = dispatcher.runSync(serviceName, UtilMisc.toMap("content", content, "userLogin", userLogin)); List<GenericValue> kids = ContentWorker.getAssociatedContent(content, "from", contentAssocTypeIdList, null, null, null); - Iterator<GenericValue> iter = kids.iterator(); - while (iter.hasNext()) { - GenericValue kidContent = iter.next(); + for(GenericValue kidContent : kids) { followNodeChildrenMethod(kidContent, dispatcher, serviceName, context); } return result; Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementWorker.java?rev=1301931&r1=1301930&r2=1301931&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementWorker.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementWorker.java Sat Mar 17 13:03:31 2012 @@ -130,9 +130,7 @@ public class ContentManagementWorker { Collection<String> keyColl = pk.getPrimaryKey().getAllKeys(); List<String> keyList = UtilMisc.makeListWritable(keyColl); Collections.sort(keyList); - Iterator<String> it = keyList.iterator(); - while (it.hasNext()) { - String ky = it.next(); + for(String ky : keyList) { String val = (String)pk.get(ky); if (UtilValidate.isNotEmpty(val)) { if (sig.length() > 0) sig.append("_"); @@ -229,9 +227,7 @@ public class ContentManagementWorker { GenericValue v = delegator.makeValue(entityName); GenericPK passedPK = v.getPrimaryKey(); Collection<String> keyColl = passedPK.getAllKeys(); - Iterator<String> keyIt = keyColl.iterator(); - while (keyIt.hasNext()) { - String attrName = keyIt.next(); + for(String attrName : keyColl) { String attrVal = (String)request.getAttribute(attrName); if (UtilValidate.isEmpty(attrVal)) { attrVal = (String)paramMap.get(attrName); @@ -249,13 +245,11 @@ public class ContentManagementWorker { if (cachedPK != null) { useCached = true; keyColl = cachedPK.getPrimaryKey().getAllKeys(); - keyIt = keyColl.iterator(); - while (keyIt.hasNext()) { + for(String ky : keyColl) { String sCached = null; String sPassed = null; Object oPassed = null; Object oCached = null; - String ky = keyIt.next(); oPassed = passedPK.get(ky); if (oPassed != null) { sPassed = oPassed.toString(); @@ -306,9 +300,7 @@ public class ContentManagementWorker { List<String []> permittedPublishPointList = FastList.newInstance(); // Check that user has permission to admin sites - Iterator<GenericValue> it = allPublishPoints.iterator(); - while (it.hasNext()) { - GenericValue webSitePP = it.next(); + for(GenericValue webSitePP : allPublishPoints) { String contentId = (String)webSitePP.get("contentId"); String templateTitle = (String)webSitePP.get("templateTitle"); GenericValue content = delegator.makeValue("Content", UtilMisc.toMap("contentId", contentId)); @@ -352,10 +344,7 @@ public class ContentManagementWorker { } List<GenericValue> allPublishPoints = FastList.newInstance(); GenericValue webSitePublishPoint = null; - GenericValue contentAssoc = null; - Iterator<GenericValue> it = relatedPubPts.iterator(); - while (it.hasNext()) { - contentAssoc = it.next(); + for(GenericValue contentAssoc : relatedPubPts) { String pub = (String)contentAssoc.get("contentId"); //webSitePublishPoint = delegator.findByPrimaryKeyCache("WebSitePublishPoint", UtilMisc.toMap("contentId", pub)); webSitePublishPoint = getWebSitePublishPoint(delegator, pub, false); @@ -367,9 +356,7 @@ public class ContentManagementWorker { public static Map<String, GenericValue> getPublishPointMap(Delegator delegator, String pubPtId) throws GeneralException { List<GenericValue> publishPointList = getAllPublishPoints(delegator, pubPtId); Map<String, GenericValue> publishPointMap = FastMap.newInstance(); - Iterator<GenericValue> it = publishPointList.iterator(); - while (it.hasNext()) { - GenericValue webSitePublishPoint = it.next(); + for(GenericValue webSitePublishPoint : publishPointList) { String pub = (String)webSitePublishPoint.get("contentId"); publishPointMap.put(pub, webSitePublishPoint); } @@ -379,9 +366,7 @@ public class ContentManagementWorker { public static void getAllPublishPointMap(Delegator delegator, String pubPtId, Map<String, GenericValue> publishPointMap) throws GeneralException { List<GenericValue> publishPointList = getAllPublishPoints(delegator, pubPtId); - Iterator<GenericValue> it = publishPointList.iterator(); - while (it.hasNext()) { - GenericValue webSitePublishPoint = it.next(); + for(GenericValue webSitePublishPoint : publishPointList) { String pub = (String)webSitePublishPoint.get("contentId"); publishPointMap.put(pub, webSitePublishPoint); getAllPublishPointMap(delegator, pub, publishPointMap); @@ -390,9 +375,7 @@ public class ContentManagementWorker { public static Map<String, GenericValue> getPublishPointMap(Delegator delegator, List<GenericValue> publishPointList) { Map<String, GenericValue> publishPointMap = FastMap.newInstance(); - Iterator<GenericValue> it = publishPointList.iterator(); - while (it.hasNext()) { - GenericValue webSitePublishPoint = it.next(); + for(GenericValue webSitePublishPoint : publishPointList) { String pub = (String)webSitePublishPoint.get("contentId"); publishPointMap.put(pub, webSitePublishPoint); } @@ -408,10 +391,8 @@ public class ContentManagementWorker { } List<Map<String, Object>> staticValueList = FastList.newInstance(); - Iterator<GenericValue> it = assocValueList.iterator(); int counter = 0; - while (it.hasNext()) { - GenericValue content = it.next(); + for(GenericValue content : assocValueList) { String contentId = (String)content.get("contentId"); String contentName = (String)content.get("contentName"); String description = (String)content.get("description"); @@ -419,21 +400,17 @@ public class ContentManagementWorker { map.put("contentId", contentId); map.put("contentName", contentName); map.put("description", description); - Iterator<String []> it2 = permittedPublishPointList.iterator(); - while (it2.hasNext()) { - String [] publishPointArray = it2.next(); + for(String [] publishPointArray : permittedPublishPointList) { String publishPointId = publishPointArray[0]; - //fieldName = "_" + Integer.toString(counter) + "_" + publishPointId; - String fieldName = publishPointId; List<GenericValue> contentAssocList = content.getRelatedByAnd("ToContentAssoc", UtilMisc.toMap("contentId", publishPointId)); List<GenericValue> filteredList = EntityUtil.filterByDate(contentAssocList); if (filteredList.size() > 0) { - map.put(fieldName, "Y"); + map.put(publishPointId, "Y"); GenericValue assoc = filteredList.get(0); Timestamp fromDate = (Timestamp)assoc.get("fromDate"); - map.put(fieldName + "FromDate", fromDate); + map.put(publishPointId + "FromDate", fromDate); } else { - map.put(fieldName, "N"); + map.put(publishPointId, "N"); } } staticValueList.add(map); @@ -536,12 +513,10 @@ public class ContentManagementWorker { List<String []> publishPointList = getPermittedPublishPoints(delegator, allPublishPointList, userLogin, security , permittedAction, permittedOperations, passedRoles); Map<String, Object> publishPointMap = FastMap.newInstance(); Map<String, Object> publishPointMapAll = FastMap.newInstance(); - Iterator<String []> it = publishPointList.iterator(); - while (it.hasNext()) { + for(String [] arr : publishPointList) { //GenericValue webSitePublishPoint = (GenericValue)it.next(); //String contentId = (String)webSitePublishPoint.get("contentId"); //String description = (String)webSitePublishPoint.get("description"); - String [] arr = it.next(); String contentId = arr[0]; String description = arr[1]; List<Object []> subPointList = FastList.newInstance(); @@ -550,12 +525,10 @@ public class ContentManagementWorker { publishPointMap.put(contentId, subArr); publishPointMapAll.put(contentId, contentId); List<GenericValue> subPublishPointList = getAllPublishPoints(delegator, contentId); - Iterator<GenericValue> it2 = subPublishPointList.iterator(); - while (it2.hasNext()) { + for(GenericValue webSitePublishPoint2 : subPublishPointList) { //String [] arr2 = (String [])it2.next(); //String contentId2 = (String)arr2[0]; //String description2 = (String)arr2[1]; - GenericValue webSitePublishPoint2 = it2.next(); String contentId2 = (String)webSitePublishPoint2.get("contentId"); String description2 = (String)webSitePublishPoint2.get("templateTitle"); publishPointMapAll.put(contentId2, contentId); @@ -572,9 +545,7 @@ public class ContentManagementWorker { } catch (GenericEntityException e) { throw new GeneralException(e.getMessage()); } - Iterator<GenericValue> it4 = assocValueList.iterator(); - while (it4.hasNext()) { - GenericValue contentAssoc = it4.next(); + for(GenericValue contentAssoc : assocValueList) { String contentIdTo = contentAssoc.getString("contentIdTo"); String topContentId = (String)publishPointMapAll.get(contentIdTo); Object [] subArr = (Object [])publishPointMap.get(topContentId); @@ -598,10 +569,7 @@ public class ContentManagementWorker { } List<Object []> publishedLinkList = FastList.newInstance(); - Set<String> keySet = publishPointMap.keySet(); - Iterator<String> it3 = keySet.iterator(); - while (it3.hasNext()) { - String contentId = it3.next(); + for(String contentId : publishPointMap.keySet()) { Object [] subPointArr = (Object [])publishPointMap.get(contentId); publishedLinkList.add(subPointArr); } @@ -635,9 +603,7 @@ public class ContentManagementWorker { List<String []> permittedDepartmentPointList = FastList.newInstance(); // Check that user has permission to admin sites - Iterator<GenericValue> it = allDepartmentPoints.iterator(); - while (it.hasNext()) { - GenericValue content = it.next(); + for(GenericValue content : allDepartmentPoints) { String contentId = (String)content.get("contentId"); String contentName = (String)content.get("contentName"); String statusId = null; @@ -680,10 +646,7 @@ public class ContentManagementWorker { } List<GenericValue> allDepartmentPoints = FastList.newInstance(); GenericValue departmentContent = null; - GenericValue contentAssoc = null; - Iterator<GenericValue> it = relatedPubPts.iterator(); - while (it.hasNext()) { - contentAssoc = it.next(); + for(GenericValue contentAssoc : relatedPubPts) { String pub = (String)contentAssoc.get("contentId"); departmentContent = delegator.findByPrimaryKeyCache("Content", UtilMisc.toMap("contentId", pub)); allDepartmentPoints.add(departmentContent); @@ -715,9 +678,7 @@ public class ContentManagementWorker { } List<GenericValue> listAll = delegator.findList("ContentAssoc", conditionMain, null, null, null, true); List<GenericValue> listFiltered = EntityUtil.filterByDate(listAll); - Iterator<GenericValue> iter = listFiltered.iterator(); - while (iter.hasNext()) { - GenericValue contentAssoc = iter.next(); + for(GenericValue contentAssoc : listFiltered) { String subContentId = contentAssoc.getString("contentId"); subLeafCount += updateStatsTopDown(delegator, subContentId, typeList); } @@ -741,9 +702,7 @@ public class ContentManagementWorker { EntityCondition conditionMain = EntityCondition.makeCondition(UtilMisc.toList(EntityCondition.makeCondition("contentId", EntityOperator.EQUALS, contentId), conditionType), EntityOperator.AND); List<GenericValue> listAll = delegator.findList("ContentAssoc", conditionMain, null, null, null, true); List<GenericValue> listFiltered = EntityUtil.filterByDate(listAll); - Iterator<GenericValue> iter = listFiltered.iterator(); - while (iter.hasNext()) { - GenericValue contentAssoc = iter.next(); + for(GenericValue contentAssoc : listFiltered) { String contentIdTo = contentAssoc.getString("contentIdTo"); GenericValue contentTo = delegator.findByPrimaryKey("Content", UtilMisc.toMap("contentId", contentIdTo)); int intLeafCount = 0; Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/blog/BlogRssServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/blog/BlogRssServices.java?rev=1301931&r1=1301930&r2=1301931&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/blog/BlogRssServices.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/blog/BlogRssServices.java Sat Mar 17 13:03:31 2012 @@ -115,9 +115,7 @@ public class BlogRssServices { } if (contentRecs != null) { - Iterator<GenericValue> i = contentRecs.iterator(); - while (i.hasNext()) { - GenericValue v = i.next(); + for(GenericValue v : contentRecs) { String sub = null; try { Map<String, Object> dummy = FastMap.newInstance(); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocEvents.java?rev=1301931&r1=1301930&r2=1301931&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocEvents.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocEvents.java Sat Mar 17 13:03:31 2012 @@ -104,10 +104,7 @@ public class CompDocEvents { Map<String, Object> persistResult = dispatcher.runSync("persistContentAndAssoc", persistMap); contentId = (String)persistResult.get("contentId"); //request.setAttribute("contentId", contentId); - Set<String> keySet = persistResult.keySet(); - Iterator<String> iter = keySet.iterator(); - while (iter.hasNext()) { - Object obj = iter.next(); + for(Object obj : persistResult.keySet()) { Object val = persistResult.get(obj); request.setAttribute(obj.toString(), val); } @@ -117,10 +114,7 @@ public class CompDocEvents { contentRevisionMap.put("contentId", contentId); contentRevisionMap.put("userLogin", userLogin); Map<String, Object> result = dispatcher.runSync("persistContentRevisionAndItem", contentRevisionMap); - keySet = result.keySet(); - iter = keySet.iterator(); - while (iter.hasNext()) { - Object obj = iter.next(); + for(Object obj : result.keySet()) { Object val = result.get(obj); request.setAttribute(obj.toString(), val); } Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocServices.java?rev=1301931&r1=1301930&r2=1301931&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocServices.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocServices.java Sat Mar 17 13:03:31 2012 @@ -177,10 +177,8 @@ public class CompDocServices { //PdfWriter writer = PdfWriter.getInstance(document, baos); PdfCopy writer = new PdfCopy(document, baos); document.open(); - Iterator<GenericValue> iter = compDocParts.iterator(); int pgCnt =0; - while (iter.hasNext()) { - GenericValue contentAssocRevisionItemView = iter.next(); + for(GenericValue contentAssocRevisionItemView : compDocParts) { //String thisContentId = contentAssocRevisionItemView.getString("contentId"); //String thisContentRevisionSeqId = contentAssocRevisionItemView.getString("maxRevisionSeqId"); String thisDataResourceId = contentAssocRevisionItemView.getString("dataResourceId"); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java?rev=1301931&r1=1301930&r2=1301931&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java Sat Mar 17 13:03:31 2012 @@ -102,10 +102,8 @@ public class ContentServices { serviceInMap.put("entityOperation", context.get("entityOperation")); List<GenericValue> permittedList = FastList.newInstance(); - Iterator<GenericValue> it = contentList.iterator(); Map<String, Object> permResults = null; - while (it.hasNext()) { - GenericValue content = it.next(); + for(GenericValue content : contentList) { serviceInMap.put("currentContent", content); try { permResults = dispatcher.runSync("checkContentPermission", serviceInMap); @@ -162,9 +160,7 @@ public class ContentServices { if (UtilValidate.isEmpty(kids)) { parentList.add(nodeMap.get("contentId")); } else { - Iterator<Map<String, Object>> iter = kids.iterator(); - while (iter.hasNext()) { - Map<String, Object> node = iter.next(); + for(Map<String, Object> node : kids) { walkParentTree(node, parentList); } } @@ -843,9 +839,7 @@ public class ContentServices { List<GenericValue> filteredAssocs = EntityUtil.filterByDate(relatedAssocs); //if (Debug.infoOn()) Debug.logInfo("in deactivateAssocs, filteredAssocs:" + filteredAssocs, module); - Iterator<GenericValue> it = filteredAssocs.iterator(); - while (it.hasNext()) { - GenericValue val = it.next(); + for(GenericValue val : filteredAssocs) { val.set("thruDate", nowTimestamp); val.store(); //if (Debug.infoOn()) Debug.logInfo("in deactivateAssocs, val:" + val, module); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServicesComplex.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServicesComplex.java?rev=1301931&r1=1301930&r2=1301931&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServicesComplex.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServicesComplex.java Sat Mar 17 13:03:31 2012 @@ -210,7 +210,6 @@ public class ContentServicesComplex { //EntityExpr joinExpr = null; //EntityExpr expr = null; String viewName = null; - GenericValue contentAssoc = null; String contentFieldName = null; if (direction != null && direction.equalsIgnoreCase("From")) { contentFieldName = "contentIdTo"; @@ -257,9 +256,7 @@ public class ContentServicesComplex { String contentAssocTypeId = null; List<GenericValue> contentAssocsTypeFiltered = FastList.newInstance(); if (assocTypes != null && assocTypes.size() > 1) { - Iterator<GenericValue> it = contentAssocsDateFiltered.iterator(); - while (it.hasNext()) { - contentAssoc = it.next(); + for(GenericValue contentAssoc : contentAssocsDateFiltered) { contentAssocTypeId = (String)contentAssoc.get("contentAssocTypeId"); if (assocTypes.contains(contentAssocTypeId)) { contentAssocsTypeFiltered.add(contentAssoc); @@ -281,9 +278,7 @@ public class ContentServicesComplex { GenericValue dataResource = null; List<GenericValue> contentAssocDataResourceList = FastList.newInstance(); Locale locale = Locale.getDefault(); // TODO: this needs to be passed in - Iterator<GenericValue> it = contentAssocsTypeFiltered.iterator(); - while (it.hasNext()) { - contentAssoc = it.next(); + for(GenericValue contentAssoc : contentAssocsTypeFiltered) { content = contentAssoc.getRelatedOneCache(assocRelationName); if (UtilValidate.isNotEmpty(contentTypes)) { String contentTypeId = (String)content.get("contentTypeId"); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java?rev=1301931&r1=1301930&r2=1301931&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java Sat Mar 17 13:03:31 2012 @@ -163,9 +163,7 @@ public class ContentWorker implements or } alternateViews = EntityUtil.filterByDate(alternateViews, UtilDateTime.nowTimestamp(), "caFromDate", "caThruDate", true); - Iterator<GenericValue> alternateViewIter = alternateViews.iterator(); - while (alternateViewIter.hasNext()) { - GenericValue thisView = alternateViewIter.next(); + for(GenericValue thisView : alternateViews) { GenericValue altContentRole = EntityUtil.getFirst(EntityUtil.filterByDate(thisView.getRelatedByAndCache("ContentRole", UtilMisc.toMap("partyId", partyId, "roleTypeId", roleTypeId)))); GenericValue altContent = null; if (UtilValidate.isNotEmpty(altContentRole)) { @@ -393,9 +391,7 @@ public class ContentWorker implements or } alternateViews = EntityUtil.filterByDate(alternateViews, UtilDateTime.nowTimestamp(), "caFromDate", "caThruDate", true); - Iterator<GenericValue> alternateViewIter = alternateViews.iterator(); - while (alternateViewIter.hasNext()) { - GenericValue thisView = alternateViewIter.next(); + for(GenericValue thisView : alternateViews) { String currentLocaleString = thisView.getString("localeString"); if (UtilValidate.isEmpty(currentLocaleString)) { continue; @@ -498,11 +494,9 @@ public class ContentWorker implements or if (!isReturnAfter) { List<String> assocTypes = FastList.newInstance(); List<GenericValue> relatedAssocs = getContentAssocsWithId(delegator, contentId, fromDate, thruDate, direction, assocTypes); - Iterator<GenericValue> it = relatedAssocs.iterator(); Map<String, Object> assocContext = FastMap.newInstance(); assocContext.put("related", relatedAssocs); - while (it.hasNext()) { - GenericValue assocValue = it.next(); + for(GenericValue assocValue : relatedAssocs) { contentAssocTypeId = (String) assocValue.get("contentAssocTypeId"); assocContext.put("contentAssocTypeId", contentAssocTypeId); //assocContext.put("contentTypeId", assocValue.get("contentTypeId")); @@ -699,9 +693,7 @@ public class ContentWorker implements or } List<GenericValue> relatedViews = UtilGenerics.checkList(results.get("entityList")); //if (Debug.infoOn()) Debug.logInfo("traverse, relatedViews:" + relatedViews,null); - Iterator<GenericValue> it = relatedViews.iterator(); - while (it.hasNext()) { - GenericValue assocValue = it.next(); + for(GenericValue assocValue : relatedViews) { Map<String, Object> thisNode = ContentWorker.makeNode(assocValue); checkConditions(delegator, thisNode, null, whenMap); // boolean isReturnBeforePick = booleanDataType(thisNode.get("isReturnBeforePick")); @@ -771,12 +763,9 @@ public class ContentWorker implements or if (linkDir != null && linkDir.equalsIgnoreCase("TO")) { contentIdName = contentIdName.concat("To"); } - GenericValue assoc = null; GenericValue content = null; String contentTypeId = null; - Iterator<GenericValue> assocIt = assocList.iterator(); - while (assocIt.hasNext()) { - assoc = assocIt.next(); + for(GenericValue assoc : assocList) { String contentId = (String) assoc.get(contentIdName); if (Debug.infoOn()) Debug.logInfo("contentId:" + contentId, ""); content = delegator.findByPrimaryKey("Content", UtilMisc.toMap("contentId", contentId)); @@ -862,9 +851,7 @@ public class ContentWorker implements or exprList.add(joinExpr); if (UtilValidate.isNotEmpty(assocTypes)) { List<EntityExpr> exprListOr = FastList.newInstance(); - Iterator<String> it = assocTypes.iterator(); - while (it.hasNext()) { - String assocType = it.next(); + for(String assocType : assocTypes) { expr = EntityCondition.makeCondition("contentAssocTypeId", EntityOperator.EQUALS, assocType); exprListOr.add(expr); } @@ -974,9 +961,7 @@ public class ContentWorker implements or //if (Debug.infoOn()) Debug.logInfo("getContentAncestry, lst:" + lst, ""); List<GenericValue> lst2 = EntityUtil.filterByDate(lst); //if (Debug.infoOn()) Debug.logInfo("getContentAncestry, lst2:" + lst2, ""); - Iterator<GenericValue> iter = lst2.iterator(); - while (iter.hasNext()) { - GenericValue contentAssoc = iter.next(); + for(GenericValue contentAssoc : lst2) { String contentIdOther = contentAssoc.getString(contentIdOtherField); if (!contentAncestorList.contains(contentIdOther)) { getContentAncestryAll(delegator, contentIdOther, passedContentTypeId, direction, contentAncestorList); @@ -998,9 +983,7 @@ public class ContentWorker implements or List<GenericValue> contentAncestorList = FastList.newInstance(); List<Map<String, Object>> nodeTrail = FastList.newInstance(); getContentAncestry(delegator, contentId, contentAssocTypeId, direction, contentAncestorList); - Iterator<GenericValue> contentAncestorListIter = contentAncestorList.iterator(); - while (contentAncestorListIter.hasNext()) { - GenericValue value = contentAncestorListIter.next(); + for(GenericValue value : contentAncestorList) { Map<String, Object> thisNode = ContentWorker.makeNode(value); nodeTrail.add(thisNode); } @@ -1460,12 +1443,10 @@ public class ContentWorker implements or return ""; } StringBuilder csv = new StringBuilder(); - Iterator<Map<String, ? extends Object>> it = nodeTrail.iterator(); - while (it.hasNext()) { + for(Map<String, ? extends Object> node : nodeTrail) { if (csv.length() > 0) { csv.append(","); } - Map<String, ? extends Object> node = it.next(); if (node == null) { break; } @@ -1479,12 +1460,9 @@ public class ContentWorker implements or List<List<String>> outList = FastList.newInstance(); List<String> contentIdList = StringUtil.split(csv, ","); GenericValue content = null; - String contentId = null; String contentName = null; List<String> values = null; - Iterator<String> it = contentIdList.iterator(); - while (it.hasNext()) { - contentId = it.next(); + for(String contentId : contentIdList) { try { content = delegator.findByPrimaryKeyCache("Content", UtilMisc.toMap("contentId", contentId)); } catch (GenericEntityException e) { @@ -1507,10 +1485,7 @@ public class ContentWorker implements or } List<String> contentIdList = StringUtil.split(csv, ","); GenericValue content = null; - String contentId = null; - Iterator<String> it = contentIdList.iterator(); - while (it.hasNext()) { - contentId = it.next(); + for(String contentId : contentIdList) { try { content = delegator.findByPrimaryKeyCache("Content", UtilMisc.toMap("contentId", contentId)); } catch (GenericEntityException e) { @@ -1528,10 +1503,7 @@ public class ContentWorker implements or return trail; } List<GenericValue> contentList = csvToContentList(csv, delegator); - GenericValue content = null; - Iterator<GenericValue> it = contentList.iterator(); - while (it.hasNext()) { - content = it.next(); + for(GenericValue content : contentList) { Map<String, Object> node = makeNode(content); trail.add(node); } @@ -1627,10 +1599,7 @@ public class ContentWorker implements or s.append(lbl); } s.append("=").append(indent).append("==>").append(eol); - Set<String> keySet = map.keySet(); - Iterator<String> it = keySet.iterator(); - while (it.hasNext()) { - String key = it.next(); + for(String key : map.keySet()) { if ("request response session".indexOf(key) < 0) { Object obj = map.get(key); s.append(spc).append(key).append(sep); @@ -1676,9 +1645,7 @@ public class ContentWorker implements or int sz = lst.size(); if (lbl != null) s.append(lbl); s.append("=").append(indent).append("==> sz:").append(sz).append(eol); - Iterator<Object> it = lst.iterator(); - while (it.hasNext()) { - Object obj = it.next(); + for(Object obj : lst) { s.append(spc); if (obj instanceof GenericValue) { GenericValue gv = (GenericValue)obj; Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java?rev=1301931&r1=1301930&r2=1301931&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java Sat Mar 17 13:03:31 2012 @@ -236,9 +236,7 @@ public class PermissionRecorder { sb.append("<td class=\"headr\" >Pass/Fail</td>"); sb.append("</tr>"); - Iterator<Map<String, Object>> iter = permCheckResults.iterator(); - while (iter.hasNext()) { - Map<String, Object> cMap = iter.next(); + for(Map<String, Object> cMap : permCheckResults) { sb.append(renderCurrentContentMapHtml(cMap)); } sb.append("</table>"); @@ -248,9 +246,7 @@ public class PermissionRecorder { public String renderCurrentContentMapHtml(Map<String, Object> cMap) { StringBuilder sb = new StringBuilder(); List<Map<String, Object>> resultList = UtilGenerics.checkList(cMap.get("checkResultList")); - Iterator<Map<String, Object>> iter = resultList.iterator(); - while (iter.hasNext()) { - Map<String, Object> rMap = iter.next(); + for(Map<String, Object> rMap : resultList) { //if (Debug.infoOn()) Debug.logInfo("renderCCMapHtml, (1):" + rMap, module); sb.append(renderResultRowHtml(rMap, cMap)); } Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/UploadContentAndImage.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/UploadContentAndImage.java?rev=1301931&r1=1301930&r2=1301931&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/UploadContentAndImage.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/UploadContentAndImage.java Sat Mar 17 13:03:31 2012 @@ -463,11 +463,9 @@ public class UploadContentAndImage { ModelEntity modelEntity = delegator.getModelEntity("ContentAssocDataResourceViewFrom"); List<String> fieldNames = modelEntity.getAllFieldNames(); - Iterator<String> iter = fieldNames.iterator(); Map<String, Object> ftlContext2 = FastMap.newInstance(); Map<String, Object> ftlContext3 = FastMap.newInstance(); - while (iter.hasNext()) { - String keyName = iter.next(); + for(String keyName : fieldNames) { Object obj = passedParams.get(keyName + suffix); ftlContext2.put(keyName, obj); } Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutEvents.java?rev=1301931&r1=1301930&r2=1301931&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutEvents.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutEvents.java Sat Mar 17 13:03:31 2012 @@ -593,9 +593,7 @@ public class LayoutEvents { GenericValue v = delegator.makeValue(entityName); GenericPK passedPK = v.getPrimaryKey(); Collection<String> keyColl = passedPK.getAllKeys(); - Iterator<String> keyIt = keyColl.iterator(); - while (keyIt.hasNext()) { - String attrName = keyIt.next(); + for(String attrName : keyColl) { String attrVal = (String)request.getAttribute(attrName); if (attrVal == null) { attrVal = (String)paramMap.get(attrName); 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=1301931&r1=1301930&r2=1301931&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 Sat Mar 17 13:03:31 2012 @@ -111,9 +111,7 @@ public class PdfSurveyServices { String surveyQuestionCategoryId = (String) createCategoryResultMap.get("surveyQuestionCategoryId"); pdfStamper.setFormFlattening(true); - Iterator<String> i = acroFieldMap.keySet().iterator(); - while (i.hasNext()) { - String fieldName = i.next(); + for(String fieldName : acroFieldMap.keySet()) { AcroFields.Item item = acroFields.getFieldItem(fieldName); int type = acroFields.getFieldType(fieldName); String value = acroFields.getField(fieldName); @@ -182,9 +180,7 @@ public class PdfSurveyServices { PdfObject tuValue = null; Set<PdfName> dictKeys = UtilGenerics.checkSet(dict.getKeys()); - Iterator<PdfName> dictKeyIter = dictKeys.iterator(); - while (dictKeyIter.hasNext()) { - PdfName dictKeyName = dictKeyIter.next(); + for(PdfName dictKeyName : dictKeys) { PdfObject dictObject = dict.get(dictKeyName); if ("/Type".equals(dictKeyName.toString())) { @@ -271,9 +267,7 @@ public class PdfSurveyServices { AcroFields fs = s.getAcroFields(); Map<String, Object> hm = UtilGenerics.checkMap(fs.getFields()); s.setFormFlattening(true); - Iterator<String> i = hm.keySet().iterator(); - while (i.hasNext()) { - String fieldName = i.next(); + for(String fieldName : hm.keySet()) { //AcroFields.Item item = fs.getFieldItem(fieldName); //int type = fs.getFieldType(fieldName); String value = fs.getField(fieldName); @@ -329,9 +323,7 @@ public class PdfSurveyServices { // for (int i=0;i<sa.length;i++) // Debug.logInfo("Appearance="+sa[i]); - Iterator<String> iter = map.keySet().iterator(); - while (iter.hasNext()) { - String fieldName = iter.next(); + for(String fieldName : map.keySet()) { String parmValue = fs.getField(fieldName); acroFieldMap.put(fieldName, parmValue); } @@ -372,9 +364,7 @@ public class PdfSurveyServices { // for (int i=0;i<sa.length;i++) // Debug.logInfo("Appearance="+sa[i]); - Iterator<String> iter = map.keySet().iterator(); - while (iter.hasNext()) { - String fieldName = iter.next(); + for(String fieldName : map.keySet()) { String fieldValue = fs.getField(fieldName); Object obj = acroFieldMap.get(fieldName); if (obj instanceof Date) { @@ -452,10 +442,8 @@ public class PdfSurveyServices { PdfWriter.getInstance(document, baos); List<GenericValue> responses = delegator.findByAnd("SurveyResponseAnswer", UtilMisc.toMap("surveyResponseId", surveyResponseId)); - Iterator<GenericValue> iter = responses.iterator(); - while (iter.hasNext()) { + for(GenericValue surveyResponseAnswer : responses) { String value = null; - GenericValue surveyResponseAnswer = iter.next(); String surveyQuestionId = (String) surveyResponseAnswer.get("surveyQuestionId"); GenericValue surveyQuestion = delegator.findByPrimaryKey("SurveyQuestion", UtilMisc.toMap("surveyQuestionId", surveyQuestionId)); String questionType = surveyQuestion.getString("surveyQuestionTypeId"); @@ -503,9 +491,7 @@ public class PdfSurveyServices { try { List<GenericValue> responses = delegator.findByAnd("SurveyResponseAnswer", UtilMisc.toMap("surveyResponseId", surveyResponseId)); - Iterator<GenericValue> iter = responses.iterator(); - while (iter.hasNext()) { - GenericValue surveyResponseAnswer = iter.next(); + for(GenericValue surveyResponseAnswer : responses) { String surveyQuestionId = (String) surveyResponseAnswer.get("surveyQuestionId"); GenericValue surveyQuestion = delegator.findByPrimaryKey("SurveyQuestion", UtilMisc.toMap("surveyQuestionId", surveyQuestionId)); qAndA.add(UtilMisc.toMap("question", surveyQuestion, "response", surveyResponseAnswer)); @@ -546,10 +532,8 @@ public class PdfSurveyServices { } List<GenericValue> responses = delegator.findByAnd("SurveyResponseAnswer", UtilMisc.toMap("surveyResponseId", surveyResponseId)); - Iterator<GenericValue> iter = responses.iterator(); - while (iter.hasNext()) { + for(GenericValue surveyResponseAnswer : responses) { String value = null; - GenericValue surveyResponseAnswer = iter.next(); String surveyQuestionId = (String) surveyResponseAnswer.get("surveyQuestionId"); GenericValue surveyQuestion = delegator.findByPrimaryKeyCache("SurveyQuestion", UtilMisc.toMap("surveyQuestionId", surveyQuestionId)); 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=1301931&r1=1301930&r2=1301931&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 Sat Mar 17 13:03:31 2012 @@ -181,9 +181,7 @@ public class SurveyWrapper { } Map<String, Object> sqaaWithColIdListByMultiRespId = FastMap.newInstance(); - Iterator<GenericValue> surveyQuestionAndApplIter = surveyQuestionAndAppls.iterator(); - while (surveyQuestionAndApplIter.hasNext()) { - GenericValue surveyQuestionAndAppl = surveyQuestionAndApplIter.next(); + for(GenericValue surveyQuestionAndAppl : surveyQuestionAndAppls) { String surveyMultiRespColId = surveyQuestionAndAppl.getString("surveyMultiRespColId"); if (UtilValidate.isNotEmpty(surveyMultiRespColId)) { String surveyMultiRespId = surveyQuestionAndAppl.getString("surveyMultiRespId"); @@ -368,9 +366,7 @@ public class SurveyWrapper { } if (UtilValidate.isNotEmpty(answers)) { - Iterator<GenericValue> i = answers.iterator(); - while (i.hasNext()) { - GenericValue answer = i.next(); + for(GenericValue answer : answers) { answerMap.put(answer.getString("surveyQuestionId"), answer); } } @@ -378,9 +374,7 @@ public class SurveyWrapper { // get the pass-thru (posted form data) if (UtilValidate.isNotEmpty(passThru)) { - Iterator<String> i = passThru.keySet().iterator(); - while (i.hasNext()) { - String key = i.next(); + for(String key : passThru.keySet()) { if (key.toUpperCase().startsWith("ANSWERS_")) { int splitIndex = key.indexOf('_'); String questionId = key.substring(splitIndex+1); @@ -440,9 +434,7 @@ public class SurveyWrapper { public Map<String, Object> getResults(List<GenericValue> questions) throws SurveyWrapperException { Map<String, Object> questionResults = FastMap.newInstance(); if (questions != null) { - Iterator<GenericValue> i = questions.iterator(); - while (i.hasNext()) { - GenericValue question = i.next(); + for(GenericValue question : questions) { Map<String, Object> results = getResultInfo(question); if (results != null) { questionResults.put(question.getString("surveyQuestionId"), results); @@ -484,10 +476,8 @@ public class SurveyWrapper { resultMap.put("_total", questionTotal); // create the map of option info ("_total", "_percent") - Iterator<String> i = thisResult.keySet().iterator(); - while (i.hasNext()) { + for(String optId : thisResult.keySet()) { Map<String, Object> optMap = FastMap.newInstance(); - String optId = i.next(); Long optTotal = (Long) thisResult.get(optId); if (optTotal == null) { optTotal = Long.valueOf(0); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/EditRenderSubContentCacheTransform.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/EditRenderSubContentCacheTransform.java?rev=1301931&r1=1301930&r2=1301931&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/EditRenderSubContentCacheTransform.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/EditRenderSubContentCacheTransform.java Sat Mar 17 13:03:31 2012 @@ -167,10 +167,7 @@ public class EditRenderSubContentCacheTr templateRoot.put("context", templateCtx); if (Debug.verboseOn()) { - Set<String> kySet = templateCtx.keySet(); - Iterator<String> it = kySet.iterator(); - while (it.hasNext()) { - Object ky = (Object)it.next(); + for(Object ky : templateCtx.keySet()) { Object val = templateCtx.get(ky); Debug.logVerbose("context key: " + ky + " val: " + val, module); } |
Free forum by Nabble | Edit this page |