forked from wso2/carbon-identity-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add action invocation status INCOMPLETE.
- Loading branch information
1 parent
b242fe4
commit c2b8c08
Showing
8 changed files
with
264 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
...a/org/wso2/carbon/identity/action/execution/model/ActionInvocationIncompleteResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/* | ||
* 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.action.execution.model; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | ||
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* This class is used to represent the incomplete response of an action invocation. | ||
* This response will contain the list of operations that need to be performed. | ||
*/ | ||
@JsonDeserialize(builder = ActionInvocationIncompleteResponse.Builder.class) | ||
public class ActionInvocationIncompleteResponse implements ActionInvocationResponse.APIResponse { | ||
|
||
private final ActionInvocationResponse.Status actionStatus; | ||
|
||
private final List<PerformableOperation> operations; | ||
|
||
private ActionInvocationIncompleteResponse(Builder builder) { | ||
|
||
this.actionStatus = builder.actionStatus; | ||
this.operations = builder.operations; | ||
} | ||
|
||
@Override | ||
public ActionInvocationResponse.Status getActionStatus() { | ||
|
||
return actionStatus; | ||
} | ||
|
||
public List<PerformableOperation> getOperations() { | ||
|
||
return operations; | ||
} | ||
|
||
/** | ||
* This class is used to build the {@link ActionInvocationIncompleteResponse}. | ||
*/ | ||
@JsonPOJOBuilder(withPrefix = "") | ||
public static class Builder { | ||
|
||
private ActionInvocationResponse.Status actionStatus; | ||
private List<PerformableOperation> operations; | ||
|
||
@JsonProperty("actionStatus") | ||
public Builder actionStatus(ActionInvocationResponse.Status actionStatus) { | ||
|
||
this.actionStatus = actionStatus; | ||
return this; | ||
} | ||
|
||
@JsonProperty("operations") | ||
public Builder operations(@JsonProperty("operations") List<PerformableOperation> operations) { | ||
|
||
this.operations = operations; | ||
return this; | ||
} | ||
|
||
public ActionInvocationIncompleteResponse build() { | ||
|
||
if (this.actionStatus == null) { | ||
throw new IllegalArgumentException("actionStatus must not be null."); | ||
} | ||
|
||
if (!ActionInvocationResponse.Status.INCOMPLETE.equals(actionStatus)) { | ||
throw new IllegalArgumentException("actionStatus must be INCOMPLETE."); | ||
} | ||
|
||
if (this.operations == null) { | ||
throw new IllegalArgumentException("operations must not be null."); | ||
} | ||
|
||
return new ActionInvocationIncompleteResponse(this); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...n.execution/src/main/java/org/wso2/carbon/identity/action/execution/model/Incomplete.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* 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.action.execution.model; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* This interface models the Incomplete status. | ||
* If the downstream extension needs to compose the responses with INCOMPLETE status and communicate it back, | ||
* this class can be used by consumers to implement the model for that incomplete response. | ||
*/ | ||
public class Incomplete { | ||
|
||
private final List<PerformableOperation> performableOperations; | ||
|
||
public Incomplete(List<PerformableOperation> incompleteReasons) { | ||
|
||
this.performableOperations = incompleteReasons; | ||
} | ||
|
||
public List<PerformableOperation> getPerformableOperations() { | ||
|
||
return performableOperations; | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
...ution/src/main/java/org/wso2/carbon/identity/action/execution/model/IncompleteStatus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Copyright (c) 2024, 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.action.execution.model; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* This class models the IncompleteStatus. | ||
*/ | ||
public class IncompleteStatus extends ActionExecutionStatus<Incomplete> { | ||
|
||
private final Incomplete incomplete; | ||
|
||
private IncompleteStatus(Builder builder) { | ||
|
||
this.status = Status.INCOMPLETE; | ||
this.incomplete = builder.incomplete; | ||
this.responseContext = builder.responseContext; | ||
} | ||
|
||
@Override | ||
public Incomplete getResponse() { | ||
|
||
return incomplete; | ||
} | ||
|
||
/** | ||
* This class is the builder for SuccessStatus. | ||
*/ | ||
public static class Builder { | ||
|
||
private Incomplete incomplete; | ||
private Map<String, Object> responseContext; | ||
|
||
public Builder incomplete(Incomplete incomplete) { | ||
|
||
this.incomplete = incomplete; | ||
return this; | ||
} | ||
|
||
public Builder responseContext(Map<String, Object> responseContext) { | ||
|
||
this.responseContext = responseContext; | ||
return this; | ||
} | ||
|
||
public IncompleteStatus build() { | ||
|
||
return new IncompleteStatus(this); | ||
} | ||
} | ||
} |