use of org.osate.aadl2.RecordType in project geotoolkit by Geomatys.
the class CswXMLBindingTest method getRecordByIdResponseMarshalingTest.
/**
* Test getRecordById request Marshalling.
*/
@Test
public void getRecordByIdResponseMarshalingTest() throws JAXBException {
Marshaller marshaller = pool.acquireMarshaller();
/*
* 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<Object> records = new ArrayList<>();
records.add(record);
records.add(briefRecord);
records.add(sumRecord);
GetRecordByIdResponse response = new GetRecordByIdResponseType(records);
StringWriter sw = new StringWriter();
marshaller.marshal(response, sw);
String result = sw.toString();
String expResult = "<?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";
LOGGER.log(Level.FINER, "RESULT:\n{0}", result);
LOGGER.log(Level.FINER, "EXPRESULT:\n{0}", expResult);
assertXmlEquals(expResult, result, "xmlns:*");
pool.recycle(marshaller);
}
use of org.osate.aadl2.RecordType in project ARLAS-server by gisaia.
the class RecordBuilder method getFullResult.
public static RecordType getFullResult(CollectionReference collectionReference, String[] elements, String baseUri, boolean inspireIsEnabled) {
RecordType record = new RecordType();
DublinCoreElementName dublinCoreElementName = collectionReference.params.dublinCoreElementName;
Inspire inspire = collectionReference.params.inspire;
addIdentifier(record, dublinCoreElementName.identifier);
if (elements.length == 0 || elements == null) {
// ADD ALL field
addTitle(record, dublinCoreElementName.title);
if (inspire != null && inspire.keywords != null) {
inspire.keywords.forEach(keyword -> {
if (keyword.value != null) {
addSubject(record, keyword.value);
}
});
}
if (!StringUtil.isNullOrEmpty(dublinCoreElementName.subject)) {
addSubject(record, dublinCoreElementName.subject);
}
if (inspireIsEnabled) {
addType(record, RESOURCE_TYPE);
} else {
addType(record, dublinCoreElementName.type);
}
addBbox(record, dublinCoreElementName.bbox);
addModified(record, dublinCoreElementName.getDate());
addFormat(record, dublinCoreElementName.format);
addAbstract(record, dublinCoreElementName.description);
addUrlToWFS(record, baseUri + "ogc/wfs/" + collectionReference.collectionName + "/?" + OGCConstant.WFS_GET_CAPABILITIES_PARAMETERS);
} else {
for (String element : Arrays.asList(elements)) {
switch(element.toLowerCase()) {
case CSWConstant.DC_FIELD_TITLE:
addTitle(record, dublinCoreElementName.title);
break;
case CSWConstant.DC_FIELD_TYPE:
if (inspireIsEnabled) {
addType(record, RESOURCE_TYPE);
} else {
addType(record, dublinCoreElementName.type);
}
break;
case CSWConstant.DC_FIELD_BBOX:
addBbox(record, dublinCoreElementName.bbox);
break;
case CSWConstant.DC_FIELD_SUBJECT:
if (inspire.keywords != null) {
inspire.keywords.forEach(keyword -> addSubject(record, keyword.value));
}
if (!StringUtil.isNullOrEmpty(dublinCoreElementName.subject)) {
addSubject(record, dublinCoreElementName.subject);
}
break;
case CSWConstant.DC_FIELD_MODIFIED:
addModified(record, dublinCoreElementName.getDate());
break;
case CSWConstant.DC_FIELD_FORMAT:
addFormat(record, dublinCoreElementName.format);
break;
case CSWConstant.DC_FIELD_ABSTRACT:
addAbstract(record, dublinCoreElementName.description);
break;
}
}
}
return record;
}
use of org.osate.aadl2.RecordType in project AMASE by loonwerks.
the class SafetyScopeProvider method scope_GetPropertyExpr_prop.
protected IScope scope_GetPropertyExpr_prop(GetPropertyExpr ctx, EReference ref) {
IScope prevScope = prevScope(ctx, ref);
ComponentRef cr = ctx.getComponentRef();
if (cr instanceof ThisRef) {
List<Property> ps = new ArrayList<>();
EObject container = ctx.getContainingClassifier();
while (container != null) {
if (container instanceof Classifier) {
List<PropertyAssociation> pas = ((Classifier) container).getAllPropertyAssociations();
for (PropertyAssociation pa : pas) {
ps.add(pa.getProperty());
}
container = ((Classifier) container).eContainer();
} else if (container instanceof AadlPackage) {
for (PropertySet propSet : EcoreUtil2.getAllContentsOfType(container, PropertySet.class)) {
for (Property p : propSet.getOwnedProperties()) {
ps.add(p);
}
// =======
// EList<EObject> refs = null;
//
// if (container instanceof NestedDotID) {
// NestedDotID parent = (NestedDotID) container;
// refs = parent.eCrossReferences();
//
// if (refs.size() != 1) {
// return new HashSet<>(); // this will throw a parsing error
// }
// container = refs.get(0); // figure out what this type this portion
//
// // of the nest id is so we can figure out
// // what we could possibly link to
//
// if (container instanceof ThreadSubcomponent) {
// container = ((ThreadSubcomponent) container).getComponentType();
// result.addAll(getAadlElements(container));
// } else if (container instanceof Subcomponent) {
// container = ((Subcomponent) container).getComponentImplementation();
// if (container == null) { // no implementation is provided
// container = refs.get(0);
// container = ((Subcomponent) container).getClassifier();
// }
// result.addAll(getAadlElements(container));
// } else if (container instanceof DataPort) {
// container = ((DataPort) container).getDataFeatureClassifier();
// result.addAll(getAadlElements(container));
// } else if (container instanceof EventDataPort) {
// container = ((EventDataPort) container).getDataFeatureClassifier();
// result.addAll(getAadlElements(container));
// } else if (container instanceof AadlPackage) {
// result.addAll(getAadlElements(container));
// } else if (container instanceof FeatureGroupImpl) {
// container = ((FeatureGroupImpl) container).getAllFeatureGroupType();
// result.addAll(getAadlElements(container));
// } else if (container instanceof Arg || container instanceof ConstStatement) {
// Type type;
//
// if (container instanceof Arg) {
// type = ((Arg) container).getType();
// } else {
// type = ((ConstStatement) container).getType();
// }
//
// if (type instanceof RecordType) {
// DoubleDotRef elID = ((RecordType) type).getRecord();
// NamedElement namedEl = elID.getElm();
//
// if (namedEl instanceof ComponentImplementation) {
// ComponentImplementation componentImplementation = (ComponentImplementation) namedEl;
// EList<Subcomponent> subs = componentImplementation.getAllSubcomponents();
// result.addAll(subs);
// } else if (namedEl instanceof RecordDefExpr) {
// result.addAll(((RecordDefExpr) namedEl).getArgs());
// >>>>>>> origin/develop
}
container = null;
} else {
container = container.eContainer();
}
}
return Scopes.scopeFor(ps, prevScope);
} else if (cr instanceof DoubleDotRef) {
NamedElement ne = ((DoubleDotRef) cr).getElm();
if (ne instanceof Subcomponent) {
List<PropertyAssociation> pas = ((Subcomponent) ne).getOwnedPropertyAssociations();
List<Property> ps = new ArrayList<>();
for (PropertyAssociation pa : pas) {
ps.add(pa.getProperty());
}
return Scopes.scopeFor(ps, prevScope);
}
}
return IScope.NULLSCOPE;
}
use of org.osate.aadl2.RecordType in project mod-oai-pmh by folio-org.
the class OaiPmhImplTest method verifyHeaderDateStamp.
private void verifyHeaderDateStamp(OAIPMH oaipmh, VerbType verbType, String timeGranularity) {
String verb = verbType.value();
if (verb.equals(LIST_RECORDS.value())) {
oaipmh.getListRecords().getRecords().stream().map(RecordType::getHeader).map(HeaderType::getDatestamp).forEach(headerDateStamp -> verifyHeaderDateStamp(headerDateStamp, timeGranularity));
} else if (verb.equals(LIST_IDENTIFIERS.value())) {
oaipmh.getListIdentifiers().getHeaders().stream().map(HeaderType::getDatestamp).forEach(headerDateStamp -> verifyHeaderDateStamp(headerDateStamp, timeGranularity));
} else if (verb.equals(GET_RECORD.value())) {
String datestamp = oaipmh.getGetRecord().getRecord().getHeader().getDatestamp();
verifyHeaderDateStamp(datestamp, timeGranularity);
}
}
use of org.osate.aadl2.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();
}
Aggregations