Package de.boksa.rt.rest

Examples of de.boksa.rt.rest.RTRESTResponse


  }
 
  @Override
  public List<RTTicket> findByQuery(String query, String orderby, TicketSearchResponseFormat format) throws Exception {
    client.login();
    RTRESTResponse response = client.searchTickets(query, orderby, format);
    client.logout();
    TicketSearchResponseParser parser = null;
   
    switch (format) {
      case IDONLY: parser = null; break;
      case IDANDSUBJECT: parser = null; break;
      case MULTILINE: parser = MultilineTicketSearchResponseParser.getInstance(); break;
    }
   
    if (parser != null) {   
      if (response.getStatusCode() == 200l) {
        return parser.parseTicketSearchResponse(response);
      } else if (response.getStatusCode() == 401l) {
        throw new CredentialException(response.getStatusMessage());
      } else {
        throw new IOException(String.format("Server returned REST-response code %s (%s)", response.getStatusCode(), response.getStatusMessage()));
      }
    } else {
      throw new UnsupportedOperationException("Could not create parser for response format.");
    }
  }
View Full Code Here

TOP

Related Classes of de.boksa.rt.rest.RTRESTResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.