public void executeFetch(final DSRequest request, final DSResponse response) { long ctime = -1; int maxItems = -1; // retrieve current portlet display settings if ((this.portlet != null) && (this.portlet instanceof RecentlyAddedResourcesPortlet)) { RecentlyAddedResourcesPortlet recentAdditionsPortlet = (RecentlyAddedResourcesPortlet) this.portlet; if (recentAdditionsPortlet != null) { if (getMaximumRecentlyAddedToDisplay() > 0) { maxItems = getMaximumRecentlyAddedToDisplay(); } // define the time window if (getMaximumRecentlyAddedWithinHours() > 0) { ctime = System.currentTimeMillis() - (getMaximumRecentlyAddedWithinHours() * MeasurementUtility.HOURS); setOldestDate(ctime); } } } // TODO: spinder: revisit this later. ResourceCriteria mechanism does not work. Not sure if it's // better? // ResourceCriteria c = new ResourceCriteria(); // // String p = request.getCriteria().getAttribute("parentId"); // // if (p == null) { // c.addFilterResourceCategory(ResourceCategory.PLATFORM); // c.fetchChildResources(true); // } else { // c.addFilterParentResourceId(Integer.parseInt(p)); // } // TODO GH: Enhance resourceCriteria query to support itime based filtering for // "Recently imported" resources // if logged in then proceed making server side calls if (UserSessionManager.isLoggedIn()) { GWTServiceLookup.getResourceService() .findRecentlyAddedResources( ctime, maxItems, new AsyncCallback<List<RecentlyAddedResourceComposite>>() { public void onFailure(Throwable throwable) { CoreGUI.getErrorHandler() .handleError(MSG.view_portlet_recentlyAdded_error1(), throwable); } public void onSuccess(List<RecentlyAddedResourceComposite> recentlyAddedList) { List<RecentlyAddedResourceComposite> list = new ArrayList<RecentlyAddedResourceComposite>(); for (RecentlyAddedResourceComposite recentlyAdded : recentlyAddedList) { list.add(recentlyAdded); list.addAll(recentlyAdded.getChildren()); } response.setData(buildNodes(list)); response.setTotalRows(list.size()); processResponse(request.getRequestId(), response); } }); } else { // Log.debug("user is not logged in. Not fetching recently added resource now."); // answer the datasource response.setTotalRows(0); processResponse(request.getRequestId(), response); } }