Search in sources :

Example 16 with RecordType

use of org.openarchives.oai._2.RecordType in project mod-oai-pmh by folio-org.

the class MarcWithHoldingsRequestHelper method buildRecordsResponse.

private Future<Response> buildRecordsResponse(Request request, String requestId, List<JsonObject> batch, Map<String, JsonObject> srsResponse, boolean firstBatch, String nextInstanceId, boolean deletedRecordSupport) {
    Promise<Response> promise = Promise.promise();
    try {
        List<RecordType> records = buildRecordsList(request, batch, srsResponse, deletedRecordSupport);
        logger.debug("Build records response, instances = {}, instances with srs records = {}.", batch.size(), records.size());
        ResponseHelper responseHelper = getResponseHelper();
        OAIPMH oaipmh = responseHelper.buildBaseOaipmhResponse(request);
        if (records.isEmpty() && nextInstanceId == null && firstBatch) {
            oaipmh.withErrors(createNoRecordsFoundError());
        } else {
            oaipmh.withListRecords(new ListRecordsType().withRecords(records));
        }
        Response response;
        if (oaipmh.getErrors().isEmpty()) {
            if (!firstBatch || nextInstanceId != null) {
                ResumptionTokenType resumptionToken = buildResumptionTokenFromRequest(request, requestId, records.size(), nextInstanceId);
                oaipmh.getListRecords().withResumptionToken(resumptionToken);
            }
            response = responseHelper.buildSuccessResponse(oaipmh);
        } else {
            response = responseHelper.buildFailureResponse(oaipmh, request);
        }
        promise.complete(response);
    } catch (Exception e) {
        handleException(promise, e);
    }
    return promise.future();
}
Also used : Response(javax.ws.rs.core.Response) HttpResponse(io.vertx.ext.web.client.HttpResponse) OAIPMH(org.openarchives.oai._2.OAIPMH) ResumptionTokenType(org.openarchives.oai._2.ResumptionTokenType) RecordType(org.openarchives.oai._2.RecordType) ResponseHelper(org.folio.oaipmh.helpers.response.ResponseHelper) DecodeException(io.vertx.core.json.DecodeException) ListRecordsType(org.openarchives.oai._2.ListRecordsType)

Example 17 with RecordType

use of org.openarchives.oai._2.RecordType in project mod-oai-pmh by folio-org.

the class MarcWithHoldingsRequestHelper method buildRecordsList.

