bug fixes
This commit is contained in:
parent
40df26c560
commit
4b32d5f548
|
@ -32,6 +32,7 @@ import org.slf4j.LoggerFactory;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URLConnection;
|
||||
|
@ -39,6 +40,7 @@ import java.time.Duration;
|
|||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class FieldCommonModelBuilder extends BaseCommonModelBuilder<FieldModel, FieldEntity> {
|
||||
private final BuilderFactory builderFactory;
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package org.opencdmp.model.builder.commonmodels.description;
|
||||
|
||||
import gr.cite.tools.data.builder.BuilderFactory;
|
||||
import gr.cite.tools.exception.MyApplicationException;
|
||||
import gr.cite.tools.logging.LoggerService;
|
||||
import org.opencdmp.authorization.AuthorizationFlags;
|
||||
import org.opencdmp.commonmodels.models.description.PropertyDefinitionFieldSetItemModel;
|
||||
import org.opencdmp.commons.types.description.PropertyDefinitionFieldSetItemEntity;
|
||||
|
@ -8,9 +11,6 @@ import org.opencdmp.commons.types.descriptiontemplate.FieldSetEntity;
|
|||
import org.opencdmp.convention.ConventionService;
|
||||
import org.opencdmp.model.builder.commonmodels.BaseCommonModelBuilder;
|
||||
import org.opencdmp.model.builder.commonmodels.CommonModelBuilderItemResponse;
|
||||
import gr.cite.tools.data.builder.BuilderFactory;
|
||||
import gr.cite.tools.exception.MyApplicationException;
|
||||
import gr.cite.tools.logging.LoggerService;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
|
@ -20,7 +20,7 @@ import org.springframework.stereotype.Component;
|
|||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class PropertyDefinitionFieldSetItemModelCommonModelBuilder extends BaseCommonModelBuilder<PropertyDefinitionFieldSetItemModel, PropertyDefinitionFieldSetItemEntity> {
|
||||
private final BuilderFactory builderFactory;
|
||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||
|
@ -66,8 +66,8 @@ public class PropertyDefinitionFieldSetItemModelCommonModelBuilder extends BaseC
|
|||
if (d.getFields() != null && !d.getFields().isEmpty()) {
|
||||
m.setFields(new HashMap<>());
|
||||
for (String key : d.getFields().keySet()){
|
||||
FieldEntity fieldEntity = fieldSetEntity != null ? fieldSetEntity.getFieldById(key).stream().findFirst().orElse(null) : null;
|
||||
m.getFields().put(key, this.builderFactory.builder(FieldCommonModelBuilder.class).useSharedStorage(useSharedStorage).authorize(this.authorize).withFieldEntity(fieldEntity).build(d.getFields().get(key)));
|
||||
FieldEntity fieldEntity = this.fieldSetEntity != null ? this.fieldSetEntity.getFieldById(key).stream().findFirst().orElse(null) : null;
|
||||
m.getFields().put(key, this.builderFactory.builder(FieldCommonModelBuilder.class).useSharedStorage(this.useSharedStorage).authorize(this.authorize).withFieldEntity(fieldEntity).build(d.getFields().get(key)));
|
||||
}
|
||||
}
|
||||
models.add(new CommonModelBuilderItemResponse<>(m, d));
|
||||
|
|
|
@ -12,12 +12,14 @@ import org.slf4j.LoggerFactory;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Component
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class DefaultValueCommonModelBuilder extends BaseCommonModelBuilder<DefaultValueModel, DefaultValueEntity> {
|
||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||
|
|
|
@ -20,31 +20,31 @@ public class FileTransformerRepository implements FileTransformerClient {
|
|||
|
||||
@Override
|
||||
public FileEnvelopeModel exportDmp(DmpModel dmpModel, String format) {
|
||||
return transformerClient.post().uri("/export/dmp", uriBuilder -> uriBuilder.queryParam("format", format).build()).bodyValue(dmpModel)
|
||||
return this.transformerClient.post().uri("/export/dmp", uriBuilder -> uriBuilder.queryParam("format", format).build()).bodyValue(dmpModel)
|
||||
.exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(FileEnvelopeModel.class)).block();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DmpModel importDmp(FileEnvelopeModel fileEnvelope) {
|
||||
return transformerClient.post().uri("/import/dmp").bodyValue(fileEnvelope)
|
||||
return this.transformerClient.post().uri("/import/dmp").bodyValue(fileEnvelope)
|
||||
.exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(DmpModel.class)).block();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileEnvelopeModel exportDescription(DescriptionModel descriptionModel, String format) {
|
||||
return transformerClient.post().uri("/export/description", uriBuilder -> uriBuilder.queryParam("format", format).build()).bodyValue(descriptionModel)
|
||||
return this.transformerClient.post().uri("/export/description", uriBuilder -> uriBuilder.queryParam("format", format).build()).bodyValue(descriptionModel)
|
||||
.exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(FileEnvelopeModel.class)).block();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DescriptionModel importDescription(FileEnvelopeModel fileEnvelope) {
|
||||
return transformerClient.post().uri("/import/description").bodyValue(fileEnvelope)
|
||||
return this.transformerClient.post().uri("/import/description").bodyValue(fileEnvelope)
|
||||
.exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(DescriptionModel.class)).block();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileTransformerConfiguration getConfiguration() {
|
||||
return transformerClient.get().uri("/formats")
|
||||
return this.transformerClient.get().uri("/formats")
|
||||
.exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(new ParameterizedTypeReference<FileTransformerConfiguration>() {})).block();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue