@Test public void testSystemUpdateExpectContentAndImageNodesToUpdateOnContentUpdate() throws Exception { String contentId = createAndPublishAContent(); update(contentId); String liveVersionKey = (String) ((Map<String, Object>) getContent(contentId).getResult().get("content")).get("versionKey"); String draftVersionKey = (String) ((Map<String, Object>) getContent(contentId + ".img").getResult().get("content")).get("versionKey"); String contentUpdateName = "Updated Name for Resource Content"; String systemUpdateReqForContent = "{\"request\": {\"content\": {\"name\": \"" + contentUpdateName + "\"}}}"; systemUpdate(contentId, systemUpdateReqForContent); Response contentResponse = getContent(contentId); Response contentImageResponse = getContent(contentId + ".img"); assertEquals(contentUpdateName, (String) ((Map<String, Object>) contentResponse.getResult().get("content")).get("name")); assertEquals(contentUpdateName, (String) ((Map<String, Object>) contentImageResponse.getResult().get("content")).get("name")); assertEquals(liveVersionKey, (String) ((Map<String, Object>) contentResponse.getResult().get("content")).get("versionKey")); assertEquals(draftVersionKey, (String) ((Map<String, Object>) contentImageResponse.getResult().get("content")).get("versionKey")); }
@SuppressWarnings("unchecked") public ResponseEntity<Response> update(@PathVariable(value = "id") String contentId, @RequestBody Map<String, Object> requestMap) { String apiId = "ekstep.learning.content.update"; TelemetryManager.log( "Executing Content Update API (Java Version) (API Version V3) For Content Id: " + contentId + ".", requestMap); Request request = getRequest(requestMap); try { Map<String, Object> map = (Map<String, Object>) request.get("content"); Response response = contentManager.update(contentId, map); return getResponseEntity(response, apiId, null); } catch (Exception e) { TelemetryManager.error("Exception: " + e.getMessage(), e); return getExceptionResponseEntity(e, apiId, null); } }
ContentV3Controller extends BaseController { @SuppressWarnings("unchecked") public ResponseEntity<Response> update(@PathVariable(value = "id") String contentId, @RequestBody Map<String, Object> requestMap) { String apiId = "ekstep.learning.content.update"; TelemetryManager.log( "Executing Content Update API (Java Version) (API Version V3) For Content Id: " + contentId + ".", requestMap); Request request = getRequest(requestMap); try { Map<String, Object> map = (Map<String, Object>) request.get("content"); Response response = contentManager.update(contentId, map); return getResponseEntity(response, apiId, null); } catch (Exception e) { TelemetryManager.error("Exception: " + e.getMessage(), e); return getExceptionResponseEntity(e, apiId, null); } } }
ContentV3Controller extends BaseController { @SuppressWarnings("unchecked") public ResponseEntity<Response> update(@PathVariable(value = "id") String contentId, @RequestBody Map<String, Object> requestMap) { String apiId = "ekstep.learning.content.update"; TelemetryManager.log( "Executing Content Update API (Java Version) (API Version V3) For Content Id: " + contentId + ".", requestMap); Request request = getRequest(requestMap); try { Map<String, Object> map = (Map<String, Object>) request.get("content"); Response response = contentManager.update(contentId, map); return getResponseEntity(response, apiId, null); } catch (Exception e) { TelemetryManager.error("Exception: " + e.getMessage(), e); return getExceptionResponseEntity(e, apiId, null); } }  }
ContentV3Controller extends BaseController { @SuppressWarnings("unchecked") public ResponseEntity<Response> update(@PathVariable(value = "id") String contentId, @RequestBody Map<String, Object> requestMap) { String apiId = "ekstep.learning.content.update"; TelemetryManager.log( "Executing Content Update API (Java Version) (API Version V3) For Content Id: " + contentId + ".", requestMap); Request request = getRequest(requestMap); try { Map<String, Object> map = (Map<String, Object>) request.get("content"); Response response = contentManager.update(contentId, map); return getResponseEntity(response, apiId, null); } catch (Exception e) { TelemetryManager.error("Exception: " + e.getMessage(), e); return getExceptionResponseEntity(e, apiId, null); } }  @SuppressWarnings("unchecked") // @RequestMapping(value = "/create", method = RequestMethod.POST) // @ResponseBody ResponseEntity<Response> create(@RequestBody Map<String, Object> requestMap,
			@RequestHeader(value = CHANNEL_ID, required = true) String channelId); @SuppressWarnings("unchecked") // @RequestMapping(value = "/update/{id:.+}", method = RequestMethod.PATCH) // @ResponseBody ResponseEntity<Response> update(@PathVariable(value = "id") String contentId,
			@RequestBody Map<String, Object> requestMap); @RequestMapping(value = "/upload/{id:.+}", method = RequestMethod.POST) @ResponseBody ResponseEntity<Response> upload(@PathVariable(value = "id") String contentId,
			@RequestParam(value = "file", required = false) MultipartFile file,
			@RequestParam(value = "fileUrl", required = false) String fileUrl,
			@RequestParam(value = "mimeType", required = false) String mimeType); @RequestMapping(value = "/bundle", method = RequestMethod.POST) @ResponseBody ResponseEntity<Response> bundle(@RequestBody Map<String, Object> map); @SuppressWarnings("unchecked") @RequestMapping(value = { "/publish/{id:.+}", "/public/publish/{id:.+}" }, method = RequestMethod.POST) @ResponseBody ResponseEntity<Response> publish(@PathVariable(value = "id") String contentId,
			@RequestBody Map<String, Object> map); @SuppressWarnings("unchecked") @RequestMapping(value = "/unlisted/publish/{id:.+}", method = RequestMethod.POST) @ResponseBody ResponseEntity<Response> publishUnlisted(@PathVariable(value = "id") String contentId,
			@RequestBody Map<String, Object> map); @RequestMapping(value = "/review/{id:.+}", method = RequestMethod.POST) @ResponseBody ResponseEntity<Response> review(@PathVariable(value = "id") String contentId,
			@RequestBody Map<String, Object> map); @RequestMapping(value = "/hierarchy/{id:.+}", method = RequestMethod.GET) @ResponseBody ResponseEntity<Response> hierarchy(@PathVariable(value = "id") String contentId,
											  @RequestParam(value = "mode", required = false) String mode,
											  @RequestParam(value = "fields", required = false) String[] fields); @RequestMapping(value = "/hierarchy/{id:.+}/{bookmarkId:.+}", method = RequestMethod.GET) @ResponseBody ResponseEntity<Response> hierarchy(@PathVariable(value = "id") String contentId,
											  @PathVariable(value = "bookmarkId") String bookmarkId,
											  @RequestParam(value = "mode", required = false) String mode,
											  @RequestParam(value = "fields", required = false) String[] fields); ResponseEntity<Response> find(@PathVariable(value = "id") String contentId,
			@RequestParam(value = "fields", required = false) String[] fields,
			@RequestParam(value = "mode", required = false) String mode); @SuppressWarnings("unchecked") @RequestMapping(value = "/upload/url/{id:.+}", method = RequestMethod.POST) @ResponseBody ResponseEntity<Response> preSignedURL(@PathVariable(value = "id") String contentId,
												 @RequestBody Map<String, Object> map, @PathParam(value = "type") String type); @SuppressWarnings("unchecked") @RequestMapping(value = "/hierarchy/update", method = RequestMethod.PATCH) @ResponseBody ResponseEntity<Response> updateHierarchy(@RequestBody Map<String, Object> requestMap); @SuppressWarnings("unchecked") @RequestMapping(value = "/hierarchy/sync/{id:.+}", method = RequestMethod.POST) @ResponseBody ResponseEntity<Response> syncHierarchy(@PathVariable(value = "id") String identifier); @RequestMapping(value = "/dialcode/link", method = RequestMethod.POST) @ResponseBody ResponseEntity<Response> linkDialCode(@RequestBody Map<String, Object> requestMap,
			@RequestHeader(value = CHANNEL_ID, required = true) String channelId); @RequestMapping(value = "/dialcode/reserve/{id:.+}", method = RequestMethod.POST) @ResponseBody ResponseEntity<Response> reserveDialCode(
			@PathVariable(value = "id") String contentId,
			@RequestBody Map<String, Object> requestMap,
			@RequestHeader(value = CHANNEL_ID, required = true) String channelId); @RequestMapping(value="/dialcode/release/{id}", method = RequestMethod.PATCH) @ResponseBody ResponseEntity<Response> releaseDialcodes(@PathVariable(value="id") String contentId,
													 @RequestHeader(value = CHANNEL_ID) String channelId); @SuppressWarnings("unchecked") @RequestMapping(value = "/copy/{id:.+}", method = RequestMethod.POST) @ResponseBody ResponseEntity<Response> copy(@PathVariable(value = "id") String contentId,
			@RequestParam(value = "mode", required = false) String mode, @RequestBody Map<String, Object> requestMap); @RequestMapping(value="/retire/{id:.+}", method = RequestMethod.DELETE) @ResponseBody ResponseEntity<Response> retire(@PathVariable(value = "id") String contentId); @RequestMapping(value="/flag/accept/{id:.+}", method = RequestMethod.POST) @ResponseBody ResponseEntity<Response> acceptFlag(@PathVariable(value = "id") String contentId); @RequestMapping(value="/flag/reject/{id:.+}", method = RequestMethod.POST) @ResponseBody ResponseEntity<Response> rejectFlag(@PathVariable(value = "id") String contentId); @RequestMapping(value="/flag/{id:.+}", method = RequestMethod.POST) @ResponseBody ResponseEntity<Response> flag(@PathVariable(value = "id") String contentId,
			@RequestBody Map<String, Object> map); @RequestMapping(value = "/discard/{id:.+}", method = RequestMethod.DELETE) @ResponseBody ResponseEntity<Response> discard(@PathVariable(value = "id") String contentId); @RequestMapping(value = "/reject/{id:.+}", method = RequestMethod.POST) @ResponseBody ResponseEntity<Response> rejectContent(@PathVariable(value = "id") String contentId,
												  @RequestBody Map<String, Object> requestMap); }
