function readResponse(response){
	var tree			= JSON.parse(response).tree;
	var treeRoot		= tree.root;	
	var questionsArray 	= null;	
	if(treeRoot.questions != null){
		questionsArray = new Array();
		for(var i = 0; i < treeRoot.questions.length; i++){
			var question = treeRoot.questions[i];
			var answersArray = null;
			if(question.answers != null){
				answersArray = new Array();
				for(var j = 0; j < question.answers.length; j++){
					var answer = question.answers[j];
					var argumentsArray = null;
					if(answer.arguments != null){
						argumentsArray = new Array();
						for(var k = 0; k < answer.arguments.length; k++){
							var arg = answer.arguments[k];
							argumentsMap.set(parseInt(arg.pubId), new Argument(parseInt(arg.pubId), arg.content, null, parseInt(arg.authorId), parseInt(answer.pubId), parseInt(arg.agree)));
							argumentsArray.push(parseInt(arg.pubId));
						}
					}
					answersMap.set(parseInt(answer.pubId), new Answer(parseInt(answer.pubId), answer.content, argumentsArray , parseInt(answer.authorId), parseInt(question.pubId)));
					answersArray.push(parseInt(answer.pubId));
				}
			}
			questionsMap.set(parseInt(question.pubId), new Question(parseInt(question.pubId), question.content, answersArray , parseInt(question.authorId), question.parent, parseInt(question.category), question.title));
			questionsArray.push(parseInt(question.pubId));
		}
	}
	if(tree.users != null){
		for(var i = 0; i < tree.users.length; i++){
			var user = tree.users[i];
			usersMap.set(parseInt(user.id), new User(user.name, user.picture));
		}
	}
	if(tree.categories != null){
		for(var i = 0; i < tree.categories.length; i++){
			var cat = tree.categories[i];
			categories.set(parseInt(cat.id), cat.name);
		}
	}
	var pub = new Publication(0, treeRoot.name, questionsArray, null, null);
	setRootNode(pub);
	draw();
	onClickOnCircle(pub);
}
/**
 * The callback function passed as parameter in the previous method
 * @param response		(String) request's response (JSON tree with all publications)
 * Parse this Tree and updates nodes
 * TODO At the moment, it's a only a sample JSON file with no updated, but if the app uses a database, the tree should be parsed
 * and used to update the tree
 */
The callback function passed as parameter in the previous method
@param response              (String) request's response (JSON tree with all publications)
Parse this Tree and updates nodes
TODO At the moment, it's a only a sample JSON file with no updated, but if the app uses a database, the tree should be parsed
and used to update the tree
The callback function passed as parameter in the previous method @param response ( String ) request ' s response ( JSON tree with all publications ) Parse this Tree and updates nodes TODO At the moment it ' s a only a sample JSON file with no updated but if the app uses a database the tree should be parsed and used to update the tree
function readResponse(response){
	var tree			= JSON.parse(response).tree;
	var treeRoot		= tree.root;	
	var questionsArray 	= null;	
	if(treeRoot.questions != null){
		questionsArray = new Array();
		for(var i = 0; i < treeRoot.questions.length; i++){
			var question = treeRoot.questions[i];
			var answersArray = null;
			if(question.answers != null){
				answersArray = new Array();
				for(var j = 0; j < question.answers.length; j++){
					var answer = question.answers[j];
					var argumentsArray = null;
					if(answer.arguments != null){
						argumentsArray = new Array();
						for(var k = 0; k < answer.arguments.length; k++){
							var arg = answer.arguments[k];
							argumentsMap.set(parseInt(arg.pubId), new Argument(parseInt(arg.pubId), arg.content, null, parseInt(arg.authorId), parseInt(answer.pubId), parseInt(arg.agree)));
							argumentsArray.push(parseInt(arg.pubId));
						}
					}
					answersMap.set(parseInt(answer.pubId), new Answer(parseInt(answer.pubId), answer.content, argumentsArray , parseInt(answer.authorId), parseInt(question.pubId)));
					answersArray.push(parseInt(answer.pubId));
				}
			}
			questionsMap.set(parseInt(question.pubId), new Question(parseInt(question.pubId), question.content, answersArray , parseInt(question.authorId), question.parent, parseInt(question.category), question.title));
			questionsArray.push(parseInt(question.pubId));
		}
	}
	if(tree.users != null){
		for(var i = 0; i < tree.users.length; i++){
			var user = tree.users[i];
			usersMap.set(parseInt(user.id), new User(user.name, user.picture));
		}
	}
	if(tree.categories != null){
		for(var i = 0; i < tree.categories.length; i++){
			var cat = tree.categories[i];
			categories.set(parseInt(cat.id), cat.name);
		}
	}
	var pub = new Publication(0, treeRoot.name, questionsArray, null, null);
	setRootNode(pub);
	draw();
	onClickOnCircle(pub);
}
function readResponse ( response ) { var tree = JSON . parse ( response ) . tree ; var treeRoot = tree . root ; var questionsArray = null ; if ( treeRoot . questions != null ) { questionsArray = new Array ( ) ; for ( var i = 0 ; i < treeRoot . questions . length ; i ++ ) { var question = treeRoot . questions [ i ] ; var answersArray = null ; if ( question . answers != null ) { answersArray = new Array ( ) ; for ( var j = 0 ; j < question . answers . length ; j ++ ) { var answer = question . answers [ j ] ; var argumentsArray = null ; if ( answer . arguments != null ) { argumentsArray = new Array ( ) ; for ( var k = 0 ; k < answer . arguments . length ; k ++ ) { var arg = answer . arguments [ k ] ; argumentsMap . set ( parseInt ( arg . pubId ) , new Argument ( parseInt ( arg . pubId ) , arg . content , null , parseInt ( arg . authorId ) , parseInt ( answer . pubId ) , parseInt ( arg . agree ) ) ) ; argumentsArray . push ( parseInt ( arg . pubId ) ) ; } } answersMap . set ( parseInt ( answer . pubId ) , new Answer ( parseInt ( answer . pubId ) , answer . content , argumentsArray , parseInt ( answer . authorId ) , parseInt ( question . pubId ) ) ) ; answersArray . push ( parseInt ( answer . pubId ) ) ; } } questionsMap . set ( parseInt ( question . pubId ) , new Question ( parseInt ( question . pubId ) , question . content , answersArray , parseInt ( question . authorId ) , question . parent , parseInt ( question . category ) , question . title ) ) ; questionsArray . push ( parseInt ( question . pubId ) ) ; } } if ( tree . users != null ) { for ( var i = 0 ; i < tree . users . length ; i ++ ) { var user = tree . users [ i ] ; usersMap . set ( parseInt ( user . id ) , new User ( user . name , user . picture ) ) ; } } if ( tree . categories != null ) { for ( var i = 0 ; i < tree . categories . length ; i ++ ) { var cat = tree . categories [ i ] ; categories . set ( parseInt ( cat . id ) , cat . name ) ; } } var pub = new Publication ( 0 , treeRoot . name , questionsArray , null , null ) ; setRootNode ( pub ) ; draw ( ) ; onClickOnCircle ( pub ) ; }
The callback function passed as parameter in the previous method
 @param response              (String) request's response (JSON tree with all publications)
 Parse this Tree and updates nodes
 TODO At the moment, it's a only a sample JSON file with no updated, but if the app uses a database, the tree should be parsed
 and used to update the tree
The callback function passed as parameter in the previous method @param response ( String ) request ' s response ( JSON tree with all publications ) Parse this Tree and updates nodes TODO At the moment it ' s a only a sample JSON file with no updated but if the app uses a database the tree should be parsed and used to update the tree