src/org/ohmage/validator/MobilityValidators.java
public static List<ColumnKey> validateColumns(
			final String value,
			final boolean allowDuplicates)
			throws ValidationException {
		
		if(StringUtils.isEmptyOrWhitespaceOnly(value)) {
			return MobilityColumnKey.ALL_COLUMNS;
		}
		
		Map<ColumnKey, String> duplicates = new HashMap<ColumnKey, String>();
		List<ColumnKey> result = new LinkedList<ColumnKey>();
		String[] columns = value.trim().split(InputKeys.LIST_ITEM_SEPARATOR);
		for(String column : columns) {
			if(StringUtils.isEmptyOrWhitespaceOnly(column)) {
				continue;
			}
			
			try {
				List<ColumnKey> validatedColumns =
						MobilityPoint.validateKeyString(column.trim());
				
				if(! allowDuplicates) {
					String duplicate;
					for(ColumnKey currColumn : validatedColumns) {
						if((duplicate = duplicates.put(currColumn, column)) != null) {
							throw new ValidationException(
									ErrorCode.MOBILITY_INVALID_COLUMN_LIST,
									"The same column '" +
										currColumn.toString() +
										"' is being requested by two column values: '" +
										duplicate + 
										"' and '" +
										column +
										"'");
						}
					}
				}
				
				result.addAll(validatedColumns);
			}
			catch(DomainException e) {
				throw new ValidationException(
						ErrorCode.MOBILITY_INVALID_COLUMN_LIST,
						"The column is unknown: " + column,
						e);
			}
		}
		
		return result;
	}
/**
	 * Validates that a string representing column keys contains only valid 
	 * column keys and then converts them into their actual value.
	 * 
	 * @param value The string to be decoded.
	 * 
	 * @return A list of column keys.
	 * 
	 * @throws ValidationException
	 */
Validates that a string representing column keys contains only valid
column keys and then converts them into their actual value.

@param value The string to be decoded.

@return A list of column keys.


Validates that a string representing column keys contains only valid column keys and then converts them into their actual value . @param value The string to be decoded . @return A list of column keys .
public static List<ColumnKey> validateColumns(
			final String value,
			final boolean allowDuplicates)
			throws ValidationException {
		if(StringUtils.isEmptyOrWhitespaceOnly(value)) {
			return MobilityColumnKey.ALL_COLUMNS;
		}
		Map<ColumnKey, String> duplicates = new HashMap<ColumnKey, String>();
		List<ColumnKey> result = new LinkedList<ColumnKey>();
		String[] columns = value.trim().split(InputKeys.LIST_ITEM_SEPARATOR);
		for(String column : columns) {
			if(StringUtils.isEmptyOrWhitespaceOnly(column)) {
				continue;
			}
			try {
				List<ColumnKey> validatedColumns =
						MobilityPoint.validateKeyString(column.trim());
				if(! allowDuplicates) {
					String duplicate;
					for(ColumnKey currColumn : validatedColumns) {
						if((duplicate = duplicates.put(currColumn, column)) != null) {
							throw new ValidationException(
									ErrorCode.MOBILITY_INVALID_COLUMN_LIST,
									"The same column '" +
										currColumn.toString() +
										"' is being requested by two column values: '" +
										duplicate + 
										"' and '" +
										column +
										"'");
						}
					}
				}
				result.addAll(validatedColumns);
			}
			catch(DomainException e) {
				throw new ValidationException(
						ErrorCode.MOBILITY_INVALID_COLUMN_LIST,
						"The column is unknown: " + column,
						e);
			}
		}
		return result;
	}
public static List < ColumnKey > validateColumns ( final String value , final boolean allowDuplicates ) throws ValidationException { if ( StringUtils . isEmptyOrWhitespaceOnly ( value ) ) { return MobilityColumnKey . ALL_COLUMNS ; } Map < ColumnKey , String > duplicates = new HashMap < ColumnKey , String > ( ) ; List < ColumnKey > result = new LinkedList < ColumnKey > ( ) ; String [ ] columns = value . trim ( ) . split ( InputKeys . LIST_ITEM_SEPARATOR ) ; for ( String column : columns ) { if ( StringUtils . isEmptyOrWhitespaceOnly ( column ) ) { continue ; } try { List < ColumnKey > validatedColumns = MobilityPoint . validateKeyString ( column . trim ( ) ) ; if ( ! allowDuplicates ) { String duplicate ; for ( ColumnKey currColumn : validatedColumns ) { if ( ( duplicate = duplicates . put ( currColumn , column ) ) != null ) { throw new ValidationException ( ErrorCode . MOBILITY_INVALID_COLUMN_LIST , "The same column '" + currColumn . toString ( ) + "' is being requested by two column values: '" + duplicate + "' and '" + column + "'" ) ; } } } result . addAll ( validatedColumns ) ; } catch ( DomainException e ) { throw new ValidationException ( ErrorCode . MOBILITY_INVALID_COLUMN_LIST , "The column is unknown: " + column , e ) ; } } return result ; }
Validates that a string representing column keys contains only valid
 column keys and then converts them into their actual value.
Validates that a string representing column keys contains only valid column keys and then converts them into their actual value .