private List<RecordType> buildRecordsList(Request request, List<JsonObject> batch, Map<String, JsonObject> srsResponse, boolean deletedRecordSupport) {
    RecordMetadataManager metadataManager = RecordMetadataManager.getInstance();
    final boolean suppressedRecordsProcessing = getBooleanProperty(request.getRequestId(), REPOSITORY_SUPPRESSED_RECORDS_PROCESSING);
    List<RecordType> records = new ArrayList<>();
    batch.stream().filter(instance -> {
        final String instanceId = instance.getString(INSTANCE_ID_FIELD_NAME);
        final JsonObject srsInstance = srsResponse.get(instanceId);
        return Objects.nonNull(srsInstance);
    }).forEach(instance -> {
        final String instanceId = instance.getString(INSTANCE_ID_FIELD_NAME);
        final JsonObject srsInstance = srsResponse.get(instanceId);
        RecordType record = createRecord(request, srsInstance, instanceId);
        JsonObject updatedSrsWithItemsData = metadataManager.populateMetadataWithItemsData(srsInstance, instance, suppressedRecordsProcessing);
        JsonObject updatedSrsInstance = metadataManager.populateMetadataWithHoldingsData(updatedSrsWithItemsData, instance, suppressedRecordsProcessing);
        if (deletedRecordSupport && storageHelper.isRecordMarkAsDeleted(updatedSrsInstance)) {
            record.getHeader().setStatus(StatusType.DELETED);
        }
        String source = storageHelper.getInstanceRecordSource(updatedSrsInstance);
        if (source != null && record.getHeader().getStatus() == null) {
            if (suppressedRecordsProcessing) {
                source = metadataManager.updateMetadataSourceWithDiscoverySuppressedData(source, updatedSrsInstance);
                source = metadataManager.updateElectronicAccessFieldWithDiscoverySuppressedData(source, updatedSrsInstance);
            }
            try {
                record.withMetadata(buildOaiMetadata(request, source));
            } catch (Exception e) {
                logger.error("Error occurred while converting record to xml representation: {}.", e.getMessage(), e);
                logger.debug("Skipping problematic record due the conversion error. Source record id - {}.", storageHelper.getRecordId(srsInstance));
                return;
            }
        }
        if (filterInstance(request, srsInstance)) {
            records.add(record);
        }
    });
    return records;
}
Also used : CONTENT_TYPE(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE) OFFSET_PARAM(org.folio.oaipmh.Constants.OFFSET_PARAM) DecodeException(io.vertx.core.json.DecodeException) Date(java.util.Date) NEXT_INSTANCE_PK_VALUE(org.folio.oaipmh.Constants.NEXT_INSTANCE_PK_VALUE) StatusType(org.openarchives.oai._2.StatusType) Autowired(org.springframework.beans.factory.annotation.Autowired) NEXT_RECORD_ID_PARAM(org.folio.oaipmh.Constants.NEXT_RECORD_ID_PARAM) SEND_REQUEST(org.folio.oaipmh.service.MetricsCollectingService.MetricOperation.SEND_REQUEST) RESUMPTION_TOKEN_TIMEOUT(org.folio.oaipmh.Constants.RESUMPTION_TOKEN_TIMEOUT) Context(io.vertx.core.Context) WorkerExecutor(io.vertx.core.WorkerExecutor) Tuple(io.vertx.sqlclient.Tuple) OAIPMHerrorType(org.openarchives.oai._2.OAIPMHerrorType) ResumptionTokenType(org.openarchives.oai._2.ResumptionTokenType) Request(org.folio.oaipmh.Request) NAME(org.folio.oaipmh.helpers.records.RecordMetadataManager.NAME) OAIPMH(org.openarchives.oai._2.OAIPMH) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Map(java.util.Map) JsonObject(io.vertx.core.json.JsonObject) BigInteger(java.math.BigInteger) APPLICATION_JSON(javax.ws.rs.core.MediaType.APPLICATION_JSON) AbstractHelper(org.folio.oaipmh.helpers.AbstractHelper) UNTIL_PARAM(org.folio.oaipmh.Constants.UNTIL_PARAM) EXPIRATION_DATE_RESUMPTION_TOKEN_PARAM(org.folio.oaipmh.Constants.EXPIRATION_DATE_RESUMPTION_TOKEN_PARAM) OKAPI_TENANT(org.folio.oaipmh.Constants.OKAPI_TENANT) InstancesService(org.folio.oaipmh.service.InstancesService) ITEMS(org.folio.oaipmh.helpers.records.RecordMetadataManager.ITEMS) MetricsCollectingService(org.folio.oaipmh.service.MetricsCollectingService) UUID(java.util.UUID) ITEMS_AND_HOLDINGS_FIELDS(org.folio.oaipmh.helpers.records.RecordMetadataManager.ITEMS_AND_HOLDINGS_FIELDS) Instant(java.time.Instant) Future(io.vertx.core.Future) TenantTool(org.folio.rest.tools.utils.TenantTool) Collectors(java.util.stream.Collectors) PostgresClient(org.folio.rest.persist.PostgresClient) ZoneId(java.time.ZoneId) String.format(java.lang.String.format) RepositoryConfigurationUtil(org.folio.oaipmh.helpers.RepositoryConfigurationUtil) REQUEST_ID_PARAM(org.folio.oaipmh.Constants.REQUEST_ID_PARAM) CALL_NUMBER(org.folio.oaipmh.helpers.records.RecordMetadataManager.CALL_NUMBER) Objects(java.util.Objects) List(java.util.List) Logger(org.apache.logging.log4j.Logger) OffsetDateTime(java.time.OffsetDateTime) Buffer(io.vertx.core.buffer.Buffer) Response(javax.ws.rs.core.Response) WebClientProvider(org.folio.oaipmh.WebClientProvider) RETRY_ATTEMPTS(org.folio.oaipmh.Constants.RETRY_ATTEMPTS) STATUS_MESSAGE(org.folio.oaipmh.Constants.STATUS_MESSAGE) ChronoField(java.time.temporal.ChronoField) HttpResponse(io.vertx.ext.web.client.HttpResponse) SourceStorageSourceRecordsClientWrapper(org.folio.oaipmh.service.SourceStorageSourceRecordsClientWrapper) RequestMetadataLb(org.folio.rest.jooq.tables.pojos.RequestMetadataLb) BodyCodec(io.vertx.ext.web.codec.BodyCodec) INSTANCES_PROCESSING(org.folio.oaipmh.service.MetricsCollectingService.MetricOperation.INSTANCES_PROCESSING) HashMap(java.util.HashMap) OKAPI_TOKEN(org.folio.oaipmh.Constants.OKAPI_TOKEN) REPOSITORY_MAX_RECORDS_PER_RESPONSE(org.folio.oaipmh.Constants.REPOSITORY_MAX_RECORDS_PER_RESPONSE) JsonEvent(io.vertx.core.parsetools.JsonEvent) CollectionUtils(org.apache.commons.collections4.CollectionUtils) SpringContextUtil(org.folio.spring.SpringContextUtil) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) RepositoryConfigurationUtil.getBooleanProperty(org.folio.oaipmh.helpers.RepositoryConfigurationUtil.getBooleanProperty) HttpRequestImpl(io.vertx.ext.web.client.impl.HttpRequestImpl) AsyncResult(io.vertx.core.AsyncResult) STATUS_CODE(org.folio.oaipmh.Constants.STATUS_CODE) Promise(io.vertx.core.Promise) Vertx(io.vertx.core.Vertx) Instances(org.folio.rest.jooq.tables.pojos.Instances) RecordMetadataManager(org.folio.oaipmh.helpers.records.RecordMetadataManager) Maps(com.google.common.collect.Maps) HttpRequest(io.vertx.ext.web.client.HttpRequest) JsonArray(io.vertx.core.json.JsonArray) ResponseHelper(org.folio.oaipmh.helpers.response.ResponseHelper) PgConnection(io.vertx.pgclient.PgConnection) Collectors.toList(java.util.stream.Collectors.toList) RecordType(org.openarchives.oai._2.RecordType) REPOSITORY_SRS_HTTP_REQUEST_RETRY_ATTEMPTS(org.folio.oaipmh.Constants.REPOSITORY_SRS_HTTP_REQUEST_RETRY_ATTEMPTS) ACCEPT(javax.ws.rs.core.HttpHeaders.ACCEPT) LOCATION(org.folio.oaipmh.Constants.LOCATION) REPOSITORY_SUPPRESSED_RECORDS_PROCESSING(org.folio.oaipmh.Constants.REPOSITORY_SUPPRESSED_RECORDS_PROCESSING) ListRecordsType(org.openarchives.oai._2.ListRecordsType) Handler(io.vertx.core.Handler) LogManager(org.apache.logging.log4j.LogManager) Collections(java.util.Collections) RecordType(org.openarchives.oai._2.RecordType) RecordMetadataManager(org.folio.oaipmh.helpers.records.RecordMetadataManager) ArrayList(java.util.ArrayList) JsonObject(io.vertx.core.json.JsonObject) DecodeException(io.vertx.core.json.DecodeException)

