agave-profiles/profiles-core/src/main/java/org/iplantc/service/profile/dao/TrellisProfileDAO.java
/**
	 * Makes API call to CyVerse Trellis API for profile info.
	 * @param trellisUrl the fully qualified url to the Trellis API
	 * @return a list of Profile objects mappeed from the query response of the Trellis API
	 * @throws RemoteDataException if Trellis is unavailable.
	 */
Makes API call to CyVerse Trellis API for profile info.
@param trellisUrl the fully qualified url to the Trellis API
@return a list of Profile objects mappeed from the query response of the Trellis API
@throws RemoteDataException if Trellis is unavailable.
Makes API call to CyVerse Trellis API for profile info . @param trellisUrl the fully qualified url to the Trellis API @return a list of Profile objects mappeed from the query response of the Trellis API @throws RemoteDataException if Trellis is unavailable .
private List<Profile> fetchResults(String trellisUrl) throws RemoteDataException 
	{
		List<Profile> profiles = new ArrayList<Profile>();
		HTTPSClient client = null;
		try {
			client = new HTTPSClient(trellisUrl, 
					Settings.QUERY_URL_USERNAME, 
					Settings.QUERY_URL_PASSWORD, 
					new HashMap<String,String>());
			String response = client.getText();
			JSONObject jsonObject = new JSONObject(response);
			if (jsonObject.has("users")) 
			{
				JSONArray json = jsonObject.getJSONArray("users");
				for (int i=0; i< json.length(); i++)
				{
					profiles.add(new TrellisProfile(json.getJSONObject(i)));
				}
			}
			return profiles;
		} 
		catch (JSONException e) {
			throw new RemoteDataException("Failed to parse profile data", e);
		} 
		catch (Exception e) {
			throw new RemoteDataException("Failed to retrieve profile data", e);
		}
	}
private List < Profile > fetchResults ( String trellisUrl ) throws RemoteDataException { List < Profile > profiles = new ArrayList < Profile > ( ) ; HTTPSClient client = null ; try { client = new HTTPSClient ( trellisUrl , Settings . QUERY_URL_USERNAME , Settings . QUERY_URL_PASSWORD , new HashMap < String , String > ( ) ) ; String response = client . getText ( ) ; JSONObject jsonObject = new JSONObject ( response ) ; if ( jsonObject . has ( "users" ) ) { JSONArray json = jsonObject . getJSONArray ( "users" ) ; for ( int i = 0 ; i < json . length ( ) ; i ++ ) { profiles . add ( new TrellisProfile ( json . getJSONObject ( i ) ) ) ; } } return profiles ; } catch ( JSONException e ) { throw new RemoteDataException ( "Failed to parse profile data" , e ) ; } catch ( Exception e ) { throw new RemoteDataException ( "Failed to retrieve profile data" , e ) ; } }
Makes API call to CyVerse Trellis API for profile info.
Makes API call to CyVerse Trellis API for profile info .
// execute method and handle any error responses. //String response = "{\"users\":[{\"id\":\"6102\",\"username\":\"jnvaughn\",\"firstname\":\"Justin\",\"lastname\":\"Vaughn\",\"email\":\"jnvaughn@uga.edu\",\"position\":null,\"institution\":\"University of Georgia\"},{\"id\":\"3819\",\"username\":\"vaughn\",\"firstname\":\"Matthew\",\"lastname\":\"Vaughn\",\"email\":\"vaughn@tacc.utexas.edu\",\"position\":null,\"institution\":\"University of Texas Austin\"}]}";