use of io.github.microcks.domain.Service in project microcks by microcks.
the class AsyncAPIImporter method getServiceDefinitions.
@Override
public List<Service> getServiceDefinitions() throws MockRepositoryImportException {
List<Service> result = new ArrayList<>();
// Build a new service.
Service service = new Service();
service.setName(spec.path("info").path("title").asText());
service.setVersion(spec.path("info").path("version").asText());
service.setType(ServiceType.EVENT);
// Complete metadata if specified via extension.
if (spec.path("info").has(MetadataExtensions.MICROCKS_EXTENSION)) {
Metadata metadata = new Metadata();
MetadataExtractor.completeMetadata(metadata, spec.path("info").path(MetadataExtensions.MICROCKS_EXTENSION));
service.setMetadata(metadata);
}
// Then build its operations.
service.setOperations(extractOperations());
result.add(service);
return result;
}
use of io.github.microcks.domain.Service in project microcks by microcks.
the class ServiceRepositoryImpl method findByLabelsAndNameLike.
@Override
public List<Service> findByLabelsAndNameLike(Map<String, String> labels, String name) {
Query query = new Query(Criteria.where("name").regex(name, "i"));
for (String labelKey : labels.keySet()) {
query.addCriteria(Criteria.where("metadata.labels." + labelKey).is(labels.get(labelKey)));
}
List<Service> results = template.find(query, Service.class);
return results;
}
Aggregations