Revision 6078 trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/catalogClient/csw/drivers/CSWMessages.java

View differences:

CSWMessages.java
89 89
            nvp1 = new NameValuePair("request", "getCapabilities");
90 90
        }
91 91
            
92
        NameValuePair nvp2 = new NameValuePair("service", "CSW");
92
        NameValuePair nvp2 = new NameValuePair("service", driver.getService());
93 93
        NameValuePair nvp3 = new NameValuePair("acceptversion", driver.getVersion());
94 94
        return new NameValuePair[] { nvp1, nvp2, nvp3 };
95 95
    } 
......
205 205
 */
206 206
    public String getHTTPPOSTRecords(Query query, int firstRecord) {        
207 207
                      
208
        return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
209
            "<GetRecords " + "service=\"CSW\" " +
210
            "version=\"2.0.0\" " + "xmlns=\"http://www.opengis.net/cat/csw\" " +
208
        StringBuffer answer = new StringBuffer();
209
        	answer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
210
            "<GetRecords " + "service=\"" + driver.getService() + "\" " +
211
            "version=\"" + driver.getVersion() + "\" " + "xmlns=\"http://www.opengis.net/cat/csw\" " +
211 212
            "xmlns:ogc=\"http://www.opengis.net/ogc\" " +
212 213
            "xmlns:gml=\"http://www.opengis.net/gml\" " + "startPosition='" +
213
            firstRecord  + "' " + "maxRecords='10' " +
214
            "outputFormat=\"" + driver.getOutputFormat() + "\" " + 
215
            "outputSchema=\"" + getOutputSchema(driver.getOutputSchema()) + "\" " +
216
            "resultType=\"" +
214
            firstRecord  + "' " + "maxRecords='10' ");
215
            if (driver.getOutputFormat() != null){
216
            	answer.append("outputFormat=\"" + driver.getOutputFormat() + "\" ");
217
            }
218
            if (getOutputSchema(driver.getOutputSchema()) != null){
219
            	answer.append("outputSchema=\"" + getOutputSchema(driver.getOutputSchema()) + "\" ");
220
            }
221
            answer.append("resultType=\"" +
217 222
            getResultType(driver.getResultType()) + "\">" +
218
            "<Query typeNames=\"" +
219
            Strings.getBlankSeparated(driver.getTypeNames()) + "\">" +
223
            "<Query ");
224
            if (driver.getTypeNames() != null){
225
            	answer.append("typeNames=\"" +
226
            			Strings.getBlankSeparated(driver.getTypeNames()) + "\"");
227
            }
228
            answer.append(">" +
220 229
            getElementSetNameLabel() + 
221
            getMaxSetName(driver.getElementSetName()) + "</ElementSetName>" +
222
            "<Constraint version='1.0.20'>" +
223
            new CSWFilter().getQuery(query,driver.getServerProfile()) +
230
            getMaxSetName(driver.getElementSetName()) + "</ElementSetName>");
231
            if ((driver.getService().equals("CSW"))){
232
            	answer.append("<Constraint version='1.0.20'>");
233
            }else{
234
            	answer.append("<Constraint version='1.1.0'>");
235
            }
236
            answer.append(new CSWFilter().getQuery(query,driver.getServerProfile()) +
224 237
            "</Constraint>" +
225 238
            "</Query>" +
226
            "</GetRecords>";
239
            "</GetRecords>");
240
            return answer.toString();
227 241
    } 
228 242

  
229 243
/**
......
291 305
 * @param outputSchemas 
292 306
 */
293 307
    private String getOutputSchema(String[] outputSchemas) {        
294
        for (int i=0 ; i<outputSchemas.length ; i++){
308
        if (outputSchemas == null){
309
        	return null;
310
        }
311
    	for (int i=0 ; i<outputSchemas.length ; i++){
295 312
            if (outputSchemas[i].equals(Schemas.ISO19115))
296 313
                return outputSchemas[i];
297 314
        }        

Also available in: Unified diff