*/
@SuppressWarnings("unchecked")
public String createMenu(String startFromPath, int numberOfLevels, HttpServletRequest request) throws PortalException, SystemException, DotDataException, DotSecurityException
{
String currentPath = request.getRequestURI();
Host host = WebAPILocator.getHostWebAPI().getCurrentHost(request);
String hostId = host.getIdentifier();
StringBuffer stringbuf = new StringBuffer();
//Variable used to discriminate the menu names based on the paramaters given to the macro
String paramsValues = "";
boolean addSpans = false;
if(request.getAttribute("menu_spans") != null && (Boolean)request.getAttribute("menu_spans")){
addSpans = true;
}
String firstItemClass = "";
if(request.getAttribute("firstItemClass") != null){
firstItemClass = " class=\""+(String)request.getAttribute("firstItemClass")+"_";
}
String lastItemClass = "";
if(request.getAttribute("lastItemClass") != null ) {
lastItemClass=" class=\""+(String)request.getAttribute("lastItemClass")+"_";
}
String menuIdPrefix = "";
if(request.getAttribute("menuIdPrefix") != null ){
menuIdPrefix=(String)request.getAttribute("menuIdPrefix")+"_";
}
paramsValues = ((Boolean)addSpans).toString() + firstItemClass.toString() + lastItemClass.toString() +
menuIdPrefix.toString();
try {
Logger.debug(NavigationWebAPI.class, "\n\nNavigationWebAPI :: StaticMenuBuilder begins");
Logger.debug(NavigationWebAPI.class, "NavigationWebAPI :: StaticMenuBuilder start path=" + startFromPath);
Logger.debug(NavigationWebAPI.class, "NavigationWebAPI :: StaticMenuBuilder number of levels=" + numberOfLevels);
if ((startFromPath == null) || (startFromPath.length() == 0)) {
Logger.debug(NavigationWebAPI.class, "pagePath=" + currentPath);
int idx1 = currentPath.indexOf("/");
int idx2 = currentPath.indexOf("/", idx1 + 1);
startFromPath = currentPath.substring(idx1, idx2 + 1);
Logger.debug(NavigationWebAPI.class, "path=" + startFromPath);
}
Logger.debug(NavigationWebAPI.class, "NavigationWebAPI :: StaticMenuBuilder hostId=" + host.getIdentifier());
java.util.List itemsList = new ArrayList();
String folderPath = "";
String fileName = "";
boolean fileExists = true;