Example 18 with RecordType

use of org.openarchives.oai._2.RecordType in project ARLAS-server by gisaia.

the class RecordBuilder method addBbox.

public static void addBbox(AbstractRecordType abstractRecordType, DublinCoreElementName.Bbox bbox) {
    WGS84BoundingBoxType boudingBox = new WGS84BoundingBoxType();
    boudingBox.getLowerCorner().add(String.valueOf(bbox.west));
    boudingBox.getLowerCorner().add(String.valueOf(bbox.south));
    boudingBox.getUpperCorner().add(String.valueOf(bbox.east));
    boudingBox.getUpperCorner().add(String.valueOf(bbox.north));
    JAXBElement<WGS84BoundingBoxType> JAXBElementBbox = owsObjectFactory.createWGS84BoundingBox(boudingBox);
    switch(abstractRecordType.getClass().getSimpleName()) {
        case "BriefRecordType":
            ((BriefRecordType) abstractRecordType).getBoundingBox().add(JAXBElementBbox);
            break;
        case "SummaryRecordType":
            ((SummaryRecordType) abstractRecordType).getBoundingBox().add(JAXBElementBbox);
            break;
        case "RecordType":
            ((RecordType) abstractRecordType).getBoundingBox().add(JAXBElementBbox);
            break;
    }
}
Also used : WGS84BoundingBoxType(net.opengis.ows._2.WGS84BoundingBoxType)

