-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathislandora_newspaper_batch.rules_defaults.inc
101 lines (98 loc) · 2.93 KB
/
islandora_newspaper_batch.rules_defaults.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
/**
* @file
* Implementation of Rules hooks, giving default configurations.
*/
/**
* Implements hook_default_rules_configuration().
*/
function islandora_newspaper_batch_default_rules_configuration() {
$configs = array();
$parse_exported = '{ "islandora_newspaper_batch_newspaper_issue_ingested" : {
"LABEL" : "Newspaper Issue Ingested",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "islandora" ],
"ON" : { "islandora_object_ingested" : [] },
"IF" : [
{ "list_contains" : {
"list" : [ "object:models" ],
"item" : "islandora:newspaperIssueCModel"
}
},
{ "islandora_object_has_relationship" : {
"subject" : [ "object" ],
"pred_uri" : "http:\/\/islandora.ca\/ontology\/relsext#",
"pred" : "newspaper-batched",
"object" : "true",
"type" : "1"
}
},
{ "islandora_object_has_relationship" : {
"subject" : [ "object" ],
"pred_uri" : "http:\/\/islandora.ca\/ontology\/relsext#",
"pred" : "email-admin-when-ingested",
"object" : "true",
"type" : "1"
}
}
],
"DO" : [
{ "mail" : {
"to" : "[site:mail]",
"subject" : "[[site:name]] \u0022[object:label]\u0022 has been ingested",
"message" : "[object:label] has been ingested as [object:id].",
"language" : [ "" ]
}
},
{ "islandora_object_remove_relationship" : {
"subject" : [ "object" ],
"pred_uri" : "http:\/\/islandora.ca\/ontology\/relsext#",
"pred" : "email-admin-when-ingested",
"object" : "true",
"type" : "1"
}
}
]
}
}';
$parsed_parse = rules_import($parse_exported);
$configs[$parsed_parse->name] = $parsed_parse;
$complete_exported = '{ "islandora_newspaper_batch_newspaper_issue_batch_complete" : {
"LABEL" : "Newspaper Issue Batch Complete",
"PLUGIN" : "reaction rule",
"WEIGHT" : "10",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "islandora" ],
"ON" : { "islandora_object_ingested" : [] },
"IF" : [
{ "list_contains" : {
"list" : [ "object:models" ],
"item" : "islandora:newspaperIssueCModel"
}
},
{ "islandora_object_has_relationship" : {
"subject" : [ "object" ],
"pred_uri" : "http:\/\/islandora.ca\/ontology\/relsext#",
"pred" : "newspaper-batched",
"object" : "true",
"type" : "1"
}
}
],
"DO" : [
{ "islandora_object_remove_relationship" : {
"subject" : [ "object" ],
"pred_uri" : "http:\/\/islandora.ca\/ontology\/relsext#",
"pred" : "newspaper-batched",
"object" : "true",
"type" : "1"
}
}
]
}
}';
$parsed_complete = rules_import($complete_exported);
$configs[$parsed_complete->name] = $parsed_complete;
return $configs;
}