Changeset 1802 for MDService2


Ignore:
Timestamp:
03/19/12 10:46:36 (12 years ago)
Author:
gaba
Message:

corrections

Location:
MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/action/FCSAction.java

    r1801 r1802  
    7878        @Override
    7979        public String getRepository() {
    80                 return getParam("x-content");
     80                //return getParam("x-content");
     81                if (WorkspaceProfile.getFCSMapping(params.get("x-context")[0]) == null){
     82                                        return getParam("x-context");
     83                                } else {
     84                                        return WorkspaceProfile.getFCSMapping(params.get("x-context")[0]);
     85                                }
    8186        }
    82         */
     87*/
    8388         
    8489        /**
     
    128133                // set defaults
    129134               
    130                 if ( params.get("version") == null){
    131                         addParam("version","1.2");
    132                 }
    133                 /*
    134                 if ( params.get("operation") == null){
    135                         addParam("operation","searchRetrieve");
    136                 }
    137                 //q=query                       
    138                 if (getQ() != null) {
    139                         addParam("q",getQ());
    140                         addParam("query",getQ());
    141                 } else {
    142                         addParam("q",this.getParam("query"));
    143                 }
     135                if  (params.get("repository") == null){
     136                        if (params.get("x-context") == null){
     137                                addParam("repository",WorkspaceProfile.getRepositoryByIndex(0));
     138                        } else {
     139                                // search in fcs-mapping
     140                                if (WorkspaceProfile.getFCSMapping(params.get("x-context")[0]) == null){
     141                                        addParam("repository",params.get("x-context")[0]);
     142                                } else {
     143                                        addParam("repository",WorkspaceProfile.getFCSMapping(params.get("x-context")[0]));
     144                                }
     145                        }       
     146                }       
    144147               
    145                 if ( params.get("startRecord") == null){
    146                         addParam("startRecord","1");
    147                 }
    148                 if ( params.get("maximumRecords") == null){
    149                         addParam("maximumRecords","10");
    150                 }
    151                
    152                 if ( params.get("x-cmd-maxdepth") == null){
    153                         if (params.get("maxdepth") == null){
    154                                 addParam("maxdepth","2");
    155                         }
    156                 } else {
    157                         addParam("maxdepth",params.get("x-cmd-maxdepth")[0]);
    158                 }
    159                 */
    160                 if ( params.get("x-cmd-repository") == null){
    161                         if (params.get("repository") == null){
    162                                 if (params.get("x-context") == null){
    163                                         addParam("repository",WorkspaceProfile.getRepositoryByIndex(0));
    164                                 } else {
    165                                         // search in fcs-mapping
    166                                         if (WorkspaceProfile.getFCSMapping(params.get("x-context")[0]) == null){
    167                                                 addParam("repository",params.get("x-context")[0]);
    168                                         } else {
    169                                                 addParam("repository",WorkspaceProfile.getFCSMapping(params.get("x-context")[0]));
    170                                         }
    171                                         //addParam("repository",params.get("x-context")[0]);
    172                                 }
    173                         }
    174                 } else {
    175                         addParam("repository",params.get("x-cmd-repository")[0]);
    176                 }
    177                 /*
    178                 if ( params.get("x-cmd-cache") == null){
    179                         if (params.get("cache") == null){
    180                                 addParam("cache",Cache.SKIP);
    181                         }
    182                 } else {
    183                         addParam("cache",params.get("x-cmd-cache")[0]);
    184                 }
    185                
    186                 if ( params.get("x-cmd-lang") == null){
    187                         if (params.get("lang") == null){
    188                                 addParam("lang","en");
    189                         }
    190                 } else {
    191                         addParam("lang",params.get("x-cmd-lang")[0]);
    192                 }
    193                 */
    194                 if ( params.get("x-cmd-format") == null){
    195                         if (params.get("format") == null){
    196                                 if (this.getParam("format") == null) {
    197                                         addParam("format","xml");
    198                                 } else if (this.getParam("format").equals("")){
    199                                         addParam("format","xml");
    200                                 } else {
    201                                         addParam("format",this.getParam("format"));
    202                                 }
    203                         }
    204                 } else {
    205                         addParam("format",params.get("x-cmd-format")[0]);
    206                 }
    207 
    208                 addParam("fullformat",getFullFormat());
    209148        }
    210149        @Override
  • MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/proxy/FCSProxy.java

    r1801 r1802  
    3030        }
    3131       
     32        @Override
     33        public void checkParams() {
     34                // required Params
     35                // check and set defaults
     36                if (getParam("operation").equals("")) {
     37                        //getSourceAction().setParam("operation","searchRetrieve");
     38                        getSourceAction().getDiagnostics().Add(Diagnostic.MANDATORY_NOTSUPPLIED, "operation");
     39                }
     40               
     41                if (getParam("query").equals("") && getParam("operation").equals("searchRetrieve")) {
     42                        getSourceAction().getDiagnostics().Add(Diagnostic.MANDATORY_NOTSUPPLIED, "query");
     43                }
     44                if (getParam("scanClause").equals("") && getParam("operation").equals("scan")) {
     45                        getSourceAction().getDiagnostics().Add(Diagnostic.MANDATORY_NOTSUPPLIED, "scan");
     46                }
     47
     48
     49        }
    3250       
    3351}
Note: See TracChangeset for help on using the changeset viewer.