src/org/ohmage/request/omh/OmhReadRequest.java
private StringBuilder buildRootPreviousNextString() 
			throws DomainException {
		
		StringBuilder rootBuilder = new StringBuilder();
		
		// Adds the default URL without a path.
		rootBuilder.append(CookieUtils.buildServerRootUrl());
		
		// Add the path to the Open mHealth read API.
		rootBuilder.append("/app/omh/v1.0/read?");
			
		try {
			// Add the authentication token.
			rootBuilder
				.append(
					URLEncoder
						.encode(
							InputKeys.AUTH_TOKEN,
							URL_ENCODING_UTF_8))
				.append('=')
				.append(
					URLEncoder
						.encode(
							userRequest.getUser().getToken(),
							URL_ENCODING_UTF_8));

			// Add the requester value..
			rootBuilder
				.append('&')
				.append(
					URLEncoder
						.encode(
							InputKeys.OMH_REQUESTER,
							URL_ENCODING_UTF_8))
				.append('=')
				.append(
					URLEncoder
						.encode(
							userRequest.getClient(),
							URL_ENCODING_UTF_8));
			
			// Add the payload ID.
			rootBuilder
				.append('&')
				.append(
					URLEncoder
						.encode(
							InputKeys.OMH_PAYLOAD_ID,
							URL_ENCODING_UTF_8))
				.append('=')
				.append(
					URLEncoder
						.encode(
							payloadIdString,
							URL_ENCODING_UTF_8));
			
			// Add the payload version.
			rootBuilder
				.append('&')
				.append(
					URLEncoder
						.encode(
							InputKeys.OMH_PAYLOAD_VERSION,
							URL_ENCODING_UTF_8))
				.append('=')
				.append(
					URLEncoder
						.encode(
							payloadVersion.toString(),
							URL_ENCODING_UTF_8));
			
			// Add the owner, if given.
			if(owner != null) {
				rootBuilder
					.append('&')
					.append(
						URLEncoder
							.encode(
								InputKeys.OMH_OWNER,
								URL_ENCODING_UTF_8))
					.append('=')
					.append(
						URLEncoder
							.encode(
								owner,
								URL_ENCODING_UTF_8));
			}
			
			DateTimeFormatter isoDateTimeFormatter =
				ISODateTimeFormat.dateTime();
			
			// Add the start date, if given.
			if(startDate != null) {
				rootBuilder
					.append('&')
					.append(
						URLEncoder
							.encode(
								InputKeys.OMH_START_TIMESTAMP,
								URL_ENCODING_UTF_8))
					.append('=')
					.append(
						URLEncoder
							.encode(
								isoDateTimeFormatter.print(startDate),
								URL_ENCODING_UTF_8));
			}
			
			// Add the end date, if given.
			if(endDate != null) {
				rootBuilder
					.append('&')
					.append(
						URLEncoder
							.encode(
								InputKeys.OMH_END_TIMESTAMP,
								URL_ENCODING_UTF_8))
					.append('=')
					.append(
						URLEncoder
							.encode(
								isoDateTimeFormatter.print(endDate),
								URL_ENCODING_UTF_8));
			}
			
			// Add the end date, if given.
			if((columns != null) && (! columns.isLeaf())) {
				rootBuilder
					.append('&')
					.append(
						URLEncoder
							.encode(
								InputKeys.OMH_COLUMN_LIST,
								URL_ENCODING_UTF_8))
					.append('=')
					.append(
						URLEncoder
							.encode(
								columns.toListString(),
								URL_ENCODING_UTF_8));
			}
		}
		catch(UnsupportedEncodingException e) {
			throw
				new DomainException(
					"The encoding is unknown: " + URL_ENCODING_UTF_8,
					e);
		}
		
		return rootBuilder;
	}
/**
	 * Generates the next and previous URLs' base URL. A caller is expected to
	 * clone the resulting StringBuilder and append their own paging 
	 * information.
	 * 
	 * @return A StringBuilder that is the base URL for previous and next
	 * 		   parameters.
	 * 
	 * @throws DomainException There was an error building the URL.
	 */
Generates the next and previous URLs' base URL. A caller is expected to
clone the resulting StringBuilder and append their own paging
information.

@return A StringBuilder that is the base URL for previous and next
parameters.

