Author: mrisaliti
Date: Sat Jan 29 21:34:25 2011 New Revision: 1065116 URL: http://svn.apache.org/viewvc?rev=1065116&view=rev Log: Remove some java compilation warnings of TraverseSubContentCacheTransform/ TraverseSubContentTransform(OFBIZ-4102) Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/TraverseSubContentCacheTransform.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/TraverseSubContentTransform.java Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/TraverseSubContentCacheTransform.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/TraverseSubContentCacheTransform.java?rev=1065116&r1=1065115&r2=1065116&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/TraverseSubContentCacheTransform.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/TraverseSubContentCacheTransform.java Sat Jan 29 21:34:25 2011 @@ -31,6 +31,7 @@ import javolution.util.FastMap; import org.ofbiz.base.util.GeneralException; import org.ofbiz.base.util.UtilDateTime; +import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.template.FreeMarkerWorker; import org.ofbiz.content.content.ContentWorker; @@ -66,7 +67,7 @@ public class TraverseSubContentCacheTran * @deprecated use FreeMarkerWorker.getArg() */ @Deprecated - public static String getArg(Map args, String key, Environment env) { + public static String getArg(Map<String, Object> args, String key, Environment env) { return FreeMarkerWorker.getArg(args, key, env); } @@ -74,7 +75,7 @@ public class TraverseSubContentCacheTran * @deprecated use FreeMarkerWorker.getArg() */ @Deprecated - public static String getArg(Map args, String key, Map ctx) { + public static String getArg(Map<String, Object> args, String key, Map<String, Object> ctx) { return FreeMarkerWorker.getArg(args, key, ctx); } @@ -82,41 +83,39 @@ public class TraverseSubContentCacheTran final StringBuilder buf = new StringBuilder(); final Environment env = Environment.getCurrentEnvironment(); //final Map templateRoot = FreeMarkerWorker.getWrappedObject("context", env); - final Map templateRoot = FreeMarkerWorker.createEnvironmentMap(env); + final Map<String, Object> templateRoot = FreeMarkerWorker.createEnvironmentMap(env); //FreeMarkerWorker.convertContext(templateRoot); - final Map savedValuesUp = FastMap.newInstance(); + final Map<String, Object> savedValuesUp = FastMap.newInstance(); FreeMarkerWorker.saveContextValues(templateRoot, upSaveKeyNames, savedValuesUp); - final Map savedValues = FastMap.newInstance(); + final Map<String, Object> savedValues = FastMap.newInstance(); FreeMarkerWorker.overrideWithArgs(templateRoot, args); String startContentAssocTypeId = (String)templateRoot.get("contentAssocTypeId"); - //if (Debug.infoOn()) Debug.logInfo("in TraverseSubContentCache, startContentAssocTypeId:" + startContentAssocTypeId, module); + // if (Debug.infoOn()) Debug.logInfo("in TraverseSubContentCache, startContentAssocTypeId:" + startContentAssocTypeId, module); final Delegator delegator = FreeMarkerWorker.getWrappedObject("delegator", env); final HttpServletRequest request = FreeMarkerWorker.getWrappedObject("request", env); FreeMarkerWorker.getSiteParameters(request, templateRoot); final GenericValue userLogin = FreeMarkerWorker.getWrappedObject("userLogin", env); - Object obj = templateRoot.get("globalNodeTrail"); - List globalNodeTrail = (List)obj; - //List globalNodeTrail = (List)templateRoot.get("globalNodeTrail"); - String csvTrail = ContentWorker.nodeTrailToCsv(globalNodeTrail); - //if (Debug.infoOn()) Debug.logInfo("in Traverse(0), csvTrail:"+csvTrail,module); + List<Map<String, ? extends Object>> globalNodeTrail = UtilGenerics.checkList(templateRoot.get("globalNodeTrail")); + // List globalNodeTrail = (List)templateRoot.get("globalNodeTrail"); + // String csvTrail = ContentWorker.nodeTrailToCsv(globalNodeTrail); + // if (Debug.infoOn()) Debug.logInfo("in Traverse(0), csvTrail:"+csvTrail,module); String strNullThruDatesOnly = (String)templateRoot.get("nullThruDatesOnly"); String contentAssocPredicateId = (String)templateRoot.get("contentAssocPredicateId"); Boolean nullThruDatesOnly = (strNullThruDatesOnly != null && strNullThruDatesOnly.equalsIgnoreCase("true")) ? Boolean.TRUE :Boolean.FALSE; - GenericValue val = null; try { // getCurrentContent puts the "current" node on the end of globalNodeTrail. // It may have already been there, but getCurrentContent will compare its contentId // to values in templateRoot. - val = ContentWorker.getCurrentContent(delegator, globalNodeTrail, userLogin, templateRoot, nullThruDatesOnly, contentAssocPredicateId); + ContentWorker.getCurrentContent(delegator, globalNodeTrail, userLogin, templateRoot, nullThruDatesOnly, contentAssocPredicateId); } catch (GeneralException e) { throw new RuntimeException("Error getting current content. " + e.toString()); } - final GenericValue view = val; + // final GenericValue view = val; - final Map traverseContext = FastMap.newInstance(); + final Map<String, Object> traverseContext = FastMap.newInstance(); traverseContext.put("delegator", delegator); - Map whenMap = FastMap.newInstance(); + Map<String, Object> whenMap = FastMap.newInstance(); whenMap.put("followWhen", templateRoot.get("followWhen")); whenMap.put("pickWhen", templateRoot.get("pickWhen")); whenMap.put("returnBeforePickWhen", templateRoot.get("returnBeforePickWhen")); @@ -145,7 +144,6 @@ public class TraverseSubContentCacheTran } traverseContext.put("direction", direction); - return new LoopWriter(out) { @Override @@ -163,34 +161,34 @@ public class TraverseSubContentCacheTran @Override public int onStart() throws TemplateModelException, IOException { //templateContext.put("buf", new StringBuilder()); - List nodeTrail = null; - Map node = null; - GenericValue subContentDataResourceView = null; - List globalNodeTrail = (List)templateRoot.get("globalNodeTrail"); - String trailCsv = ContentWorker.nodeTrailToCsv(globalNodeTrail); - //if (Debug.infoOn()) Debug.logInfo("in TraverseSubContentCache, onStart, trailCsv(1):" + trailCsv , module); + List<Map<String, ? extends Object>> nodeTrail = null; + Map<String, Object> node = null; + // GenericValue subContentDataResourceView = null; + List<Map<String, ? extends Object>> globalNodeTrail = UtilGenerics.checkList(templateRoot.get("globalNodeTrail")); + // String trailCsv = ContentWorker.nodeTrailToCsv(globalNodeTrail); + // if (Debug.infoOn()) Debug.logInfo("in TraverseSubContentCache, onStart, trailCsv(1):" + trailCsv , module); if (globalNodeTrail.size() > 0) { int sz = globalNodeTrail.size() ; nodeTrail = FastList.newInstance(); //nodeTrail = passedGlobalNodeTrail.subList(sz - 1, sz); - node = (Map)globalNodeTrail.get(sz - 1); + node = UtilGenerics.checkMap(globalNodeTrail.get(sz - 1)); //if (Debug.infoOn()) Debug.logInfo("in TraverseSubContentCache, onStart, node(1):" + node , module); Boolean checkedObj = (Boolean)node.get("checked"); - Map whenMap = (Map)templateRoot.get("whenMap"); + Map<String, Object> whenMap = UtilGenerics.checkMap(templateRoot.get("whenMap")); //if (Debug.infoOn()) Debug.logInfo("in TraverseSubContentCache, whenMap(2):" + whenMap , module); if (checkedObj == null || !checkedObj.booleanValue()) { ContentWorker.checkConditions(delegator, node, null, whenMap); } - subContentDataResourceView = (GenericValue)node.get("value"); } else { throw new IOException("Empty node trail entries"); } Boolean isReturnBeforePickBool = (Boolean)node.get("isReturnBeforePick"); - if (isReturnBeforePickBool != null && isReturnBeforePickBool.booleanValue()) + if (isReturnBeforePickBool != null && isReturnBeforePickBool.booleanValue()) { return TransformControl.SKIP_BODY; + } - GenericValue content = null; + // GenericValue content = null; ContentWorker.selectKids(node, traverseContext); //if (Debug.infoOn()) Debug.logInfo("in TraverseSubContentCache, onStart, node(2):" + node , module); nodeTrail.add(node); @@ -215,45 +213,41 @@ public class TraverseSubContentCacheTran @Override public int afterBody() throws TemplateModelException, IOException { - - FreeMarkerWorker.reloadValues(templateRoot, savedValues, env); - List globalNodeTrail = (List)templateRoot.get("globalNodeTrail"); - //if (Debug.infoOn()) Debug.logInfo("populateContext, globalNodeTrail(2a):" + FreeMarkerWorker.nodeTrailToCsv(globalNodeTrail), ""); - List nodeTrail = (List)traverseContext.get("nodeTrail"); - //List savedGlobalNodeTrail = (List)savedValues.get("globalNodeTrail"); - //templateRoot.put("globalNodeTrail", savedGlobalNodeTrail); + // List globalNodeTrail = (List)templateRoot.get("globalNodeTrail"); + // if (Debug.infoOn()) Debug.logInfo("populateContext, globalNodeTrail(2a):" + FreeMarkerWorker.nodeTrailToCsv(globalNodeTrail), ""); + // List<Map<String, ? extends Object>> nodeTrail = UtilGenerics.checkList(traverseContext.get("nodeTrail")); + // List savedGlobalNodeTrail = (List)savedValues.get("globalNodeTrail"); + // templateRoot.put("globalNodeTrail", savedGlobalNodeTrail); + // int sz = nodeTrail.size(); boolean inProgress = ContentWorker.traverseSubContent(traverseContext); - int sz = nodeTrail.size(); if (inProgress) { populateContext(traverseContext, templateRoot); FreeMarkerWorker.saveContextValues(templateRoot, saveKeyNames, savedValues); //globalNodeTrail = (List)templateRoot.get("globalNodeTrail"); //globalNodeTrail.addAll(nodeTrail); return TransformControl.REPEAT_EVALUATION; - } else + } else { return TransformControl.END_EVALUATION; + } } @Override public void close() throws IOException { - FreeMarkerWorker.reloadValues(templateRoot, savedValuesUp, env); String wrappedContent = buf.toString(); out.write(wrappedContent); //if (Debug.infoOn()) Debug.logInfo("in TraverseSubContent, wrappedContent:" + wrappedContent, module); } - - public void populateContext(Map traverseContext, Map templateContext) { - - List nodeTrail = (List)traverseContext.get("nodeTrail"); - //if (Debug.infoOn()) Debug.logInfo("populateContext, nodeTrail csv(a):" + FreeMarkerWorker.nodeTrailToCsv((List)nodeTrail), ""); + public void populateContext(Map<String, Object> traverseContext, Map<String, Object> templateContext) { + List<Map<String, ? extends Object>> nodeTrail = UtilGenerics.checkList(traverseContext.get("nodeTrail")); + // if (Debug.infoOn()) Debug.logInfo("populateContext, nodeTrail csv(a):" + FreeMarkerWorker.nodeTrailToCsv((List)nodeTrail), ""); int sz = nodeTrail.size(); - Map node = (Map)nodeTrail.get(sz - 1); + Map<String, ? extends Object> node = nodeTrail.get(sz - 1); GenericValue content = (GenericValue)node.get("value"); String contentId = (String)node.get("contentId"); - String subContentId = (String)node.get("subContentId"); + // String subContentId = (String)node.get("subContentId"); String contentAssocTypeId = (String)node.get("contentAssocTypeId"); envWrap("contentAssocTypeId", contentAssocTypeId); envWrap("contentId", contentId); @@ -261,13 +255,13 @@ public class TraverseSubContentCacheTran String mapKey = (String)node.get("mapKey"); envWrap("mapKey", mapKey); envWrap("subContentDataResourceView", null); - List globalNodeTrail = (List)templateContext.get("globalNodeTrail"); + List<Map<String, ? extends Object>> globalNodeTrail = UtilGenerics.checkList(templateContext.get("nodeTrail")); String contentIdEnd = null; String contentIdStart = null; if (globalNodeTrail != null) { - Map ndEnd = (Map)globalNodeTrail.get(globalNodeTrail.size() - 1); + Map<String, ? extends Object> ndEnd = globalNodeTrail.get(globalNodeTrail.size() - 1); contentIdEnd = (String)ndEnd.get("contentId"); - Map ndStart = (Map)nodeTrail.get(0); + Map<String, ? extends Object> ndStart = nodeTrail.get(0); contentIdStart = (String)ndStart.get("contentId"); } else { globalNodeTrail = FastList.newInstance(); @@ -276,15 +270,15 @@ public class TraverseSubContentCacheTran boolean bIdEnd = UtilValidate.isNotEmpty(contentIdEnd); boolean bIdStart = UtilValidate.isNotEmpty(contentIdStart); boolean bEquals = contentIdStart.equals(contentIdEnd); - //if (Debug.infoOn()) Debug.logInfo("in TraverseSubContentCache, populateContext, contentIdEnd(1):" + bIdEnd + " contentIdStart:" + bIdStart + " equals:" + bEquals, module); - //if (Debug.infoOn()) Debug.logInfo("populateContext, globalNodeTrail(1a):" + FreeMarkerWorker.nodeTrailToCsv(globalNodeTrail), ""); + // if (Debug.infoOn()) Debug.logInfo("in TraverseSubContentCache, populateContext, contentIdEnd(1):" + bIdEnd + " contentIdStart:" + bIdStart + " equals:" + bEquals, module); + // if (Debug.infoOn()) Debug.logInfo("populateContext, globalNodeTrail(1a):" + FreeMarkerWorker.nodeTrailToCsv(globalNodeTrail), ""); if (bIdEnd && bIdStart && bEquals) { - List subList = nodeTrail.subList(1, sz); + List<Map<String, ? extends Object>> subList = nodeTrail.subList(1, sz); globalNodeTrail.addAll(subList); } else { globalNodeTrail.addAll(nodeTrail); } - //if (Debug.infoOn()) Debug.logInfo("populateContext, globalNodeTrail(1b):" + FreeMarkerWorker.nodeTrailToCsv(globalNodeTrail), ""); + // if (Debug.infoOn()) Debug.logInfo("populateContext, globalNodeTrail(1b):" + FreeMarkerWorker.nodeTrailToCsv(globalNodeTrail), ""); int indentSz = globalNodeTrail.size(); envWrap("indent", Integer.valueOf(indentSz)); String trailCsv = ContentWorker.nodeTrailToCsv(globalNodeTrail); @@ -294,11 +288,9 @@ public class TraverseSubContentCacheTran } public void envWrap(String varName, Object obj) { - templateRoot.put(varName, obj); env.setVariable(varName, FreeMarkerWorker.autoWrap(obj, env)); } - }; } } Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/TraverseSubContentTransform.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/TraverseSubContentTransform.java?rev=1065116&r1=1065115&r2=1065116&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/TraverseSubContentTransform.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/TraverseSubContentTransform.java Sat Jan 29 21:34:25 2011 @@ -31,6 +31,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.base.util.template.FreeMarkerWorker; @@ -38,8 +39,8 @@ import org.ofbiz.content.content.Content import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; -import org.ofbiz.webapp.ftl.LoopWriter; import org.ofbiz.service.LocalDispatcher; +import org.ofbiz.webapp.ftl.LoopWriter; import freemarker.core.Environment; import freemarker.template.TemplateModelException; @@ -68,7 +69,7 @@ public class TraverseSubContentTransform * @deprecated use FreeMarkerWorker.getArg() */ @Deprecated - public static String getArg(Map args, String key, Environment env) { + public static String getArg(Map<String, Object> args, String key, Environment env) { return FreeMarkerWorker.getArg(args, key, env); } @@ -76,16 +77,16 @@ public class TraverseSubContentTransform * @deprecated use FreeMarkerWorker.getArg() */ @Deprecated - public static String getArg(Map args, String key, Map ctx) { + public static String getArg(Map<String, Object> args, String key, Map<String, Object> ctx) { return FreeMarkerWorker.getArg(args, key, ctx); } public Writer getWriter(final Writer out, Map args) { final StringBuilder buf = new StringBuilder(); final Environment env = Environment.getCurrentEnvironment(); - final Map templateCtx = FreeMarkerWorker.getWrappedObject("context", env); + final Map<String, Object> templateCtx = FreeMarkerWorker.getWrappedObject("context", env); //FreeMarkerWorker.convertContext(templateCtx); - final Map savedValues = FreeMarkerWorker.saveValues(templateCtx, saveKeyNames); + final Map<String, Object> savedValues = FreeMarkerWorker.saveValues(templateCtx, saveKeyNames); FreeMarkerWorker.overrideWithArgs(templateCtx, args); final Delegator delegator = FreeMarkerWorker.getWrappedObject("delegator", env); /* @@ -117,11 +118,10 @@ public class TraverseSubContentTransform String subContentId = (String)templateCtx.get("subContentId"); if (view == null) { String thisContentId = subContentId; - if (UtilValidate.isEmpty(thisContentId)) + if (UtilValidate.isEmpty(thisContentId)) { thisContentId = contentId; - + } if (UtilValidate.isNotEmpty(thisContentId)) { - try { view = delegator.findByPrimaryKey("Content", UtilMisc.toMap("contentId", thisContentId)); } catch (GenericEntityException e) { @@ -132,10 +132,9 @@ public class TraverseSubContentTransform } final GenericValue subContentDataResourceView = view; - - final Map traverseContext = FastMap.newInstance(); + final Map<String, Object> traverseContext = FastMap.newInstance(); traverseContext.put("delegator", delegator); - Map whenMap = FastMap.newInstance(); + Map<String, Object> whenMap = FastMap.newInstance(); whenMap.put("followWhen", templateCtx.get("followWhen")); whenMap.put("pickWhen", templateCtx.get("pickWhen")); whenMap.put("returnBeforePickWhen", templateCtx.get("returnBeforePickWhen")); @@ -180,9 +179,9 @@ public class TraverseSubContentTransform @Override public int onStart() throws TemplateModelException, IOException { //templateContext.put("buf", new StringBuilder()); - List nodeTrail = FastList.newInstance(); + List<Map<String, Object>> nodeTrail = FastList.newInstance(); traverseContext.put("nodeTrail", nodeTrail); - GenericValue content = null; + // GenericValue content = null; /* if (UtilValidate.isNotEmpty(contentId)) { try { @@ -193,21 +192,21 @@ public class TraverseSubContentTransform } } */ - Map rootNode = ContentWorker.makeNode(subContentDataResourceView); - ContentWorker.traceNodeTrail("1",nodeTrail); + Map<String, Object> rootNode = ContentWorker.makeNode(subContentDataResourceView); + ContentWorker.traceNodeTrail("1", nodeTrail); ContentWorker.selectKids(rootNode, traverseContext); - ContentWorker.traceNodeTrail("2",nodeTrail); + ContentWorker.traceNodeTrail("2", nodeTrail); nodeTrail.add(rootNode); boolean isPick = checkWhen(subContentDataResourceView, (String)traverseContext.get("contentAssocTypeId")); rootNode.put("isPick", Boolean.valueOf(isPick)); if (!isPick) { - ContentWorker.traceNodeTrail("3",nodeTrail); + ContentWorker.traceNodeTrail("3", nodeTrail); isPick = ContentWorker.traverseSubContent(traverseContext); - ContentWorker.traceNodeTrail("4",nodeTrail); + ContentWorker.traceNodeTrail("4", nodeTrail); } if (isPick) { populateContext(traverseContext, templateCtx); - ContentWorker.traceNodeTrail("5",nodeTrail); + ContentWorker.traceNodeTrail("5", nodeTrail); return TransformControl.EVALUATE_BODY; } else { return TransformControl.SKIP_BODY; @@ -219,7 +218,7 @@ public class TraverseSubContentTransform //out.write(buf.toString()); //buf.setLength(0); //templateContext.put("buf", new StringBuilder()); - List nodeTrail = (List)traverseContext.get("nodeTrail"); + List<Map<String, Object>> nodeTrail = UtilGenerics.checkList(traverseContext.get("nodeTrail")); ContentWorker.traceNodeTrail("6",nodeTrail); boolean inProgress = ContentWorker.traverseSubContent(traverseContext); ContentWorker.traceNodeTrail("7",nodeTrail); @@ -233,20 +232,16 @@ public class TraverseSubContentTransform @Override public void close() throws IOException { - String wrappedFTL = buf.toString(); String encloseWrappedText = (String)templateCtx.get("encloseWrappedText"); if (UtilValidate.isEmpty(encloseWrappedText) || encloseWrappedText.equalsIgnoreCase("false")) { - out.write(wrappedFTL); wrappedFTL = null; // So it won't get written again below. } String wrapTemplateId = (String)templateCtx.get("wrapTemplateId"); if (UtilValidate.isNotEmpty(wrapTemplateId)) { templateCtx.put("wrappedFTL", wrappedFTL); - - Map templateRoot = FreeMarkerWorker.createEnvironmentMap(env); - + Map<String, Object> templateRoot = FreeMarkerWorker.createEnvironmentMap(env); /* templateRoot.put("viewSize", viewSize); templateRoot.put("viewIndex", viewIndex); @@ -281,41 +276,39 @@ public class TraverseSubContentTransform templateContext.put("subDataResourceTypeId", null); templateContext.put("mimeTypeId", null); */ - - } else { if (UtilValidate.isNotEmpty(wrappedFTL)) out.write(wrappedFTL); } - FreeMarkerWorker.removeValues(templateCtx, removeKeyNames); - FreeMarkerWorker.reloadValues(templateCtx, savedValues, env); + FreeMarkerWorker.removeValues(templateCtx, removeKeyNames); + FreeMarkerWorker.reloadValues(templateCtx, savedValues, env); } private boolean checkWhen (GenericValue thisContent, String contentAssocTypeId) { - boolean isPick = false; - Map assocContext = FastMap.newInstance(); - if (UtilValidate.isEmpty(contentAssocTypeId)) + Map<String, Object> assocContext = FastMap.newInstance(); + if (UtilValidate.isEmpty(contentAssocTypeId)) { contentAssocTypeId = ""; + } assocContext.put("contentAssocTypeId", contentAssocTypeId); - //assocContext.put("contentTypeId", assocValue.get("contentTypeId")); - String assocRelation = null; + // assocContext.put("contentTypeId", assocValue.get("contentTypeId")); + // String assocRelation = null; String thisDirection = (String)templateCtx.get("direction"); String thisContentId = (String)templateCtx.get("thisContentId"); - String relatedDirection = null; + // String relatedDirection = null; if (thisDirection != null && thisDirection.equalsIgnoreCase("From")) { assocContext.put("contentIdFrom", thisContentId); - assocRelation = "FromContent"; - relatedDirection = "From"; + // assocRelation = "FromContent"; + // relatedDirection = "From"; } else { assocContext.put("contentIdTo", thisContentId); - assocRelation = "ToContent"; - relatedDirection = "To"; + // assocRelation = "ToContent"; + // relatedDirection = "To"; } assocContext.put("content", thisContent); - List purposes = ContentWorker.getPurposes(thisContent); + List<Object> purposes = ContentWorker.getPurposes(thisContent); assocContext.put("purposes", purposes); - List contentTypeAncestry = FastList.newInstance(); + List<String> contentTypeAncestry = FastList.newInstance(); String contentTypeId = (String)thisContent.get("contentTypeId"); try { ContentWorker.getContentTypeAncestry(delegator, contentTypeId, contentTypeAncestry); @@ -323,30 +316,28 @@ public class TraverseSubContentTransform return false; } assocContext.put("typeAncestry", contentTypeAncestry); - Map whenMap = (Map)traverseContext.get("whenMap"); - String pickWhen = (String)whenMap.get("pickWhen"); - List nodeTrail = (List)traverseContext.get("nodeTrail"); + Map<String, Object> whenMap = UtilGenerics.checkMap(traverseContext.get("whenMap")); + // String pickWhen = (String)whenMap.get("pickWhen"); + List<Map<String, ? extends Object>> nodeTrail = UtilGenerics.checkList(traverseContext.get("nodeTrail")); int indentSz = indent.intValue() + nodeTrail.size(); assocContext.put("indentObj", Integer.valueOf(indentSz)); isPick = ContentWorker.checkWhen(assocContext, (String)whenMap.get("pickWhen")); return isPick; - } - - - public void populateContext(Map traverseContext, Map templateContext) { + } - List nodeTrail = (List)traverseContext.get("nodeTrail"); + public void populateContext(Map<String, Object> traverseContext, Map<String, Object> templateContext) { + List<Map<String, Object>> nodeTrail = UtilGenerics.checkList(traverseContext.get("nodeTrail")); int sz = nodeTrail.size(); - Map node = (Map)nodeTrail.get(sz - 1); - GenericValue content = (GenericValue)node.get("value"); + Map<String, Object> node = nodeTrail.get(sz - 1); + // GenericValue content = (GenericValue)node.get("value"); String contentId = (String)node.get("contentId"); - String subContentId = (String)node.get("subContentId"); + // String subContentId = (String)node.get("subContentId"); templateContext.put("subContentId", contentId); templateContext.put("subContentDataResourceView", null); int indentSz = indent.intValue() + nodeTrail.size(); templateContext.put("indent", Integer.valueOf(indentSz)); if (sz >= 2) { - Map parentNode = (Map)nodeTrail.get(sz - 2); + Map<String, Object> parentNode = nodeTrail.get(sz - 2); GenericValue parentContent = (GenericValue)parentNode.get("value"); String parentContentId = (String)parentNode.get("contentId"); templateContext.put("parentContentId", parentContentId); |
Free forum by Nabble | Edit this page |