{"action":"created","comment":{"url":"https://api.github.com/repos/strongbox/strongbox/pulls/comments/106655773","pull_request_review_id":27590559,"id":106655773,"diff_hunk":"@@ -65,141 +57,74 @@ public void init()\n     }\n \n     @Override\n-    @Cacheable(value = USERS_CACHE,\n-               key = \"#name\",\n-               sync = true)\n-    public User findByUserName(String name)\n+    public Class<User> getEntityClass()\n     {\n-        try\n-        {\n-            // TODO find more appropriate place for detaching in some place\n-            // where actual generated query will be executed\n-            return databaseTx.detachAll(repository.findByUsername(name), true);\n-        }\n-        catch (Exception e)\n-        {\n-            logger.warn(\"Internal spring-data-orientdb exception: \" + e.getLocalizedMessage());\n-            logger.trace(\"Exception details: \", e);\n-\n-            usersCache.evict(name);\n-\n-            return null;\n-        }\n+        return User.class;\n     }\n \n     @Override\n-    @Transactional(propagation = Propagation.REQUIRES_NEW)\n-    public <S extends User> S save(S newUser)\n-    {\n-        S user = repository.save(newUser);\n-        usersCache.put(user.getUsername(), user);\n-\n-        return user;\n-    }\n-\n-    @Override\n-    public <S extends User> Iterable<S> save(Iterable<S> var1)\n-    {\n-        return repository.save(var1);\n-    }\n-\n-    @Override\n-    public Optional<User> findOne(String var1)\n+    @Cacheable(value = USERS_CACHE, key = \"#name\", sync = true)\n+    public User findByUserName(String name)\n     {\n-        if (var1 == null)\n-        {\n-            return Optional.empty();\n-        }\n+        String sQuery = String.format(\"select * from %s where userName=:userName\", getEntityClass().getSimpleName(),\n+                                      name);\n+        OSQLSynchQuery<Long> oQuery = new OSQLSynchQuery<Long>(sQuery);\n+        oQuery.setLimit(1);\n+        HashMap<String, String> params = new HashMap<String, String>();\n+        params.put(\"userName\", name);\n \n-        User user = repository.findOne(var1);\n-        if (user != null)\n-        {\n-            usersCache.put(user.getUsername(), user);\n-            return Optional.of(user);\n-        }\n-        else\n-        {\n-            return Optional.empty();\n-        }\n-    }\n-\n-    @Override\n-    public boolean exists(String var1)\n-    {\n-        return repository.exists(var1);\n+        List<User> resultList = getDelegate().command(oQuery).execute(params);\n+        return resultList.size() > 0 ? resultList.iterator().next() : null;","path":"strongbox-user-management/src/main/java/org/carlspring/strongbox/users/service/impl/UserServiceImpl.java","position":145,"original_position":145,"commit_id":"5554f652c7e8d6fae151f59d26bb652b1fa452a5","original_commit_id":"5554f652c7e8d6fae151f59d26bb652b1fa452a5","user":{"login":"cs-devops-bot","id":20419677,"avatar_url":"https://avatars0.githubusercontent.com/u/20419677?v=3","gravatar_id":"","url":"https://api.github.com/users/cs-devops-bot","html_url":"https://github.com/cs-devops-bot","followers_url":"https://api.github.com/users/cs-devops-bot/followers","following_url":"https://api.github.com/users/cs-devops-bot/following{/other_user}","gists_url":"https://api.github.com/users/cs-devops-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/cs-devops-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cs-devops-bot/subscriptions","organizations_url":"https://api.github.com/users/cs-devops-bot/orgs","repos_url":"https://api.github.com/users/cs-devops-bot/repos","events_url":"https://api.github.com/users/cs-devops-bot/events{/privacy}","received_events_url":"https://api.github.com/users/cs-devops-bot/received_events","type":"User","site_admin":false},"body":"![MAJOR](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-major.png 'Severity: MAJOR') Use isEmpty() to check whether the collection is empty or not. [![rule](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/rule.png)](https://dev.carlspring.org/sonar/coding_rules#rule_key=squid%3AS1155)\n","created_at":"2017-03-17T14:03:16Z","updated_at":"2017-03-17T14:03:16Z","html_url":"https://github.com/strongbox/strongbox/pull/224#discussion_r106655773","pull_request_url":"https://api.github.com/repos/strongbox/strongbox/pulls/224","_links":{"self":{"href":"https://api.github.com/repos/strongbox/strongbox/pulls/comments/106655773"},"html":{"href":"https://github.com/strongbox/strongbox/pull/224#discussion_r106655773"},"pull_request":{"href":"https://api.github.com/repos/strongbox/strongbox/pulls/224"}}},"pull_request":{"url":"https://api.github.com/repos/strongbox/strongbox/pulls/224","id":111263977,"html_url":"https://github.com/strongbox/strongbox/pull/224","diff_url":"https://github.com/strongbox/strongbox/pull/224.diff","patch_url":"https://github.com/strongbox/strongbox/pull/224.patch","issue_url":"https://api.github.com/repos/strongbox/strongbox/issues/224","number":224,"state":"open","locked":false,"title":"Sb 731","user":{"login":"sbespalov","id":22783811,"avatar_url":"https://avatars1.githubusercontent.com/u/22783811?v=3","gravatar_id":"","url":"https://api.github.com/users/sbespalov","html_url":"https://github.com/sbespalov","followers_url":"https://api.github.com/users/sbespalov/followers","following_url":"https://api.github.com/users/sbespalov/following{/other_user}","gists_url":"https://api.github.com/users/sbespalov/gists{/gist_id}","starred_url":"https://api.github.com/users/sbespalov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbespalov/subscriptions","organizations_url":"https://api.github.com/users/sbespalov/orgs","repos_url":"https://api.github.com/users/sbespalov/repos","events_url":"https://api.github.com/users/sbespalov/events{/privacy}","received_events_url":"https://api.github.com/users/sbespalov/received_events","type":"User","site_admin":false},"body":"SB-731 + many transactional issues fixed","created_at":"2017-03-17T11:40:52Z","updated_at":"2017-03-17T14:03:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c75fc08be44aa89bd1af219fea9f32521f0b5e7f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/strongbox/strongbox/pulls/224/commits","review_comments_url":"https://api.github.com/repos/strongbox/strongbox/pulls/224/comments","review_comment_url":"https://api.github.com/repos/strongbox/strongbox/pulls/comments{/number}","comments_url":"https://api.github.com/repos/strongbox/strongbox/issues/224/comments","statuses_url":"https://api.github.com/repos/strongbox/strongbox/statuses/5554f652c7e8d6fae151f59d26bb652b1fa452a5","head":{"label":"sbespalov:SB-731","ref":"SB-731","sha":"5554f652c7e8d6fae151f59d26bb652b1fa452a5","user":{"login":"sbespalov","id":22783811,"avatar_url":"https://avatars1.githubusercontent.com/u/22783811?v=3","gravatar_id":"","url":"https://api.github.com/users/sbespalov","html_url":"https://github.com/sbespalov","followers_url":"https://api.github.com/users/sbespalov/followers","following_url":"https://api.github.com/users/sbespalov/following{/other_user}","gists_url":"https://api.github.com/users/sbespalov/gists{/gist_id}","starred_url":"https://api.github.com/users/sbespalov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbespalov/subscriptions","organizations_url":"https://api.github.com/users/sbespalov/orgs","repos_url":"https://api.github.com/users/sbespalov/repos","events_url":"https://api.github.com/users/sbespalov/events{/privacy}","received_events_url":"https://api.github.com/users/sbespalov/received_events","type":"User","site_admin":false},"repo":{"id":72494340,"name":"strongbox","full_name":"sbespalov/strongbox","owner":{"login":"sbespalov","id":22783811,"avatar_url":"https://avatars1.githubusercontent.com/u/22783811?v=3","gravatar_id":"","url":"https://api.github.com/users/sbespalov","html_url":"https://github.com/sbespalov","followers_url":"https://api.github.com/users/sbespalov/followers","following_url":"https://api.github.com/users/sbespalov/following{/other_user}","gists_url":"https://api.github.com/users/sbespalov/gists{/gist_id}","starred_url":"https://api.github.com/users/sbespalov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbespalov/subscriptions","organizations_url":"https://api.github.com/users/sbespalov/orgs","repos_url":"https://api.github.com/users/sbespalov/repos","events_url":"https://api.github.com/users/sbespalov/events{/privacy}","received_events_url":"https://api.github.com/users/sbespalov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sbespalov/strongbox","description":null,"fork":true,"url":"https://api.github.com/repos/sbespalov/strongbox","forks_url":"https://api.github.com/repos/sbespalov/strongbox/forks","keys_url":"https://api.github.com/repos/sbespalov/strongbox/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sbespalov/strongbox/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sbespalov/strongbox/teams","hooks_url":"https://api.github.com/repos/sbespalov/strongbox/hooks","issue_events_url":"https://api.github.com/repos/sbespalov/strongbox/issues/events{/number}","events_url":"https://api.github.com/repos/sbespalov/strongbox/events","assignees_url":"https://api.github.com/repos/sbespalov/strongbox/assignees{/user}","branches_url":"https://api.github.com/repos/sbespalov/strongbox/branches{/branch}","tags_url":"https://api.github.com/repos/sbespalov/strongbox/tags","blobs_url":"https://api.github.com/repos/sbespalov/strongbox/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sbespalov/strongbox/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sbespalov/strongbox/git/refs{/sha}","trees_url":"https://api.github.com/repos/sbespalov/strongbox/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sbespalov/strongbox/statuses/{sha}","languages_url":"https://api.github.com/repos/sbespalov/strongbox/languages","stargazers_url":"https://api.github.com/repos/sbespalov/strongbox/stargazers","contributors_url":"https://api.github.com/repos/sbespalov/strongbox/contributors","subscribers_url":"https://api.github.com/repos/sbespalov/strongbox/subscribers","subscription_url":"https://api.github.com/repos/sbespalov/strongbox/subscription","commits_url":"https://api.github.com/repos/sbespalov/strongbox/commits{/sha}","git_commits_url":"https://api.github.com/repos/sbespalov/strongbox/git/commits{/sha}","comments_url":"https://api.github.com/repos/sbespalov/strongbox/comments{/number}","issue_comment_url":"https://api.github.com/repos/sbespalov/strongbox/issues/comments{/number}","contents_url":"https://api.github.com/repos/sbespalov/strongbox/contents/{+path}","compare_url":"https://api.github.com/repos/sbespalov/strongbox/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sbespalov/strongbox/merges","archive_url":"https://api.github.com/repos/sbespalov/strongbox/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sbespalov/strongbox/downloads","issues_url":"https://api.github.com/repos/sbespalov/strongbox/issues{/number}","pulls_url":"https://api.github.com/repos/sbespalov/strongbox/pulls{/number}","milestones_url":"https://api.github.com/repos/sbespalov/strongbox/milestones{/number}","notifications_url":"https://api.github.com/repos/sbespalov/strongbox/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sbespalov/strongbox/labels{/name}","releases_url":"https://api.github.com/repos/sbespalov/strongbox/releases{/id}","deployments_url":"https://api.github.com/repos/sbespalov/strongbox/deployments","created_at":"2016-11-01T01:54:58Z","updated_at":"2016-11-01T01:55:00Z","pushed_at":"2017-03-17T13:40:54Z","git_url":"git://github.com/sbespalov/strongbox.git","ssh_url":"git@github.com:sbespalov/strongbox.git","clone_url":"https://github.com/sbespalov/strongbox.git","svn_url":"https://github.com/sbespalov/strongbox","homepage":null,"size":4371,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"strongbox:master","ref":"master","sha":"9ca479896f8d7e04e67045689ffd9151bd4017f8","user":{"login":"strongbox","id":5637881,"avatar_url":"https://avatars3.githubusercontent.com/u/5637881?v=3","gravatar_id":"","url":"https://api.github.com/users/strongbox","html_url":"https://github.com/strongbox","followers_url":"https://api.github.com/users/strongbox/followers","following_url":"https://api.github.com/users/strongbox/following{/other_user}","gists_url":"https://api.github.com/users/strongbox/gists{/gist_id}","starred_url":"https://api.github.com/users/strongbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strongbox/subscriptions","organizations_url":"https://api.github.com/users/strongbox/orgs","repos_url":"https://api.github.com/users/strongbox/repos","events_url":"https://api.github.com/users/strongbox/events{/privacy}","received_events_url":"https://api.github.com/users/strongbox/received_events","type":"Organization","site_admin":false},"repo":{"id":11830269,"name":"strongbox","full_name":"strongbox/strongbox","owner":{"login":"strongbox","id":5637881,"avatar_url":"https://avatars3.githubusercontent.com/u/5637881?v=3","gravatar_id":"","url":"https://api.github.com/users/strongbox","html_url":"https://github.com/strongbox","followers_url":"https://api.github.com/users/strongbox/followers","following_url":"https://api.github.com/users/strongbox/following{/other_user}","gists_url":"https://api.github.com/users/strongbox/gists{/gist_id}","starred_url":"https://api.github.com/users/strongbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strongbox/subscriptions","organizations_url":"https://api.github.com/users/strongbox/orgs","repos_url":"https://api.github.com/users/strongbox/repos","events_url":"https://api.github.com/users/strongbox/events{/privacy}","received_events_url":"https://api.github.com/users/strongbox/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/strongbox/strongbox","description":null,"fork":false,"url":"https://api.github.com/repos/strongbox/strongbox","forks_url":"https://api.github.com/repos/strongbox/strongbox/forks","keys_url":"https://api.github.com/repos/strongbox/strongbox/keys{/key_id}","collaborators_url":"https://api.github.com/repos/strongbox/strongbox/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/strongbox/strongbox/teams","hooks_url":"https://api.github.com/repos/strongbox/strongbox/hooks","issue_events_url":"https://api.github.com/repos/strongbox/strongbox/issues/events{/number}","events_url":"https://api.github.com/repos/strongbox/strongbox/events","assignees_url":"https://api.github.com/repos/strongbox/strongbox/assignees{/user}","branches_url":"https://api.github.com/repos/strongbox/strongbox/branches{/branch}","tags_url":"https://api.github.com/repos/strongbox/strongbox/tags","blobs_url":"https://api.github.com/repos/strongbox/strongbox/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/strongbox/strongbox/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/strongbox/strongbox/git/refs{/sha}","trees_url":"https://api.github.com/repos/strongbox/strongbox/git/trees{/sha}","statuses_url":"https://api.github.com/repos/strongbox/strongbox/statuses/{sha}","languages_url":"https://api.github.com/repos/strongbox/strongbox/languages","stargazers_url":"https://api.github.com/repos/strongbox/strongbox/stargazers","contributors_url":"https://api.github.com/repos/strongbox/strongbox/contributors","subscribers_url":"https://api.github.com/repos/strongbox/strongbox/subscribers","subscription_url":"https://api.github.com/repos/strongbox/strongbox/subscription","commits_url":"https://api.github.com/repos/strongbox/strongbox/commits{/sha}","git_commits_url":"https://api.github.com/repos/strongbox/strongbox/git/commits{/sha}","comments_url":"https://api.github.com/repos/strongbox/strongbox/comments{/number}","issue_comment_url":"https://api.github.com/repos/strongbox/strongbox/issues/comments{/number}","contents_url":"https://api.github.com/repos/strongbox/strongbox/contents/{+path}","compare_url":"https://api.github.com/repos/strongbox/strongbox/compare/{base}...{head}","merges_url":"https://api.github.com/repos/strongbox/strongbox/merges","archive_url":"https://api.github.com/repos/strongbox/strongbox/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/strongbox/strongbox/downloads","issues_url":"https://api.github.com/repos/strongbox/strongbox/issues{/number}","pulls_url":"https://api.github.com/repos/strongbox/strongbox/pulls{/number}","milestones_url":"https://api.github.com/repos/strongbox/strongbox/milestones{/number}","notifications_url":"https://api.github.com/repos/strongbox/strongbox/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/strongbox/strongbox/labels{/name}","releases_url":"https://api.github.com/repos/strongbox/strongbox/releases{/id}","deployments_url":"https://api.github.com/repos/strongbox/strongbox/deployments","created_at":"2013-08-01T23:27:37Z","updated_at":"2017-02-23T07:57:51Z","pushed_at":"2017-03-17T13:40:55Z","git_url":"git://github.com/strongbox/strongbox.git","ssh_url":"git@github.com:strongbox/strongbox.git","clone_url":"https://github.com/strongbox/strongbox.git","svn_url":"https://github.com/strongbox/strongbox","homepage":null,"size":4338,"stargazers_count":8,"watchers_count":8,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":27,"mirror_url":null,"open_issues_count":5,"forks":27,"open_issues":5,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/strongbox/strongbox/pulls/224"},"html":{"href":"https://github.com/strongbox/strongbox/pull/224"},"issue":{"href":"https://api.github.com/repos/strongbox/strongbox/issues/224"},"comments":{"href":"https://api.github.com/repos/strongbox/strongbox/issues/224/comments"},"review_comments":{"href":"https://api.github.com/repos/strongbox/strongbox/pulls/224/comments"},"review_comment":{"href":"https://api.github.com/repos/strongbox/strongbox/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/strongbox/strongbox/pulls/224/commits"},"statuses":{"href":"https://api.github.com/repos/strongbox/strongbox/statuses/5554f652c7e8d6fae151f59d26bb652b1fa452a5"}}}}
{"actor":{"display_login":"cs-devops-bot"}}