question: public static List < String > makeBestTrailElementsForTrail ( HttpServletRequest request , Delegator delegator , String categoryId , String productId ) { List < String > trail = CategoryWorker . getTrail ( request ) ; List < String > trailElements = null ; if ( categoryId != null ) { if ( trail == null || trail . size ( ) < 1 ) { ; } else { ListIterator < String > li = trail . listIterator ( trail . size ( ) ) ; while ( li . hasPrevious ( ) ) { String trailCatId = li . previous ( ) ; if ( categoryId . equals ( trailCatId ) ) { trailElements = FastList . newInstance ( ) ; trailElements . add ( categoryId ) ; break ; } } if ( trailElements == null ) { li = trail . listIterator ( trail . size ( ) ) ; while ( li . hasPrevious ( ) ) { String trailCatId = li . previous ( ) ; if ( CategoryWorker . isCategoryChildOf ( request , trailCatId , categoryId ) ) { trailElements = FastList . newInstance ( ) ; trailElements . add ( trailCatId ) ; trailElements . add ( categoryId ) ; break ; } } } } } else { if ( trail == null || trail . size ( ) < 1 ) { ; } else { ListIterator < String > li = trail . listIterator ( trail . size ( ) ) ; while ( li . hasPrevious ( ) ) { String trailCatId = li . previous ( ) ; if ( CategoryWorker . isCategoryContainsProduct ( request , trailCatId , productId ) ) { trailElements = FastList . newInstance ( ) ; trailElements . add ( trailCatId ) ; break ; } } } } return trailElements ; }
target:  SCIPIO: Tries to see if the passed product or category can be integrated in the current/given trail. If it can, returns a list of TrailElements that can be passed to #updateRequestAndTrail which will merge them together. <p> If an appropriate list of trail elements can't be made (a brand new one will be required), returns null. <p> FIXME: This still does not always produce the most appropriate default trail; it only helps in some simple cases where current trail already contains the current product or category.