Revision 6078

View differences:

trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/catalogClient/csw/drivers/CSWCatalogServiceDriver.java
63 63
 * @see http://portal.opengeospatial.org/files/?artifact_id=5929&version=1
64 64
 */
65 65
public class CSWCatalogServiceDriver extends AbstractCatalogServiceDriver {
66

  
66
private String service = "CSW";
67 67
/**
68 68
 * 
69 69
 * 
......
214 214
        	return null;
215 215
      
216 216
        if (getServerProfile().equals(Schemas.ISO19115)){
217
            firstRecord = firstRecord - 1;
217
        	 if (getService().equals("CSW")){
218
        		 firstRecord = firstRecord - 1;
219
        	 }
218 220
        }
221
    
219 222
        
220 223
        for (int i=0 ; i<getOperations().getGetRecords().length; i++){
221 224
            /*
......
357 360
        }
358 361
        if (auxNodes.length == 0) {
359 362
            auxNodes = XMLTree.searchMultipleNode(node,
363
                    "csw:SearchResults->csw:SummaryRecord");
364
        }
365
        
366
        if (auxNodes.length == 0) {
367
            auxNodes = XMLTree.searchMultipleNode(node,
360 368
                    "SearchResults->wrs:WRSExtrinsicObject");
361 369
        }
362 370
        
......
641 649
    public String getQueryProfile() {        
642 650
        // TODO Auto-generated method stub
643 651
        return getServerProfile();
644
    } 
652
    }
653

  
654
public String getService() {
655
	return service;
656
}
657

  
658
public void setService(String service) {
659
	this.service = service;
660
} 
645 661
 }
trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/catalogClient/csw/drivers/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