Skip to content

Commit

Permalink
Feat/download data (#14)
Browse files Browse the repository at this point in the history
* Added functionality for value sets

* Added local storage functionality for business rules

* Updated Value Set handling and api description

* Updated country list handling and api description

* Updated business rule handling and api description

* Added `X-VERSION` Header as optional

* Added Licence Text

* Added download of business rules, value set and country list using the dgc-lib

* Add simple sanity check for downloaded data.

* Update DGC-Lib to 1.1.1

Co-authored-by: Felix Dittrich <[email protected]>
  • Loading branch information
slaurenz and f11h authored Jun 25, 2021
1 parent 85f900b commit 128e116
Show file tree
Hide file tree
Showing 42 changed files with 1,948 additions and 103 deletions.
8 changes: 6 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<bcpkix.version>1.68</bcpkix.version>
<okhttp.version>4.9.1</okhttp.version>
<shedlock.version>4.23.0</shedlock.version>
<dgc.lib.version>0.5.0</dgc.lib.version>
<dgc.lib.version>1.1.1</dgc.lib.version>
<!-- plugins -->
<plugin.checkstyle.version>3.1.2</plugin.checkstyle.version>
<plugin.sonar.version>3.6.1.1688</plugin.sonar.version>
Expand Down Expand Up @@ -133,7 +133,11 @@
</dependencyManagement>

<dependencies>

<dependency>
<groupId>eu.europa.ec.dgc</groupId>
<artifactId>dgc-lib</artifactId>
<version>${dgc.lib.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*-
* ---license-start
* eu-digital-green-certificates / dgca-verifier-service
* eu-digital-green-certificates / dgca-businessrule-service
* ---
* Copyright (C) 2021 T-Systems International GmbH and all other contributors
* ---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*-
* ---license-start
* eu-digital-green-certificates / dgca-verifier-service
* eu-digital-green-certificates / dgca-businessrule-service
* ---
* Copyright (C) 2021 T-Systems International GmbH and all other contributors
* ---
Expand Down Expand Up @@ -29,12 +29,18 @@
@ConfigurationProperties("dgc")
public class DgcConfigProperties {

private final CertificatesDownloader certificatesDownloader = new CertificatesDownloader();
private final GatewayDownload businessRulesDownload = new GatewayDownload();

private final GatewayDownload valueSetsDownload = new GatewayDownload();

private final GatewayDownload countryListDownload = new GatewayDownload();

@Getter
@Setter
public static class CertificatesDownloader {
public static class GatewayDownload {
private Integer timeInterval;
private Integer lockLimit;
}


}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*-
* ---license-start
* eu-digital-green-certificates / dgca-verifier-service
* eu-digital-green-certificates / dgca-businessrule-service
* ---
* Copyright (C) 2021 T-Systems International GmbH and all other contributors
* ---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
/*-
* ---license-start
* eu-digital-green-certificates / dgca-businessrule-service
* ---
* Copyright (C) 2021 T-Systems International GmbH and all other contributors
* ---
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ---license-end
*/

package eu.europa.ec.dgc.businessrule.config;

import io.swagger.v3.oas.models.OpenAPI;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*-
* ---license-start
* eu-digital-green-certificates / dgca-verifier-service
* eu-digital-green-certificates / dgca-businessrule-service
* ---
* Copyright (C) 2021 T-Systems International GmbH and all other contributors
* ---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*-
* ---license-start
* eu-digital-green-certificates / dgca-verifier-service
* eu-digital-green-certificates / dgca-businessrule-service
* ---
* Copyright (C) 2021 T-Systems International GmbH and all other contributors
* ---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
/*-
* ---license-start
* eu-digital-green-certificates / dgca-businessrule-service
* ---
* Copyright (C) 2021 T-Systems International GmbH and all other contributors
* ---
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ---license-end
*/

package eu.europa.ec.dgc.businessrule.entity;

import javax.persistence.Column;
Expand Down Expand Up @@ -31,7 +51,7 @@ public class BusinessRuleEntity {
private String identifier;

@Column(name = "version", nullable = false)
String version = "1.0.0";
String version;

@Column(name = "country_code", nullable = false, length = 2)
String country;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
/*-
* ---license-start
* eu-digital-green-certificates / dgca-businessrule-service
* ---
* Copyright (C) 2021 T-Systems International GmbH and all other contributors
* ---
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ---license-end
*/

package eu.europa.ec.dgc.businessrule.entity;

import javax.persistence.Column;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*-
* ---license-start
* eu-digital-green-certificates / dgca-verifier-service
* eu-digital-green-certificates / dgca-businessrule-service
* ---
* Copyright (C) 2021 T-Systems International GmbH and all other contributors
* ---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
/*-
* ---license-start
* eu-digital-green-certificates / dgca-businessrule-service
* ---
* Copyright (C) 2021 T-Systems International GmbH and all other contributors
* ---
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ---license-end
*/

package eu.europa.ec.dgc.businessrule.entity;

import javax.persistence.Column;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
/*-
* ---license-start
* eu-digital-green-certificates / dgca-businessrule-service
* ---
* Copyright (C) 2021 T-Systems International GmbH and all other contributors
* ---
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ---license-end
*/

package eu.europa.ec.dgc.businessrule.exception;

import lombok.Getter;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package eu.europa.ec.dgc.businessrule.model;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class BusinessRuleItem {

private String hash;

private String identifier;

private String version;

private String country;

private String rawData;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package eu.europa.ec.dgc.businessrule.model;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class ValueSetItem {

private String hash;

private String id;

private String rawData;
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
/*-
* ---license-start
* eu-digital-green-certificates / dgca-businessrule-service
* ---
* Copyright (C) 2021 T-Systems International GmbH and all other contributors
* ---
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ---license-end
*/

package eu.europa.ec.dgc.businessrule.repository;

import eu.europa.ec.dgc.businessrule.entity.BusinessRuleEntity;
Expand All @@ -14,4 +34,6 @@ public interface BusinessRuleRepository extends JpaRepository<BusinessRuleEntity
List<BusinessRuleListItemDto> findAllByCountryOrderByIdentifierAsc(String country);

BusinessRuleEntity findOneByCountryAndHash(String country, String hash);

void deleteByHashNotIn(List<String> hashes);
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
/*-
* ---license-start
* eu-digital-green-certificates / dgca-businessrule-service
* ---
* Copyright (C) 2021 T-Systems International GmbH and all other contributors
* ---
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ---license-end
*/

package eu.europa.ec.dgc.businessrule.repository;

import eu.europa.ec.dgc.businessrule.entity.CountryListEntity;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
/*-
* ---license-start
* eu-digital-green-certificates / dgca-businessrule-service
* ---
* Copyright (C) 2021 T-Systems International GmbH and all other contributors
* ---
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ---license-end
*/

package eu.europa.ec.dgc.businessrule.repository;

import eu.europa.ec.dgc.businessrule.entity.ValueSetEntity;
Expand All @@ -10,4 +30,6 @@ public interface ValueSetRepository extends JpaRepository<ValueSetEntity, String
List<ValueSetListItemDto> findAllByOrderByIdAsc();

ValueSetEntity findOneByHash(String hash);

void deleteByHashNotIn(List<String> hashes);
}
Loading

0 comments on commit 128e116

Please sign in to comment.