agave-systems/systems-core/src/main/java/org/iplantc/service/transfer/model/enumerations/PermissionType.java
/**
	 * Mergest the newPermission with the current one, maintaining the ability of both. If {@link #NONE} is provided,
	 * no change will be made.
	 * @return combination of the two permission values.
	 */
Mergest the newPermission with the current one, maintaining the ability of both. If  #NONE is provided,
no change will be made.
@return combination of the two permission values.
Mergest the newPermission with the current one maintaining the ability of both . If #NONE is provided no change will be made . @return combination of the two permission values .
public PermissionType add(PermissionType newPermission)
	{
		if (newPermission.equals(this)) 
		{
			return newPermission;
		} 
		else if (newPermission.equals(OWNER) || this.equals(OWNER)) 
		{
			return OWNER;
		}
		else if (newPermission.equals(ALL) || this.equals(ALL)) 
		{
			return ALL;
		} 
		else if (newPermission.canRead() && newPermission.canWrite())
		{
			if (canExecute()) 
				return ALL;
			else 
				return READ_WRITE;
		} 
		else if (newPermission.canRead() && newPermission.canExecute())
		{	
			if (canWrite()) 
				return ALL;
			else 
				return READ_EXECUTE;
		}	
		else if (newPermission.canWrite() && newPermission.canExecute())
		{	
			if (canRead()) 
				return ALL;
			else 
				return READ_WRITE;
		}
		else if (newPermission.canRead())
		{	
			if (canWrite() && canExecute()) 
				return ALL;
			else if (canWrite())
				return READ_WRITE;
			else if (canExecute())
				return READ_EXECUTE;
			else 
				return READ;
		}
		else if (newPermission.canWrite())
		{	
			if (canRead() && canExecute()) 
				return ALL;
			else if (canRead())
				return READ_WRITE;
			else if (canExecute())
				return WRITE_EXECUTE;
			else 
				return WRITE;
		}
		else if (newPermission.canExecute())
		{	
			if (canRead() && canWrite()) 
				return ALL;
			else if (canRead())
				return READ_EXECUTE;
			else if (canWrite())
				return WRITE_EXECUTE;
			else
				return EXECUTE;
		}
		else {
			return this;
		}
	}
public PermissionType add ( PermissionType newPermission ) { if ( newPermission . equals ( this ) ) { return newPermission ; } else if ( newPermission . equals ( OWNER ) || this . equals ( OWNER ) ) { return OWNER ; } else if ( newPermission . equals ( ALL ) || this . equals ( ALL ) ) { return ALL ; } else if ( newPermission . canRead ( ) && newPermission . canWrite ( ) ) { if ( canExecute ( ) ) return ALL ; else return READ_WRITE ; } else if ( newPermission . canRead ( ) && newPermission . canExecute ( ) ) { if ( canWrite ( ) ) return ALL ; else return READ_EXECUTE ; } else if ( newPermission . canWrite ( ) && newPermission . canExecute ( ) ) { if ( canRead ( ) ) return ALL ; else return READ_WRITE ; } else if ( newPermission . canRead ( ) ) { if ( canWrite ( ) && canExecute ( ) ) return ALL ; else if ( canWrite ( ) ) return READ_WRITE ; else if ( canExecute ( ) ) return READ_EXECUTE ; else return READ ; } else if ( newPermission . canWrite ( ) ) { if ( canRead ( ) && canExecute ( ) ) return ALL ; else if ( canRead ( ) ) return READ_WRITE ; else if ( canExecute ( ) ) return WRITE_EXECUTE ; else return WRITE ; } else if ( newPermission . canExecute ( ) ) { if ( canRead ( ) && canWrite ( ) ) return ALL ; else if ( canRead ( ) ) return READ_EXECUTE ; else if ( canWrite ( ) ) return WRITE_EXECUTE ; else return EXECUTE ; } else { return this ; } }
Mergest the newPermission with the current one, maintaining the ability of both.
Mergest the newPermission with the current one maintaining the ability of both .