forked from irods/irods_rule_engine_plugin_python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrulemsiAddConditionToGenQuery.r
More file actions
26 lines (20 loc) · 1.09 KB
/
Copy pathrulemsiAddConditionToGenQuery.r
File metadata and controls
26 lines (20 loc) · 1.09 KB
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
def main(rule_args, callback, rei):
select = irods_rule_vars['*Select'][1:-1]
attribute = irods_rule_vars['*Attribute'][1:-1]
operator = irods_rule_vars['*Operator'][1:-1]
value = irods_rule_vars['*Value'][1:-1]
ret_val = {}
# Initial condition for query corresponds to "COLL_NAME like '/tempZone/home/rods/%%'"
ret_val = callback.msiMakeGenQuery(select, "COLL_NAME like '/tempZone/home/rods/%%'", irods_types.GenQueryInp())
genQueryInp = ret_val['arguments'][2]
# Add condition to query "DATA_NAME like rule%%"
ret_val = callback.msiAddConditionToGenQuery(attribute, operator, value, genQueryInp)
genQueryInp = ret_val['arguments'][3]
ret_val = callback.msiExecGenQuery(genQueryInp, irods_types.GenQueryOut())
genQueryOut = ret_val['arguments'][1]
for row in range(genQueryOut.rowCnt):
data = genQueryOut.sqlResult[0].row(row)
coll = genQueryOut.sqlResult[1].row(row)
callback.writeLine('stdout', coll + '/' + data)
INPUT *Select="DATA_NAME, COLL_NAME", *Attribute="DATA_NAME", *Operator=" like ", *Value="rule%%"
OUTPUT ruleExecOut