{"action":"created","comment":{"url":"https://api.github.com/repos/droolsjbpm/guvnor/pulls/comments/34768255","id":34768255,"diff_hunk":"@@ -0,0 +1,211 @@\n+package org.guvnor.structure.client.editors.repository.clone;\n+\n+import com.github.gwtbootstrap.client.ui.constants.ControlGroupType;\n+import org.guvnor.structure.client.editors.repository.RepositoryPreferences;\n+import org.guvnor.structure.organizationalunit.OrganizationalUnit;\n+import org.guvnor.structure.organizationalunit.OrganizationalUnitService;\n+import org.guvnor.structure.repositories.Repository;\n+import org.guvnor.structure.repositories.RepositoryAlreadyExistsException;\n+import org.guvnor.structure.repositories.RepositoryService;\n+import org.jboss.errai.bus.client.api.messaging.Message;\n+import org.jboss.errai.common.client.api.Caller;\n+import org.jboss.errai.common.client.api.ErrorCallback;\n+import org.jboss.errai.common.client.api.RemoteCallback;\n+import org.jboss.errai.ioc.client.container.IOC;\n+import org.jboss.errai.ioc.client.container.IOCBeanDef;\n+import org.jboss.errai.ioc.client.container.IOCResolutionException;\n+import org.uberfire.client.mvp.PlaceManager;\n+import org.uberfire.mvp.impl.DefaultPlaceRequest;\n+import org.uberfire.util.URIUtil;\n+\n+import javax.annotation.PostConstruct;\n+import javax.enterprise.context.Dependent;\n+import javax.inject.Inject;\n+import java.util.Collection;\n+import java.util.HashMap;\n+import java.util.Map;\n+\n+@Dependent\n+public class CloneRepositoryPresenter implements CloneRepositoryView.Presenter {\n+\n+    private boolean isOuMandatory;\n+\n+    @Inject\n+    private CloneRepositoryView view;\n+\n+    @Inject\n+    private Caller<RepositoryService> repositoryService;\n+\n+    @Inject\n+    private Caller<OrganizationalUnitService> organizationalUnitService;\n+\n+    @Inject\n+    private PlaceManager placeManager;\n+\n+    private Map<String, OrganizationalUnit> availableOrganizationalUnits = new HashMap<String, OrganizationalUnit>();\n+\n+    @PostConstruct\n+    public void init() {\n+        isOuMandatory = isOuMandatory();\n+        view.init(this, isOuMandatory);\n+        populateOrganizationalUnits();\n+    }\n+\n+    @Override\n+    public void handleCancelClick() {\n+        view.hideForm();\n+    }\n+\n+    @Override\n+    public void handleCloneClick() {\n+        if ( view.isGitUrlEmpty() ) {\n+            view.setUrlGroupType( ControlGroupType.ERROR );\n+            view.setUrlHelpMandatory();\n+            return;\n+        } else if ( !URIUtil.isValid(view.getGitUrl()) ) {\n+            view.setUrlGroupType( ControlGroupType.ERROR );\n+            view.setUrlHelpInvalidFormat();\n+            return;\n+        } else {\n+            view.setUrlGroupType( ControlGroupType.NONE );\n+        }\n+        final String organizationalUnit = view.getOrganizationalUnit(view.getSelectedOrganizationalUnit());\n+        if ( isOuMandatory && !availableOrganizationalUnits.containsKey( organizationalUnit ) ) {\n+            view.setOrganizationalUnitGroupType( ControlGroupType.ERROR );\n+            view.setOrganizationalUnitHelpMandatory();\n+            return;\n+        } else {\n+            view.setOrganizationalUnitGroupType( ControlGroupType.NONE );\n+        }\n+\n+        if ( view.isNameEmpty() ) {\n+            view.setNameGroupType( ControlGroupType.ERROR );\n+            view.setNameHelpMandatory();","path":"guvnor-structure/guvnor-structure-client/src/main/java/org/guvnor/structure/client/editors/repository/clone/CloneRepositoryPresenter.java","position":83,"original_position":83,"commit_id":"dc4384b892e9a6f938ca728f02f860e2e25521ac","original_commit_id":"dc4384b892e9a6f938ca728f02f860e2e25521ac","user":{"login":"manstis","id":497544,"avatar_url":"https://avatars.githubusercontent.com/u/497544?v=3","gravatar_id":"","url":"https://api.github.com/users/manstis","html_url":"https://github.com/manstis","followers_url":"https://api.github.com/users/manstis/followers","following_url":"https://api.github.com/users/manstis/following{/other_user}","gists_url":"https://api.github.com/users/manstis/gists{/gist_id}","starred_url":"https://api.github.com/users/manstis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manstis/subscriptions","organizations_url":"https://api.github.com/users/manstis/orgs","repos_url":"https://api.github.com/users/manstis/repos","events_url":"https://api.github.com/users/manstis/events{/privacy}","received_events_url":"https://api.github.com/users/manstis/received_events","type":"User","site_admin":false},"body":"```view.showNameHelpManatoryMessage()``` would be better. You're not *setting* anything.","created_at":"2015-07-16T09:05:24Z","updated_at":"2015-07-16T09:05:24Z","html_url":"https://github.com/droolsjbpm/guvnor/pull/142#discussion_r34768255","pull_request_url":"https://api.github.com/repos/droolsjbpm/guvnor/pulls/142","_links":{"self":{"href":"https://api.github.com/repos/droolsjbpm/guvnor/pulls/comments/34768255"},"html":{"href":"https://github.com/droolsjbpm/guvnor/pull/142#discussion_r34768255"},"pull_request":{"href":"https://api.github.com/repos/droolsjbpm/guvnor/pulls/142"}}},"pull_request":{"url":"https://api.github.com/repos/droolsjbpm/guvnor/pulls/142","id":40023400,"html_url":"https://github.com/droolsjbpm/guvnor/pull/142","diff_url":"https://github.com/droolsjbpm/guvnor/pull/142.diff","patch_url":"https://github.com/droolsjbpm/guvnor/pull/142.patch","issue_url":"https://api.github.com/repos/droolsjbpm/guvnor/issues/142","number":142,"state":"open","locked":false,"title":"clone repo form refacotred to MVP","user":{"login":"jomarko","id":8044780,"avatar_url":"https://avatars.githubusercontent.com/u/8044780?v=3","gravatar_id":"","url":"https://api.github.com/users/jomarko","html_url":"https://github.com/jomarko","followers_url":"https://api.github.com/users/jomarko/followers","following_url":"https://api.github.com/users/jomarko/following{/other_user}","gists_url":"https://api.github.com/users/jomarko/gists{/gist_id}","starred_url":"https://api.github.com/users/jomarko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jomarko/subscriptions","organizations_url":"https://api.github.com/users/jomarko/orgs","repos_url":"https://api.github.com/users/jomarko/repos","events_url":"https://api.github.com/users/jomarko/events{/privacy}","received_events_url":"https://api.github.com/users/jomarko/received_events","type":"User","site_admin":false},"body":"PR for jira https://issues.jboss.org/browse/GUVNOR-2218","created_at":"2015-07-15T13:40:39Z","updated_at":"2015-07-16T09:05:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1315f69fd955cdad53c7b01889b2e0a5781c40bc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/droolsjbpm/guvnor/pulls/142/commits","review_comments_url":"https://api.github.com/repos/droolsjbpm/guvnor/pulls/142/comments","review_comment_url":"https://api.github.com/repos/droolsjbpm/guvnor/pulls/comments{/number}","comments_url":"https://api.github.com/repos/droolsjbpm/guvnor/issues/142/comments","statuses_url":"https://api.github.com/repos/droolsjbpm/guvnor/statuses/dc4384b892e9a6f938ca728f02f860e2e25521ac","head":{"label":"jomarko:GUVNOR-2218","ref":"GUVNOR-2218","sha":"dc4384b892e9a6f938ca728f02f860e2e25521ac","user":{"login":"jomarko","id":8044780,"avatar_url":"https://avatars.githubusercontent.com/u/8044780?v=3","gravatar_id":"","url":"https://api.github.com/users/jomarko","html_url":"https://github.com/jomarko","followers_url":"https://api.github.com/users/jomarko/followers","following_url":"https://api.github.com/users/jomarko/following{/other_user}","gists_url":"https://api.github.com/users/jomarko/gists{/gist_id}","starred_url":"https://api.github.com/users/jomarko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jomarko/subscriptions","organizations_url":"https://api.github.com/users/jomarko/orgs","repos_url":"https://api.github.com/users/jomarko/repos","events_url":"https://api.github.com/users/jomarko/events{/privacy}","received_events_url":"https://api.github.com/users/jomarko/received_events","type":"User","site_admin":false},"repo":{"id":38737658,"name":"guvnor","full_name":"jomarko/guvnor","owner":{"login":"jomarko","id":8044780,"avatar_url":"https://avatars.githubusercontent.com/u/8044780?v=3","gravatar_id":"","url":"https://api.github.com/users/jomarko","html_url":"https://github.com/jomarko","followers_url":"https://api.github.com/users/jomarko/followers","following_url":"https://api.github.com/users/jomarko/following{/other_user}","gists_url":"https://api.github.com/users/jomarko/gists{/gist_id}","starred_url":"https://api.github.com/users/jomarko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jomarko/subscriptions","organizations_url":"https://api.github.com/users/jomarko/orgs","repos_url":"https://api.github.com/users/jomarko/repos","events_url":"https://api.github.com/users/jomarko/events{/privacy}","received_events_url":"https://api.github.com/users/jomarko/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jomarko/guvnor","description":"Guvnor is the governance framework for KIE workbenches","fork":true,"url":"https://api.github.com/repos/jomarko/guvnor","forks_url":"https://api.github.com/repos/jomarko/guvnor/forks","keys_url":"https://api.github.com/repos/jomarko/guvnor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jomarko/guvnor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jomarko/guvnor/teams","hooks_url":"https://api.github.com/repos/jomarko/guvnor/hooks","issue_events_url":"https://api.github.com/repos/jomarko/guvnor/issues/events{/number}","events_url":"https://api.github.com/repos/jomarko/guvnor/events","assignees_url":"https://api.github.com/repos/jomarko/guvnor/assignees{/user}","branches_url":"https://api.github.com/repos/jomarko/guvnor/branches{/branch}","tags_url":"https://api.github.com/repos/jomarko/guvnor/tags","blobs_url":"https://api.github.com/repos/jomarko/guvnor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jomarko/guvnor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jomarko/guvnor/git/refs{/sha}","trees_url":"https://api.github.com/repos/jomarko/guvnor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jomarko/guvnor/statuses/{sha}","languages_url":"https://api.github.com/repos/jomarko/guvnor/languages","stargazers_url":"https://api.github.com/repos/jomarko/guvnor/stargazers","contributors_url":"https://api.github.com/repos/jomarko/guvnor/contributors","subscribers_url":"https://api.github.com/repos/jomarko/guvnor/subscribers","subscription_url":"https://api.github.com/repos/jomarko/guvnor/subscription","commits_url":"https://api.github.com/repos/jomarko/guvnor/commits{/sha}","git_commits_url":"https://api.github.com/repos/jomarko/guvnor/git/commits{/sha}","comments_url":"https://api.github.com/repos/jomarko/guvnor/comments{/number}","issue_comment_url":"https://api.github.com/repos/jomarko/guvnor/issues/comments{/number}","contents_url":"https://api.github.com/repos/jomarko/guvnor/contents/{+path}","compare_url":"https://api.github.com/repos/jomarko/guvnor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jomarko/guvnor/merges","archive_url":"https://api.github.com/repos/jomarko/guvnor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jomarko/guvnor/downloads","issues_url":"https://api.github.com/repos/jomarko/guvnor/issues{/number}","pulls_url":"https://api.github.com/repos/jomarko/guvnor/pulls{/number}","milestones_url":"https://api.github.com/repos/jomarko/guvnor/milestones{/number}","notifications_url":"https://api.github.com/repos/jomarko/guvnor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jomarko/guvnor/labels{/name}","releases_url":"https://api.github.com/repos/jomarko/guvnor/releases{/id}","created_at":"2015-07-08T07:00:17Z","updated_at":"2015-07-08T07:00:21Z","pushed_at":"2015-07-16T08:11:07Z","git_url":"git://github.com/jomarko/guvnor.git","ssh_url":"git@github.com:jomarko/guvnor.git","clone_url":"https://github.com/jomarko/guvnor.git","svn_url":"https://github.com/jomarko/guvnor","homepage":"http://www.jboss.org/drools/drools-guvnor","size":486757,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"droolsjbpm:master","ref":"master","sha":"19870232b3fc652c9733fece3175c0e3431c6390","user":{"login":"droolsjbpm","id":517980,"avatar_url":"https://avatars.githubusercontent.com/u/517980?v=3","gravatar_id":"","url":"https://api.github.com/users/droolsjbpm","html_url":"https://github.com/droolsjbpm","followers_url":"https://api.github.com/users/droolsjbpm/followers","following_url":"https://api.github.com/users/droolsjbpm/following{/other_user}","gists_url":"https://api.github.com/users/droolsjbpm/gists{/gist_id}","starred_url":"https://api.github.com/users/droolsjbpm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/droolsjbpm/subscriptions","organizations_url":"https://api.github.com/users/droolsjbpm/orgs","repos_url":"https://api.github.com/users/droolsjbpm/repos","events_url":"https://api.github.com/users/droolsjbpm/events{/privacy}","received_events_url":"https://api.github.com/users/droolsjbpm/received_events","type":"Organization","site_admin":false},"repo":{"id":1354561,"name":"guvnor","full_name":"droolsjbpm/guvnor","owner":{"login":"droolsjbpm","id":517980,"avatar_url":"https://avatars.githubusercontent.com/u/517980?v=3","gravatar_id":"","url":"https://api.github.com/users/droolsjbpm","html_url":"https://github.com/droolsjbpm","followers_url":"https://api.github.com/users/droolsjbpm/followers","following_url":"https://api.github.com/users/droolsjbpm/following{/other_user}","gists_url":"https://api.github.com/users/droolsjbpm/gists{/gist_id}","starred_url":"https://api.github.com/users/droolsjbpm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/droolsjbpm/subscriptions","organizations_url":"https://api.github.com/users/droolsjbpm/orgs","repos_url":"https://api.github.com/users/droolsjbpm/repos","events_url":"https://api.github.com/users/droolsjbpm/events{/privacy}","received_events_url":"https://api.github.com/users/droolsjbpm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/droolsjbpm/guvnor","description":"Guvnor is the governance framework for KIE workbenches","fork":false,"url":"https://api.github.com/repos/droolsjbpm/guvnor","forks_url":"https://api.github.com/repos/droolsjbpm/guvnor/forks","keys_url":"https://api.github.com/repos/droolsjbpm/guvnor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/droolsjbpm/guvnor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/droolsjbpm/guvnor/teams","hooks_url":"https://api.github.com/repos/droolsjbpm/guvnor/hooks","issue_events_url":"https://api.github.com/repos/droolsjbpm/guvnor/issues/events{/number}","events_url":"https://api.github.com/repos/droolsjbpm/guvnor/events","assignees_url":"https://api.github.com/repos/droolsjbpm/guvnor/assignees{/user}","branches_url":"https://api.github.com/repos/droolsjbpm/guvnor/branches{/branch}","tags_url":"https://api.github.com/repos/droolsjbpm/guvnor/tags","blobs_url":"https://api.github.com/repos/droolsjbpm/guvnor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/droolsjbpm/guvnor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/droolsjbpm/guvnor/git/refs{/sha}","trees_url":"https://api.github.com/repos/droolsjbpm/guvnor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/droolsjbpm/guvnor/statuses/{sha}","languages_url":"https://api.github.com/repos/droolsjbpm/guvnor/languages","stargazers_url":"https://api.github.com/repos/droolsjbpm/guvnor/stargazers","contributors_url":"https://api.github.com/repos/droolsjbpm/guvnor/contributors","subscribers_url":"https://api.github.com/repos/droolsjbpm/guvnor/subscribers","subscription_url":"https://api.github.com/repos/droolsjbpm/guvnor/subscription","commits_url":"https://api.github.com/repos/droolsjbpm/guvnor/commits{/sha}","git_commits_url":"https://api.github.com/repos/droolsjbpm/guvnor/git/commits{/sha}","comments_url":"https://api.github.com/repos/droolsjbpm/guvnor/comments{/number}","issue_comment_url":"https://api.github.com/repos/droolsjbpm/guvnor/issues/comments{/number}","contents_url":"https://api.github.com/repos/droolsjbpm/guvnor/contents/{+path}","compare_url":"https://api.github.com/repos/droolsjbpm/guvnor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/droolsjbpm/guvnor/merges","archive_url":"https://api.github.com/repos/droolsjbpm/guvnor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/droolsjbpm/guvnor/downloads","issues_url":"https://api.github.com/repos/droolsjbpm/guvnor/issues{/number}","pulls_url":"https://api.github.com/repos/droolsjbpm/guvnor/pulls{/number}","milestones_url":"https://api.github.com/repos/droolsjbpm/guvnor/milestones{/number}","notifications_url":"https://api.github.com/repos/droolsjbpm/guvnor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/droolsjbpm/guvnor/labels{/name}","releases_url":"https://api.github.com/repos/droolsjbpm/guvnor/releases{/id}","created_at":"2011-02-11T10:35:34Z","updated_at":"2015-05-08T09:04:50Z","pushed_at":"2015-07-16T08:11:08Z","git_url":"git://github.com/droolsjbpm/guvnor.git","ssh_url":"git@github.com:droolsjbpm/guvnor.git","clone_url":"https://github.com/droolsjbpm/guvnor.git","svn_url":"https://github.com/droolsjbpm/guvnor","homepage":"http://www.jboss.org/drools/drools-guvnor","size":527486,"stargazers_count":148,"watchers_count":148,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":294,"mirror_url":null,"open_issues_count":1,"forks":294,"open_issues":1,"watchers":148,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/droolsjbpm/guvnor/pulls/142"},"html":{"href":"https://github.com/droolsjbpm/guvnor/pull/142"},"issue":{"href":"https://api.github.com/repos/droolsjbpm/guvnor/issues/142"},"comments":{"href":"https://api.github.com/repos/droolsjbpm/guvnor/issues/142/comments"},"review_comments":{"href":"https://api.github.com/repos/droolsjbpm/guvnor/pulls/142/comments"},"review_comment":{"href":"https://api.github.com/repos/droolsjbpm/guvnor/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/droolsjbpm/guvnor/pulls/142/commits"},"statuses":{"href":"https://api.github.com/repos/droolsjbpm/guvnor/statuses/dc4384b892e9a6f938ca728f02f860e2e25521ac"}}}}