Video_Storage_Service/src/com/fincons/videostorage/restlet/NodeResources.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
private JSONArray createListElement(JSONArray folderContent, String path) {
		JSONArray list = null;
		try {
			list = new JSONArray();
			logger.debug("Get content of the folder requested");
			folderContent=(folderContent==null)? new JSONArray():folderContent;
			for (int i = 0; i < folderContent.length(); i++) {
				JSONObject dataObj = folderContent.optJSONObject(i);
				JSONObject temp = new JSONObject();
				if (dataObj.optString(ConstantsDB.CLASS_NODE).equalsIgnoreCase(ConstantsDB.DIRECTORY_CLASS)) {
					String name= dataObj.optString("name");
					String fullPath = path+"/"+name;
					if(fullPath.startsWith("//")){
						fullPath = fullPath.replaceFirst("//", "");
					} else if(fullPath.startsWith("/")){
						fullPath = fullPath.replaceFirst("/", "");
					}
					temp.put(Constants.NAME_VIDEO, name);
					temp.put("URLDir", fullPath); 
				} else if (dataObj.optString(ConstantsDB.CLASS_NODE).equalsIgnoreCase(ConstantsDB.VIDEO_CLASS)) {
					String name= dataObj.optString("name");
					String fullPath = path+"/"+name;
					if(fullPath.startsWith("//")){
						fullPath = fullPath.replaceFirst("//", "");
					} else if(fullPath.startsWith("/")){
						fullPath = fullPath.replaceFirst("/", "");
					}
					temp.put(Constants.NAME_VIDEO, name);
					temp.put("URLVideo", fullPath); 
				}
				list.put(temp);
			}
		} catch (JSONException e) {
			logger.error("JSON Exception " + e.getMessage());
			return list;
		}
		return list;
	}
private JSONArray createListElement ( JSONArray folderContent , String path ) { JSONArray list = null ; try { list = new JSONArray ( ) ; logger . debug ( "Get content of the folder requested" ) ; folderContent = ( folderContent == null ) ? new JSONArray ( ) : folderContent ; for ( int i = 0 ; i < folderContent . length ( ) ; i ++ ) { JSONObject dataObj = folderContent . optJSONObject ( i ) ; JSONObject temp = new JSONObject ( ) ; if ( dataObj . optString ( ConstantsDB . CLASS_NODE ) . equalsIgnoreCase ( ConstantsDB . DIRECTORY_CLASS ) ) { String name = dataObj . optString ( "name" ) ; String fullPath = path + "/" + name ; if ( fullPath . startsWith ( "//" ) ) { fullPath = fullPath . replaceFirst ( "//" , "" ) ; } else if ( fullPath . startsWith ( "/" ) ) { fullPath = fullPath . replaceFirst ( "/" , "" ) ; } temp . put ( Constants . NAME_VIDEO , name ) ; temp . put ( "URLDir" , fullPath ) ; } else if ( dataObj . optString ( ConstantsDB . CLASS_NODE ) . equalsIgnoreCase ( ConstantsDB . VIDEO_CLASS ) ) { String name = dataObj . optString ( "name" ) ; String fullPath = path + "/" + name ; if ( fullPath . startsWith ( "//" ) ) { fullPath = fullPath . replaceFirst ( "//" , "" ) ; } else if ( fullPath . startsWith ( "/" ) ) { fullPath = fullPath . replaceFirst ( "/" , "" ) ; } temp . put ( Constants . NAME_VIDEO , name ) ; temp . put ( "URLVideo" , fullPath ) ; } 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 .
//(path+"/"+name).replace("//", "") //					String nameShowed= dataObj.optString("fm_filename"); //(path+"/"+name).replace("//", "")