Search in sources :

Example 31 with RecordType

use of org.osate.aadl2.RecordType in project AGREE by loonwerks.

the class AgreeUtils method getLustreTypes.

public static List<TypeDef> getLustreTypes(AgreeProgram agreeProgram) {
    List<TypeDef> types = new ArrayList<>();
    for (Type type : agreeProgram.globalTypes) {
        String typeName;
        if (type instanceof RecordType) {
            typeName = ((RecordType) type).id;
        } else if (type instanceof EnumType) {
            typeName = ((EnumType) type).id;
        } else {
            throw new AgreeException("Unable to handle type of type '" + type.getClass() + "'");
        }
        types.add(new TypeDef(typeName, type));
    }
    // add synonym types
    types.addAll(getTypeSynonmyms());
    return types;
}
Also used : RecordType(jkind.lustre.RecordType) EnumType(jkind.lustre.EnumType) ComponentType(org.osate.aadl2.ComponentType) Type(jkind.lustre.Type) NamedType(jkind.lustre.NamedType) TypeDef(jkind.lustre.TypeDef) RecordType(jkind.lustre.RecordType) EnumType(jkind.lustre.EnumType) ArrayList(java.util.ArrayList)

Example 32 with RecordType

use of org.osate.aadl2.RecordType in project openaire-cris-validator by EuroCRIS.

the class FileLoggingConnectionStreamFactory method wrapCheckOAIIdentifier.

private CheckingIterable<RecordType> wrapCheckOAIIdentifier(final CheckingIterable<RecordType> checker) {
    final Optional<String> repoIdentifier = endpoint.getRepositoryIdentifer();
    if (repoIdentifier.isPresent()) {
        final Function<RecordType, Set<String>> expectedFunction = new Function<RecordType, Set<String>>() {

            @Override
            public Set<String> apply(final RecordType x) {
                final MetadataType metadata = x.getMetadata();
                final Set<String> results = new HashSet<>();
                if (metadata != null) {
                    final Element el = (Element) metadata.getAny();
                    final String id = el.getAttribute("id");
                    results.add("oai:" + repoIdentifier.get() + ":" + el.getLocalName() + "s/" + id);
                    results.add("oai:" + repoIdentifier.get() + ":" + id);
                } else {
                    // make the test trivially satisfied for records with no metadata
                    results.add(x.getHeader().getIdentifier());
                }
                return results;
            }
        };
        return checker.checkForAllValueInSet(expectedFunction, ((final RecordType record) -> record.getHeader().getIdentifier()), "OAI identifier other than expected");
    } else {
        return checker;
    }
}
Also used : Function(java.util.function.Function) Set(java.util.Set) HashSet(java.util.HashSet) RecordType(org.openarchives.oai._2.RecordType) JAXBElement(javax.xml.bind.JAXBElement) Element(org.w3c.dom.Element) MetadataType(org.openarchives.oai._2.MetadataType) HashSet(java.util.HashSet)

Aggregations

ArrayList (java.util.ArrayList)12 List (java.util.List)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 NamedElement (org.osate.aadl2.NamedElement)7 Property (org.osate.aadl2.Property)7 RecordType (org.openarchives.oai._2.RecordType)6 OAIPMH (org.openarchives.oai._2.OAIPMH)5 ResumptionTokenType (org.openarchives.oai._2.ResumptionTokenType)5 AadlPackage (org.osate.aadl2.AadlPackage)5 DoubleDotRef (com.rockwellcollins.atc.agree.agree.DoubleDotRef)4 StringWriter (java.io.StringWriter)4 RecordType (org.osate.aadl2.RecordType)4 Map (java.util.Map)3