Revision 948
Added by Jing Tao over 22 years ago
src/edu/ucsb/nceas/metacat/DBQuery.java | ||
---|---|---|
1010 | 1010 |
|
1011 | 1011 |
/** |
1012 | 1012 |
*transfer a docid vetor to a documentImpl vector. The documentImpl vetor |
1013 |
*inlcudes current and old version
|
|
1013 |
*only inlcudes current version
|
|
1014 | 1014 |
*@param docIdList, a vetor hold a docid list for a data package. In docid, |
1015 | 1015 |
*there is not version number in it. |
1016 | 1016 |
*/ |
... | ... | |
1035 | 1035 |
{ |
1036 | 1036 |
//get newest version for this docId |
1037 | 1037 |
rev=getCurrentRevFromXMLDoumentsTable((String)docIdList.elementAt(i)); |
1038 |
//get all versions including current and old ones for one docid |
|
1039 |
for (int j=1;j<=rev;j++) |
|
1040 |
{ |
|
1041 |
String docidPlusVersion=((String)docIdList.elementAt(i)) |
|
1042 |
+util.getOption("accNumSeparator")+j; |
|
1043 |
//create new documentImpl object |
|
1044 |
DocumentImpl documentImplObject = |
|
1038 |
|
|
1039 |
String docidPlusVersion=((String)docIdList.elementAt(i)) |
|
1040 |
+util.getOption("accNumSeparator")+rev; |
|
1041 |
//create new documentImpl object |
|
1042 |
DocumentImpl documentImplObject = |
|
1045 | 1043 |
new DocumentImpl(dbConn,docidPlusVersion); |
1046 |
//add them to vector
|
|
1047 |
documentImplList.add(documentImplObject);
|
|
1048 |
}//for |
|
1044 |
//add them to vector |
|
1045 |
documentImplList.add(documentImplObject); |
|
1046 |
|
|
1049 | 1047 |
}//for |
1050 | 1048 |
return documentImplList; |
1051 | 1049 |
} |
1052 | 1050 |
|
1053 | 1051 |
/** |
1054 | 1052 |
*transfer a docid vetor to a documentImpl vector. The documentImpl vetor |
1055 |
*inlcudes old version
|
|
1053 |
*does not inlcude old version
|
|
1056 | 1054 |
*@param docIdList, a vetor hold a docid list for a data package. In docid, |
1057 | 1055 |
*there is version number in it. |
1058 | 1056 |
*/ |
... | ... | |
1077 | 1075 |
for (int i=0;i<docIdList.size();i++) |
1078 | 1076 |
{ |
1079 | 1077 |
|
1080 |
//create a documentIdentifier object |
|
1081 |
DocumentIdentifier identifier= |
|
1082 |
new DocumentIdentifier((String)docIdList.elementAt(i)); |
|
1083 |
|
|
1084 |
//get newest version for this docId |
|
1085 |
siteCode=identifier.getSiteCode(); |
|
1086 |
uniqueId=identifier.getUniqueId(); |
|
1087 |
rev=Integer.parseInt(identifier.getRev()); |
|
1088 |
|
|
1089 |
//get all versions including current and old ones for one docid |
|
1090 |
for (int j=1;j<=rev;j++) |
|
1091 |
{ |
|
1092 |
String docidPlusVersion=siteCode+util.getOption("accNumSeparator")+ |
|
1093 |
uniqueId+util.getOption("accNumSeparator")+j; |
|
1078 |
String docidPlusVersion=(String)(docIdList.elementAt(i)); |
|
1094 | 1079 |
//create new documentImpl object |
1095 | 1080 |
DocumentImpl documentImplObject = |
1096 | 1081 |
new DocumentImpl(dbConn,docidPlusVersion); |
1097 | 1082 |
//add them to vector |
1098 | 1083 |
documentImplList.add(documentImplObject); |
1099 |
}//for |
|
1084 |
|
|
1100 | 1085 |
}//for |
1101 | 1086 |
return documentImplList; |
1102 | 1087 |
} |
... | ... | |
1308 | 1293 |
{ |
1309 | 1294 |
//create a docmentImpls object (represent xml doc) base on the docId |
1310 | 1295 |
docImpls=(DocumentImpl)documentImplList.elementAt(i); |
1311 |
|
|
1312 |
//if the docImpls is metadata |
|
1313 |
if ((docImpls.getDoctype()).compareTo("BIN")!=0) |
|
1314 |
{ |
|
1296 |
|
|
1297 |
//checking if the user has the permission to read the documents |
|
1298 |
if (docImpls.hasReadPermission(dbConn,user,groups,docImpls.getDocID())) |
|
1299 |
{ |
|
1300 |
//if the docImpls is metadata |
|
1301 |
if ((docImpls.getDoctype()).compareTo("BIN")!=0) |
|
1302 |
{ |
|
1303 |
//eml-access file wouldn't put into the zip output stream |
|
1304 |
//if the docImpls is not a eml-access file |
|
1305 |
if ((util.getOption("accessdoctype")). |
|
1306 |
lastIndexOf(docImpls.getDoctype())==-1) |
|
1307 |
{ |
|
1308 |
|
|
1309 |
//add metadata into zip output stream |
|
1310 |
addDocToZipOutputStream(docImpls, zOut, rootName); |
|
1311 |
//add the documentImpl into the vetor which will be used in html |
|
1312 |
htmlDocumentImplList.add(docImpls); |
|
1313 |
}//if |
|
1314 |
}//if |
|
1315 | 1315 |
//eml-access file wouldn't put into the zip output stream |
1316 |
//if the docImpls is not a eml-access file |
|
1317 |
if ((util.getOption("accessdoctype")). |
|
1318 |
lastIndexOf(docImpls.getDoctype())==-1) |
|
1319 |
{ |
|
1320 |
|
|
1321 |
//add metadata into zip output stream |
|
1322 |
addDocToZipOutputStream(docImpls, zOut, rootName); |
|
1323 |
//add the documentImpl into the vetor which will be used in html |
|
1324 |
htmlDocumentImplList.add(docImpls); |
|
1325 |
} |
|
1326 |
} |
|
1327 |
//eml-access file wouldn't put into the zip output stream |
|
1328 |
else |
|
1329 |
{ |
|
1316 |
else |
|
1317 |
{ |
|
1330 | 1318 |
|
1331 | 1319 |
//it is data file |
1332 | 1320 |
addDataFileToZipOutputStream(docImpls, zOut, rootName); |
1333 | 1321 |
htmlDocumentImplList.add(docImpls); |
1334 |
} |
|
1322 |
}//else |
|
1323 |
}//if |
|
1335 | 1324 |
|
1336 | 1325 |
}//for |
1337 | 1326 |
|
Also available in: Unified diff
When user request a data package, the old version documents would be exported. Only export the request one.
During the export function. Every document will be check if the user has the permission to read or not.