Merge branch 'rest-api-improvements' of https://github.com/wso2/carbon-device-mgt-plugins into rest-api-improvements

revert-dabc3590
mharindu 9 years ago
commit 62a116ba71

@ -26,7 +26,9 @@ import javax.ws.rs.*;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
@Api(value = "Event Receiver", description = "Event publishing/retrieving related APIs.") @Api(value = "Event Receiver", description = "Event publishing/retrieving related APIs.To enable Eventing need to" +
" configure as ref-https://docs.wso2.com/display/EMM210/Managing+Event+Publishing+with+WSO2+Data+Analytics+Server, " +
"https://docs.wso2.com/display/EMM210/Creating+a+New+Event+Stream+and+Receiver")
@Path("/events") @Path("/events")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)

@ -62,7 +62,7 @@ public class EventReceiverServiceImpl implements EventReceiverService {
entity(message).build(); entity(message).build();
} }
} catch (DataPublisherConfigurationException e) { } catch (DataPublisherConfigurationException e) {
String msg = "Error occurred while getting the Data publisher Service."; String msg = "Error occurred while getting the Data publisher Service instance.";
log.error(msg, e); log.error(msg, e);
throw new UnexpectedServerErrorException( throw new UnexpectedServerErrorException(
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build());
@ -150,7 +150,7 @@ public class EventReceiverServiceImpl implements EventReceiverService {
deviceStates = AndroidAPIUtils.getAllEventsForDevice(EVENT_STREAM_DEFINITION, query); deviceStates = AndroidAPIUtils.getAllEventsForDevice(EVENT_STREAM_DEFINITION, query);
if (deviceStates == null) { if (deviceStates == null) {
message.setResponseCode("No any alerts are published for given Device: " + message.setResponseCode("No any alerts are published for given Device: " +
"" + deviceId + " on specific date."); "" + deviceId + "and given specific Type.");
return Response.status(Response.Status.NOT_FOUND).entity(message).build(); return Response.status(Response.Status.NOT_FOUND).entity(message).build();
} else { } else {
@ -158,7 +158,7 @@ public class EventReceiverServiceImpl implements EventReceiverService {
} }
} catch (AnalyticsException e) { } catch (AnalyticsException e) {
String msg = "Error occurred while getting published events for specific " + String msg = "Error occurred while getting published events for specific " +
"Device: " + deviceId + "and given device Type."; "Device: " + deviceId + "and given specific Type.";
log.error(msg, e); log.error(msg, e);
throw new UnexpectedServerErrorException( throw new UnexpectedServerErrorException(
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build());

@ -388,7 +388,7 @@
<Permission> <Permission>
<name>Event Retrieve</name> <name>Event Retrieve</name>
<path>/device-mgt/android/events/view</path> <path>/device-mgt/android/events/view</path>
<url>/events/*</url> <url>/events</url>
<method>GET</method> <method>GET</method>
<scope>emm_admin</scope> <scope>emm_admin</scope>
</Permission> </Permission>

Loading…
Cancel
Save