public static Map<String,Object> findContentParents(DispatchContext dctx,Map<String,? extends Object> context){
  Map<String,Object> results=FastMap.newInstance();
  List<Object> parentList=FastList.newInstance();
  results.put("parentList",parentList);
  LocalDispatcher dispatcher=dctx.getDispatcher();
  String contentId=(String)context.get("contentId");
  String contentAssocTypeId=(String)context.get("contentAssocTypeId");
  String direction=(String)context.get("direction");
  if (UtilValidate.isEmpty(direction)) {
    direction="To";
  }
  Map<String,Object> traversMap=FastMap.newInstance();
  traversMap.put("contentId",contentId);
  traversMap.put("direction",direction);
  traversMap.put("contentAssocTypeId",contentAssocTypeId);
  try {
    Map<String,Object> thisResults=dispatcher.runSync("traverseContent",traversMap);
    String errorMsg=ServiceUtil.getErrorMessage(thisResults);
    if (UtilValidate.isNotEmpty(errorMsg)) {
      Debug.logError("Problem in traverseContent. " + errorMsg,module);
      return ServiceUtil.returnError(errorMsg);
    }
    Map<String,Object> nodeMap=UtilGenerics.checkMap(thisResults.get("nodeMap"));
    walkParentTree(nodeMap,parentList);
  }
 catch (  GenericServiceException e) {
    return ServiceUtil.returnFailure(e.getMessage());
  }
  return results;
}

public static Map < String , Object > findContentParents ( DispatchContext dctx , Map < String , ? extends Object > context ) { Map < String , Object > results = FastMap . newInstance ( ) ; List < Object > parentList = FastList . newInstance ( ) ; results . put ( "parentList" , parentList ) ; LocalDispatcher dispatcher = dctx . getDispatcher ( ) ; String contentId = ( String ) context . get ( "contentId" ) ; String contentAssocTypeId = ( String ) context . get ( "contentAssocTypeId" ) ; String direction = ( String ) context . get ( "direction" ) ; if ( UtilValidate . isEmpty ( direction ) ) { direction = "To" ; } Map < String , Object > traversMap = FastMap . newInstance ( ) ; traversMap . put ( "contentId" , contentId ) ; traversMap . put ( "direction" , direction ) ; traversMap . put ( "contentAssocTypeId" , contentAssocTypeId ) ; try { Map < String , Object > thisResults = dispatcher . runSync ( "traverseContent" , traversMap ) ; String errorMsg = ServiceUtil . getErrorMessage ( thisResults ) ; if ( UtilValidate . isNotEmpty ( errorMsg ) ) { Debug . logError ( "Problem in traverseContent. " + errorMsg , module ) ; return ServiceUtil . returnError ( errorMsg ) ; } Map < String , Object > nodeMap = UtilGenerics . checkMap ( thisResults . get ( "nodeMap" ) ) ; walkParentTree ( nodeMap , parentList ) ; } catch ( GenericServiceException e ) { return ServiceUtil . returnFailure ( e . getMessage ( ) ) ; } return results ; }
this is a generic service for traversing a content tree , typical of a blog response tree . it calls the contentworker . traverse method .
