{"action":"created","comment":{"url":"https://api.github.com/repos/spdx/tools/pulls/comments/30450713","id":30450713,"diff_hunk":"@@ -0,0 +1,150 @@\n+/**\r\n+ * Copyright (c) 2011 Source Auditor Inc.\r\n+ *\r\n+ *   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n+ *   you may not use this file except in compliance with the License.\r\n+ *   You may obtain a copy of the License at\r\n+ *\r\n+ *       http://www.apache.org/licenses/LICENSE-2.0\r\n+ *\r\n+ *   Unless required by applicable law or agreed to in writing, software\r\n+ *   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n+ *   See the License for the specific language governing permissions and\r\n+ *   limitations under the License.\r\n+ *\r\n+ */\r\n+package org.spdx.html;\r\n+\r\n+import java.io.File;\r\n+import java.io.FileWriter;\r\n+import java.io.IOException;\r\n+import java.util.ArrayList;\r\n+import java.util.HashMap;\r\n+\r\n+import org.spdx.rdfparser.license.SpdxListedLicense;\r\n+\r\n+import org.json.simple.JSONArray;\r\n+import org.json.simple.JSONObject;\r\n+\r\n+/**\r\n+ * This class holds a JSON file for a license table of contents\r\n+ * @author Kyle E. Mitchell\r\n+ *\r\n+ */\r\n+public class LicenseTOCJSONFile {\r\n+\t\r\n+\tpublic class ListedSpdxLicense {\r\n+\t\tprivate String reference;\r\n+\t\tprivate String refNumber;\r\n+\t\tprivate String licenseId;\r\n+\t\tprivate boolean osiApproved;\r\n+\t\tprivate String licenseName;\r\n+\t\t\r\n+\t\tpublic ListedSpdxLicense() {\r\n+\t\t\treference = null;\r\n+\t\t\trefNumber = null;\r\n+\t\t\tlicenseId = null;\r\n+\t\t\tosiApproved = false;\r\n+\t\t\tlicenseName = null;\r\n+\t\t}\r\n+\t\t\r\n+\t\tpublic ListedSpdxLicense(String reference, String refNumber, \r\n+\t\t\t\tString licenseId, boolean isOsiApproved, String licenseName) {\r\n+\t\t\tthis.reference = reference;\r\n+\t\t\tthis.refNumber = refNumber;\r\n+\t\t\tthis.licenseId = licenseId;\r\n+\t\t\tthis.osiApproved = osiApproved;\r\n+\t\t\tthis.licenseName = licenseName;\r\n+\t\t}\r\n+\r\n+\t\tpublic String getReference() {\r\n+\t\t\treturn reference;\r\n+\t\t}\r\n+\r\n+\t\tpublic void setReference(String reference) {\r\n+\t\t\tthis.reference = reference;\r\n+\t\t}\r\n+\r\n+\t\tpublic String getRefNumber() {\r\n+\t\t\treturn refNumber;\r\n+\t\t}\r\n+\r\n+\t\tpublic void setRefNumber(String refNumber) {\r\n+\t\t\tthis.refNumber = refNumber;\r\n+\t\t}\r\n+\r\n+\t\tpublic String getLicenseId() {\r\n+\t\t\treturn licenseId;\r\n+\t\t}\r\n+\r\n+\t\tpublic void setLicenseId(String licenseId) {\r\n+\t\t\tthis.licenseId = licenseId;\r\n+\t\t}\r\n+\r\n+\t\tpublic boolean getOsiApproved() {\r\n+\t\t\treturn osiApproved;\r\n+\t\t}\r\n+\r\n+\t\tpublic void setOsiApproved(boolean osiApproved) {\r\n+\t\t\tthis.osiApproved = osiApproved;\r\n+\t\t}\r\n+\r\n+\t\tpublic String getLicenseName() {\r\n+\t\t\treturn licenseName;\r\n+\t\t}\r\n+\r\n+\t\tpublic void setLicenseName(String licenseName) {\r\n+\t\t\tthis.licenseName = licenseName;\r\n+\t\t}\r\n+\t}\r\n+\t\r\n+\tArrayList<ListedSpdxLicense> listedLicenses = new ArrayList<ListedSpdxLicense>();\r\n+\t\r\n+\tprivate int currentRefNumber = 1;\r\n+\r\n+\tString version;\r\n+\tString releaseDate;\r\n+\r\n+\tpublic LicenseTOCJSONFile(String version, String releaseDate) {\r\n+\t\tthis.version = version;\r\n+\t\tthis.releaseDate = releaseDate;\r\n+\t}\r\n+\r\n+\tpublic void addLicense(SpdxListedLicense license, String licHTMLReference) {\r\n+\t\tlistedLicenses.add(new ListedSpdxLicense(licHTMLReference, String.valueOf(this.currentRefNumber), \r\n+\t\t\t\tlicense.getLicenseId(), license.isOsiApproved(), license.getName()));\r\n+\t\tcurrentRefNumber++;\r\n+\t}\r\n+\r\n+\tpublic void writeToFile(File jsonFile) throws IOException {\r\n+\t\tFileWriter writer = null;\r\n+\t\tif (!jsonFile.exists()) {\r\n+\t\t\tif (!jsonFile.createNewFile()) {\r\n+\t\t\t\tthrow(new IOException(\"Can not create new file \"+jsonFile.getName()));\r\n+\t\t\t}\r\n+\t\t}\r\n+\t\ttry {\r\n+\t\t\tJSONObject jsonObject = new JSONObject();\r\n+\t\t\tjsonObject.put(\"version\", version);\r\n+\t\t\tjsonObject.put(\"releaseDate\", releaseDate);\r\n+\t\t\tJSONArray licensesList = new JSONArray();\r\n+\t\t\tfor (ListedSpdxLicense license : listedLicenses) {\r\n+\t\t\t\tJSONObject licenseJSON = new JSONObject();\r\n+\t\t\t\tlicenseJSON.put(\"reference\", license.getReference());\r\n+\t\t\t\tlicenseJSON.put(\"referenceNumber\", license.getRefNumber());\r\n+\t\t\t\tlicenseJSON.put(\"id\", license.getLicenseId());\r\n+\t\t\t\tlicenseJSON.put(\"osiApproved\", license.getOsiApproved());\r\n+\t\t\t\tlicenseJSON.put(\"name\", license.getLicenseName());\r\n+\t\t\t\tlicensesList.add(licenseJSON);\r\n+\t\t\t}\r\n+\t\t\tjsonObject.put(\"licenses\", licensesList);\r\n+\t\t\twriter = new FileWriter(jsonFile);\r\n+\t\t\twriter.write(jsonObject.toJSONString());\r","path":"src/org/spdx/html/LicenseTOCJSONFile.java","position":143,"original_position":143,"commit_id":"112623a4141b797190d0bb2cc4744e50e01c6394","original_commit_id":"112623a4141b797190d0bb2cc4744e50e01c6394","user":{"login":"sindresorhus","id":170270,"avatar_url":"https://avatars.githubusercontent.com/u/170270?v=3","gravatar_id":"","url":"https://api.github.com/users/sindresorhus","html_url":"https://github.com/sindresorhus","followers_url":"https://api.github.com/users/sindresorhus/followers","following_url":"https://api.github.com/users/sindresorhus/following{/other_user}","gists_url":"https://api.github.com/users/sindresorhus/gists{/gist_id}","starred_url":"https://api.github.com/users/sindresorhus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sindresorhus/subscriptions","organizations_url":"https://api.github.com/users/sindresorhus/orgs","repos_url":"https://api.github.com/users/sindresorhus/repos","events_url":"https://api.github.com/users/sindresorhus/events{/privacy}","received_events_url":"https://api.github.com/users/sindresorhus/received_events","type":"User","site_admin":false},"body":">  But I for one would like to move forward on the list without waiting for full texts, in part because rubygems/rubygems#1249 is waiting.\r\n\r\n:+1: \r\n\r\n> Perhaps you'd like open an issue on spdx/tools?\r\n\r\nIt would be nice to have those easily accessible from the official source, but I don't have time to deal with the back and forth of such an issue and the current code I use to get it works fine for me.","created_at":"2015-05-15T22:19:51Z","updated_at":"2015-05-15T22:19:51Z","html_url":"https://github.com/spdx/tools/pull/2#discussion_r30450713","pull_request_url":"https://api.github.com/repos/spdx/tools/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/spdx/tools/pulls/comments/30450713"},"html":{"href":"https://github.com/spdx/tools/pull/2#discussion_r30450713"},"pull_request":{"href":"https://api.github.com/repos/spdx/tools/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/spdx/tools/pulls/2","id":35549793,"html_url":"https://github.com/spdx/tools/pull/2","diff_url":"https://github.com/spdx/tools/pull/2.diff","patch_url":"https://github.com/spdx/tools/pull/2.patch","issue_url":"https://api.github.com/repos/spdx/tools/issues/2","number":2,"state":"open","locked":false,"title":"Generate a licenses.json file.","user":{"login":"kemitchell","id":205760,"avatar_url":"https://avatars.githubusercontent.com/u/205760?v=3","gravatar_id":"","url":"https://api.github.com/users/kemitchell","html_url":"https://github.com/kemitchell","followers_url":"https://api.github.com/users/kemitchell/followers","following_url":"https://api.github.com/users/kemitchell/following{/other_user}","gists_url":"https://api.github.com/users/kemitchell/gists{/gist_id}","starred_url":"https://api.github.com/users/kemitchell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kemitchell/subscriptions","organizations_url":"https://api.github.com/users/kemitchell/orgs","repos_url":"https://api.github.com/users/kemitchell/repos","events_url":"https://api.github.com/users/kemitchell/events{/privacy}","received_events_url":"https://api.github.com/users/kemitchell/received_events","type":"User","site_admin":false},"body":"This pull request adds a generator to add a `licenses.json` file containing information about SPDX license identifiers to spdx.org.\r\n\r\nThe work grew out of comments to rubygems/rubygems#1249.","created_at":"2015-05-15T20:52:54Z","updated_at":"2015-05-15T22:19:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4d458c2b75911610b09b41ccd9bab3ba509f5019","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/spdx/tools/pulls/2/commits","review_comments_url":"https://api.github.com/repos/spdx/tools/pulls/2/comments","review_comment_url":"https://api.github.com/repos/spdx/tools/pulls/comments{/number}","comments_url":"https://api.github.com/repos/spdx/tools/issues/2/comments","statuses_url":"https://api.github.com/repos/spdx/tools/statuses/112623a4141b797190d0bb2cc4744e50e01c6394","head":{"label":"kemitchell:licenses.json","ref":"licenses.json","sha":"112623a4141b797190d0bb2cc4744e50e01c6394","user":{"login":"kemitchell","id":205760,"avatar_url":"https://avatars.githubusercontent.com/u/205760?v=3","gravatar_id":"","url":"https://api.github.com/users/kemitchell","html_url":"https://github.com/kemitchell","followers_url":"https://api.github.com/users/kemitchell/followers","following_url":"https://api.github.com/users/kemitchell/following{/other_user}","gists_url":"https://api.github.com/users/kemitchell/gists{/gist_id}","starred_url":"https://api.github.com/users/kemitchell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kemitchell/subscriptions","organizations_url":"https://api.github.com/users/kemitchell/orgs","repos_url":"https://api.github.com/users/kemitchell/repos","events_url":"https://api.github.com/users/kemitchell/events{/privacy}","received_events_url":"https://api.github.com/users/kemitchell/received_events","type":"User","site_admin":false},"repo":{"id":35695899,"name":"tools","full_name":"kemitchell/tools","owner":{"login":"kemitchell","id":205760,"avatar_url":"https://avatars.githubusercontent.com/u/205760?v=3","gravatar_id":"","url":"https://api.github.com/users/kemitchell","html_url":"https://github.com/kemitchell","followers_url":"https://api.github.com/users/kemitchell/followers","following_url":"https://api.github.com/users/kemitchell/following{/other_user}","gists_url":"https://api.github.com/users/kemitchell/gists{/gist_id}","starred_url":"https://api.github.com/users/kemitchell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kemitchell/subscriptions","organizations_url":"https://api.github.com/users/kemitchell/orgs","repos_url":"https://api.github.com/users/kemitchell/repos","events_url":"https://api.github.com/users/kemitchell/events{/privacy}","received_events_url":"https://api.github.com/users/kemitchell/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kemitchell/tools","description":"SPDX Tools","fork":true,"url":"https://api.github.com/repos/kemitchell/tools","forks_url":"https://api.github.com/repos/kemitchell/tools/forks","keys_url":"https://api.github.com/repos/kemitchell/tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kemitchell/tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kemitchell/tools/teams","hooks_url":"https://api.github.com/repos/kemitchell/tools/hooks","issue_events_url":"https://api.github.com/repos/kemitchell/tools/issues/events{/number}","events_url":"https://api.github.com/repos/kemitchell/tools/events","assignees_url":"https://api.github.com/repos/kemitchell/tools/assignees{/user}","branches_url":"https://api.github.com/repos/kemitchell/tools/branches{/branch}","tags_url":"https://api.github.com/repos/kemitchell/tools/tags","blobs_url":"https://api.github.com/repos/kemitchell/tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kemitchell/tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kemitchell/tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/kemitchell/tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kemitchell/tools/statuses/{sha}","languages_url":"https://api.github.com/repos/kemitchell/tools/languages","stargazers_url":"https://api.github.com/repos/kemitchell/tools/stargazers","contributors_url":"https://api.github.com/repos/kemitchell/tools/contributors","subscribers_url":"https://api.github.com/repos/kemitchell/tools/subscribers","subscription_url":"https://api.github.com/repos/kemitchell/tools/subscription","commits_url":"https://api.github.com/repos/kemitchell/tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/kemitchell/tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/kemitchell/tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/kemitchell/tools/issues/comments{/number}","contents_url":"https://api.github.com/repos/kemitchell/tools/contents/{+path}","compare_url":"https://api.github.com/repos/kemitchell/tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kemitchell/tools/merges","archive_url":"https://api.github.com/repos/kemitchell/tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kemitchell/tools/downloads","issues_url":"https://api.github.com/repos/kemitchell/tools/issues{/number}","pulls_url":"https://api.github.com/repos/kemitchell/tools/pulls{/number}","milestones_url":"https://api.github.com/repos/kemitchell/tools/milestones{/number}","notifications_url":"https://api.github.com/repos/kemitchell/tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kemitchell/tools/labels{/name}","releases_url":"https://api.github.com/repos/kemitchell/tools/releases{/id}","created_at":"2015-05-15T20:45:51Z","updated_at":"2015-05-15T20:45:56Z","pushed_at":"2015-05-15T20:46:26Z","git_url":"git://github.com/kemitchell/tools.git","ssh_url":"git@github.com:kemitchell/tools.git","clone_url":"https://github.com/kemitchell/tools.git","svn_url":"https://github.com/kemitchell/tools","homepage":"","size":108451,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"spdx:develop","ref":"develop","sha":"3866b0d3abf9b768dc3b7b1bd11eb413b48ec4b3","user":{"login":"spdx","id":11620174,"avatar_url":"https://avatars.githubusercontent.com/u/11620174?v=3","gravatar_id":"","url":"https://api.github.com/users/spdx","html_url":"https://github.com/spdx","followers_url":"https://api.github.com/users/spdx/followers","following_url":"https://api.github.com/users/spdx/following{/other_user}","gists_url":"https://api.github.com/users/spdx/gists{/gist_id}","starred_url":"https://api.github.com/users/spdx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spdx/subscriptions","organizations_url":"https://api.github.com/users/spdx/orgs","repos_url":"https://api.github.com/users/spdx/repos","events_url":"https://api.github.com/users/spdx/events{/privacy}","received_events_url":"https://api.github.com/users/spdx/received_events","type":"Organization","site_admin":false},"repo":{"id":32760696,"name":"tools","full_name":"spdx/tools","owner":{"login":"spdx","id":11620174,"avatar_url":"https://avatars.githubusercontent.com/u/11620174?v=3","gravatar_id":"","url":"https://api.github.com/users/spdx","html_url":"https://github.com/spdx","followers_url":"https://api.github.com/users/spdx/followers","following_url":"https://api.github.com/users/spdx/following{/other_user}","gists_url":"https://api.github.com/users/spdx/gists{/gist_id}","starred_url":"https://api.github.com/users/spdx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spdx/subscriptions","organizations_url":"https://api.github.com/users/spdx/orgs","repos_url":"https://api.github.com/users/spdx/repos","events_url":"https://api.github.com/users/spdx/events{/privacy}","received_events_url":"https://api.github.com/users/spdx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/spdx/tools","description":"SPDX Tools","fork":false,"url":"https://api.github.com/repos/spdx/tools","forks_url":"https://api.github.com/repos/spdx/tools/forks","keys_url":"https://api.github.com/repos/spdx/tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spdx/tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spdx/tools/teams","hooks_url":"https://api.github.com/repos/spdx/tools/hooks","issue_events_url":"https://api.github.com/repos/spdx/tools/issues/events{/number}","events_url":"https://api.github.com/repos/spdx/tools/events","assignees_url":"https://api.github.com/repos/spdx/tools/assignees{/user}","branches_url":"https://api.github.com/repos/spdx/tools/branches{/branch}","tags_url":"https://api.github.com/repos/spdx/tools/tags","blobs_url":"https://api.github.com/repos/spdx/tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spdx/tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spdx/tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/spdx/tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spdx/tools/statuses/{sha}","languages_url":"https://api.github.com/repos/spdx/tools/languages","stargazers_url":"https://api.github.com/repos/spdx/tools/stargazers","contributors_url":"https://api.github.com/repos/spdx/tools/contributors","subscribers_url":"https://api.github.com/repos/spdx/tools/subscribers","subscription_url":"https://api.github.com/repos/spdx/tools/subscription","commits_url":"https://api.github.com/repos/spdx/tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/spdx/tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/spdx/tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/spdx/tools/issues/comments{/number}","contents_url":"https://api.github.com/repos/spdx/tools/contents/{+path}","compare_url":"https://api.github.com/repos/spdx/tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spdx/tools/merges","archive_url":"https://api.github.com/repos/spdx/tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spdx/tools/downloads","issues_url":"https://api.github.com/repos/spdx/tools/issues{/number}","pulls_url":"https://api.github.com/repos/spdx/tools/pulls{/number}","milestones_url":"https://api.github.com/repos/spdx/tools/milestones{/number}","notifications_url":"https://api.github.com/repos/spdx/tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spdx/tools/labels{/name}","releases_url":"https://api.github.com/repos/spdx/tools/releases{/id}","created_at":"2015-03-23T21:46:19Z","updated_at":"2015-03-25T17:24:06Z","pushed_at":"2015-05-15T20:52:54Z","git_url":"git://github.com/spdx/tools.git","ssh_url":"git@github.com:spdx/tools.git","clone_url":"https://github.com/spdx/tools.git","svn_url":"https://github.com/spdx/tools","homepage":"","size":108634,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":"http://git.spdx.org/spdx-tools.git","open_issues_count":2,"forks":2,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/spdx/tools/pulls/2"},"html":{"href":"https://github.com/spdx/tools/pull/2"},"issue":{"href":"https://api.github.com/repos/spdx/tools/issues/2"},"comments":{"href":"https://api.github.com/repos/spdx/tools/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/spdx/tools/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/spdx/tools/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/spdx/tools/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/spdx/tools/statuses/112623a4141b797190d0bb2cc4744e50e01c6394"}}}}