{"action":"created","comment":{"url":"https://api.github.com/repos/lf-kailashraj/batch7crud/pulls/comments/50382152","id":50382152,"diff_hunk":"@@ -0,0 +1,187 @@\n+package com.lftechnology.batch7crud.controller;\n+\n+import static com.lftechnology.batch7crud.constant.AttribConstants.*;\n+import static com.lftechnology.batch7crud.constant.RouteConstants.*;\n+import static com.lftechnology.batch7crud.constant.UrlConstants.*;\n+import static com.lftechnology.batch7crud.constant.ParamConstants.*;\n+\n+import com.lftechnology.batch7crud.exception.DataException;\n+import com.lftechnology.batch7crud.model.Employee;\n+import com.lftechnology.batch7crud.service.EmployeeService;\n+\n+import javax.servlet.RequestDispatcher;\n+import javax.servlet.ServletException;\n+import javax.servlet.annotation.WebServlet;\n+import javax.servlet.http.HttpServletRequest;\n+import javax.servlet.http.HttpServletResponse;\n+import java.io.IOException;\n+import java.util.logging.Level;\n+import java.util.logging.Logger;\n+\n+/**\n+ * Created by pratishshr on 1/14/16.\n+ */\n+\n+@WebServlet(name = \"EmployeeController\", urlPatterns = { \"/employees/*\" })\n+public class EmployeeController extends CustomHttpServlet {\n+  private static final Logger LOGGER = Logger.getLogger(EmployeeController.class.getName());\n+\n+  private static EmployeeService employeeService;\n+\n+  public EmployeeController() {\n+    employeeService = new EmployeeService();\n+  }\n+\n+  @Override\n+  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {\n+    String[] parameters = parameterValues(request);\n+\n+    if (parameters.length == 2) {\n+      list(request, response);\n+    } else if (parameters.length == 3 && ROUTE_CREATE.equals(parameters[2])) {\n+      create(request, response);\n+    } else if (parameters.length == 3) {\n+      viewProfile(request, response);\n+    } else if (parameters.length == 4 && ROUTE_EDIT.equals(parameters[3])) {\n+      edit(request, response);\n+    } else {\n+      show404(request, response);\n+    }\n+\n+  }\n+\n+  @Override\n+  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {\n+    String[] parameters = parameterValues(request);\n+\n+    if (parameters.length == 3 && ROUTE_CREATE.equals(parameters[2])) {\n+      createProcess(request, response);\n+    } else if (parameters.length == 4 && ROUTE_EDIT.equals(parameters[3])) {\n+      editProcess(request, response);\n+    } else if (parameters.length == 4 && ROUTE_DELETE.equals(parameters[3])) {\n+      deleteProcess(request, response);\n+    } else {\n+      show404(request, response);\n+    }\n+  }\n+\n+  private void list(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {\n+    try {\n+      int page = pageNumber(request);\n+      int noOfRecords = employeeService.fetchNoOfRecords();\n+      int noOfPages = (int) Math.ceil(noOfRecords * 1.0 / 20);\n+      int recordLimit = 20;\n+\n+      if (page != 1 && page > noOfPages) {\n+        show404(request, response);\n+        return;\n+      }\n+\n+      request.setAttribute(ATTRIB_EMPLOYEES, employeeService.fetch(page, recordLimit));","path":"batch7crud-roll4/src/main/java/com/lftechnology/batch7crud/controller/EmployeeController.java","position":80,"original_position":80,"commit_id":"3d63258b698bdef4eacee85542ec94ec15f4c438","original_commit_id":"3d63258b698bdef4eacee85542ec94ec15f4c438","user":{"login":"sudhirshakya","id":3131421,"avatar_url":"https://avatars.githubusercontent.com/u/3131421?v=3","gravatar_id":"","url":"https://api.github.com/users/sudhirshakya","html_url":"https://github.com/sudhirshakya","followers_url":"https://api.github.com/users/sudhirshakya/followers","following_url":"https://api.github.com/users/sudhirshakya/following{/other_user}","gists_url":"https://api.github.com/users/sudhirshakya/gists{/gist_id}","starred_url":"https://api.github.com/users/sudhirshakya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sudhirshakya/subscriptions","organizations_url":"https://api.github.com/users/sudhirshakya/orgs","repos_url":"https://api.github.com/users/sudhirshakya/repos","events_url":"https://api.github.com/users/sudhirshakya/events{/privacy}","received_events_url":"https://api.github.com/users/sudhirshakya/received_events","type":"User","site_admin":false},"body":"Send the page number as jsp page attribute.","created_at":"2016-01-21T10:18:28Z","updated_at":"2016-01-21T10:18:28Z","html_url":"https://github.com/lf-kailashraj/batch7crud/pull/2#discussion_r50382152","pull_request_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/lf-kailashraj/batch7crud/pulls/comments/50382152"},"html":{"href":"https://github.com/lf-kailashraj/batch7crud/pull/2#discussion_r50382152"},"pull_request":{"href":"https://api.github.com/repos/lf-kailashraj/batch7crud/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/lf-kailashraj/batch7crud/pulls/2","id":56332267,"html_url":"https://github.com/lf-kailashraj/batch7crud/pull/2","diff_url":"https://github.com/lf-kailashraj/batch7crud/pull/2.diff","patch_url":"https://github.com/lf-kailashraj/batch7crud/pull/2.patch","issue_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/issues/2","number":2,"state":"open","locked":false,"title":"Roll4 crud practice","user":{"login":"pratishshr","id":13301510,"avatar_url":"https://avatars.githubusercontent.com/u/13301510?v=3","gravatar_id":"","url":"https://api.github.com/users/pratishshr","html_url":"https://github.com/pratishshr","followers_url":"https://api.github.com/users/pratishshr/followers","following_url":"https://api.github.com/users/pratishshr/following{/other_user}","gists_url":"https://api.github.com/users/pratishshr/gists{/gist_id}","starred_url":"https://api.github.com/users/pratishshr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pratishshr/subscriptions","organizations_url":"https://api.github.com/users/pratishshr/orgs","repos_url":"https://api.github.com/users/pratishshr/repos","events_url":"https://api.github.com/users/pratishshr/events{/privacy}","received_events_url":"https://api.github.com/users/pratishshr/received_events","type":"User","site_admin":false},"body":"@lf-kailashraj  \r\nBasic CRUD operation added.","created_at":"2016-01-18T11:42:02Z","updated_at":"2016-01-21T10:18:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f2d6bdc94006607e5e2720c228d27932287d9e68","assignee":{"login":"sudhirshakya","id":3131421,"avatar_url":"https://avatars.githubusercontent.com/u/3131421?v=3","gravatar_id":"","url":"https://api.github.com/users/sudhirshakya","html_url":"https://github.com/sudhirshakya","followers_url":"https://api.github.com/users/sudhirshakya/followers","following_url":"https://api.github.com/users/sudhirshakya/following{/other_user}","gists_url":"https://api.github.com/users/sudhirshakya/gists{/gist_id}","starred_url":"https://api.github.com/users/sudhirshakya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sudhirshakya/subscriptions","organizations_url":"https://api.github.com/users/sudhirshakya/orgs","repos_url":"https://api.github.com/users/sudhirshakya/repos","events_url":"https://api.github.com/users/sudhirshakya/events{/privacy}","received_events_url":"https://api.github.com/users/sudhirshakya/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/pulls/2/commits","review_comments_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/pulls/2/comments","review_comment_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/issues/2/comments","statuses_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/statuses/3d63258b698bdef4eacee85542ec94ec15f4c438","head":{"label":"lf-kailashraj:ROLL4-crud-practice","ref":"ROLL4-crud-practice","sha":"3d63258b698bdef4eacee85542ec94ec15f4c438","user":{"login":"lf-kailashraj","id":7426244,"avatar_url":"https://avatars.githubusercontent.com/u/7426244?v=3","gravatar_id":"","url":"https://api.github.com/users/lf-kailashraj","html_url":"https://github.com/lf-kailashraj","followers_url":"https://api.github.com/users/lf-kailashraj/followers","following_url":"https://api.github.com/users/lf-kailashraj/following{/other_user}","gists_url":"https://api.github.com/users/lf-kailashraj/gists{/gist_id}","starred_url":"https://api.github.com/users/lf-kailashraj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lf-kailashraj/subscriptions","organizations_url":"https://api.github.com/users/lf-kailashraj/orgs","repos_url":"https://api.github.com/users/lf-kailashraj/repos","events_url":"https://api.github.com/users/lf-kailashraj/events{/privacy}","received_events_url":"https://api.github.com/users/lf-kailashraj/received_events","type":"User","site_admin":false},"repo":{"id":49557152,"name":"batch7crud","full_name":"lf-kailashraj/batch7crud","owner":{"login":"lf-kailashraj","id":7426244,"avatar_url":"https://avatars.githubusercontent.com/u/7426244?v=3","gravatar_id":"","url":"https://api.github.com/users/lf-kailashraj","html_url":"https://github.com/lf-kailashraj","followers_url":"https://api.github.com/users/lf-kailashraj/followers","following_url":"https://api.github.com/users/lf-kailashraj/following{/other_user}","gists_url":"https://api.github.com/users/lf-kailashraj/gists{/gist_id}","starred_url":"https://api.github.com/users/lf-kailashraj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lf-kailashraj/subscriptions","organizations_url":"https://api.github.com/users/lf-kailashraj/orgs","repos_url":"https://api.github.com/users/lf-kailashraj/repos","events_url":"https://api.github.com/users/lf-kailashraj/events{/privacy}","received_events_url":"https://api.github.com/users/lf-kailashraj/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lf-kailashraj/batch7crud","description":"","fork":false,"url":"https://api.github.com/repos/lf-kailashraj/batch7crud","forks_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/forks","keys_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/teams","hooks_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/hooks","issue_events_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/issues/events{/number}","events_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/events","assignees_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/assignees{/user}","branches_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/branches{/branch}","tags_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/tags","blobs_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/git/refs{/sha}","trees_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/statuses/{sha}","languages_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/languages","stargazers_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/stargazers","contributors_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/contributors","subscribers_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/subscribers","subscription_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/subscription","commits_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/commits{/sha}","git_commits_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/git/commits{/sha}","comments_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/comments{/number}","issue_comment_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/issues/comments{/number}","contents_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/contents/{+path}","compare_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/merges","archive_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/downloads","issues_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/issues{/number}","pulls_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/pulls{/number}","milestones_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/milestones{/number}","notifications_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/labels{/name}","releases_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/releases{/id}","created_at":"2016-01-13T07:24:08Z","updated_at":"2016-01-13T07:26:37Z","pushed_at":"2016-01-21T09:47:02Z","git_url":"git://github.com/lf-kailashraj/batch7crud.git","ssh_url":"git@github.com:lf-kailashraj/batch7crud.git","clone_url":"https://github.com/lf-kailashraj/batch7crud.git","svn_url":"https://github.com/lf-kailashraj/batch7crud","homepage":null,"size":465,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":9,"forks":0,"open_issues":9,"watchers":0,"default_branch":"dev"}},"base":{"label":"lf-kailashraj:dev","ref":"dev","sha":"2356e0515bd2aae35d92d74484081a4e53512bb4","user":{"login":"lf-kailashraj","id":7426244,"avatar_url":"https://avatars.githubusercontent.com/u/7426244?v=3","gravatar_id":"","url":"https://api.github.com/users/lf-kailashraj","html_url":"https://github.com/lf-kailashraj","followers_url":"https://api.github.com/users/lf-kailashraj/followers","following_url":"https://api.github.com/users/lf-kailashraj/following{/other_user}","gists_url":"https://api.github.com/users/lf-kailashraj/gists{/gist_id}","starred_url":"https://api.github.com/users/lf-kailashraj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lf-kailashraj/subscriptions","organizations_url":"https://api.github.com/users/lf-kailashraj/orgs","repos_url":"https://api.github.com/users/lf-kailashraj/repos","events_url":"https://api.github.com/users/lf-kailashraj/events{/privacy}","received_events_url":"https://api.github.com/users/lf-kailashraj/received_events","type":"User","site_admin":false},"repo":{"id":49557152,"name":"batch7crud","full_name":"lf-kailashraj/batch7crud","owner":{"login":"lf-kailashraj","id":7426244,"avatar_url":"https://avatars.githubusercontent.com/u/7426244?v=3","gravatar_id":"","url":"https://api.github.com/users/lf-kailashraj","html_url":"https://github.com/lf-kailashraj","followers_url":"https://api.github.com/users/lf-kailashraj/followers","following_url":"https://api.github.com/users/lf-kailashraj/following{/other_user}","gists_url":"https://api.github.com/users/lf-kailashraj/gists{/gist_id}","starred_url":"https://api.github.com/users/lf-kailashraj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lf-kailashraj/subscriptions","organizations_url":"https://api.github.com/users/lf-kailashraj/orgs","repos_url":"https://api.github.com/users/lf-kailashraj/repos","events_url":"https://api.github.com/users/lf-kailashraj/events{/privacy}","received_events_url":"https://api.github.com/users/lf-kailashraj/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lf-kailashraj/batch7crud","description":"","fork":false,"url":"https://api.github.com/repos/lf-kailashraj/batch7crud","forks_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/forks","keys_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/teams","hooks_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/hooks","issue_events_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/issues/events{/number}","events_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/events","assignees_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/assignees{/user}","branches_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/branches{/branch}","tags_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/tags","blobs_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/git/refs{/sha}","trees_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/statuses/{sha}","languages_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/languages","stargazers_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/stargazers","contributors_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/contributors","subscribers_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/subscribers","subscription_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/subscription","commits_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/commits{/sha}","git_commits_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/git/commits{/sha}","comments_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/comments{/number}","issue_comment_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/issues/comments{/number}","contents_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/contents/{+path}","compare_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/merges","archive_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/downloads","issues_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/issues{/number}","pulls_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/pulls{/number}","milestones_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/milestones{/number}","notifications_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/labels{/name}","releases_url":"https://api.github.com/repos/lf-kailashraj/batch7crud/releases{/id}","created_at":"2016-01-13T07:24:08Z","updated_at":"2016-01-13T07:26:37Z","pushed_at":"2016-01-21T09:47:02Z","git_url":"git://github.com/lf-kailashraj/batch7crud.git","ssh_url":"git@github.com:lf-kailashraj/batch7crud.git","clone_url":"https://github.com/lf-kailashraj/batch7crud.git","svn_url":"https://github.com/lf-kailashraj/batch7crud","homepage":null,"size":465,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":9,"forks":0,"open_issues":9,"watchers":0,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/lf-kailashraj/batch7crud/pulls/2"},"html":{"href":"https://github.com/lf-kailashraj/batch7crud/pull/2"},"issue":{"href":"https://api.github.com/repos/lf-kailashraj/batch7crud/issues/2"},"comments":{"href":"https://api.github.com/repos/lf-kailashraj/batch7crud/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/lf-kailashraj/batch7crud/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/lf-kailashraj/batch7crud/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lf-kailashraj/batch7crud/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/lf-kailashraj/batch7crud/statuses/3d63258b698bdef4eacee85542ec94ec15f4c438"}}}}