{"action":"created","comment":{"url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/pulls/comments/69527657","id":69527657,"diff_hunk":"@@ -22,8 +30,22 @@\n     \n     static final String RADIOLOGY_DASHBOARD_FORM_VIEW = \"/module/radiology/radiologyDashboardForm\";\n     \n+    @Autowired\n+    private MrrtReportTemplateService mrrtReportTemplateService;\n+    \n     @RequestMapping(method = RequestMethod.GET)\n     protected ModelAndView get() {\n         return new ModelAndView(RADIOLOGY_DASHBOARD_FORM_VIEW);\n     }\n+    \n+    @RequestMapping(method = RequestMethod.POST)\n+    protected ModelAndView upload(HttpServletRequest request) throws IOException {\n+        final MultipartHttpServletRequest multipartHttpServletRequest = (MultipartHttpServletRequest) request;\n+        final MultipartFile templateFile = multipartHttpServletRequest.getFile(\"templateFile\");\n+        \n+        mrrtReportTemplateService.importMrrtReportTemplate(templateFile.getOriginalFilename(),","path":"omod/src/main/java/org/openmrs/module/radiology/order/web/RadiologyDashboardFormController.java","position":35,"original_position":35,"commit_id":"446354612eb98817faa44d9f39a5470e7ca6878d","original_commit_id":"446354612eb98817faa44d9f39a5470e7ca6878d","user":{"login":"teleivo","id":4661144,"avatar_url":"https://avatars.githubusercontent.com/u/4661144?v=3","gravatar_id":"","url":"https://api.github.com/users/teleivo","html_url":"https://github.com/teleivo","followers_url":"https://api.github.com/users/teleivo/followers","following_url":"https://api.github.com/users/teleivo/following{/other_user}","gists_url":"https://api.github.com/users/teleivo/gists{/gist_id}","starred_url":"https://api.github.com/users/teleivo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teleivo/subscriptions","organizations_url":"https://api.github.com/users/teleivo/orgs","repos_url":"https://api.github.com/users/teleivo/repos","events_url":"https://api.github.com/users/teleivo/events{/privacy}","received_events_url":"https://api.github.com/users/teleivo/received_events","type":"User","site_admin":false},"body":"@ivange94 do we need the filename? I would get rid of it. our API should be easy to use, this isnt really easy to understand. whats the filename used for?\r\n\r\ncan we pass in the file? or thats what wasnt possible right? since its a security issue. so I assume we can only use a stream.\r\n\r\nit seems you are complicating things a bit.\r\n\r\njsoup has [parse(InputStream in, String charsetName, String baseUri)](https://github.com/jhy/jsoup/blob/master/src/main/java/org/jsoup/Jsoup.java#L117)\r\n\r\nso we do not need to provide `MrrtReportTemplateFileParser.parse(File)`, at least not now.\r\n\r\nI would only provide `MrrtReportTemplateFileParser.parse(InputStream)` which parses (extracts metadata into `MrrtReportTemplate` the `MrrtReportTemplateService` should take care of storing the file on the filesystem (since it has access to the RadiologyProperties and knows where to store it). `MrrtReportTemplateFileParser` should not care, it has only one concern.\r\n\r\nThink of the process of importing as 3 steps:\r\n\r\n* validate\r\n* parse\r\n* store\r\n\r\ndone by the `MrrtReportTemplateService` with help of a MrrtReportTemplateValidator, MrrtReportTemplateParser and RadiologyProperties for the storage dir.\r\n\r\nWe are almost there!","created_at":"2016-07-05T08:55:26Z","updated_at":"2016-07-05T08:55:26Z","html_url":"https://github.com/openmrs/openmrs-module-radiology/pull/333#discussion_r69527657","pull_request_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/pulls/333","_links":{"self":{"href":"https://api.github.com/repos/openmrs/openmrs-module-radiology/pulls/comments/69527657"},"html":{"href":"https://github.com/openmrs/openmrs-module-radiology/pull/333#discussion_r69527657"},"pull_request":{"href":"https://api.github.com/repos/openmrs/openmrs-module-radiology/pulls/333"}}},"pull_request":{"url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/pulls/333","id":76113434,"html_url":"https://github.com/openmrs/openmrs-module-radiology/pull/333","diff_url":"https://github.com/openmrs/openmrs-module-radiology/pull/333.diff","patch_url":"https://github.com/openmrs/openmrs-module-radiology/pull/333.patch","issue_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/issues/333","number":333,"state":"open","locked":false,"title":"Can now import templates into the system. ","user":{"login":"ivange94","id":11330494,"avatar_url":"https://avatars.githubusercontent.com/u/11330494?v=3","gravatar_id":"","url":"https://api.github.com/users/ivange94","html_url":"https://github.com/ivange94","followers_url":"https://api.github.com/users/ivange94/followers","following_url":"https://api.github.com/users/ivange94/following{/other_user}","gists_url":"https://api.github.com/users/ivange94/gists{/gist_id}","starred_url":"https://api.github.com/users/ivange94/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ivange94/subscriptions","organizations_url":"https://api.github.com/users/ivange94/orgs","repos_url":"https://api.github.com/users/ivange94/repos","events_url":"https://api.github.com/users/ivange94/events{/privacy}","received_events_url":"https://api.github.com/users/ivange94/received_events","type":"User","site_admin":false},"body":"<!--- Provide PR Title above as: 'RAD-JiraIssueNumber JiraIssueTitle' -->\r\nCan now import templates into the system.\r\n\r\n## Description\r\n<!--- Describe your changes in detail -->\r\nThis pull request holds work done here, https://github.com/openmrs/openmrs-module-radiology/pull/304 . And all comments resolved.\r\n\r\nadded a parser to parse mrrt template file. Added a unit test and a real life mrrt template for testing\r\n\r\nimplemented templates tab with popup\r\n\r\nremoved some duplicate codes in messages.properties that entered due to cherry-picking a commit from another branch\r\n\r\nadded View Radiology Report Templates privilege which is used in radiologyReportTemplatesTab.jsp\r\n\r\ndeleted a duplicate file\r\n\r\nresolved @teleivo's comment which include, implementing getMrrtReportTemplateByUuid() and deleting MrrtReportTemplateException.java\r\n\r\nadded unit test covering getMrrtReportTemplateByUuid()\r\n\r\nAdded MrrtReportTemplateResource.java\r\n\r\ncan now import templates from ui\r\n\r\nattemted to resolve @telivos comment, but still facing a null pointer exception. the problem is with the way i configured my MrrtReportTemplateFileParser bean inside moduleApplicationContext.xml\r\n\r\nadded a service method to get all templates by title and also implemented a search handler for templates\r\n\r\ndeleted unnecessary parse(String) method\r\n\r\nused Criteria in HibernateDAO\r\n\r\nmade DefaultMrrtReportTemplateParser package private\r\n\r\nmade local variables final\r\n\r\nreengineered MrrtReportTemplate to extend BaseOpenmrsData and also renamed MrrtReportTemplateServiceTest to MrrtReportTemplateComponentTest to conform to other service tests\r\n\r\nchanged superclass of MrrtReportTemplateResource\r\n\r\nrenamed resource properties\r\n\r\nresource was returning no description in default representation mode. Fixed it\r\n\r\nuse REST in template tab\r\n\r\nfixed problem with find button not firing in radiologyReportTemplatesTab\r\n\r\nmoved BaseOpenmrsData properties to the end of the database\r\n\r\nadded a GP for templates folder\r\n\r\nrenamed button id on templates tab page\r\n\r\nstarted implementing validator but am still have a null pointer exception\r\n\r\ndid some code clean ups, adding unit tests, started with implementation of validator, removed code in controller that was importing templates and will put inside an import method in the MrrtReportTemplateService\r\n\r\nimplemented importReportTemplate method\r\n\r\nimplemented small part of validation. File validation\r\n## Related Issue\r\n<!--- This project only accepts pull requests related to open issues -->\r\n<!--- If suggesting a new feature or change, please discuss it in an issue\r\nfirst -->\r\n<!--- If fixing a bug, there should be an issue describing it with steps to\r\nreproduce -->\r\n<!--- Please link to the issue here: -->\r\nsee https://issues.openmrs.org/browse/RAD-272\r\n\r\n## Checklist:\r\n<!--- Go over all the following points, and put an `x` in all the boxes that\r\napply. -->\r\n<!--- If you're unsure about any of these, don't hesitate to ask. We're here to\r\nhelp! -->\r\n- [x] My pull request only contains one single commit.\r\n- [x] My pull request is based on the latest master branch\r\n  `git pull --rebase upstream master`.\r\n- [x] I ran `mvn clean package` right before creating this pull request and\r\n  added all formatting changes to my commit.\r\n- [x] My code follows the code style of this project.\r\n- [x] I have read the **CONTRIBUTING** document.\r\n- [x] I have added tests to cover my changes.\r\n- [x] All new and existing tests passed.","created_at":"2016-07-04T05:17:20Z","updated_at":"2016-07-05T08:55:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"79a1d1f9a328c8a6a17f1670908fc9b8aeef03b3","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/pulls/333/commits","review_comments_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/pulls/333/comments","review_comment_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/issues/333/comments","statuses_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/statuses/446354612eb98817faa44d9f39a5470e7ca6878d","head":{"label":"ivange94:RAD-272-part1","ref":"RAD-272-part1","sha":"446354612eb98817faa44d9f39a5470e7ca6878d","user":{"login":"ivange94","id":11330494,"avatar_url":"https://avatars.githubusercontent.com/u/11330494?v=3","gravatar_id":"","url":"https://api.github.com/users/ivange94","html_url":"https://github.com/ivange94","followers_url":"https://api.github.com/users/ivange94/followers","following_url":"https://api.github.com/users/ivange94/following{/other_user}","gists_url":"https://api.github.com/users/ivange94/gists{/gist_id}","starred_url":"https://api.github.com/users/ivange94/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ivange94/subscriptions","organizations_url":"https://api.github.com/users/ivange94/orgs","repos_url":"https://api.github.com/users/ivange94/repos","events_url":"https://api.github.com/users/ivange94/events{/privacy}","received_events_url":"https://api.github.com/users/ivange94/received_events","type":"User","site_admin":false},"repo":{"id":53416892,"name":"openmrs-module-radiology","full_name":"ivange94/openmrs-module-radiology","owner":{"login":"ivange94","id":11330494,"avatar_url":"https://avatars.githubusercontent.com/u/11330494?v=3","gravatar_id":"","url":"https://api.github.com/users/ivange94","html_url":"https://github.com/ivange94","followers_url":"https://api.github.com/users/ivange94/followers","following_url":"https://api.github.com/users/ivange94/following{/other_user}","gists_url":"https://api.github.com/users/ivange94/gists{/gist_id}","starred_url":"https://api.github.com/users/ivange94/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ivange94/subscriptions","organizations_url":"https://api.github.com/users/ivange94/orgs","repos_url":"https://api.github.com/users/ivange94/repos","events_url":"https://api.github.com/users/ivange94/events{/privacy}","received_events_url":"https://api.github.com/users/ivange94/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ivange94/openmrs-module-radiology","description":"OpenMRS Radiology Module with dcm4chee","fork":true,"url":"https://api.github.com/repos/ivange94/openmrs-module-radiology","forks_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/forks","keys_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/teams","hooks_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/hooks","issue_events_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/issues/events{/number}","events_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/events","assignees_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/assignees{/user}","branches_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/branches{/branch}","tags_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/tags","blobs_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/git/refs{/sha}","trees_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/statuses/{sha}","languages_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/languages","stargazers_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/stargazers","contributors_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/contributors","subscribers_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/subscribers","subscription_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/subscription","commits_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/commits{/sha}","git_commits_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/git/commits{/sha}","comments_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/comments{/number}","issue_comment_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/issues/comments{/number}","contents_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/contents/{+path}","compare_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/merges","archive_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/downloads","issues_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/issues{/number}","pulls_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/pulls{/number}","milestones_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/milestones{/number}","notifications_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/labels{/name}","releases_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/releases{/id}","deployments_url":"https://api.github.com/repos/ivange94/openmrs-module-radiology/deployments","created_at":"2016-03-08T14:05:49Z","updated_at":"2016-03-08T14:05:50Z","pushed_at":"2016-07-04T05:09:39Z","git_url":"git://github.com/ivange94/openmrs-module-radiology.git","ssh_url":"git@github.com:ivange94/openmrs-module-radiology.git","clone_url":"https://github.com/ivange94/openmrs-module-radiology.git","svn_url":"https://github.com/ivange94/openmrs-module-radiology","homepage":null,"size":71727,"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":"openmrs:master","ref":"master","sha":"918f6e9b0ba1ac6d194be1fa14984b0f610622bf","user":{"login":"openmrs","id":860776,"avatar_url":"https://avatars.githubusercontent.com/u/860776?v=3","gravatar_id":"","url":"https://api.github.com/users/openmrs","html_url":"https://github.com/openmrs","followers_url":"https://api.github.com/users/openmrs/followers","following_url":"https://api.github.com/users/openmrs/following{/other_user}","gists_url":"https://api.github.com/users/openmrs/gists{/gist_id}","starred_url":"https://api.github.com/users/openmrs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openmrs/subscriptions","organizations_url":"https://api.github.com/users/openmrs/orgs","repos_url":"https://api.github.com/users/openmrs/repos","events_url":"https://api.github.com/users/openmrs/events{/privacy}","received_events_url":"https://api.github.com/users/openmrs/received_events","type":"Organization","site_admin":false},"repo":{"id":13028147,"name":"openmrs-module-radiology","full_name":"openmrs/openmrs-module-radiology","owner":{"login":"openmrs","id":860776,"avatar_url":"https://avatars.githubusercontent.com/u/860776?v=3","gravatar_id":"","url":"https://api.github.com/users/openmrs","html_url":"https://github.com/openmrs","followers_url":"https://api.github.com/users/openmrs/followers","following_url":"https://api.github.com/users/openmrs/following{/other_user}","gists_url":"https://api.github.com/users/openmrs/gists{/gist_id}","starred_url":"https://api.github.com/users/openmrs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openmrs/subscriptions","organizations_url":"https://api.github.com/users/openmrs/orgs","repos_url":"https://api.github.com/users/openmrs/repos","events_url":"https://api.github.com/users/openmrs/events{/privacy}","received_events_url":"https://api.github.com/users/openmrs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openmrs/openmrs-module-radiology","description":"OpenMRS Radiology Module with dcm4chee","fork":false,"url":"https://api.github.com/repos/openmrs/openmrs-module-radiology","forks_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/forks","keys_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/teams","hooks_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/hooks","issue_events_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/issues/events{/number}","events_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/events","assignees_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/assignees{/user}","branches_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/branches{/branch}","tags_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/tags","blobs_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/git/refs{/sha}","trees_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/statuses/{sha}","languages_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/languages","stargazers_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/stargazers","contributors_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/contributors","subscribers_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/subscribers","subscription_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/subscription","commits_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/commits{/sha}","git_commits_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/git/commits{/sha}","comments_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/comments{/number}","issue_comment_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/issues/comments{/number}","contents_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/contents/{+path}","compare_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/merges","archive_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/downloads","issues_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/issues{/number}","pulls_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/pulls{/number}","milestones_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/milestones{/number}","notifications_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/labels{/name}","releases_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/releases{/id}","deployments_url":"https://api.github.com/repos/openmrs/openmrs-module-radiology/deployments","created_at":"2013-09-23T06:03:47Z","updated_at":"2016-05-06T23:06:59Z","pushed_at":"2016-07-04T05:17:20Z","git_url":"git://github.com/openmrs/openmrs-module-radiology.git","ssh_url":"git@github.com:openmrs/openmrs-module-radiology.git","clone_url":"https://github.com/openmrs/openmrs-module-radiology.git","svn_url":"https://github.com/openmrs/openmrs-module-radiology","homepage":null,"size":72352,"stargazers_count":6,"watchers_count":6,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":35,"mirror_url":null,"open_issues_count":1,"forks":35,"open_issues":1,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openmrs/openmrs-module-radiology/pulls/333"},"html":{"href":"https://github.com/openmrs/openmrs-module-radiology/pull/333"},"issue":{"href":"https://api.github.com/repos/openmrs/openmrs-module-radiology/issues/333"},"comments":{"href":"https://api.github.com/repos/openmrs/openmrs-module-radiology/issues/333/comments"},"review_comments":{"href":"https://api.github.com/repos/openmrs/openmrs-module-radiology/pulls/333/comments"},"review_comment":{"href":"https://api.github.com/repos/openmrs/openmrs-module-radiology/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openmrs/openmrs-module-radiology/pulls/333/commits"},"statuses":{"href":"https://api.github.com/repos/openmrs/openmrs-module-radiology/statuses/446354612eb98817faa44d9f39a5470e7ca6878d"}}}}
{"actor":{"display_login":"teleivo"}}