{"action":"created","comment":{"url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/pulls/comments/67820222","id":67820222,"diff_hunk":"@@ -0,0 +1,175 @@\n+package com.reliance.jiocloud.sbs.db.driver;\n+\n+import java.util.Calendar;\n+import java.util.Date;\n+import java.util.List;\n+import java.util.Map;\n+import java.util.Set;\n+import java.util.TimeZone;\n+\n+import org.hibernate.Criteria;\n+import org.hibernate.Session;\n+import org.hibernate.SessionFactory;\n+import org.hibernate.criterion.Restrictions;\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+\n+import com.google.common.collect.Lists;\n+import com.google.inject.Inject;\n+import com.reliance.jiocloud.sbs.db.Backups;\n+import com.reliance.jiocloud.sbs.db.QuotaUsages;\n+import com.reliance.jiocloud.sbs.db.Volumes;\n+import com.reliance.jiocloud.sbs.volumestorage.SbsWorkflowException;\n+\n+/**\n+ * Hibernate Implementation of {@link IDataFetch} with mysql as backend.\n+ * \n+ * @author souvik.ray\n+ */\n+public class DataFetchImpl implements IDataFetch {\n+    private static final Logger logger = LoggerFactory.getLogger(DataFetchImpl.class);\n+    private static final int QUOTA_UPDATE_MAX_TRY = 10;\n+    private SessionFactory sessionFactory;\n+\n+    @Inject\n+    public DataFetchImpl(SessionFactory sessionFactory) {\n+        this.sessionFactory = sessionFactory;\n+    }\n+\n+    @Override\n+    /*\n+     * (non-Javadoc)\n+     * @see com.reliance.jiocloud.sbs.db.driver.IDataFetch#getVolume(java.lang.\n+     * String)\n+     */\n+    public Volumes getVolume(String volumeId) {\n+        Session session = null;\n+        try {\n+            session = sessionFactory.openSession();\n+            session.beginTransaction();\n+            Volumes volume = session.get(Volumes.class, volumeId);\n+            session.getTransaction().commit();\n+            return volume;\n+        } catch (Exception e) {\n+            logger.error(\"Error in Fetching Volume [{}] information from database\", volumeId, e);\n+            throw e;\n+        } finally {\n+            if (session.isConnected()) {\n+                session.close();\n+            }\n+        }\n+    }\n+\n+    @Override\n+    /*\n+     * (non-Javadoc)\n+     * @see\n+     * com.reliance.jiocloud.sbs.db.driver.IDataFetch#updateVolume(com.reliance.\n+     * jiocloud.sbs.db.Volumes)\n+     */\n+    public void updateVolume(Volumes volume) {\n+        Session session = null;\n+        try {\n+            session = sessionFactory.openSession();\n+            session.beginTransaction();\n+            session.saveOrUpdate(volume);\n+            session.getTransaction().commit();\n+        } catch (Exception e) {\n+            logger.error(\"Error in Fetching Volume [{}] information from database\", volume.getId(), e);\n+            throw e;\n+        } finally {\n+            if (session.isConnected()) {\n+                session.close();\n+            }\n+        }\n+    }\n+\n+    @SuppressWarnings(\"unchecked\")","path":"src/com/reliance/jiocloud/sbs/db/driver/DataFetchImpl.java","position":87,"original_position":87,"commit_id":"b2baf299793ea8cb3f578cf16f7a0675c74d4796","original_commit_id":"b2baf299793ea8cb3f578cf16f7a0675c74d4796","user":{"login":"souvik-ray","id":16453607,"avatar_url":"https://avatars.githubusercontent.com/u/16453607?v=3","gravatar_id":"","url":"https://api.github.com/users/souvik-ray","html_url":"https://github.com/souvik-ray","followers_url":"https://api.github.com/users/souvik-ray/followers","following_url":"https://api.github.com/users/souvik-ray/following{/other_user}","gists_url":"https://api.github.com/users/souvik-ray/gists{/gist_id}","starred_url":"https://api.github.com/users/souvik-ray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/souvik-ray/subscriptions","organizations_url":"https://api.github.com/users/souvik-ray/orgs","repos_url":"https://api.github.com/users/souvik-ray/repos","events_url":"https://api.github.com/users/souvik-ray/events{/privacy}","received_events_url":"https://api.github.com/users/souvik-ray/received_events","type":"User","site_admin":false},"body":"This is a standard annotation in java (mainly eclipse) to supress type check warnings...\r\nThis supresses type check warnings....\r\n(Nothing to worry about this ... :)","created_at":"2016-06-21T07:33:05Z","updated_at":"2016-06-21T07:33:05Z","html_url":"https://github.com/JioCloud/SbsVolumeAsyncService/pull/2#discussion_r67820222","pull_request_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/pulls/comments/67820222"},"html":{"href":"https://github.com/JioCloud/SbsVolumeAsyncService/pull/2#discussion_r67820222"},"pull_request":{"href":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/pulls/2","id":73714747,"html_url":"https://github.com/JioCloud/SbsVolumeAsyncService/pull/2","diff_url":"https://github.com/JioCloud/SbsVolumeAsyncService/pull/2.diff","patch_url":"https://github.com/JioCloud/SbsVolumeAsyncService/pull/2.patch","issue_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/issues/2","number":2,"state":"open","locked":false,"title":"First Cut of SBS Volume Async Service [JBS-365]","user":{"login":"souvik-ray","id":16453607,"avatar_url":"https://avatars.githubusercontent.com/u/16453607?v=3","gravatar_id":"","url":"https://api.github.com/users/souvik-ray","html_url":"https://github.com/souvik-ray","followers_url":"https://api.github.com/users/souvik-ray/followers","following_url":"https://api.github.com/users/souvik-ray/following{/other_user}","gists_url":"https://api.github.com/users/souvik-ray/gists{/gist_id}","starred_url":"https://api.github.com/users/souvik-ray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/souvik-ray/subscriptions","organizations_url":"https://api.github.com/users/souvik-ray/orgs","repos_url":"https://api.github.com/users/souvik-ray/repos","events_url":"https://api.github.com/users/souvik-ray/events{/privacy}","received_events_url":"https://api.github.com/users/souvik-ray/received_events","type":"User","site_admin":false},"body":"Refer,\r\nhttp://atlas.jiocloudservices.com/mediawiki/index.php/Block_Storage_Team/SBSVolumeAsyncService\r\nhttps://jira.ril.com/browse/JBS-365","created_at":"2016-06-14T10:22:30Z","updated_at":"2016-06-21T07:33:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1dd506d0f1431c076c389824c6048e085045a7d5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/pulls/2/commits","review_comments_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/pulls/2/comments","review_comment_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/issues/2/comments","statuses_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/statuses/b2baf299793ea8cb3f578cf16f7a0675c74d4796","head":{"label":"JioCloud:souvik-commit2","ref":"souvik-commit2","sha":"b2baf299793ea8cb3f578cf16f7a0675c74d4796","user":{"login":"JioCloud","id":5500757,"avatar_url":"https://avatars.githubusercontent.com/u/5500757?v=3","gravatar_id":"","url":"https://api.github.com/users/JioCloud","html_url":"https://github.com/JioCloud","followers_url":"https://api.github.com/users/JioCloud/followers","following_url":"https://api.github.com/users/JioCloud/following{/other_user}","gists_url":"https://api.github.com/users/JioCloud/gists{/gist_id}","starred_url":"https://api.github.com/users/JioCloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JioCloud/subscriptions","organizations_url":"https://api.github.com/users/JioCloud/orgs","repos_url":"https://api.github.com/users/JioCloud/repos","events_url":"https://api.github.com/users/JioCloud/events{/privacy}","received_events_url":"https://api.github.com/users/JioCloud/received_events","type":"Organization","site_admin":false},"repo":{"id":60555718,"name":"SbsVolumeAsyncService","full_name":"JioCloud/SbsVolumeAsyncService","owner":{"login":"JioCloud","id":5500757,"avatar_url":"https://avatars.githubusercontent.com/u/5500757?v=3","gravatar_id":"","url":"https://api.github.com/users/JioCloud","html_url":"https://github.com/JioCloud","followers_url":"https://api.github.com/users/JioCloud/followers","following_url":"https://api.github.com/users/JioCloud/following{/other_user}","gists_url":"https://api.github.com/users/JioCloud/gists{/gist_id}","starred_url":"https://api.github.com/users/JioCloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JioCloud/subscriptions","organizations_url":"https://api.github.com/users/JioCloud/orgs","repos_url":"https://api.github.com/users/JioCloud/repos","events_url":"https://api.github.com/users/JioCloud/events{/privacy}","received_events_url":"https://api.github.com/users/JioCloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JioCloud/SbsVolumeAsyncService","description":"This is the repository for the SbsVolumeAsyncService","fork":false,"url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService","forks_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/forks","keys_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/teams","hooks_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/hooks","issue_events_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/issues/events{/number}","events_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/events","assignees_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/assignees{/user}","branches_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/branches{/branch}","tags_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/tags","blobs_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/git/refs{/sha}","trees_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/statuses/{sha}","languages_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/languages","stargazers_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/stargazers","contributors_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/contributors","subscribers_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/subscribers","subscription_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/subscription","commits_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/commits{/sha}","git_commits_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/git/commits{/sha}","comments_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/comments{/number}","issue_comment_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/issues/comments{/number}","contents_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/contents/{+path}","compare_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/merges","archive_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/downloads","issues_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/issues{/number}","pulls_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/pulls{/number}","milestones_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/milestones{/number}","notifications_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/labels{/name}","releases_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/releases{/id}","deployments_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/deployments","created_at":"2016-06-06T19:42:28Z","updated_at":"2016-06-06T19:42:28Z","pushed_at":"2016-06-14T10:22:30Z","git_url":"git://github.com/JioCloud/SbsVolumeAsyncService.git","ssh_url":"git@github.com:JioCloud/SbsVolumeAsyncService.git","clone_url":"https://github.com/JioCloud/SbsVolumeAsyncService.git","svn_url":"https://github.com/JioCloud/SbsVolumeAsyncService","homepage":null,"size":19645,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"JioCloud:master","ref":"master","sha":"915709f324c2ad101c99b618271370c1a9c052c9","user":{"login":"JioCloud","id":5500757,"avatar_url":"https://avatars.githubusercontent.com/u/5500757?v=3","gravatar_id":"","url":"https://api.github.com/users/JioCloud","html_url":"https://github.com/JioCloud","followers_url":"https://api.github.com/users/JioCloud/followers","following_url":"https://api.github.com/users/JioCloud/following{/other_user}","gists_url":"https://api.github.com/users/JioCloud/gists{/gist_id}","starred_url":"https://api.github.com/users/JioCloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JioCloud/subscriptions","organizations_url":"https://api.github.com/users/JioCloud/orgs","repos_url":"https://api.github.com/users/JioCloud/repos","events_url":"https://api.github.com/users/JioCloud/events{/privacy}","received_events_url":"https://api.github.com/users/JioCloud/received_events","type":"Organization","site_admin":false},"repo":{"id":60555718,"name":"SbsVolumeAsyncService","full_name":"JioCloud/SbsVolumeAsyncService","owner":{"login":"JioCloud","id":5500757,"avatar_url":"https://avatars.githubusercontent.com/u/5500757?v=3","gravatar_id":"","url":"https://api.github.com/users/JioCloud","html_url":"https://github.com/JioCloud","followers_url":"https://api.github.com/users/JioCloud/followers","following_url":"https://api.github.com/users/JioCloud/following{/other_user}","gists_url":"https://api.github.com/users/JioCloud/gists{/gist_id}","starred_url":"https://api.github.com/users/JioCloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JioCloud/subscriptions","organizations_url":"https://api.github.com/users/JioCloud/orgs","repos_url":"https://api.github.com/users/JioCloud/repos","events_url":"https://api.github.com/users/JioCloud/events{/privacy}","received_events_url":"https://api.github.com/users/JioCloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JioCloud/SbsVolumeAsyncService","description":"This is the repository for the SbsVolumeAsyncService","fork":false,"url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService","forks_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/forks","keys_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/teams","hooks_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/hooks","issue_events_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/issues/events{/number}","events_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/events","assignees_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/assignees{/user}","branches_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/branches{/branch}","tags_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/tags","blobs_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/git/refs{/sha}","trees_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/statuses/{sha}","languages_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/languages","stargazers_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/stargazers","contributors_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/contributors","subscribers_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/subscribers","subscription_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/subscription","commits_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/commits{/sha}","git_commits_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/git/commits{/sha}","comments_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/comments{/number}","issue_comment_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/issues/comments{/number}","contents_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/contents/{+path}","compare_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/merges","archive_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/downloads","issues_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/issues{/number}","pulls_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/pulls{/number}","milestones_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/milestones{/number}","notifications_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/labels{/name}","releases_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/releases{/id}","deployments_url":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/deployments","created_at":"2016-06-06T19:42:28Z","updated_at":"2016-06-06T19:42:28Z","pushed_at":"2016-06-14T10:22:30Z","git_url":"git://github.com/JioCloud/SbsVolumeAsyncService.git","ssh_url":"git@github.com:JioCloud/SbsVolumeAsyncService.git","clone_url":"https://github.com/JioCloud/SbsVolumeAsyncService.git","svn_url":"https://github.com/JioCloud/SbsVolumeAsyncService","homepage":null,"size":19645,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/pulls/2"},"html":{"href":"https://github.com/JioCloud/SbsVolumeAsyncService/pull/2"},"issue":{"href":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/issues/2"},"comments":{"href":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/JioCloud/SbsVolumeAsyncService/statuses/b2baf299793ea8cb3f578cf16f7a0675c74d4796"}}}}
{"actor":{"display_login":"souvik-ray"}}