-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdmp-createXML.r
37 lines (37 loc) · 1.33 KB
/
dmp-createXML.r
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
createXML {
# rule dmp-createXML.r
# for each file in a collection
# create an associated XML file
*Xhead = ``<?xml version="1.0"?>``;
*Xcat =``<catalog>``;
*Xend =``</catalog>``;
*Coll = "/$rodsZoneClient/home/$userNameClient/*Relcoll";
checkCollInput (*Coll);
checkRescInput (*Res, $rodsZoneClient);
*Q1 = select COLL_NAME, DATA_NAME where COLL_NAME like '*Coll%';
foreach (*R1 in *Q1) {
*File = *R1.DATA_NAME;
*Col = *R1.COLL_NAME;
*Filn = *File ++ ".xml";
#============ create an XML file if it does not exist ===============
*Lfile = "*Col/*Filn";
*Dfile = "destRescName=*Res++++forceFlag=";
msiDataObjCreate(*Lfile, *Dfile, *L_FD);
writeLine("*Lfile","*Xhead");
writeLine("*Lfile","*Xcat");
writeLine("*Lfile","<File path=\"*Col/*File\">");
*Q2 = select META_DATA_ATTR_NAME, META_DATA_ATTR_VALUE where DATA_NAME = '*File' and COLL_NAME = '*Col';
foreach (*R2 in *Q2) {
*Aname = *R2.META_DATA_ATTR_NAME;
*Aval = *R2.META_DATA_ATTR_VALUE;
writeLine("*Lfile","<*Aname>*Aval</*Aname>");
}
writeLine("*Lfile","</File>");
writeLine("*Lfile","*Xend");
msiDataObjClose(*L_FD, *Status);
writeLine("stdout", "Created XML file for *Col/*File");
}
writeLine("stdout", "Finished processing collection *Col");
}
INPUT *Relcoll =$"sub1", *Res =$"LTLResc"
OUTPUT ruleExecOut