Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
public class FlowExecutionResponse {

private String flowId;
private String flowType;
private String flowStatus;

@XmlType(name="TypeEnum")
Expand Down Expand Up @@ -92,6 +93,27 @@ public void setFlowId(String flowId) {
this.flowId = flowId;
}

/**
* Unique identifier to identify the flow type
**/
public FlowExecutionResponse flowType(String flowType) {

this.flowType = flowType;
return this;
}

@ApiModelProperty(example = "REGISTRATION", required = true, value = "Unique identifier to identify the flow type")
@JsonProperty("flowType")
@Valid
@NotNull(message = "Property flowType cannot be null.")

public String getFlowType() {
return flowType;
}
public void setFlowType(String flowType) {
this.flowType = flowType;
}

/**
**/
public FlowExecutionResponse flowStatus(String flowStatus) {
Expand Down Expand Up @@ -163,14 +185,15 @@ public boolean equals(java.lang.Object o) {
}
FlowExecutionResponse flowExecutionResponse = (FlowExecutionResponse) o;
return Objects.equals(this.flowId, flowExecutionResponse.flowId) &&
Objects.equals(this.flowType, flowExecutionResponse.flowType) &&
Objects.equals(this.flowStatus, flowExecutionResponse.flowStatus) &&
Objects.equals(this.type, flowExecutionResponse.type) &&
Objects.equals(this.data, flowExecutionResponse.data);
}

@Override
public int hashCode() {
return Objects.hash(flowId, flowStatus, type, data);
return Objects.hash(flowId, flowType, flowStatus, type, data);
}

@Override
Expand All @@ -180,6 +203,7 @@ public String toString() {
sb.append("class FlowExecutionResponse {\n");

sb.append(" flowId: ").append(toIndentedString(flowId)).append("\n");
sb.append(" flowType: ").append(toIndentedString(flowType)).append("\n");
sb.append(" flowStatus: ").append(toIndentedString(flowStatus)).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" data: ").append(toIndentedString(data)).append("\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public FlowExecutionResponse processFlowExecution(FlowExecutionRequest flowExecu

return flowExecutionResponse
.flowId(flowExecutionStep.getFlowId())
.flowType(flowExecutionStep.getFlowType())
.flowStatus(flowExecutionStep.getFlowStatus())
.type(FlowExecutionResponse.TypeEnum.valueOf(flowExecutionStep.getStepType()))
.data(Utils.convertToData(flowExecutionStep.getData(), flowExecutionStep.getStepType()));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.wso2.carbon.identity.api.server.flow.execution.v1.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import org.wso2.carbon.identity.api.server.common.error.ErrorDTO;

/**
* Flow execution error DTO for the flow execution API related error responses.
*/
public class FlowExecutionErrorDTO extends ErrorDTO {

private static final long serialVersionUID = 6169725164223318439L;
private String flowType = null;

public FlowExecutionErrorDTO() {

super();
}

public FlowExecutionErrorDTO(ErrorDTO errorDTO) {

this.setCode(errorDTO.getCode());
this.setMessage(errorDTO.getMessage());
this.setDescription(errorDTO.getDescription());
this.setRef(errorDTO.getRef());
}

@JsonProperty("flowType")
public String getFlowType() {

return flowType;
}

public void setFlowType(String flowType) {

this.flowType = flowType;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.identity.api.server.common.error.APIError;
import org.wso2.carbon.identity.api.server.common.error.ErrorDTO;
import org.wso2.carbon.identity.api.server.flow.execution.common.FlowExecutionServiceHolder;
import org.wso2.carbon.identity.api.server.flow.execution.v1.Component;
import org.wso2.carbon.identity.api.server.flow.execution.v1.Data;
import org.wso2.carbon.identity.api.server.flow.execution.v1.FlowExecutionRequest;
import org.wso2.carbon.identity.api.server.flow.execution.v1.constants.FlowExecutionEndpointConstants;
import org.wso2.carbon.identity.api.server.flow.execution.v1.model.FlowExecutionErrorDTO;
import org.wso2.carbon.identity.application.common.model.Property;
import org.wso2.carbon.identity.core.util.IdentityTenantUtil;
import org.wso2.carbon.identity.flow.execution.engine.exception.FlowEngineClientException;
Expand Down Expand Up @@ -88,9 +88,9 @@ private Utils() {
* @return APIError object.
*/
public static APIError handleException(Response.Status status, String errorCode,
String message, String description) {
String message, String description, String flowType) {

return new APIError(status, getError(errorCode, message, description));
return new APIError(status, getError(errorCode, message, description, flowType));
}

/**
Expand All @@ -111,7 +111,7 @@ public static APIError handleFlowException(FlowEngineException e) {
String errorCode = e.getErrorCode();
errorCode = errorCode.contains(ERROR_CODE_DELIMITER) ? errorCode :
FlowExecutionEndpointConstants.REGISTRATION_FLOW_PREFIX + errorCode;
return handleException(status, errorCode, e.getMessage(), e.getDescription());
return handleException(status, errorCode, e.getMessage(), e.getDescription(), e.getFlowType());
}

/**
Expand All @@ -132,15 +132,15 @@ public static APIError handleFlowException(FlowEngineException e, String tenantD
!isShowUsernameUnavailabilityEnabled(tenantDomain)) {
return handleException(status, ERROR_CODE_INVALID_USER_INPUT.getCode(),
ERROR_CODE_INVALID_USER_INPUT.getMessage(),
ERROR_CODE_INVALID_USER_INPUT.getDescription());
ERROR_CODE_INVALID_USER_INPUT.getDescription(), e.getFlowType());
}
} else {
LOG.error(e.getMessage(), e);
}
// handle NPE when confirmation code expired
errorCode = errorCode.contains(ERROR_CODE_DELIMITER) ? errorCode :
FlowExecutionEndpointConstants.REGISTRATION_FLOW_PREFIX + errorCode;
return handleException(status, errorCode, e.getMessage(), e.getDescription());
return handleException(status, errorCode, e.getMessage(), e.getDescription(), e.getFlowType());
}

/**
Expand All @@ -151,12 +151,14 @@ public static APIError handleFlowException(FlowEngineException e, String tenantD
* @param errorDescription Error description.
* @return A generic error with the specified details.
*/
public static ErrorDTO getError(String errorCode, String errorMessage, String errorDescription) {
public static FlowExecutionErrorDTO getError(String errorCode, String errorMessage, String errorDescription,
String flowType) {

ErrorDTO error = new ErrorDTO();
FlowExecutionErrorDTO error = new FlowExecutionErrorDTO();
error.setCode(errorCode);
error.setMessage(errorMessage);
error.setDescription(errorDescription);
error.setFlowType(flowType);
return error;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,18 @@ components:
type: object
required:
- flowId
- flowType
- flowStatus
- type
properties:
flowId:
type: string
description: Unique identifier for the flow execution
example: 3fa85f64-5717-4562-b3fc-2c963f66afa6
flowType:
type: string
description: Unique identifier to identify the flow type
example: REGISTRATION
flowStatus:
type: string
example: INCOMPLETE
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@
<maven.buildnumber.plugin.version>1.4</maven.buildnumber.plugin.version>
<org.apache.felix.annotations.version>1.2.4</org.apache.felix.annotations.version>
<identity.governance.version>1.11.103</identity.governance.version>
<carbon.identity.framework.version>7.8.466</carbon.identity.framework.version>
<carbon.identity.framework.version>7.8.476</carbon.identity.framework.version>
<maven.findbugsplugin.version>3.0.5</maven.findbugsplugin.version>
<findsecbugs-plugin.version>1.12.0</findsecbugs-plugin.version>
<maven.checkstyleplugin.excludes>**/gen/**/*</maven.checkstyleplugin.excludes>
Expand Down