- Timestamp:
- 2012-01-26T11:50:17+13:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSDocumentModel.java
r24887 r24993 121 121 * is the collection we want to create the document/section in. 122 122 */ 123 public void documentCreate(String oid, String collection, String lang, String uid)123 public void documentCreate(String oid, String collection, UserContext userContext) 124 124 { 125 125 _errorStatus = NO_ERROR; … … 136 136 oid = generateOID(); 137 137 } 138 else if (archiveCheckDocumentOrSectionExists(oid, collection, lang, uid))138 else if (archiveCheckDocumentOrSectionExists(oid, collection, userContext)) 139 139 { 140 140 _errorStatus = ERROR_DESTINATION_DOCUMENT_OR_SECTION_ALREADY_EXISTS; … … 164 164 165 165 //Write the new entry to the archive database 166 archiveWriteEntryToDatabase(oid, collection, entries, lang, uid);166 archiveWriteEntryToDatabase(oid, collection, entries, userContext); 167 167 if (_errorStatus != NO_ERROR) 168 168 { … … 171 171 172 172 //Create a basic doc.xml file to go in the new folder 173 documentXMLCreateDocXML(oid, collection, lang, uid);173 documentXMLCreateDocXML(oid, collection, userContext); 174 174 } 175 175 else 176 176 { 177 documentXMLCreateSection(oid, collection, lang, uid);177 documentXMLCreateSection(oid, collection, userContext); 178 178 } 179 179 } … … 187 187 * is the collection to delete the document/section from. 188 188 */ 189 public void documentDelete(String oid, String collection, String lang, String uid)189 public void documentDelete(String oid, String collection, UserContext userContext) 190 190 { 191 191 _errorStatus = NO_ERROR; … … 201 201 } 202 202 203 if (!archiveCheckDocumentOrSectionExists(oid, collection, lang, uid))203 if (!archiveCheckDocumentOrSectionExists(oid, collection, userContext)) 204 204 { 205 205 _errorStatus = ERROR_SOURCE_DOCUMENT_OR_SECTION_DOES_NOT_EXIST; … … 225 225 226 226 //Remove the entry from the archive database 227 archiveRemoveEntryFromDatabase(oid, collection, lang, uid);227 archiveRemoveEntryFromDatabase(oid, collection, userContext); 228 228 } 229 229 else 230 230 { 231 documentXMLDeleteSection(oid, collection, lang, uid);231 documentXMLDeleteSection(oid, collection, userContext); 232 232 } 233 233 } … … 249 249 * instead. 250 250 */ 251 public void documentMoveOrDuplicate(String oid, String collection, String newOID, String newCollection, int operation, boolean move, String lang, String uid)252 { 253 if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR)251 public void documentMoveOrDuplicate(String oid, String collection, String newOID, String newCollection, int operation, boolean move, UserContext userContext) 252 { 253 if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 254 254 { 255 255 return; … … 275 275 case OPERATION_TYPE_DOC_TO_DOC: 276 276 { 277 String archiveDir = archiveGetDocumentFilePath(oid, collection, lang, uid);277 String archiveDir = archiveGetDocumentFilePath(oid, collection, userContext); 278 278 if (_errorStatus != NO_ERROR) 279 279 { … … 312 312 case OPERATION_TYPE_DOC_TO_SEC: 313 313 { 314 Document originalDocument = getDocXML(oid, collection, lang, uid);314 Document originalDocument = getDocXML(oid, collection, userContext); 315 315 Element originalSection = getTopLevelSectionElement(originalDocument); 316 316 317 documentXMLCreateSection(newOID, newCollection, lang, uid);317 documentXMLCreateSection(newOID, newCollection, userContext); 318 318 if (_errorStatus != NO_ERROR) 319 319 { … … 321 321 } 322 322 323 documentXMLSetSection(newOID, newCollection, originalSection, operation, lang, uid);323 documentXMLSetSection(newOID, newCollection, originalSection, operation, userContext); 324 324 325 325 if (move) 326 326 { 327 String archiveDirStr = archiveGetDocumentFilePath(oid, collection, lang, uid);327 String archiveDirStr = archiveGetDocumentFilePath(oid, collection, userContext); 328 328 if (_errorStatus != NO_ERROR) 329 329 { … … 342 342 case OPERATION_TYPE_SEC_TO_DOC: 343 343 { 344 Document originalDocument = getDocXML(oid, collection, lang, uid);344 Document originalDocument = getDocXML(oid, collection, userContext); 345 345 Element originalSection = getSectionBySectionNumber(originalDocument, getSectionFromOID(oid)); 346 346 347 documentCreate(newOID, newCollection, lang, uid);347 documentCreate(newOID, newCollection, userContext); 348 348 if (_errorStatus != NO_ERROR) 349 349 { … … 351 351 } 352 352 353 documentXMLCreateSection(newOID, newCollection, lang, uid);353 documentXMLCreateSection(newOID, newCollection, userContext); 354 354 if (_errorStatus != NO_ERROR) 355 355 { … … 357 357 } 358 358 359 documentXMLSetSection(newOID, newCollection, originalSection, operation, lang, uid);359 documentXMLSetSection(newOID, newCollection, originalSection, operation, userContext); 360 360 361 361 if (move) 362 362 { 363 originalDocument = getDocXML(oid, collection, lang, uid);363 originalDocument = getDocXML(oid, collection, userContext); 364 364 originalSection.getParentNode().removeChild(originalSection); 365 365 366 366 //Write the new change back into the file 367 if (!writeXMLFile(originalDocument, oid, collection, lang, uid))367 if (!writeXMLFile(originalDocument, oid, collection, userContext)) 368 368 { 369 369 _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML; … … 377 377 case OPERATION_TYPE_SEC_TO_SEC: 378 378 { 379 Document originalDocument = getDocXML(oid, collection, lang, uid);379 Document originalDocument = getDocXML(oid, collection, userContext); 380 380 Element originalSection = getSectionBySectionNumber(originalDocument, getSectionFromOID(oid)); 381 381 382 382 if (operation == OPERATION_REPLACE) 383 383 { 384 documentXMLCreateSection(newOID, newCollection, lang, uid);384 documentXMLCreateSection(newOID, newCollection, userContext); 385 385 if (_errorStatus != NO_ERROR) 386 386 { … … 389 389 } 390 390 391 documentXMLSetSection(newOID, newCollection, originalSection, operation, lang, uid);391 documentXMLSetSection(newOID, newCollection, originalSection, operation, userContext); 392 392 if (_errorStatus != NO_ERROR) 393 393 { … … 397 397 if (move) 398 398 { 399 originalDocument = getDocXML(oid, collection, lang, uid);399 originalDocument = getDocXML(oid, collection, userContext); 400 400 originalSection.getParentNode().removeChild(originalSection); 401 401 402 402 //Write the new change back into the file 403 if (!writeXMLFile(originalDocument, oid, collection, lang, uid))403 if (!writeXMLFile(originalDocument, oid, collection, userContext)) 404 404 { 405 405 _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML; … … 420 420 421 421 //Write the new entry to the archive database 422 archiveWriteEntryToDatabase(newOID, newCollection, entries, lang, uid);422 archiveWriteEntryToDatabase(newOID, newCollection, entries, userContext); 423 423 } 424 424 } … … 435 435 * @return This returns an array containing the requested information. 436 436 */ 437 public String[] documentGetInformation(String oid, String collection, String[] requestedInfo, String lang, String uid)438 { 439 if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR)437 public String[] documentGetInformation(String oid, String collection, String[] requestedInfo, UserContext userContext) 438 { 439 if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 440 440 { 441 441 return null; … … 467 467 * merged into. 468 468 */ 469 public void documentMerge(String oid, String collection, String mergeOID, String lang, String uid)470 { 471 if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR)472 { 473 return; 474 } 475 476 if ((_errorStatus = checkOIDandCollection(mergeOID, collection, lang, uid)) != NO_ERROR)469 public void documentMerge(String oid, String collection, String mergeOID, UserContext userContext) 470 { 471 if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 472 { 473 return; 474 } 475 476 if ((_errorStatus = checkOIDandCollection(mergeOID, collection, userContext)) != NO_ERROR) 477 477 { 478 478 return; … … 504 504 } 505 505 506 Document docXML = getDocXML(oid, collection, lang, uid);506 Document docXML = getDocXML(oid, collection, userContext); 507 507 if (docXML == null) 508 508 { … … 569 569 } 570 570 571 documentXMLSetSection(mergeOID, collection, sourceSection, OPERATION_REPLACE, lang, uid);571 documentXMLSetSection(mergeOID, collection, sourceSection, OPERATION_REPLACE, userContext); 572 572 if (_errorStatus != NO_ERROR) 573 573 { … … 575 575 } 576 576 577 documentXMLDeleteSection(oid, collection, lang, uid);577 documentXMLDeleteSection(oid, collection, userContext); 578 578 } 579 579 … … 590 590 * is the point in the text we want to split at. 591 591 */ 592 public void documentSplit(String oid, String collection, int splitPoint, String lang, String uid)593 { 594 if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR)595 { 596 return; 597 } 598 599 Document docXML = getDocXML(oid, collection, lang, uid);592 public void documentSplit(String oid, String collection, int splitPoint, UserContext userContext) 593 { 594 if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 595 { 596 return; 597 } 598 599 Document docXML = getDocXML(oid, collection, userContext); 600 600 if (docXML == null) 601 601 { … … 644 644 newSection.appendChild(newContent); 645 645 646 documentXMLSetSection(oid, collection, newSection, OPERATION_INSERT_BEFORE, lang, uid);646 documentXMLSetSection(oid, collection, newSection, OPERATION_INSERT_BEFORE, userContext); 647 647 if (_errorStatus != NO_ERROR) 648 648 { … … 652 652 653 653 //Write the new change back into the file 654 if (!writeXMLFile(docXML, oid, collection, lang, uid))654 if (!writeXMLFile(docXML, oid, collection, userContext)) 655 655 { 656 656 _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML; … … 666 666 * is the collection the new document will reside in. 667 667 */ 668 public void documentXMLCreateDocXML(String oid, String collection, String lang, String uid)668 public void documentXMLCreateDocXML(String oid, String collection, UserContext userContext) 669 669 { 670 670 _errorStatus = NO_ERROR; … … 673 673 Document docXML = null; 674 674 675 String filePath = archiveGetDocumentFilePath(oid, collection, lang, uid);675 String filePath = archiveGetDocumentFilePath(oid, collection, userContext); 676 676 File docFile = new File(filePath); 677 677 if (!docFile.exists() && !docFile.createNewFile()) … … 714 714 * @return an array of metadata elements containing the resquested metadata 715 715 */ 716 public ArrayList<Element> documentXMLGetMetadata(String oid, String collection, String metadataName, String lang, String uid)717 { 718 if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR)716 public ArrayList<Element> documentXMLGetMetadata(String oid, String collection, String metadataName, UserContext userContext) 717 { 718 if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 719 719 { 720 720 return null; … … 726 726 } 727 727 728 Document docXML = getDocXML(oid, collection, lang, uid);728 Document docXML = getDocXML(oid, collection, userContext); 729 729 if (docXML == null) 730 730 { … … 753 753 * OPERATION_INSERT_AFTER or OPERATION_APPEND. 754 754 */ 755 public void documentXMLSetMetadata(String oid, String collection, String metadataName, String newMetadataValue, int position, int operation, String lang, String uid)756 { 757 if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR)755 public void documentXMLSetMetadata(String oid, String collection, String metadataName, String newMetadataValue, int position, int operation, UserContext userContext) 756 { 757 if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 758 758 { 759 759 return; … … 770 770 } 771 771 772 Document docXML = getDocXML(oid, collection, lang, uid);772 Document docXML = getDocXML(oid, collection, userContext); 773 773 if (docXML == null) 774 774 { … … 825 825 826 826 //Write the new change back into the file 827 if (!writeXMLFile(docXML, oid, collection, lang, uid))827 if (!writeXMLFile(docXML, oid, collection, userContext)) 828 828 { 829 829 _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML; … … 845 845 * is position of the item that is to be deleted. 846 846 */ 847 public void documentXMLDeleteMetadata(String oid, String collection, String metadataName, int position, String lang, String uid)848 { 849 if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR)847 public void documentXMLDeleteMetadata(String oid, String collection, String metadataName, int position, UserContext userContext) 848 { 849 if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 850 850 { 851 851 return; … … 857 857 } 858 858 859 Document docXML = getDocXML(oid, collection, lang, uid);859 Document docXML = getDocXML(oid, collection, userContext); 860 860 if (docXML == null) 861 861 { … … 884 884 * is the name of the metadata to delete. 885 885 */ 886 public void documentXMLDeleteMetadata(String oid, String collection, String metadataName, String lang, String uid)887 { 888 if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR)886 public void documentXMLDeleteMetadata(String oid, String collection, String metadataName, UserContext userContext) 887 { 888 if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 889 889 { 890 890 return; … … 896 896 } 897 897 898 Document docXML = getDocXML(oid, collection, lang, uid);898 Document docXML = getDocXML(oid, collection, userContext); 899 899 if (docXML == null) 900 900 { … … 929 929 * value. 930 930 */ 931 public void documentXMLReplaceMetadata(String oid, String collection, String metadataName, String oldMetadataValue, String newMetadataValue, String lang, String uid)932 { 933 if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR)931 public void documentXMLReplaceMetadata(String oid, String collection, String metadataName, String oldMetadataValue, String newMetadataValue, UserContext userContext) 932 { 933 if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 934 934 { 935 935 return; … … 951 951 } 952 952 953 Document docXML = getDocXML(oid, collection, lang, uid);953 Document docXML = getDocXML(oid, collection, userContext); 954 954 if (docXML == null) 955 955 { … … 971 971 972 972 //Write the new change back into the file 973 if (!writeXMLFile(docXML, oid, collection, lang, uid))973 if (!writeXMLFile(docXML, oid, collection, userContext)) 974 974 { 975 975 _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML; … … 985 985 * is the collection the document resides in. 986 986 */ 987 public void documentXMLCreateSection(String oid, String collection, String lang, String uid)987 public void documentXMLCreateSection(String oid, String collection, UserContext userContext) 988 988 { 989 989 _errorStatus = NO_ERROR; … … 999 999 } 1000 1000 1001 if (oid.contains(".") && !archiveCheckDocumentOrSectionExists(oid.substring(0, oid.indexOf(".")), collection, lang, uid))1002 { 1003 documentCreate(oid.substring(0, oid.indexOf(".")), collection, lang, uid);1001 if (oid.contains(".") && !archiveCheckDocumentOrSectionExists(oid.substring(0, oid.indexOf(".")), collection, userContext)) 1002 { 1003 documentCreate(oid.substring(0, oid.indexOf(".")), collection, userContext); 1004 1004 if (_errorStatus != NO_ERROR) 1005 1005 { … … 1008 1008 } 1009 1009 1010 Document docXML = getDocXML(oid, collection, lang, uid);1010 Document docXML = getDocXML(oid, collection, userContext); 1011 1011 if (docXML == null) 1012 1012 { … … 1068 1068 1069 1069 //Write the new change back into the file 1070 if (!writeXMLFile(docXML, oid, collection, lang, uid))1070 if (!writeXMLFile(docXML, oid, collection, userContext)) 1071 1071 { 1072 1072 _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML; … … 1082 1082 * is the collection the document resides in. 1083 1083 */ 1084 public void documentXMLDeleteSection(String oid, String collection, String lang, String uid)1085 { 1086 if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR)1087 { 1088 return; 1089 } 1090 1091 Document docXML = getDocXML(oid, collection, lang, uid);1084 public void documentXMLDeleteSection(String oid, String collection, UserContext userContext) 1085 { 1086 if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 1087 { 1088 return; 1089 } 1090 1091 Document docXML = getDocXML(oid, collection, userContext); 1092 1092 if (docXML == null) 1093 1093 { … … 1106 1106 1107 1107 //Write the new change back into the file 1108 if (!writeXMLFile(docXML, oid, collection, lang, uid))1108 if (!writeXMLFile(docXML, oid, collection, userContext)) 1109 1109 { 1110 1110 _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML; … … 1121 1121 * @return the requested section. 1122 1122 */ 1123 public Element documentXMLGetSection(String oid, String collection, String lang, String uid)1124 { 1125 if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR)1126 { 1127 return null; 1128 } 1129 1130 Document docXML = getDocXML(oid, collection, lang, uid);1123 public Element documentXMLGetSection(String oid, String collection, UserContext userContext) 1124 { 1125 if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 1126 { 1127 return null; 1128 } 1129 1130 Document docXML = getDocXML(oid, collection, userContext); 1131 1131 if (docXML == null) 1132 1132 { … … 1168 1168 * @throws IOException 1169 1169 */ 1170 public void documentXMLSetSection(String oid, String collection, Element newSection, int operation, String lang, String uid)1171 { 1172 if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR)1173 { 1174 return; 1175 } 1176 1177 Document docXML = getDocXML(oid, collection, lang, uid);1170 public void documentXMLSetSection(String oid, String collection, Element newSection, int operation, UserContext userContext) 1171 { 1172 if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 1173 { 1174 return; 1175 } 1176 1177 Document docXML = getDocXML(oid, collection, userContext); 1178 1178 if (docXML == null) 1179 1179 { … … 1240 1240 1241 1241 //Write the new change back into the file 1242 if (!writeXMLFile(docXML, oid, collection, lang, uid))1242 if (!writeXMLFile(docXML, oid, collection, userContext)) 1243 1243 { 1244 1244 _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML; … … 1256 1256 * @return the text from the section. 1257 1257 */ 1258 public String documentXMLGetText(String oid, String collection, String lang, String uid)1259 { 1260 if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR)1261 { 1262 return null; 1263 } 1264 1265 Document docXML = getDocXML(oid, collection, lang, uid);1258 public String documentXMLGetText(String oid, String collection, UserContext userContext) 1259 { 1260 if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 1261 { 1262 return null; 1263 } 1264 1265 Document docXML = getDocXML(oid, collection, userContext); 1266 1266 if (docXML == null) 1267 1267 { … … 1311 1311 * is the new content element for the section. 1312 1312 */ 1313 public void documentXMLSetText(String oid, String collection, Element newContent, String lang, String uid)1314 { 1315 if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR)1316 { 1317 return; 1318 } 1319 1320 Document docXML = getDocXML(oid, collection, lang, uid);1313 public void documentXMLSetText(String oid, String collection, Element newContent, UserContext userContext) 1314 { 1315 if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 1316 { 1317 return; 1318 } 1319 1320 Document docXML = getDocXML(oid, collection, userContext); 1321 1321 if (docXML == null) 1322 1322 { … … 1363 1363 1364 1364 //Write the new change back into the file 1365 if (!writeXMLFile(docXML, oid, collection, lang, uid))1365 if (!writeXMLFile(docXML, oid, collection, userContext)) 1366 1366 { 1367 1367 _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML; … … 1380 1380 * is the new text for the section. 1381 1381 */ 1382 public void documentXMLSetText(String oid, String collection, String newContent, String lang, String uid)1383 { 1384 if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR)1385 { 1386 return; 1387 } 1388 1389 Document docXML = getDocXML(oid, collection, lang, uid);1382 public void documentXMLSetText(String oid, String collection, String newContent, UserContext userContext) 1383 { 1384 if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 1385 { 1386 return; 1387 } 1388 1389 Document docXML = getDocXML(oid, collection, userContext); 1390 1390 if (docXML == null) 1391 1391 { … … 1433 1433 1434 1434 //Write the new change back into the file 1435 if (!writeXMLFile(docXML, oid, collection, lang, uid))1435 if (!writeXMLFile(docXML, oid, collection, userContext)) 1436 1436 { 1437 1437 _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML; … … 1451 1451 * @return the file path to the doc.xml file. 1452 1452 */ 1453 public String archiveGetDocumentFilePath(String oid, String collection, String lang, String uid)1453 public String archiveGetDocumentFilePath(String oid, String collection, UserContext userContext) 1454 1454 { 1455 1455 _errorStatus = NO_ERROR; … … 1460 1460 } 1461 1461 1462 String assocFilePath = getDocFilePathFromDatabase(oid, collection, lang, uid);1462 String assocFilePath = getDocFilePathFromDatabase(oid, collection, userContext); 1463 1463 if (assocFilePath == null) 1464 1464 { … … 1485 1485 * @return the OID of the document that the source file is used in. 1486 1486 */ 1487 public String archiveGetSourceFileOID(String srcFile, String collection, String lang, String uid)1487 public String archiveGetSourceFileOID(String srcFile, String collection, UserContext userContext) 1488 1488 { 1489 1489 _errorStatus = NO_ERROR; 1490 SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFSRC, SimpleCollectionDatabase.READ, lang, uid);1490 SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFSRC, SimpleCollectionDatabase.READ, userContext); 1491 1491 if (coll_db == null) 1492 1492 { … … 1518 1518 * @return true if the document/section exists, false otherwise. 1519 1519 */ 1520 public boolean archiveCheckDocumentOrSectionExists(String oid, String collection, String lang, String uid)1520 public boolean archiveCheckDocumentOrSectionExists(String oid, String collection, UserContext userContext) 1521 1521 { 1522 1522 _errorStatus = NO_ERROR; 1523 SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.READ, lang, uid);1523 SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.READ, userContext); 1524 1524 if (coll_db == null) 1525 1525 { … … 1548 1548 if (section && exists) 1549 1549 { 1550 Document docXML = getDocXML(oid, collection, lang, uid);1550 Document docXML = getDocXML(oid, collection, userContext); 1551 1551 if (getSectionBySectionNumber(docXML, getSectionFromOID(oid)) == null) 1552 1552 { … … 1569 1569 * is the list of entries to write. 1570 1570 */ 1571 public void archiveWriteEntryToDatabase(String oid, String collection, HashMap<String, ArrayList<String>> infoList, String lang, String uid)1571 public void archiveWriteEntryToDatabase(String oid, String collection, HashMap<String, ArrayList<String>> infoList, UserContext userContext) 1572 1572 { 1573 1573 _errorStatus = NO_ERROR; … … 1593 1593 } 1594 1594 1595 SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.WRITE, lang, uid);1595 SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.WRITE, userContext); 1596 1596 if (coll_db == null) 1597 1597 { … … 1611 1611 * is the collection whose database will have the entry removed. 1612 1612 */ 1613 public void archiveRemoveEntryFromDatabase(String oid, String collection, String lang, String uid)1613 public void archiveRemoveEntryFromDatabase(String oid, String collection, UserContext userContext) 1614 1614 { 1615 1615 _errorStatus = NO_ERROR; … … 1625 1625 } 1626 1626 1627 SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.WRITE, lang, uid);1627 SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.WRITE, userContext); 1628 1628 if (coll_db == null) 1629 1629 { … … 1645 1645 * @return the list of associated files. 1646 1646 */ 1647 public ArrayList<String> archiveGetAssociatedImportFiles(String oid, String collection, String lang, String uid)1647 public ArrayList<String> archiveGetAssociatedImportFiles(String oid, String collection, UserContext userContext) 1648 1648 { 1649 1649 _errorStatus = NO_ERROR; … … 1659 1659 } 1660 1660 1661 SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.READ, lang, uid);1661 SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.READ, userContext); 1662 1662 if (coll_db == null) 1663 1663 { … … 1756 1756 } 1757 1757 1758 public String getDocFilePathFromDatabase(String oid, String collection, String lang, String uid)1759 { 1760 SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.WRITE, lang, uid);1758 public String getDocFilePathFromDatabase(String oid, String collection, UserContext userContext) 1759 { 1760 SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.WRITE, userContext); 1761 1761 if (coll_db == null) 1762 1762 { … … 1810 1810 } 1811 1811 1812 public int checkOIDandCollection(String oid, String collection, String lang, String uid)1812 public int checkOIDandCollection(String oid, String collection, UserContext userContext) 1813 1813 { 1814 1814 if (oid == null || oid.equals("")) … … 1822 1822 } 1823 1823 1824 if (!archiveCheckDocumentOrSectionExists(oid, collection, lang, uid))1824 if (!archiveCheckDocumentOrSectionExists(oid, collection, userContext)) 1825 1825 { 1826 1826 return ERROR_SOURCE_DOCUMENT_OR_SECTION_DOES_NOT_EXIST; … … 1883 1883 } 1884 1884 1885 public boolean writeXMLFile(Document doc, String oid, String collection, String lang, String uid)1885 public boolean writeXMLFile(Document doc, String oid, String collection, UserContext userContext) 1886 1886 { 1887 1887 try … … 1889 1889 DOMSource source = new DOMSource(doc); 1890 1890 1891 String test = archiveGetDocumentFilePath(oid, collection, lang, uid);1891 String test = archiveGetDocumentFilePath(oid, collection, userContext); 1892 1892 File xmlFile = new File(test); 1893 1893 Result result = new StreamResult(xmlFile); … … 1903 1903 } 1904 1904 1905 public Document getDocXML(String oid, String collection, String lang, String uid)1905 public Document getDocXML(String oid, String collection, UserContext userContext) 1906 1906 { 1907 1907 if (oid.contains(".")) … … 1913 1913 if ((docXML = _docCache.get(oid + "__" + collection)) == null) 1914 1914 { 1915 String filePath = archiveGetDocumentFilePath(oid, collection, lang, uid);1915 String filePath = archiveGetDocumentFilePath(oid, collection, userContext); 1916 1916 File docFile = new File(filePath); 1917 1917 … … 2005 2005 } 2006 2006 2007 public String getDatabaseTypeFromCollection(String collection, String lang, String uid)2007 public String getDatabaseTypeFromCollection(String collection, UserContext userContext) 2008 2008 { 2009 2009 //Find out what kind of database we have 2010 2010 Element dbTypeMessage = _mainDoc.createElement(GSXML.MESSAGE_ELEM); 2011 Element dbTypeRequest = GSXML.createBasicRequest(_mainDoc, GSXML.REQUEST_TYPE_DESCRIBE, collection, lang, uid);2011 Element dbTypeRequest = GSXML.createBasicRequest(_mainDoc, GSXML.REQUEST_TYPE_DESCRIBE, collection, userContext); 2012 2012 dbTypeMessage.appendChild(dbTypeRequest); 2013 2013 Element dbTypeResponse = (Element) _router.process(dbTypeMessage); … … 2023 2023 } 2024 2024 2025 public SimpleCollectionDatabase openDatabase(String collection, String dbName, int readWrite, String lang, String uid)2025 public SimpleCollectionDatabase openDatabase(String collection, String dbName, int readWrite, UserContext userContext) 2026 2026 { 2027 2027 //Find out what kind of database we have 2028 String databaseType = getDatabaseTypeFromCollection(collection, lang, uid);2028 String databaseType = getDatabaseTypeFromCollection(collection, userContext); 2029 2029 String dbExt = DBHelper.getDBExtFromDBType(databaseType); 2030 2030
Note:
See TracChangeset
for help on using the changeset viewer.