Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. public class SampleServlet extends HttpServlet {
  2. public void doPost(HttpServletRequest req, HttpServletResponse res)throws ServletException, IOException {
  3. ServletActions.valueOf("action1").execute(params); //Invoking respective action
  4. }
  5. }
  6.  
  7. public enum ServletActions {
  8.  
  9. ACTION_1 {
  10. //Do some actions
  11. //Notify `a` regarding the actions
  12. //Notify `b` regarding the action performed
  13. //Construct response json
  14. },
  15.  
  16. ACTION_2 {
  17. //Do some actions
  18. //Notify `d` regarding the actions
  19. //Notify `e` regarding the action performed
  20. //Construct response json
  21. },
  22.  
  23. ACTION_3 {
  24. //Do some actions
  25. //Notify `d` regarding the actions
  26. //Notify `b` regarding the action performed
  27. //Construct response json
  28. },
  29.  
  30. ACTION_4 {
  31. },
  32.  
  33. ACTION_5 {
  34. },
  35.  
  36. ACTION_6 {
  37. },
  38.  
  39. ACTION_7 {
  40. };
  41. }
  42.  
  43. public enum ServletActionsNotifier {
  44.  
  45. ACTION_1_NOTIFIER {
  46. public void sendNotification() {
  47. //Send agent notification
  48. //Send progress notification
  49. }
  50. },
  51.  
  52. ACTION_2_NOTIFIER {
  53. public void sendNotification() {
  54. //Send task notification
  55. //Send progress notification
  56. }
  57. },
  58.  
  59. ACTION_3_NOTIFIER {
  60. public void sendNotification() {
  61. //Send feed notification
  62. //Send success notification
  63. }
  64. },
  65.  
  66. ACTION_4_NOTIFIER {
  67. },
  68.  
  69. ACTION_5_NOTIFIER {
  70. },
  71.  
  72. ACTION_6_NOTIFIER {
  73. },
  74.  
  75. ACTION_7_NOTIFIER {
  76. };
  77. abstract void sendNotification();
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement