List of usage examples for org.apache.commons.lang ArrayUtils addAll
public static double[] addAll(double[] array1, double[] array2)
Adds all the elements of the given arrays into a new array.
From source file:org.ednovo.gooru.controllers.v2.api.ContentRestV2Controller.java
@AuthorizeOperations(operations = { GooruOperationConstants.OPERATION_FEEDBACK_READ }) @RequestMapping(method = RequestMethod.GET, value = { "/{id}/rating/{type}", "/{id}/report/{type}", "/{id}/flag/{type}", "/{id}/reaction/{type}" }) public ModelAndView getContentFeedbacks(HttpServletRequest request, @PathVariable(value = ID) String assocContentUid, @RequestParam(value = OFFSET_FIELD, required = false, defaultValue = "0") Integer offset, @RequestParam(value = LIMIT_FIELD, required = false, defaultValue = "20") Integer limit, @RequestParam(value = ORDER_BY, required = false) String orderBy, @RequestParam(value = CREATOR_UID, required = false) String creatorUid, @PathVariable(value = TYPE) String feedbackType, HttpServletResponse response) throws Exception { String includes[] = (String[]) ArrayUtils.addAll(FEEDBACK_INCLUDE_FIELDS, ERROR_INCLUDE); if (feedbackType.equalsIgnoreCase(AVERAGE)) { return toJsonModelAndView(this.getFeedbackService().getContentFeedbackAverage(assocContentUid, getFeedbackCategory(request)), true); } else if (feedbackType.equalsIgnoreCase(AGGREGATE)) { return toJsonModelAndView(this.getFeedbackService().getContentFeedbackAggregate(assocContentUid, getFeedbackCategory(request)), true); }//from w w w . j a v a2s .c o m return toModelAndViewWithIoFilter( this.getFeedbackService().getContentFeedbacks(getFeedbackCategory(request), feedbackType, assocContentUid, creatorUid, limit, offset, orderBy), RESPONSE_FORMAT_JSON, EXCLUDE_ALL, true, includes); }
From source file:org.ednovo.gooru.controllers.v2.api.ContentRestV2Controller.java
@AuthorizeOperations(operations = { GooruOperationConstants.OPERATION_FEEDBACK_READ }) @RequestMapping(method = RequestMethod.GET, value = { "/{id}/rating", "/{id}/report", "/{id}/flag", "/{id}/reaction" }) public ModelAndView getContentFeedbacksByCategory(HttpServletRequest request, @PathVariable(value = ID) String assocContentUid, @RequestParam(value = OFFSET_FIELD, required = false, defaultValue = "0") Integer offset, @RequestParam(value = LIMIT_FIELD, required = false, defaultValue = "20") Integer limit, @RequestParam(value = ORDER_BY, required = false) String orderBy, @RequestParam(value = CREATOR_UID, required = false) String creatorUid, HttpServletResponse response) throws Exception { String includes[] = (String[]) ArrayUtils.addAll(FEEDBACK_INCLUDE_FIELDS, ERROR_INCLUDE); try {/*from w ww . j a va2s .com*/ return toModelAndViewWithIoFilter( this.getFeedbackService() .getContentFeedbacks(getFeedbackCategory(request), null, assocContentUid, creatorUid, limit, offset, orderBy) .getSearchResults(), RESPONSE_FORMAT_JSON, EXCLUDE_ALL, true, includes); } catch (Exception e) { LOGGER.error("Error resolver : {} ", e); throw new RuntimeException(e); } }
From source file:org.ednovo.gooru.controllers.v2.api.EventRestV2Controller.java
@AuthorizeOperations(operations = { GooruOperationConstants.OPERATION_EVENT_ADD }) @RequestMapping(method = { RequestMethod.POST }, value = "") public ModelAndView createEvent(@RequestBody String data, HttpServletRequest request, HttpServletResponse response) throws Exception { User user = (User) request.getAttribute(Constants.USER); Event event = getEventService().createEvent(this.buildEventFromInputParameters(data), user); response.setStatus(HttpServletResponse.SC_CREATED); String includes[] = (String[]) ArrayUtils.addAll(EVENT_INCLUDES, ERROR_INCLUDE); return toModelAndViewWithIoFilter(event, RESPONSE_FORMAT_JSON, EXCLUDE_ALL, true, includes); }
From source file:org.ednovo.gooru.controllers.v2.api.EventRestV2Controller.java
@AuthorizeOperations(operations = { GooruOperationConstants.OPERATION_EVENT_UPDATE }) @RequestMapping(method = { RequestMethod.PUT }, value = "/{id}") public ModelAndView updateEvent(@PathVariable(value = ID) String id, @RequestBody String data, HttpServletRequest request, HttpServletResponse response) throws Exception { Event event = getEventService().updateEvent(id, this.buildEventFromInputParameters(data)); String includes[] = (String[]) ArrayUtils.addAll(EVENT_INCLUDES, ERROR_INCLUDE); return toModelAndViewWithIoFilter(event, RESPONSE_FORMAT_JSON, EXCLUDE_ALL, true, includes); }
From source file:org.ednovo.gooru.controllers.v2.api.EventRestV2Controller.java
@AuthorizeOperations(operations = { GooruOperationConstants.OPERATION_EVENT_READ }) @RequestMapping(method = RequestMethod.GET, value = "/{id}") public ModelAndView getEvent(@PathVariable(value = ID) String id, HttpServletRequest request, HttpServletResponse response) throws Exception { String includes[] = (String[]) ArrayUtils.addAll(EVENT_INCLUDES, ERROR_INCLUDE); return toModelAndViewWithIoFilter(this.getEventService().getEvent(id), RESPONSE_FORMAT_JSON, EXCLUDE_ALL, true, includes);//from w w w . ja va 2 s .co m }
From source file:org.ednovo.gooru.controllers.v2.api.EventRestV2Controller.java
@AuthorizeOperations(operations = { GooruOperationConstants.OPERATION_EVENT_LIST }) @RequestMapping(method = RequestMethod.GET, value = "") public ModelAndView getEvents( @RequestParam(value = OFFSET_FIELD, required = false, defaultValue = "0") Integer offset, @RequestParam(value = LIMIT_FIELD, required = false, defaultValue = "10") Integer limit, HttpServletRequest request, HttpServletResponse response) throws Exception { String includes[] = (String[]) ArrayUtils.addAll(EVENT_INCLUDES, ERROR_INCLUDE); return toModelAndViewWithIoFilter(this.getEventService().getEvents(limit, offset), RESPONSE_FORMAT_JSON, EXCLUDE_ALL, true, includes); }
From source file:org.ednovo.gooru.controllers.v2.api.EventRestV2Controller.java
@AuthorizeOperations(operations = { GooruOperationConstants.OPERATION_EVENT_MAPPING_ADD }) @RequestMapping(method = { RequestMethod.POST }, value = "/{id}/template-mapping") public ModelAndView createEventMapping(@PathVariable(value = ID) String id, @RequestBody String data, HttpServletRequest request, HttpServletResponse response) throws Exception { User user = (User) request.getAttribute(Constants.USER); EventMapping eventMapping = getEventService() .createEventMapping(this.buildEventMappingFromInputParameters(data, id), user); response.setStatus(HttpServletResponse.SC_CREATED); String includes[] = (String[]) ArrayUtils.addAll(EVENT_MAPPING_INCLUDES, ERROR_INCLUDE); return toModelAndViewWithIoFilter(eventMapping, RESPONSE_FORMAT_JSON, EXCLUDE_ALL, true, includes); }
From source file:org.ednovo.gooru.controllers.v2.api.EventRestV2Controller.java
@AuthorizeOperations(operations = { GooruOperationConstants.OPERATION_EVENT_MAPPING_UPDATE }) @RequestMapping(method = { RequestMethod.PUT }, value = "/{id}/template-mapping") public ModelAndView updateEventMapping(@PathVariable(value = ID) String id, @RequestBody String data, HttpServletRequest request, HttpServletResponse response) throws Exception { User user = (User) request.getAttribute(Constants.USER); EventMapping eventMapping = getEventService() .updateEventMapping(this.buildEventMappingFromInputParameters(data, id), user); response.setStatus(HttpServletResponse.SC_CREATED); String includes[] = (String[]) ArrayUtils.addAll(EVENT_MAPPING_INCLUDES, ERROR_INCLUDE); return toModelAndViewWithIoFilter(eventMapping, RESPONSE_FORMAT_JSON, EXCLUDE_ALL, true, includes); }
From source file:org.ednovo.gooru.controllers.v2.api.EventRestV2Controller.java
@AuthorizeOperations(operations = { GooruOperationConstants.OPERATION_EVENT_MAPPING_READ }) @RequestMapping(method = RequestMethod.GET, value = "/{id}/template-mapping") public ModelAndView getEventMapping(@PathVariable(value = ID) String eventUid, @RequestParam(value = TEMPLATE_UID) String templateUid, HttpServletRequest request, HttpServletResponse response) throws Exception { String includes[] = (String[]) ArrayUtils.addAll(EVENT_MAPPING_INCLUDES, ERROR_INCLUDE); return toModelAndViewWithIoFilter(this.getEventService().getEventMapping(eventUid, templateUid), RESPONSE_FORMAT_JSON, EXCLUDE_ALL, true, includes); }
From source file:org.ednovo.gooru.controllers.v2.api.FeedbackRestV2Controller.java
@AuthorizeOperations(operations = { GooruOperationConstants.OPERATION_FEEDBACK_ADD }) @RequestMapping(method = RequestMethod.POST, value = "") public ModelAndView createFeedback(@RequestBody final String data, final HttpServletRequest request, final HttpServletResponse response) throws Exception { final User user = (User) request.getAttribute(Constants.USER); final Feedback newFeedback = this.buildFeedbackFromInputParameters(data, request); final boolean list = newFeedback.getTypes() == null ? false : true; final List<Feedback> feedbacks = getFeedbackService().createFeedbacks(newFeedback, user); final Feedback feedback = feedbacks.get(0); response.setStatus(HttpServletResponse.SC_CREATED); final String includes[] = (String[]) ArrayUtils.addAll(FEEDBACK_INCLUDE_FIELDS, ERROR_INCLUDE); return toModelAndViewWithIoFilter(list ? feedbacks : feedback, RESPONSE_FORMAT_JSON, EXCLUDE_ALL, true, includes);/* www . j a va2 s. co m*/ }