Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class SampleServlet extends HttpServlet {
- public void doPost(HttpServletRequest req, HttpServletResponse res)throws ServletException, IOException {
- ServletActions.valueOf("action1").execute(params); //Invoking respective action
- }
- }
- public enum ServletActions {
- ACTION_1 {
- //Do some actions
- //Notify `a` regarding the actions
- //Notify `b` regarding the action performed
- //Construct response json
- },
- ACTION_2 {
- //Do some actions
- //Notify `d` regarding the actions
- //Notify `e` regarding the action performed
- //Construct response json
- },
- ACTION_3 {
- //Do some actions
- //Notify `d` regarding the actions
- //Notify `b` regarding the action performed
- //Construct response json
- },
- ACTION_4 {
- },
- ACTION_5 {
- },
- ACTION_6 {
- },
- ACTION_7 {
- };
- }
- public enum ServletActionsNotifier {
- ACTION_1_NOTIFIER {
- public void sendNotification() {
- //Send agent notification
- //Send progress notification
- }
- },
- ACTION_2_NOTIFIER {
- public void sendNotification() {
- //Send task notification
- //Send progress notification
- }
- },
- ACTION_3_NOTIFIER {
- public void sendNotification() {
- //Send feed notification
- //Send success notification
- }
- },
- ACTION_4_NOTIFIER {
- },
- ACTION_5_NOTIFIER {
- },
- ACTION_6_NOTIFIER {
- },
- ACTION_7_NOTIFIER {
- };
- abstract void sendNotification();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement