@Test public void testGetAssessmentDataMap1() throws JsonParseException, JsonMappingException, IOException { PowerMockito.mockStatic(QuestionPaperGeneratorUtil.class); String do_11293645874324275213NodeString = "{\"id\":986986,\"graphId\":\"domain\",\"identifier\":\"do_11293645874324275213\",\"nodeType\":\"DATA_NODE\",\"objectType\":\"AssessmentItem\",\"metadata\":{\"itemType\":\"UNIT\",\"lastStatusChangedOn\":\"2020-01-16T12:22:41.396+0530\",\"creator\":\"contentcreator\",\"code\":\"5ea97a7b-cad7-4655-ae97-721a9a6bfeca\",\"qumlVersion\":0.5,\"qlevel\":\"MEDIUM\",\"channel\":\"in.ekstep\",\"organisation\":[\"DPS (Ghaziabad)\"],\"responseDeclaration\":\"{\\\"responseValue\\\":{\\\"cardinality\\\":\\\"single\\\",\\\"type\\\":\\\"string\\\",\\\"correct_response\\\":{\\\"value\\\":\\\"Anwser Data\\\"}}}\",\"language\":[\"English\"],\"program\":\"CBSE\",\"templateId\":\"NA\",\"type\":\"reference\",\"createdOn\":\"2020-01-16T12:22:41.396+0530\",\"version\":3,\"versionKey\":\"1579157561396\",\"framework\":\"NCF\",\"options\":\"[{\\\"value\\\":{\\\"type\\\":\\\"text\\\",\\\"asset\\\":\\\"12&10\\\"}},{\\\"value\\\":{\\\"type\\\":\\\"text\\\",\\\"asset\\\":\\\"14&7\\\"}},{\\\"value\\\":{\\\"type\\\":\\\"mixed\\\",\\\"text\\\":\\\"16&8\\\",\\\"image\\\":\\\"image1\\\",\\\"audio\\\":\\\"audio1\\\"}},{\\\"value\\\":{\\\"type\\\":\\\"mixed\\\",\\\"image\\\":\\\"image2\\\",\\\"audio\\\":\\\"audio2\\\"},\\\"answer\\\":true}]\",\"name\":\"MCQ_ekstep_ncert_k-12\",\"lastUpdatedOn\":\"2020-01-16T12:22:41.396+0530\",\"category\":\"CuriosityQuestion\",\"programId\":\"31ab2990-7892-11e9-8a02-93c5c62c03f1\",\"status\":\"Live\"},\"outRelations\":[],\"inRelations\":[{\"id\":824422,\"graphId\":\"domain\",\"relationType\":\"hasSequenceMember\",\"startNodeId\":\"do_11293646884701798412\",\"endNodeId\":\"do_11293645874324275213\",\"startNodeName\":\"Question Paper\",\"endNodeName\":\"MCQ_ekstep_ncert_k-12\",\"startNodeType\":\"DATA_NODE\",\"endNodeType\":\"DATA_NODE\",\"startNodeObjectType\":\"ItemSet\",\"endNodeObjectType\":\"AssessmentItem\",\"metadata\":{\"IL_SEQUENCE_INDEX\":3},\"startNodeMetadata\":{\"lastStatusChangedOn\":\"2020-01-16T15:44:59.863+0530\",\"code\":\"question\",\"previewUrl\":\"https: Node do_11293645874324275213Node = mapper.readValue(do_11293645874324275213NodeString, Node.class); String do_11293645447181107211NodeString = "{\"id\":986984,\"graphId\":\"domain\",\"identifier\":\"do_11293645447181107211\",\"nodeType\":\"DATA_NODE\",\"objectType\":\"AssessmentItem\",\"metadata\":{\"itemType\":\"UNIT\",\"creator\":\"contentcreator\",\"lastStatusChangedOn\":\"2020-01-16T12:13:59.816+0530\",\"code\":\"5ea97a7b-cad7-4655-ae97-721a9a6bfeca\",\"qumlVersion\":0.5,\"qlevel\":\"MEDIUM\",\"channel\":\"in.ekstep\",\"organisation\":[\"DPS (Ghaziabad)\"],\"responseDeclaration\":\"{\\\"responseValue\\\":{\\\"cardinality\\\":\\\"single\\\",\\\"type\\\":\\\"integer\\\",\\\"correct_response\\\":{\\\"value\\\":\\\"1\\\"}}}\",\"language\":[\"English\"],\"program\":\"CBSE\",\"templateId\":\"mcq-vertical\",\"type\":\"mcq\",\"createdOn\":\"2020-01-16T12:13:59.816+0530\",\"version\":3,\"versionKey\":\"1579157039816\",\"framework\":\"NCF\",\"options\":\"[{\\\"value\\\":{\\\"type\\\":\\\"text\\\",\\\"asset\\\":\\\"12&10\\\",\\\"resvalue\\\":0,\\\"resindex\\\":0}},{\\\"value\\\":{\\\"type\\\":\\\"text\\\",\\\"asset\\\":\\\"14&7\\\",\\\"resvalue\\\":1,\\\"resindex\\\":1}},{\\\"value\\\":{\\\"type\\\":\\\"mixed\\\",\\\"text\\\":\\\"16&8\\\",\\\"image\\\":\\\"image1\\\",\\\"audio\\\":\\\"audio1\\\",\\\"resvalue\\\":\\\"16&8\\\",\\\"resindex\\\":2}},{\\\"value\\\":{\\\"type\\\":\\\"mixed\\\",\\\"image\\\":\\\"image2\\\",\\\"audio\\\":\\\"audio2\\\",\\\"resvalue\\\":3,\\\"resindex\\\":3},\\\"answer\\\":true}]\",\"name\":\"MCQ_ekstep_ncert_k-12\",\"lastUpdatedOn\":\"2020-01-16T12:13:59.816+0530\",\"category\":\"MCQ\",\"programId\":\"31ab2990-7892-11e9-8a02-93c5c62c03f1\",\"status\":\"Live\"},\"outRelations\":[],\"inRelations\":[{\"id\":824420,\"graphId\":\"domain\",\"relationType\":\"hasSequenceMember\",\"startNodeId\":\"do_11293646884701798412\",\"endNodeId\":\"do_11293645447181107211\",\"startNodeName\":\"Question Paper\",\"endNodeName\":\"MCQ_ekstep_ncert_k-12\",\"startNodeType\":\"DATA_NODE\",\"endNodeType\":\"DATA_NODE\",\"startNodeObjectType\":\"ItemSet\",\"endNodeObjectType\":\"AssessmentItem\",\"metadata\":{\"IL_SEQUENCE_INDEX\":1},\"startNodeMetadata\":{\"lastStatusChangedOn\":\"2020-01-16T15:44:59.863+0530\",\"code\":\"question\",\"previewUrl\":\"https: Node do_11293645447181107211Node = mapper.readValue(do_11293645447181107211NodeString, Node.class); String do_11293645469885235212NodeString = "{\"id\":986985,\"graphId\":\"domain\",\"identifier\":\"do_11293645469885235212\",\"nodeType\":\"DATA_NODE\",\"objectType\":\"AssessmentItem\",\"metadata\":{\"itemType\":\"UNIT\",\"creator\":\"contentcreator\",\"lastStatusChangedOn\":\"2020-01-16T12:14:27.725+0530\",\"code\":\"5ea97a7b-cad7-4655-ae97-721a9a6bfeca\",\"qumlVersion\":0.5,\"qlevel\":\"MEDIUM\",\"channel\":\"in.ekstep\",\"organisation\":[\"DPS (Ghaziabad)\"],\"responseDeclaration\":\"{\\\"responseValue\\\":{\\\"cardinality\\\":\\\"single\\\",\\\"type\\\":\\\"integer\\\",\\\"correct_response\\\":{\\\"value\\\":\\\"1\\\"}}}\",\"language\":[\"English\"],\"program\":\"CBSE\",\"templateId\":\"mcq-vertical\",\"type\":\"mcq\",\"createdOn\":\"2020-01-16T12:14:27.725+0530\",\"version\":3,\"versionKey\":\"1579157067725\",\"framework\":\"NCF\",\"options\":\"[{\\\"value\\\":{\\\"type\\\":\\\"text\\\",\\\"asset\\\":\\\"12&10\\\",\\\"resvalue\\\":0,\\\"resindex\\\":0}},{\\\"value\\\":{\\\"type\\\":\\\"text\\\",\\\"asset\\\":\\\"14&7\\\",\\\"resvalue\\\":1,\\\"resindex\\\":1}},{\\\"value\\\":{\\\"type\\\":\\\"mixed\\\",\\\"text\\\":\\\"16&8\\\",\\\"image\\\":\\\"image1\\\",\\\"audio\\\":\\\"audio1\\\",\\\"resvalue\\\":\\\"16&8\\\",\\\"resindex\\\":2}},{\\\"value\\\":{\\\"type\\\":\\\"mixed\\\",\\\"image\\\":\\\"image2\\\",\\\"audio\\\":\\\"audio2\\\",\\\"resvalue\\\":3,\\\"resindex\\\":3},\\\"answer\\\":true}]\",\"name\":\"MCQ_ekstep_ncert_k-12\",\"lastUpdatedOn\":\"2020-01-16T12:14:27.725+0530\",\"category\":\"MCQ\",\"programId\":\"31ab2990-7892-11e9-8a02-93c5c62c03f1\",\"status\":\"Live\"},\"outRelations\":[],\"inRelations\":[{\"id\":824421,\"graphId\":\"domain\",\"relationType\":\"hasSequenceMember\",\"startNodeId\":\"do_11293646884701798412\",\"endNodeId\":\"do_11293645469885235212\",\"startNodeName\":\"Question Paper\",\"endNodeName\":\"MCQ_ekstep_ncert_k-12\",\"startNodeType\":\"DATA_NODE\",\"endNodeType\":\"DATA_NODE\",\"startNodeObjectType\":\"ItemSet\",\"endNodeObjectType\":\"AssessmentItem\",\"metadata\":{\"IL_SEQUENCE_INDEX\":2},\"startNodeMetadata\":{\"lastStatusChangedOn\":\"2020-01-16T15:44:59.863+0530\",\"code\":\"question\",\"previewUrl\":\"https: Node do_11293645469885235212Node = mapper.readValue(do_11293645469885235212NodeString, Node.class); Map<String, Object> nodeMap = new HashMap<>(); nodeMap.put("do_11293645874324275213", do_11293645874324275213Node); nodeMap.put("do_11293645447181107211", do_11293645447181107211Node); nodeMap.put("do_11293645469885235212", do_11293645469885235212Node); PowerMockito.when(QuestionPaperGeneratorUtil.getMetadataFromNeo4j(Mockito.anyList())).thenReturn(nodeMap); String externalPropMapString = "{\"do_11293645874324275213\":{\"body\":\"body Data\",\"editorstate\":\"{\\\"question\\\":\\\"question\\\",\\\"answer\\\":\\\"\\\",\\\"solutions\\\":[{\\\"id\\\":\\\"2\\\",\\\"value\\\":\\\"Solution as videoDat\\\",\\\"type\\\":\\\"html/video\\\"}]}\"},\"do_11293645447181107211\":{\"body\":\"<div class='mcq-vertical cheveron-helper'><div class='mcq-title'><p>Alpha</p></div><i class='chevron down icon'></i><div class='mcq-options'><div data-simple-choice-interaction data-response-variable='responseValue' value=0 class='mcq-option'><p>26</p></div><div data-simple-choice-interaction data-response-variable='responseValue' value=1 class='mcq-option'><p>24</p></div></div></div>\",\"editorstate\":\"{\\\"question\\\":\\\"question\\\",\\\"options\\\":[{\\\"answer\\\":false,\\\"value\\\":{\\\"type\\\":\\\"text\\\",\\\"body\\\":\\\"<p>26</p>\\\",\\\"resvalue\\\":0,\\\"resindex\\\":0}},{\\\"answer\\\":true,\\\"value\\\":{\\\"type\\\":\\\"text\\\",\\\"body\\\":\\\"<p>24</p>\\\",\\\"resvalue\\\":1,\\\"resindex\\\":1}}],\\\"solutions\\\":[{\\\"id\\\":\\\"1\\\",\\\"value\\\":\\\"Solution as videoData\\\",\\\"type\\\":\\\"html/video\\\"}]}\"},\"do_11293645469885235212\":{\"body\":\"<div class='mcq-vertical cheveron-helper'><div class='mcq-title'><p>Alpha</p></div><i class='chevron down icon'></i><div class='mcq-options'><div data-simple-choice-interaction data-response-variable='responseValue' value=0 class='mcq-option'><p>26</p></div><div data-simple-choice-interaction data-response-variable='responseValue' value=1 class='mcq-option'><p>24</p></div></div></div>\",\"editorstate\":\"{\\\"question\\\":\\\"question\\\",\\\"options\\\":[{\\\"answer\\\":false,\\\"value\\\":{\\\"type\\\":\\\"text\\\",\\\"body\\\":\\\"<p>26</p>\\\",\\\"resvalue\\\":0,\\\"resindex\\\":0}},{\\\"answer\\\":true,\\\"value\\\":{\\\"type\\\":\\\"text\\\",\\\"body\\\":\\\"<p>24</p>\\\",\\\"resvalue\\\":1,\\\"resindex\\\":1}}],\\\"solutions\\\":[{\\\"id\\\":\\\"1\\\",\\\"value\\\":\\\"Solution as videoData\\\",\\\"type\\\":\\\"html/video\\\"}]}\"}}"; Map<String, Object> externalPropMap = mapper.readValue(externalPropMapString, Map.class); PowerMockito.when(QuestionPaperGeneratorUtil.getExternalPropsData(Mockito.anyList())).thenReturn(externalPropMap); String childDataString = "{\"do_11293645874324275213\":3,\"do_11293645447181107211\":1,\"do_11293645469885235212\":2}"; Map<String, Object> childData = mapper.readValue(childDataString, Map.class); Map<String, Object> assessmentMap = QuestionPaperGenerator.getAssessmentDataMap(childData); Assert.assertNotNull(assessmentMap); System.out.println(assessmentMap); }
public static Map<String, Object> getAssessmentDataMap(Map<String, Object> childData) throws JsonParseException, JsonMappingException, IOException { List<String> identifiers = new ArrayList<>(childData.keySet()); Map<String, Object> nodeMap = QuestionPaperGeneratorUtil.getMetadataFromNeo4j(identifiers); Map<String, Object> externalPropMap = QuestionPaperGeneratorUtil.getExternalPropsData(identifiers); if (MapUtils.isNotEmpty(nodeMap) && MapUtils.isNotEmpty(externalPropMap)) { Map<String, Object> assessmentMap = new HashMap<>(externalPropMap); for(String id : assessmentMap.keySet()) { String type = ((String)((Node)nodeMap.get(id)).getMetadata().get("type")); Map<String, Object> editorState = mapper.readValue((String)((Map<String, Object>) externalPropMap.get(id)).get("editorstate"), new TypeReference<Map<String, Object>>(){}); String answer = null; if(StringUtils.isNotBlank((String)((Node)nodeMap.get(id)).getMetadata().get("responseDeclaration"))) { Map<String, Object> answerMap = mapper.readValue((String)((Node)nodeMap.get(id)).getMetadata().get("responseDeclaration"), new TypeReference<Map<String, Object>>(){}); answer = (String) ((Map<String, Object>) ((Map<String, Object>) answerMap. getOrDefault("responseValue", new HashMap<String, Object>())). getOrDefault("correct_response", new HashMap<String, Object>())). getOrDefault("value", null); } if(StringUtils.equalsIgnoreCase(type, "mcq") && MapUtils.isNotEmpty(editorState)) { if(StringUtils.isNoneBlank(answer)) { ((Map<String, Object>)assessmentMap.get(id)).put(ANSWER, ((Map<String, Object>) ((Map<String, Object>) ((List<Map<String, Object>>)editorState.get("options")). get(Integer.parseInt(answer))). getOrDefault("value", new HashMap<String, Object>())). getOrDefault("body", "")); }else { ((Map<String, Object>)assessmentMap.get(id)).put(ANSWER, ""); } }else { ((Map<String, Object>)assessmentMap.get(id)).put(ANSWER, null != answer ? answer : ""); } ((Map<String, Object>)assessmentMap.get(id)).put(TYPE, type); ((Map<String, Object>)assessmentMap.get(id)).put(INDEX, childData.get(id)); } return assessmentMap; } TelemetryManager.error("Question Paper not generated because : typeMap and/or bodyMap is null."); return null; }
QuestionPaperGenerator { public static Map<String, Object> getAssessmentDataMap(Map<String, Object> childData) throws JsonParseException, JsonMappingException, IOException { List<String> identifiers = new ArrayList<>(childData.keySet()); Map<String, Object> nodeMap = QuestionPaperGeneratorUtil.getMetadataFromNeo4j(identifiers); Map<String, Object> externalPropMap = QuestionPaperGeneratorUtil.getExternalPropsData(identifiers); if (MapUtils.isNotEmpty(nodeMap) && MapUtils.isNotEmpty(externalPropMap)) { Map<String, Object> assessmentMap = new HashMap<>(externalPropMap); for(String id : assessmentMap.keySet()) { String type = ((String)((Node)nodeMap.get(id)).getMetadata().get("type")); Map<String, Object> editorState = mapper.readValue((String)((Map<String, Object>) externalPropMap.get(id)).get("editorstate"), new TypeReference<Map<String, Object>>(){}); String answer = null; if(StringUtils.isNotBlank((String)((Node)nodeMap.get(id)).getMetadata().get("responseDeclaration"))) { Map<String, Object> answerMap = mapper.readValue((String)((Node)nodeMap.get(id)).getMetadata().get("responseDeclaration"), new TypeReference<Map<String, Object>>(){}); answer = (String) ((Map<String, Object>) ((Map<String, Object>) answerMap. getOrDefault("responseValue", new HashMap<String, Object>())). getOrDefault("correct_response", new HashMap<String, Object>())). getOrDefault("value", null); } if(StringUtils.equalsIgnoreCase(type, "mcq") && MapUtils.isNotEmpty(editorState)) { if(StringUtils.isNoneBlank(answer)) { ((Map<String, Object>)assessmentMap.get(id)).put(ANSWER, ((Map<String, Object>) ((Map<String, Object>) ((List<Map<String, Object>>)editorState.get("options")). get(Integer.parseInt(answer))). getOrDefault("value", new HashMap<String, Object>())). getOrDefault("body", "")); }else { ((Map<String, Object>)assessmentMap.get(id)).put(ANSWER, ""); } }else { ((Map<String, Object>)assessmentMap.get(id)).put(ANSWER, null != answer ? answer : ""); } ((Map<String, Object>)assessmentMap.get(id)).put(TYPE, type); ((Map<String, Object>)assessmentMap.get(id)).put(INDEX, childData.get(id)); } return assessmentMap; } TelemetryManager.error("Question Paper not generated because : typeMap and/or bodyMap is null."); return null; } }
QuestionPaperGenerator { public static Map<String, Object> getAssessmentDataMap(Map<String, Object> childData) throws JsonParseException, JsonMappingException, IOException { List<String> identifiers = new ArrayList<>(childData.keySet()); Map<String, Object> nodeMap = QuestionPaperGeneratorUtil.getMetadataFromNeo4j(identifiers); Map<String, Object> externalPropMap = QuestionPaperGeneratorUtil.getExternalPropsData(identifiers); if (MapUtils.isNotEmpty(nodeMap) && MapUtils.isNotEmpty(externalPropMap)) { Map<String, Object> assessmentMap = new HashMap<>(externalPropMap); for(String id : assessmentMap.keySet()) { String type = ((String)((Node)nodeMap.get(id)).getMetadata().get("type")); Map<String, Object> editorState = mapper.readValue((String)((Map<String, Object>) externalPropMap.get(id)).get("editorstate"), new TypeReference<Map<String, Object>>(){}); String answer = null; if(StringUtils.isNotBlank((String)((Node)nodeMap.get(id)).getMetadata().get("responseDeclaration"))) { Map<String, Object> answerMap = mapper.readValue((String)((Node)nodeMap.get(id)).getMetadata().get("responseDeclaration"), new TypeReference<Map<String, Object>>(){}); answer = (String) ((Map<String, Object>) ((Map<String, Object>) answerMap. getOrDefault("responseValue", new HashMap<String, Object>())). getOrDefault("correct_response", new HashMap<String, Object>())). getOrDefault("value", null); } if(StringUtils.equalsIgnoreCase(type, "mcq") && MapUtils.isNotEmpty(editorState)) { if(StringUtils.isNoneBlank(answer)) { ((Map<String, Object>)assessmentMap.get(id)).put(ANSWER, ((Map<String, Object>) ((Map<String, Object>) ((List<Map<String, Object>>)editorState.get("options")). get(Integer.parseInt(answer))). getOrDefault("value", new HashMap<String, Object>())). getOrDefault("body", "")); }else { ((Map<String, Object>)assessmentMap.get(id)).put(ANSWER, ""); } }else { ((Map<String, Object>)assessmentMap.get(id)).put(ANSWER, null != answer ? answer : ""); } ((Map<String, Object>)assessmentMap.get(id)).put(TYPE, type); ((Map<String, Object>)assessmentMap.get(id)).put(INDEX, childData.get(id)); } return assessmentMap; } TelemetryManager.error("Question Paper not generated because : typeMap and/or bodyMap is null."); return null; }  }
QuestionPaperGenerator { public static Map<String, Object> getAssessmentDataMap(Map<String, Object> childData) throws JsonParseException, JsonMappingException, IOException { List<String> identifiers = new ArrayList<>(childData.keySet()); Map<String, Object> nodeMap = QuestionPaperGeneratorUtil.getMetadataFromNeo4j(identifiers); Map<String, Object> externalPropMap = QuestionPaperGeneratorUtil.getExternalPropsData(identifiers); if (MapUtils.isNotEmpty(nodeMap) && MapUtils.isNotEmpty(externalPropMap)) { Map<String, Object> assessmentMap = new HashMap<>(externalPropMap); for(String id : assessmentMap.keySet()) { String type = ((String)((Node)nodeMap.get(id)).getMetadata().get("type")); Map<String, Object> editorState = mapper.readValue((String)((Map<String, Object>) externalPropMap.get(id)).get("editorstate"), new TypeReference<Map<String, Object>>(){}); String answer = null; if(StringUtils.isNotBlank((String)((Node)nodeMap.get(id)).getMetadata().get("responseDeclaration"))) { Map<String, Object> answerMap = mapper.readValue((String)((Node)nodeMap.get(id)).getMetadata().get("responseDeclaration"), new TypeReference<Map<String, Object>>(){}); answer = (String) ((Map<String, Object>) ((Map<String, Object>) answerMap. getOrDefault("responseValue", new HashMap<String, Object>())). getOrDefault("correct_response", new HashMap<String, Object>())). getOrDefault("value", null); } if(StringUtils.equalsIgnoreCase(type, "mcq") && MapUtils.isNotEmpty(editorState)) { if(StringUtils.isNoneBlank(answer)) { ((Map<String, Object>)assessmentMap.get(id)).put(ANSWER, ((Map<String, Object>) ((Map<String, Object>) ((List<Map<String, Object>>)editorState.get("options")). get(Integer.parseInt(answer))). getOrDefault("value", new HashMap<String, Object>())). getOrDefault("body", "")); }else { ((Map<String, Object>)assessmentMap.get(id)).put(ANSWER, ""); } }else { ((Map<String, Object>)assessmentMap.get(id)).put(ANSWER, null != answer ? answer : ""); } ((Map<String, Object>)assessmentMap.get(id)).put(TYPE, type); ((Map<String, Object>)assessmentMap.get(id)).put(INDEX, childData.get(id)); } return assessmentMap; } TelemetryManager.error("Question Paper not generated because : typeMap and/or bodyMap is null."); return null; }  static File generateQuestionPaper(Node node); static Map<String, Object> fetchChildDetails(Node node); static Map<String, Object> getAssessmentDataMap(Map<String, Object> childData); static String getFileName(String prefix); }
QuestionPaperGenerator { public static Map<String, Object> getAssessmentDataMap(Map<String, Object> childData) throws JsonParseException, JsonMappingException, IOException { List<String> identifiers = new ArrayList<>(childData.keySet()); Map<String, Object> nodeMap = QuestionPaperGeneratorUtil.getMetadataFromNeo4j(identifiers); Map<String, Object> externalPropMap = QuestionPaperGeneratorUtil.getExternalPropsData(identifiers); if (MapUtils.isNotEmpty(nodeMap) && MapUtils.isNotEmpty(externalPropMap)) { Map<String, Object> assessmentMap = new HashMap<>(externalPropMap); for(String id : assessmentMap.keySet()) { String type = ((String)((Node)nodeMap.get(id)).getMetadata().get("type")); Map<String, Object> editorState = mapper.readValue((String)((Map<String, Object>) externalPropMap.get(id)).get("editorstate"), new TypeReference<Map<String, Object>>(){}); String answer = null; if(StringUtils.isNotBlank((String)((Node)nodeMap.get(id)).getMetadata().get("responseDeclaration"))) { Map<String, Object> answerMap = mapper.readValue((String)((Node)nodeMap.get(id)).getMetadata().get("responseDeclaration"), new TypeReference<Map<String, Object>>(){}); answer = (String) ((Map<String, Object>) ((Map<String, Object>) answerMap. getOrDefault("responseValue", new HashMap<String, Object>())). getOrDefault("correct_response", new HashMap<String, Object>())). getOrDefault("value", null); } if(StringUtils.equalsIgnoreCase(type, "mcq") && MapUtils.isNotEmpty(editorState)) { if(StringUtils.isNoneBlank(answer)) { ((Map<String, Object>)assessmentMap.get(id)).put(ANSWER, ((Map<String, Object>) ((Map<String, Object>) ((List<Map<String, Object>>)editorState.get("options")). get(Integer.parseInt(answer))). getOrDefault("value", new HashMap<String, Object>())). getOrDefault("body", "")); }else { ((Map<String, Object>)assessmentMap.get(id)).put(ANSWER, ""); } }else { ((Map<String, Object>)assessmentMap.get(id)).put(ANSWER, null != answer ? answer : ""); } ((Map<String, Object>)assessmentMap.get(id)).put(TYPE, type); ((Map<String, Object>)assessmentMap.get(id)).put(INDEX, childData.get(id)); } return assessmentMap; } TelemetryManager.error("Question Paper not generated because : typeMap and/or bodyMap is null."); return null; }  static File generateQuestionPaper(Node node); static Map<String, Object> fetchChildDetails(Node node); static Map<String, Object> getAssessmentDataMap(Map<String, Object> childData); static String getFileName(String prefix);  }