agave-apps/apps-core/src/main/java/org/iplantc/service/apps/util/ServiceUtils.java
/**
	 * Determines if a JsonNode represents a boolean value. We need this
	 * method due to our support for form submissions where numbers are
	 * serialized to integers.
	 * 
	 * @param jsonNode
	 * @return true if the JsonNode is a JSON boolean primary type, JSON integer primary 
	 * type with value 0 or 1, or a string with value equal to 0, 1, true, or false.
	 */
Determines if a JsonNode represents a boolean value. We need this
method due to our support for form submissions where numbers are
serialized to integers.

@param jsonNode
@return true if the JsonNode is a JSON boolean primary type, JSON integer primary
type with value 0 or 1, or a string with value equal to 0, 1, true, or false.
Determines if a JsonNode represents a boolean value . We need this method due to our support for form submissions where numbers are serialized to integers . @param jsonNode @return true if the JsonNode is a JSON boolean primary type JSON integer primary type with value 0 or 1 or a string with value equal to 0 1 true or false .
public static boolean isBooleanOrNumericBoolean(JsonNode jsonNode)
	{
		if (jsonNode.isBoolean()) 
		{
			return true;
		}
		else if (jsonNode.isIntegralNumber())
		{
			return jsonNode.asInt() == 1 || jsonNode.asInt() == 0;
		}
		else if (jsonNode.isTextual()) 
		{
			 return StringUtils.equals(jsonNode.asText(), "1") ||
					 StringUtils.equals(jsonNode.asText(), "0") || 
					 StringUtils.equals(jsonNode.asText(), "true") ||
					 StringUtils.equals(jsonNode.asText(), "false");
		}
		else
		{
			return false;
		}
	}
public static boolean isBooleanOrNumericBoolean ( JsonNode jsonNode ) { if ( jsonNode . isBoolean ( ) ) { return true ; } else if ( jsonNode . isIntegralNumber ( ) ) { return jsonNode . asInt ( ) == 1 || jsonNode . asInt ( ) == 0 ; } else if ( jsonNode . isTextual ( ) ) { return StringUtils . equals ( jsonNode . asText ( ) , "1" ) || StringUtils . equals ( jsonNode . asText ( ) , "0" ) || StringUtils . equals ( jsonNode . asText ( ) , "true" ) || StringUtils . equals ( jsonNode . asText ( ) , "false" ) ; } else { return false ; } }
Determines if a JsonNode represents a boolean value.
Determines if a JsonNode represents a boolean value .