<%@ page language="java" contentType="text/xml;charset=UTF-8"%><%@ page import="java.util.*"%><%@ page import="java.net.*"%><%@ page import="com.bea.content.*"%><%@ page import="com.bea.content.expression.*"%><%@ page import="com.bea.content.federated.*"%><%@ page import="com.bea.content.paging.*"%> <% // TODO: UPDATE THESE SETTINGS TO CUSTOMIZE String hostName = "wlp.bea.com"; // hostname for URL generation to the image binaries String repoName = "Shared Content Repository"; // name of the repository String contentType = "auto"; // content type to query for (hard coded because output format is very specific) String statusProperty = "status"; // optional query limiter, for example status="openBid" // Get the WLP CM context ContentContext context= new ContentContext(request); String repo = PathHelper.SEPARATOR + repoName + PathHelper.SEPARATOR; // Set up the WLP CM search string String queryString = "(cm_objectClass = '"+contentType+"')"; Object reduceQuery = request.getParameter(statusProperty); if (reduceQuery != null) { // add an optional limiter, like (tag contains 'plane') queryString = queryString + " && ("+statusProperty+" contains '"+reduceQuery.toString()+"')"; } System.out.println("query.jsp search string: "+queryString); // Create a new Search using the search query string. Search search = new Search( queryString ); search.addSearchPath(repo); // Do not use the global search cache. search.setUseCache(false); // Do the search using the ISearchManager. ISearchManager searchManager = ContentManagerFactory.getSearchManager(); context.setParameter( ICMPagedResult.PAGE_SIZE_KEY, new Integer(5) ); // use pages of size 5 // find the search results ISortableFilterablePagedList resultList = searchManager.search(context, search); CMPagedResultFactory pagedResultFactory= new CMPagedResultFactory(); ICMPagedResult pagedResults= pagedResultFactory.createPagedResult( context, resultList ); // Construct the JSON response by iterating through the results // TODO: for different content types, you will need to alter the JSON output format // to fit the shape of the returned items StringBuffer buffer = new StringBuffer(); buffer.append("\n"); while (pagedResults.hasNextPage()) { Iterator curPage = pagedResults.nextPage(); while (curPage.hasNext()) { Node curNode = curPage.next(); Property makeObj = curNode.getProperty("make"); String makeStr = "make"; if (makeObj.getValue() != null) { makeStr = makeObj.getValue().toString(); } Property modelObj = curNode.getProperty("model"); String modelStr = "model"; if (modelObj.getValue() != null) { modelStr = modelObj.getValue().toString(); } Property trimObj = curNode.getProperty("trim"); String trimStr = "trim"; if (trimObj.getValue() != null) { trimStr = trimObj.getValue().toString(); } Property yearObj = curNode.getProperty("year"); String yearStr = "year"; if (yearObj.getValue() != null) { yearStr = ""+yearObj.getValue().getLongValue(); } Property vinObj = curNode.getProperty("vin"); String vinStr = "vin"; if (vinObj.getValue() != null) { vinStr = vinObj.getValue().toString(); } Property mileageObj = curNode.getProperty("mileage"); String mileageStr = "mileage"; if (mileageObj.getValue() != null) { mileageStr = ""+mileageObj.getValue().getLongValue(); } Property priceObj = curNode.getProperty("price"); String priceStr = "price"; if (priceObj.getValue() != null) { priceStr = ""+priceObj.getValue().getLongValue(); } Property zipObj = curNode.getProperty("zip"); String zipStr = "zip"; if (zipObj.getValue() != null) { zipStr = ""+zipObj.getValue().getLongValue(); } Property damageObj = curNode.getProperty("damage_desc"); String damageStr = "damage"; if (damageObj.getValue() != null) { damageStr = damageObj.getValue().toString(); } // computed values String titleStr = yearStr+" "+makeStr+" "+modelStr+" "+trimStr; titleStr = titleStr.toUpperCase(); ID idObj = curNode.getId(); String id = URLEncoder.encode(idObj.toString(), "UTF-8"); String url = "http://"+hostName+request.getContextPath()+ "/ShowProperty?nodeId="+id; buffer.append(" \n"); buffer.append(" "+titleStr+"\n"); buffer.append(" "+makeStr+"\n"); buffer.append(" "+modelStr+"\n"); buffer.append(" "+trimStr+"\n"); buffer.append(" "+yearStr+"\n"); buffer.append(" "+vinStr+"\n"); buffer.append(" "+mileageStr+"\n"); buffer.append(" "+priceStr+"\n"); buffer.append(" "+zipStr+"\n"); buffer.append(" "+damageStr+"\n"); buffer.append(" "+url+"\n"); buffer.append(" \n"); } } buffer.append("\n"); %> <%= buffer %>