Package org.fieldapi.Notification

Examples of org.fieldapi.Notification.NotificationStatus


                    int uuid = notification.get("uuid").intValue();
                    String type = notification.get("type").textValue();
                    ObjectType subjectType = ObjectType.valueOf(notification.get("subjectType").textValue());
                    String subjectUri = notification.get("subjectUri").textValue();

                    NotificationStatus status = NotificationStatus.Undeliverable;
                    if (type.equals(NotificationType.ConfigurationChangeNotification.toString()))
                        status = Notification.sendConfigurationChangeNotification(subjectType, subjectUri);
                    else if (type.equals(NotificationType.PushDataRecordNotifaction.toString()))
                        status = Notification.sendPushDataRecordNotifaction(subjectType, subjectUri);
                    else if (type.equals(NotificationType.PopDataRecordNotification.toString()))
                        status = Notification.sendPopDataRecordNotification(subjectType, subjectUri);
                    else if (type.equals(NotificationType.GetStatusNotifaction.toString()))
                        status = Notification.sendGetStatusNotifaction(subjectType, subjectUri);
                    else if (type.equals(NotificationType.ShutDownNotification.toString()))
                        status = Notification.sendShutDownNotifaction(subjectType, subjectUri);
                    else
                    {
                        Map<String,String> payload = new HashMap<String,String>();
                        Iterator<Map.Entry<String,JsonNode>> j = notification.get("payload").fields();
                        while (j.hasNext())
                        {
                            Map.Entry<String,JsonNode> field = j.next();
                            payload.put(field.getKey(), field.getValue().textValue());
                        }

                        status = Notification.sendCustomNotifaction(type, subjectType, subjectUri, payload);
                    }

                    // Report the delivery status to the server by invoking a PUT on the following web service
                    // resource: "Agent/<objectUri>/Notification/<uuid>?status=<status>
                    //
                    // The request body is empty and the response body should be empty too. The actual status
                    // if the notification delivery is given directly inside the URL as query parameter "status".
                    // If can have one of the valiues of the NotificationStatus enumeration.
                    //
                    // The web service host has to return with status 204 to signal success.
                    isStatusEqualTo(client.target(baseUrl).path("Agent").path(agentUri).path("Notifications")
                                          .path("" + uuid).queryParam("status", status.toString()).request()
                                          .put(Entity.entity("", MediaType.APPLICATION_JSON_TYPE)), 204);
                }
                catch (Exception e)
                {
                    log.error(e.getMessage());
View Full Code Here

TOP

Related Classes of org.fieldapi.Notification.NotificationStatus

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.