ContentV3Controller extends BaseController { @SuppressWarnings("unchecked") public ResponseEntity<Response> update(@PathVariable(value = "id") String contentId, @RequestBody Map<String, Object> requestMap) { String apiId = "ekstep.learning.content.update"; TelemetryManager.log( "Executing Content Update API (Java Version) (API Version V3) For Content Id: " + contentId + ".", requestMap); Request request = getRequest(requestMap); try { Map<String, Object> map = (Map<String, Object>) request.get("content"); Response response = contentManager.update(contentId, map); return getResponseEntity(response, apiId, null); } catch (Exception e) { TelemetryManager.error("Exception: " + e.getMessage(), e); return getExceptionResponseEntity(e, apiId, null); } }  @SuppressWarnings("unchecked") // @RequestMapping(value = "/create", method = RequestMethod.POST) // @ResponseBody ResponseEntity<Response> create(@RequestBody Map<String, Object> requestMap,
			@RequestHeader(value = CHANNEL_ID, required = true) String channelId); @SuppressWarnings("unchecked") // @RequestMapping(value = "/update/{id:.+}", method = RequestMethod.PATCH) // @ResponseBody ResponseEntity<Response> update(@PathVariable(value = "id") String contentId,
			@RequestBody Map<String, Object> requestMap); @RequestMapping(value = "/upload/{id:.+}", method = RequestMethod.POST) @ResponseBody ResponseEntity<Response> upload(@PathVariable(value = "id") String contentId,
			@RequestParam(value = "file", required = false) MultipartFile file,
			@RequestParam(value = "fileUrl", required = false) String fileUrl,
			@RequestParam(value = "mimeType", required = false) String mimeType); @RequestMapping(value = "/bundle", method = RequestMethod.POST) @ResponseBody ResponseEntity<Response> bundle(@RequestBody Map<String, Object> map); @SuppressWarnings("unchecked") @RequestMapping(value = { "/publish/{id:.+}", "/public/publish/{id:.+}" }, method = RequestMethod.POST) @ResponseBody ResponseEntity<Response> publish(@PathVariable(value = "id") String contentId,
			@RequestBody Map<String, Object> map); @SuppressWarnings("unchecked") @RequestMapping(value = "/unlisted/publish/{id:.+}", method = RequestMethod.POST) @ResponseBody ResponseEntity<Response> publishUnlisted(@PathVariable(value = "id") String contentId,
			@RequestBody Map<String, Object> map); @RequestMapping(value = "/review/{id:.+}", method = RequestMethod.POST) @ResponseBody ResponseEntity<Response> review(@PathVariable(value = "id") String contentId,
			@RequestBody Map<String, Object> map); @RequestMapping(value = "/hierarchy/{id:.+}", method = RequestMethod.GET) @ResponseBody ResponseEntity<Response> hierarchy(@PathVariable(value = "id") String contentId,
											  @RequestParam(value = "mode", required = false) String mode,
											  @RequestParam(value = "fields", required = false) String[] fields); @RequestMapping(value = "/hierarchy/{id:.+}/{bookmarkId:.+}", method = RequestMethod.GET) @ResponseBody ResponseEntity<Response> hierarchy(@PathVariable(value = "id") String contentId,
											  @PathVariable(value = "bookmarkId") String bookmarkId,
											  @RequestParam(value = "mode", required = false) String mode,
											  @RequestParam(value = "fields", required = false) String[] fields); ResponseEntity<Response> find(@PathVariable(value = "id") String contentId,
			@RequestParam(value = "fields", required = false) String[] fields,
			@RequestParam(value = "mode", required = false) String mode); @SuppressWarnings("unchecked") @RequestMapping(value = "/upload/url/{id:.+}", method = RequestMethod.POST) @ResponseBody ResponseEntity<Response> preSignedURL(@PathVariable(value = "id") String contentId,
												 @RequestBody Map<String, Object> map, @PathParam(value = "type") String type); @SuppressWarnings("unchecked") @RequestMapping(value = "/hierarchy/update", method = RequestMethod.PATCH) @ResponseBody ResponseEntity<Response> updateHierarchy(@RequestBody Map<String, Object> requestMap); @SuppressWarnings("unchecked") @RequestMapping(value = "/hierarchy/sync/{id:.+}", method = RequestMethod.POST) @ResponseBody ResponseEntity<Response> syncHierarchy(@PathVariable(value = "id") String identifier); @RequestMapping(value = "/dialcode/link", method = RequestMethod.POST) @ResponseBody ResponseEntity<Response> linkDialCode(@RequestBody Map<String, Object> requestMap,
			@RequestHeader(value = CHANNEL_ID, required = true) String channelId); @RequestMapping(value = "/dialcode/reserve/{id:.+}", method = RequestMethod.POST) @ResponseBody ResponseEntity<Response> reserveDialCode(
			@PathVariable(value = "id") String contentId,
			@RequestBody Map<String, Object> requestMap,
			@RequestHeader(value = CHANNEL_ID, required = true) String channelId); @RequestMapping(value="/dialcode/release/{id}", method = RequestMethod.PATCH) @ResponseBody ResponseEntity<Response> releaseDialcodes(@PathVariable(value="id") String contentId,
													 @RequestHeader(value = CHANNEL_ID) String channelId); @SuppressWarnings("unchecked") @RequestMapping(value = "/copy/{id:.+}", method = RequestMethod.POST) @ResponseBody ResponseEntity<Response> copy(@PathVariable(value = "id") String contentId,
			@RequestParam(value = "mode", required = false) String mode, @RequestBody Map<String, Object> requestMap); @RequestMapping(value="/retire/{id:.+}", method = RequestMethod.DELETE) @ResponseBody ResponseEntity<Response> retire(@PathVariable(value = "id") String contentId); @RequestMapping(value="/flag/accept/{id:.+}", method = RequestMethod.POST) @ResponseBody ResponseEntity<Response> acceptFlag(@PathVariable(value = "id") String contentId); @RequestMapping(value="/flag/reject/{id:.+}", method = RequestMethod.POST) @ResponseBody ResponseEntity<Response> rejectFlag(@PathVariable(value = "id") String contentId); @RequestMapping(value="/flag/{id:.+}", method = RequestMethod.POST) @ResponseBody ResponseEntity<Response> flag(@PathVariable(value = "id") String contentId,
			@RequestBody Map<String, Object> map); @RequestMapping(value = "/discard/{id:.+}", method = RequestMethod.DELETE) @ResponseBody ResponseEntity<Response> discard(@PathVariable(value = "id") String contentId); @RequestMapping(value = "/reject/{id:.+}", method = RequestMethod.POST) @ResponseBody ResponseEntity<Response> rejectContent(@PathVariable(value = "id") String contentId,
												  @RequestBody Map<String, Object> requestMap);  }