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/service/DocumentMaker.java

    r24890 r24993  
    3838import org.greenstone.gsdl3.util.GSPath;
    3939import org.greenstone.gsdl3.util.GSXML;
     40import org.greenstone.gsdl3.util.UserContext;
    4041
    4142import org.w3c.dom.Element;
     
    123124        }
    124125
    125         String lang = request.getAttribute(GSXML.LANG_ATT);
    126         String uid = request.getAttribute(GSXML.USER_ID_ATT);
     126        UserContext userContext = new UserContext(request);
    127127
    128128        //Get the list of documents to create
     
    135135            String collection = currentDoc.getAttribute(GSXML.COLLECTION_ATT);
    136136
    137             _GSDM.documentCreate(oid, collection, lang, uid);
     137            _GSDM.documentCreate(oid, collection, userContext);
    138138            if (_GSDM.checkError(result, DOCUMENT_CREATE))
    139139            {
     
    155155        }
    156156
    157         String lang = request.getAttribute(GSXML.LANG_ATT);
    158         String uid = request.getAttribute(GSXML.USER_ID_ATT);
     157        UserContext userContext = new UserContext(request);
    159158
    160159        //Get the list of documents to delete
     
    166165            String collection = currentDoc.getAttribute(GSXML.COLLECTION_ATT);
    167166
    168             _GSDM.documentDelete(oid, collection, lang, uid);
     167            _GSDM.documentDelete(oid, collection, userContext);
    169168            if (_GSDM.checkError(result, DOCUMENT_DELETE))
    170169            {
     
    186185        }
    187186
    188         String lang = request.getAttribute(GSXML.LANG_ATT);
    189         String uid = request.getAttribute(GSXML.USER_ID_ATT);
     187        UserContext userContext = new UserContext(request);
    190188
    191189        //Get the list of documents to duplicate
     
    200198            String operation = currentDoc.getAttribute("operation");
    201199
    202             _GSDM.documentMoveOrDuplicate(oid, collection, newOID, newCollection, _GSDM.operationStringToInt(operation), false, lang, uid);
     200            _GSDM.documentMoveOrDuplicate(oid, collection, newOID, newCollection, _GSDM.operationStringToInt(operation), false, userContext);
    203201            if (_GSDM.checkError(result, DOCUMENT_DUPLICATE))
    204202            {
     
    220218        }
    221219
    222         String lang = request.getAttribute(GSXML.LANG_ATT);
    223         String uid = request.getAttribute(GSXML.USER_ID_ATT);
     220        UserContext userContext = new UserContext(request);
    224221
    225222        //Get the list of documents to duplicate
     
    239236            }
    240237
    241             _GSDM.documentGetInformation(oid, collection, requestedInfo, lang, uid);
     238            _GSDM.documentGetInformation(oid, collection, requestedInfo, userContext);
    242239            if (_GSDM.checkError(result, DOCUMENT_GET_INFORMATION))
    243240            {
     
    259256        }
    260257
    261         String lang = request.getAttribute(GSXML.LANG_ATT);
    262         String uid = request.getAttribute(GSXML.USER_ID_ATT);
     258        UserContext userContext = new UserContext(request);
    263259
    264260        //Get the list of documents to duplicate
     
    273269            String operation = currentDoc.getAttribute("operation");
    274270
    275             _GSDM.documentMoveOrDuplicate(oid, collection, newOID, newCollection, _GSDM.operationStringToInt(operation), true, lang, uid);
     271            _GSDM.documentMoveOrDuplicate(oid, collection, newOID, newCollection, _GSDM.operationStringToInt(operation), true, userContext);
    276272            if (_GSDM.checkError(result, DOCUMENT_MOVE))
    277273            {
     
    292288        }
    293289
    294         String lang = request.getAttribute(GSXML.LANG_ATT);
    295         String uid = request.getAttribute(GSXML.USER_ID_ATT);
     290        UserContext userContext = new UserContext(request);
    296291
    297292        //Get the list of documents to duplicate
     
    304299            String mergeOID = currentDoc.getAttribute("merge" + GSXML.NODE_ID_ATT);
    305300
    306             _GSDM.documentMerge(oid, collection, mergeOID, lang, uid);
     301            _GSDM.documentMerge(oid, collection, mergeOID, userContext);
    307302            if (_GSDM.checkError(result, DOCUMENT_MERGE))
    308303            {
     
    324319        }
    325320
    326         String lang = request.getAttribute(GSXML.LANG_ATT);
    327         String uid = request.getAttribute(GSXML.USER_ID_ATT);
     321        UserContext userContext = new UserContext(request);
    328322
    329323        //Get the list of documents to duplicate
     
    347341            }
    348342
    349             _GSDM.documentSplit(oid, collection, split, lang, uid);
     343            _GSDM.documentSplit(oid, collection, split, userContext);
    350344            if (_GSDM.checkError(result, DOCUMENT_SPLIT))
    351345            {
     
    367361        }
    368362
    369         String lang = request.getAttribute(GSXML.LANG_ATT);
    370         String uid = request.getAttribute(GSXML.USER_ID_ATT);
     363        UserContext userContext = new UserContext(request);
    371364
    372365        Element param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER);
     
    401394                    String subOperation = (String) keyValueMap.get("subOperation");
    402395
    403                     _GSDM.documentMoveOrDuplicate(origOID, origCollection, newOID, newCollection, _GSDM.operationStringToInt(subOperation), operation.equals("move"), lang, uid);
     396                    _GSDM.documentMoveOrDuplicate(origOID, origCollection, newOID, newCollection, _GSDM.operationStringToInt(subOperation), operation.equals("move"), userContext);
    404397
    405398                    if (_GSDM.getErrorStatus() == GSDocumentModel.NO_ERROR && origCollection != null && !collectionsToBuild.contains(origCollection))
     
    419412                    String subOperation = (String) keyValueMap.get("subOperation");
    420413
    421                     //_GSDM.documentCreate(oid, collection, lang, uid); <--- Maybe go back to this
    422                     _GSDM.documentXMLSetSection(oid, collection, this.doc.createElement(GSXML.DOCXML_SECTION_ELEM), _GSDM.operationStringToInt(subOperation), lang, uid);
     414                    //_GSDM.documentCreate(oid, collection, userContext); <--- Maybe go back to this
     415                    _GSDM.documentXMLSetSection(oid, collection, this.doc.createElement(GSXML.DOCXML_SECTION_ELEM), _GSDM.operationStringToInt(subOperation), userContext);
    423416
    424417                    if (_GSDM.getErrorStatus() == GSDocumentModel.NO_ERROR && collection != null && !collectionsToBuild.contains(collection))
     
    432425                    String collection = (String) keyValueMap.get("collection");
    433426
    434                     _GSDM.documentDelete(oid, collection, lang, uid);
     427                    _GSDM.documentDelete(oid, collection, userContext);
    435428
    436429                    if (_GSDM.getErrorStatus() == GSDocumentModel.NO_ERROR && collection != null && !collectionsToBuild.contains(collection))
     
    445438                    String newContent = (String) keyValueMap.get("text");
    446439                   
    447                     _GSDM.documentXMLSetText(oid, collection, newContent, lang, uid);
     440                    _GSDM.documentXMLSetText(oid, collection, newContent, userContext);
    448441                   
    449442                    System.err.println(newContent);
Note: See TracChangeset for help on using the changeset viewer.