{"action":"created","comment":{"url":"https://api.github.com/repos/broadinstitute/rawls/pulls/comments/33359999","id":33359999,"diff_hunk":"@@ -150,6 +158,57 @@ class WorkspaceService(dataSource: DataSource, workspaceDAO: WorkspaceDAO, entit\n       }\n     }\n \n+  def copyEntities(entityCopyDef: EntityCopyDefinition, uri: Uri): PerRequestMessage =\n+    dataSource inTransaction { txn =>\n+      val destNamespace = entityCopyDef.destinationWorkspace.namespace\n+      val destWorkspace = entityCopyDef.destinationWorkspace.name\n+\n+      val sourceNamespace = entityCopyDef.sourceWorkspace.namespace\n+      val sourceWorkspace = entityCopyDef.sourceWorkspace.name\n+\n+      val entityNames = entityCopyDef.entityNames\n+      val entityType = entityCopyDef.entityType\n+\n+      val conflicts = entityDAO.copyEntities(destNamespace, destWorkspace, sourceNamespace, sourceWorkspace, entityType, entityNames, txn)\n+\n+      conflicts.size match {\n+        case 0 => {\n+          RequestComplete(StatusCodes.Created, workspaceDAO.load(destNamespace, destWorkspace, txn))\n+        }\n+        case _ => {\n+          val basePath = \"/\" + destNamespace + \"/\" + destWorkspace + \"/entities/\"\n+          val conflictUris = conflicts.map(conflict => uri.copy(path = Uri.Path(basePath + conflict.entityType + \"/\" + conflict.name)).toString())\n+          val conflictingEntities = ConflictingEntities(conflictUris)\n+          RequestComplete(StatusCodes.Conflict, conflictingEntities)\n+        }\n+      }\n+\n+\n+      /*withEntity(workspace, entityType, entityName, txn) { entity =>\n+        try {\n+          val updatedEntity = applyOperationsToEntity(entity, operations)\n+          RequestComplete(entityDAO.save(workspaceNamespace, workspaceName, updatedEntity, txn))\n+        } catch {\n+          case e: AttributeUpdateOperationException => RequestComplete(http.StatusCodes.BadRequest, s\"in $workspaceNamespace/$workspaceName, ${e.getMessage}\")\n+        }\n+      }*/\n+\n+    }\n+\n+  def getCopyConflicts(destNamespace: String, destWorkspace: String, entitiesToCopy: Seq[Entity]): Unit =\n+    dataSource inTransaction { txn =>\n+      val copyMap = entitiesToCopy.map { entity => (entity.entityType, entity.name) -> entity }.toMap\n+      val conflicts = entityDAO.listEntitiesAllTypes(destNamespace, destWorkspace, txn).toSeq.filter(entity => copyMap.keySet.contains(entity.entityType, entity.name))\n+      conflicts.size match {\n+        case 0 => //RequestComplete(StatusCodes.Created, entityDAO.cloneTheseEntities(entitiesToCopy, destNamespace, destWorkspace, txn))","path":"src/main/scala/org/broadinstitute/dsde/rawls/workspace/WorkspaceService.scala","position":97,"original_position":97,"commit_id":"9cbe39f5b0b27e0ddc63156ee7024d6e3f843341","original_commit_id":"9cbe39f5b0b27e0ddc63156ee7024d6e3f843341","user":{"login":"MatthewBemis","id":7257391,"avatar_url":"https://avatars.githubusercontent.com/u/7257391?v=3","gravatar_id":"","url":"https://api.github.com/users/MatthewBemis","html_url":"https://github.com/MatthewBemis","followers_url":"https://api.github.com/users/MatthewBemis/followers","following_url":"https://api.github.com/users/MatthewBemis/following{/other_user}","gists_url":"https://api.github.com/users/MatthewBemis/gists{/gist_id}","starred_url":"https://api.github.com/users/MatthewBemis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MatthewBemis/subscriptions","organizations_url":"https://api.github.com/users/MatthewBemis/orgs","repos_url":"https://api.github.com/users/MatthewBemis/repos","events_url":"https://api.github.com/users/MatthewBemis/events{/privacy}","received_events_url":"https://api.github.com/users/MatthewBemis/received_events","type":"User","site_admin":false},"body":"this should not be commented out","created_at":"2015-06-26T14:25:00Z","updated_at":"2015-06-26T14:25:00Z","html_url":"https://github.com/broadinstitute/rawls/pull/42#discussion_r33359999","pull_request_url":"https://api.github.com/repos/broadinstitute/rawls/pulls/42","_links":{"self":{"href":"https://api.github.com/repos/broadinstitute/rawls/pulls/comments/33359999"},"html":{"href":"https://github.com/broadinstitute/rawls/pull/42#discussion_r33359999"},"pull_request":{"href":"https://api.github.com/repos/broadinstitute/rawls/pulls/42"}}},"pull_request":{"url":"https://api.github.com/repos/broadinstitute/rawls/pulls/42","id":38558956,"html_url":"https://github.com/broadinstitute/rawls/pull/42","diff_url":"https://github.com/broadinstitute/rawls/pull/42.diff","patch_url":"https://github.com/broadinstitute/rawls/pull/42.patch","issue_url":"https://api.github.com/repos/broadinstitute/rawls/issues/42","number":42,"state":"open","locked":false,"title":"copy entities from one workspace into another","user":{"login":"MatthewBemis","id":7257391,"avatar_url":"https://avatars.githubusercontent.com/u/7257391?v=3","gravatar_id":"","url":"https://api.github.com/users/MatthewBemis","html_url":"https://github.com/MatthewBemis","followers_url":"https://api.github.com/users/MatthewBemis/followers","following_url":"https://api.github.com/users/MatthewBemis/following{/other_user}","gists_url":"https://api.github.com/users/MatthewBemis/gists{/gist_id}","starred_url":"https://api.github.com/users/MatthewBemis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MatthewBemis/subscriptions","organizations_url":"https://api.github.com/users/MatthewBemis/orgs","repos_url":"https://api.github.com/users/MatthewBemis/repos","events_url":"https://api.github.com/users/MatthewBemis/events{/privacy}","received_events_url":"https://api.github.com/users/MatthewBemis/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-06-25T15:18:56Z","updated_at":"2015-06-26T14:25:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"897d45407ae9b56672f0e284ac6ed9056b51f426","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/broadinstitute/rawls/pulls/42/commits","review_comments_url":"https://api.github.com/repos/broadinstitute/rawls/pulls/42/comments","review_comment_url":"https://api.github.com/repos/broadinstitute/rawls/pulls/comments{/number}","comments_url":"https://api.github.com/repos/broadinstitute/rawls/issues/42/comments","statuses_url":"https://api.github.com/repos/broadinstitute/rawls/statuses/9cbe39f5b0b27e0ddc63156ee7024d6e3f843341","head":{"label":"broadinstitute:mb_copy_entities","ref":"mb_copy_entities","sha":"9cbe39f5b0b27e0ddc63156ee7024d6e3f843341","user":{"login":"broadinstitute","id":393552,"avatar_url":"https://avatars.githubusercontent.com/u/393552?v=3","gravatar_id":"","url":"https://api.github.com/users/broadinstitute","html_url":"https://github.com/broadinstitute","followers_url":"https://api.github.com/users/broadinstitute/followers","following_url":"https://api.github.com/users/broadinstitute/following{/other_user}","gists_url":"https://api.github.com/users/broadinstitute/gists{/gist_id}","starred_url":"https://api.github.com/users/broadinstitute/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/broadinstitute/subscriptions","organizations_url":"https://api.github.com/users/broadinstitute/orgs","repos_url":"https://api.github.com/users/broadinstitute/repos","events_url":"https://api.github.com/users/broadinstitute/events{/privacy}","received_events_url":"https://api.github.com/users/broadinstitute/received_events","type":"Organization","site_admin":false},"repo":{"id":34129770,"name":"rawls","full_name":"broadinstitute/rawls","owner":{"login":"broadinstitute","id":393552,"avatar_url":"https://avatars.githubusercontent.com/u/393552?v=3","gravatar_id":"","url":"https://api.github.com/users/broadinstitute","html_url":"https://github.com/broadinstitute","followers_url":"https://api.github.com/users/broadinstitute/followers","following_url":"https://api.github.com/users/broadinstitute/following{/other_user}","gists_url":"https://api.github.com/users/broadinstitute/gists{/gist_id}","starred_url":"https://api.github.com/users/broadinstitute/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/broadinstitute/subscriptions","organizations_url":"https://api.github.com/users/broadinstitute/orgs","repos_url":"https://api.github.com/users/broadinstitute/repos","events_url":"https://api.github.com/users/broadinstitute/events{/privacy}","received_events_url":"https://api.github.com/users/broadinstitute/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/broadinstitute/rawls","description":"Rawls service for DSDE","fork":false,"url":"https://api.github.com/repos/broadinstitute/rawls","forks_url":"https://api.github.com/repos/broadinstitute/rawls/forks","keys_url":"https://api.github.com/repos/broadinstitute/rawls/keys{/key_id}","collaborators_url":"https://api.github.com/repos/broadinstitute/rawls/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/broadinstitute/rawls/teams","hooks_url":"https://api.github.com/repos/broadinstitute/rawls/hooks","issue_events_url":"https://api.github.com/repos/broadinstitute/rawls/issues/events{/number}","events_url":"https://api.github.com/repos/broadinstitute/rawls/events","assignees_url":"https://api.github.com/repos/broadinstitute/rawls/assignees{/user}","branches_url":"https://api.github.com/repos/broadinstitute/rawls/branches{/branch}","tags_url":"https://api.github.com/repos/broadinstitute/rawls/tags","blobs_url":"https://api.github.com/repos/broadinstitute/rawls/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/broadinstitute/rawls/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/broadinstitute/rawls/git/refs{/sha}","trees_url":"https://api.github.com/repos/broadinstitute/rawls/git/trees{/sha}","statuses_url":"https://api.github.com/repos/broadinstitute/rawls/statuses/{sha}","languages_url":"https://api.github.com/repos/broadinstitute/rawls/languages","stargazers_url":"https://api.github.com/repos/broadinstitute/rawls/stargazers","contributors_url":"https://api.github.com/repos/broadinstitute/rawls/contributors","subscribers_url":"https://api.github.com/repos/broadinstitute/rawls/subscribers","subscription_url":"https://api.github.com/repos/broadinstitute/rawls/subscription","commits_url":"https://api.github.com/repos/broadinstitute/rawls/commits{/sha}","git_commits_url":"https://api.github.com/repos/broadinstitute/rawls/git/commits{/sha}","comments_url":"https://api.github.com/repos/broadinstitute/rawls/comments{/number}","issue_comment_url":"https://api.github.com/repos/broadinstitute/rawls/issues/comments{/number}","contents_url":"https://api.github.com/repos/broadinstitute/rawls/contents/{+path}","compare_url":"https://api.github.com/repos/broadinstitute/rawls/compare/{base}...{head}","merges_url":"https://api.github.com/repos/broadinstitute/rawls/merges","archive_url":"https://api.github.com/repos/broadinstitute/rawls/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/broadinstitute/rawls/downloads","issues_url":"https://api.github.com/repos/broadinstitute/rawls/issues{/number}","pulls_url":"https://api.github.com/repos/broadinstitute/rawls/pulls{/number}","milestones_url":"https://api.github.com/repos/broadinstitute/rawls/milestones{/number}","notifications_url":"https://api.github.com/repos/broadinstitute/rawls/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/broadinstitute/rawls/labels{/name}","releases_url":"https://api.github.com/repos/broadinstitute/rawls/releases{/id}","created_at":"2015-04-17T17:16:07Z","updated_at":"2015-06-12T15:10:03Z","pushed_at":"2015-06-25T19:23:06Z","git_url":"git://github.com/broadinstitute/rawls.git","ssh_url":"git@github.com:broadinstitute/rawls.git","clone_url":"https://github.com/broadinstitute/rawls.git","svn_url":"https://github.com/broadinstitute/rawls","homepage":null,"size":1435,"stargazers_count":3,"watchers_count":3,"language":"Scala","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":3,"default_branch":"master"}},"base":{"label":"broadinstitute:master","ref":"master","sha":"1b4bb857d1d351d08eda6640b6d39fd742f2b10e","user":{"login":"broadinstitute","id":393552,"avatar_url":"https://avatars.githubusercontent.com/u/393552?v=3","gravatar_id":"","url":"https://api.github.com/users/broadinstitute","html_url":"https://github.com/broadinstitute","followers_url":"https://api.github.com/users/broadinstitute/followers","following_url":"https://api.github.com/users/broadinstitute/following{/other_user}","gists_url":"https://api.github.com/users/broadinstitute/gists{/gist_id}","starred_url":"https://api.github.com/users/broadinstitute/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/broadinstitute/subscriptions","organizations_url":"https://api.github.com/users/broadinstitute/orgs","repos_url":"https://api.github.com/users/broadinstitute/repos","events_url":"https://api.github.com/users/broadinstitute/events{/privacy}","received_events_url":"https://api.github.com/users/broadinstitute/received_events","type":"Organization","site_admin":false},"repo":{"id":34129770,"name":"rawls","full_name":"broadinstitute/rawls","owner":{"login":"broadinstitute","id":393552,"avatar_url":"https://avatars.githubusercontent.com/u/393552?v=3","gravatar_id":"","url":"https://api.github.com/users/broadinstitute","html_url":"https://github.com/broadinstitute","followers_url":"https://api.github.com/users/broadinstitute/followers","following_url":"https://api.github.com/users/broadinstitute/following{/other_user}","gists_url":"https://api.github.com/users/broadinstitute/gists{/gist_id}","starred_url":"https://api.github.com/users/broadinstitute/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/broadinstitute/subscriptions","organizations_url":"https://api.github.com/users/broadinstitute/orgs","repos_url":"https://api.github.com/users/broadinstitute/repos","events_url":"https://api.github.com/users/broadinstitute/events{/privacy}","received_events_url":"https://api.github.com/users/broadinstitute/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/broadinstitute/rawls","description":"Rawls service for DSDE","fork":false,"url":"https://api.github.com/repos/broadinstitute/rawls","forks_url":"https://api.github.com/repos/broadinstitute/rawls/forks","keys_url":"https://api.github.com/repos/broadinstitute/rawls/keys{/key_id}","collaborators_url":"https://api.github.com/repos/broadinstitute/rawls/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/broadinstitute/rawls/teams","hooks_url":"https://api.github.com/repos/broadinstitute/rawls/hooks","issue_events_url":"https://api.github.com/repos/broadinstitute/rawls/issues/events{/number}","events_url":"https://api.github.com/repos/broadinstitute/rawls/events","assignees_url":"https://api.github.com/repos/broadinstitute/rawls/assignees{/user}","branches_url":"https://api.github.com/repos/broadinstitute/rawls/branches{/branch}","tags_url":"https://api.github.com/repos/broadinstitute/rawls/tags","blobs_url":"https://api.github.com/repos/broadinstitute/rawls/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/broadinstitute/rawls/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/broadinstitute/rawls/git/refs{/sha}","trees_url":"https://api.github.com/repos/broadinstitute/rawls/git/trees{/sha}","statuses_url":"https://api.github.com/repos/broadinstitute/rawls/statuses/{sha}","languages_url":"https://api.github.com/repos/broadinstitute/rawls/languages","stargazers_url":"https://api.github.com/repos/broadinstitute/rawls/stargazers","contributors_url":"https://api.github.com/repos/broadinstitute/rawls/contributors","subscribers_url":"https://api.github.com/repos/broadinstitute/rawls/subscribers","subscription_url":"https://api.github.com/repos/broadinstitute/rawls/subscription","commits_url":"https://api.github.com/repos/broadinstitute/rawls/commits{/sha}","git_commits_url":"https://api.github.com/repos/broadinstitute/rawls/git/commits{/sha}","comments_url":"https://api.github.com/repos/broadinstitute/rawls/comments{/number}","issue_comment_url":"https://api.github.com/repos/broadinstitute/rawls/issues/comments{/number}","contents_url":"https://api.github.com/repos/broadinstitute/rawls/contents/{+path}","compare_url":"https://api.github.com/repos/broadinstitute/rawls/compare/{base}...{head}","merges_url":"https://api.github.com/repos/broadinstitute/rawls/merges","archive_url":"https://api.github.com/repos/broadinstitute/rawls/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/broadinstitute/rawls/downloads","issues_url":"https://api.github.com/repos/broadinstitute/rawls/issues{/number}","pulls_url":"https://api.github.com/repos/broadinstitute/rawls/pulls{/number}","milestones_url":"https://api.github.com/repos/broadinstitute/rawls/milestones{/number}","notifications_url":"https://api.github.com/repos/broadinstitute/rawls/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/broadinstitute/rawls/labels{/name}","releases_url":"https://api.github.com/repos/broadinstitute/rawls/releases{/id}","created_at":"2015-04-17T17:16:07Z","updated_at":"2015-06-12T15:10:03Z","pushed_at":"2015-06-25T19:23:06Z","git_url":"git://github.com/broadinstitute/rawls.git","ssh_url":"git@github.com:broadinstitute/rawls.git","clone_url":"https://github.com/broadinstitute/rawls.git","svn_url":"https://github.com/broadinstitute/rawls","homepage":null,"size":1435,"stargazers_count":3,"watchers_count":3,"language":"Scala","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":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/broadinstitute/rawls/pulls/42"},"html":{"href":"https://github.com/broadinstitute/rawls/pull/42"},"issue":{"href":"https://api.github.com/repos/broadinstitute/rawls/issues/42"},"comments":{"href":"https://api.github.com/repos/broadinstitute/rawls/issues/42/comments"},"review_comments":{"href":"https://api.github.com/repos/broadinstitute/rawls/pulls/42/comments"},"review_comment":{"href":"https://api.github.com/repos/broadinstitute/rawls/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/broadinstitute/rawls/pulls/42/commits"},"statuses":{"href":"https://api.github.com/repos/broadinstitute/rawls/statuses/9cbe39f5b0b27e0ddc63156ee7024d6e3f843341"}}}}