use of org.springframework.web.portlet.bind.annotation.ResourceMapping in project uPortal by Jasig.
the class PortletMarketplaceController method getLayoutInfo.
@ResourceMapping("layoutInfo")
public String getLayoutInfo(ResourceRequest request, @RequestParam String portletFName, Model model) throws TransformerException {
Validate.notNull(portletFName, "Please supply a portlet fname");
final HttpServletRequest servletRequest = this.portalRequestUtils.getPortletHttpRequest(request);
IUserInstance ui = userInstanceManager.getUserInstance(servletRequest);
UserPreferencesManager upm = (UserPreferencesManager) ui.getPreferencesManager();
IUserLayoutManager ulm = upm.getUserLayoutManager();
IPerson person = ui.getPerson();
DistributedUserLayout userLayout = userLayoutStore.getUserLayout(person, upm.getUserProfile());
List<PortletTab> tabs = getPortletTabInfo(userLayout, portletFName);
boolean isFavorite = isPortletFavorited(ulm.getUserLayout(), portletFName);
model.addAttribute("favorite", isFavorite);
model.addAttribute("tabs", tabs);
return "json";
}
use of org.springframework.web.portlet.bind.annotation.ResourceMapping in project uPortal by Jasig.
the class GoogleAnalyticsConfigController method storeData.
@ResourceMapping("storeData")
public String storeData(ResourceRequest request, @RequestParam JsonNode config) throws ValidatorException, IOException, ReadOnlyException {
final PortletPreferences preferences = request.getPreferences();
this.portletPreferencesJsonDao.storeJson(preferences, CONFIG_PREF_NAME, config);
return "jsonView";
}
use of org.springframework.web.portlet.bind.annotation.ResourceMapping in project uPortal by Jasig.
the class MessageEntityTranslationController method getEntity.
@ResourceMapping
@RequestMapping(params = "action=getEntity")
public ModelAndView getEntity(@RequestParam("id") String code, @RequestParam("locale") String localeStr) {
final Locale locale = LocaleManager.parseLocale(localeStr);
final Message message = messageDao.getMessage(code, locale);
return new ModelAndView("json", "message", message);
}
use of org.springframework.web.portlet.bind.annotation.ResourceMapping in project uPortal by Jasig.
the class PortletEntityTranslationController method getPortletDefinition.
@ResourceMapping
@RequestMapping(params = "action=getEntity")
public ModelAndView getPortletDefinition(@RequestParam("id") String portletId, @RequestParam("locale") String locale) throws Exception {
final IPortletDefinition definition = portletDefinitionDao.getPortletDefinition(portletId);
final PortletDefinitionTranslation translation = new PortletDefinitionTranslation();
translation.setId(portletId);
translation.setLocale(locale);
translation.setLocalized(new LocalizedPortletDefinition(definition, locale));
translation.setOriginal(new LocalizedPortletDefinition(definition, null));
return new ModelAndView("json", "portlet", translation);
}
use of org.springframework.web.portlet.bind.annotation.ResourceMapping in project uPortal by Jasig.
the class SearchPortletController method showJSONSearchResults.
/** Display AJAX autocomplete search results for the last query */
@ResourceMapping(value = "retrieveSearchJSONResults")
public ModelAndView showJSONSearchResults(PortletRequest request) {
PortletPreferences prefs = request.getPreferences();
int maxTextLength = Integer.parseInt(prefs.getValue(AUTOCOMPLETE_MAX_TEXT_LENGTH_PREF_NAME, "180"));
final Map<String, Object> model = new HashMap<>();
List<AutocompleteResultsModel> results = new ArrayList<>();
final PortletSession session = request.getPortletSession();
String queryId = (String) session.getAttribute(SEARCH_LAST_QUERY_ID);
if (queryId != null) {
final PortalSearchResults portalSearchResults = this.getPortalSearchResults(request, queryId);
if (portalSearchResults != null) {
final ConcurrentMap<String, List<Tuple<SearchResult, String>>> resultsMap = portalSearchResults.getResults();
results = collateResultsForAutoCompleteResponse(resultsMap, maxTextLength);
}
}
model.put("results", results);
model.put("count", results.size());
return new ModelAndView("json", model);
}
Aggregations