agave-files/files-core/src/main/java/org/iplantc/service/io/manager/LogicalFileManager.java
/**
	 * Validates and adds {@link Notifications} given in a serialized JSON object to a logical file. 
	 * The serialized value may be a single object or an array of objects. Objects must conform
	 * to the the same JSON Notification request format as would be passed to the Notifications API.
	 * The {@ode associationUuid} field can be omitted as it will be set to the value of
	 * {@link LogicalFile#getUuid()}.
	 * 
	 * @param logicalFile the logical file to which the notification will be associated
	 * @param sNotification a json serialized {@link Notification} object or array
	 * @return the registered {@link Notifications}.
	 * @throws NotificationException
	 */
Validates and adds  Notifications given in a serialized JSON object to a logical file.
The serialized value may be a single object or an array of objects. Objects must conform
to the the same JSON Notification request format as would be passed to the Notifications API.
The  associationUuid field can be omitted as it will be set to the value of
LogicalFile#getUuid().

@param logicalFile the logical file to which the notification will be associated
@param sNotification a json serialized  Notification object or array
@return the registered  Notifications.
Validates and adds Notifications given in a serialized JSON object to a logical file . The serialized value may be a single object or an array of objects . Objects must conform to the the same JSON Notification request format as would be passed to the Notifications API . The associationUuid field can be omitted as it will be set to the value of LogicalFile#getUuid () . @param logicalFile the logical file to which the notification will be associated @param sNotification a json serialized Notification object or array @return the registered Notifications .
public static List<Notification> addUploadNotifications(LogicalFile logicalFile, String createdBy, String sNotification) 
	throws NotificationException 
	{
		List<Notification> notifications = new ArrayList<Notification>();
		try {
			if (StringUtils.startsWithAny(sNotification,  new String[]{ "{", "[" })) {
				ObjectMapper mapper = new ObjectMapper();
				JsonNode json = mapper.readTree(sNotification);
				if (json.isTextual()) {
					notifications = addDefaultUploadNotifications(logicalFile, createdBy, json.asText());
				}
				else if (json.isArray()) {
					notifications = addUploadNotifications(logicalFile, createdBy, (ArrayNode)json);
				} else {
					notifications.add(addUploadNotification(logicalFile, createdBy, (ObjectNode)json));
				}
			}
			else {
				notifications = addDefaultUploadNotifications(logicalFile, createdBy, sNotification);
			}
			return notifications;
		} catch (NotificationException e) {
			throw e;
		} catch (IOException e) {
			throw new NotificationException("Unable to process JSON notification object", e);
		} 
	}
public static List < Notification > addUploadNotifications ( LogicalFile logicalFile , String createdBy , String sNotification ) throws NotificationException { List < Notification > notifications = new ArrayList < Notification > ( ) ; try { if ( StringUtils . startsWithAny ( sNotification , new String [ ] { "{" , "[" } ) ) { ObjectMapper mapper = new ObjectMapper ( ) ; JsonNode json = mapper . readTree ( sNotification ) ; if ( json . isTextual ( ) ) { notifications = addDefaultUploadNotifications ( logicalFile , createdBy , json . asText ( ) ) ; } else if ( json . isArray ( ) ) { notifications = addUploadNotifications ( logicalFile , createdBy , ( ArrayNode ) json ) ; } else { notifications . add ( addUploadNotification ( logicalFile , createdBy , ( ObjectNode ) json ) ) ; } } else { notifications = addDefaultUploadNotifications ( logicalFile , createdBy , sNotification ) ; } return notifications ; } catch ( NotificationException e ) { throw e ; } catch ( IOException e ) { throw new NotificationException ( "Unable to process JSON notification object" , e ) ; } }
Validates and adds {@link Notifications} given in a serialized JSON object to a logical file.
Validates and adds { @link Notifications } given in a serialized JSON object to a logical file .
//			if (ServiceUtils.isEmailAddress(sNotification)  //					|| ServiceUtils.isValidURL(sNotification)  //					|| ServiceUtils.isValidPhoneNumber(sNotification)) { //				notifications = addDefaultUploadNotifications(logicalFile, createdBy, sNotification); //			} // if they passed in a single string, we assume it was a URL and attempt to register the default set of upload // notifications to this URL. This provides legacy support when a simple callbackURL was given in the  // multipart upload request.