backend fixes

This commit is contained in:
Diamantis Tziotzios 2023-10-27 09:54:49 +03:00
parent d983e1e38e
commit e4203a3bb4
3 changed files with 21 additions and 18 deletions

View File

@ -87,11 +87,13 @@ public class SectionEntity implements XmlSerializable<SectionEntity> {
systemFields.appendChild(systemField.toXml(doc)); systemFields.appendChild(systemField.toXml(doc));
} }
rootElement.appendChild(systemFields); rootElement.appendChild(systemFields);
Element descriptionTemplates = doc.createElement("descriptionTemplates"); if (this.descriptionTemplates != null) {
for (DescriptionTemplateEntity descriptionTemplate : this.descriptionTemplates) { Element descriptionTemplates = doc.createElement("descriptionTemplates");
descriptionTemplates.appendChild(descriptionTemplate.toXml(doc)); for (DescriptionTemplateEntity descriptionTemplate : this.descriptionTemplates) {
descriptionTemplates.appendChild(descriptionTemplate.toXml(doc));
}
rootElement.appendChild(descriptionTemplates);
} }
rootElement.appendChild(descriptionTemplates);
temp = this.fields.stream().filter(f -> f.getCategory().equals(DmpBlueprintFieldCategory.Extra)).collect(Collectors.toList()); temp = this.fields.stream().filter(f -> f.getCategory().equals(DmpBlueprintFieldCategory.Extra)).collect(Collectors.toList());
List<ExtraFieldEntity> extraFieldList = temp.stream().map(x-> (ExtraFieldEntity)x).collect(Collectors.toList()); List<ExtraFieldEntity> extraFieldList = temp.stream().map(x-> (ExtraFieldEntity)x).collect(Collectors.toList());
Element extraFields = doc.createElement("extraFields"); Element extraFields = doc.createElement("extraFields");

View File

@ -36,19 +36,19 @@ public class DepositConfiguration {
public List<RepositoryDeposit> depositClients() { public List<RepositoryDeposit> depositClients() {
List<RepositoryDeposit> clients = new ArrayList<>(); List<RepositoryDeposit> clients = new ArrayList<>();
for (DepositProperties.DepositSource source: properties.getSources()) { for (DepositProperties.DepositSource source: properties.getSources()) {
ClientRegistration clientRegistration = ClientRegistration // ClientRegistration clientRegistration = ClientRegistration
.withRegistrationId(source.getClientId()) // .withRegistrationId(source.getClientId())
.clientId(source.getClientId()) // .clientId(source.getClientId())
.clientSecret(source.getClientSecret()) // .clientSecret(source.getClientSecret())
.scope(source.getScope()) // .scope(source.getScope())
.issuerUri(source.getIssuerUrl()) // .issuerUri(source.getIssuerUrl())
.authorizationGrantType(AuthorizationGrantType.JWT_BEARER) // .authorizationGrantType(AuthorizationGrantType.JWT_BEARER)
.build(); // .build();
ReactiveClientRegistrationRepository clientRegistrationRepository = new InMemoryReactiveClientRegistrationRepository(clientRegistration); // ReactiveClientRegistrationRepository clientRegistrationRepository = new InMemoryReactiveClientRegistrationRepository(clientRegistration);
ReactiveOAuth2AuthorizedClientService clientService = new InMemoryReactiveOAuth2AuthorizedClientService(clientRegistrationRepository); // ReactiveOAuth2AuthorizedClientService clientService = new InMemoryReactiveOAuth2AuthorizedClientService(clientRegistrationRepository);
AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager authorizedClientManager = new AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager(clientRegistrationRepository, clientService); // AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager authorizedClientManager = new AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager(clientRegistrationRepository, clientService);
ServerOAuth2AuthorizedClientExchangeFilterFunction oauth = new ServerOAuth2AuthorizedClientExchangeFilterFunction(authorizedClientManager); // ServerOAuth2AuthorizedClientExchangeFilterFunction oauth = new ServerOAuth2AuthorizedClientExchangeFilterFunction(authorizedClientManager);
clients.add(new DepositRepository(WebClient.builder().baseUrl(source.getUrl() + "/api/deposit").filters(exchangeFilterFunctions -> exchangeFilterFunctions.add(oauth)).build())); // clients.add(new DepositRepository(WebClient.builder().baseUrl(source.getUrl() + "/api/deposit").filters(exchangeFilterFunctions -> exchangeFilterFunctions.add(oauth)).build()));
} }
return clients; return clients;
} }

View File

@ -14,7 +14,8 @@ import java.util.UUID;
@JsonTypeInfo( @JsonTypeInfo(
use = JsonTypeInfo.Id.NAME, use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.PROPERTY, include = JsonTypeInfo.As.PROPERTY,
property = "category") property = "category",
visible = true)
@JsonSubTypes({ @JsonSubTypes({
@JsonSubTypes.Type(value = SystemFieldPersist.class, name = "0"), @JsonSubTypes.Type(value = SystemFieldPersist.class, name = "0"),
@JsonSubTypes.Type(value = ExtraFieldPersist.class, name = "1") @JsonSubTypes.Type(value = ExtraFieldPersist.class, name = "1")