Policies_Storage_Service/src/com/fincons/policiesstorage/restlet/DBPolicyConnection.java
/**
	 * Checks if a policy is inside a folder node.
	 * 
	 * @param father
	 *            The ID of the folder node
	 * @param nameNode
	 *            The name of the policy
	 * @return true = if one of the element inside the father node has the same
	 *         name, false = otherwise
	 */
Checks if a policy is inside a folder node.

@param father
The ID of the folder node
@param nameNode
The name of the policy
@return true = if one of the element inside the father node has the same
name, false = otherwise
Checks if a policy is inside a folder node . @param father The ID of the folder node @param nameNode The name of the policy @return true = if one of the element inside the father node has the same name false = otherwise
public boolean isValid(String father, String nameNode) {
		boolean valid = true;
		try {
			father = "#" + father.replace("_", ":");
			JSONObject content = getContent(father);
			JSONArray elementsInside = content.getJSONArray("data");
			for (int i = 0; i < elementsInside.length(); i++) {
				JSONObject temp = elementsInside.getJSONObject(i);
				String name = temp.optString(Constants.NAME_NODE);
				if (name.equalsIgnoreCase(nameNode)) {
					valid = false;
					break;
				}
			}
		} catch (JSONException e) {
			logger.error("JSON Exception " + e.getMessage());
			e.printStackTrace();
		}
		return valid;
	}
public boolean isValid ( String father , String nameNode ) { boolean valid = true ; try { father = "#" + father . replace ( "_" , ":" ) ; JSONObject content = getContent ( father ) ; JSONArray elementsInside = content . getJSONArray ( "data" ) ; for ( int i = 0 ; i < elementsInside . length ( ) ; i ++ ) { JSONObject temp = elementsInside . getJSONObject ( i ) ; String name = temp . optString ( Constants . NAME_NODE ) ; if ( name . equalsIgnoreCase ( nameNode ) ) { valid = false ; break ; } } } catch ( JSONException e ) { logger . error ( "JSON Exception " + e . getMessage ( ) ) ; e . printStackTrace ( ) ; } return valid ; }
Checks if a policy is inside a folder node.
Checks if a policy is inside a folder node .