Last active
August 29, 2015 14:04
-
-
Save ethanbustad/412cba4ddabb957ef168 to your computer and use it in GitHub Desktop.
processDataRequest example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected String processDataRequest(ActionRequest actionRequest) { | |
try { | |
String attributesString = ParamUtil.getString(actionRequest, "attributes"); | |
Map<String, Serializable> attributes = JSONFactoryUtil.looseDeserialize(attributesString, HashMap.class); | |
String keywords = ParamUtil.getString(actionRequest, "keywords"); | |
List<Sort> sorts = new ArrayList<Sort>(); | |
String sortsString = ParamUtil.getString(actionRequest, "sorts"); | |
Map<String, Boolean> sortsMap = JSONFactoryUtil.looseDeserialize(sortsString, HashMap.class); | |
for (Map.Entry<String, Boolean> sortEntry : sortsMap.entrySet()) { | |
sorts.add(new Sort(sortEntry.getKey(), sortEntry.getValue())); | |
} | |
AlloySearchResult alloySearchResult = search(PortalUtil.getHttpServletRequest(actionRequest), actionRequest, attributes, keywords, sorts.toArray(new Sort[sorts.size()])); | |
List<ConnectPersonComposite> connectPersonComposites = ConnectCompositeUtil.getComposites(alloySearchResult.getBaseModels(), ConnectPersonComposite.class, new Class<?>[] {ConnectPerson.class, ThemeDisplay.class}, new Object[] {themeDisplay}); | |
return JSONFactoryUtil.looseSerialize(connectPersonComposites); | |
} | |
catch (Exception e) { | |
e.printStackTrace(); | |
return StringPool.BLANK; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment