Skip to content

Commit

Permalink
Merge pull request #25 from nordic-institute/XRDCAT-19
Browse files Browse the repository at this point in the history
XRDCAT-19: Merge changes from VRK repository
  • Loading branch information
raits committed May 28, 2024
2 parents 0e7b24a + 9a1d21a commit a2d3bdc
Show file tree
Hide file tree
Showing 20 changed files with 304 additions and 384 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,4 @@ No support for X-Road Catalog deployment is provided here.

* X-Road Catalog was originally developed by the [Finnish Digital Agency](https://dvv.fi/en) during 2016-2023.
* In 2023 it was agreed that [Nordic Institute for Interoperability Solutions (NIIS)](https://www.niis.org/) takes
maintenance responsibility.
maintenance responsibility.
12 changes: 10 additions & 2 deletions doc/xroad_catalog_user_guide.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# X-Road Catalog User Guide
Version: 4.2.0
Version: 4.2.1
Doc. ID: UG-XRDCAT

---
Expand All @@ -25,6 +25,7 @@ Doc. ID: UG-XRDCAT
| 22.03.2023 | 4.0.0 | Split document into X-Road Catalog Installation Guide and User Guide | Petteri Kivimäki |
| 16.08.2023 | 4.1.0 | Update Catalog Lister port number from `8080` to `8070` | Petteri Kivimäki |
| 09.09.2023 | 4.2.0 | Update REST endpoint descriptions | Petteri Kivimäki |
| 17.11.2023 | 4.2.1 | Update response of ListMembers and service types for GetServiceType | Bert Viikmäe |

## Table of Contents <!-- omit in toc -->

Expand Down Expand Up @@ -204,6 +205,7 @@ Contents of the XML response of the request
<ns2:services>
<ns2:service>
<ns2:serviceCode>clientReg</ns2:serviceCode>
<ns2:serviceType>SOAP</ns2:serviceType>
<ns2:wsdl>
<ns2:externalId>1584692751893_da8be621-5d6b-4920-91c9-d8c359dddbad</ns2:externalId>
<ns2:created>2020-03-20T10:25:51.892+02:00</ns2:created>
Expand All @@ -216,12 +218,14 @@ Contents of the XML response of the request
</ns2:service>
<ns2:service>
<ns2:serviceCode>respa.tampere.fi</ns2:serviceCode>
<ns2:serviceType>REST</ns2:serviceType>
<ns2:created>2020-03-20T10:25:51.632+02:00</ns2:created>
<ns2:changed>2020-03-20T10:25:51.632+02:00</ns2:changed>
<ns2:fetched>2020-03-20T12:31:07.223+02:00</ns2:fetched>
</ns2:service>
<ns2:service>
<ns2:serviceCode>authCertDeletion</ns2:serviceCode>
<ns2:serviceType>SOAP</ns2:serviceType>
<ns2:wsdl>
<ns2:externalId>1584692751942_ab002cbd-bbbd-43c7-a311-b0dc5adf3af1</ns2:externalId>
<ns2:created>2020-03-20T10:25:51.936+02:00</ns2:created>
Expand All @@ -234,6 +238,7 @@ Contents of the XML response of the request
</ns2:service>
<ns2:service>
<ns2:serviceCode>clientDeletion</ns2:serviceCode>
<ns2:serviceType>SOAP</ns2:serviceType>
<ns2:wsdl>
<ns2:externalId>1584692751908_5bdde30d-3a5f-42c0-9f45-d884f5810996</ns2:externalId>
<ns2:created>2020-03-20T10:25:51.906+02:00</ns2:created>
Expand All @@ -246,6 +251,7 @@ Contents of the XML response of the request
</ns2:service>
<ns2:service>
<ns2:serviceCode>ownerChange</ns2:serviceCode>
<ns2:serviceType>SOAP</ns2:serviceType>
<ns2:wsdl>
<ns2:externalId>1584692751888_07141c5a-bfe0-4c84-b621-e5e4a9db01fa</ns2:externalId>
<ns2:created>2020-03-20T10:25:51.884+02:00</ns2:created>
Expand All @@ -258,6 +264,7 @@ Contents of the XML response of the request
</ns2:service>
<ns2:service>
<ns2:serviceCode>PetStoreNew</ns2:serviceCode>
<ns2:serviceType>REST</ns2:serviceType>
<ns2:created>2020-03-20T10:25:51.632+02:00</ns2:created>
<ns2:changed>2020-03-20T10:25:51.632+02:00</ns2:changed>
<ns2:fetched>2020-03-20T12:31:07.223+02:00</ns2:fetched>
Expand Down Expand Up @@ -296,6 +303,7 @@ The XML response has a `<SOAP-ENV:Body>` element with the following structure:
* `services`
* `service`
* `serviceCode`
* `serviceType`
* `wsdl` (if the given service description is a WSDL description)
* `externalId`

Expand Down Expand Up @@ -456,7 +464,7 @@ The following request fields need to be filled:
The XML response has a `<SOAP-ENV:Body>` element with the following structure:

* `GetServiceTypeResponse`
* `type` (values: `REST`/`OPENAPI3`/`WSDL`)
* `type` (values: `REST`/`OPENAPI3`/`WSDL`/`UNKNOWN`)

### 3.1.5 Check if member is provider

Expand Down
15 changes: 15 additions & 0 deletions xroad-catalog-collector/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

All notable changes to this project will be documented in this file.

## [3.0.7] - 2023-11-17

# Changed
- Refactor ListMembers endpoint to have extra field "serviceType"

## [3.0.6] - 2023-11-09

# Changed
- Refactor fetch of companies

## [3.0.5] - 2023-11-07

# Changed
- Pull latest version from NIIS develop branch

## [3.0.4] - 2023-02-13

# Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import akka.actor.ActorSystem;
import akka.event.Logging;
import akka.event.LoggingAdapter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
Expand All @@ -28,7 +27,6 @@
import java.util.Arrays;
import java.util.concurrent.TimeUnit;

@Slf4j
@SpringBootApplication
public class XRoadCatalogCollector {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Profile;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import scala.concurrent.duration.Duration;
Expand All @@ -34,7 +33,6 @@
@Component("CatalogSupervisor")
@Scope("prototype")
@Slf4j
@Profile("!fi") // remove, so that this will be used for all profiles
public class CatalogSupervisor extends XRoadCatalogActor {

public static final String LIST_CLIENTS_ACTOR_ROUTER = "list-clients-actor-router";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import fi.vrk.xroad.catalog.collector.util.OrganizationUtil;
import fi.vrk.xroad.catalog.collector.wsimport.ClientType;
import fi.vrk.xroad.catalog.collector.wsimport.XRoadClientIdentifierType;
import fi.vrk.xroad.catalog.persistence.CatalogService;
import fi.vrk.xroad.catalog.persistence.CompanyService;
import fi.vrk.xroad.catalog.persistence.entity.BusinessAddress;
Expand All @@ -36,7 +35,6 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

Expand All @@ -48,6 +46,9 @@ public class FetchCompaniesActor extends XRoadCatalogActor {
@Value("${xroad-catalog.fetch-companies-url}")
private String fetchCompaniesUrl;

@Value("${xroad-catalog.fetch-companies-limit}")
private Integer fetchCompaniesLimit;

@Autowired
protected CatalogService catalogService;

Expand All @@ -63,13 +64,19 @@ public void preStart() throws Exception {
protected boolean handleMessage(Object message) {
if (message instanceof ClientType) {
ClientType clientType = (ClientType) message;
XRoadClientIdentifierType client = clientType.getId();
log.info("Fetching data for company with businessCode {}", client.getMemberCode());
String businessCode = clientType.getId().getMemberCode();
JSONObject companyJson = OrganizationUtil.getCompany(clientType, fetchCompaniesUrl, businessCode,
JSONObject companiesJson = OrganizationUtil.getCompanies(clientType, fetchCompaniesLimit, fetchCompaniesUrl,
catalogService);
saveData(companyJson.optJSONArray("results"));
log.info("Successfully saved data for company with businessCode {}", businessCode);
JSONArray companiesArray = companiesJson.optJSONArray("results");
int numberOfCompanies = companiesArray.length();
log.info("Fetching data for {} companies", numberOfCompanies);
companiesArray.forEach(item -> {
JSONObject company = (JSONObject) item;
String businessCode = company.optString("businessId");
JSONObject companyJson = OrganizationUtil.getCompany(clientType, fetchCompaniesUrl, businessCode,
catalogService);
saveData(companyJson.optJSONArray("results"));
});
log.info("Successfully saved data for {} companies", numberOfCompanies);
return true;
} else {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public class OrganizationsActor extends XRoadCatalogActor {

private boolean organizationsFetched = false;

private boolean companiesFetched = false;

private static final String SERVICE_TYPE_REST = "REST";

@Value("${xroad-catalog.security-server-host}")
Expand Down Expand Up @@ -139,7 +141,10 @@ private void fetchOrganizations(ClientType clientType) {
private void fetchCompanies(ClientType clientType) {
if (MethodListUtil.shouldFetchCompanies(fetchCompaniesUnlimited, fetchCompaniesTimeAfterHour,
fetchCompaniesTimeBeforeHour)) {
fetchCompaniesPoolRef.tell(clientType, getSelf());
if (Boolean.FALSE.equals(companiesFetched)) {
fetchCompaniesPoolRef.tell(clientType, getSelf());
companiesFetched = true;
}
}
}

Expand Down Expand Up @@ -186,4 +191,3 @@ private void saveSubsystemsAndServices(ClientType clientType) {
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@
*/
package fi.vrk.xroad.catalog.collector.configuration;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

@Configuration
@Profile({ "production", "sshtest" })
@Slf4j
public class ProductionConfiguration extends ApplicationConfiguration {

// dont override anything from ApplicationConfiguration
Expand Down
Loading

0 comments on commit a2d3bdc

Please sign in to comment.