Compare commits
2 Commits
main
...
feature/RE
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7fe102a22b | ||
|
|
9501ebebd0 |
@ -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
|
||||
@ -0,0 +1,7 @@
|
||||
package com.knecon.fforesight.tenantcommons;
|
||||
|
||||
public enum TenantApplicationType {
|
||||
RedactManager,
|
||||
DocuMine,
|
||||
Clarifynd
|
||||
}
|
||||
@ -15,4 +15,6 @@ public interface TenantProvider {
|
||||
|
||||
List<TenantResponse> getTenants();
|
||||
|
||||
TenantApplicationType getTenantApplicationType(String tenantId);
|
||||
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
}
|
||||
|
||||
@ -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());
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user