{"action":"created","comment":{"url":"https://api.github.com/repos/codice/alliance/pulls/comments/66649608","id":66649608,"diff_hunk":"@@ -0,0 +1,124 @@\n+/**\n+ * Copyright (c) Codice Foundation\n+ * <p>\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+ * <p>\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+package org.codice.alliance.imaging.chip.actionprovider;\n+\n+import java.net.MalformedURLException;\n+import java.net.URL;\n+import java.util.Arrays;\n+import java.util.List;\n+\n+import org.codice.ddf.configuration.SystemBaseUrl;\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+\n+import com.vividsolutions.jts.geom.Coordinate;\n+import com.vividsolutions.jts.geom.Geometry;\n+import com.vividsolutions.jts.io.ParseException;\n+import com.vividsolutions.jts.io.WKTReader;\n+\n+import ddf.action.Action;\n+import ddf.action.ActionProvider;\n+import ddf.action.impl.ActionImpl;\n+import ddf.catalog.data.Metacard;\n+\n+public class ImagingChipActionProvider implements ActionProvider {\n+\n+    private static final Logger LOGGER = LoggerFactory.getLogger(ImagingChipActionProvider.class);\n+\n+    public static final String TITLE = \"Chip Image\";\n+\n+    public static final String DESCRIPTION =\n+            \"Opens a new window to enter the boundaries of an image chip for a Metacard.\";\n+\n+    public static final String PATH = \"/chipping/chipping.html\";\n+\n+    public static final String ID = \"image-chipping-action-view\";\n+\n+    public static final String NITF_CONTENT_TYPE = \"image/nitf\";\n+\n+    @Override\n+    public <T> List<Action> getActions(T input) {\n+        if (input == null) {\n+            LOGGER.warn(\"Metacard can not be null.\");\n+            return null;\n+        }\n+\n+        if (canHandle(input)) {\n+            final Metacard metacard = (Metacard) input;\n+\n+            URL url;\n+            String chipPath = null;\n+            try {\n+                WKTReader wktReader = new WKTReader();\n+                Geometry geometry = wktReader.read(metacard.getLocation());\n+                String location = getBoxDimensionString(geometry.getEnvelope()\n+                        .getCoordinates());\n+                chipPath =\n+                        SystemBaseUrl.getBaseUrl() + PATH + \"?id=\" + metacard.getId() + \"&source=\"\n+                                + metacard.getSourceId() + \"&location=\" + location.substring(0,\n+                                location.length() - 1);\n+                url = new URL(chipPath);\n+            } catch (MalformedURLException e) {\n+                LOGGER.debug(\"Invalid URL for chipping path : {}\", chipPath, e);\n+                return null;\n+            } catch (ParseException e) {\n+                LOGGER.debug(\"Cannot parse metacard geometry: {}\", metacard.getLocation(), e);\n+                return null;\n+            }\n+            return Arrays.asList(new ActionImpl(getId(), TITLE, DESCRIPTION, url));\n+        }\n+        return null;\n+    }\n+\n+    @Override\n+    public String getId() {\n+        return ID;\n+    }\n+\n+    @Override\n+    public <T> boolean canHandle(T subject) {\n+        if (subject instanceof Metacard) {\n+            Metacard metacard = (Metacard) subject;\n+            String contentTypeName = metacard.getContentTypeName();\n+            if (contentTypeName != null && contentTypeName.equals(NITF_CONTENT_TYPE)\n+                    && metacard.getLocation() != null) {\n+                return true;\n+            }\n+        }\n+        return false;\n+    }\n+\n+    private String getBoxDimensionString(Coordinate[] coordinates) {\n+        double north = coordinates[0].y;","path":"catalog/imaging/imaging-actionprovider-chip/src/main/java/org/codice/alliance/imaging/chip/actionprovider/ImagingChipActionProvider.java","position":103,"original_position":103,"commit_id":"3f16daf6c39e72d131bd03b21e13eab35eb4cf93","original_commit_id":"3f16daf6c39e72d131bd03b21e13eab35eb4cf93","user":{"login":"jrnorth","id":4495447,"avatar_url":"https://avatars.githubusercontent.com/u/4495447?v=3","gravatar_id":"","url":"https://api.github.com/users/jrnorth","html_url":"https://github.com/jrnorth","followers_url":"https://api.github.com/users/jrnorth/followers","following_url":"https://api.github.com/users/jrnorth/following{/other_user}","gists_url":"https://api.github.com/users/jrnorth/gists{/gist_id}","starred_url":"https://api.github.com/users/jrnorth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrnorth/subscriptions","organizations_url":"https://api.github.com/users/jrnorth/orgs","repos_url":"https://api.github.com/users/jrnorth/repos","events_url":"https://api.github.com/users/jrnorth/events{/privacy}","received_events_url":"https://api.github.com/users/jrnorth/received_events","type":"User","site_admin":false},"body":"Would this work?\r\n```\r\ngetBoxDimensionString(geometry.getEnvelopeInternal());\r\n...\r\nprivate String getBoxDimensionString(Envelope envelope) {\r\n    double north = envelope.getMaxY();\r\n    double south = envelope.getMinY();\r\n    double east = envelope.getMaxX();\r\n    double west = envelope.getMinX();\r\n    return ...\r\n}\r\n```","created_at":"2016-06-10T17:20:54Z","updated_at":"2016-06-10T17:20:54Z","html_url":"https://github.com/codice/alliance/pull/62#discussion_r66649608","pull_request_url":"https://api.github.com/repos/codice/alliance/pulls/62","_links":{"self":{"href":"https://api.github.com/repos/codice/alliance/pulls/comments/66649608"},"html":{"href":"https://github.com/codice/alliance/pull/62#discussion_r66649608"},"pull_request":{"href":"https://api.github.com/repos/codice/alliance/pulls/62"}}},"pull_request":{"url":"https://api.github.com/repos/codice/alliance/pulls/62","id":73130762,"html_url":"https://github.com/codice/alliance/pull/62","diff_url":"https://github.com/codice/alliance/pull/62.diff","patch_url":"https://github.com/codice/alliance/pull/62.patch","issue_url":"https://api.github.com/repos/codice/alliance/issues/62","number":62,"state":"open","locked":false,"title":"CAL-53 Added Metacard Action for Image Chipping","user":{"login":"bdeining","id":6551038,"avatar_url":"https://avatars.githubusercontent.com/u/6551038?v=3","gravatar_id":"","url":"https://api.github.com/users/bdeining","html_url":"https://github.com/bdeining","followers_url":"https://api.github.com/users/bdeining/followers","following_url":"https://api.github.com/users/bdeining/following{/other_user}","gists_url":"https://api.github.com/users/bdeining/gists{/gist_id}","starred_url":"https://api.github.com/users/bdeining/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bdeining/subscriptions","organizations_url":"https://api.github.com/users/bdeining/orgs","repos_url":"https://api.github.com/users/bdeining/repos","events_url":"https://api.github.com/users/bdeining/events{/privacy}","received_events_url":"https://api.github.com/users/bdeining/received_events","type":"User","site_admin":false},"body":"#### What does this PR do?\r\nThis PR adds an Action Page for the Image Chipping Service\r\n#### Who is reviewing it?\r\n@dcruver @glenhein \r\n@jlcsmith @kcwire \r\n#### How should this be tested?\r\nBuild Alliance and Install.  Ingest a NITF that has a Geolocation.  Click the `Chip Image` Action from the Action tab and Chip the image in various ways.\r\n#### Any background context you want to provide?\r\nThis PR is intended to be used in the new Catalog UI and the Action Page may be too large to be used reasonably in the Search UI.  There is currently a bug in the backend image chipping service that inverts north/south coordinates that is currently being resolved.  \r\n#### What are the relevant tickets?\r\nhttps://codice.atlassian.net/browse/CAL-53\r\n#### Screenshots (if appropriate)\r\nhttps://codice.atlassian.net/browse/CAL-53\r\n#### Checklist:\r\n- [ ] Documentation Updated\r\n- [X] Update / Add Unit Tests\r\n- [ ] Update / Add Integration Tests\r\n","created_at":"2016-06-08T22:23:19Z","updated_at":"2016-06-10T17:20:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bf511b65cb1c0ba0d3cfd6bad9790a0ac2f39e6a","assignee":{"login":"jlcsmith","id":4503545,"avatar_url":"https://avatars.githubusercontent.com/u/4503545?v=3","gravatar_id":"","url":"https://api.github.com/users/jlcsmith","html_url":"https://github.com/jlcsmith","followers_url":"https://api.github.com/users/jlcsmith/followers","following_url":"https://api.github.com/users/jlcsmith/following{/other_user}","gists_url":"https://api.github.com/users/jlcsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/jlcsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlcsmith/subscriptions","organizations_url":"https://api.github.com/users/jlcsmith/orgs","repos_url":"https://api.github.com/users/jlcsmith/repos","events_url":"https://api.github.com/users/jlcsmith/events{/privacy}","received_events_url":"https://api.github.com/users/jlcsmith/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/codice/alliance/pulls/62/commits","review_comments_url":"https://api.github.com/repos/codice/alliance/pulls/62/comments","review_comment_url":"https://api.github.com/repos/codice/alliance/pulls/comments{/number}","comments_url":"https://api.github.com/repos/codice/alliance/issues/62/comments","statuses_url":"https://api.github.com/repos/codice/alliance/statuses/3f16daf6c39e72d131bd03b21e13eab35eb4cf93","head":{"label":"bdeining:CAL-53","ref":"CAL-53","sha":"3f16daf6c39e72d131bd03b21e13eab35eb4cf93","user":{"login":"bdeining","id":6551038,"avatar_url":"https://avatars.githubusercontent.com/u/6551038?v=3","gravatar_id":"","url":"https://api.github.com/users/bdeining","html_url":"https://github.com/bdeining","followers_url":"https://api.github.com/users/bdeining/followers","following_url":"https://api.github.com/users/bdeining/following{/other_user}","gists_url":"https://api.github.com/users/bdeining/gists{/gist_id}","starred_url":"https://api.github.com/users/bdeining/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bdeining/subscriptions","organizations_url":"https://api.github.com/users/bdeining/orgs","repos_url":"https://api.github.com/users/bdeining/repos","events_url":"https://api.github.com/users/bdeining/events{/privacy}","received_events_url":"https://api.github.com/users/bdeining/received_events","type":"User","site_admin":false},"repo":{"id":52810110,"name":"alliance","full_name":"bdeining/alliance","owner":{"login":"bdeining","id":6551038,"avatar_url":"https://avatars.githubusercontent.com/u/6551038?v=3","gravatar_id":"","url":"https://api.github.com/users/bdeining","html_url":"https://github.com/bdeining","followers_url":"https://api.github.com/users/bdeining/followers","following_url":"https://api.github.com/users/bdeining/following{/other_user}","gists_url":"https://api.github.com/users/bdeining/gists{/gist_id}","starred_url":"https://api.github.com/users/bdeining/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bdeining/subscriptions","organizations_url":"https://api.github.com/users/bdeining/orgs","repos_url":"https://api.github.com/users/bdeining/repos","events_url":"https://api.github.com/users/bdeining/events{/privacy}","received_events_url":"https://api.github.com/users/bdeining/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bdeining/alliance","description":"","fork":true,"url":"https://api.github.com/repos/bdeining/alliance","forks_url":"https://api.github.com/repos/bdeining/alliance/forks","keys_url":"https://api.github.com/repos/bdeining/alliance/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bdeining/alliance/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bdeining/alliance/teams","hooks_url":"https://api.github.com/repos/bdeining/alliance/hooks","issue_events_url":"https://api.github.com/repos/bdeining/alliance/issues/events{/number}","events_url":"https://api.github.com/repos/bdeining/alliance/events","assignees_url":"https://api.github.com/repos/bdeining/alliance/assignees{/user}","branches_url":"https://api.github.com/repos/bdeining/alliance/branches{/branch}","tags_url":"https://api.github.com/repos/bdeining/alliance/tags","blobs_url":"https://api.github.com/repos/bdeining/alliance/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bdeining/alliance/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bdeining/alliance/git/refs{/sha}","trees_url":"https://api.github.com/repos/bdeining/alliance/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bdeining/alliance/statuses/{sha}","languages_url":"https://api.github.com/repos/bdeining/alliance/languages","stargazers_url":"https://api.github.com/repos/bdeining/alliance/stargazers","contributors_url":"https://api.github.com/repos/bdeining/alliance/contributors","subscribers_url":"https://api.github.com/repos/bdeining/alliance/subscribers","subscription_url":"https://api.github.com/repos/bdeining/alliance/subscription","commits_url":"https://api.github.com/repos/bdeining/alliance/commits{/sha}","git_commits_url":"https://api.github.com/repos/bdeining/alliance/git/commits{/sha}","comments_url":"https://api.github.com/repos/bdeining/alliance/comments{/number}","issue_comment_url":"https://api.github.com/repos/bdeining/alliance/issues/comments{/number}","contents_url":"https://api.github.com/repos/bdeining/alliance/contents/{+path}","compare_url":"https://api.github.com/repos/bdeining/alliance/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bdeining/alliance/merges","archive_url":"https://api.github.com/repos/bdeining/alliance/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bdeining/alliance/downloads","issues_url":"https://api.github.com/repos/bdeining/alliance/issues{/number}","pulls_url":"https://api.github.com/repos/bdeining/alliance/pulls{/number}","milestones_url":"https://api.github.com/repos/bdeining/alliance/milestones{/number}","notifications_url":"https://api.github.com/repos/bdeining/alliance/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bdeining/alliance/labels{/name}","releases_url":"https://api.github.com/repos/bdeining/alliance/releases{/id}","deployments_url":"https://api.github.com/repos/bdeining/alliance/deployments","created_at":"2016-02-29T17:34:35Z","updated_at":"2016-03-03T16:09:43Z","pushed_at":"2016-06-10T14:59:22Z","git_url":"git://github.com/bdeining/alliance.git","ssh_url":"git@github.com:bdeining/alliance.git","clone_url":"https://github.com/bdeining/alliance.git","svn_url":"https://github.com/bdeining/alliance","homepage":null,"size":18322,"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":"codice:master","ref":"master","sha":"2ca6e5010045d1300d7058e06d093190973cfcc7","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":52804523,"name":"alliance","full_name":"codice/alliance","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/alliance","description":"","fork":false,"url":"https://api.github.com/repos/codice/alliance","forks_url":"https://api.github.com/repos/codice/alliance/forks","keys_url":"https://api.github.com/repos/codice/alliance/keys{/key_id}","collaborators_url":"https://api.github.com/repos/codice/alliance/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/codice/alliance/teams","hooks_url":"https://api.github.com/repos/codice/alliance/hooks","issue_events_url":"https://api.github.com/repos/codice/alliance/issues/events{/number}","events_url":"https://api.github.com/repos/codice/alliance/events","assignees_url":"https://api.github.com/repos/codice/alliance/assignees{/user}","branches_url":"https://api.github.com/repos/codice/alliance/branches{/branch}","tags_url":"https://api.github.com/repos/codice/alliance/tags","blobs_url":"https://api.github.com/repos/codice/alliance/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/codice/alliance/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/codice/alliance/git/refs{/sha}","trees_url":"https://api.github.com/repos/codice/alliance/git/trees{/sha}","statuses_url":"https://api.github.com/repos/codice/alliance/statuses/{sha}","languages_url":"https://api.github.com/repos/codice/alliance/languages","stargazers_url":"https://api.github.com/repos/codice/alliance/stargazers","contributors_url":"https://api.github.com/repos/codice/alliance/contributors","subscribers_url":"https://api.github.com/repos/codice/alliance/subscribers","subscription_url":"https://api.github.com/repos/codice/alliance/subscription","commits_url":"https://api.github.com/repos/codice/alliance/commits{/sha}","git_commits_url":"https://api.github.com/repos/codice/alliance/git/commits{/sha}","comments_url":"https://api.github.com/repos/codice/alliance/comments{/number}","issue_comment_url":"https://api.github.com/repos/codice/alliance/issues/comments{/number}","contents_url":"https://api.github.com/repos/codice/alliance/contents/{+path}","compare_url":"https://api.github.com/repos/codice/alliance/compare/{base}...{head}","merges_url":"https://api.github.com/repos/codice/alliance/merges","archive_url":"https://api.github.com/repos/codice/alliance/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/codice/alliance/downloads","issues_url":"https://api.github.com/repos/codice/alliance/issues{/number}","pulls_url":"https://api.github.com/repos/codice/alliance/pulls{/number}","milestones_url":"https://api.github.com/repos/codice/alliance/milestones{/number}","notifications_url":"https://api.github.com/repos/codice/alliance/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/codice/alliance/labels{/name}","releases_url":"https://api.github.com/repos/codice/alliance/releases{/id}","deployments_url":"https://api.github.com/repos/codice/alliance/deployments","created_at":"2016-02-29T16:10:33Z","updated_at":"2016-05-19T17:38:05Z","pushed_at":"2016-06-10T16:24:34Z","git_url":"git://github.com/codice/alliance.git","ssh_url":"git@github.com:codice/alliance.git","clone_url":"https://github.com/codice/alliance.git","svn_url":"https://github.com/codice/alliance","homepage":null,"size":18499,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":18,"mirror_url":null,"open_issues_count":7,"forks":18,"open_issues":7,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/codice/alliance/pulls/62"},"html":{"href":"https://github.com/codice/alliance/pull/62"},"issue":{"href":"https://api.github.com/repos/codice/alliance/issues/62"},"comments":{"href":"https://api.github.com/repos/codice/alliance/issues/62/comments"},"review_comments":{"href":"https://api.github.com/repos/codice/alliance/pulls/62/comments"},"review_comment":{"href":"https://api.github.com/repos/codice/alliance/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/codice/alliance/pulls/62/commits"},"statuses":{"href":"https://api.github.com/repos/codice/alliance/statuses/3f16daf6c39e72d131bd03b21e13eab35eb4cf93"}}}}
{"actor":{"display_login":"jrnorth"}}