Skip to content

Commit

Permalink
Merge branch 'develop' into examples
Browse files Browse the repository at this point in the history
  • Loading branch information
axlbonnet committed Oct 4, 2024
2 parents f376f01 + 2030acb commit 8490cdc
Show file tree
Hide file tree
Showing 95 changed files with 4,892 additions and 999 deletions.
12 changes: 0 additions & 12 deletions vip-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,6 @@ knowledge of the CeCILL-B license and that you accept its terms.
<version>${keycloak.version}</version>
</dependency>

<!-- Json mapping library -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>${jackson.version}</version>
</dependency>

<!-- Validation implementation -->
<dependency>
<groupId>org.hibernate</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,10 @@ public void addCorsMappings(CorsRegistry registry) {
}

/*
to verify that the proxy ist still valid each day
to verify that the proxy is still valid each day
*/
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(vipConfigurer);
}

@Bean
public ObjectMapper objectMapper() {
return Jackson2ObjectMapperBuilder.json().build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.env.Environment;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.stereotype.Service;

@Service
Expand Down Expand Up @@ -60,6 +61,9 @@ private User signin(String username, String password) throws ApiException {
logger.info("Credentials OK for " + username);
return user;
} catch (BusinessException e) {
if (e.getMessage().startsWith("Authentication failed")) {
throw new ApiException(ApiException.ApiError.BAD_CREDENTIALS);
}
throw new ApiException("Authentication Error", e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,7 @@ public String initExecution(Execution execution)
}
String resultsLocation = execution.getResultsLocation();
if (resultsLocation != null) {
inputMap.put(CoreConstants.RESULTS_DIRECTORY_PARAM_NAME,
resultsLocation);
inputMap.put(CoreConstants.RESULTS_DIRECTORY_PARAM_NAME, resultsLocation);
}

checkInputExecNameIsValid(execution.getName());
Expand Down Expand Up @@ -368,39 +367,35 @@ private String initExecution(String pipelineId,
// Check that all pipeline inputs are present
Pipeline p = pipelineBusiness.getPipelineWithResultsDirectory(pipelineId);
for (PipelineParameter pp : p.getParameters()) {
// always true on vip
if (pp.isReturnedValue()) {
continue;
}
// pp is an input
if (!(inputValues.get(pp.getName()) == null)) {
// ok if input is present
if ( inputValues.get(pp.getName()) != null) {
continue;
}
// pp is an empty input
// then ok if input has a default value (and we set it)
// beware : with gwendia, optional always have an defaultValue (either defined or No_Value_Provided)
if (pp.getDefaultValue() != null) {
inputValues.put(pp.getName(), pp.getDefaultValue().toString());
continue;
}
// pp is an empty input with no default value
// then ok if it is optional
// beware, with gwendia it should not be possible to enter this case (see previous condition)
if (pp.isOptional()) {
inputValues.put("no", pp.getDefaultValue().toString());//that's how optional values are handled in VIP
continue;
}
// pp is an empty input with no default value and it is not optional
logger.error("Error initialising {}, missing {} parameter",
pipelineId, pp.getName());
throw new ApiException("Parameter " + pp.getName() + " is empty while it is not optional and it has no default value.");
// error : pp is an empty input with no default value and it is not optional
logger.error("Error initialising {}, missing {} parameter", pipelineId, pp.getName());
throw new ApiException(ApiException.ApiError.INPUT_FIELD_MISSING, pp.getName());
}

boolean hasInputResultsDirectory =
inputValues.containsKey(
CoreConstants.RESULTS_DIRECTORY_PARAM_NAME);

boolean hasPipelineResultsDirectory =
p.getParameters().stream().anyMatch(
param ->
boolean inputsContainsResultsDirectoryInput = inputValues.containsKey(CoreConstants.RESULTS_DIRECTORY_PARAM_NAME);
boolean pipelineHasResultsDirectoryInput = p.getParameters().stream().anyMatch(param ->
param.getName().equals(CoreConstants.RESULTS_DIRECTORY_PARAM_NAME));

if (hasInputResultsDirectory && !hasPipelineResultsDirectory) {
if (inputsContainsResultsDirectoryInput && ! pipelineHasResultsDirectoryInput) {
logger.error("Missing results-directory for {}", pipelineId);
throw new ApiException(
"Input has parameter results-directory but it is not defined in pipeline.");
Expand Down
Loading

0 comments on commit 8490cdc

Please sign in to comment.