private List<ScheduledServiceListResource> getTaskRequest(String uri) throws IOException { try { String entityText = nexusRestClient.doGetForText(uri, isSuccessful()); XStreamRepresentation representation = new XStreamRepresentation(xstream, entityText, MediaType.APPLICATION_XML); ScheduledServiceListResourceResponse scheduleResponse = (ScheduledServiceListResourceResponse) representation.getPayload( new ScheduledServiceListResourceResponse()); return scheduleResponse.getData(); } catch (AssertionError e) { // unsuccessful GET LOG.error(e.getMessage(), e); return Collections.emptyList(); } }
ScheduledServiceListResourceResponse result = new ScheduledServiceListResourceResponse(); item.setEnabled( task.isEnabled() ); result.addData( item );
/** * Method addData * * @param scheduledServiceListResource */ public void addData(ScheduledServiceListResource scheduledServiceListResource) { if ( !(scheduledServiceListResource instanceof ScheduledServiceListResource) ) { throw new ClassCastException( "ScheduledServiceListResourceResponse.addData(scheduledServiceListResource) parameter must be instanceof " + ScheduledServiceListResource.class.getName() ); } getData().add( scheduledServiceListResource ); } //-- void addData(ScheduledServiceListResource)
ScheduledServiceListResourceResponse result = new ScheduledServiceListResourceResponse(); item.setEnabled(task.isEnabled()); result.addData(item);
/** * Method removeData * * @param scheduledServiceListResource */ public void removeData(ScheduledServiceListResource scheduledServiceListResource) { if ( !(scheduledServiceListResource instanceof ScheduledServiceListResource) ) { throw new ClassCastException( "ScheduledServiceListResourceResponse.removeData(scheduledServiceListResource) parameter must be instanceof " + ScheduledServiceListResource.class.getName() ); } getData().remove( scheduledServiceListResource ); } //-- void removeData(ScheduledServiceListResource)
private List<ScheduledServiceListResource> getTaskRequest( String uri ) throws IOException { try { String entityText = nexusRestClient.doGetForText( uri, isSuccessful() ); XStreamRepresentation representation = new XStreamRepresentation( xstream, entityText, MediaType.APPLICATION_XML ); ScheduledServiceListResourceResponse scheduleResponse = (ScheduledServiceListResourceResponse) representation.getPayload( new ScheduledServiceListResourceResponse() ); return scheduleResponse.getData(); } catch ( AssertionError e ) { // unsuccessful GET LOG.error( e.getMessage(), e ); return Collections.emptyList(); } }
@SuppressWarnings( "unchecked" ) public static List<ScheduledServiceListResource> getTasks() throws IOException { String serviceURI = "service/local/schedules"; Response response = RequestFacade.doGetRequest( serviceURI ); XStreamRepresentation representation = new XStreamRepresentation( xstream, response.getEntity().getText(), MediaType.APPLICATION_XML ); ScheduledServiceListResourceResponse scheduleResponse = (ScheduledServiceListResourceResponse) representation .getPayload( new ScheduledServiceListResourceResponse() ); return scheduleResponse.getData(); }