Compare commits

...

2 Commits

Author SHA1 Message Date
maverickstuder
7fe102a22b RED-10196: Backend adaptions for RM/DM unification 2024-10-18 12:37:22 +02:00
maverickstuder
9501ebebd0 RED-10196: Backend adaptions for RM/DM unification 2024-10-18 12:25:28 +02:00
6 changed files with 35 additions and 5 deletions

View File

@ -18,4 +18,5 @@ deploy:
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_COMMIT_BRANCH =~ /^release/
- if: $CI_COMMIT_BRANCH =~ /^feature/
- if: $CI_COMMIT_TAG

View File

@ -0,0 +1,7 @@
package com.knecon.fforesight.tenantcommons;
public enum TenantApplicationType {
RedactManager,
DocuMine,
Clarifynd
}

View File

@ -15,4 +15,6 @@ public interface TenantProvider {
List<TenantResponse> getTenants();
TenantApplicationType getTenantApplicationType(String tenantId);
}

View File

@ -24,6 +24,7 @@ public interface TenantsClient extends TenantProvider {
String TENANT_ID_PARAM = "tenantId";
String DETAILS_PATH = "/details";
String TENANT_ID_PATH_PARAM = "/{" + TENANT_ID_PARAM + "}";
String APPLICATION_TYPE_PATH = "/application-type";
@PostMapping(value = TENANT_PATH + TENANT_ID_PATH_PARAM + DETAILS_PATH, consumes = MediaType.APPLICATION_JSON_VALUE)
@ -37,4 +38,8 @@ public interface TenantsClient extends TenantProvider {
@GetMapping(value = TENANT_PATH, produces = MediaType.APPLICATION_JSON_VALUE)
List<TenantResponse> getTenants();
@GetMapping(value = TENANT_PATH + TENANT_ID_PATH_PARAM + APPLICATION_TYPE_PATH, produces = MediaType.APPLICATION_JSON_VALUE)
TenantApplicationType getTenantApplicationType(@PathVariable(TENANT_ID_PARAM) String tenantId);
}

View File

@ -3,6 +3,8 @@ package com.knecon.fforesight.tenantcommons.model;
import java.util.HashMap;
import java.util.Map;
import com.knecon.fforesight.tenantcommons.TenantApplicationType;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -26,5 +28,6 @@ public class TenantResponse implements ITenantEvent {
private AuthDetails authDetails;
private Map<String, Object> details = new HashMap<>();
private TenantApplicationType applicationType;
}

View File

@ -2,10 +2,10 @@ package com.knecon.fforesight.tenantcommons.utils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Service;
import com.knecon.fforesight.tenantcommons.TenantApplicationType;
import com.knecon.fforesight.tenantcommons.TenantProvider;
import com.knecon.fforesight.tenantcommons.listener.ITenantEventHandler;
import com.knecon.fforesight.tenantcommons.model.TenantCreatedEvent;
@ -27,7 +27,10 @@ public class TestTenantProvider implements TenantProvider, ITenantEventHandler<T
@Override
public TenantResponse getTenant(String s) {
return tenants.stream().filter(t -> t.getTenantId().equals(s)).findFirst().orElse(null);
return tenants.stream()
.filter(t -> t.getTenantId().equals(s))
.findFirst()
.orElse(null);
}
@ -38,12 +41,21 @@ public class TestTenantProvider implements TenantProvider, ITenantEventHandler<T
}
@Override
public TenantApplicationType getTenantApplicationType(String s) {
return tenants.stream()
.filter(t -> t.getTenantId().equals(s))
.findFirst()
.map(TenantResponse::getApplicationType)
.orElse(TenantApplicationType.RedactManager);
}
@Override
public void handle(TenantCreatedEvent event) {
tenants.add(TenantResponse.builder()
.tenantId(event.getTenantId())
.build());
tenants.add(TenantResponse.builder().tenantId(event.getTenantId()).build());
}