@throws DomainException There was an error building the URL.
Generates the next and previous URLs ' base URL . A caller is expected to clone the resulting StringBuilder and append their own paging information . @return A StringBuilder that is the base URL for previous and next parameters . @throws DomainException There was an error building the URL .
private StringBuilder buildRootPreviousNextString() 
			throws DomainException {
		StringBuilder rootBuilder = new StringBuilder();
		rootBuilder.append(CookieUtils.buildServerRootUrl());
		rootBuilder.append("/app/omh/v1.0/read?");
		try {
			rootBuilder
				.append(
					URLEncoder
						.encode(
							InputKeys.AUTH_TOKEN,
							URL_ENCODING_UTF_8))
				.append('=')
				.append(
					URLEncoder
						.encode(
							userRequest.getUser().getToken(),
							URL_ENCODING_UTF_8));
			rootBuilder
				.append('&')
				.append(
					URLEncoder
						.encode(
							InputKeys.OMH_REQUESTER,
							URL_ENCODING_UTF_8))
				.append('=')
				.append(
					URLEncoder
						.encode(
							userRequest.getClient(),
							URL_ENCODING_UTF_8));
			rootBuilder
				.append('&')
				.append(
					URLEncoder
						.encode(
							InputKeys.OMH_PAYLOAD_ID,
							URL_ENCODING_UTF_8))
				.append('=')
				.append(
					URLEncoder
						.encode(
							payloadIdString,
							URL_ENCODING_UTF_8));
			rootBuilder
				.append('&')
				.append(
					URLEncoder
						.encode(
							InputKeys.OMH_PAYLOAD_VERSION,
							URL_ENCODING_UTF_8))
				.append('=')
				.append(
					URLEncoder
						.encode(
							payloadVersion.toString(),
							URL_ENCODING_UTF_8));
			if(owner != null) {
				rootBuilder
					.append('&')
					.append(
						URLEncoder
							.encode(
								InputKeys.OMH_OWNER,
								URL_ENCODING_UTF_8))
					.append('=')
					.append(
						URLEncoder
							.encode(
								owner,
								URL_ENCODING_UTF_8));
			}
			DateTimeFormatter isoDateTimeFormatter =
				ISODateTimeFormat.dateTime();
			if(startDate != null) {
				rootBuilder
					.append('&')
					.append(
						URLEncoder
							.encode(
								InputKeys.OMH_START_TIMESTAMP,
								URL_ENCODING_UTF_8))
					.append('=')
					.append(
						URLEncoder
							.encode(
								isoDateTimeFormatter.print(startDate),
								URL_ENCODING_UTF_8));
			}
			if(endDate != null) {
				rootBuilder
					.append('&')
					.append(
						URLEncoder
							.encode(
								InputKeys.OMH_END_TIMESTAMP,
								URL_ENCODING_UTF_8))
					.append('=')
					.append(
						URLEncoder
							.encode(
								isoDateTimeFormatter.print(endDate),
								URL_ENCODING_UTF_8));
			}
			if((columns != null) && (! columns.isLeaf())) {
				rootBuilder
					.append('&')
					.append(
						URLEncoder
							.encode(
								InputKeys.OMH_COLUMN_LIST,
								URL_ENCODING_UTF_8))
					.append('=')
					.append(
						URLEncoder
							.encode(
								columns.toListString(),
								URL_ENCODING_UTF_8));
			}
		}
		catch(UnsupportedEncodingException e) {
			throw
				new DomainException(
					"The encoding is unknown: " + URL_ENCODING_UTF_8,
					e);
		}
		return rootBuilder;
	}
private StringBuilder buildRootPreviousNextString ( ) throws DomainException { StringBuilder rootBuilder = new StringBuilder ( ) ; rootBuilder . append ( CookieUtils . buildServerRootUrl ( ) ) ; rootBuilder . append ( "/app/omh/v1.0/read?" ) ; try { rootBuilder . append ( URLEncoder . encode ( InputKeys . AUTH_TOKEN , URL_ENCODING_UTF_8 ) ) . append ( '=' ) . append ( URLEncoder . encode ( userRequest . getUser ( ) . getToken ( ) , URL_ENCODING_UTF_8 ) ) ; rootBuilder . append ( '&' ) . append ( URLEncoder . encode ( InputKeys . OMH_REQUESTER , URL_ENCODING_UTF_8 ) ) . append ( '=' ) . append ( URLEncoder . encode ( userRequest . getClient ( ) , URL_ENCODING_UTF_8 ) ) ; rootBuilder . append ( '&' ) . append ( URLEncoder . encode ( InputKeys . OMH_PAYLOAD_ID , URL_ENCODING_UTF_8 ) ) . append ( '=' ) . append ( URLEncoder . encode ( payloadIdString , URL_ENCODING_UTF_8 ) ) ; rootBuilder . append ( '&' ) . append ( URLEncoder . encode ( InputKeys . OMH_PAYLOAD_VERSION , URL_ENCODING_UTF_8 ) ) . append ( '=' ) . append ( URLEncoder . encode ( payloadVersion . toString ( ) , URL_ENCODING_UTF_8 ) ) ; if ( owner != null ) { rootBuilder . append ( '&' ) . append ( URLEncoder . encode ( InputKeys . OMH_OWNER , URL_ENCODING_UTF_8 ) ) . append ( '=' ) . append ( URLEncoder . encode ( owner , URL_ENCODING_UTF_8 ) ) ; } DateTimeFormatter isoDateTimeFormatter = ISODateTimeFormat . dateTime ( ) ; if ( startDate != null ) { rootBuilder . append ( '&' ) . append ( URLEncoder . encode ( InputKeys . OMH_START_TIMESTAMP , URL_ENCODING_UTF_8 ) ) . append ( '=' ) . append ( URLEncoder . encode ( isoDateTimeFormatter . print ( startDate ) , URL_ENCODING_UTF_8 ) ) ; } if ( endDate != null ) { rootBuilder . append ( '&' ) . append ( URLEncoder . encode ( InputKeys . OMH_END_TIMESTAMP , URL_ENCODING_UTF_8 ) ) . append ( '=' ) . append ( URLEncoder . encode ( isoDateTimeFormatter . print ( endDate ) , URL_ENCODING_UTF_8 ) ) ; } if ( ( columns != null ) && ( ! columns . isLeaf ( ) ) ) { rootBuilder . append ( '&' ) . append ( URLEncoder . encode ( InputKeys . OMH_COLUMN_LIST , URL_ENCODING_UTF_8 ) ) . append ( '=' ) . append ( URLEncoder . encode ( columns . toListString ( ) , URL_ENCODING_UTF_8 ) ) ; } } catch ( UnsupportedEncodingException e ) { throw new DomainException ( "The encoding is unknown: " + URL_ENCODING_UTF_8 , e ) ; } return rootBuilder ; }
Generates the next and previous URLs' base URL.
Generates the next and previous URLs ' base URL .
// Adds the default URL without a path. // Add the path to the Open mHealth read API. // Add the authentication token. // Add the requester value.. // Add the payload ID. // Add the payload version. // Add the owner, if given. // Add the start date, if given. // Add the end date, if given. // Add the end date, if given.