{"action":"created","comment":{"url":"https://api.github.com/repos/dotCMS/core/pulls/comments/152059578","pull_request_review_id":77863126,"id":152059578,"diff_hunk":"@@ -190,4 +212,79 @@ public String asJson(final PageView pageView) throws JsonProcessingException {\n         return objectWriter.writeValueAsString(pageView);\n     }\n \n+    public Template saveTemplate(final User user, String pageId, final PageForm pageForm)\n+            throws BadRequestException, DotDataException, DotSecurityException, IOException {\n+\n+        final Contentlet page = this.contentletAPI.findContentletByIdentifier(pageId, false,\n+                langAPI.getDefaultLanguage().getId(), user, false);\n+\n+        if (page == null) {\n+            throw new NotFoundException(\"An error occurred when proccessing the JSON request\");\n+        }\n+\n+        try {\n+            Template templateSaved = this.saveTemplate(page, user, pageForm);\n+\n+            String templateId = page.getStringProperty(HTMLPageAssetAPI.TEMPLATE_FIELD);\n+\n+            if (!templateId.equals( templateSaved.getIdentifier() )) {\n+                page.setStringProperty(Contentlet.INODE_KEY, null);\n+                page.setStringProperty(HTMLPageAssetAPI.TEMPLATE_FIELD, templateSaved.getIdentifier());\n+                this.contentletAPI.checkin(page, user, false);\n+            }\n+\n+            return templateSaved;\n+        } catch (Exception e) {\n+            throw new DotRuntimeException(e);\n+        }\n+    }\n+\n+    public Template saveTemplate(final Contentlet page, final User user, final PageForm pageForm)\n+            throws BadRequestException, DotDataException, DotSecurityException, IOException {\n+\n+        try {\n+            final Host host = getHost(pageForm.getHostId(), user);\n+            Template template = getTemplate(page, user, pageForm);\n+\n+            return this.templateAPI.saveTemplate(template, host, user, false);\n+        } catch (Exception e) {\n+            throw new DotRuntimeException(e);\n+        }\n+    }\n+\n+    public Template saveTemplate(final User user, final PageForm pageForm)\n+            throws BadRequestException, DotDataException, DotSecurityException, IOException {","path":"dotCMS/src/main/java/com/dotcms/rest/api/v1/page/PageResourceHelper.java","position":165,"original_position":165,"commit_id":"c0d9e09797d78e0e90552b91d7c6bed8400516cb","original_commit_id":"c0d9e09797d78e0e90552b91d7c6bed8400516cb","user":{"login":"jenkins-dotcms","id":29232833,"avatar_url":"https://avatars2.githubusercontent.com/u/29232833?v=4","gravatar_id":"","url":"https://api.github.com/users/jenkins-dotcms","html_url":"https://github.com/jenkins-dotcms","followers_url":"https://api.github.com/users/jenkins-dotcms/followers","following_url":"https://api.github.com/users/jenkins-dotcms/following{/other_user}","gists_url":"https://api.github.com/users/jenkins-dotcms/gists{/gist_id}","starred_url":"https://api.github.com/users/jenkins-dotcms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenkins-dotcms/subscriptions","organizations_url":"https://api.github.com/users/jenkins-dotcms/orgs","repos_url":"https://api.github.com/users/jenkins-dotcms/repos","events_url":"https://api.github.com/users/jenkins-dotcms/events{/privacy}","received_events_url":"https://api.github.com/users/jenkins-dotcms/received_events","type":"User","site_admin":false},"body":"![MINOR](https://sonarsource.github.io/sonar-github/severity-minor.png 'Severity: MINOR') Remove the declaration of thrown exception 'com.dotcms.rest.exception.BadRequestException' which is a runtime exception. [![rule](https://sonarsource.github.io/sonar-github/rule.png)](https://sonarcloud.io/coding_rules#rule_key=squid%3ARedundantThrowsDeclarationCheck)\n","created_at":"2017-11-20T17:35:40Z","updated_at":"2017-11-20T17:35:40Z","html_url":"https://github.com/dotCMS/core/pull/13079#discussion_r152059578","pull_request_url":"https://api.github.com/repos/dotCMS/core/pulls/13079","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/dotCMS/core/pulls/comments/152059578"},"html":{"href":"https://github.com/dotCMS/core/pull/13079#discussion_r152059578"},"pull_request":{"href":"https://api.github.com/repos/dotCMS/core/pulls/13079"}}},"pull_request":{"url":"https://api.github.com/repos/dotCMS/core/pulls/13079","id":153321876,"html_url":"https://github.com/dotCMS/core/pull/13079","diff_url":"https://github.com/dotCMS/core/pull/13079.diff","patch_url":"https://github.com/dotCMS/core/pull/13079.patch","issue_url":"https://api.github.com/repos/dotCMS/core/issues/13079","number":13079,"state":"open","locked":false,"title":"Create endpoint to save the layout","user":{"login":"freddyucv","id":10408015,"avatar_url":"https://avatars1.githubusercontent.com/u/10408015?v=4","gravatar_id":"","url":"https://api.github.com/users/freddyucv","html_url":"https://github.com/freddyucv","followers_url":"https://api.github.com/users/freddyucv/followers","following_url":"https://api.github.com/users/freddyucv/following{/other_user}","gists_url":"https://api.github.com/users/freddyucv/gists{/gist_id}","starred_url":"https://api.github.com/users/freddyucv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freddyucv/subscriptions","organizations_url":"https://api.github.com/users/freddyucv/orgs","repos_url":"https://api.github.com/users/freddyucv/repos","events_url":"https://api.github.com/users/freddyucv/events{/privacy}","received_events_url":"https://api.github.com/users/freddyucv/received_events","type":"User","site_admin":false},"body":"#13012 ","created_at":"2017-11-17T15:18:03Z","updated_at":"2017-11-20T17:35:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8d43821e2d663c973a3febaab03b70a709ef76b7","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/dotCMS/core/pulls/13079/commits","review_comments_url":"https://api.github.com/repos/dotCMS/core/pulls/13079/comments","review_comment_url":"https://api.github.com/repos/dotCMS/core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotCMS/core/issues/13079/comments","statuses_url":"https://api.github.com/repos/dotCMS/core/statuses/c0d9e09797d78e0e90552b91d7c6bed8400516cb","head":{"label":"dotCMS:issue-13012-Create-endpoint-to-save-the-layout","ref":"issue-13012-Create-endpoint-to-save-the-layout","sha":"c0d9e09797d78e0e90552b91d7c6bed8400516cb","user":{"login":"dotCMS","id":1005263,"avatar_url":"https://avatars3.githubusercontent.com/u/1005263?v=4","gravatar_id":"","url":"https://api.github.com/users/dotCMS","html_url":"https://github.com/dotCMS","followers_url":"https://api.github.com/users/dotCMS/followers","following_url":"https://api.github.com/users/dotCMS/following{/other_user}","gists_url":"https://api.github.com/users/dotCMS/gists{/gist_id}","starred_url":"https://api.github.com/users/dotCMS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotCMS/subscriptions","organizations_url":"https://api.github.com/users/dotCMS/orgs","repos_url":"https://api.github.com/users/dotCMS/repos","events_url":"https://api.github.com/users/dotCMS/events{/privacy}","received_events_url":"https://api.github.com/users/dotCMS/received_events","type":"Organization","site_admin":false},"repo":{"id":3729629,"name":"core","full_name":"dotCMS/core","owner":{"login":"dotCMS","id":1005263,"avatar_url":"https://avatars3.githubusercontent.com/u/1005263?v=4","gravatar_id":"","url":"https://api.github.com/users/dotCMS","html_url":"https://github.com/dotCMS","followers_url":"https://api.github.com/users/dotCMS/followers","following_url":"https://api.github.com/users/dotCMS/following{/other_user}","gists_url":"https://api.github.com/users/dotCMS/gists{/gist_id}","starred_url":"https://api.github.com/users/dotCMS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotCMS/subscriptions","organizations_url":"https://api.github.com/users/dotCMS/orgs","repos_url":"https://api.github.com/users/dotCMS/repos","events_url":"https://api.github.com/users/dotCMS/events{/privacy}","received_events_url":"https://api.github.com/users/dotCMS/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotCMS/core","description":"Source Code for dotCMS Java Enterprise Content Management System","fork":false,"url":"https://api.github.com/repos/dotCMS/core","forks_url":"https://api.github.com/repos/dotCMS/core/forks","keys_url":"https://api.github.com/repos/dotCMS/core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotCMS/core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotCMS/core/teams","hooks_url":"https://api.github.com/repos/dotCMS/core/hooks","issue_events_url":"https://api.github.com/repos/dotCMS/core/issues/events{/number}","events_url":"https://api.github.com/repos/dotCMS/core/events","assignees_url":"https://api.github.com/repos/dotCMS/core/assignees{/user}","branches_url":"https://api.github.com/repos/dotCMS/core/branches{/branch}","tags_url":"https://api.github.com/repos/dotCMS/core/tags","blobs_url":"https://api.github.com/repos/dotCMS/core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotCMS/core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotCMS/core/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotCMS/core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotCMS/core/statuses/{sha}","languages_url":"https://api.github.com/repos/dotCMS/core/languages","stargazers_url":"https://api.github.com/repos/dotCMS/core/stargazers","contributors_url":"https://api.github.com/repos/dotCMS/core/contributors","subscribers_url":"https://api.github.com/repos/dotCMS/core/subscribers","subscription_url":"https://api.github.com/repos/dotCMS/core/subscription","commits_url":"https://api.github.com/repos/dotCMS/core/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotCMS/core/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotCMS/core/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotCMS/core/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotCMS/core/contents/{+path}","compare_url":"https://api.github.com/repos/dotCMS/core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotCMS/core/merges","archive_url":"https://api.github.com/repos/dotCMS/core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotCMS/core/downloads","issues_url":"https://api.github.com/repos/dotCMS/core/issues{/number}","pulls_url":"https://api.github.com/repos/dotCMS/core/pulls{/number}","milestones_url":"https://api.github.com/repos/dotCMS/core/milestones{/number}","notifications_url":"https://api.github.com/repos/dotCMS/core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotCMS/core/labels{/name}","releases_url":"https://api.github.com/repos/dotCMS/core/releases{/id}","deployments_url":"https://api.github.com/repos/dotCMS/core/deployments","created_at":"2012-03-15T15:24:14Z","updated_at":"2017-11-16T16:22:20Z","pushed_at":"2017-11-20T17:30:31Z","git_url":"git://github.com/dotCMS/core.git","ssh_url":"git@github.com:dotCMS/core.git","clone_url":"https://github.com/dotCMS/core.git","svn_url":"https://github.com/dotCMS/core","homepage":"http://dotcms.com","size":287697,"stargazers_count":342,"watchers_count":342,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":301,"mirror_url":null,"archived":false,"open_issues_count":1704,"forks":301,"open_issues":1704,"watchers":342,"default_branch":"master"}},"base":{"label":"dotCMS:master","ref":"master","sha":"228b7e4ba1b416c31fc228ca776596429aa6366b","user":{"login":"dotCMS","id":1005263,"avatar_url":"https://avatars3.githubusercontent.com/u/1005263?v=4","gravatar_id":"","url":"https://api.github.com/users/dotCMS","html_url":"https://github.com/dotCMS","followers_url":"https://api.github.com/users/dotCMS/followers","following_url":"https://api.github.com/users/dotCMS/following{/other_user}","gists_url":"https://api.github.com/users/dotCMS/gists{/gist_id}","starred_url":"https://api.github.com/users/dotCMS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotCMS/subscriptions","organizations_url":"https://api.github.com/users/dotCMS/orgs","repos_url":"https://api.github.com/users/dotCMS/repos","events_url":"https://api.github.com/users/dotCMS/events{/privacy}","received_events_url":"https://api.github.com/users/dotCMS/received_events","type":"Organization","site_admin":false},"repo":{"id":3729629,"name":"core","full_name":"dotCMS/core","owner":{"login":"dotCMS","id":1005263,"avatar_url":"https://avatars3.githubusercontent.com/u/1005263?v=4","gravatar_id":"","url":"https://api.github.com/users/dotCMS","html_url":"https://github.com/dotCMS","followers_url":"https://api.github.com/users/dotCMS/followers","following_url":"https://api.github.com/users/dotCMS/following{/other_user}","gists_url":"https://api.github.com/users/dotCMS/gists{/gist_id}","starred_url":"https://api.github.com/users/dotCMS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotCMS/subscriptions","organizations_url":"https://api.github.com/users/dotCMS/orgs","repos_url":"https://api.github.com/users/dotCMS/repos","events_url":"https://api.github.com/users/dotCMS/events{/privacy}","received_events_url":"https://api.github.com/users/dotCMS/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotCMS/core","description":"Source Code for dotCMS Java Enterprise Content Management System","fork":false,"url":"https://api.github.com/repos/dotCMS/core","forks_url":"https://api.github.com/repos/dotCMS/core/forks","keys_url":"https://api.github.com/repos/dotCMS/core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotCMS/core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotCMS/core/teams","hooks_url":"https://api.github.com/repos/dotCMS/core/hooks","issue_events_url":"https://api.github.com/repos/dotCMS/core/issues/events{/number}","events_url":"https://api.github.com/repos/dotCMS/core/events","assignees_url":"https://api.github.com/repos/dotCMS/core/assignees{/user}","branches_url":"https://api.github.com/repos/dotCMS/core/branches{/branch}","tags_url":"https://api.github.com/repos/dotCMS/core/tags","blobs_url":"https://api.github.com/repos/dotCMS/core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotCMS/core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotCMS/core/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotCMS/core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotCMS/core/statuses/{sha}","languages_url":"https://api.github.com/repos/dotCMS/core/languages","stargazers_url":"https://api.github.com/repos/dotCMS/core/stargazers","contributors_url":"https://api.github.com/repos/dotCMS/core/contributors","subscribers_url":"https://api.github.com/repos/dotCMS/core/subscribers","subscription_url":"https://api.github.com/repos/dotCMS/core/subscription","commits_url":"https://api.github.com/repos/dotCMS/core/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotCMS/core/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotCMS/core/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotCMS/core/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotCMS/core/contents/{+path}","compare_url":"https://api.github.com/repos/dotCMS/core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotCMS/core/merges","archive_url":"https://api.github.com/repos/dotCMS/core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotCMS/core/downloads","issues_url":"https://api.github.com/repos/dotCMS/core/issues{/number}","pulls_url":"https://api.github.com/repos/dotCMS/core/pulls{/number}","milestones_url":"https://api.github.com/repos/dotCMS/core/milestones{/number}","notifications_url":"https://api.github.com/repos/dotCMS/core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotCMS/core/labels{/name}","releases_url":"https://api.github.com/repos/dotCMS/core/releases{/id}","deployments_url":"https://api.github.com/repos/dotCMS/core/deployments","created_at":"2012-03-15T15:24:14Z","updated_at":"2017-11-16T16:22:20Z","pushed_at":"2017-11-20T17:30:31Z","git_url":"git://github.com/dotCMS/core.git","ssh_url":"git@github.com:dotCMS/core.git","clone_url":"https://github.com/dotCMS/core.git","svn_url":"https://github.com/dotCMS/core","homepage":"http://dotcms.com","size":287697,"stargazers_count":342,"watchers_count":342,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":301,"mirror_url":null,"archived":false,"open_issues_count":1704,"forks":301,"open_issues":1704,"watchers":342,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotCMS/core/pulls/13079"},"html":{"href":"https://github.com/dotCMS/core/pull/13079"},"issue":{"href":"https://api.github.com/repos/dotCMS/core/issues/13079"},"comments":{"href":"https://api.github.com/repos/dotCMS/core/issues/13079/comments"},"review_comments":{"href":"https://api.github.com/repos/dotCMS/core/pulls/13079/comments"},"review_comment":{"href":"https://api.github.com/repos/dotCMS/core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotCMS/core/pulls/13079/commits"},"statuses":{"href":"https://api.github.com/repos/dotCMS/core/statuses/c0d9e09797d78e0e90552b91d7c6bed8400516cb"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"jenkins-dotcms"}}