{"action":"created","comment":{"url":"https://api.github.com/repos/codice/ddf/pulls/comments/66508325","id":66508325,"diff_hunk":"@@ -0,0 +1,250 @@\n+/**\n+ * Copyright (c) Codice Foundation\n+ *\n+ * This is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser\n+ * General Public License as published by the Free Software Foundation, either version 3 of the\n+ * License, or any later version.\n+ *\n+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\n+ * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n+ * Lesser General Public License for more details. A copy of the GNU Lesser General Public License\n+ * is distributed along with this program and can be found at\n+ * <http://www.gnu.org/licenses/lgpl.html>.\n+ *\n+ **/\n+/*global define*/\n+/*jshint -W024*/\n+define([\n+    'backbone',\n+    'underscore',\n+    'js/model/FieldDescriptors.js',\n+    'js/model/Segment.js',\n+    'wreqr',\n+    'backboneassociation'\n+\n+\n+], function (Backbone, _, FieldDescriptors, Segment, wreqr) {\n+\n+    var counter = 0;\n+\n+    function generateId() {\n+        counter++;\n+        return 'urn:association:id:' + new Date().getTime() + \"-\" + counter;\n+\n+    }\n+\n+    function getSegmentModel(segment, id) {\n+        if (segment.get('segmentId') === id) {\n+            return segment;\n+        }\n+        for (var index = 0; index < segment.get('segments').models.length; index++) {\n+            var seg = getSegmentModel(segment.get('segments').models[index], id);\n+            if (seg) {\n+                return seg;\n+            }\n+        }\n+    }\n+\n+    var Association = {};\n+\n+    Association.Association = Backbone.AssociatedModel.extend({\n+        defaults: {\n+            id: undefined,\n+            type: undefined,\n+            sourceId: undefined,\n+            sourceName: undefined,\n+            targetId: undefined,\n+            targetName: undefined,\n+            targetType: undefined\n+        },\n+        populateFromModel: function (association, topLevelSegment) {\n+            if (association) {\n+                this.set('id', association.id);\n+                this.set('type', association.associationType);\n+                this.set('sourceId', association.sourceObject);\n+                this.set('targetId', association.targetObject);\n+            }\n+            var sourceSeg = getSegmentModel(topLevelSegment, this.get('sourceId'));\n+            var targetSeg = getSegmentModel(topLevelSegment, this.get('targetId'));\n+            this.set('targetType', targetSeg.get('segmentType'));\n+            this.set('sourceName', sourceSeg.constructTitle ? sourceSeg.constructTitle() : sourceSeg.getField('Name').get('value'));\n+            this.set('targetName', targetSeg.constructTitle ? targetSeg.constructTitle() : targetSeg.getField('Name').get('value'));\n+        }\n+\n+    });\n+    Association.Associations = Backbone.Collection.extend({\n+        model: Association.Association\n+    });\n+\n+    Association.AssociationModel = Backbone.AssociatedModel.extend({\n+        relations: [\n+            {\n+                type: Backbone.Many,\n+                key: 'associations',\n+                collectionType: function () {\n+                    return Association.Associations;\n+                },\n+                relatedModel: function () {\n+                    return Association.Association;\n+                }\n+            },\n+            {\n+                type: Backbone.Many,\n+                key: 'associationSegments',\n+                collectionType: function () {\n+                    return Association.SegmentIds;\n+                },\n+                relatedModel: function () {\n+                    return Association.SegmentId;\n+                }\n+            },\n+            {\n+                type: Backbone.One,\n+                key: 'topSegment',\n+                relatedModel: function () {\n+                    return Segment.Segment;\n+                }\n+            }\n+        ],\n+        defaults: {\n+            associations: [],\n+            associationSegments: [],\n+            topSegment: null\n+        },\n+        populateFromModel: function (associations) {\n+            var model = this;\n+            var collectionModel = this.get('associations');","path":"catalog/spatial/registry/registry-admin-modules/registry-admin-local-ui/src/main/webapp/js/model/Association.js","position":116,"original_position":116,"commit_id":"424b3e345ca6a127de97a3cac93aa97d1fd875ef","original_commit_id":"424b3e345ca6a127de97a3cac93aa97d1fd875ef","user":{"login":"harrison-tarr","id":14062223,"avatar_url":"https://avatars.githubusercontent.com/u/14062223?v=3","gravatar_id":"","url":"https://api.github.com/users/harrison-tarr","html_url":"https://github.com/harrison-tarr","followers_url":"https://api.github.com/users/harrison-tarr/followers","following_url":"https://api.github.com/users/harrison-tarr/following{/other_user}","gists_url":"https://api.github.com/users/harrison-tarr/gists{/gist_id}","starred_url":"https://api.github.com/users/harrison-tarr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harrison-tarr/subscriptions","organizations_url":"https://api.github.com/users/harrison-tarr/orgs","repos_url":"https://api.github.com/users/harrison-tarr/repos","events_url":"https://api.github.com/users/harrison-tarr/events{/privacy}","received_events_url":"https://api.github.com/users/harrison-tarr/received_events","type":"User","site_admin":false},"body":"I don't know if I've seen it before or if this is a normal thing, but could you replace the strings like 'associations' and 'topSegment' with class constants? I could see one of these being misspelled sometime and causing a huge headache during debugging","created_at":"2016-06-09T19:42:50Z","updated_at":"2016-06-09T19:42:50Z","html_url":"https://github.com/codice/ddf/pull/790#discussion_r66508325","pull_request_url":"https://api.github.com/repos/codice/ddf/pulls/790","_links":{"self":{"href":"https://api.github.com/repos/codice/ddf/pulls/comments/66508325"},"html":{"href":"https://github.com/codice/ddf/pull/790#discussion_r66508325"},"pull_request":{"href":"https://api.github.com/repos/codice/ddf/pulls/790"}}},"pull_request":{"url":"https://api.github.com/repos/codice/ddf/pulls/790","id":70612321,"html_url":"https://github.com/codice/ddf/pull/790","diff_url":"https://github.com/codice/ddf/pull/790.diff","patch_url":"https://github.com/codice/ddf/pull/790.patch","issue_url":"https://api.github.com/repos/codice/ddf/issues/790","number":790,"state":"open","locked":false,"title":"DDF-1886 Added admin ui for adding/editing local registry node information","user":{"login":"clockard","id":5248090,"avatar_url":"https://avatars.githubusercontent.com/u/5248090?v=3","gravatar_id":"","url":"https://api.github.com/users/clockard","html_url":"https://github.com/clockard","followers_url":"https://api.github.com/users/clockard/followers","following_url":"https://api.github.com/users/clockard/following{/other_user}","gists_url":"https://api.github.com/users/clockard/gists{/gist_id}","starred_url":"https://api.github.com/users/clockard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clockard/subscriptions","organizations_url":"https://api.github.com/users/clockard/orgs","repos_url":"https://api.github.com/users/clockard/repos","events_url":"https://api.github.com/users/clockard/events{/privacy}","received_events_url":"https://api.github.com/users/clockard/received_events","type":"User","site_admin":false},"body":"#### What does this PR do?\r\nAdds admin ui for adding/editing local registry node information. \r\n#### Who is reviewing it (please choose AT LEAST two reviewers that need to approve the PR before it can get merged; if a component team is listed, at least one of its members needs to approve)?\r\n@djblue @andrewkfiedler @harrison-tarr \r\n#### Choose 2 committers to review/merge the PR (please choose ONLY two committers from below, delete the rest).\r\n@pklinef\r\n@shaundmorris\r\n\r\n#### How should this be tested?\r\nStart up ddf and then start the DDF Registry app. Once the app is started you can open up the app and see a new 'Local Node Information' tab. You can play around with setting/adding/removing nodes/fields and saving them.\r\n#### Any background context you want to provide?\r\nThis was pulled from the ddf-registry repo.\r\n#### What are the relevant tickets?\r\nDDF-1886\r\n#### Screenshots (if appropriate)\r\nMain table view\r\n![screen shot 2016-06-06 at 4 08 54 pm](https://cloud.githubusercontent.com/assets/5248090/15840775/0fd42654-2c01-11e6-9587-a961fdc7a014.png)\r\n\r\nEdit dialog\r\n![screen shot 2016-06-06 at 4 01 43 pm](https://cloud.githubusercontent.com/assets/5248090/15840776/14d93446-2c01-11e6-88ba-53e6630d65f3.png)\r\n\r\nValidation error\r\n![screen shot 2016-06-07 at 4 11 57 pm](https://cloud.githubusercontent.com/assets/5248090/15882626/472dcb2e-2cf5-11e6-954a-f7f1ff5a1361.png)\r\n\r\n\r\n#### Checklist:\r\n- [ ] Documentation Updated\r\n- [ ] Update / Add Unit Tests\r\n- [ ] Update / Add Integration Tests\r\n","created_at":"2016-05-18T22:49:48Z","updated_at":"2016-06-09T19:42:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c4a643b59a1a6451db32a1f7600c4ea613479f46","assignee":{"login":"pklinef","id":700518,"avatar_url":"https://avatars.githubusercontent.com/u/700518?v=3","gravatar_id":"","url":"https://api.github.com/users/pklinef","html_url":"https://github.com/pklinef","followers_url":"https://api.github.com/users/pklinef/followers","following_url":"https://api.github.com/users/pklinef/following{/other_user}","gists_url":"https://api.github.com/users/pklinef/gists{/gist_id}","starred_url":"https://api.github.com/users/pklinef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pklinef/subscriptions","organizations_url":"https://api.github.com/users/pklinef/orgs","repos_url":"https://api.github.com/users/pklinef/repos","events_url":"https://api.github.com/users/pklinef/events{/privacy}","received_events_url":"https://api.github.com/users/pklinef/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/codice/ddf/pulls/790/commits","review_comments_url":"https://api.github.com/repos/codice/ddf/pulls/790/comments","review_comment_url":"https://api.github.com/repos/codice/ddf/pulls/comments{/number}","comments_url":"https://api.github.com/repos/codice/ddf/issues/790/comments","statuses_url":"https://api.github.com/repos/codice/ddf/statuses/424b3e345ca6a127de97a3cac93aa97d1fd875ef","head":{"label":"clockard:DDF-1886","ref":"DDF-1886","sha":"424b3e345ca6a127de97a3cac93aa97d1fd875ef","user":{"login":"clockard","id":5248090,"avatar_url":"https://avatars.githubusercontent.com/u/5248090?v=3","gravatar_id":"","url":"https://api.github.com/users/clockard","html_url":"https://github.com/clockard","followers_url":"https://api.github.com/users/clockard/followers","following_url":"https://api.github.com/users/clockard/following{/other_user}","gists_url":"https://api.github.com/users/clockard/gists{/gist_id}","starred_url":"https://api.github.com/users/clockard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clockard/subscriptions","organizations_url":"https://api.github.com/users/clockard/orgs","repos_url":"https://api.github.com/users/clockard/repos","events_url":"https://api.github.com/users/clockard/events{/privacy}","received_events_url":"https://api.github.com/users/clockard/received_events","type":"User","site_admin":false},"repo":{"id":33900871,"name":"ddf","full_name":"clockard/ddf","owner":{"login":"clockard","id":5248090,"avatar_url":"https://avatars.githubusercontent.com/u/5248090?v=3","gravatar_id":"","url":"https://api.github.com/users/clockard","html_url":"https://github.com/clockard","followers_url":"https://api.github.com/users/clockard/followers","following_url":"https://api.github.com/users/clockard/following{/other_user}","gists_url":"https://api.github.com/users/clockard/gists{/gist_id}","starred_url":"https://api.github.com/users/clockard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clockard/subscriptions","organizations_url":"https://api.github.com/users/clockard/orgs","repos_url":"https://api.github.com/users/clockard/repos","events_url":"https://api.github.com/users/clockard/events{/privacy}","received_events_url":"https://api.github.com/users/clockard/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/clockard/ddf","description":"The Distributed Data Framework - Distribution, SDK, and Test","fork":true,"url":"https://api.github.com/repos/clockard/ddf","forks_url":"https://api.github.com/repos/clockard/ddf/forks","keys_url":"https://api.github.com/repos/clockard/ddf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/clockard/ddf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/clockard/ddf/teams","hooks_url":"https://api.github.com/repos/clockard/ddf/hooks","issue_events_url":"https://api.github.com/repos/clockard/ddf/issues/events{/number}","events_url":"https://api.github.com/repos/clockard/ddf/events","assignees_url":"https://api.github.com/repos/clockard/ddf/assignees{/user}","branches_url":"https://api.github.com/repos/clockard/ddf/branches{/branch}","tags_url":"https://api.github.com/repos/clockard/ddf/tags","blobs_url":"https://api.github.com/repos/clockard/ddf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/clockard/ddf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/clockard/ddf/git/refs{/sha}","trees_url":"https://api.github.com/repos/clockard/ddf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/clockard/ddf/statuses/{sha}","languages_url":"https://api.github.com/repos/clockard/ddf/languages","stargazers_url":"https://api.github.com/repos/clockard/ddf/stargazers","contributors_url":"https://api.github.com/repos/clockard/ddf/contributors","subscribers_url":"https://api.github.com/repos/clockard/ddf/subscribers","subscription_url":"https://api.github.com/repos/clockard/ddf/subscription","commits_url":"https://api.github.com/repos/clockard/ddf/commits{/sha}","git_commits_url":"https://api.github.com/repos/clockard/ddf/git/commits{/sha}","comments_url":"https://api.github.com/repos/clockard/ddf/comments{/number}","issue_comment_url":"https://api.github.com/repos/clockard/ddf/issues/comments{/number}","contents_url":"https://api.github.com/repos/clockard/ddf/contents/{+path}","compare_url":"https://api.github.com/repos/clockard/ddf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/clockard/ddf/merges","archive_url":"https://api.github.com/repos/clockard/ddf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/clockard/ddf/downloads","issues_url":"https://api.github.com/repos/clockard/ddf/issues{/number}","pulls_url":"https://api.github.com/repos/clockard/ddf/pulls{/number}","milestones_url":"https://api.github.com/repos/clockard/ddf/milestones{/number}","notifications_url":"https://api.github.com/repos/clockard/ddf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/clockard/ddf/labels{/name}","releases_url":"https://api.github.com/repos/clockard/ddf/releases{/id}","deployments_url":"https://api.github.com/repos/clockard/ddf/deployments","created_at":"2015-04-14T00:06:27Z","updated_at":"2016-01-14T17:17:40Z","pushed_at":"2016-06-09T18:09:19Z","git_url":"git://github.com/clockard/ddf.git","ssh_url":"git@github.com:clockard/ddf.git","clone_url":"https://github.com/clockard/ddf.git","svn_url":"https://github.com/clockard/ddf","homepage":"","size":143507,"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":"codice:master","ref":"master","sha":"9b3913ac45770c3c12327cf93d473890237201d6","user":{"login":"codice","id":2386734,"avatar_url":"https://avatars.githubusercontent.com/u/2386734?v=3","gravatar_id":"","url":"https://api.github.com/users/codice","html_url":"https://github.com/codice","followers_url":"https://api.github.com/users/codice/followers","following_url":"https://api.github.com/users/codice/following{/other_user}","gists_url":"https://api.github.com/users/codice/gists{/gist_id}","starred_url":"https://api.github.com/users/codice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codice/subscriptions","organizations_url":"https://api.github.com/users/codice/orgs","repos_url":"https://api.github.com/users/codice/repos","events_url":"https://api.github.com/users/codice/events{/privacy}","received_events_url":"https://api.github.com/users/codice/received_events","type":"Organization","site_admin":false},"repo":{"id":15173563,"name":"ddf","full_name":"codice/ddf","owner":{"login":"codice","id":2386734,"avatar_url":"https://avatars.githubusercontent.com/u/2386734?v=3","gravatar_id":"","url":"https://api.github.com/users/codice","html_url":"https://github.com/codice","followers_url":"https://api.github.com/users/codice/followers","following_url":"https://api.github.com/users/codice/following{/other_user}","gists_url":"https://api.github.com/users/codice/gists{/gist_id}","starred_url":"https://api.github.com/users/codice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codice/subscriptions","organizations_url":"https://api.github.com/users/codice/orgs","repos_url":"https://api.github.com/users/codice/repos","events_url":"https://api.github.com/users/codice/events{/privacy}","received_events_url":"https://api.github.com/users/codice/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/codice/ddf","description":"Distributed Data Framework - an open source, modular integration framework.","fork":false,"url":"https://api.github.com/repos/codice/ddf","forks_url":"https://api.github.com/repos/codice/ddf/forks","keys_url":"https://api.github.com/repos/codice/ddf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/codice/ddf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/codice/ddf/teams","hooks_url":"https://api.github.com/repos/codice/ddf/hooks","issue_events_url":"https://api.github.com/repos/codice/ddf/issues/events{/number}","events_url":"https://api.github.com/repos/codice/ddf/events","assignees_url":"https://api.github.com/repos/codice/ddf/assignees{/user}","branches_url":"https://api.github.com/repos/codice/ddf/branches{/branch}","tags_url":"https://api.github.com/repos/codice/ddf/tags","blobs_url":"https://api.github.com/repos/codice/ddf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/codice/ddf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/codice/ddf/git/refs{/sha}","trees_url":"https://api.github.com/repos/codice/ddf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/codice/ddf/statuses/{sha}","languages_url":"https://api.github.com/repos/codice/ddf/languages","stargazers_url":"https://api.github.com/repos/codice/ddf/stargazers","contributors_url":"https://api.github.com/repos/codice/ddf/contributors","subscribers_url":"https://api.github.com/repos/codice/ddf/subscribers","subscription_url":"https://api.github.com/repos/codice/ddf/subscription","commits_url":"https://api.github.com/repos/codice/ddf/commits{/sha}","git_commits_url":"https://api.github.com/repos/codice/ddf/git/commits{/sha}","comments_url":"https://api.github.com/repos/codice/ddf/comments{/number}","issue_comment_url":"https://api.github.com/repos/codice/ddf/issues/comments{/number}","contents_url":"https://api.github.com/repos/codice/ddf/contents/{+path}","compare_url":"https://api.github.com/repos/codice/ddf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/codice/ddf/merges","archive_url":"https://api.github.com/repos/codice/ddf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/codice/ddf/downloads","issues_url":"https://api.github.com/repos/codice/ddf/issues{/number}","pulls_url":"https://api.github.com/repos/codice/ddf/pulls{/number}","milestones_url":"https://api.github.com/repos/codice/ddf/milestones{/number}","notifications_url":"https://api.github.com/repos/codice/ddf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/codice/ddf/labels{/name}","releases_url":"https://api.github.com/repos/codice/ddf/releases{/id}","deployments_url":"https://api.github.com/repos/codice/ddf/deployments","created_at":"2013-12-13T20:38:28Z","updated_at":"2016-06-09T11:41:29Z","pushed_at":"2016-06-09T19:40:18Z","git_url":"git://github.com/codice/ddf.git","ssh_url":"git@github.com:codice/ddf.git","clone_url":"https://github.com/codice/ddf.git","svn_url":"https://github.com/codice/ddf","homepage":"http://ddf.codice.org","size":271261,"stargazers_count":38,"watchers_count":38,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":81,"mirror_url":null,"open_issues_count":23,"forks":81,"open_issues":23,"watchers":38,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/codice/ddf/pulls/790"},"html":{"href":"https://github.com/codice/ddf/pull/790"},"issue":{"href":"https://api.github.com/repos/codice/ddf/issues/790"},"comments":{"href":"https://api.github.com/repos/codice/ddf/issues/790/comments"},"review_comments":{"href":"https://api.github.com/repos/codice/ddf/pulls/790/comments"},"review_comment":{"href":"https://api.github.com/repos/codice/ddf/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/codice/ddf/pulls/790/commits"},"statuses":{"href":"https://api.github.com/repos/codice/ddf/statuses/424b3e345ca6a127de97a3cac93aa97d1fd875ef"}}}}
{"actor":{"display_login":"harrison-tarr"}}