src/org/ohmage/validator/SurveyResponseValidators.java
public static Set<FunctionPrivacyStateItem> validatePrivacyStateGroupList(
			final String list)
			throws ValidationException {
		
		if(StringUtils.isEmptyOrWhitespaceOnly(list)) {
			return Collections.emptySet();
		}
		
		String[] listArray = list.split(InputKeys.LIST_ITEM_SEPARATOR);
		int numItems = listArray.length;
		
		Set<FunctionPrivacyStateItem> result = 
			new HashSet<FunctionPrivacyStateItem>(numItems);
		
		for(int i = 0; i < listArray.length; i++) {
			String item = listArray[i];
			
			if((item != null) && 
					(! StringUtils.isEmptyOrWhitespaceOnly(item))) {
				
				try {
					result.add(FunctionPrivacyStateItem.getValue(item));
				}
				catch(IllegalArgumentException e) {
					throw new ValidationException(
							ErrorCode.SURVEY_FUNCTION_INVALID_PRIVACY_STATE_GROUP_ITEM,
							"The function grouping item is unknown.",
							e);
				}
			}
		}
		
		return result;
	}
/**
	 * Validates a list of privacy state grouping items.
	 * 
	 * @param list The list of grouping items as a string.
	 * 
	 * @return The decoded set of grouping items.
	 * 
	 * @throws ValidationException Thrown if one of the items in the list 
	 * 							   wasn't decodable.
	 */
Validates a list of privacy state grouping items.

@param list The list of grouping items as a string.

@return The decoded set of grouping items.

@throws ValidationException Thrown if one of the items in the list
wasn't decodable.
Validates a list of privacy state grouping items . @param list The list of grouping items as a string . @return The decoded set of grouping items . @throws ValidationException Thrown if one of the items in the list wasn ' t decodable .
public static Set<FunctionPrivacyStateItem> validatePrivacyStateGroupList(
			final String list)
			throws ValidationException {
		if(StringUtils.isEmptyOrWhitespaceOnly(list)) {
			return Collections.emptySet();
		}
		String[] listArray = list.split(InputKeys.LIST_ITEM_SEPARATOR);
		int numItems = listArray.length;
		Set<FunctionPrivacyStateItem> result = 
			new HashSet<FunctionPrivacyStateItem>(numItems);
		for(int i = 0; i < listArray.length; i++) {
			String item = listArray[i];
			if((item != null) && 
					(! StringUtils.isEmptyOrWhitespaceOnly(item))) {
				try {
					result.add(FunctionPrivacyStateItem.getValue(item));
				}
				catch(IllegalArgumentException e) {
					throw new ValidationException(
							ErrorCode.SURVEY_FUNCTION_INVALID_PRIVACY_STATE_GROUP_ITEM,
							"The function grouping item is unknown.",
							e);
				}
			}
		}
		return result;
	}
public static Set < FunctionPrivacyStateItem > validatePrivacyStateGroupList ( final String list ) throws ValidationException { if ( StringUtils . isEmptyOrWhitespaceOnly ( list ) ) { return Collections . emptySet ( ) ; } String [ ] listArray = list . split ( InputKeys . LIST_ITEM_SEPARATOR ) ; int numItems = listArray . length ; Set < FunctionPrivacyStateItem > result = new HashSet < FunctionPrivacyStateItem > ( numItems ) ; for ( int i = 0 ; i < listArray . length ; i ++ ) { String item = listArray [ i ] ; if ( ( item != null ) && ( ! StringUtils . isEmptyOrWhitespaceOnly ( item ) ) ) { try { result . add ( FunctionPrivacyStateItem . getValue ( item ) ) ; } catch ( IllegalArgumentException e ) { throw new ValidationException ( ErrorCode . SURVEY_FUNCTION_INVALID_PRIVACY_STATE_GROUP_ITEM , "The function grouping item is unknown." , e ) ; } } } return result ; }
Validates a list of privacy state grouping items.
Validates a list of privacy state grouping items .