{"action":"created","comment":{"url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/pulls/comments/171599779","pull_request_review_id":100480782,"id":171599779,"diff_hunk":"@@ -0,0 +1,510 @@\n+package util;\n+\n+import android.util.Log;\n+\n+import org.apache.commons.lang3.StringUtils;\n+import org.smartregister.domain.jsonmapping.Location;\n+import org.smartregister.domain.jsonmapping.util.LocationTree;\n+import org.smartregister.domain.jsonmapping.util.TreeNode;\n+import org.smartregister.path.application.VaccinatorApplication;\n+import org.smartregister.path.domain.jsonmapping.FormLocation;\n+import org.smartregister.path.view.LocationPickerView;\n+import org.smartregister.repository.AllSharedPreferences;\n+import org.smartregister.util.AssetHandler;\n+\n+import java.util.ArrayList;\n+import java.util.Collections;\n+import java.util.HashMap;\n+import java.util.LinkedHashMap;\n+import java.util.List;\n+import java.util.Map;\n+import java.util.Set;\n+import java.util.regex.Matcher;\n+import java.util.regex.Pattern;\n+\n+/**\n+ * Created by keyman on 3/1/2018.\n+ */\n+\n+public class LocationUtils {\n+    private static final String TAG = \"LocationUtils\";\n+\n+    public static ArrayList<String> locationsFromHierarchy() {\n+        return locationsFromHierarchy(null);\n+    }\n+\n+    public static ArrayList<String> locationsFromHierarchy(String defaultLocation) {\n+        ArrayList<String> locations = new ArrayList<>();\n+        try {\n+            LinkedHashMap<String, TreeNode<String, Location>> map = map();\n+            if (map != null) {\n+                for (Map.Entry<String, TreeNode<String, Location>> entry : map.entrySet()) {\n+                    List<String> foundLocations = extractLocations(entry.getValue(), defaultLocation);\n+                    if (!Utils.isEmptyCollection(foundLocations)) {\n+                        locations.addAll(foundLocations);\n+                    }\n+                }\n+            }\n+        } catch (Exception e) {\n+            android.util.Log.e(Utils.class.getCanonicalName(), android.util.Log.getStackTraceString(e));","path":"opensrp-path/src/main/java/util/LocationUtils.java","position":49,"original_position":49,"commit_id":"5fa0a1b804a2dea24acf41af46d21831988eaa67","original_commit_id":"5fa0a1b804a2dea24acf41af46d21831988eaa67","user":{"login":"codacy-bot","id":19940114,"avatar_url":"https://avatars1.githubusercontent.com/u/19940114?v=4","gravatar_id":"","url":"https://api.github.com/users/codacy-bot","html_url":"https://github.com/codacy-bot","followers_url":"https://api.github.com/users/codacy-bot/followers","following_url":"https://api.github.com/users/codacy-bot/following{/other_user}","gists_url":"https://api.github.com/users/codacy-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/codacy-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codacy-bot/subscriptions","organizations_url":"https://api.github.com/users/codacy-bot/orgs","repos_url":"https://api.github.com/users/codacy-bot/repos","events_url":"https://api.github.com/users/codacy-bot/events{/privacy}","received_events_url":"https://api.github.com/users/codacy-bot/received_events","type":"User","site_admin":false},"body":"![Codacy](https://app.codacy.com/assets/images/favicon.png) Issue found: [Unnecessary use of fully qualified name 'android.util.Log.e' due to existing import 'android.util.Log'](https://app.codacy.com/app/OpenSRP/opensrp-client-path/pullRequest?prid=1386762)","created_at":"2018-03-01T15:45:28Z","updated_at":"2018-03-01T15:45:28Z","html_url":"https://github.com/OpenSRP/opensrp-client-path/pull/272#discussion_r171599779","pull_request_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/pulls/272","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/OpenSRP/opensrp-client-path/pulls/comments/171599779"},"html":{"href":"https://github.com/OpenSRP/opensrp-client-path/pull/272#discussion_r171599779"},"pull_request":{"href":"https://api.github.com/repos/OpenSRP/opensrp-client-path/pulls/272"}}},"pull_request":{"url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/pulls/272","id":172272602,"html_url":"https://github.com/OpenSRP/opensrp-client-path/pull/272","diff_url":"https://github.com/OpenSRP/opensrp-client-path/pull/272.diff","patch_url":"https://github.com/OpenSRP/opensrp-client-path/pull/272.patch","issue_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/issues/272","number":272,"state":"open","locked":false,"title":"Login clean up","user":{"login":"keymane","id":13656416,"avatar_url":"https://avatars3.githubusercontent.com/u/13656416?v=4","gravatar_id":"","url":"https://api.github.com/users/keymane","html_url":"https://github.com/keymane","followers_url":"https://api.github.com/users/keymane/followers","following_url":"https://api.github.com/users/keymane/following{/other_user}","gists_url":"https://api.github.com/users/keymane/gists{/gist_id}","starred_url":"https://api.github.com/users/keymane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keymane/subscriptions","organizations_url":"https://api.github.com/users/keymane/orgs","repos_url":"https://api.github.com/users/keymane/repos","events_url":"https://api.github.com/users/keymane/events{/privacy}","received_events_url":"https://api.github.com/users/keymane/received_events","type":"User","site_admin":false},"body":"Depends on https://github.com/OpenSRP/opensrp-client-core/pull/57","created_at":"2018-03-01T15:41:37Z","updated_at":"2018-03-01T15:45:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"510137c36f676c342d4a7df46ddef981f9970cac","assignee":null,"assignees":[],"requested_reviewers":[{"login":"githengi","id":25123762,"avatar_url":"https://avatars1.githubusercontent.com/u/25123762?v=4","gravatar_id":"","url":"https://api.github.com/users/githengi","html_url":"https://github.com/githengi","followers_url":"https://api.github.com/users/githengi/followers","following_url":"https://api.github.com/users/githengi/following{/other_user}","gists_url":"https://api.github.com/users/githengi/gists{/gist_id}","starred_url":"https://api.github.com/users/githengi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/githengi/subscriptions","organizations_url":"https://api.github.com/users/githengi/orgs","repos_url":"https://api.github.com/users/githengi/repos","events_url":"https://api.github.com/users/githengi/events{/privacy}","received_events_url":"https://api.github.com/users/githengi/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/pulls/272/commits","review_comments_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/pulls/272/comments","review_comment_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/issues/272/comments","statuses_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/statuses/5fa0a1b804a2dea24acf41af46d21831988eaa67","head":{"label":"OpenSRP:issue253","ref":"issue253","sha":"5fa0a1b804a2dea24acf41af46d21831988eaa67","user":{"login":"OpenSRP","id":7898027,"avatar_url":"https://avatars1.githubusercontent.com/u/7898027?v=4","gravatar_id":"","url":"https://api.github.com/users/OpenSRP","html_url":"https://github.com/OpenSRP","followers_url":"https://api.github.com/users/OpenSRP/followers","following_url":"https://api.github.com/users/OpenSRP/following{/other_user}","gists_url":"https://api.github.com/users/OpenSRP/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenSRP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenSRP/subscriptions","organizations_url":"https://api.github.com/users/OpenSRP/orgs","repos_url":"https://api.github.com/users/OpenSRP/repos","events_url":"https://api.github.com/users/OpenSRP/events{/privacy}","received_events_url":"https://api.github.com/users/OpenSRP/received_events","type":"Organization","site_admin":false},"repo":{"id":97621363,"name":"opensrp-client-path","full_name":"OpenSRP/opensrp-client-path","owner":{"login":"OpenSRP","id":7898027,"avatar_url":"https://avatars1.githubusercontent.com/u/7898027?v=4","gravatar_id":"","url":"https://api.github.com/users/OpenSRP","html_url":"https://github.com/OpenSRP","followers_url":"https://api.github.com/users/OpenSRP/followers","following_url":"https://api.github.com/users/OpenSRP/following{/other_user}","gists_url":"https://api.github.com/users/OpenSRP/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenSRP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenSRP/subscriptions","organizations_url":"https://api.github.com/users/OpenSRP/orgs","repos_url":"https://api.github.com/users/OpenSRP/repos","events_url":"https://api.github.com/users/OpenSRP/events{/privacy}","received_events_url":"https://api.github.com/users/OpenSRP/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OpenSRP/opensrp-client-path","description":null,"fork":false,"url":"https://api.github.com/repos/OpenSRP/opensrp-client-path","forks_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/forks","keys_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/teams","hooks_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/hooks","issue_events_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/issues/events{/number}","events_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/events","assignees_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/assignees{/user}","branches_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/branches{/branch}","tags_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/tags","blobs_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/git/refs{/sha}","trees_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/statuses/{sha}","languages_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/languages","stargazers_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/stargazers","contributors_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/contributors","subscribers_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/subscribers","subscription_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/subscription","commits_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/commits{/sha}","git_commits_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/git/commits{/sha}","comments_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/comments{/number}","issue_comment_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/issues/comments{/number}","contents_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/contents/{+path}","compare_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/merges","archive_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/downloads","issues_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/issues{/number}","pulls_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/pulls{/number}","milestones_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/milestones{/number}","notifications_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/labels{/name}","releases_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/releases{/id}","deployments_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/deployments","created_at":"2017-07-18T16:35:27Z","updated_at":"2018-02-28T12:20:05Z","pushed_at":"2018-03-01T15:41:37Z","git_url":"git://github.com/OpenSRP/opensrp-client-path.git","ssh_url":"git@github.com:OpenSRP/opensrp-client-path.git","clone_url":"https://github.com/OpenSRP/opensrp-client-path.git","svn_url":"https://github.com/OpenSRP/opensrp-client-path","homepage":null,"size":80935,"stargazers_count":4,"watchers_count":4,"language":"Java","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":73,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":2,"open_issues":73,"watchers":4,"default_branch":"master"}},"base":{"label":"OpenSRP:master","ref":"master","sha":"c92fc2e779cf7bcac5459b563bb3994929fcfa84","user":{"login":"OpenSRP","id":7898027,"avatar_url":"https://avatars1.githubusercontent.com/u/7898027?v=4","gravatar_id":"","url":"https://api.github.com/users/OpenSRP","html_url":"https://github.com/OpenSRP","followers_url":"https://api.github.com/users/OpenSRP/followers","following_url":"https://api.github.com/users/OpenSRP/following{/other_user}","gists_url":"https://api.github.com/users/OpenSRP/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenSRP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenSRP/subscriptions","organizations_url":"https://api.github.com/users/OpenSRP/orgs","repos_url":"https://api.github.com/users/OpenSRP/repos","events_url":"https://api.github.com/users/OpenSRP/events{/privacy}","received_events_url":"https://api.github.com/users/OpenSRP/received_events","type":"Organization","site_admin":false},"repo":{"id":97621363,"name":"opensrp-client-path","full_name":"OpenSRP/opensrp-client-path","owner":{"login":"OpenSRP","id":7898027,"avatar_url":"https://avatars1.githubusercontent.com/u/7898027?v=4","gravatar_id":"","url":"https://api.github.com/users/OpenSRP","html_url":"https://github.com/OpenSRP","followers_url":"https://api.github.com/users/OpenSRP/followers","following_url":"https://api.github.com/users/OpenSRP/following{/other_user}","gists_url":"https://api.github.com/users/OpenSRP/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenSRP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenSRP/subscriptions","organizations_url":"https://api.github.com/users/OpenSRP/orgs","repos_url":"https://api.github.com/users/OpenSRP/repos","events_url":"https://api.github.com/users/OpenSRP/events{/privacy}","received_events_url":"https://api.github.com/users/OpenSRP/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OpenSRP/opensrp-client-path","description":null,"fork":false,"url":"https://api.github.com/repos/OpenSRP/opensrp-client-path","forks_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/forks","keys_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/teams","hooks_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/hooks","issue_events_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/issues/events{/number}","events_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/events","assignees_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/assignees{/user}","branches_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/branches{/branch}","tags_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/tags","blobs_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/git/refs{/sha}","trees_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/statuses/{sha}","languages_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/languages","stargazers_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/stargazers","contributors_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/contributors","subscribers_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/subscribers","subscription_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/subscription","commits_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/commits{/sha}","git_commits_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/git/commits{/sha}","comments_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/comments{/number}","issue_comment_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/issues/comments{/number}","contents_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/contents/{+path}","compare_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/merges","archive_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/downloads","issues_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/issues{/number}","pulls_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/pulls{/number}","milestones_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/milestones{/number}","notifications_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/labels{/name}","releases_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/releases{/id}","deployments_url":"https://api.github.com/repos/OpenSRP/opensrp-client-path/deployments","created_at":"2017-07-18T16:35:27Z","updated_at":"2018-02-28T12:20:05Z","pushed_at":"2018-03-01T15:41:37Z","git_url":"git://github.com/OpenSRP/opensrp-client-path.git","ssh_url":"git@github.com:OpenSRP/opensrp-client-path.git","clone_url":"https://github.com/OpenSRP/opensrp-client-path.git","svn_url":"https://github.com/OpenSRP/opensrp-client-path","homepage":null,"size":80935,"stargazers_count":4,"watchers_count":4,"language":"Java","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":73,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":2,"open_issues":73,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/OpenSRP/opensrp-client-path/pulls/272"},"html":{"href":"https://github.com/OpenSRP/opensrp-client-path/pull/272"},"issue":{"href":"https://api.github.com/repos/OpenSRP/opensrp-client-path/issues/272"},"comments":{"href":"https://api.github.com/repos/OpenSRP/opensrp-client-path/issues/272/comments"},"review_comments":{"href":"https://api.github.com/repos/OpenSRP/opensrp-client-path/pulls/272/comments"},"review_comment":{"href":"https://api.github.com/repos/OpenSRP/opensrp-client-path/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OpenSRP/opensrp-client-path/pulls/272/commits"},"statuses":{"href":"https://api.github.com/repos/OpenSRP/opensrp-client-path/statuses/5fa0a1b804a2dea24acf41af46d21831988eaa67"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"codacy-bot"}}