Example 19 with RecordType

use of org.openarchives.oai._2.RecordType in project geotoolkit by Geomatys.

the class CswXMLBindingTest method getRecordByIdResponseUnMarshalingTest.

/**
 * Test getRecordById request Marshalling.
 */
@Test
public void getRecordByIdResponseUnMarshalingTest() throws JAXBException {
    Unmarshaller unmarshaller = pool.acquireUnmarshaller();
    /*
         * Test marshalling csw getRecordByIdResponse v2.0.2
         */
    SimpleLiteral id = new SimpleLiteral("{8C71082D-5B3B-5F9D-FC40-F7807C8AB645}");
    SimpleLiteral title = new SimpleLiteral("(JASON-1)");
    SimpleLiteral type = new SimpleLiteral("clearinghouse");
    List<SimpleLiteral> subject = new ArrayList<>();
    subject.add(new SimpleLiteral("oceans elevation NASA/JPL/JASON-1"));
    subject.add(new SimpleLiteral("oceans elevation 2"));
    SimpleLiteral modified = new SimpleLiteral("2007-11-15 21:26:49");
    SimpleLiteral Abstract = new SimpleLiteral("Jason-1 is the first follow-on to the highly successful TOPEX/Poseidonmission that measured ocean surface topography to an accuracy of 4.2cm.");
    SimpleLiteral references = new SimpleLiteral("http://keel.esri.com/output/TOOLKIT_Browse_Metadata_P7540_T8020_D1098.xml");
    SimpleLiteral spatial = new SimpleLiteral("northlimit=65.9999999720603; eastlimit=180; southlimit=-66.0000000558794; westlimit=-180;");
    List<BoundingBoxType> bbox = new ArrayList<>();
    bbox.add(new WGS84BoundingBoxType(180, -66.0000000558794, -180, 65.9999999720603));
    RecordType record = new RecordType(id, title, type, subject, null, modified, null, Abstract, bbox, null, null, null, spatial, references);
    BriefRecordType briefRecord = new BriefRecordType(id, title, type, bbox);
    SummaryRecordType sumRecord = new SummaryRecordType(id, title, type, bbox, subject, null, modified, Abstract);
    List<AbstractRecordType> records = new ArrayList<>();
    records.add(record);
    records.add(briefRecord);
    records.add(sumRecord);
    GetRecordByIdResponse expResult = new GetRecordByIdResponseType(records);
    String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<csw:GetRecordByIdResponse xmlns:ows=\"http://www.opengis.net/ows\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:csw=\"http://www.opengis.net/cat/csw/2.0.2\" xmlns:dct=\"http://purl.org/dc/terms/\">\n" + "  <csw:Record>\n" + "    <dc:identifier>{8C71082D-5B3B-5F9D-FC40-F7807C8AB645}</dc:identifier>\n" + "    <dc:title>(JASON-1)</dc:title>\n" + "    <dc:type>clearinghouse</dc:type>\n" + "    <dc:subject>oceans elevation NASA/JPL/JASON-1</dc:subject>\n" + "    <dc:subject>oceans elevation 2</dc:subject>\n" + "    <dct:modified>2007-11-15 21:26:49</dct:modified>\n" + "    <dct:abstract>Jason-1 is the first follow-on to the highly successful TOPEX/Poseidonmission that measured ocean surface topography to an accuracy of 4.2cm.</dct:abstract>\n" + "    <dct:references>http://keel.esri.com/output/TOOLKIT_Browse_Metadata_P7540_T8020_D1098.xml</dct:references>\n" + "    <dct:spatial>northlimit=65.9999999720603; eastlimit=180; southlimit=-66.0000000558794; westlimit=-180;</dct:spatial>\n" + "    <ows:WGS84BoundingBox dimensions=\"2\">\n" + "      <ows:LowerCorner>180.0 -66.0000000558794</ows:LowerCorner>\n" + "      <ows:UpperCorner>-180.0 65.9999999720603</ows:UpperCorner>\n" + "    </ows:WGS84BoundingBox>\n" + "  </csw:Record>\n" + "  <csw:BriefRecord>\n" + "    <dc:identifier>{8C71082D-5B3B-5F9D-FC40-F7807C8AB645}</dc:identifier>\n" + "    <dc:title>(JASON-1)</dc:title>\n" + "    <dc:type>clearinghouse</dc:type>\n" + "    <ows:WGS84BoundingBox dimensions=\"2\">\n" + "      <ows:LowerCorner>180.0 -66.0000000558794</ows:LowerCorner>\n" + "      <ows:UpperCorner>-180.0 65.9999999720603</ows:UpperCorner>\n" + "    </ows:WGS84BoundingBox>\n" + "  </csw:BriefRecord>\n" + "  <csw:SummaryRecord>\n" + "    <dc:identifier>{8C71082D-5B3B-5F9D-FC40-F7807C8AB645}</dc:identifier>\n" + "    <dc:title>(JASON-1)</dc:title>\n" + "    <dc:type>clearinghouse</dc:type>\n" + "    <dc:subject>oceans elevation NASA/JPL/JASON-1</dc:subject>\n" + "    <dc:subject>oceans elevation 2</dc:subject>\n" + "    <dct:modified>2007-11-15 21:26:49</dct:modified>\n" + "    <dct:abstract>Jason-1 is the first follow-on to the highly successful TOPEX/Poseidonmission that measured ocean surface topography to an accuracy of 4.2cm.</dct:abstract>\n" + "    <ows:WGS84BoundingBox dimensions=\"2\">\n" + "      <ows:LowerCorner>180.0 -66.0000000558794</ows:LowerCorner>\n" + "      <ows:UpperCorner>-180.0 65.9999999720603</ows:UpperCorner>\n" + "    </ows:WGS84BoundingBox>\n" + "  </csw:SummaryRecord>\n" + "</csw:GetRecordByIdResponse>\n";
    GetRecordByIdResponse result = ((JAXBElement<GetRecordByIdResponse>) unmarshaller.unmarshal(new StringReader(xml))).getValue();
    assertTrue(result.getAny() instanceof List);
    List<Object> resultList = result.getAny();
    List<Object> expResultList = expResult.getAny();
    assertEquals(resultList.get(0), expResultList.get(0));
    assertEquals(resultList.get(1), expResultList.get(1));
    assertEquals(resultList.get(2), expResultList.get(2));
    assertEquals(resultList, expResultList);
    assertEquals(expResult.getAny(), result.getAny());
    assertEquals(expResult, result);
    pool.recycle(unmarshaller);
}
Also used : SummaryRecordType(org.geotoolkit.csw.xml.v202.SummaryRecordType) WGS84BoundingBoxType(org.geotoolkit.ows.xml.v100.WGS84BoundingBoxType) ArrayList(java.util.ArrayList) JAXBElement(javax.xml.bind.JAXBElement) AbstractRecordType(org.geotoolkit.csw.xml.v202.AbstractRecordType) BriefRecordType(org.geotoolkit.csw.xml.v202.BriefRecordType) BoundingBoxType(org.geotoolkit.ows.xml.v100.BoundingBoxType) WGS84BoundingBoxType(org.geotoolkit.ows.xml.v100.WGS84BoundingBoxType) GetRecordByIdResponseType(org.geotoolkit.csw.xml.v202.GetRecordByIdResponseType) AbstractRecordType(org.geotoolkit.csw.xml.v202.AbstractRecordType) BriefRecordType(org.geotoolkit.csw.xml.v202.BriefRecordType) SummaryRecordType(org.geotoolkit.csw.xml.v202.SummaryRecordType) RecordType(org.geotoolkit.csw.xml.v202.RecordType) StringReader(java.io.StringReader) SimpleLiteral(org.geotoolkit.dublincore.xml.v2.elements.SimpleLiteral) List(java.util.List) ArrayList(java.util.ArrayList) Unmarshaller(javax.xml.bind.Unmarshaller) Test(org.junit.Test)

