Ignore:
Timestamp:
2012-01-26T11:50:17+13:00 (12 years ago)
Author:
sjm84
Message:

Adding UserContext to replace the use of lang and uid

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSDocumentModel.java

    r24887 r24993  
    121121     *            is the collection we want to create the document/section in.
    122122     */
    123     public void documentCreate(String oid, String collection, String lang, String uid)
     123    public void documentCreate(String oid, String collection, UserContext userContext)
    124124    {
    125125        _errorStatus = NO_ERROR;
     
    136136            oid = generateOID();
    137137        }
    138         else if (archiveCheckDocumentOrSectionExists(oid, collection, lang, uid))
     138        else if (archiveCheckDocumentOrSectionExists(oid, collection, userContext))
    139139        {
    140140            _errorStatus = ERROR_DESTINATION_DOCUMENT_OR_SECTION_ALREADY_EXISTS;
     
    164164
    165165            //Write the new entry to the archive database
    166             archiveWriteEntryToDatabase(oid, collection, entries, lang, uid);
     166            archiveWriteEntryToDatabase(oid, collection, entries, userContext);
    167167            if (_errorStatus != NO_ERROR)
    168168            {
     
    171171
    172172            //Create a basic doc.xml file to go in the new folder
    173             documentXMLCreateDocXML(oid, collection, lang, uid);
     173            documentXMLCreateDocXML(oid, collection, userContext);
    174174        }
    175175        else
    176176        {
    177             documentXMLCreateSection(oid, collection, lang, uid);
     177            documentXMLCreateSection(oid, collection, userContext);
    178178        }
    179179    }
     
    187187     *            is the collection to delete the document/section from.
    188188     */
    189     public void documentDelete(String oid, String collection, String lang, String uid)
     189    public void documentDelete(String oid, String collection, UserContext userContext)
    190190    {
    191191        _errorStatus = NO_ERROR;
     
    201201        }
    202202
    203         if (!archiveCheckDocumentOrSectionExists(oid, collection, lang, uid))
     203        if (!archiveCheckDocumentOrSectionExists(oid, collection, userContext))
    204204        {
    205205            _errorStatus = ERROR_SOURCE_DOCUMENT_OR_SECTION_DOES_NOT_EXIST;
     
    225225
    226226            //Remove the entry from the archive database
    227             archiveRemoveEntryFromDatabase(oid, collection, lang, uid);
     227            archiveRemoveEntryFromDatabase(oid, collection, userContext);
    228228        }
    229229        else
    230230        {
    231             documentXMLDeleteSection(oid, collection, lang, uid);
     231            documentXMLDeleteSection(oid, collection, userContext);
    232232        }
    233233    }
     
    249249     *            instead.
    250250     */
    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)
    254254        {
    255255            return;
     
    275275        case OPERATION_TYPE_DOC_TO_DOC:
    276276        {
    277             String archiveDir = archiveGetDocumentFilePath(oid, collection, lang, uid);
     277            String archiveDir = archiveGetDocumentFilePath(oid, collection, userContext);
    278278            if (_errorStatus != NO_ERROR)
    279279            {
     
    312312        case OPERATION_TYPE_DOC_TO_SEC:
    313313        {
    314             Document originalDocument = getDocXML(oid, collection, lang, uid);
     314            Document originalDocument = getDocXML(oid, collection, userContext);
    315315            Element originalSection = getTopLevelSectionElement(originalDocument);
    316316
    317             documentXMLCreateSection(newOID, newCollection, lang, uid);
     317            documentXMLCreateSection(newOID, newCollection, userContext);
    318318            if (_errorStatus != NO_ERROR)
    319319            {
     
    321321            }
    322322
    323             documentXMLSetSection(newOID, newCollection, originalSection, operation, lang, uid);
     323            documentXMLSetSection(newOID, newCollection, originalSection, operation, userContext);
    324324
    325325            if (move)
    326326            {
    327                 String archiveDirStr = archiveGetDocumentFilePath(oid, collection, lang, uid);
     327                String archiveDirStr = archiveGetDocumentFilePath(oid, collection, userContext);
    328328                if (_errorStatus != NO_ERROR)
    329329                {
     
    342342        case OPERATION_TYPE_SEC_TO_DOC:
    343343        {
    344             Document originalDocument = getDocXML(oid, collection, lang, uid);
     344            Document originalDocument = getDocXML(oid, collection, userContext);
    345345            Element originalSection = getSectionBySectionNumber(originalDocument, getSectionFromOID(oid));
    346346
    347             documentCreate(newOID, newCollection, lang, uid);
     347            documentCreate(newOID, newCollection, userContext);
    348348            if (_errorStatus != NO_ERROR)
    349349            {
     
    351351            }
    352352
    353             documentXMLCreateSection(newOID, newCollection, lang, uid);
     353            documentXMLCreateSection(newOID, newCollection, userContext);
    354354            if (_errorStatus != NO_ERROR)
    355355            {
     
    357357            }
    358358
    359             documentXMLSetSection(newOID, newCollection, originalSection, operation, lang, uid);
     359            documentXMLSetSection(newOID, newCollection, originalSection, operation, userContext);
    360360
    361361            if (move)
    362362            {
    363                 originalDocument = getDocXML(oid, collection, lang, uid);
     363                originalDocument = getDocXML(oid, collection, userContext);
    364364                originalSection.getParentNode().removeChild(originalSection);
    365365
    366366                //Write the new change back into the file
    367                 if (!writeXMLFile(originalDocument, oid, collection, lang, uid))
     367                if (!writeXMLFile(originalDocument, oid, collection, userContext))
    368368                {
    369369                    _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML;
     
    377377        case OPERATION_TYPE_SEC_TO_SEC:
    378378        {
    379             Document originalDocument = getDocXML(oid, collection, lang, uid);
     379            Document originalDocument = getDocXML(oid, collection, userContext);
    380380            Element originalSection = getSectionBySectionNumber(originalDocument, getSectionFromOID(oid));
    381381
    382382            if (operation == OPERATION_REPLACE)
    383383            {
    384                 documentXMLCreateSection(newOID, newCollection, lang, uid);
     384                documentXMLCreateSection(newOID, newCollection, userContext);
    385385                if (_errorStatus != NO_ERROR)
    386386                {
     
    389389            }
    390390
    391             documentXMLSetSection(newOID, newCollection, originalSection, operation, lang, uid);
     391            documentXMLSetSection(newOID, newCollection, originalSection, operation, userContext);
    392392            if (_errorStatus != NO_ERROR)
    393393            {
     
    397397            if (move)
    398398            {
    399                 originalDocument = getDocXML(oid, collection, lang, uid);
     399                originalDocument = getDocXML(oid, collection, userContext);
    400400                originalSection.getParentNode().removeChild(originalSection);
    401401
    402402                //Write the new change back into the file
    403                 if (!writeXMLFile(originalDocument, oid, collection, lang, uid))
     403                if (!writeXMLFile(originalDocument, oid, collection, userContext))
    404404                {
    405405                    _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML;
     
    420420
    421421            //Write the new entry to the archive database
    422             archiveWriteEntryToDatabase(newOID, newCollection, entries, lang, uid);
     422            archiveWriteEntryToDatabase(newOID, newCollection, entries, userContext);
    423423        }
    424424    }
     
    435435     * @return This returns an array containing the requested information.
    436436     */
    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)
    440440        {
    441441            return null;
     
    467467     *            merged into.
    468468     */
    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)
    477477        {
    478478            return;
     
    504504        }
    505505
    506         Document docXML = getDocXML(oid, collection, lang, uid);
     506        Document docXML = getDocXML(oid, collection, userContext);
    507507        if (docXML == null)
    508508        {
     
    569569        }
    570570
    571         documentXMLSetSection(mergeOID, collection, sourceSection, OPERATION_REPLACE, lang, uid);
     571        documentXMLSetSection(mergeOID, collection, sourceSection, OPERATION_REPLACE, userContext);
    572572        if (_errorStatus != NO_ERROR)
    573573        {
     
    575575        }
    576576
    577         documentXMLDeleteSection(oid, collection, lang, uid);
     577        documentXMLDeleteSection(oid, collection, userContext);
    578578    }
    579579
     
    590590     *            is the point in the text we want to split at.
    591591     */
    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);
    600600        if (docXML == null)
    601601        {
     
    644644        newSection.appendChild(newContent);
    645645
    646         documentXMLSetSection(oid, collection, newSection, OPERATION_INSERT_BEFORE, lang, uid);
     646        documentXMLSetSection(oid, collection, newSection, OPERATION_INSERT_BEFORE, userContext);
    647647        if (_errorStatus != NO_ERROR)
    648648        {
     
    652652
    653653        //Write the new change back into the file
    654         if (!writeXMLFile(docXML, oid, collection, lang, uid))
     654        if (!writeXMLFile(docXML, oid, collection, userContext))
    655655        {
    656656            _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML;
     
    666666     *            is the collection the new document will reside in.
    667667     */
    668     public void documentXMLCreateDocXML(String oid, String collection, String lang, String uid)
     668    public void documentXMLCreateDocXML(String oid, String collection, UserContext userContext)
    669669    {
    670670        _errorStatus = NO_ERROR;
     
    673673            Document docXML = null;
    674674
    675             String filePath = archiveGetDocumentFilePath(oid, collection, lang, uid);
     675            String filePath = archiveGetDocumentFilePath(oid, collection, userContext);
    676676            File docFile = new File(filePath);
    677677            if (!docFile.exists() && !docFile.createNewFile())
     
    714714     * @return an array of metadata elements containing the resquested metadata
    715715     */
    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)
    719719        {
    720720            return null;
     
    726726        }
    727727
    728         Document docXML = getDocXML(oid, collection, lang, uid);
     728        Document docXML = getDocXML(oid, collection, userContext);
    729729        if (docXML == null)
    730730        {
     
    753753     *            OPERATION_INSERT_AFTER or OPERATION_APPEND.
    754754     */
    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)
    758758        {
    759759            return;
     
    770770        }
    771771
    772         Document docXML = getDocXML(oid, collection, lang, uid);
     772        Document docXML = getDocXML(oid, collection, userContext);
    773773        if (docXML == null)
    774774        {
     
    825825
    826826        //Write the new change back into the file
    827         if (!writeXMLFile(docXML, oid, collection, lang, uid))
     827        if (!writeXMLFile(docXML, oid, collection, userContext))
    828828        {
    829829            _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML;
     
    845845     *            is position of the item that is to be deleted.
    846846     */
    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)
    850850        {
    851851            return;
     
    857857        }
    858858
    859         Document docXML = getDocXML(oid, collection, lang, uid);
     859        Document docXML = getDocXML(oid, collection, userContext);
    860860        if (docXML == null)
    861861        {
     
    884884     *            is the name of the metadata to delete.
    885885     */
    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)
    889889        {
    890890            return;
     
    896896        }
    897897
    898         Document docXML = getDocXML(oid, collection, lang, uid);
     898        Document docXML = getDocXML(oid, collection, userContext);
    899899        if (docXML == null)
    900900        {
     
    929929     *            value.
    930930     */
    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)
    934934        {
    935935            return;
     
    951951        }
    952952
    953         Document docXML = getDocXML(oid, collection, lang, uid);
     953        Document docXML = getDocXML(oid, collection, userContext);
    954954        if (docXML == null)
    955955        {
     
    971971
    972972        //Write the new change back into the file
    973         if (!writeXMLFile(docXML, oid, collection, lang, uid))
     973        if (!writeXMLFile(docXML, oid, collection, userContext))
    974974        {
    975975            _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML;
     
    985985     *            is the collection the document resides in.
    986986     */
    987     public void documentXMLCreateSection(String oid, String collection, String lang, String uid)
     987    public void documentXMLCreateSection(String oid, String collection, UserContext userContext)
    988988    {
    989989        _errorStatus = NO_ERROR;
     
    999999        }
    10001000
    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);
    10041004            if (_errorStatus != NO_ERROR)
    10051005            {
     
    10081008        }
    10091009
    1010         Document docXML = getDocXML(oid, collection, lang, uid);
     1010        Document docXML = getDocXML(oid, collection, userContext);
    10111011        if (docXML == null)
    10121012        {
     
    10681068
    10691069        //Write the new change back into the file
    1070         if (!writeXMLFile(docXML, oid, collection, lang, uid))
     1070        if (!writeXMLFile(docXML, oid, collection, userContext))
    10711071        {
    10721072            _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML;
     
    10821082     *            is the collection the document resides in.
    10831083     */
    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);
    10921092        if (docXML == null)
    10931093        {
     
    11061106
    11071107        //Write the new change back into the file
    1108         if (!writeXMLFile(docXML, oid, collection, lang, uid))
     1108        if (!writeXMLFile(docXML, oid, collection, userContext))
    11091109        {
    11101110            _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML;
     
    11211121     * @return the requested section.
    11221122     */
    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);
    11311131        if (docXML == null)
    11321132        {
     
    11681168     * @throws IOException
    11691169     */
    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);
    11781178        if (docXML == null)
    11791179        {
     
    12401240       
    12411241        //Write the new change back into the file
    1242         if (!writeXMLFile(docXML, oid, collection, lang, uid))
     1242        if (!writeXMLFile(docXML, oid, collection, userContext))
    12431243        {
    12441244            _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML;
     
    12561256     * @return the text from the section.
    12571257     */
    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);
    12661266        if (docXML == null)
    12671267        {
     
    13111311     *            is the new content element for the section.
    13121312     */
    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);
    13211321        if (docXML == null)
    13221322        {
     
    13631363
    13641364        //Write the new change back into the file
    1365         if (!writeXMLFile(docXML, oid, collection, lang, uid))
     1365        if (!writeXMLFile(docXML, oid, collection, userContext))
    13661366        {
    13671367            _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML;
     
    13801380     *            is the new text for the section.
    13811381     */
    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);
    13901390        if (docXML == null)
    13911391        {
     
    14331433
    14341434        //Write the new change back into the file
    1435         if (!writeXMLFile(docXML, oid, collection, lang, uid))
     1435        if (!writeXMLFile(docXML, oid, collection, userContext))
    14361436        {
    14371437            _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML;
     
    14511451     * @return the file path to the doc.xml file.
    14521452     */
    1453     public String archiveGetDocumentFilePath(String oid, String collection, String lang, String uid)
     1453    public String archiveGetDocumentFilePath(String oid, String collection, UserContext userContext)
    14541454    {
    14551455        _errorStatus = NO_ERROR;
     
    14601460        }
    14611461
    1462         String assocFilePath = getDocFilePathFromDatabase(oid, collection, lang, uid);
     1462        String assocFilePath = getDocFilePathFromDatabase(oid, collection, userContext);
    14631463        if (assocFilePath == null)
    14641464        {
     
    14851485     * @return the OID of the document that the source file is used in.
    14861486     */
    1487     public String archiveGetSourceFileOID(String srcFile, String collection, String lang, String uid)
     1487    public String archiveGetSourceFileOID(String srcFile, String collection, UserContext userContext)
    14881488    {
    14891489        _errorStatus = NO_ERROR;
    1490         SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFSRC, SimpleCollectionDatabase.READ, lang, uid);
     1490        SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFSRC, SimpleCollectionDatabase.READ, userContext);
    14911491        if (coll_db == null)
    14921492        {
     
    15181518     * @return true if the document/section exists, false otherwise.
    15191519     */
    1520     public boolean archiveCheckDocumentOrSectionExists(String oid, String collection, String lang, String uid)
     1520    public boolean archiveCheckDocumentOrSectionExists(String oid, String collection, UserContext userContext)
    15211521    {
    15221522        _errorStatus = NO_ERROR;
    1523         SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.READ, lang, uid);
     1523        SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.READ, userContext);
    15241524        if (coll_db == null)
    15251525        {
     
    15481548        if (section && exists)
    15491549        {
    1550             Document docXML = getDocXML(oid, collection, lang, uid);
     1550            Document docXML = getDocXML(oid, collection, userContext);
    15511551            if (getSectionBySectionNumber(docXML, getSectionFromOID(oid)) == null)
    15521552            {
     
    15691569     *            is the list of entries to write.
    15701570     */
    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)
    15721572    {
    15731573        _errorStatus = NO_ERROR;
     
    15931593        }
    15941594
    1595         SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.WRITE, lang, uid);
     1595        SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.WRITE, userContext);
    15961596        if (coll_db == null)
    15971597        {
     
    16111611     *            is the collection whose database will have the entry removed.
    16121612     */
    1613     public void archiveRemoveEntryFromDatabase(String oid, String collection, String lang, String uid)
     1613    public void archiveRemoveEntryFromDatabase(String oid, String collection, UserContext userContext)
    16141614    {
    16151615        _errorStatus = NO_ERROR;
     
    16251625        }
    16261626
    1627         SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.WRITE, lang, uid);
     1627        SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.WRITE, userContext);
    16281628        if (coll_db == null)
    16291629        {
     
    16451645     * @return the list of associated files.
    16461646     */
    1647     public ArrayList<String> archiveGetAssociatedImportFiles(String oid, String collection, String lang, String uid)
     1647    public ArrayList<String> archiveGetAssociatedImportFiles(String oid, String collection, UserContext userContext)
    16481648    {
    16491649        _errorStatus = NO_ERROR;
     
    16591659        }
    16601660
    1661         SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.READ, lang, uid);
     1661        SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.READ, userContext);
    16621662        if (coll_db == null)
    16631663        {
     
    17561756    }
    17571757
    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);
    17611761        if (coll_db == null)
    17621762        {
     
    18101810    }
    18111811
    1812     public int checkOIDandCollection(String oid, String collection, String lang, String uid)
     1812    public int checkOIDandCollection(String oid, String collection, UserContext userContext)
    18131813    {
    18141814        if (oid == null || oid.equals(""))
     
    18221822        }
    18231823
    1824         if (!archiveCheckDocumentOrSectionExists(oid, collection, lang, uid))
     1824        if (!archiveCheckDocumentOrSectionExists(oid, collection, userContext))
    18251825        {
    18261826            return ERROR_SOURCE_DOCUMENT_OR_SECTION_DOES_NOT_EXIST;
     
    18831883    }
    18841884
    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)
    18861886    {
    18871887        try
     
    18891889            DOMSource source = new DOMSource(doc);
    18901890
    1891             String test = archiveGetDocumentFilePath(oid, collection, lang, uid);
     1891            String test = archiveGetDocumentFilePath(oid, collection, userContext);
    18921892            File xmlFile = new File(test);
    18931893            Result result = new StreamResult(xmlFile);
     
    19031903    }
    19041904
    1905     public Document getDocXML(String oid, String collection, String lang, String uid)
     1905    public Document getDocXML(String oid, String collection, UserContext userContext)
    19061906    {
    19071907        if (oid.contains("."))
     
    19131913        if ((docXML = _docCache.get(oid + "__" + collection)) == null)
    19141914        {
    1915             String filePath = archiveGetDocumentFilePath(oid, collection, lang, uid);
     1915            String filePath = archiveGetDocumentFilePath(oid, collection, userContext);
    19161916            File docFile = new File(filePath);
    19171917
     
    20052005    }
    20062006
    2007     public String getDatabaseTypeFromCollection(String collection, String lang, String uid)
     2007    public String getDatabaseTypeFromCollection(String collection, UserContext userContext)
    20082008    {
    20092009        //Find out what kind of database we have
    20102010        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);
    20122012        dbTypeMessage.appendChild(dbTypeRequest);
    20132013        Element dbTypeResponse = (Element) _router.process(dbTypeMessage);
     
    20232023    }
    20242024
    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)
    20262026    {
    20272027        //Find out what kind of database we have
    2028         String databaseType = getDatabaseTypeFromCollection(collection, lang, uid);
     2028        String databaseType = getDatabaseTypeFromCollection(collection, userContext);
    20292029        String dbExt = DBHelper.getDBExtFromDBType(databaseType);
    20302030
Note: See TracChangeset for help on using the changeset viewer.