agave-metadata/metadata-core/src/main/java/org/iplantc/service/metadata/managers/MetadataRequestPermissionProcessor.java
/**
	 * @deprecated duplicate of MetadataRequestPermissionProcessor.process()
	 * @param json
	 * @throws MetadataException
	 */
@deprecated duplicate of MetadataRequestPermissionProcessor.process()
@param json
@throws MetadataException
@deprecated duplicate of MetadataRequestPermissionProcessor . process () @param json @throws MetadataException
public void processToCollection(ArrayNode json) throws MetadataException {
		getMetadataItem().getPermissions().clear();
		if (json == null || json.isNull()) {
			return;
		}
		else
		{
			for (int i=0; i<json.size(); i++)
			{
				JsonNode jsonPermission = json.get(i);
				if (!jsonPermission.isObject())
				{
					throw new MetadataException("Invalid permissions["+i+"] value given. "
							+ "Each permission objects should specify a "
							+ "valid username and permission.");
				}
				else
				{
					try {
						String pemUsername = jsonPermission.hasNonNull("username") ? jsonPermission.get("username").asText() : null;
						String pemName = jsonPermission.hasNonNull("permission") ? jsonPermission.get("permission").asText().toUpperCase() : null;
						PermissionType permissionType = PermissionType.getIfPresent(pemName);
						getMetadataItem().getPermissions().add(new MetadataPermission(pemUsername, permissionType));
					}
					catch (MetadataException e) {
						throw e;
					}
					catch (Throwable e) {
						throw new MetadataException("Unable to process metadata permission["+i+"].", e);
					}
				}
			}
		}
	}
public void processToCollection ( ArrayNode json ) throws MetadataException { getMetadataItem ( ) . getPermissions ( ) . clear ( ) ; if ( json == null || json . isNull ( ) ) { return ; } else { for ( int i = 0 ; i < json . size ( ) ; i ++ ) { JsonNode jsonPermission = json . get ( i ) ; if ( ! jsonPermission . isObject ( ) ) { throw new MetadataException ( "Invalid permissions[" + i + "] value given. " + "Each permission objects should specify a " + "valid username and permission." ) ; } else { try { String pemUsername = jsonPermission . hasNonNull ( "username" ) ? jsonPermission . get ( "username" ) . asText ( ) : null ; String pemName = jsonPermission . hasNonNull ( "permission" ) ? jsonPermission . get ( "permission" ) . asText ( ) . toUpperCase ( ) : null ; PermissionType permissionType = PermissionType . getIfPresent ( pemName ) ; getMetadataItem ( ) . getPermissions ( ) . add ( new MetadataPermission ( pemUsername , permissionType ) ) ; } catch ( MetadataException e ) { throw e ; } catch ( Throwable e ) { throw new MetadataException ( "Unable to process metadata permission[" + i + "]." , e ) ; } } } } }
@deprecated duplicate of MetadataRequestPermissionProcessor.process()
 @param json
 @throws MetadataException
@deprecated duplicate of MetadataRequestPermissionProcessor . process () @param json @throws MetadataException
// ignore the null value // here we reuse the validation built into the {@link MetadataPermissionManager} // to validate the embedded {@link MetadataPermission}. // extract the username and permission from the json node. we leave validation up // to the manager class.