Skip to content
Snippets Groups Projects
Commit b8e7e7b0 authored by ThanKarab's avatar ThanKarab
Browse files

Removed uneccessary code.

parent a37f8670
No related branches found
No related tags found
1 merge request!8Dev merge middleware
......@@ -13,12 +13,10 @@ import eu.hbp.mip.controllers.retrofit.RetrofitClientInstance;
import eu.hbp.mip.dto.ErrorResponse;
import eu.hbp.mip.dto.GalaxyWorkflowResult;
import eu.hbp.mip.dto.PostWorkflowToGalaxyDtoResponse;
import eu.hbp.mip.helpers.LogHelper;
import eu.hbp.mip.model.*;
import eu.hbp.mip.repositories.ExperimentRepository;
import eu.hbp.mip.repositories.ModelRepository;
import eu.hbp.mip.utils.HTTPUtil;
import eu.hbp.mip.utils.JWTUtil;
import eu.hbp.mip.utils.UserActionLogging;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -300,7 +298,7 @@ public class ExperimentApi {
}
}
if(!resultFound) { // If there is no visible result
if (!resultFound) { // If there is no visible result
UserActionLogging.LogAction("Get workflow experiment", "No visible result");
experiment.setResult(new ErrorResponse("The workflow has no visible result.", "500").toString());
experiment.setHasError(true);
......@@ -333,7 +331,7 @@ public class ExperimentApi {
}
}
if(!failedJobFound) { // If there is no visible failed job
if (!failedJobFound) { // If there is no visible failed job
UserActionLogging.LogAction("Get workflow experiment", "No failed result");
experiment.setResult(new ErrorResponse("The workflow has no failed result.", "500").toString());
experiment.setHasError(true);
......@@ -477,20 +475,20 @@ public class ExperimentApi {
/**
* @param jobId the id of the workflow job that failed
* @return the error that was produced or null if an error occurred
* @return the error that was produced or null if an error occurred
*/
public String getWorkflowJobError(String jobId){
public String getWorkflowJobError(String jobId) {
UserActionLogging.LogAction("Get workflow job error", " jobId : " + jobId);
RetroFitGalaxyClients service = RetrofitClientInstance.getRetrofitInstance().create(RetroFitGalaxyClients.class);
Call<Object> callError = service.getErrorMessageOfWorkflowFromGalaxy(jobId,galaxyApiKey);
Call<Object> callError = service.getErrorMessageOfWorkflowFromGalaxy(jobId, galaxyApiKey);
String fullError = null;
String returnError = null;
try {
Response<Object> response = callError.execute();
if(response.code() >= 400){
UserActionLogging.LogAction("Get workflow job error","Response code: "
if (response.code() >= 400) {
UserActionLogging.LogAction("Get workflow job error", "Response code: "
+ response.code() + " with body: " + (response.errorBody() != null ? response.errorBody().string() : " "));
return null;
}
......@@ -500,19 +498,19 @@ public class ExperimentApi {
JsonElement jsonElement = new JsonParser().parse(jsonString);
JsonObject rootObject = jsonElement.getAsJsonObject();
fullError = rootObject.get("stderr").getAsString();
UserActionLogging.LogAction("Get workflow job error","Error: " + fullError);
UserActionLogging.LogAction("Get workflow job error", "Error: " + fullError);
String[] arrOfStr = fullError.split("ValueError", 0);
String specError = arrOfStr[arrOfStr.length-1];
String specError = arrOfStr[arrOfStr.length - 1];
returnError = specError.substring(1);
UserActionLogging.LogAction("Get workflow job error","Parsed Error: " + returnError);
UserActionLogging.LogAction("Get workflow job error", "Parsed Error: " + returnError);
} catch (IOException e) {
UserActionLogging.LogAction("Get workflow job error","Exception: " + e.getMessage());
UserActionLogging.LogAction("Get workflow job error", "Exception: " + e.getMessage());
return null;
}
UserActionLogging.LogAction("Get workflow job error","Completed successfully!");
UserActionLogging.LogAction("Get workflow job error", "Completed successfully!");
return returnError;
}
......
This diff is collapsed.
......@@ -64,10 +64,7 @@ public class MethodsApi {
final GalaxyInstance instance = GalaxyInstanceFactory.get(galaxyUrl, galaxyApiKey);
final WorkflowsClient workflowsClient = instance.getWorkflowsClient();
List<Workflow> workflowList = new ArrayList<>();
for(Workflow workflow : workflowsClient.getWorkflows()) {
workflowList.add(workflow);
}
List<Workflow> workflowList = new ArrayList<>(workflowsClient.getWorkflows());
List<WorkflowDetails> workflowDetailsList = new ArrayList<>();
for(Workflow workflow : workflowList){
......
/*
* Developed by Kechagias Konstantinos.
* Copyright (c) 2019. MIT License
*/
package eu.hbp.mip.dto;
public class JwtResponse {
private String token;
private String type = "Bearer";
public JwtResponse(String accessToken) {
this.token = accessToken;
}
public String getAccessToken() {
return token;
}
public void setAccessToken(String accessToken) {
this.token = accessToken;
}
public String getTokenType() {
return type;
}
public void setTokenType(String tokenType) {
this.type = tokenType;
}
}
\ No newline at end of file
/*
* Developed by Kechagias Konstantinos.
* Copyright (c) 2019. MIT License
*/
package eu.hbp.mip.dto;
import org.hibernate.validator.constraints.NotBlank;
import javax.validation.constraints.Size;
public class LoginDto {
@NotBlank
@Size(min=3, max = 60)
private String username;
@NotBlank
@Size(min = 6, max = 40)
private String password;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
/*
* Developed by Kechagias Konstantinos.
* Copyright (c) 2019. MIT License
*/
package eu.hbp.mip.dto;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.Set;
public class SignUpDto {
@NotBlank
@Size(min = 3, max = 50)
private String name;
@NotBlank
@Size(min = 3, max = 50)
private String username;
@NotBlank
@Size(max = 60)
@Email
private String email;
private Set<String> role;
@NotBlank
@Size(min = 6, max = 40)
private String password;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Set<String> getRole() {
return this.role;
}
public void setRole(Set<String> role) {
this.role = role;
}
}
/*
* Developed by Kechagias Konstantinos.
* Copyright (c) 2019. MIT License
*/
package eu.hbp.mip.dto;
public class StringDtoResponse {
private String response;
public StringDtoResponse() {
}
public StringDtoResponse(String response) {
this.response = response;
}
public String getResponse() {
return response;
}
public void setResponse(String response) {
this.response = response;
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment