{"action":"created","comment":{"url":"https://api.github.com/repos/Islandora-CLAW/islandora/pulls/comments/158064897","pull_request_review_id":84812381,"id":158064897,"diff_hunk":"@@ -82,39 +84,69 @@ function islandora_rdf_namespaces() {\n }\n \n /**\n- * Implements hook_ENTITY_TYPE_insert().\n+ * Implements hook_entity_insert().\n  */\n-function islandora_node_insert(EntityInterface $entity) {\n-  // Creates a record in the db to track the number of changes to the entity.\n-  $versionCounter = \\Drupal::service('islandora.versioncounter');\n-  try {\n-    $versionCounter->create($entity->uuid());\n+function islandora_entity_insert(EntityInterface $entity) {\n+  switch ($entity->getEntityType()->id()) {\n+    case \"node\":\n+      $provider = new NodeContextProvider($entity);\n+      break;\n+\n+    case \"media\":\n+      $provider = new MediaContextProvider($entity);\n+      break;\n+\n+    case \"file\":\n+      $provider = new FileContextProvider($entity);\n+      break;\n+\n+    default:\n+      $provider = NULL;\n+      break;\n   }\n-  catch (IntegrityConstraintViolationException $e) {\n-    \\Drupal::logger('islandora')->error(\n-      'Attempted to create duplicate entry for @uuid in version counter ' .\n-      'table. This should never happen.',\n-      ['@uuid' => $entity->uuid()]\n-    );\n+\n+  if ($provider) {\n+    $context_manager = \\Drupal::service('context.manager');\n+    $provided = $provider->getRuntimeContexts([]);\n+    $context_manager->evaluateContexts($provided);\n+\n+    foreach ($context_manager->getActiveReactions('index') as $reaction) {","path":"islandora.module","position":54,"original_position":54,"commit_id":"1282e6ce6d1f9d5c43b603c3933c8e5bfe159c1d","original_commit_id":"1282e6ce6d1f9d5c43b603c3933c8e5bfe159c1d","user":{"login":"whikloj","id":2857697,"avatar_url":"https://avatars2.githubusercontent.com/u/2857697?v=4","gravatar_id":"","url":"https://api.github.com/users/whikloj","html_url":"https://github.com/whikloj","followers_url":"https://api.github.com/users/whikloj/followers","following_url":"https://api.github.com/users/whikloj/following{/other_user}","gists_url":"https://api.github.com/users/whikloj/gists{/gist_id}","starred_url":"https://api.github.com/users/whikloj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whikloj/subscriptions","organizations_url":"https://api.github.com/users/whikloj/orgs","repos_url":"https://api.github.com/users/whikloj/repos","events_url":"https://api.github.com/users/whikloj/events{/privacy}","received_events_url":"https://api.github.com/users/whikloj/received_events","type":"User","site_admin":false},"body":"Ok, I'm 👍 on one action for insert/update but I'm unsure whether `index` is better than `update`. This is not a huge issue, depends how we see the syncing of objects to Fedora/Triplestore/etc.","created_at":"2017-12-20T16:07:13Z","updated_at":"2017-12-20T16:07:13Z","html_url":"https://github.com/Islandora-CLAW/islandora/pull/68#discussion_r158064897","pull_request_url":"https://api.github.com/repos/Islandora-CLAW/islandora/pulls/68","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/Islandora-CLAW/islandora/pulls/comments/158064897"},"html":{"href":"https://github.com/Islandora-CLAW/islandora/pull/68#discussion_r158064897"},"pull_request":{"href":"https://api.github.com/repos/Islandora-CLAW/islandora/pulls/68"}},"in_reply_to_id":157885018},"pull_request":{"url":"https://api.github.com/repos/Islandora-CLAW/islandora/pulls/68","id":159274170,"html_url":"https://github.com/Islandora-CLAW/islandora/pull/68","diff_url":"https://github.com/Islandora-CLAW/islandora/pull/68.diff","patch_url":"https://github.com/Islandora-CLAW/islandora/pull/68.patch","issue_url":"https://api.github.com/repos/Islandora-CLAW/islandora/issues/68","number":68,"state":"open","locked":false,"title":"Using Context instead of Rules","user":{"login":"dannylamb","id":20773151,"avatar_url":"https://avatars3.githubusercontent.com/u/20773151?v=4","gravatar_id":"","url":"https://api.github.com/users/dannylamb","html_url":"https://github.com/dannylamb","followers_url":"https://api.github.com/users/dannylamb/followers","following_url":"https://api.github.com/users/dannylamb/following{/other_user}","gists_url":"https://api.github.com/users/dannylamb/gists{/gist_id}","starred_url":"https://api.github.com/users/dannylamb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dannylamb/subscriptions","organizations_url":"https://api.github.com/users/dannylamb/orgs","repos_url":"https://api.github.com/users/dannylamb/repos","events_url":"https://api.github.com/users/dannylamb/events{/privacy}","received_events_url":"https://api.github.com/users/dannylamb/received_events","type":"User","site_admin":false},"body":"**GitHub Issue**: https://github.com/Islandora-CLAW/CLAW/issues/765\r\n\r\nOther Relevant Links:\r\n* https://github.com/Islandora-CLAW/CLAW/issues/656\r\n* https://github.com/Islandora-CLAW/CLAW/issues/682 \r\n\r\n# What does this Pull Request do?\r\n\r\nReplaces Rules with Context\r\n\r\n# What's new?\r\n\r\n* Three contexts (file, media, node) which have execute preconfigued actions on write events.\r\n* Preconfigured actions for emitting events to queues (indexing in triplestore and fedora)\r\n* 'Views bulk operation' functionality since everything is actions (essentially https://github.com/Islandora/islandora_bookmark functionality is baked into core) \r\n* Custom Condition plugins for file, media, and node content types.\r\n* Functional tests! \r\n\r\n# How should this be tested?\r\n\r\nUsing https://github.com/islandora-devops/claw-playbook\r\n- `vagrant up`\r\n- `vagrant ssh`\r\n\r\nThen uninstall the module, which is a bit of a pain right now (see https://github.com/Islandora-CLAW/CLAW/issues/685)\r\n- `/var/www/html/drupal/vendor/bin/drupal config:delete active views.view.file_checksum` (This PR fixes the bug that leaves the view in the database)\r\n- `/var/www/html/drupal/vendor/bin/drupal config:delete active field.field.media.tn.field_height`\r\n- `/var/www/html/drupal/vendor/bin/drupal config:delete active field.field.media.tn.field_width`\r\n- `/var/www/html/drupal/vendor/bin/drupal config:delete active field.field.media.tn.field_mimetype`\r\n- `/var/www/html/drupal/vendor/bin/drupal config:delete active field.field.media.tn.field_image`\r\n- `/var/www/html/drupal/vendor/bin/drush pmu islandora\r\n\r\nPull in dependencies with composer\r\n- `cd /var/www/html/drupal`\r\n- `composer require drupal/context`\r\n\r\nThen pull in the changes for this PR\r\n- `cd /var/www/html/drupal/web/modules/contrib/islandora`\r\n- `git remote add danny https://github.com/dannylamb/islandora.git`\r\n- `git fetch danny`\r\n- `git checkout context-preconfigured`\r\n\r\nThen install\r\n- `/var/www/html/drupal/vendor/bin/drush en islandora_image context_ui`\r\n\r\nCheck that fedora and triplestore indexing still function as expected.\r\n\r\nThen go check out `admin/config/system/actions` and inspect all the preconfigured actions for publishing events to queues.\r\n![screenshot from 2017-12-19 16-59-41](https://user-images.githubusercontent.com/20773151/34178605-2f5fa452-e4de-11e7-90cd-a218d6bf200c.png)\r\n\r\n\r\nYou can make a preconfigured action to print something to the screen:\r\n![screenshot from 2017-12-19 17-03-12](https://user-images.githubusercontent.com/20773151/34178734-9f95c36e-e4de-11e7-86fe-e5d2792d0a32.png)\r\n\r\n \r\n![screenshot from 2017-12-19 17-04-56](https://user-images.githubusercontent.com/20773151/34178787-c5390a68-e4de-11e7-8897-41c9bcf90109.png)\r\n\r\n\r\nThen you can execute that action as a Context reaction adding it as an `index` or `deindex` action (I'm open to better naming for those).  For example, to print the message every time a node is updated or created, go to `admin/structure/context/node` and Ctrl+Click the `Say Hey` action in the `Index` select box.\r\n![screenshot from 2017-12-19 17-09-22](https://user-images.githubusercontent.com/20773151/34178954-6bd5e846-e4df-11e7-96cd-f6064535d346.png)\r\n\r\n\r\nFYI, the usual Shift+Click and Ctrl+Click functionality is available when using that select box.\r\n\r\n\r\nClick `Save and continue`.  Then go create or update a node and you should see this:\r\n![screenshot from 2017-12-19 17-11-18](https://user-images.githubusercontent.com/20773151/34179026-b0243f5c-e4df-11e7-9816-95cbadce5693.png)\r\n\r\n\r\nYou can also do cool bookmark type stuff since everything is core actions.  Check out the main admin view for nodes to see all the things you can do.  \r\n![screenshot from 2017-12-19 17-13-40](https://user-images.githubusercontent.com/20773151/34179249-84d8e842-e4e0-11e7-8e8c-661e5706122b.png)\r\n\r\n\r\n\r\nThere's also stuff available for Media.\r\n![screenshot from 2017-12-19 17-15-11](https://user-images.githubusercontent.com/20773151/34179154-37280970-e4e0-11e7-9b42-d9cd70ec04ad.png)\r\n\r\n\r\n# Interested parties\r\n@Islandora-CLAW/committers @rosiel @mjordan\r\n","created_at":"2017-12-19T21:18:39Z","updated_at":"2017-12-20T16:07:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"af57a59799fd15e3bb88ff3c9252c53dff63be7b","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/Islandora-CLAW/islandora/pulls/68/commits","review_comments_url":"https://api.github.com/repos/Islandora-CLAW/islandora/pulls/68/comments","review_comment_url":"https://api.github.com/repos/Islandora-CLAW/islandora/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Islandora-CLAW/islandora/issues/68/comments","statuses_url":"https://api.github.com/repos/Islandora-CLAW/islandora/statuses/1282e6ce6d1f9d5c43b603c3933c8e5bfe159c1d","head":{"label":"dannylamb:context-preconfigured","ref":"context-preconfigured","sha":"1282e6ce6d1f9d5c43b603c3933c8e5bfe159c1d","user":{"login":"dannylamb","id":20773151,"avatar_url":"https://avatars3.githubusercontent.com/u/20773151?v=4","gravatar_id":"","url":"https://api.github.com/users/dannylamb","html_url":"https://github.com/dannylamb","followers_url":"https://api.github.com/users/dannylamb/followers","following_url":"https://api.github.com/users/dannylamb/following{/other_user}","gists_url":"https://api.github.com/users/dannylamb/gists{/gist_id}","starred_url":"https://api.github.com/users/dannylamb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dannylamb/subscriptions","organizations_url":"https://api.github.com/users/dannylamb/orgs","repos_url":"https://api.github.com/users/dannylamb/repos","events_url":"https://api.github.com/users/dannylamb/events{/privacy}","received_events_url":"https://api.github.com/users/dannylamb/received_events","type":"User","site_admin":false},"repo":{"id":73302611,"name":"islandora","full_name":"dannylamb/islandora","owner":{"login":"dannylamb","id":20773151,"avatar_url":"https://avatars3.githubusercontent.com/u/20773151?v=4","gravatar_id":"","url":"https://api.github.com/users/dannylamb","html_url":"https://github.com/dannylamb","followers_url":"https://api.github.com/users/dannylamb/followers","following_url":"https://api.github.com/users/dannylamb/following{/other_user}","gists_url":"https://api.github.com/users/dannylamb/gists{/gist_id}","starred_url":"https://api.github.com/users/dannylamb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dannylamb/subscriptions","organizations_url":"https://api.github.com/users/dannylamb/orgs","repos_url":"https://api.github.com/users/dannylamb/repos","events_url":"https://api.github.com/users/dannylamb/events{/privacy}","received_events_url":"https://api.github.com/users/dannylamb/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dannylamb/islandora","description":"CLAW Drupal modules","fork":true,"url":"https://api.github.com/repos/dannylamb/islandora","forks_url":"https://api.github.com/repos/dannylamb/islandora/forks","keys_url":"https://api.github.com/repos/dannylamb/islandora/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dannylamb/islandora/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dannylamb/islandora/teams","hooks_url":"https://api.github.com/repos/dannylamb/islandora/hooks","issue_events_url":"https://api.github.com/repos/dannylamb/islandora/issues/events{/number}","events_url":"https://api.github.com/repos/dannylamb/islandora/events","assignees_url":"https://api.github.com/repos/dannylamb/islandora/assignees{/user}","branches_url":"https://api.github.com/repos/dannylamb/islandora/branches{/branch}","tags_url":"https://api.github.com/repos/dannylamb/islandora/tags","blobs_url":"https://api.github.com/repos/dannylamb/islandora/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dannylamb/islandora/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dannylamb/islandora/git/refs{/sha}","trees_url":"https://api.github.com/repos/dannylamb/islandora/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dannylamb/islandora/statuses/{sha}","languages_url":"https://api.github.com/repos/dannylamb/islandora/languages","stargazers_url":"https://api.github.com/repos/dannylamb/islandora/stargazers","contributors_url":"https://api.github.com/repos/dannylamb/islandora/contributors","subscribers_url":"https://api.github.com/repos/dannylamb/islandora/subscribers","subscription_url":"https://api.github.com/repos/dannylamb/islandora/subscription","commits_url":"https://api.github.com/repos/dannylamb/islandora/commits{/sha}","git_commits_url":"https://api.github.com/repos/dannylamb/islandora/git/commits{/sha}","comments_url":"https://api.github.com/repos/dannylamb/islandora/comments{/number}","issue_comment_url":"https://api.github.com/repos/dannylamb/islandora/issues/comments{/number}","contents_url":"https://api.github.com/repos/dannylamb/islandora/contents/{+path}","compare_url":"https://api.github.com/repos/dannylamb/islandora/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dannylamb/islandora/merges","archive_url":"https://api.github.com/repos/dannylamb/islandora/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dannylamb/islandora/downloads","issues_url":"https://api.github.com/repos/dannylamb/islandora/issues{/number}","pulls_url":"https://api.github.com/repos/dannylamb/islandora/pulls{/number}","milestones_url":"https://api.github.com/repos/dannylamb/islandora/milestones{/number}","notifications_url":"https://api.github.com/repos/dannylamb/islandora/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dannylamb/islandora/labels{/name}","releases_url":"https://api.github.com/repos/dannylamb/islandora/releases{/id}","deployments_url":"https://api.github.com/repos/dannylamb/islandora/deployments","created_at":"2016-11-09T16:45:37Z","updated_at":"2017-06-01T20:28:49Z","pushed_at":"2017-12-19T14:42:59Z","git_url":"git://github.com/dannylamb/islandora.git","ssh_url":"git@github.com:dannylamb/islandora.git","clone_url":"https://github.com/dannylamb/islandora.git","svn_url":"https://github.com/dannylamb/islandora","homepage":"http://islandora.ca/CLAW","size":484,"stargazers_count":1,"watchers_count":1,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":1,"default_branch":"8.x-1.x"}},"base":{"label":"Islandora-CLAW:8.x-1.x","ref":"8.x-1.x","sha":"d357de4cfbc43b245555c1dbf8e9cf72caa800d1","user":{"login":"Islandora-CLAW","id":15603186,"avatar_url":"https://avatars0.githubusercontent.com/u/15603186?v=4","gravatar_id":"","url":"https://api.github.com/users/Islandora-CLAW","html_url":"https://github.com/Islandora-CLAW","followers_url":"https://api.github.com/users/Islandora-CLAW/followers","following_url":"https://api.github.com/users/Islandora-CLAW/following{/other_user}","gists_url":"https://api.github.com/users/Islandora-CLAW/gists{/gist_id}","starred_url":"https://api.github.com/users/Islandora-CLAW/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Islandora-CLAW/subscriptions","organizations_url":"https://api.github.com/users/Islandora-CLAW/orgs","repos_url":"https://api.github.com/users/Islandora-CLAW/repos","events_url":"https://api.github.com/users/Islandora-CLAW/events{/privacy}","received_events_url":"https://api.github.com/users/Islandora-CLAW/received_events","type":"Organization","site_admin":false},"repo":{"id":58668425,"name":"islandora","full_name":"Islandora-CLAW/islandora","owner":{"login":"Islandora-CLAW","id":15603186,"avatar_url":"https://avatars0.githubusercontent.com/u/15603186?v=4","gravatar_id":"","url":"https://api.github.com/users/Islandora-CLAW","html_url":"https://github.com/Islandora-CLAW","followers_url":"https://api.github.com/users/Islandora-CLAW/followers","following_url":"https://api.github.com/users/Islandora-CLAW/following{/other_user}","gists_url":"https://api.github.com/users/Islandora-CLAW/gists{/gist_id}","starred_url":"https://api.github.com/users/Islandora-CLAW/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Islandora-CLAW/subscriptions","organizations_url":"https://api.github.com/users/Islandora-CLAW/orgs","repos_url":"https://api.github.com/users/Islandora-CLAW/repos","events_url":"https://api.github.com/users/Islandora-CLAW/events{/privacy}","received_events_url":"https://api.github.com/users/Islandora-CLAW/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Islandora-CLAW/islandora","description":"CLAW Drupal modules","fork":false,"url":"https://api.github.com/repos/Islandora-CLAW/islandora","forks_url":"https://api.github.com/repos/Islandora-CLAW/islandora/forks","keys_url":"https://api.github.com/repos/Islandora-CLAW/islandora/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Islandora-CLAW/islandora/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Islandora-CLAW/islandora/teams","hooks_url":"https://api.github.com/repos/Islandora-CLAW/islandora/hooks","issue_events_url":"https://api.github.com/repos/Islandora-CLAW/islandora/issues/events{/number}","events_url":"https://api.github.com/repos/Islandora-CLAW/islandora/events","assignees_url":"https://api.github.com/repos/Islandora-CLAW/islandora/assignees{/user}","branches_url":"https://api.github.com/repos/Islandora-CLAW/islandora/branches{/branch}","tags_url":"https://api.github.com/repos/Islandora-CLAW/islandora/tags","blobs_url":"https://api.github.com/repos/Islandora-CLAW/islandora/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Islandora-CLAW/islandora/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Islandora-CLAW/islandora/git/refs{/sha}","trees_url":"https://api.github.com/repos/Islandora-CLAW/islandora/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Islandora-CLAW/islandora/statuses/{sha}","languages_url":"https://api.github.com/repos/Islandora-CLAW/islandora/languages","stargazers_url":"https://api.github.com/repos/Islandora-CLAW/islandora/stargazers","contributors_url":"https://api.github.com/repos/Islandora-CLAW/islandora/contributors","subscribers_url":"https://api.github.com/repos/Islandora-CLAW/islandora/subscribers","subscription_url":"https://api.github.com/repos/Islandora-CLAW/islandora/subscription","commits_url":"https://api.github.com/repos/Islandora-CLAW/islandora/commits{/sha}","git_commits_url":"https://api.github.com/repos/Islandora-CLAW/islandora/git/commits{/sha}","comments_url":"https://api.github.com/repos/Islandora-CLAW/islandora/comments{/number}","issue_comment_url":"https://api.github.com/repos/Islandora-CLAW/islandora/issues/comments{/number}","contents_url":"https://api.github.com/repos/Islandora-CLAW/islandora/contents/{+path}","compare_url":"https://api.github.com/repos/Islandora-CLAW/islandora/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Islandora-CLAW/islandora/merges","archive_url":"https://api.github.com/repos/Islandora-CLAW/islandora/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Islandora-CLAW/islandora/downloads","issues_url":"https://api.github.com/repos/Islandora-CLAW/islandora/issues{/number}","pulls_url":"https://api.github.com/repos/Islandora-CLAW/islandora/pulls{/number}","milestones_url":"https://api.github.com/repos/Islandora-CLAW/islandora/milestones{/number}","notifications_url":"https://api.github.com/repos/Islandora-CLAW/islandora/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Islandora-CLAW/islandora/labels{/name}","releases_url":"https://api.github.com/repos/Islandora-CLAW/islandora/releases{/id}","deployments_url":"https://api.github.com/repos/Islandora-CLAW/islandora/deployments","created_at":"2016-05-12T18:54:08Z","updated_at":"2016-11-25T20:10:00Z","pushed_at":"2017-12-19T21:18:40Z","git_url":"git://github.com/Islandora-CLAW/islandora.git","ssh_url":"git@github.com:Islandora-CLAW/islandora.git","clone_url":"https://github.com/Islandora-CLAW/islandora.git","svn_url":"https://github.com/Islandora-CLAW/islandora","homepage":"http://islandora.ca/CLAW","size":349,"stargazers_count":4,"watchers_count":4,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":14,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0"},"forks":14,"open_issues":3,"watchers":4,"default_branch":"8.x-1.x"}},"_links":{"self":{"href":"https://api.github.com/repos/Islandora-CLAW/islandora/pulls/68"},"html":{"href":"https://github.com/Islandora-CLAW/islandora/pull/68"},"issue":{"href":"https://api.github.com/repos/Islandora-CLAW/islandora/issues/68"},"comments":{"href":"https://api.github.com/repos/Islandora-CLAW/islandora/issues/68/comments"},"review_comments":{"href":"https://api.github.com/repos/Islandora-CLAW/islandora/pulls/68/comments"},"review_comment":{"href":"https://api.github.com/repos/Islandora-CLAW/islandora/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Islandora-CLAW/islandora/pulls/68/commits"},"statuses":{"href":"https://api.github.com/repos/Islandora-CLAW/islandora/statuses/1282e6ce6d1f9d5c43b603c3933c8e5bfe159c1d"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"whikloj"}}