Fixed hub validation issue
This commit is contained in:
@@ -139,7 +139,7 @@ public class ApplicationDao {
|
||||
}
|
||||
formService.validateFormField(applicationRequestBean.getFormFields(),applicationEntity,formEntity);
|
||||
ApplicationFormEntity applicationFormEntity = getApplicationFormOrCreate(formEntity, applicationEntity);
|
||||
createOrUpdateMultipleFormFields(applicationRequestBean.getFormFields(), applicationFormEntity,formEntity);
|
||||
createOrUpdateMultipleFormFields(applicationRequestBean.getFormFields(), applicationFormEntity, formEntity);
|
||||
return getApplicationById(applicationEntity.getId(),formEntity.getId());
|
||||
}
|
||||
public void validateDelegation(UserEntity user, CompanyEntity company) {
|
||||
@@ -288,7 +288,7 @@ public class ApplicationDao {
|
||||
|
||||
log.info("Fetching applications for RoleType: {}", userEntity.getRoleEntity().getRoleType());
|
||||
|
||||
Specification<ApplicationEntity> spec = search(userEntity.getId(), callId, companyId,status);
|
||||
Specification<ApplicationEntity> spec = search(userEntity, callId, companyId,status);
|
||||
|
||||
List<ApplicationEntity> applicationEntities = applicationRepository.findAll(spec);
|
||||
|
||||
@@ -298,12 +298,12 @@ public class ApplicationDao {
|
||||
}
|
||||
|
||||
|
||||
private Specification<ApplicationEntity> search(Long userId, Long callId, Long companyId,String status) {
|
||||
private Specification<ApplicationEntity> search(UserEntity userEntity, Long callId, Long companyId,String status) {
|
||||
return (root, query, builder) -> {
|
||||
Boolean isBeneficiary = validator.checkIsBeneficiary();
|
||||
Predicate predicate = builder.isFalse(root.get("isDeleted"));
|
||||
if (isBeneficiary) {
|
||||
predicate = builder.and(predicate, builder.equal(root.get("userId"), userId));
|
||||
predicate = builder.and(predicate, builder.equal(root.get("userId"), userEntity.getId()));
|
||||
}
|
||||
if (callId != null) {
|
||||
predicate = builder.and(predicate, builder.equal(root.get("call").get("id"), callId));
|
||||
@@ -314,7 +314,7 @@ public class ApplicationDao {
|
||||
if (status != null) {
|
||||
predicate = builder.and(predicate, builder.equal(root.get("status"), status));
|
||||
}
|
||||
|
||||
predicate = builder.and(predicate, builder.equal(root.get("hubId"), userEntity.getHub().getId()));
|
||||
return predicate;
|
||||
};
|
||||
}
|
||||
@@ -601,7 +601,7 @@ public class ApplicationDao {
|
||||
throw new CustomValidationException(Status.BAD_REQUEST,Translator.toLocale(GepafinConstant.APPLICATION_ALREADY_IN_PREVIOUS_STATUS));
|
||||
}
|
||||
if (status.equals(ApplicationStatusTypeEnum.SUBMIT) && Boolean.TRUE.equals(applicationEntity.getStatus().equals(ApplicationStatusTypeEnum.READY.getValue()))) {
|
||||
callService.validatePublishedCall(applicationEntity.getCall().getId());
|
||||
callService.validatePublishedCall(applicationEntity.getCall().getId(), userEntity.getHub().getId());
|
||||
Long protocolNumber = getProtocolNumber(userEntity.getHub());
|
||||
ProtocolEntity protocolEntity = createProtocolEntity(applicationEntity,protocolNumber, userEntity.getHub().getId());
|
||||
applicationEntity.setProtocol(protocolEntity);
|
||||
|
||||
Reference in New Issue
Block a user