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;
}
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;
}
}
Aggregations