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.v1.api.TaxonomyCourseRestController.java
@AuthorizeOperations(operations = { GooruOperationConstants.OPERATION_COURSE_ADD }) @RequestMapping(method = RequestMethod.POST) public ModelAndView createCourse(@RequestBody String data, HttpServletRequest request, HttpServletResponse response) {//from ww w . ja va 2 s. c o m final User user = (User) request.getAttribute(Constants.USER); ActionResponseDTO<TaxonomyCourse> responseDTO = getTaxonomyCourseService() .createTaxonomyCourse(buildCourseFromInputParameters(data), user); if (responseDTO.getErrors().getErrorCount() > 0) { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); } else { response.setStatus(HttpServletResponse.SC_CREATED); responseDTO.getModel().setUri(RequestMappingUri.TAXONOMY_COURSE + RequestMappingUri.SEPARATOR + responseDTO.getModel().getCourseId()); } String includes[] = (String[]) ArrayUtils.addAll(CREATE_INCLUDES, ERROR_INCLUDE); return toModelAndViewWithIoFilter(responseDTO.getModelData(), RESPONSE_FORMAT_JSON, EXCLUDE_ALL, true, includes); }
From source file:org.ednovo.gooru.controllers.v2.api.AccountRestV2Controller.java
@AuthorizeOperations(operations = { GooruOperationConstants.OPERATION_USER_SIGNIN }) @RequestMapping(method = { RequestMethod.POST }, value = "/login") public ModelAndView login(@RequestBody final String data, final HttpServletRequest request, final HttpServletResponse response) throws Exception { final JSONObject json = requestData(data); ActionResponseDTO<UserToken> responseDTO = null; responseDTO = this.getAccountService().logIn(getValue(USER_NAME, json), getValue(PASSWORD, json), false, request);/*from w w w .j ava 2s. c om*/ if (responseDTO.getErrors().getErrorCount() > 0) { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); } else { response.setStatus(HttpServletResponse.SC_OK); SessionContextSupport.putLogParameter(EVENT_NAME, USER_LOGIN); } String[] includes = (String[]) ArrayUtils.addAll(USER_INCLUDES, ERROR_INCLUDE); if (getValue(RETURN_URL, json) != null) { response.sendRedirect(getValue(RETURN_URL, json)); return null; } else { return toModelAndView( serialize(responseDTO.getModelData(), RESPONSE_FORMAT_JSON, EXCLUDE_ALL, includes)); } }
From source file:org.ednovo.gooru.controllers.v2.api.AccountRestV2Controller.java
@AuthorizeOperations(operations = { GooruOperationConstants.OPERATION_USER_SIGNIN }) @RequestMapping(method = { RequestMethod.PUT }, value = "/switch-session") public ModelAndView swithSession(@RequestParam(value = SESSIONTOKEN, required = true) final String sessionToken, final HttpServletRequest request, final HttpServletResponse response) throws Exception { ActionResponseDTO<UserToken> responseDTO = null; responseDTO = this.getAccountService().switchSession(sessionToken); if (responseDTO.getErrors().getErrorCount() > 0) { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); } else {/*w w w.j a va2 s.c om*/ response.setStatus(HttpServletResponse.SC_OK); SessionContextSupport.putLogParameter(EVENT_NAME, USER_SIGN_IN); SessionContextSupport.putLogParameter(CURRENT_SESSION_TOKEN, responseDTO.getModel().getToken()); SessionContextSupport.putLogParameter(GOORU_UID, responseDTO.getModel().getUser().getPartyUid()); } String[] includes = (String[]) ArrayUtils.addAll(USER_INCLUDES, ERROR_INCLUDE); return toModelAndView(serialize(responseDTO.getModel(), RESPONSE_FORMAT_JSON, EXCLUDE_ALL, includes)); }
From source file:org.ednovo.gooru.controllers.v2.api.AccountRestV2Controller.java
@AuthorizeOperations(operations = { GooruOperationConstants.OPERATION_USER_SIGNIN }) @RequestMapping(method = { RequestMethod.POST }, value = "/loginas/{id}") public ModelAndView loginAs(@PathVariable(value = ID) final String gooruUid, final HttpServletRequest request, final HttpServletResponse response) throws Exception { final UserToken userToken = this.getAccountService().loginAs(gooruUid, request); if (userToken == null) { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); } else {// w ww. j a v a 2 s . c o m response.setStatus(HttpServletResponse.SC_OK); } String[] includes = (String[]) ArrayUtils.addAll(USER_INCLUDES, ERROR_INCLUDE); return toModelAndView(serialize(userToken, RESPONSE_FORMAT_JSON, EXCLUDE_ALL, includes)); }
From source file:org.ednovo.gooru.controllers.v2.api.ApplicationRestV2Controller.java
@AuthorizeOperations(operations = { GooruOperationConstants.OPERATION_APPLICATION_ADD }) @RequestMapping(method = RequestMethod.POST) public ModelAndView createApplication(@RequestBody String data, HttpServletRequest request, HttpServletResponse response) throws Exception { User user = (User) request.getAttribute(Constants.USER); ActionResponseDTO<Application> responseDTO = getApplicationService() .createApplication(buildApplicationFromInputParameters(data), user); if (responseDTO.getErrors().getErrorCount() > 0) { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); } else {/*from w w w .j a v a 2s .co m*/ response.setStatus(HttpServletResponse.SC_CREATED); } String includes[] = (String[]) ArrayUtils.addAll(APPLICATION_INCLUDES, ERROR_INCLUDE); return toModelAndViewWithIoFilter(responseDTO.getModelData(), RESPONSE_FORMAT_JSON, EXCLUDE_ALL, true, includes); }
From source file:org.ednovo.gooru.controllers.v2.api.ApplicationRestV2Controller.java
@AuthorizeOperations(operations = { GooruOperationConstants.OPERATION_APPLICATION_UPDATE }) @RequestMapping(method = RequestMethod.PUT, value = "/{id}") public ModelAndView updateApplication(@RequestBody String data, HttpServletRequest request, HttpServletResponse response, @PathVariable String id) throws Exception { Application responseDTO = getApplicationService() .updateApplication(buildApplicationFromInputParameters(data), id); String includes[] = (String[]) ArrayUtils.addAll(APPLICATION_INCLUDES, ERROR_INCLUDE); return toModelAndViewWithIoFilter(responseDTO, RESPONSE_FORMAT_JSON, EXCLUDE_ALL, true, includes); }
From source file:org.ednovo.gooru.controllers.v2.api.ApplicationRestV2Controller.java
@AuthorizeOperations(operations = { GooruOperationConstants.OPERATION_APPLICATION_READ }) @RequestMapping(method = RequestMethod.GET, value = "/{id}") public ModelAndView getApplication(HttpServletRequest request, HttpServletResponse response, @PathVariable String id) throws Exception { String includes[] = (String[]) ArrayUtils.addAll(APPLICATION_INCLUDES, ERROR_INCLUDE); includes = (String[]) ArrayUtils.addAll(includes, OAUTH_CLIENT_INCLUDES); includes = (String[]) ArrayUtils.addAll(includes, APPLICATION_ITEM_INCLUDES); return toModelAndViewWithIoFilter(this.getApplicationService().getApplication(id), RESPONSE_FORMAT_JSON, EXCLUDE_ALL, true, includes); }
From source file:org.ednovo.gooru.controllers.v2.api.ApplicationRestV2Controller.java
@AuthorizeOperations(operations = { GooruOperationConstants.OPERATION_APPLICATION_READ }) @RequestMapping(method = RequestMethod.GET, value = "") public ModelAndView getApplications(HttpServletRequest request, HttpServletResponse response, @RequestParam(value = ORGANIZATION_UID, required = false) String organizationUid, @RequestParam(value = ID, required = false) String gooruUid, @RequestParam(value = OFFSET_FIELD, required = false, defaultValue = "0") Integer offset, @RequestParam(value = LIMIT_FIELD, required = false, defaultValue = "10") Integer limit) throws Exception { String includes[] = (String[]) ArrayUtils.addAll(APPLICATION_INCLUDES, ERROR_INCLUDE); User user = (User) request.getAttribute(Constants.USER); return toModelAndViewWithIoFilter( this.getApplicationService().getApplications(user, organizationUid, gooruUid, limit, offset), RESPONSE_FORMAT_JSON, EXCLUDE_ALL, true, includes); }
From source file:org.ednovo.gooru.controllers.v2.api.ApplicationRestV2Controller.java
@AuthorizeOperations(operations = { GooruOperationConstants.OPERATION_OAUTH_READ }) @RequestMapping(method = { RequestMethod.GET }, value = "/{apiKey}/oauth/client") public ModelAndView getOAuthClientByApiKey(@PathVariable String apiKey, HttpServletRequest request, HttpServletResponse response) throws Exception { request.setAttribute(Constants.EVENT_PREDICATE, "oauthclient.read"); String[] includes = (String[]) ArrayUtils.addAll(OAUTH_CLIENT_INCLUDES, ERROR_INCLUDE); return toModelAndViewWithIoFilter(oAuthService.getOAuthClientByApiKey(apiKey), RESPONSE_FORMAT_JSON, EXCLUDE_ALL, true, includes); }
From source file:org.ednovo.gooru.controllers.v2.api.ApplicationRestV2Controller.java
@AuthorizeOperations(operations = { GooruOperationConstants.OPERATION_APPLICATION_READ }) @RequestMapping(method = RequestMethod.GET, value = "/{apiKey}/item/{id}") public ModelAndView getApplicationItem(@PathVariable(value = API_KEY) String apikey, HttpServletRequest request, HttpServletResponse response, @PathVariable String id) throws Exception { String includes[] = (String[]) ArrayUtils.addAll(APPLICATION_ITEM_INCLUDES, ERROR_INCLUDE); return toModelAndViewWithIoFilter(this.getApplicationService().getApplicationItem(apikey, id), RESPONSE_FORMAT_JSON, EXCLUDE_ALL, true, includes); }