factoryParameters.put(RESTRTDAOFactory.REST_INTERFACE_BASE_URL, "http://rt.easter-eggs.org/demos/stable/REST/1.0/");
factoryParameters.put(RESTRTDAOFactory.REST_INTERFACE_USERNAME, "john.foo");
factoryParameters.put(RESTRTDAOFactory.REST_INTERFACE_PASSWORD, "john.foo");
LOG.debug("Creating the RTTicketDAO");
RTTicketDAO dao = RESTRTDAOFactory.getInstance().getRTTicketDAO(factoryParameters);
// Strictly following the J2EE DAO Pattern that would be:
// RTTicketDAO dao = RTDAOFactory.getRTDAOFactory(RTDAOFactoryType.REST).getRTTicketDAO(factoryParameters);
try {
LOG.debug("Running the RT Query Builder query and parsing the results");
List<RTTicket> result = dao.findByQuery(RTQBQ_ALL_FROM_CUSTOMER_SERVICE, RTRESTClient.TicketSearchResponseFormat.MULTILINE);
LOG.debug("Iterating over the resulting POJOs");
for (RTTicket ticket : result) {
LOG.debug(String.format(" Found ticket: #%s / %s", ticket.getId(), ticket.getSubject()));
}