-
Notifications
You must be signed in to change notification settings - Fork 1
/
dfc-list-avus-report.r
51 lines (48 loc) · 1.69 KB
/
dfc-list-avus-report.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
listAVUsReport {
# dfc-list-avus-report.r
# create a list of all metadata names used in a collection
*ShortDate = "";
msiGetIcatTime(*DateStamp, "human");
if (strlen("*DateStamp") > 10) {
*ShortDate = substr("*DateStamp", 0, 10);
}
*ReportPath = *BaseColl ++ "/" ++ "*ShortDate" ++ "_reports";
msiCollCreate(*ReportPath,"1",*Status);
msiStrlen(*ReportPath,*ROOTLENGTH);
*OFFSET = int(*ROOTLENGTH) + 1;
*Q1 = select order(USER_NAME);
foreach (*R1 in *Q1) {
*UserName = *R1.USER_NAME;
*Coll = "/$rodsZoneClient/home/*UserName";
writeLine ("stdout", "Metadata names for *Coll collection:");
*Metanum.total = str(0);
*Q2 = select order(META_DATA_ATTR_NAME), count(META_DATA_ATTR_ID) where COLL_NAME like '*Coll';
foreach (*R2 in *Q2) {
*Metaname = *R2.META_DATA_ATTR_NAME;
*Num = *R2.META_DATA_ATTR_ID;
*Metanum.total = str(int(*Metanum.total) + int(*Num));
*Metanum.*Metaname = *Num;
}
foreach (*Metaname in *Metanum) {
if (*Metaname != "total") {
*C1 = *Metanum.*Metaname;
*C2 = *Metaname;
if (strlen(*C2) < 8) {*C2 = *C2 ++ "\t";}
if (strlen(*C2) < 16) {*C2 = *C2 ++ "\t";}
if (strlen(*C2) < 24) {*C2 = *C2 ++ "\t";}
writeLine ("stdout", "*C2 *C1");
}
}
*C1 = *Metanum.total;
*C2 = "total\t\t\t";
writeLine ("stdout", "*C2 *C1");
writeLine ("stdout", "");
}
# now save it all to reportdata object
msiDataObjCreate("*ReportPath" ++ "/newresource-report.txt","forceFlag=",*FD);
msiDataObjWrite(*FD,"stdout",*WLEN);
msiDataObjClose(*FD,*Status);
msiFreeBuffer("stdout");
}
INPUT *BaseColl="/dfcmain/home/dfcAdmin/AdminReports"
OUTPUT ruleExecOut