Revision 3772
Added by ben leinfelder about 16 years ago
ClientViewHelper.java | ||
---|---|---|
1000 | 1000 |
pth = ClientFgdcHelper.FGDC_DOCID_ROOT_XPATH.replaceFirst("%1s", docId); |
1001 | 1001 |
branchRoot = getNode(xpath, pth, getMetadataDoc()); |
1002 | 1002 |
fNm = getNodeText(xpath, ClientFgdcHelper.FGDC_FILE_NAME_XPATH, branchRoot); |
1003 |
//include the filename for the docid |
|
1004 |
args.put(fNm, docId); |
|
1003 | 1005 |
fNm = toZipFileName(fNm); |
1004 | 1006 |
responseMap.put("contentType", "application/zip"); |
1005 | 1007 |
//*** Get the list of docId's for the entire package. |
1006 | 1008 |
args.put(metaId, "docid"); |
1007 | 1009 |
txtLst = getNodeTextList(xpath, ClientFgdcHelper.FGDC_DATA_FILE_NODES_XPATH, branchRoot); |
1008 |
for (int i = 0; i < txtLst.length; i++) |
|
1009 |
args.put(txtLst[i], "docid"); |
|
1010 |
for (int i = 0; i < txtLst.length; i++) { |
|
1011 |
String additionalDocId = txtLst[i]; |
|
1012 |
if (additionalDocId != null && additionalDocId.length() > 1) { |
|
1013 |
//look up the filename from the metadata |
|
1014 |
String tempPath = ClientFgdcHelper.PATH4ANCESTOR.replaceFirst("%1s", additionalDocId); |
|
1015 |
tempPath = tempPath.replaceFirst("%2s", "digform"); |
|
1016 |
Node tempBranchRoot = getNode(xpath, tempPath, getMetadataDoc()); |
|
1017 |
String tempFileName = getNodeText(xpath, ClientFgdcHelper.FGDC_DATA_FILE_NAME_XPATH, tempBranchRoot); |
|
1018 |
//include the docid |
|
1019 |
args.put(additionalDocId, "docid"); |
|
1020 |
//include the filename for the docid |
|
1021 |
args.put(tempFileName, additionalDocId); |
|
1022 |
} |
|
1023 |
} |
|
1010 | 1024 |
args.put("zip", "qformat"); |
1011 | 1025 |
} else { //*** This is a data file. |
1012 | 1026 |
pth = ClientFgdcHelper.PATH4ANCESTOR.replaceFirst("%1s", docId); |
Also available in: Unified diff
Enable file naming when returning a zip file of the requested documents.
File names for each docid are provided as additional parameters named by the actual docid value that they are providing a name for. An example query string might look like:
action=read&docid=doc.1.1&docid=doc.2.1&qformat=zip&doc.1.1=fileName1.txt&doc.2.1=fileName2.jpg
and would create a zip file containing files named:
fileName1.txt
fileName2.jpg
This is enhancement was motivated by the SANParks/SAEON skin use of FGDC groups of files and will be useful in the NCEAS and KNB skins when they support FGDC metadata display and download.
See bug #3146 for additional information.