Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workflow APIs #851

Open
wants to merge 47 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
c68a4d8
Update dependencies and modules
SenuDyl Mar 1, 2025
288bcce
Add workflow-engine api package
SenuDyl Mar 1, 2025
ade64be
Update copyright banner
SenuDyl Mar 1, 2025
1279723
Update API specification
SenuDyl Mar 1, 2025
6de1f7c
Update API specification with scopes
SenuDyl Mar 3, 2025
5752336
Update API specification
SenuDyl Mar 3, 2025
d7f270c
Update the copyright banner in the regenerated code
SenuDyl Mar 3, 2025
426f3d0
Add a new line at the end
SenuDyl Mar 3, 2025
5fd8ac7
Update the API spec with new endpoints
SenuDyl Mar 3, 2025
cbdbd32
Update the API spec
SenuDyl Mar 4, 2025
26bd58c
Regenerate the code after changine the specification
SenuDyl Mar 4, 2025
7a1438a
Implement methods for recently added API endpoints
SenuDyl Mar 4, 2025
760e523
Add new model for updating an association
SenuDyl Mar 4, 2025
06ad4b7
Add null checks in a function
SenuDyl Mar 4, 2025
c6e674c
Change package name from workflow-engine to workflow
SenuDyl Mar 5, 2025
b87a9d5
Change package name and add maven plugin
SenuDyl Mar 5, 2025
3c83660
Resolve formatting issues and create a factory object
SenuDyl Mar 5, 2025
4bd026d
Resolve formatting issues
SenuDyl Mar 5, 2025
6400666
Update exception handling and add a separate method for workflow update
SenuDyl Mar 5, 2025
2034cc8
Change package name
SenuDyl Mar 5, 2025
d3f9e6b
Add a new class to define error messages
SenuDyl Mar 5, 2025
d1cee68
Renamed workflow-engine.yaml
SenuDyl Mar 5, 2025
96915dd
Remove unnecessary properties from pom.xml file
SenuDyl Mar 6, 2025
3f193da
Remove unnecessary try-catch blocks
SenuDyl Mar 6, 2025
a20e3bb
Invoke corresponding service methods
SenuDyl Mar 6, 2025
42cf497
Remove unnecessary new lines and move private methods to the bottom
SenuDyl Mar 6, 2025
ac7f81f
Update the API Specification with new changes
SenuDyl Mar 9, 2025
5d3c6a4
Remove unnecessary files
SenuDyl Mar 9, 2025
8f5bfcd
Add new constants
SenuDyl Mar 9, 2025
65754f5
Remove unnecessary files and regenerate the code
SenuDyl Mar 9, 2025
8a9dc6a
Update the implementation logic according to the changes
SenuDyl Mar 9, 2025
49811bf
Update pom file with new file names and artifact ids
SenuDyl Mar 9, 2025
b2957d5
Improve formatting
SenuDyl Mar 9, 2025
5c0d4ea
Improve formatting and remove unwanted files
SenuDyl Mar 9, 2025
5a3a036
Change return type of some methods and update response
SenuDyl Mar 9, 2025
18f514f
Update dependencies
SenuDyl Mar 9, 2025
ab73c7d
Update dependencies
SenuDyl Mar 9, 2025
1569474
Update the API specification
SenuDyl Mar 12, 2025
b587550
Change a method name
SenuDyl Mar 12, 2025
47b8db6
Add class comments
SenuDyl Mar 12, 2025
b36e846
Change return types of some methods
SenuDyl Mar 12, 2025
9345fe6
Change payloads of several methods
SenuDyl Mar 12, 2025
4e6eedf
Improve formatting
SenuDyl Mar 12, 2025
04ae6ea
Regenerate the code after changing the specification
SenuDyl Mar 12, 2025
74e3254
Improve formatting and add class comments
SenuDyl Mar 17, 2025
1ee09d4
Update method names
SenuDyl Mar 17, 2025
24a1a3e
Add class comments
SenuDyl Mar 17, 2025
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
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
~ 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.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.workflow</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.3.84-SNAPSHOT</version>
</parent>

