{"action":"created","comment":{"url":"https://api.github.com/repos/TWCable/grabbit/pulls/comments/36686277","id":36686277,"diff_hunk":"@@ -0,0 +1,90 @@\n+/*\n+ * Copyright 2015 Time Warner Cable, Inc.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package com.twcable.grabbit.server.services\n+\n+import com.twcable.grabbit.jcr.JCRNodeDecorator\n+import groovy.transform.CompileStatic\n+import groovy.transform.TailRecursive\n+\n+import javax.jcr.Node as JcrNode\n+\n+/**\n+ * Custom Node Iterator that will iterate over a rootNode node and its immediate children\n+ * taking into account cases where a node (rootNode node or any of the children) has any number of\n+ * mandatory subnodes\n+ */\n+@CompileStatic\n+final class NodeWithMandatoryIterator implements Iterator<JcrNode> {\n+\n+    private boolean doneRoot\n+    private JCRNodeDecorator rootNode\n+    private Iterator<JCRNodeDecorator> immediateChildren\n+    private Iterator<JCRNodeDecorator> mandatoryWriteNodes\n+\n+\n+    public NodeWithMandatoryIterator(JcrNode root) {\n+        this.rootNode = new JCRNodeDecorator(root)\n+        this.doneRoot = false\n+        //Get all immediate children that are not mandatory write nodes.  We will handle those by iterating over mandatoryWriteNodes\n+        immediateChildren = rootNode.getImmediateChildNodes().findAll { !it.isRequiredNode() }.iterator() as Iterator<JCRNodeDecorator>","path":"grabbit/src/main/groovy/com/twcable/grabbit/server/services/NodeWithMandatoryIterator.groovy","position":43,"original_position":43,"commit_id":"59bd90fee10b2ee92cab182565fd7cadf7da4f85","original_commit_id":"5b0227531bb79574366891a58b9f89daa364f6f8","user":{"login":"jbornemann","id":4540994,"avatar_url":"https://avatars.githubusercontent.com/u/4540994?v=3","gravatar_id":"","url":"https://api.github.com/users/jbornemann","html_url":"https://github.com/jbornemann","followers_url":"https://api.github.com/users/jbornemann/followers","following_url":"https://api.github.com/users/jbornemann/following{/other_user}","gists_url":"https://api.github.com/users/jbornemann/gists{/gist_id}","starred_url":"https://api.github.com/users/jbornemann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbornemann/subscriptions","organizations_url":"https://api.github.com/users/jbornemann/orgs","repos_url":"https://api.github.com/users/jbornemann/repos","events_url":"https://api.github.com/users/jbornemann/events{/privacy}","received_events_url":"https://api.github.com/users/jbornemann/received_events","type":"User","site_admin":false},"body":"Sure","created_at":"2015-08-10T21:21:36Z","updated_at":"2015-08-10T21:21:36Z","html_url":"https://github.com/TWCable/grabbit/pull/55#discussion_r36686277","pull_request_url":"https://api.github.com/repos/TWCable/grabbit/pulls/55","_links":{"self":{"href":"https://api.github.com/repos/TWCable/grabbit/pulls/comments/36686277"},"html":{"href":"https://github.com/TWCable/grabbit/pull/55#discussion_r36686277"},"pull_request":{"href":"https://api.github.com/repos/TWCable/grabbit/pulls/55"}}},"pull_request":{"url":"https://api.github.com/repos/TWCable/grabbit/pulls/55","id":41727650,"html_url":"https://github.com/TWCable/grabbit/pull/55","diff_url":"https://github.com/TWCable/grabbit/pull/55.diff","patch_url":"https://github.com/TWCable/grabbit/pull/55.patch","issue_url":"https://api.github.com/repos/TWCable/grabbit/issues/55","number":55,"state":"open","locked":false,"title":"Work to solve edge case around server writing mandatory nodes","user":{"login":"jbornemann","id":4540994,"avatar_url":"https://avatars.githubusercontent.com/u/4540994?v=3","gravatar_id":"","url":"https://api.github.com/users/jbornemann","html_url":"https://github.com/jbornemann","followers_url":"https://api.github.com/users/jbornemann/followers","following_url":"https://api.github.com/users/jbornemann/following{/other_user}","gists_url":"https://api.github.com/users/jbornemann/gists{/gist_id}","starred_url":"https://api.github.com/users/jbornemann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbornemann/subscriptions","organizations_url":"https://api.github.com/users/jbornemann/orgs","repos_url":"https://api.github.com/users/jbornemann/repos","events_url":"https://api.github.com/users/jbornemann/events{/privacy}","received_events_url":"https://api.github.com/users/jbornemann/received_events","type":"User","site_admin":false},"body":"To support changes @sikarwarvimal made, this will fix an edge case if a configuration \"/. path\" targets a node with mandatory children that are not jcr:content.  \r\n\r\nSome shifting around of things as well...\r\n\r\n@sagarsane @jdigger @sikarwarvimal @masroormohammed ","created_at":"2015-08-05T21:20:53Z","updated_at":"2015-08-10T21:21:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2406eae5646860679bb1811fb058cf48700cbc19","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/TWCable/grabbit/pulls/55/commits","review_comments_url":"https://api.github.com/repos/TWCable/grabbit/pulls/55/comments","review_comment_url":"https://api.github.com/repos/TWCable/grabbit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/TWCable/grabbit/issues/55/comments","statuses_url":"https://api.github.com/repos/TWCable/grabbit/statuses/59bd90fee10b2ee92cab182565fd7cadf7da4f85","head":{"label":"TWCable:work-around-serverside-iterator","ref":"work-around-serverside-iterator","sha":"59bd90fee10b2ee92cab182565fd7cadf7da4f85","user":{"login":"TWCable","id":10778149,"avatar_url":"https://avatars.githubusercontent.com/u/10778149?v=3","gravatar_id":"","url":"https://api.github.com/users/TWCable","html_url":"https://github.com/TWCable","followers_url":"https://api.github.com/users/TWCable/followers","following_url":"https://api.github.com/users/TWCable/following{/other_user}","gists_url":"https://api.github.com/users/TWCable/gists{/gist_id}","starred_url":"https://api.github.com/users/TWCable/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TWCable/subscriptions","organizations_url":"https://api.github.com/users/TWCable/orgs","repos_url":"https://api.github.com/users/TWCable/repos","events_url":"https://api.github.com/users/TWCable/events{/privacy}","received_events_url":"https://api.github.com/users/TWCable/received_events","type":"Organization","site_admin":false},"repo":{"id":31395930,"name":"grabbit","full_name":"TWCable/grabbit","owner":{"login":"TWCable","id":10778149,"avatar_url":"https://avatars.githubusercontent.com/u/10778149?v=3","gravatar_id":"","url":"https://api.github.com/users/TWCable","html_url":"https://github.com/TWCable","followers_url":"https://api.github.com/users/TWCable/followers","following_url":"https://api.github.com/users/TWCable/following{/other_user}","gists_url":"https://api.github.com/users/TWCable/gists{/gist_id}","starred_url":"https://api.github.com/users/TWCable/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TWCable/subscriptions","organizations_url":"https://api.github.com/users/TWCable/orgs","repos_url":"https://api.github.com/users/TWCable/repos","events_url":"https://api.github.com/users/TWCable/events{/privacy}","received_events_url":"https://api.github.com/users/TWCable/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/TWCable/grabbit","description":"Grabbit - Fast Content Sync tool for AEM/CQ","fork":false,"url":"https://api.github.com/repos/TWCable/grabbit","forks_url":"https://api.github.com/repos/TWCable/grabbit/forks","keys_url":"https://api.github.com/repos/TWCable/grabbit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TWCable/grabbit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TWCable/grabbit/teams","hooks_url":"https://api.github.com/repos/TWCable/grabbit/hooks","issue_events_url":"https://api.github.com/repos/TWCable/grabbit/issues/events{/number}","events_url":"https://api.github.com/repos/TWCable/grabbit/events","assignees_url":"https://api.github.com/repos/TWCable/grabbit/assignees{/user}","branches_url":"https://api.github.com/repos/TWCable/grabbit/branches{/branch}","tags_url":"https://api.github.com/repos/TWCable/grabbit/tags","blobs_url":"https://api.github.com/repos/TWCable/grabbit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TWCable/grabbit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TWCable/grabbit/git/refs{/sha}","trees_url":"https://api.github.com/repos/TWCable/grabbit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TWCable/grabbit/statuses/{sha}","languages_url":"https://api.github.com/repos/TWCable/grabbit/languages","stargazers_url":"https://api.github.com/repos/TWCable/grabbit/stargazers","contributors_url":"https://api.github.com/repos/TWCable/grabbit/contributors","subscribers_url":"https://api.github.com/repos/TWCable/grabbit/subscribers","subscription_url":"https://api.github.com/repos/TWCable/grabbit/subscription","commits_url":"https://api.github.com/repos/TWCable/grabbit/commits{/sha}","git_commits_url":"https://api.github.com/repos/TWCable/grabbit/git/commits{/sha}","comments_url":"https://api.github.com/repos/TWCable/grabbit/comments{/number}","issue_comment_url":"https://api.github.com/repos/TWCable/grabbit/issues/comments{/number}","contents_url":"https://api.github.com/repos/TWCable/grabbit/contents/{+path}","compare_url":"https://api.github.com/repos/TWCable/grabbit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TWCable/grabbit/merges","archive_url":"https://api.github.com/repos/TWCable/grabbit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TWCable/grabbit/downloads","issues_url":"https://api.github.com/repos/TWCable/grabbit/issues{/number}","pulls_url":"https://api.github.com/repos/TWCable/grabbit/pulls{/number}","milestones_url":"https://api.github.com/repos/TWCable/grabbit/milestones{/number}","notifications_url":"https://api.github.com/repos/TWCable/grabbit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TWCable/grabbit/labels{/name}","releases_url":"https://api.github.com/repos/TWCable/grabbit/releases{/id}","created_at":"2015-02-27T00:24:35Z","updated_at":"2015-07-21T19:07:00Z","pushed_at":"2015-08-07T02:48:02Z","git_url":"git://github.com/TWCable/grabbit.git","ssh_url":"git@github.com:TWCable/grabbit.git","clone_url":"https://github.com/TWCable/grabbit.git","svn_url":"https://github.com/TWCable/grabbit","homepage":"","size":1328,"stargazers_count":25,"watchers_count":25,"language":"Groovy","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":30,"forks":8,"open_issues":30,"watchers":25,"default_branch":"master"}},"base":{"label":"TWCable:master","ref":"master","sha":"4844d3d0b41b567540039a4aa0ff972d1d32da42","user":{"login":"TWCable","id":10778149,"avatar_url":"https://avatars.githubusercontent.com/u/10778149?v=3","gravatar_id":"","url":"https://api.github.com/users/TWCable","html_url":"https://github.com/TWCable","followers_url":"https://api.github.com/users/TWCable/followers","following_url":"https://api.github.com/users/TWCable/following{/other_user}","gists_url":"https://api.github.com/users/TWCable/gists{/gist_id}","starred_url":"https://api.github.com/users/TWCable/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TWCable/subscriptions","organizations_url":"https://api.github.com/users/TWCable/orgs","repos_url":"https://api.github.com/users/TWCable/repos","events_url":"https://api.github.com/users/TWCable/events{/privacy}","received_events_url":"https://api.github.com/users/TWCable/received_events","type":"Organization","site_admin":false},"repo":{"id":31395930,"name":"grabbit","full_name":"TWCable/grabbit","owner":{"login":"TWCable","id":10778149,"avatar_url":"https://avatars.githubusercontent.com/u/10778149?v=3","gravatar_id":"","url":"https://api.github.com/users/TWCable","html_url":"https://github.com/TWCable","followers_url":"https://api.github.com/users/TWCable/followers","following_url":"https://api.github.com/users/TWCable/following{/other_user}","gists_url":"https://api.github.com/users/TWCable/gists{/gist_id}","starred_url":"https://api.github.com/users/TWCable/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TWCable/subscriptions","organizations_url":"https://api.github.com/users/TWCable/orgs","repos_url":"https://api.github.com/users/TWCable/repos","events_url":"https://api.github.com/users/TWCable/events{/privacy}","received_events_url":"https://api.github.com/users/TWCable/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/TWCable/grabbit","description":"Grabbit - Fast Content Sync tool for AEM/CQ","fork":false,"url":"https://api.github.com/repos/TWCable/grabbit","forks_url":"https://api.github.com/repos/TWCable/grabbit/forks","keys_url":"https://api.github.com/repos/TWCable/grabbit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TWCable/grabbit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TWCable/grabbit/teams","hooks_url":"https://api.github.com/repos/TWCable/grabbit/hooks","issue_events_url":"https://api.github.com/repos/TWCable/grabbit/issues/events{/number}","events_url":"https://api.github.com/repos/TWCable/grabbit/events","assignees_url":"https://api.github.com/repos/TWCable/grabbit/assignees{/user}","branches_url":"https://api.github.com/repos/TWCable/grabbit/branches{/branch}","tags_url":"https://api.github.com/repos/TWCable/grabbit/tags","blobs_url":"https://api.github.com/repos/TWCable/grabbit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TWCable/grabbit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TWCable/grabbit/git/refs{/sha}","trees_url":"https://api.github.com/repos/TWCable/grabbit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TWCable/grabbit/statuses/{sha}","languages_url":"https://api.github.com/repos/TWCable/grabbit/languages","stargazers_url":"https://api.github.com/repos/TWCable/grabbit/stargazers","contributors_url":"https://api.github.com/repos/TWCable/grabbit/contributors","subscribers_url":"https://api.github.com/repos/TWCable/grabbit/subscribers","subscription_url":"https://api.github.com/repos/TWCable/grabbit/subscription","commits_url":"https://api.github.com/repos/TWCable/grabbit/commits{/sha}","git_commits_url":"https://api.github.com/repos/TWCable/grabbit/git/commits{/sha}","comments_url":"https://api.github.com/repos/TWCable/grabbit/comments{/number}","issue_comment_url":"https://api.github.com/repos/TWCable/grabbit/issues/comments{/number}","contents_url":"https://api.github.com/repos/TWCable/grabbit/contents/{+path}","compare_url":"https://api.github.com/repos/TWCable/grabbit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TWCable/grabbit/merges","archive_url":"https://api.github.com/repos/TWCable/grabbit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TWCable/grabbit/downloads","issues_url":"https://api.github.com/repos/TWCable/grabbit/issues{/number}","pulls_url":"https://api.github.com/repos/TWCable/grabbit/pulls{/number}","milestones_url":"https://api.github.com/repos/TWCable/grabbit/milestones{/number}","notifications_url":"https://api.github.com/repos/TWCable/grabbit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TWCable/grabbit/labels{/name}","releases_url":"https://api.github.com/repos/TWCable/grabbit/releases{/id}","created_at":"2015-02-27T00:24:35Z","updated_at":"2015-07-21T19:07:00Z","pushed_at":"2015-08-07T02:48:02Z","git_url":"git://github.com/TWCable/grabbit.git","ssh_url":"git@github.com:TWCable/grabbit.git","clone_url":"https://github.com/TWCable/grabbit.git","svn_url":"https://github.com/TWCable/grabbit","homepage":"","size":1328,"stargazers_count":25,"watchers_count":25,"language":"Groovy","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":30,"forks":8,"open_issues":30,"watchers":25,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/TWCable/grabbit/pulls/55"},"html":{"href":"https://github.com/TWCable/grabbit/pull/55"},"issue":{"href":"https://api.github.com/repos/TWCable/grabbit/issues/55"},"comments":{"href":"https://api.github.com/repos/TWCable/grabbit/issues/55/comments"},"review_comments":{"href":"https://api.github.com/repos/TWCable/grabbit/pulls/55/comments"},"review_comment":{"href":"https://api.github.com/repos/TWCable/grabbit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/TWCable/grabbit/pulls/55/commits"},"statuses":{"href":"https://api.github.com/repos/TWCable/grabbit/statuses/59bd90fee10b2ee92cab182565fd7cadf7da4f85"}}}}