This backend application is a showcase / quickstart part of Aerogear's UnifiedPush facilities. This Application shows how a business specific App can interact with aerogear-unifiedpush-server . It shows how it can use the aerogear-unifiedpush-java-client to send Unified Messages to the push server.
AeroDoc is a company in the health care industry, selling a revolutionary tensiometer. Their clients are doctors. AeroDoc has several sales agents all over the United States. At the headquarters, they have their "first line" sales departement, doing cold calls all along the day. As soon they have a concrete lead, they use their AeroDoc Admin app to filter out available sales Agents available in the lead area. They can then send them a push notification.
The sales agent receives the notification on their mobile device that a new lead is available. The agent will handle the lead by "accepting" the notifcation, informing the other agents that the lead has been processed.
In this highly competitive market of the tensiometers, be able to process a lead directly is for sure a competitve advantage.
- The client consist of a list of leads : a lead can be "open" or "in process", leads "in process" of other sales are not visible.
- optional : when the client tap a lead it appears on a map
- The client has a status that he can set: STANDBY | WITH_CLIENT |PTO
- The client has a location
- The client has an alias
- The admin client can create a new lead :
- A lead consist of a name and a location
- The admin client can query for Sales Agents based on :
- Status
- Location
-
The admin client can assign a lead to a selection (1..n) of sales agents, this will send out the nofitications.
-
The admin client manage the Sales Agents DB.
-
Your are a Sale Agent (SA) and you log yourself
-
First screen displayed a list of all unassigned leads retrieved server side (Rest service by default send only unassigned leads)
-
An admin pushes a new lead to a chosen list of SA (including you)
-
You receive the push notification, alert is displayed
-
Your device refresh the list of unassigned leads (server side call). Potentially retrieving also unassigned leads not directly pushed to you. Nice to have feature: The one pushed to you should be highlighted.
-
You accept the lead. The lead is removed from unassigned list and go in Second tab: your accepted list which is stored locally on you device.
-
On acceptation of your lead, you send an update to server. Server side broadcast to all SA (except yourself) to refresh unassigned leads list.
Be sure to have a running instance of a Push Server. Intructions can be found here.
When registring the device on the Push Server make sure to use one of the existing aliases (or you should create a new user on the AeroDoc Admin Page) :
- john
- jake
- maria
- bob
For all these aliases the password is 123
mvn clean install jboss-as:deploy
Browse to localhost:8080/aerodoc
You should log in with john/123 , he has admin rights and create leads and send notification.
On the left menu you should have a link to Push Configuration
.
From there you can create and manage your push configs. You should have at least 1 config available.
You can have more than one config but only one can be active. This can be useful when you have to switch between localhost and an OpenShift hosted Push Server for instance. Switching from one config to another can be done at runtime and no restart is needed. Just select the config you want and make sure it has active
enabled.
Use the form to create a new Lead
- Select a lead from the lead's list
- If needed enter the 2 available criterias
status
and/orlocation
(you can also search without criteria). - Select the agents you want to send the lead to.
- Push the button
Send Lead
The native clients can access the following REST based services :
Login service, mandatory for all further request.
curl -v -b cookies.txt -c cookies.txt -H "Accept: application/json" -H "Content-type: application/json"
-X POST -d '{"loginName": "john", "password":"123"}' http://localhost:8080/aerodoc/rest/login
It will return the user :
{"id":"cb3c05aa-3fdd-4b4e-9b90-386fc7e5671a","enabled":true,"createdDate":1371215851063,"expirationDate":null,"partition":null,"loginName":"john","firstName":null,"lastName":null,"email":null,"status":"PTO","password":"123","location":"New York"}
Logout service.
curl -v -b cookies.txt -c cookies.txt -H "Accept: application/json" -H "Content-type: application/json"
-X POST -d '{"loginName": "john", "password":"123"}' http://localhost:8080/aerodoc/rest/logout
returns no data
Obtain a list of leads.
curl -v -b cookies.txt -c cookies.txt -H "Accept: application/json" -H "Content-type: application/json"
-X GET http://localhost:8080/aerodoc/rest/leads
You will get a list of leads which has not a saleAgent set yet :
[{"id":39,"version":0,"name":"Doctor No","location":"New York","phoneNumber":"0612412121"}]
Update a SaleAgent, the service will only update the status and the location for now.
curl -v -b cookies.txt -c cookies.txt -H "Accept: application/json" -H "Content-type: application/json" -X PUT -d '{"id":"13bbaea3-9271-43f7-80aa-fb21360ff684","enabled":true,"createdDate":1371213256827,"expirationDate":null,"partition":null,"loginName":"john","firstName":null,"lastName":null,"email":null,"version":0,"status":"CHANGED","password":"123","location":"New York"}' http://localhost:8080/aerodoc/rest/saleagents/13bbaea3-9271-43f7-80aa-fb21360ff684
returns no data
Update a Lead, typically used if a Sale Agent wants to assign a lead to him.
curl -v -b cookies.txt -c cookies.txt -H "Accept: application/json" -H "Content-type: application/json" -X PUT -d '{"id":39,"version":0,"name":"Doctor No","location":"New York","phoneNumber":"121212121","saleAgent":"13bbaea3-9271-43f7-80aa-fb21360ff684"}' http://localhost:8080/aerodoc/rest/leads/39
returns no data