Search in sources :

Example 1 with IllegalParameterException

use of org.talend.esb.sam.service.rest.exception.IllegalParameterException in project tesb-rt-se by Talend.

the class SAMRestServiceImpl method getEvent.

@Override
public Response getEvent(String id) {
    Integer eventId;
    try {
        eventId = Integer.parseInt(id);
    } catch (NumberFormatException ex) {
        throw new IllegalParameterException("Error during converting " + id + " parameter to Integer", ex);
    }
    FlowEvent event = provider.getEventDetails(eventId);
    if (null == event) {
        throw new ResourceNotFoundException("There no event with " + id + " ID can be found");
    }
    return Response.ok(event).build();
}
Also used : FlowEvent(org.talend.esb.sam.server.persistence.FlowEvent) AggregatedFlowEvent(org.talend.esb.sam.server.persistence.AggregatedFlowEvent) IllegalParameterException(org.talend.esb.sam.service.rest.exception.IllegalParameterException) ResourceNotFoundException(org.talend.esb.sam.service.rest.exception.ResourceNotFoundException)

Aggregations

AggregatedFlowEvent (org.talend.esb.sam.server.persistence.AggregatedFlowEvent)1 FlowEvent (org.talend.esb.sam.server.persistence.FlowEvent)1 IllegalParameterException (org.talend.esb.sam.service.rest.exception.IllegalParameterException)1 ResourceNotFoundException (org.talend.esb.sam.service.rest.exception.ResourceNotFoundException)1