Policies_Storage_Service/src/com/fincons/policiesstorage/restlet/DBPolicyConnection.java
/**
	 * Creates a list in JSON format with the elements inside the folder
	 * parameter. This method takes the JSON Object with the informations about
	 * the content of an OrientDB node and extract a list of elements in JSON
	 * Array format.
	 * 
	 * @param folderContent
	 *            The JSON Object result of the query.
	 * @return JSON Array with the elements contained in the folder node
	 */
Creates a list in JSON format with the elements inside the folder
parameter. This method takes the JSON Object with the informations about
the content of an OrientDB node and extract a list of elements in JSON
Array format.

@param folderContent
The JSON Object result of the query.
@return JSON Array with the elements contained in the folder node
Creates a list in JSON format with the elements inside the folder parameter . This method takes the JSON Object with the informations about the content of an OrientDB node and extract a list of elements in JSON Array format . @param folderContent The JSON Object result of the query . @return JSON Array with the elements contained in the folder node
public JSONArray createListElement(JSONObject folderContent, String path) {
		JSONArray list = null;
		try {
			list = new JSONArray();
			logger.debug("Get content of the folder requested");
			JSONArray contentList = folderContent.getJSONArray("data");
			for (int i = 0; i < contentList.length(); i++) {
				JSONObject dataObj = contentList.getJSONObject(i);
				JSONObject temp = new JSONObject();
				temp.put("namePolicy", dataObj.optString("name"));
				String name = dataObj.optString(Constants.NAME_NODE);
				String fullPath = path + "/" + name;
				if (fullPath.startsWith("//")) {
					fullPath = fullPath.replaceFirst("//", "");
				} else if (fullPath.startsWith("/")) {
					fullPath = fullPath.replaceFirst("/", "");
				}
				if (dataObj.optString(Constants.CLASS_NODE).equalsIgnoreCase(Constants.DIRECTORY_CLASS)) {
					temp.put("URLDir", fullPath); 
				} else if (dataObj.optString(Constants.CLASS_NODE).equalsIgnoreCase(Constants.POLICY_CLASS)) {
					temp.put("URLPolicy", fullPath); 
					temp.put("xmlPolicy", dataObj.optString("blockly_xml"));
				}
				list.put(temp);
			}
		} catch (JSONException e) {
			logger.error("JSON Exception " + e.getMessage());
			return list;
		}
		return list;
	}
public JSONArray createListElement ( JSONObject folderContent , String path ) { JSONArray list = null ; try { list = new JSONArray ( ) ; logger . debug ( "Get content of the folder requested" ) ; JSONArray contentList = folderContent . getJSONArray ( "data" ) ; for ( int i = 0 ; i < contentList . length ( ) ; i ++ ) { JSONObject dataObj = contentList . getJSONObject ( i ) ; JSONObject temp = new JSONObject ( ) ; temp . put ( "namePolicy" , dataObj . optString ( "name" ) ) ; String name = dataObj . optString ( Constants . NAME_NODE ) ; String fullPath = path + "/" + name ; if ( fullPath . startsWith ( "//" ) ) { fullPath = fullPath . replaceFirst ( "//" , "" ) ; } else if ( fullPath . startsWith ( "/" ) ) { fullPath = fullPath . replaceFirst ( "/" , "" ) ; } if ( dataObj . optString ( Constants . CLASS_NODE ) . equalsIgnoreCase ( Constants . DIRECTORY_CLASS ) ) { temp . put ( "URLDir" , fullPath ) ; } else if ( dataObj . optString ( Constants . CLASS_NODE ) . equalsIgnoreCase ( Constants . POLICY_CLASS ) ) { temp . put ( "URLPolicy" , fullPath ) ; temp . put ( "xmlPolicy" , dataObj . optString ( "blockly_xml" ) ) ; } list . put ( temp ) ; } } catch ( JSONException e ) { logger . error ( "JSON Exception " + e . getMessage ( ) ) ; return list ; } return list ; }
Creates a list in JSON format with the elements inside the folder
 parameter.
Creates a list in JSON format with the elements inside the folder parameter .
// idNode = idNode.replace("#", "").replace(":", "_"); // .replaceFirst("/", // "") // .replaceFirst("/", // "")