Skip to content

Commit

Permalink
ARKIV-259 We're ready, but are Troms ready for the main stage?
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsodd committed Jun 19, 2024
2 parents ed8546d + 8587cad commit 295fd07
Show file tree
Hide file tree
Showing 9 changed files with 263 additions and 26 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
push: ${{ github.actor != 'dependabot[bot]' }}
tags: ${{ steps.meta.outputs.tags }}
Expand All @@ -56,6 +56,9 @@ jobs:
- org: tromsfylke-no
deploy-every-branch: true

- cluster: aks-api-fint-2022-02-08
org: ofk-no

steps:
- uses: actions/checkout@v4

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ jobs:
distribution: 'corretto'
cache: 'gradle'

- uses: gradle/wrapper-validation-action@v3.3.2
- uses: gradle/wrapper-validation-action@v3.4.1
- name: Build with Gradle
uses: gradle/gradle-build-action@v3.3.2
uses: gradle/gradle-build-action@v3.4.1
with:
arguments: check
2 changes: 1 addition & 1 deletion .github/workflows/md.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
type=sha,enable=true,priority=100,prefix=sha-,suffix=,format=short
- name: Build and push Docker image
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
push: true
Expand Down
78 changes: 78 additions & 0 deletions bruno/OTJOURNAL.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
meta {
name: OTJOURNAL
type: http
seq: 6
}

post {
url: https://flyt.vigoiks.no/{{env}}{{org}}/api/intern/metadata
body: json
auth: none
}