<artifactId>org.wso2.carbon.identity.api.server.workflow.common</artifactId>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.wso2.carbon.identity.workflow.impl.bps</groupId>
<artifactId>org.wso2.carbon.identity.workflow.mgt</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.workflow.impl.bps</groupId>
<artifactId>org.wso2.carbon.identity.workflow.impl</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
/*
* 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.workflow.common;

/**
* Common constants for workflow API.
*/
public class Constants {

public static final String WORKFLOW_PREFIX = "WF-";
public static final String APPROVAL_STEPS = "ApprovalSteps";
public static final String APPROVAL_STEP = "Step-";
public static final String TEMPLATE = "Template";
public static final String APPROVAL_TASK_SUBJECT = "ApprovalTaskSubject";
public static final String APPROVAL_TASK_DESCRIPTION = "ApprovalTaskDescription";
public static final String WORKFLOW_IMPLEMENTATION = "Workflowimpl";
public static final String WORKFLOW_NAME = "WorkflowName";

private Constants() {

}

/**
* Enum for error messages.
*/
public enum ErrorMessage {

// Client errors starting from 510xx.
ERROR_CODE_WORKFLOW_NOT_FOUND("51001", "Resource not found.",
"Unable to find a resource matching the provided workflow identifier %s."),
ERROR_CODE_ASSOCIATION_NOT_FOUND("51002", "Resource not found.",
"Unable to find a resource matching the provided workflow association identifier %s."),
ERROR_CODE_CLIENT_ERROR_ADDING_WORKFLOW("51003", "Unable to add workflow",
"Encountered an error while adding the workflow."),
ERROR_CODE_CLIENT_ERROR_UPDATING_WORKFLOW("51004", "Unable to update workflow",
"Encountered an error while updating the workflow for identifier %s."),
ERROR_CODE_CLIENT_ERROR_LISTING_WORKFLOWS("51005", "Unable to list existing workflows",
"Encountered an error while listing the workflows."),
ERROR_CODE_CLIENT_ERROR_LISTING_ASSOCIATIONS("51006", "Unable to list existing workflow " +
"associations", "Encountered an error while listing the workflow associations."),
ERROR_CODE_CLIENT_ERROR_ADDING_ASSOCIATION("51007", "Unable to add workflow association",
"Encountered an error while adding the workflow association."),
ERROR_CODE_CLIENT_ERROR_UPDATING_ASSOCIATION("51008", "Unable to update workflow association",
"Encountered an error while updating the workflow association."),

// Server Errors starting from 500xx.
ERROR_CODE_ERROR_LISTING_WORKFLOWS("50020", "Unable to list existing workflows",
"Server encountered an error while listing the workflows."),
ERROR_CODE_ERROR_REMOVING_WORKFLOW("50021", "Unable to delete the workflow",
"Server encountered an error while deleting " +
"the workflow for the identifier %s."),
ERROR_CODE_ERROR_RETRIEVING_WORKFLOW("50023", "Unable to retrieve workflow.",
"Server encountered an error while " +
"retrieving the workflow for identifier %s."),
ERROR_CODE_ERROR_ADDING_WORKFLOW("50024", "Unable to add workflow",
"Server encountered an error while adding the workflow."),
ERROR_CODE_ERROR_UPDATING_WORKFLOW("50025", "Unable to update workflow",
"Server encountered an error while updating the " +
"workflow for identifier %s."),
ERROR_CODE_ERROR_ADDING_ASSOCIATION("50026", "Unable to add workflow association",
"Server encountered an error while adding " +
"the workflow association."),
ERROR_CODE_ERROR_LISTING_ASSOCIATIONS("50027", "Unable to list existing workflow associations",
"Server encountered an error while " +
"listing the workflow associations."),
ERROR_CODE_ERROR_REMOVING_ASSOCIATION("50028", "Unable to delete the workflow association",
"Server encountered an error while deleting " +
"the workflow association."),
ERROR_CODE_ERROR_RETRIEVING_ASSOCIATION("50029", "Unable to retrieve workflow association.",
"Server encountered an error while retrieving " +
"the workflow association for identifier %s."),
ERROR_CODE_ERROR_UPDATING_ASSOCIATION("50030", "Unable to update workflow association",
"Server encountered an error while " +
"updating the workflow association.");

private final String code;
private final String message;
private final String description;

ErrorMessage(String code, String message, String description) {

this.code = code;
this.message = message;
this.description = description;
}

public String getCode() {

return WORKFLOW_PREFIX + code;
}

public String getMessage() {

return message;
}

public String getDescription() {

return description;
}

@Override
public String toString() {

return code + " | " + message;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* 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.workflow.common;

import org.wso2.carbon.identity.workflow.impl.WorkflowImplServiceImpl;
import org.wso2.carbon.identity.workflow.mgt.WorkflowManagementService;
import org.wso2.carbon.identity.workflow.mgt.WorkflowManagementServiceImpl;

/**
* Service holder class for workflow management.
*/
public class WorkflowServiceHolder {

private final static WorkflowManagementService service = new WorkflowManagementServiceImpl();
private final static WorkflowImplServiceImpl implService = new WorkflowImplServiceImpl();

public static WorkflowManagementService getWorkflowManagementService() {

return service;
}

public static WorkflowImplServiceImpl getWorkflowImplService() {

return implService;
}
}
Loading