bug fixes
This commit is contained in:
parent
46e56111f0
commit
bc0d39a72f
|
@ -257,11 +257,11 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
|
|||
predicates.add(inClause);
|
||||
}
|
||||
if (this.dmpDescriptionTemplateQuery != null) {
|
||||
QueryContext<DmpDescriptionTemplateEntity, UUID> subQuery = this.applySubQuery(this.dmpDescriptionTemplateQuery, queryContext, UUID.class, DmpDescriptionTemplate._id);
|
||||
QueryContext<DmpDescriptionTemplateEntity, UUID> subQuery = this.applySubQuery(this.dmpDescriptionTemplateQuery, queryContext, UUID.class, dmpDescriptionTemplateEntityRoot -> dmpDescriptionTemplateEntityRoot.get(DmpDescriptionTemplateEntity._id));
|
||||
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionEntity._dmpDescriptionTemplateId)).value(subQuery.Query));
|
||||
}
|
||||
if (this.dmpQuery != null) {
|
||||
QueryContext<DmpEntity, UUID> subQuery = this.applySubQuery(this.dmpQuery, queryContext, UUID.class, Dmp._id);
|
||||
QueryContext<DmpEntity, UUID> subQuery = this.applySubQuery(this.dmpQuery, queryContext, UUID.class, dmpEntityRoot -> dmpEntityRoot.get(DmpEntity._id));
|
||||
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionEntity._dmpId)).value(subQuery.Query));
|
||||
}
|
||||
if (!predicates.isEmpty()) {
|
||||
|
|
|
@ -288,8 +288,8 @@ public class DmpQuery extends QueryBase<DmpEntity> {
|
|||
}
|
||||
|
||||
if (this.dmpDescriptionTemplateQuery != null) {
|
||||
QueryContext<DmpDescriptionTemplateEntity, UUID> subQuery = this.applySubQuery(this.dmpDescriptionTemplateQuery, queryContext, UUID.class, DmpDescriptionTemplate._dmp);
|
||||
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionEntity._dmpDescriptionTemplateId)).value(subQuery.Query));
|
||||
QueryContext<DmpDescriptionTemplateEntity, UUID> subQuery = this.applySubQuery(this.dmpDescriptionTemplateQuery, queryContext, UUID.class, dmpDescriptionTemplateEntityRoot -> dmpDescriptionTemplateEntityRoot.get(DmpDescriptionTemplateEntity._dmpId));
|
||||
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpEntity._id)).value(subQuery.Query));
|
||||
}
|
||||
if (!predicates.isEmpty()) {
|
||||
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||
|
|
|
@ -196,7 +196,7 @@ public class UserQuery extends QueryBase<UserEntity> {
|
|||
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(UserEntity._id)).value(userContactInfoSubquery));
|
||||
}
|
||||
if (this.userRoleQuery != null) {
|
||||
QueryContext<UserRoleEntity, UUID> subQuery = this.applySubQuery(this.userRoleQuery, queryContext, UUID.class, UserRole._user);
|
||||
QueryContext<UserRoleEntity, UUID> subQuery = this.applySubQuery(this.userRoleQuery, queryContext, UUID.class, userRoleEntityRoot -> userRoleEntityRoot.get(UserRoleEntity._userId));
|
||||
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(UserEntity._id)).value(subQuery.Query));
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ public class DmpLookup extends Lookup {
|
|||
private List<UUID> ids;
|
||||
|
||||
private List<UUID> excludedIds;
|
||||
private List<UUID> groupIds;
|
||||
|
||||
private List<IsActive> isActive;
|
||||
private List<DmpVersionStatus> versionStatuses;
|
||||
|
@ -104,10 +105,19 @@ public class DmpLookup extends Lookup {
|
|||
this.dmpDescriptionTemplateSubQuery = dmpDescriptionTemplateSubQuery;
|
||||
}
|
||||
|
||||
public List<UUID> getGroupIds() {
|
||||
return groupIds;
|
||||
}
|
||||
|
||||
public void setGroupIds(List<UUID> groupIds) {
|
||||
this.groupIds = groupIds;
|
||||
}
|
||||
|
||||
public DmpQuery enrich(QueryFactory queryFactory) {
|
||||
DmpQuery query = queryFactory.query(DmpQuery.class);
|
||||
if (this.like != null) query.like(this.like);
|
||||
if (this.ids != null) query.ids(this.ids);
|
||||
if (this.groupIds != null) query.groupIds(this.groupIds);
|
||||
if (this.excludedIds != null) query.excludedIds(this.excludedIds);
|
||||
if (this.accessTypes != null) query.accessTypes(this.accessTypes);
|
||||
if (this.isActive != null) query.isActive(this.isActive);
|
||||
|
@ -125,6 +135,7 @@ public class DmpLookup extends Lookup {
|
|||
DmpElasticQuery query = queryFactory.query(DmpElasticQuery.class);
|
||||
if (this.like != null) query.like(this.like);
|
||||
if (this.ids != null) query.ids(this.ids);
|
||||
if (this.groupIds != null) query.groupIds(this.groupIds);
|
||||
if (this.excludedIds != null) query.excludedIds(this.excludedIds);
|
||||
if (this.accessTypes != null) query.accessTypes(this.accessTypes);
|
||||
if (this.statuses != null) query.statuses(this.statuses);
|
||||
|
@ -141,6 +152,7 @@ public class DmpLookup extends Lookup {
|
|||
InnerObjectDmpElasticQuery query = queryFactory.query(InnerObjectDmpElasticQuery.class);
|
||||
if (this.like != null) query.like(this.like);
|
||||
if (this.ids != null) query.ids(this.ids);
|
||||
if (this.groupIds != null) query.groupIds(this.groupIds);
|
||||
if (this.excludedIds != null) query.excludedIds(this.excludedIds);
|
||||
if (this.accessTypes != null) query.accessTypes(this.accessTypes);
|
||||
if (this.statuses != null) query.statuses(this.statuses);
|
||||
|
|
|
@ -166,10 +166,10 @@ public class DescriptionServiceImpl implements DescriptionService {
|
|||
if (data == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), Description.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
if (!this.conventionService.hashValue(data.getUpdatedAt()).equals(model.getHash())) throw new MyValidationException(this.errors.getHashConflict().getCode(), this.errors.getHashConflict().getMessage());
|
||||
if (!data.getStatus().equals(model.getStatus())){
|
||||
if (data.getStatus() == DescriptionStatus.Finalized){
|
||||
if (data.getStatus().equals(DescriptionStatus.Finalized)){
|
||||
DmpEntity dmpEntity = this.entityManager.find(DmpEntity.class, data.getDmpId());
|
||||
if (dmpEntity == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{data.getDmpId(), DmpEntity.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
if(dmpEntity.getStatus() .equals(DmpStatus.Finalized)) throw new MyValidationException(this.errors.getDmpIsFinalized().getCode(), this.errors.getDmpIsFinalized().getMessage());
|
||||
if(!dmpEntity.getStatus().equals(DmpStatus.Draft)) throw new MyValidationException(this.errors.getDmpIsFinalized().getCode(), this.errors.getDmpIsFinalized().getMessage());
|
||||
}
|
||||
|
||||
data.setStatus(model.getStatus());
|
||||
|
|
|
@ -315,7 +315,7 @@
|
|||
<dependency>
|
||||
<groupId>gr.cite</groupId>
|
||||
<artifactId>data-tools</artifactId>
|
||||
<version>2.1.1</version>
|
||||
<version>2.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>gr.cite</groupId>
|
||||
|
|
|
@ -3,16 +3,20 @@ package eu.eudat;
|
|||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import com.fasterxml.jackson.databind.json.JsonMapper;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import eu.eudat.data.BaseEntity;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.domain.EntityScan;
|
||||
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
||||
@SpringBootApplication(scanBasePackages = {
|
||||
|
@ -31,9 +35,22 @@ public class EuDatApplication extends SpringBootServletInitializer {
|
|||
@Primary
|
||||
public ObjectMapper primaryObjectMapper() {
|
||||
return JsonMapper.builder().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
|
||||
.configure(SerializationFeature.WRITE_DATE_KEYS_AS_TIMESTAMPS, true)
|
||||
.serializationInclusion(JsonInclude.Include.NON_NULL)
|
||||
.addModule(new JavaTimeModule()).build();
|
||||
}
|
||||
// @Bean
|
||||
// public Jackson2ObjectMapperBuilder objectMapperBuilder() {
|
||||
// return new Jackson2ObjectMapperBuilder() {
|
||||
//
|
||||
// @Override
|
||||
// public void configure(ObjectMapper objectMapper) {
|
||||
// objectMapper.registerModule(new JavaTimeModule());
|
||||
// super.configure(objectMapper);
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
|
||||
|
|
Loading…
Reference in New Issue