Example 20 with RecordType

use of org.openarchives.oai._2.RecordType in project geotoolkit by Geomatys.

the class CswXMLBindingTest method updateMarshalingTest.

/**
 * Test simple Record Marshalling.
 */
@Test
public void updateMarshalingTest() throws JAXBException, IOException, ParserConfigurationException, SAXException {
    Marshaller marshaller = pool.acquireMarshaller();
    // <TODO
    SimpleLiteral id = new SimpleLiteral("{8C71082D-5B3B-5F9D-FC40-F7807C8AB645}");
    SimpleLiteral title = new SimpleLiteral("(JASON-1)");
    SimpleLiteral type = new SimpleLiteral("clearinghouse");
    List<SimpleLiteral> subject = new ArrayList<>();
    subject.add(new SimpleLiteral("oceans elevation NASA/JPL/JASON-1"));
    subject.add(new SimpleLiteral("oceans elevation 2"));
    SimpleLiteral modified = new SimpleLiteral("2007-11-15 21:26:49");
    SimpleLiteral Abstract = new SimpleLiteral("Jason-1 is the first follow-on to the highly successful TOPEX/Poseidonmission that measured ocean surface topography to an accuracy of 4.2cm.");
    SimpleLiteral references = new SimpleLiteral("http://keel.esri.com/output/TOOLKIT_Browse_Metadata_P7540_T8020_D1098.xml");
    SimpleLiteral spatial = new SimpleLiteral("northlimit=65.9999999720603; eastlimit=180; southlimit=-66.0000000558794; westlimit=-180;");
    List<BoundingBoxType> bbox = new ArrayList<>();
    bbox.add(new WGS84BoundingBoxType(180, -66.0000000558794, -180, 65.9999999720603));
    RecordType record = new RecordType(id, title, type, subject, null, modified, null, Abstract, bbox, null, null, null, spatial, references);
    QueryConstraintType query = new QueryConstraintType("identifier='{8C71082D-5B3B-5F9D-FC40-F7807C8AB645}'", "1.1.0");
    UpdateType update = new UpdateType(record, query);
    TransactionType request = new TransactionType("CSW", "2.0.2", update);
    // marshaller.marshal(request, System.out);
    // TODO/>
    /*
         * Test 2 : Simple recordProperty (String)
         */
    RecordPropertyType recordProperty = new RecordPropertyType("/csw:Record/dc:contributor", "Jane");
    query = new QueryConstraintType("identifier='{8C71082D-5B3B-5F9D-FC40-F7807C8AB645}'", "1.1.0");
    update = new UpdateType(Arrays.asList(recordProperty), query);
    request = new TransactionType("CSW", "2.0.2", update);
    String expResult = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<csw:Transaction verboseResponse=\"false\" version=\"2.0.2\" service=\"CSW\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:csw=\"http://www.opengis.net/cat/csw/2.0.2\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n" + "  <csw:Update>\n" + "    <csw:RecordProperty>\n" + "      <csw:Name>/csw:Record/dc:contributor</csw:Name>\n" + "      <csw:Value>Jane</csw:Value>\n" + "    </csw:RecordProperty>\n" + "    <csw:Constraint version=\"1.1.0\">\n" + "      <csw:CqlText>identifier='{8C71082D-5B3B-5F9D-FC40-F7807C8AB645}'</csw:CqlText>\n" + "    </csw:Constraint>\n" + "  </csw:Update>\n" + "</csw:Transaction>\n";
    StringWriter sw = new StringWriter();
    marshaller.marshal(request, sw);
    String result = sw.toString();
    assertXmlEquals(expResult, result, "xmlns:*");
    /*
         * Test 3 : Complex recordProperty (GeographicBoundingBox)
         */
    DefaultGeographicBoundingBox geographicElement = new DefaultGeographicBoundingBox(1.1, 1.1, 1.1, 1.1);
    recordProperty = new RecordPropertyType("/gmd:MD_Metadata/identificationInfo/extent/geographicElement", geographicElement);
    query = new QueryConstraintType("identifier='{8C71082D-5B3B-5F9D-FC40-F7807C8AB645}'", "1.1.0");
    update = new UpdateType(Arrays.asList(recordProperty), query);
    request = new TransactionType("CSW", "2.0.2", update);
    expResult = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<csw:Transaction verboseResponse=\"false\" version=\"2.0.2\" service=\"CSW\" xmlns:csw=\"http://www.opengis.net/cat/csw/2.0.2\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:gmd=\"http://www.isotc211.org/2005/gmd\" xmlns:gco=\"http://www.isotc211.org/2005/gco\">\n" + "  <csw:Update>\n" + "    <csw:RecordProperty>\n" + "      <csw:Name>/gmd:MD_Metadata/identificationInfo/extent/geographicElement</csw:Name>\n" + "      <csw:Value>\n" + "       <gmd:EX_GeographicBoundingBox>" + '\n' + "        <gmd:extentTypeCode>\n" + "          <gco:Boolean>true</gco:Boolean>\n" + "        </gmd:extentTypeCode>\n" + "        <gmd:westBoundLongitude>\n" + "          <gco:Decimal>1.1</gco:Decimal>\n" + "        </gmd:westBoundLongitude>\n" + "        <gmd:eastBoundLongitude>\n" + "          <gco:Decimal>1.1</gco:Decimal>\n" + "        </gmd:eastBoundLongitude>\n" + "        <gmd:southBoundLatitude>\n" + "          <gco:Decimal>1.1</gco:Decimal>\n" + "        </gmd:southBoundLatitude>\n" + "        <gmd:northBoundLatitude>\n" + "          <gco:Decimal>1.1</gco:Decimal>\n" + "        </gmd:northBoundLatitude>\n" + "       </gmd:EX_GeographicBoundingBox>" + '\n' + "      </csw:Value>\n" + "    </csw:RecordProperty>\n" + "    <csw:Constraint version=\"1.1.0\">\n" + "      <csw:CqlText>identifier='{8C71082D-5B3B-5F9D-FC40-F7807C8AB645}'</csw:CqlText>\n" + "    </csw:Constraint>\n" + "  </csw:Update>\n" + "</csw:Transaction>\n";
    sw = new StringWriter();
    marshaller.marshal(request, sw);
    result = sw.toString();
    assertXmlEquals(expResult, result, "xmlns:*");
    pool.recycle(marshaller);
}
Also used : RecordPropertyType(org.geotoolkit.csw.xml.v202.RecordPropertyType) Marshaller(javax.xml.bind.Marshaller) TransactionType(org.geotoolkit.csw.xml.v202.TransactionType) WGS84BoundingBoxType(org.geotoolkit.ows.xml.v100.WGS84BoundingBoxType) ArrayList(java.util.ArrayList) UpdateType(org.geotoolkit.csw.xml.v202.UpdateType) QueryConstraintType(org.geotoolkit.csw.xml.v202.QueryConstraintType) BoundingBoxType(org.geotoolkit.ows.xml.v100.BoundingBoxType) WGS84BoundingBoxType(org.geotoolkit.ows.xml.v100.WGS84BoundingBoxType) DefaultGeographicBoundingBox(org.apache.sis.metadata.iso.extent.DefaultGeographicBoundingBox) AbstractRecordType(org.geotoolkit.csw.xml.v202.AbstractRecordType) BriefRecordType(org.geotoolkit.csw.xml.v202.BriefRecordType) SummaryRecordType(org.geotoolkit.csw.xml.v202.SummaryRecordType) RecordType(org.geotoolkit.csw.xml.v202.RecordType) StringWriter(java.io.StringWriter) SimpleLiteral(org.geotoolkit.dublincore.xml.v2.elements.SimpleLiteral) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)8 AbstractRecordType (org.geotoolkit.csw.xml.v202.AbstractRecordType)7 BriefRecordType (org.geotoolkit.csw.xml.v202.BriefRecordType)7 RecordType (org.geotoolkit.csw.xml.v202.RecordType)7 SummaryRecordType (org.geotoolkit.csw.xml.v202.SummaryRecordType)7 SimpleLiteral (org.geotoolkit.dublincore.xml.v2.elements.SimpleLiteral)7 BoundingBoxType (org.geotoolkit.ows.xml.v100.BoundingBoxType)7 WGS84BoundingBoxType (org.geotoolkit.ows.xml.v100.WGS84BoundingBoxType)7 Test (org.junit.Test)7 List (java.util.List)6 RecordType (org.openarchives.oai._2.RecordType)6 OAIPMH (org.openarchives.oai._2.OAIPMH)5 ResumptionTokenType (org.openarchives.oai._2.ResumptionTokenType)5 StringWriter (java.io.StringWriter)4 JAXBElement (javax.xml.bind.JAXBElement)4 Marshaller (javax.xml.bind.Marshaller)4 Property (org.osate.aadl2.Property)4 RecordType (org.osate.aadl2.RecordType)4 BasicProperty (org.osate.aadl2.BasicProperty)3 ContainmentPathElement (org.osate.aadl2.ContainmentPathElement)3