Changeset 36975


Ignore:
Timestamp:
2022-12-07T12:04:45+13:00 (15 months ago)
Author:
kjdon
Message:

made all the service names public, and added _SERVICE to the variable names to keep this in line with other serviceracks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/DocXMLUtil.java

    r32064 r36975  
    5656     * The list of services the doc.xml utility service rack supports *
    5757     *****************************************************************/
    58     protected static final String DOC_XML_CREATE_EMPTY_FILE = "DocXMLCreateEmptyFile";
    59     protected static final String DOC_XML_GET_METADATA = "DocXMLGetMetadata";
    60     protected static final String DOC_XML_SET_METADATA = "DocXMLSetMetadata";
    61     protected static final String DOC_XML_CREATE_SECTION = "DocXMLCreateSection";
    62     protected static final String DOC_XML_DELETE_SECTION = "DocXMLDeleteSection";
    63     protected static final String DOC_XML_GET_SECTION = "DocXMLGetSection";
    64     protected static final String DOC_XML_SET_SECTION = "DocXMLSetSection";
    65     protected static final String DOC_XML_GET_TEXT = "DocXMLGetText";
    66     protected static final String DOC_XML_SET_TEXT = "DocXMLSetText";
    67     protected static final String DOC_XML_DELETE_TEXT = "DocXMLDeleteText";
     58    public static final String DOC_XML_CREATE_EMPTY_FILE_SERVICE = "DocXMLCreateEmptyFile";
     59    public static final String DOC_XML_GET_METADATA_SERVICE = "DocXMLGetMetadata";
     60    public static final String DOC_XML_SET_METADATA_SERVICE = "DocXMLSetMetadata";
     61    public static final String DOC_XML_CREATE_SECTION_SERVICE = "DocXMLCreateSection";
     62    public static final String DOC_XML_DELETE_SECTION_SERVICE = "DocXMLDeleteSection";
     63    public static final String DOC_XML_GET_SECTION_SERVICE = "DocXMLGetSection";
     64    public static final String DOC_XML_SET_SECTION_SERVICE = "DocXMLSetSection";
     65    public static final String DOC_XML_GET_TEXT_SERVICE = "DocXMLGetText";
     66    public static final String DOC_XML_SET_TEXT_SERVICE = "DocXMLSetText";
     67    public static final String DOC_XML_DELETE_TEXT_SERVICE = "DocXMLDeleteText";
    6868    /*****************************************************************/
    6969
    70     String[] services = { DOC_XML_CREATE_EMPTY_FILE, DOC_XML_GET_METADATA, DOC_XML_SET_METADATA, DOC_XML_GET_SECTION, DOC_XML_SET_SECTION, DOC_XML_DELETE_SECTION, DOC_XML_GET_TEXT, DOC_XML_SET_TEXT };
     70    String[] services = { DOC_XML_CREATE_EMPTY_FILE_SERVICE, DOC_XML_GET_METADATA_SERVICE, DOC_XML_SET_METADATA_SERVICE, DOC_XML_GET_SECTION_SERVICE, DOC_XML_SET_SECTION_SERVICE, DOC_XML_DELETE_SECTION_SERVICE, DOC_XML_GET_TEXT_SERVICE, DOC_XML_SET_TEXT_SERVICE };
    7171
    7272    /** configure this service */
     
    117117    {
    118118      Document result_doc = XMLConverter.newDOM();
    119         Element result = GSXML.createBasicResponse(result_doc, DOC_XML_CREATE_EMPTY_FILE);
    120 
    121         if (request == null)
    122         {
    123             GSXML.addError(result, DOC_XML_CREATE_EMPTY_FILE + ": Request is null", GSXML.ERROR_TYPE_SYNTAX);
     119        Element result = GSXML.createBasicResponse(result_doc, DOC_XML_CREATE_EMPTY_FILE_SERVICE);
     120
     121        if (request == null)
     122        {
     123            GSXML.addError(result, DOC_XML_CREATE_EMPTY_FILE_SERVICE + ": Request is null", GSXML.ERROR_TYPE_SYNTAX);
    124124            return result;
    125125        }
     
    136136
    137137            _GSDM.documentXMLCreateDocXML(oid, collection, userContext);
    138             if(_GSDM.checkError(result, DOC_XML_CREATE_EMPTY_FILE))
     138            if(_GSDM.checkError(result, DOC_XML_CREATE_EMPTY_FILE_SERVICE))
    139139            {
    140140                return result;
     
    147147    {
    148148      Document result_doc = XMLConverter.newDOM();
    149         Element result = GSXML.createBasicResponse(result_doc, DOC_XML_GET_METADATA);
    150 
    151         if (request == null)
    152         {
    153             GSXML.addError(result, DOC_XML_GET_METADATA + ": Request is null", GSXML.ERROR_TYPE_SYNTAX);
     149        Element result = GSXML.createBasicResponse(result_doc, DOC_XML_GET_METADATA_SERVICE);
     150
     151        if (request == null)
     152        {
     153            GSXML.addError(result, DOC_XML_GET_METADATA_SERVICE + ": Request is null", GSXML.ERROR_TYPE_SYNTAX);
    154154            return result;
    155155        }
     
    167167
    168168            ArrayList<Element> metadataValues = _GSDM.documentXMLGetMetadata(oid, collection, metadataName, userContext);
    169             if(_GSDM.checkError(result, DOC_XML_GET_METADATA))
     169            if(_GSDM.checkError(result, DOC_XML_GET_METADATA_SERVICE))
    170170            {
    171171                return result;
     
    187187    {
    188188      Document result_doc = XMLConverter.newDOM();
    189         Element result = GSXML.createBasicResponse(result_doc, DOC_XML_SET_METADATA);
    190 
    191         if (request == null)
    192         {
    193             GSXML.addError(result, DOC_XML_SET_METADATA + ": Request is null", GSXML.ERROR_TYPE_SYNTAX);
     189        Element result = GSXML.createBasicResponse(result_doc, DOC_XML_SET_METADATA_SERVICE);
     190
     191        if (request == null)
     192        {
     193            GSXML.addError(result, DOC_XML_SET_METADATA_SERVICE + ": Request is null", GSXML.ERROR_TYPE_SYNTAX);
    194194            return result;
    195195        }
     
    236236                catch(Exception ex)
    237237                {
    238                     GSXML.addError(result, DOC_XML_SET_METADATA + ": Error converting the position attribute to an integer", GSXML.ERROR_TYPE_SYNTAX);
     238                    GSXML.addError(result, DOC_XML_SET_METADATA_SERVICE + ": Error converting the position attribute to an integer", GSXML.ERROR_TYPE_SYNTAX);
    239239                    return result;
    240240                }
    241241                _GSDM.documentXMLSetMetadata(oid, collection, metadataName, newMetadataValue, pos, op, userContext);
    242                 if(_GSDM.checkError(result, DOC_XML_SET_METADATA))
     242                if(_GSDM.checkError(result, DOC_XML_SET_METADATA_SERVICE))
    243243                {
    244244                    return result;
     
    249249            {
    250250                _GSDM.documentXMLReplaceMetadata(oid, collection, metadataName, oldMetadataValue, newMetadataValue, userContext);
    251                 if(_GSDM.checkError(result, DOC_XML_SET_METADATA))
     251                if(_GSDM.checkError(result, DOC_XML_SET_METADATA_SERVICE))
    252252                {
    253253                    return result;
     
    256256            else
    257257            {
    258                 GSXML.addError(result, DOC_XML_SET_METADATA + ": A position or previous value was not given", GSXML.ERROR_TYPE_SYNTAX);
     258                GSXML.addError(result, DOC_XML_SET_METADATA_SERVICE + ": A position or previous value was not given", GSXML.ERROR_TYPE_SYNTAX);
    259259                return result;
    260260            }
     
    267267    {
    268268      Document result_doc = XMLConverter.newDOM();
    269         Element result = GSXML.createBasicResponse(result_doc, DOC_XML_CREATE_SECTION);
    270 
    271         if (request == null)
    272         {
    273             GSXML.addError(result, DOC_XML_CREATE_SECTION + ": Request is null", GSXML.ERROR_TYPE_SYNTAX);
     269        Element result = GSXML.createBasicResponse(result_doc, DOC_XML_CREATE_SECTION_SERVICE);
     270
     271        if (request == null)
     272        {
     273            GSXML.addError(result, DOC_XML_CREATE_SECTION_SERVICE + ": Request is null", GSXML.ERROR_TYPE_SYNTAX);
    274274            return result;
    275275        }
     
    286286
    287287            _GSDM.documentXMLCreateSection(oid, collection, userContext);
    288             if(_GSDM.checkError(result, DOC_XML_CREATE_SECTION))
     288            if(_GSDM.checkError(result, DOC_XML_CREATE_SECTION_SERVICE))
    289289            {
    290290                return result;
     
    297297    {
    298298      Document result_doc = XMLConverter.newDOM();
    299         Element result = GSXML.createBasicResponse(result_doc, DOC_XML_DELETE_SECTION);
    300 
    301         if (request == null)
    302         {
    303             GSXML.addError(result, DOC_XML_DELETE_SECTION + ": Request is null", GSXML.ERROR_TYPE_SYNTAX);
     299        Element result = GSXML.createBasicResponse(result_doc, DOC_XML_DELETE_SECTION_SERVICE);
     300
     301        if (request == null)
     302        {
     303            GSXML.addError(result, DOC_XML_DELETE_SECTION_SERVICE + ": Request is null", GSXML.ERROR_TYPE_SYNTAX);
    304304            return result;
    305305        }
     
    316316
    317317            _GSDM.documentXMLDeleteSection(oid, collection, userContext);
    318             if(_GSDM.checkError(result, DOC_XML_DELETE_SECTION))
     318            if(_GSDM.checkError(result, DOC_XML_DELETE_SECTION_SERVICE))
    319319            {
    320320                return result;
     
    327327    {
    328328      Document result_doc = XMLConverter.newDOM();
    329         Element result = GSXML.createBasicResponse(result_doc, DOC_XML_GET_SECTION);
    330 
    331         if (request == null)
    332         {
    333             GSXML.addError(result, DOC_XML_GET_SECTION + ": Request is null", GSXML.ERROR_TYPE_SYNTAX);
     329        Element result = GSXML.createBasicResponse(result_doc, DOC_XML_GET_SECTION_SERVICE);
     330
     331        if (request == null)
     332        {
     333            GSXML.addError(result, DOC_XML_GET_SECTION_SERVICE + ": Request is null", GSXML.ERROR_TYPE_SYNTAX);
    334334            return result;
    335335        }
     
    346346
    347347            Element section = _GSDM.documentXMLGetSection(oid, collection, userContext);
    348             if(_GSDM.checkError(result, DOC_XML_GET_SECTION))
     348            if(_GSDM.checkError(result, DOC_XML_GET_SECTION_SERVICE))
    349349            {
    350350              logger.error("there was an error getting the archive section for " +oid);
     
    359359    {
    360360      Document result_doc = XMLConverter.newDOM();
    361         Element result = GSXML.createBasicResponse(result_doc, DOC_XML_SET_SECTION);
    362 
    363         if (request == null)
    364         {
    365             GSXML.addError(result, DOC_XML_SET_SECTION + ": Request is null", GSXML.ERROR_TYPE_SYNTAX);
     361        Element result = GSXML.createBasicResponse(result_doc, DOC_XML_SET_SECTION_SERVICE);
     362
     363        if (request == null)
     364        {
     365            GSXML.addError(result, DOC_XML_SET_SECTION_SERVICE + ": Request is null", GSXML.ERROR_TYPE_SYNTAX);
    366366            return result;
    367367        }
     
    393393           
    394394            _GSDM.documentXMLSetSection(oid, collection, currentSection, op, userContext);
    395             if(_GSDM.checkError(result, DOC_XML_SET_SECTION))
     395            if(_GSDM.checkError(result, DOC_XML_SET_SECTION_SERVICE))
    396396            {
    397397                return result;
     
    405405    {
    406406      Document result_doc = XMLConverter.newDOM();
    407         Element result = GSXML.createBasicResponse(result_doc, DOC_XML_GET_TEXT);
    408 
    409         if (request == null)
    410         {
    411             GSXML.addError(result, DOC_XML_GET_TEXT + ": Request is null", GSXML.ERROR_TYPE_SYNTAX);
     407        Element result = GSXML.createBasicResponse(result_doc, DOC_XML_GET_TEXT_SERVICE);
     408
     409        if (request == null)
     410        {
     411            GSXML.addError(result, DOC_XML_GET_TEXT_SERVICE + ": Request is null", GSXML.ERROR_TYPE_SYNTAX);
    412412            return result;
    413413        }
     
    424424
    425425            String content = _GSDM.documentXMLGetText(oid, collection, userContext);
    426             if(_GSDM.checkError(result, DOC_XML_GET_TEXT))
     426            if(_GSDM.checkError(result, DOC_XML_GET_TEXT_SERVICE))
    427427            {
    428428                return result;
     
    448448    {
    449449      Document result_doc = XMLConverter.newDOM();
    450         Element result = GSXML.createBasicResponse(result_doc, DOC_XML_SET_TEXT);
    451 
    452         if (request == null)
    453         {
    454             GSXML.addError(result, DOC_XML_SET_TEXT + ": Request is null", GSXML.ERROR_TYPE_SYNTAX);
     450        Element result = GSXML.createBasicResponse(result_doc, DOC_XML_SET_TEXT_SERVICE);
     451
     452        if (request == null)
     453        {
     454            GSXML.addError(result, DOC_XML_SET_TEXT_SERVICE + ": Request is null", GSXML.ERROR_TYPE_SYNTAX);
    455455            return result;
    456456        }
     
    467467
    468468            _GSDM.documentXMLSetText(oid, collection, currentContent, userContext);
    469             if(_GSDM.checkError(result, DOC_XML_SET_TEXT))
     469            if(_GSDM.checkError(result, DOC_XML_SET_TEXT_SERVICE))
    470470            {
    471471                return result;
Note: See TracChangeset for help on using the changeset viewer.