* Copyright (C) 2020-2022 Nordix Foundation
* Modifications Copyright (C) 2020-2022 Bell Canada.
* Modifications Copyright (C) 2021 Pantheon.tech
+ * Modifications Copyright (C) 2022 TechMahindra Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.onap.cps.spi.exceptions.ModelValidationException;
import org.onap.cps.spi.model.ModuleDefinition;
import org.onap.cps.spi.model.ModuleReference;
+import org.onap.cps.spi.model.SchemaSet;
import org.onap.cps.spi.repository.DataspaceRepository;
import org.onap.cps.spi.repository.ModuleReferenceRepository;
import org.onap.cps.spi.repository.SchemaSetRepository;
}
}
+ @Override
+ public Collection<SchemaSet> getSchemaSetsByDataspaceName(final String dataspaceName) {
+ final DataspaceEntity dataspaceEntity = dataspaceRepository.getByName(dataspaceName);
+ final List<SchemaSetEntity> schemaSetEntities = schemaSetRepository.getByDataspace(dataspaceEntity);
+ return schemaSetEntities.stream()
+ .map(CpsModulePersistenceServiceImpl::toSchemaSet).collect(Collectors.toList());
+ }
+
@Override
@Transactional
// A retry is made to store the schema set if it fails because of duplicated yang resource exception that
yangResourceEntity.getRevision(),
yangResourceEntity.getContent());
}
+
+ private static SchemaSet toSchemaSet(final SchemaSetEntity schemaSetEntity) {
+ return SchemaSet.builder().name(schemaSetEntity.getName())
+ .dataspaceName(schemaSetEntity.getDataspace().getName()).build();
+ }
}