Skip to content

How to add an arrayList of metaData hashMaps into metaData of a parent node? #7

Answered by joffinjoy
joffinjoy asked this question in Q&A
Discussion options

You must be logged in to vote

It was a type casting error. Node.getMetadata() returns a Map of type util.Map[String, AnyRef] but I had specified util.HashMap[String, AnyRef] as the type for elements in the ArrayList. The fix would simply be to change the expected type to Map.

Like:

val children = new util.ArrayList[util.Map[String, AnyRef]]()
	children.add(getNode("Question", Q1_Id, "Slider", AssessmentConstants.VISIBILITY_PARENT, "Question1", 1234,
		"Live").getMetadata)
	children.add(getNode("Question", Q2_Id, "Slider", AssessmentConstants.VISIBILITY_DEFAULT, "Question2", 1234,
		"Live").getMetadata)



For posterity, the refactored function with the above fix would be:

def getRootNodeWithBL(rootId: String, sectionI…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by joffinjoy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant