agave-apps/clients/ProfileService.java
/**
	 * Calls the profile service to search for InternalUser by term and value.
	 * 
	 * @param term one of "username","email","name"
	 * @param value
	 * @return List of InternalUser
	 * @throws AuthenticationException
	 * @throws ProfileException
	 */
Calls the profile service to search for InternalUser by term and value.


Calls the profile service to search for InternalUser by term and value .
private List<InternalUser> _doInternalUserSearch(String term, String value)
	throws AuthenticationException, ProfileException
	{
		if (isEmpty(term)) {
			throw new ProfileException("No term provided.");
		} else if ( !Arrays.asList("username","email","name").contains(term.toLowerCase())) {
			throw new ProfileException("Invalid search term provided. Please search by 'username', 'email', or 'name'");
		}
		if (isEmpty(value)) {
			throw new ProfileException("No search value provided.");
		}
		if (isTokenValid(token)) 
		{
			throw new AuthenticationException("Token is expired");
		} 
		else 
		{
			APIResponse response = null;
			try 
			{
				response = get( Settings.SERVICE_BASE_URL + "profile-v1/internal/search/" + term + "/" + value, token );
			} 
			catch (APIClientException e) {
				throw new ProfileException(e);
			}
			if (response.isSuccess()) {
				return parseInternalUsers(response.getResult());
			} else {
				throw new ProfileException(response.getMessage());
			}
		}
	}
private List < InternalUser > _doInternalUserSearch ( String term , String value ) throws AuthenticationException , ProfileException { if ( isEmpty ( term ) ) { throw new ProfileException ( "No term provided." ) ; } else if ( ! Arrays . asList ( "username" , "email" , "name" ) . contains ( term . toLowerCase ( ) ) ) { throw new ProfileException ( "Invalid search term provided. Please search by 'username', 'email', or 'name'" ) ; } if ( isEmpty ( value ) ) { throw new ProfileException ( "No search value provided." ) ; } if ( isTokenValid ( token ) ) { throw new AuthenticationException ( "Token is expired" ) ; } else { APIResponse response = null ; try { response = get ( Settings . SERVICE_BASE_URL + "profile-v1/internal/search/" + term + "/" + value , token ) ; } catch ( APIClientException e ) { throw new ProfileException ( e ) ; } if ( response . isSuccess ( ) ) { return parseInternalUsers ( response . getResult ( ) ) ; } else { throw new ProfileException ( response . getMessage ( ) ) ; } } }
Calls the profile service to search for InternalUser by term and value.
Calls the profile service to search for InternalUser by term and value .