private void encodeRecords(final CSWRecordsResult response) { // encode the records if(response.getRecords() != null) { try { response.getRecords().accepts(new FeatureVisitor() { @Override public void visit(Feature feature) { encode(response, feature); } }, new LoggingProgressListener()); } catch (IOException e) { throw new ServiceException("Failed to encoder records", e); } } }
private void encodeRecords(final CSWRecordsResult response) { // encode the records if (response.getRecords() != null) { try { response.getRecords() .accepts( new FeatureVisitor() { @Override public void visit(Feature feature) { encode(response, feature); } }, new LoggingProgressListener()); } catch (IOException e) { throw new ServiceException("Failed to encoder records", e); } } }
@Override public void write(Object value, OutputStream output, Operation operation) throws IOException, ServiceException { CSWRecordsResult result = (CSWRecordsResult) value; RequestBaseType request = (RequestBaseType) operation.getParameters()[0]; CSWInfo csw = gs.getService(CSWInfo.class); // check the output schema is valid if (result.getRecords() != null) { FeatureType recordSchema = result.getRecords().getSchema(); if (recordSchema != null && !recordType.equals(recordSchema)) { throw new IllegalArgumentException("Cannot encode this kind of record " + recordSchema.getName() + " into schema " + schema); } } if (getResultType(request) == ResultType.VALIDATE) { // this one is output schema independent transformAcknowledgement(output, request, csw); } else { transformResponse(output, result, request, csw); } }
@Override public void write(Object value, OutputStream output, Operation operation) throws IOException, ServiceException { CSWRecordsResult result = (CSWRecordsResult) value; RequestBaseType request = (RequestBaseType) operation.getParameters()[0]; CSWInfo csw = gs.getService(CSWInfo.class); // check the output schema is valid if (result.getRecords() != null) { FeatureType recordSchema = result.getRecords().getSchema(); if (recordSchema != null && !recordType.equals(recordSchema)) { throw new IllegalArgumentException( "Cannot encode this kind of record " + recordSchema.getName() + " into schema " + schema); } } if (getResultType(request) == ResultType.VALIDATE) { // this one is output schema independent transformAcknowledgement(output, request, csw); } else { transformResponse(output, result, request, csw); } }