body:json {
{
"sourceApplicationId": 4,
"sourceApplicationIntegrationId": "OTJOURNAL",
"sourceApplicationIntegrationUri": null,
"integrationDisplayName": "Arkivering fra VIGO OT",
"version": 2,
"instanceMetadata": {
"instanceValueMetadata": [],
"instanceObjectCollectionMetadata": [],
"categories": [
{
"displayName": "Personalia",
"content": {
"instanceValueMetadata": [
{ "displayName": "Fødselsnummer", "type": "STRING", "key": "personaliaFodselsnummer" },
{ "displayName": "Fornavn", "type": "STRING", "key": "personaliaFornavn" },
{ "displayName": "Mellomnavn", "type": "STRING", "key": "personaliaMellomnavn" },
{ "displayName": "Etternavn", "type": "STRING", "key": "personaliaEtternavn" },
{ "displayName": "Fødselsdato", "type": "STRING", "key": "personaliaFodselsdato" }
],
"instanceObjectCollectionMetadata": [],
"categories": []
}
},
{
"displayName": "Kontaktinformasjon",
"content": {
"instanceValueMetadata": [
{ "displayName": "Telefonnummer", "type": "STRING", "key": "kontaktinformasjonTelefonnummer" },
{ "displayName": "Epostadresse", "type": "STRING", "key": "kontaktinformasjonEpostadresse" }
],
"instanceObjectCollectionMetadata": [],
"categories": []
}
},
{
"displayName": "Inntaksadresse",
"content": {
"instanceValueMetadata": [
{ "displayName": "Gateadresse", "type": "STRING", "key": "inntaksadresseGateadresse" },
{ "displayName": "Postnummer", "type": "STRING", "key": "inntaksadressePostnummer" },
{ "displayName": "Poststed", "type": "STRING", "key": "inntaksadressePoststed" }
],
"instanceObjectCollectionMetadata": [],
"categories": []
}
},
{
"displayName": "Dokument",
"content": {
"instanceValueMetadata": [
{ "displayName": "Tittel", "type": "STRING", "key": "dokumentTittel" },
{ "displayName": "Dato", "type": "STRING", "key": "dokumentDato" },
{ "displayName": "Filnavn", "type": "STRING", "key": "dokumentFilnavn" },
{ "displayName": "Fil", "type": "FILE", "key": "dokumentFil" },
{ "displayName": "Format", "type": "STRING", "key": "dokumentFormat" }
],
"instanceObjectCollectionMetadata": [],
"categories": []
}
}
]
}
}
}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ dependencies {
implementation 'no.fintlabs:fint-flyt-kafka:3.0.2'

implementation 'no.fintlabs:fint-flyt-instance-gateway:5.0.5'
implementation 'no.fintlabs:fint-flyt-resource-server:2.0.0'
implementation 'no.fintlabs:fint-flyt-resource-server:2.1.0'

runtimeOnly 'io.micrometer:micrometer-registry-prometheus'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
Expand Down
34 changes: 34 additions & 0 deletions kustomize/overlays/ofk-no/api/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: ofk-no

resources:
- ../../../base

commonLabels:
app.kubernetes.io/instance: fint-flyt-vigo-gateway_ofk_no
fintlabs.no/org-id: ofk.no

patches:
- patch: |-
- op: replace
path: "/spec/kafka/acls/0/topic"
value: "ofk-no.flyt.*"
- op: replace
path: "/spec/orgId"
value: "ofk.no"
- op: add
path: "/spec/url/basePath"
value: "/ofk-no"
- op: replace
path: "/spec/ingress/basePath"
value: "/ofk-no/api/vigo"
- op: add
path: "/spec/env/-"
value:
name: "logging.level.no.fintlabs.instance.gateway"
value: "INFO"
target:
kind: Application
name: fint-flyt-vigo-gateway
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@
import org.springframework.stereotype.Service;
import reactor.core.publisher.Mono;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

@Service
@Slf4j
Expand Down Expand Up @@ -45,9 +49,48 @@ private static Map<String, String> toValuePerKey(IncomingInstance incomingInstan

entries.add(Map.entry("personaliaFodselsnummer", incomingInstance.getPersonalia().getFodselsnummer()));
entries.add(Map.entry("personaliaFornavn", incomingInstance.getPersonalia().getFornavn()));
entries.add(Map.entry("personaliaMellomnavn", incomingInstance.getPersonalia().getMellomnavn()));

Optional.ofNullable(incomingInstance.getPersonalia().getMellomnavn())
.ifPresent(mellomnavn -> entries.add(Map.entry("personaliaMellomnavn", mellomnavn)));

entries.add(Map.entry("personaliaEtternavn", incomingInstance.getPersonalia().getEtternavn()));

entries.add(Map.entry("tilpassetNavn1",
Stream.of(incomingInstance.getPersonalia().getFornavn(),
incomingInstance.getPersonalia().getMellomnavn(),
incomingInstance.getPersonalia().getEtternavn())
.filter(s -> s != null)
.collect(Collectors.joining(" "))
));

entries.add(Map.entry("tilpassetNavn2",
Stream.of(incomingInstance.getPersonalia().getEtternavn(),
incomingInstance.getPersonalia().getFornavn(),
incomingInstance.getPersonalia().getMellomnavn())
.filter(s -> s != null)
.collect(Collectors.joining(" "))
));

entries.add(Map.entry("tilpassetNavn3",
Stream.of(incomingInstance.getPersonalia().getEtternavn() +",",
incomingInstance.getPersonalia().getFornavn(),
incomingInstance.getPersonalia().getMellomnavn())
.filter(s -> s != null)
.collect(Collectors.joining(" "))
));

Optional.ofNullable(incomingInstance.getPersonalia().getFodselsdato())
.ifPresent(fodselsdato -> {
entries.add(Map.entry("personaliaFodselsdato", fodselsdato));

Optional.ofNullable(formatedDate(fodselsdato, "ddMMyy")).ifPresent(formatedFodselsdato ->
entries.add(Map.entry("tilpassetFodselsdato1", formatedFodselsdato)));

Optional.ofNullable(formatedDate(fodselsdato, "dd.MM.yyyy")).ifPresent(formatedFodselsdato ->
entries.add(Map.entry("tilpassetFodselsdato2", formatedFodselsdato)));

});

entries.add(Map.entry("kontaktinformasjonTelefonnummer", incomingInstance.getKontaktinformasjon().getTelefonnummer()));
entries.add(Map.entry("kontaktinformasjonEpostadresse", incomingInstance.getKontaktinformasjon().getEpostadresse()));

Expand Down Expand Up @@ -88,6 +131,17 @@ private static Map<String, String> toValuePerKey(IncomingInstance incomingInstan
return entries.stream().collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
}

private static String formatedDate(String fodselsdato, String format) {
try {
LocalDate date = LocalDate.parse(fodselsdato, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
String formattedDate = date.format(DateTimeFormatter.ofPattern(format));
return formattedDate;
} catch (DateTimeParseException e) {
return null;
}
}


private Mono<UUID> postFile(Long sourceApplicationId, IncomingInstance incomingInstance) {
return fileClient.postFile(
File.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ public class Personalia {
private String fornavn;
private String mellomnavn;
private String etternavn;
private String fodselsdato;
}
Loading

0 comments on commit 295fd07

Please sign in to comment.