From c68a4d8f02fcaaa74dcc2e48fcdefb4c425fb399 Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Sat, 1 Mar 2025 10:40:54 +0530 Subject: [PATCH 01/47] Update dependencies and modules --- pom.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pom.xml b/pom.xml index 6e531e31db..ff5b79e5cc 100644 --- a/pom.xml +++ b/pom.xml @@ -247,6 +247,16 @@ <version>${identity.governance.version}</version> <scope>provided</scope> </dependency> + <dependency> + <groupId>org.wso2.carbon.identity.workflow.impl.bps</groupId> + <artifactId>org.wso2.carbon.identity.workflow.impl</artifactId> + <version>${workflow.imple.bps.version}</version> + </dependency> + <dependency> + <groupId>org.wso2.carbon.identity.workflow.impl.bps</groupId> + <artifactId>org.wso2.carbon.identity.workflow.mgt</artifactId> + <version>${workflow.imple.bps.version}</version> + </dependency> <dependency> <groupId>org.wso2.carbon.identity.server.api</groupId> <artifactId>org.wso2.carbon.identity.api.server.common</artifactId> @@ -878,6 +888,7 @@ <org.wso2.carbon.event.publisher.version>5.2.61</org.wso2.carbon.event.publisher.version> <identity.branding.preference.management.version>1.1.18</identity.branding.preference.management.version> <apache.felix.scr.ds.annotations.version>1.2.4</apache.felix.scr.ds.annotations.version> + <workflow.imple.bps.version>5.5.16-SNAPSHOT</workflow.imple.bps.version> <!--<maven.checkstyleplugin.excludes>**/gen/**/*</maven.checkstyleplugin.excludes>--> @@ -937,6 +948,7 @@ <module>components/org.wso2.carbon.identity.api.server.action.management</module> <module>components/org.wso2.carbon.identity.api.server.notification.template</module> <module>components/org.wso2.carbon.identity.api.server.rule.metadata</module> + <module>components/org.wso2.carbon.identity.api.server.workflow.engine</module> </modules> </project> From 288bcce5b7459b0b304311dcfa3dfe44d835d918 Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Sat, 1 Mar 2025 10:54:22 +0530 Subject: [PATCH 02/47] Add workflow-engine api package --- .../pom.xml | 27 + .../engine/common/WorkflowServiceHolder.java | 15 + .../pom.xml | 175 +++++ .../engine/v1/WorkflowAssociationsApi.java | 141 ++++ .../v1/WorkflowAssociationsApiService.java | 43 ++ .../engine/v1/WorkflowEnginesApi.java | 66 ++ .../engine/v1/WorkflowEnginesApiService.java | 35 + .../workflow/engine/v1/WorkflowsApi.java | 165 ++++ .../engine/v1/WorkflowsApiService.java | 45 ++ .../workflow/engine/v1/dto/ErrorDTO.java | 110 +++ .../engine/v1/dto/WorkFlowEngineDTO.java | 114 +++ ...WorkflowAssociationsApiServiceFactory.java | 32 + .../WorkflowEnginesApiServiceFactory.java | 32 + .../factories/WorkflowsApiServiceFactory.java | 32 + .../engine/v1/model/ActionStatus.java | 64 ++ .../engine/v1/model/DetailedWorkflow.java | 215 ++++++ .../v1/model/DetailedWorkflowTemplate.java | 154 ++++ .../workflow/engine/v1/model/Error.java | 165 ++++ .../engine/v1/model/OptionDetails.java | 119 +++ .../workflow/engine/v1/model/Status.java | 99 +++ .../engine/v1/model/WorkflowAssociation.java | 187 +++++ .../v1/model/WorkflowAssociationCreation.java | 195 +++++ .../engine/v1/model/WorkflowCreation.java | 217 ++++++ .../engine/v1/model/WorkflowEngine.java | 167 ++++ .../engine/v1/model/WorkflowSummary.java | 187 +++++ .../engine/v1/model/WorkflowTemplate.java | 132 ++++ .../v1/model/WorkflowTemplateParameters.java | 130 ++++ .../engine/v1/core/WorkFLowEngineService.java | 71 ++ .../v1/core/WorkflowEngineConstants.java | 68 ++ .../engine/v1/core/WorkflowService.java | 482 ++++++++++++ .../core/function/BPSProfilesToExternal.java | 41 + .../v1/factories/WorkflowServiceFactory.java | 34 + .../WorkflowAssociationsApiServiceImpl.java | 69 ++ .../impl/WorkflowEnginesApiServiceImpl.java | 35 + .../v1/impl/WorkflowsApiServiceImpl.java | 76 ++ .../src/main/resources/workflow-engine.yaml | 718 ++++++++++++++++++ .../pom.xml | 40 + 37 files changed, 4697 insertions(+) create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.api.server.workflow.engine.common/pom.xml create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.api.server.workflow.engine.common/src/main/java/org/wso2/carbon/identity/api/server/workflow/engine/common/WorkflowServiceHolder.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/pom.xml create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowAssociationsApi.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowAssociationsApiService.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowEnginesApi.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowEnginesApiService.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowsApi.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowsApiService.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/dto/ErrorDTO.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/dto/WorkFlowEngineDTO.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowAssociationsApiServiceFactory.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowEnginesApiServiceFactory.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowsApiServiceFactory.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/ActionStatus.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/DetailedWorkflow.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/DetailedWorkflowTemplate.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/Error.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/OptionDetails.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/Status.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociation.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociationCreation.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowCreation.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowEngine.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowSummary.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowTemplate.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowTemplateParameters.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkFLowEngineService.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkflowEngineConstants.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkflowService.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/function/BPSProfilesToExternal.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowServiceFactory.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowAssociationsApiServiceImpl.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowEnginesApiServiceImpl.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowsApiServiceImpl.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/resources/workflow-engine.yaml create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/pom.xml diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.api.server.workflow.engine.common/pom.xml b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.api.server.workflow.engine.common/pom.xml new file mode 100644 index 0000000000..1e13c41c38 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.api.server.workflow.engine.common/pom.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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.engine</artifactId> + <relativePath>../pom.xml</relativePath> + <version>1.3.84-SNAPSHOT</version> + </parent> + + <artifactId>org.wso2.carbon.identity.api.server.workflow.engine.common</artifactId> + + <properties> + <maven.compiler.source>21</maven.compiler.source> + <maven.compiler.target>21</maven.compiler.target> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + <dependencies> + <dependency> + <groupId>org.wso2.carbon.identity.workflow.impl.bps</groupId> + <artifactId>org.wso2.carbon.identity.workflow.mgt</artifactId> + </dependency> + </dependencies> + +</project> \ No newline at end of file diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.api.server.workflow.engine.common/src/main/java/org/wso2/carbon/identity/api/server/workflow/engine/common/WorkflowServiceHolder.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.api.server.workflow.engine.common/src/main/java/org/wso2/carbon/identity/api/server/workflow/engine/common/WorkflowServiceHolder.java new file mode 100644 index 0000000000..b08d7f0bab --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.api.server.workflow.engine.common/src/main/java/org/wso2/carbon/identity/api/server/workflow/engine/common/WorkflowServiceHolder.java @@ -0,0 +1,15 @@ +package org.wso2.carbon.identity.api.server.workflow.engine.common; + +import org.wso2.carbon.identity.workflow.mgt.WorkflowManagementService; +import org.wso2.carbon.identity.workflow.mgt.WorkflowManagementServiceImpl; + +public class WorkflowServiceHolder { + private final static WorkflowManagementService service = new WorkflowManagementServiceImpl(); + + public static WorkflowManagementService getWorkflowManagementService() + { + return service; + } + + +} diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/pom.xml b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/pom.xml new file mode 100644 index 0000000000..94f6f03f9f --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/pom.xml @@ -0,0 +1,175 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ 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. + --> +<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"> + <parent> + <groupId>org.wso2.carbon.identity.server.api</groupId> + <artifactId>org.wso2.carbon.identity.api.server.workflow.engine</artifactId> + <relativePath>../pom.xml</relativePath> + <version>1.3.84-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>org.wso2.carbon.identity.rest.api.server.workflow.engine.v1</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> +<!-- <plugin>--> +<!-- <groupId>org.openapitools</groupId>--> +<!-- <artifactId>openapi-generator-maven-plugin</artifactId>--> +<!-- <version>4.1.2</version>--> +<!-- <executions>--> +<!-- <execution>--> +<!-- <goals>--> +<!-- <goal>generate</goal>--> +<!-- </goals>--> +<!-- <configuration>--> +<!-- <inputSpec>${project.basedir}/src/main/resources/workflow-engine.yaml</inputSpec>--> +<!-- <generatorName>org.wso2.carbon.codegen.CxfWso2Generator</generatorName>--> +<!-- <configOptions>--> +<!-- <sourceFolder>src/gen/java</sourceFolder>--> +<!-- <apiPackage>org.wso2.carbon.identity.rest.api.server.workflow.engine.v1</apiPackage>--> +<!-- <modelPackage>org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model</modelPackage>--> +<!-- <packageName>org.wso2.carbon.identity.rest.api.server.workflow.engine.v1</packageName>--> +<!-- <dateLibrary>java8</dateLibrary>--> +<!-- <hideGenerationTimestamp>true</hideGenerationTimestamp>--> +<!-- </configOptions>--> +<!-- <output>.</output>--> +<!-- <skipOverwrite>false</skipOverwrite>--> +<!-- </configuration>--> +<!-- </execution>--> +<!-- </executions>--> +<!-- <dependencies>--> +<!-- <dependency>--> +<!-- <groupId>org.openapitools</groupId>--> +<!-- <artifactId>cxf-wso2-openapi-generator</artifactId>--> +<!-- <version>1.0.0</version>--> +<!-- </dependency>--> +<!-- </dependencies>--> +<!-- </plugin>--> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>1.8</version> + <executions> + <execution> + <id>add-source</id> + <phase>generate-sources</phase> + <goals> + <goal>add-source</goal> + </goals> + <configuration> + <sources> + <source>src/gen/java</source> + </sources> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-frontend-jaxrs</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-rs-service-description</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>javax.ws.rs</groupId> + <artifactId>javax.ws.rs-api</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>io.swagger</groupId> + <artifactId>swagger-jaxrs</artifactId> + <exclusions> + <exclusion> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + </exclusion> + <exclusion> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-annotations</artifactId> + </exclusion> + <exclusion> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-core</artifactId> + </exclusion> + <exclusion> + <groupId>com.fasterxml.jackson.dataformat</groupId> + <artifactId>jackson-dataformat-yaml</artifactId> + </exclusion> + <exclusion> + <groupId>javax.ws.rs</groupId> + <artifactId>jsr311-api</artifactId> + </exclusion> + <exclusion> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.jaxrs</groupId> + <artifactId>jackson-jaxrs-json-provider</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.wso2.carbon.identity.governance</groupId> + <artifactId>org.wso2.carbon.identity.recovery</artifactId> + <scope>provided</scope> + <exclusions> + <exclusion> + <groupId>javax.ws.rs</groupId> + <artifactId>jsr311-api</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.wso2.carbon.identity.workflow.impl.bps</groupId> + <artifactId>org.wso2.carbon.identity.workflow.impl</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.wso2.carbon.identity.server.api</groupId> + <artifactId>org.wso2.carbon.identity.api.server.common</artifactId> + <scope>provided</scope> + <version>1.2.131</version> + </dependency> + <!--<dependency>--> + <!--<groupId>org.wso2.carbon.identity.framework</groupId>--> + <!--<artifactId>org.wso2.carbon.identity.base</artifactId>--> + <!--<scope>provided</scope>--> + <!--</dependency>--> + </dependencies> + +</project> \ No newline at end of file diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowAssociationsApi.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowAssociationsApi.java new file mode 100644 index 0000000000..8be520a003 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowAssociationsApi.java @@ -0,0 +1,141 @@ +/* + * 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.rest.api.server.workflow.engine.v1; + +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.factories.WorkflowAssociationsApiServiceFactory; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.Error; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.Status; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowAssociation; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowAssociationCreation; + +import javax.validation.Valid; +import javax.ws.rs.*; +import javax.ws.rs.core.Response; +import io.swagger.annotations.*; + +import javax.validation.constraints.*; + +@Path("/workflow-associations") +@Api(description = "The workflow-associations API") + +public class WorkflowAssociationsApi { + + private final WorkflowAssociationsApiService delegate; + + public WorkflowAssociationsApi(){ + this.delegate = WorkflowAssociationsApiServiceFactory.getWorkflowAssociationsApi(); + } + + @Valid + @POST + + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @ApiOperation(value = "Create a new workflow association.", notes = "Create a new workflow association by assigning a user operation to an existing workflow. <b>Permission required:</b> * /permission/admin/manage/humantask/viewtasks ", response = WorkflowAssociation.class, authorizations = { + @Authorization(value = "BasicAuth"), + @Authorization(value = "OAuth2", scopes = { + + }) + }, tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 201, message = "Item Created", response = WorkflowAssociation.class), + @ApiResponse(code = 400, message = "Invalid input request", response = Error.class), + @ApiResponse(code = 401, message = "Unauthorized", response = Void.class), + @ApiResponse(code = 403, message = "Forbidden", response = Void.class), + @ApiResponse(code = 409, message = "Item Already Exists", response = Error.class), + @ApiResponse(code = 500, message = "Internal Server Error", response = Error.class) + }) + public Response createWorkflowAssociation(@ApiParam(value = "Contains the details of the newly created workflow association." ,required=true) @Valid WorkflowAssociationCreation requestBody) { + + return delegate.createWorkflowAssociation(requestBody ); + } + + @Valid + @DELETE + @Path("/{association-id}") + + @Produces({ "application/json" }) + @ApiOperation(value = "Delete the workflow association by association id.", notes = "Delete a specific workflow association identified by the association id. <b>Permission required:</b> * /permission/admin/manage/humantask/viewtasks ", response = Void.class, authorizations = { + @Authorization(value = "BasicAuth"), + @Authorization(value = "OAuth2", scopes = { + + }) + }, tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 204, message = "Item Deleted", response = Void.class), + @ApiResponse(code = 400, message = "Invalid input request", response = Error.class), + @ApiResponse(code = 401, message = "Unauthorized", response = Void.class), + @ApiResponse(code = 403, message = "Forbidden", response = Void.class), + @ApiResponse(code = 404, message = "The specified resource is not found", response = Error.class), + @ApiResponse(code = 500, message = "Internal Server Error", response = Error.class) + }) + public Response deleteWorkflowAssociationById(@ApiParam(value = "Workflow Association ID",required=true) @PathParam("association-id") Integer associationId) { + + return delegate.deleteWorkflowAssociationById(associationId ); + } + + @Valid + @GET + + + @Produces({ "application/json" }) + @ApiOperation(value = "Retrieve all the available workflow associations.", notes = "Retrieve all the available workflow associations in the system. <b>Permission required:</b> * /permission/admin/manage/humantask/viewtasks ", response = WorkflowAssociation.class, responseContainer = "List", authorizations = { + @Authorization(value = "BasicAuth"), + @Authorization(value = "OAuth2", scopes = { + + }) + }, tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Array of workflow associations matching the search criteria", response = WorkflowAssociation.class, responseContainer = "List"), + @ApiResponse(code = 400, message = "Invalid input request", response = Error.class), + @ApiResponse(code = 401, message = "Unauthorized", response = Void.class), + @ApiResponse(code = 403, message = "Forbidden", response = Void.class), + @ApiResponse(code = 404, message = "The specified resource is not found", response = Error.class), + @ApiResponse(code = 500, message = "Internal Server Error", response = Error.class) + }) + public Response listWorkflowAssociations( @Valid @Min(15)@ApiParam(value = "Maximum number of records to return") @QueryParam("limit") Integer limit, @Valid @Min(0)@ApiParam(value = "Number of records to skip for pagination") @QueryParam("offset") Integer offset, @Valid@ApiParam(value = "Records, filtered by their name") @QueryParam("filter") String filter) { + + return delegate.listWorkflowAssociations(limit, offset, filter ); + } + + @Valid + @PUT + @Path("/{association-id}/status") + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @ApiOperation(value = "Update the status of a workflow association.", notes = "Enable or disable a specific workflow association. <b>Permission required:</b> * /permission/admin/manage/humantask/viewtasks ", response = Void.class, authorizations = { + @Authorization(value = "BasicAuth"), + @Authorization(value = "OAuth2", scopes = { + + }) + }, tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Item Updated", response = Void.class), + @ApiResponse(code = 400, message = "Invalid input request", response = Error.class), + @ApiResponse(code = 401, message = "Unauthorized", response = Void.class), + @ApiResponse(code = 403, message = "Forbidden", response = Void.class), + @ApiResponse(code = 404, message = "The specified resource is not found", response = Error.class), + @ApiResponse(code = 500, message = "Internal Server Error", response = Error.class) + }) + public Response updateWorkflowAssociationStatus(@ApiParam(value = "Workflow Association ID",required=true) @PathParam("association-id") Integer associationId, @ApiParam(value = "Status of the workflow association (enable/disable)" ) @Valid Status status) { + + return delegate.updateWorkflowAssociationStatus(associationId, status ); + } + +} diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowAssociationsApiService.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowAssociationsApiService.java new file mode 100644 index 0000000000..a10c9d535b --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowAssociationsApiService.java @@ -0,0 +1,43 @@ +/* + * 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.rest.api.server.workflow.engine.v1; + +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.*; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.*; +import org.apache.cxf.jaxrs.ext.multipart.Attachment; +import org.apache.cxf.jaxrs.ext.multipart.Multipart; +import java.io.InputStream; +import java.util.List; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.Error; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.Status; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowAssociation; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowAssociationCreation; +import javax.ws.rs.core.Response; + + +public interface WorkflowAssociationsApiService { + + public Response createWorkflowAssociation(WorkflowAssociationCreation requestBody); + + public Response deleteWorkflowAssociationById(Integer associationId); + + public Response listWorkflowAssociations(Integer limit, Integer offset, String filter); + + public Response updateWorkflowAssociationStatus(Integer associationId, Status status); +} diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowEnginesApi.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowEnginesApi.java new file mode 100644 index 0000000000..edd01214f7 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowEnginesApi.java @@ -0,0 +1,66 @@ +/* + * 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.rest.api.server.workflow.engine.v1; + +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.factories.WorkflowEnginesApiServiceFactory; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.Error; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowEngine; + +import javax.validation.Valid; +import javax.ws.rs.*; +import javax.ws.rs.core.Response; +import io.swagger.annotations.*; + + +@Path("/workflow-engines") +@Api(description = "The workflow-engines API") + +public class WorkflowEnginesApi { + + private final WorkflowEnginesApiService delegate; + + public WorkflowEnginesApi(){ + this.delegate = WorkflowEnginesApiServiceFactory.getWorkflowEnginesApi(); + } + + @Valid + @GET + + + @Produces({ "*/*", "application/json" }) + @ApiOperation(value = "Retrieve all the available workflow engines.", notes = "Retrieve metadata information of all the workflow engines in the system. <b>Permission required:</b> * /permission/admin/manage/humantask/viewtasks ", response = WorkflowEngine.class, responseContainer = "List", authorizations = { + @Authorization(value = "BasicAuth"), + @Authorization(value = "OAuth2", scopes = { + + }) + }, tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "search results matching criteria", response = WorkflowEngine.class, responseContainer = "List"), + @ApiResponse(code = 400, message = "Invalid input request", response = Error.class), + @ApiResponse(code = 401, message = "Unauthorized", response = Void.class), + @ApiResponse(code = 403, message = "Forbidden", response = Void.class), + @ApiResponse(code = 404, message = "The specified resource is not found", response = Error.class), + @ApiResponse(code = 500, message = "Internal Server Error", response = Error.class) + }) + public Response searchWorkFlowEngines() { + + return delegate.searchWorkFlowEngines(); + } + +} diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowEnginesApiService.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowEnginesApiService.java new file mode 100644 index 0000000000..fd30932df0 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowEnginesApiService.java @@ -0,0 +1,35 @@ +/* + * 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.rest.api.server.workflow.engine.v1; + +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.*; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.*; +import org.apache.cxf.jaxrs.ext.multipart.Attachment; +import org.apache.cxf.jaxrs.ext.multipart.Multipart; +import java.io.InputStream; +import java.util.List; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.Error; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowEngine; +import javax.ws.rs.core.Response; + + +public interface WorkflowEnginesApiService { + + public Response searchWorkFlowEngines(); +} diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowsApi.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowsApi.java new file mode 100644 index 0000000000..4bf6706f2a --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowsApi.java @@ -0,0 +1,165 @@ +/* + * 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.rest.api.server.workflow.engine.v1; + +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.factories.WorkflowsApiServiceFactory; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.DetailedWorkflow; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.Error; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowCreation; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowSummary; + +import javax.validation.Valid; +import javax.ws.rs.*; +import javax.ws.rs.core.Response; +import io.swagger.annotations.*; + +import javax.validation.constraints.*; + +@Path("/workflows") +@Api(description = "The workflows API") + +public class WorkflowsApi { + + private final WorkflowsApiService delegate; + + public WorkflowsApi(){ + this.delegate = WorkflowsApiServiceFactory.getWorkflowsApi(); + } + + @Valid + @POST + + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @ApiOperation(value = "Create a new workflow.", notes = "Create a new workflow using the specified workflow template and execution engine. <b>Permission required:</b> * /permission/admin/manage/humantask/viewtasks ", response = WorkflowSummary.class, authorizations = { + @Authorization(value = "BasicAuth"), + @Authorization(value = "OAuth2", scopes = { + + }) + }, tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 201, message = "Item Created", response = WorkflowSummary.class), + @ApiResponse(code = 400, message = "Invalid input request", response = Error.class), + @ApiResponse(code = 401, message = "Unauthorized", response = Void.class), + @ApiResponse(code = 403, message = "Forbidden", response = Void.class), + @ApiResponse(code = 409, message = "Item Already Exists", response = Error.class), + @ApiResponse(code = 500, message = "Internal Server Error", response = Error.class) + }) + public Response createWorkflow(@ApiParam(value = "Contains the details of the newly created workflow." ,required=true) @Valid WorkflowCreation requestBody) { + + return delegate.createWorkflow(requestBody ); + } + + @Valid + @DELETE + @Path("/{workflow-id}") + + @Produces({ "application/json" }) + @ApiOperation(value = "Delete the workflow by workflow-id.", notes = "Delete a specific workflow identified by the workflow-id. <b>Permission required:</b> * /permission/admin/manage/humantask/viewtasks ", response = Void.class, authorizations = { + @Authorization(value = "BasicAuth"), + @Authorization(value = "OAuth2", scopes = { + + }) + }, tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 204, message = "Item Deleted", response = Void.class), + @ApiResponse(code = 400, message = "Invalid input request", response = Error.class), + @ApiResponse(code = 401, message = "Unauthorized", response = Void.class), + @ApiResponse(code = 403, message = "Forbidden", response = Void.class), + @ApiResponse(code = 404, message = "The specified resource is not found", response = Error.class), + @ApiResponse(code = 500, message = "Internal Server Error", response = Error.class) + }) + public Response deleteWorkflowById(@ApiParam(value = "Workflow ID",required=true) @PathParam("workflow-id") String workflowId) { + + return delegate.deleteWorkflowById(workflowId ); + } + + @Valid + @GET + @Path("/{workflow-id}") + + @Produces({ "application/json" }) + @ApiOperation(value = "Retrieve the workflow by workflow id.", notes = "Retrieve information about a specific workflow identified by the workflow id. <b>Permission required:</b> * /permission/admin/manage/humantask/viewtasks ", response = DetailedWorkflow.class, authorizations = { + @Authorization(value = "BasicAuth"), + @Authorization(value = "OAuth2", scopes = { + + }) + }, tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Information about the workflow identified by the workflow-id.", response = DetailedWorkflow.class), + @ApiResponse(code = 400, message = "Invalid input request", response = Error.class), + @ApiResponse(code = 401, message = "Unauthorized", response = Void.class), + @ApiResponse(code = 403, message = "Forbidden", response = Void.class), + @ApiResponse(code = 404, message = "The specified resource is not found", response = Error.class), + @ApiResponse(code = 500, message = "Internal Server Error", response = Error.class) + }) + public Response getWorkflowById(@ApiParam(value = "Workflow ID",required=true) @PathParam("workflow-id") String workflowId) { + + return delegate.getWorkflowById(workflowId ); + } + + @Valid + @GET + + + @Produces({ "application/json" }) + @ApiOperation(value = "Retrieve all the available workflows.", notes = "Retrieve all the available workflows in the system. <b>Permission required:</b> * /permission/admin/manage/humantask/viewtasks ", response = WorkflowSummary.class, responseContainer = "List", authorizations = { + @Authorization(value = "BasicAuth"), + @Authorization(value = "OAuth2", scopes = { + + }) + }, tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Array of workflows", response = WorkflowSummary.class, responseContainer = "List"), + @ApiResponse(code = 400, message = "Invalid input request", response = Error.class), + @ApiResponse(code = 401, message = "Unauthorized", response = Void.class), + @ApiResponse(code = 403, message = "Forbidden", response = Void.class), + @ApiResponse(code = 404, message = "The specified resource is not found", response = Error.class), + @ApiResponse(code = 500, message = "Internal Server Error", response = Error.class) + }) + public Response listWorkflows( @Valid @Min(15)@ApiParam(value = "Maximum number of records to return") @QueryParam("limit") Integer limit, @Valid @Min(0)@ApiParam(value = "Number of records to skip for pagination") @QueryParam("offset") Integer offset, @Valid@ApiParam(value = "Records, filtered by their name") @QueryParam("filter") String filter) { + + return delegate.listWorkflows(limit, offset, filter ); + } + + @Valid + @PUT + @Path("/{workflow-id}") + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @ApiOperation(value = "Update an existing workflow.", notes = "Update a workflow identified by workflow-id. <b>Permission required:</b> * /permission/admin/manage/humantask/viewtasks ", response = Void.class, authorizations = { + @Authorization(value = "BasicAuth"), + @Authorization(value = "OAuth2", scopes = { + + }) + }, tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Item Updated", response = Void.class), + @ApiResponse(code = 400, message = "Invalid input request", response = Error.class), + @ApiResponse(code = 401, message = "Unauthorized", response = Void.class), + @ApiResponse(code = 403, message = "Forbidden", response = Void.class), + @ApiResponse(code = 404, message = "The specified resource is not found", response = Error.class), + @ApiResponse(code = 500, message = "Internal Server Error", response = Error.class) + }) + public Response updateWorkflow(@ApiParam(value = "Workflow ID",required=true) @PathParam("workflow-id") String workflowId, @ApiParam(value = "Contains the details of the updated workflow." ) @Valid WorkflowCreation requestBody) { + + return delegate.updateWorkflow(workflowId, requestBody ); + } + +} diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowsApiService.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowsApiService.java new file mode 100644 index 0000000000..a06e65f3ed --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowsApiService.java @@ -0,0 +1,45 @@ +/* + * 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.rest.api.server.workflow.engine.v1; + +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.*; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.*; +import org.apache.cxf.jaxrs.ext.multipart.Attachment; +import org.apache.cxf.jaxrs.ext.multipart.Multipart; +import java.io.InputStream; +import java.util.List; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.DetailedWorkflow; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.Error; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowCreation; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowSummary; +import javax.ws.rs.core.Response; + + +public interface WorkflowsApiService { + + public Response createWorkflow(WorkflowCreation requestBody); + + public Response deleteWorkflowById(String workflowId); + + public Response getWorkflowById(String workflowId); + + public Response listWorkflows(Integer limit, Integer offset, String filter); + + public Response updateWorkflow(String workflowId, WorkflowCreation requestBody); +} diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/dto/ErrorDTO.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/dto/ErrorDTO.java new file mode 100644 index 0000000000..baec5819d6 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/dto/ErrorDTO.java @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2019, WSO2 LLC. (https://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.rest.api.server.workflow.engine.v1.dto; + + +import io.swagger.annotations.*; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Pattern; + + + + + +@ApiModel(description = "") +public class ErrorDTO { + + + @NotNull + private String code = null; + + @NotNull + private String message = null; + + + private String description = null; + + + private String traceId = null; + + + /** + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty("code") + public String getCode() { + return code; + } + public void setCode(String code) { + this.code = code; + } + + + /** + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty("message") + public String getMessage() { + return message; + } + public void setMessage(String message) { + this.message = message; + } + + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("description") + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("traceId") + public String getTraceId() { + return traceId; + } + public void setTraceId(String traceId) { + this.traceId = traceId; + } + + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ErrorDTO {\n"); + + sb.append(" code: ").append(code).append("\n"); + sb.append(" message: ").append(message).append("\n"); + sb.append(" description: ").append(description).append("\n"); + sb.append(" traceId: ").append(traceId).append("\n"); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/dto/WorkFlowEngineDTO.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/dto/WorkFlowEngineDTO.java new file mode 100644 index 0000000000..8d2047505e --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/dto/WorkFlowEngineDTO.java @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2019, WSO2 LLC. (https://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.rest.api.server.workflow.engine.v1.dto; + + +import io.swagger.annotations.*; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Pattern; + + + + + +@ApiModel(description = "") +public class WorkFlowEngineDTO { + + + @NotNull + private String profileName = null; + + + private String workerHostURL = null; + + + private String managerHostURL = null; + + + private String userName = null; + + + /** + * A unique name for the workflow engine. + **/ + @ApiModelProperty(required = true, value = "A unique name for the workflow engine.") + @JsonProperty("profileName") + public String getProfileName() { + return profileName; + } + public void setProfileName(String profileName) { + this.profileName = profileName; + } + + + /** + * URL of the workflow worker node. + **/ + @ApiModelProperty(value = "URL of the workflow worker node.") + @JsonProperty("workerHostURL") + public String getWorkerHostURL() { + return workerHostURL; + } + public void setWorkerHostURL(String workerHostURL) { + this.workerHostURL = workerHostURL; + } + + + /** + * URL of the workflow manager node. + **/ + @ApiModelProperty(value = "URL of the workflow manager node.") + @JsonProperty("managerHostURL") + public String getManagerHostURL() { + return managerHostURL; + } + public void setManagerHostURL(String managerHostURL) { + this.managerHostURL = managerHostURL; + } + + + /** + * Username of the creator of the workflow engine. + **/ + @ApiModelProperty(value = "Username of the creator of the workflow engine.") + @JsonProperty("userName") + public String getUserName() { + return userName; + } + public void setUserName(String userName) { + this.userName = userName; + } + + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WorkFlowEngineDTO {\n"); + + sb.append(" profileName: ").append(profileName).append("\n"); + sb.append(" workerHostURL: ").append(workerHostURL).append("\n"); + sb.append(" managerHostURL: ").append(managerHostURL).append("\n"); + sb.append(" userName: ").append(userName).append("\n"); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowAssociationsApiServiceFactory.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowAssociationsApiServiceFactory.java new file mode 100644 index 0000000000..cc19a4caae --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowAssociationsApiServiceFactory.java @@ -0,0 +1,32 @@ +/* + * 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.rest.api.server.workflow.engine.v1.factories; + +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.WorkflowAssociationsApiService; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.impl.WorkflowAssociationsApiServiceImpl; + +public class WorkflowAssociationsApiServiceFactory { + + private final static WorkflowAssociationsApiService service = new WorkflowAssociationsApiServiceImpl(); + + public static WorkflowAssociationsApiService getWorkflowAssociationsApi() + { + return service; + } +} diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowEnginesApiServiceFactory.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowEnginesApiServiceFactory.java new file mode 100644 index 0000000000..a2936bdc1e --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowEnginesApiServiceFactory.java @@ -0,0 +1,32 @@ +/* + * 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.rest.api.server.workflow.engine.v1.factories; + +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.WorkflowEnginesApiService; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.impl.WorkflowEnginesApiServiceImpl; + +public class WorkflowEnginesApiServiceFactory { + + private final static WorkflowEnginesApiService service = new WorkflowEnginesApiServiceImpl(); + + public static WorkflowEnginesApiService getWorkflowEnginesApi() + { + return service; + } +} diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowsApiServiceFactory.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowsApiServiceFactory.java new file mode 100644 index 0000000000..692efa5888 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowsApiServiceFactory.java @@ -0,0 +1,32 @@ +/* + * 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.rest.api.server.workflow.engine.v1.factories; + +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.WorkflowsApiService; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.impl.WorkflowsApiServiceImpl; + +public class WorkflowsApiServiceFactory { + + private final static WorkflowsApiService service = new WorkflowsApiServiceImpl(); + + public static WorkflowsApiService getWorkflowsApi() + { + return service; + } +} diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/ActionStatus.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/ActionStatus.java new file mode 100644 index 0000000000..37f869427d --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/ActionStatus.java @@ -0,0 +1,64 @@ +/* + * 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.rest.api.server.workflow.engine.v1.model; + +import io.swagger.annotations.ApiModel; +import javax.validation.constraints.*; + +/** + * Indicates whether to enable or disable the workflow association + **/ +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; + +@XmlType(name="") +@XmlEnum(String.class) +public enum ActionStatus { + + @XmlEnumValue("ENABLE") ENABLE(String.valueOf("ENABLE")), @XmlEnumValue("DISABLE") DISABLE(String.valueOf("DISABLE")); + + + private String value; + + ActionStatus(String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ActionStatus fromValue(String value) { + for (ActionStatus b : ActionStatus.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + + diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/DetailedWorkflow.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/DetailedWorkflow.java new file mode 100644 index 0000000000..2e46c21ed2 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/DetailedWorkflow.java @@ -0,0 +1,215 @@ +/* + * 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.rest.api.server.workflow.engine.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.DetailedWorkflowTemplate; +import javax.validation.constraints.*; + + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; + +public class DetailedWorkflow { + + private String workflowName; + private String workflowDescription; + private DetailedWorkflowTemplate workflowTemplate; + private String workflowEngine; + private String approvalTask; + private String approvalTaskDescription; + + /** + * Name of the created workflow + **/ + public DetailedWorkflow workflowName(String workflowName) { + + this.workflowName = workflowName; + return this; + } + + @ApiModelProperty(example = "User Registration Workflow", required = true, value = "Name of the created workflow") + @JsonProperty("workflowName") + @Valid + @NotNull(message = "Property workflowName cannot be null.") + + public String getWorkflowName() { + return workflowName; + } + public void setWorkflowName(String workflowName) { + this.workflowName = workflowName; + } + + /** + * Description of the created workflow + **/ + public DetailedWorkflow workflowDescription(String workflowDescription) { + + this.workflowDescription = workflowDescription; + return this; + } + + @ApiModelProperty(example = "Workflow to approve new user registrations before account activation", value = "Description of the created workflow") + @JsonProperty("workflowDescription") + @Valid + public String getWorkflowDescription() { + return workflowDescription; + } + public void setWorkflowDescription(String workflowDescription) { + this.workflowDescription = workflowDescription; + } + + /** + **/ + public DetailedWorkflow workflowTemplate(DetailedWorkflowTemplate workflowTemplate) { + + this.workflowTemplate = workflowTemplate; + return this; + } + + @ApiModelProperty(value = "") + @JsonProperty("workflowTemplate") + @Valid + public DetailedWorkflowTemplate getWorkflowTemplate() { + return workflowTemplate; + } + public void setWorkflowTemplate(DetailedWorkflowTemplate workflowTemplate) { + this.workflowTemplate = workflowTemplate; + } + + /** + * Name of the selected workflow engine + **/ + public DetailedWorkflow workflowEngine(String workflowEngine) { + + this.workflowEngine = workflowEngine; + return this; + } + + @ApiModelProperty(example = "Simple Workflow Engine", required = true, value = "Name of the selected workflow engine") + @JsonProperty("workflowEngine") + @Valid + @NotNull(message = "Property workflowEngine cannot be null.") + + public String getWorkflowEngine() { + return workflowEngine; + } + public void setWorkflowEngine(String workflowEngine) { + this.workflowEngine = workflowEngine; + } + + /** + * Approval task subject to display + **/ + public DetailedWorkflow approvalTask(String approvalTask) { + + this.approvalTask = approvalTask; + return this; + } + + @ApiModelProperty(example = "User Registration Approval", required = true, value = "Approval task subject to display") + @JsonProperty("ApprovalTask") + @Valid + @NotNull(message = "Property approvalTask cannot be null.") + + public String getApprovalTask() { + return approvalTask; + } + public void setApprovalTask(String approvalTask) { + this.approvalTask = approvalTask; + } + + /** + * Description of the approval task + **/ + public DetailedWorkflow approvalTaskDescription(String approvalTaskDescription) { + + this.approvalTaskDescription = approvalTaskDescription; + return this; + } + + @ApiModelProperty(example = "Approval task to validate and approve new user registrations before account activation", value = "Description of the approval task") + @JsonProperty("ApprovalTaskDescription") + @Valid + public String getApprovalTaskDescription() { + return approvalTaskDescription; + } + public void setApprovalTaskDescription(String approvalTaskDescription) { + this.approvalTaskDescription = approvalTaskDescription; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DetailedWorkflow detailedWorkflow = (DetailedWorkflow) o; + return Objects.equals(this.workflowName, detailedWorkflow.workflowName) && + Objects.equals(this.workflowDescription, detailedWorkflow.workflowDescription) && + Objects.equals(this.workflowTemplate, detailedWorkflow.workflowTemplate) && + Objects.equals(this.workflowEngine, detailedWorkflow.workflowEngine) && + Objects.equals(this.approvalTask, detailedWorkflow.approvalTask) && + Objects.equals(this.approvalTaskDescription, detailedWorkflow.approvalTaskDescription); + } + + @Override + public int hashCode() { + return Objects.hash(workflowName, workflowDescription, workflowTemplate, workflowEngine, approvalTask, approvalTaskDescription); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class DetailedWorkflow {\n"); + + sb.append(" workflowName: ").append(toIndentedString(workflowName)).append("\n"); + sb.append(" workflowDescription: ").append(toIndentedString(workflowDescription)).append("\n"); + sb.append(" workflowTemplate: ").append(toIndentedString(workflowTemplate)).append("\n"); + sb.append(" workflowEngine: ").append(toIndentedString(workflowEngine)).append("\n"); + sb.append(" approvalTask: ").append(toIndentedString(approvalTask)).append("\n"); + sb.append(" approvalTaskDescription: ").append(toIndentedString(approvalTaskDescription)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/DetailedWorkflowTemplate.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/DetailedWorkflowTemplate.java new file mode 100644 index 0000000000..9acd1e5ab4 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/DetailedWorkflowTemplate.java @@ -0,0 +1,154 @@ +/* + * 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.rest.api.server.workflow.engine.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowTemplateParameters; +import javax.validation.constraints.*; + + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; + +public class DetailedWorkflowTemplate { + + private String name; + private String templateDescription; + private List<WorkflowTemplateParameters> properties = null; + + + /** + * Name of the workflow template + **/ + public DetailedWorkflowTemplate name(String name) { + + this.name = name; + return this; + } + + @ApiModelProperty(example = "MultiStepApproval", value = "Name of the workflow template") + @JsonProperty("name") + @Valid + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + /** + * Description of the workflow template + **/ + public DetailedWorkflowTemplate templateDescription(String templateDescription) { + + this.templateDescription = templateDescription; + return this; + } + + @ApiModelProperty(example = "The operation should be approved by an authorized person with given role, to complete.", value = "Description of the workflow template") + @JsonProperty("templateDescription") + @Valid + public String getTemplateDescription() { + return templateDescription; + } + public void setTemplateDescription(String templateDescription) { + this.templateDescription = templateDescription; + } + + /** + **/ + public DetailedWorkflowTemplate properties(List<WorkflowTemplateParameters> properties) { + + this.properties = properties; + return this; + } + + @ApiModelProperty(value = "") + @JsonProperty("properties") + @Valid + public List<WorkflowTemplateParameters> getProperties() { + return properties; + } + public void setProperties(List<WorkflowTemplateParameters> properties) { + this.properties = properties; + } + + public DetailedWorkflowTemplate addPropertiesItem(WorkflowTemplateParameters propertiesItem) { + if (this.properties == null) { + this.properties = new ArrayList<>(); + } + this.properties.add(propertiesItem); + return this; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DetailedWorkflowTemplate detailedWorkflowTemplate = (DetailedWorkflowTemplate) o; + return Objects.equals(this.name, detailedWorkflowTemplate.name) && + Objects.equals(this.templateDescription, detailedWorkflowTemplate.templateDescription) && + Objects.equals(this.properties, detailedWorkflowTemplate.properties); + } + + @Override + public int hashCode() { + return Objects.hash(name, templateDescription, properties); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class DetailedWorkflowTemplate {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" templateDescription: ").append(toIndentedString(templateDescription)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/Error.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/Error.java new file mode 100644 index 0000000000..9e7fd34919 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/Error.java @@ -0,0 +1,165 @@ +/* + * 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.rest.api.server.workflow.engine.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; + + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; + +public class Error { + + private String code; + private String message; + private String description; + private String traceId; + + /** + **/ + public Error code(String code) { + + this.code = code; + return this; + } + + @ApiModelProperty(example = "some_error_code", required = true, value = "") + @JsonProperty("code") + @Valid + @NotNull(message = "Property code cannot be null.") + + public String getCode() { + return code; + } + public void setCode(String code) { + this.code = code; + } + + /** + **/ + public Error message(String message) { + + this.message = message; + return this; + } + + @ApiModelProperty(example = "Some Error Message", required = true, value = "") + @JsonProperty("message") + @Valid + @NotNull(message = "Property message cannot be null.") + + public String getMessage() { + return message; + } + public void setMessage(String message) { + this.message = message; + } + + /** + **/ + public Error description(String description) { + + this.description = description; + return this; + } + + @ApiModelProperty(example = "Some Error Description", value = "") + @JsonProperty("description") + @Valid + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + + /** + **/ + public Error traceId(String traceId) { + + this.traceId = traceId; + return this; + } + + @ApiModelProperty(example = "Some Trace ID", value = "") + @JsonProperty("traceId") + @Valid + public String getTraceId() { + return traceId; + } + public void setTraceId(String traceId) { + this.traceId = traceId; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Error error = (Error) o; + return Objects.equals(this.code, error.code) && + Objects.equals(this.message, error.message) && + Objects.equals(this.description, error.description) && + Objects.equals(this.traceId, error.traceId); + } + + @Override + public int hashCode() { + return Objects.hash(code, message, description, traceId); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class Error {\n"); + + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" traceId: ").append(toIndentedString(traceId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/OptionDetails.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/OptionDetails.java new file mode 100644 index 0000000000..5b804da4f1 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/OptionDetails.java @@ -0,0 +1,119 @@ +/* + * 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.rest.api.server.workflow.engine.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; + + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; + +public class OptionDetails { + + private String entity; + private String values; + + /** + **/ + public OptionDetails entity(String entity) { + + this.entity = entity; + return this; + } + + @ApiModelProperty(example = "roles", value = "") + @JsonProperty("entity") + @Valid + public String getEntity() { + return entity; + } + public void setEntity(String entity) { + this.entity = entity; + } + + /** + **/ + public OptionDetails values(String values) { + + this.values = values; + return this; + } + + @ApiModelProperty(example = "admin", value = "") + @JsonProperty("values") + @Valid + public String getValues() { + return values; + } + public void setValues(String values) { + this.values = values; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OptionDetails optionDetails = (OptionDetails) o; + return Objects.equals(this.entity, optionDetails.entity) && + Objects.equals(this.values, optionDetails.values); + } + + @Override + public int hashCode() { + return Objects.hash(entity, values); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class OptionDetails {\n"); + + sb.append(" entity: ").append(toIndentedString(entity)).append("\n"); + sb.append(" values: ").append(toIndentedString(values)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/Status.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/Status.java new file mode 100644 index 0000000000..8caf0c3116 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/Status.java @@ -0,0 +1,99 @@ +/* + * 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.rest.api.server.workflow.engine.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.ActionStatus; +import javax.validation.constraints.*; + + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; + +public class Status { + + private ActionStatus action; + + /** + **/ + public Status action(ActionStatus action) { + + this.action = action; + return this; + } + + @ApiModelProperty(value = "") + @JsonProperty("action") + @Valid + public ActionStatus getAction() { + return action; + } + public void setAction(ActionStatus action) { + this.action = action; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Status status = (Status) o; + return Objects.equals(this.action, status.action); + } + + @Override + public int hashCode() { + return Objects.hash(action); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class Status {\n"); + + sb.append(" action: ").append(toIndentedString(action)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociation.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociation.java new file mode 100644 index 0000000000..17e36d69ba --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociation.java @@ -0,0 +1,187 @@ +/* + * 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.rest.api.server.workflow.engine.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; + + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; + +public class WorkflowAssociation { + + private String id; + private String workflowAssociationName; + private String operation; + private String workflowName; + private Boolean isEnabled; + + /** + * Unique id to represent a workflow association + **/ + public WorkflowAssociation id(String id) { + + this.id = id; + return this; + } + + @ApiModelProperty(example = "500", value = "Unique id to represent a workflow association") + @JsonProperty("id") + @Valid + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + + /** + * Name of the workflow association + **/ + public WorkflowAssociation workflowAssociationName(String workflowAssociationName) { + + this.workflowAssociationName = workflowAssociationName; + return this; + } + + @ApiModelProperty(example = "User registration Workflow Association", value = "Name of the workflow association") + @JsonProperty("workflowAssociationName") + @Valid + public String getWorkflowAssociationName() { + return workflowAssociationName; + } + public void setWorkflowAssociationName(String workflowAssociationName) { + this.workflowAssociationName = workflowAssociationName; + } + + /** + * User Operation + **/ + public WorkflowAssociation operation(String operation) { + + this.operation = operation; + return this; + } + + @ApiModelProperty(example = "Add User", value = "User Operation") + @JsonProperty("operation") + @Valid + public String getOperation() { + return operation; + } + public void setOperation(String operation) { + this.operation = operation; + } + + /** + * Assigned Workflow + **/ + public WorkflowAssociation workflowName(String workflowName) { + + this.workflowName = workflowName; + return this; + } + + @ApiModelProperty(example = "User Registration Approval", value = "Assigned Workflow") + @JsonProperty("workflowName") + @Valid + public String getWorkflowName() { + return workflowName; + } + public void setWorkflowName(String workflowName) { + this.workflowName = workflowName; + } + + /** + * Association Status + **/ + public WorkflowAssociation isEnabled(Boolean isEnabled) { + + this.isEnabled = isEnabled; + return this; + } + + @ApiModelProperty(example = "true", value = "Association Status") + @JsonProperty("isEnabled") + @Valid + public Boolean getIsEnabled() { + return isEnabled; + } + public void setIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WorkflowAssociation workflowAssociation = (WorkflowAssociation) o; + return Objects.equals(this.id, workflowAssociation.id) && + Objects.equals(this.workflowAssociationName, workflowAssociation.workflowAssociationName) && + Objects.equals(this.operation, workflowAssociation.operation) && + Objects.equals(this.workflowName, workflowAssociation.workflowName) && + Objects.equals(this.isEnabled, workflowAssociation.isEnabled); + } + + @Override + public int hashCode() { + return Objects.hash(id, workflowAssociationName, operation, workflowName, isEnabled); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class WorkflowAssociation {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" workflowAssociationName: ").append(toIndentedString(workflowAssociationName)).append("\n"); + sb.append(" operation: ").append(toIndentedString(operation)).append("\n"); + sb.append(" workflowName: ").append(toIndentedString(workflowName)).append("\n"); + sb.append(" isEnabled: ").append(toIndentedString(isEnabled)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociationCreation.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociationCreation.java new file mode 100644 index 0000000000..876beeddf0 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociationCreation.java @@ -0,0 +1,195 @@ +/* + * 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.rest.api.server.workflow.engine.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; + + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; + +public class WorkflowAssociationCreation { + + private String associationName; + private String operationCategory; + private String operationName; + private String workflowId; + private String associationCondition; + + /** + * Name of the workflow association + **/ + public WorkflowAssociationCreation associationName(String associationName) { + + this.associationName = associationName; + return this; + } + + @ApiModelProperty(example = "User Registration Workflow Association", required = true, value = "Name of the workflow association") + @JsonProperty("associationName") + @Valid + @NotNull(message = "Property associationName cannot be null.") + + public String getAssociationName() { + return associationName; + } + public void setAssociationName(String associationName) { + this.associationName = associationName; + } + + /** + * Operation type + **/ + public WorkflowAssociationCreation operationCategory(String operationCategory) { + + this.operationCategory = operationCategory; + return this; + } + + @ApiModelProperty(example = "User Store Operations", required = true, value = "Operation type") + @JsonProperty("operationCategory") + @Valid + @NotNull(message = "Property operationCategory cannot be null.") + + public String getOperationCategory() { + return operationCategory; + } + public void setOperationCategory(String operationCategory) { + this.operationCategory = operationCategory; + } + + /** + * Name of the user operation + **/ + public WorkflowAssociationCreation operationName(String operationName) { + + this.operationName = operationName; + return this; + } + + @ApiModelProperty(example = "Add User", required = true, value = "Name of the user operation") + @JsonProperty("operationName") + @Valid + @NotNull(message = "Property operationName cannot be null.") + + public String getOperationName() { + return operationName; + } + public void setOperationName(String operationName) { + this.operationName = operationName; + } + + /** + * Id of the assigned workflow + **/ + public WorkflowAssociationCreation workflowId(String workflowId) { + + this.workflowId = workflowId; + return this; + } + + @ApiModelProperty(example = "456", required = true, value = "Id of the assigned workflow") + @JsonProperty("workflowId") + @Valid + @NotNull(message = "Property workflowId cannot be null.") + + public String getWorkflowId() { + return workflowId; + } + public void setWorkflowId(String workflowId) { + this.workflowId = workflowId; + } + + /** + * Condition added to the association + **/ + public WorkflowAssociationCreation associationCondition(String associationCondition) { + + this.associationCondition = associationCondition; + return this; + } + + @ApiModelProperty(example = "Role Name equals Manager", value = "Condition added to the association") + @JsonProperty("associationCondition") + @Valid + public String getAssociationCondition() { + return associationCondition; + } + public void setAssociationCondition(String associationCondition) { + this.associationCondition = associationCondition; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WorkflowAssociationCreation workflowAssociationCreation = (WorkflowAssociationCreation) o; + return Objects.equals(this.associationName, workflowAssociationCreation.associationName) && + Objects.equals(this.operationCategory, workflowAssociationCreation.operationCategory) && + Objects.equals(this.operationName, workflowAssociationCreation.operationName) && + Objects.equals(this.workflowId, workflowAssociationCreation.workflowId) && + Objects.equals(this.associationCondition, workflowAssociationCreation.associationCondition); + } + + @Override + public int hashCode() { + return Objects.hash(associationName, operationCategory, operationName, workflowId, associationCondition); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class WorkflowAssociationCreation {\n"); + + sb.append(" associationName: ").append(toIndentedString(associationName)).append("\n"); + sb.append(" operationCategory: ").append(toIndentedString(operationCategory)).append("\n"); + sb.append(" operationName: ").append(toIndentedString(operationName)).append("\n"); + sb.append(" workflowId: ").append(toIndentedString(workflowId)).append("\n"); + sb.append(" associationCondition: ").append(toIndentedString(associationCondition)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowCreation.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowCreation.java new file mode 100644 index 0000000000..2a80cd47c6 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowCreation.java @@ -0,0 +1,217 @@ +/* + * 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.rest.api.server.workflow.engine.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowTemplate; +import javax.validation.constraints.*; + + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; + +public class WorkflowCreation { + + private String workflowName; + private String workflowDescription; + private WorkflowTemplate workflowTemplate; + private String workflowEngine; + private String approvalTask; + private String approvalTaskDescription; + + /** + * Name of the created workflow + **/ + public WorkflowCreation workflowName(String workflowName) { + + this.workflowName = workflowName; + return this; + } + + @ApiModelProperty(example = "User Registration Workflow", required = true, value = "Name of the created workflow") + @JsonProperty("workflowName") + @Valid + @NotNull(message = "Property workflowName cannot be null.") + + public String getWorkflowName() { + return workflowName; + } + public void setWorkflowName(String workflowName) { + this.workflowName = workflowName; + } + + /** + * Description of the created workflow + **/ + public WorkflowCreation workflowDescription(String workflowDescription) { + + this.workflowDescription = workflowDescription; + return this; + } + + @ApiModelProperty(example = "Workflow to approve new user registrations before account activation", value = "Description of the created workflow") + @JsonProperty("workflowDescription") + @Valid + public String getWorkflowDescription() { + return workflowDescription; + } + public void setWorkflowDescription(String workflowDescription) { + this.workflowDescription = workflowDescription; + } + + /** + **/ + public WorkflowCreation workflowTemplate(WorkflowTemplate workflowTemplate) { + + this.workflowTemplate = workflowTemplate; + return this; + } + + @ApiModelProperty(required = true, value = "") + @JsonProperty("workflowTemplate") + @Valid + @NotNull(message = "Property workflowTemplate cannot be null.") + + public WorkflowTemplate getWorkflowTemplate() { + return workflowTemplate; + } + public void setWorkflowTemplate(WorkflowTemplate workflowTemplate) { + this.workflowTemplate = workflowTemplate; + } + + /** + * Name of the selected workflow engine + **/ + public WorkflowCreation workflowEngine(String workflowEngine) { + + this.workflowEngine = workflowEngine; + return this; + } + + @ApiModelProperty(example = "Simple Workflow Engine", required = true, value = "Name of the selected workflow engine") + @JsonProperty("workflowEngine") + @Valid + @NotNull(message = "Property workflowEngine cannot be null.") + + public String getWorkflowEngine() { + return workflowEngine; + } + public void setWorkflowEngine(String workflowEngine) { + this.workflowEngine = workflowEngine; + } + + /** + * Approval task subject to display + **/ + public WorkflowCreation approvalTask(String approvalTask) { + + this.approvalTask = approvalTask; + return this; + } + + @ApiModelProperty(example = "User Registration Approval", required = true, value = "Approval task subject to display") + @JsonProperty("ApprovalTask") + @Valid + @NotNull(message = "Property approvalTask cannot be null.") + + public String getApprovalTask() { + return approvalTask; + } + public void setApprovalTask(String approvalTask) { + this.approvalTask = approvalTask; + } + + /** + * Description of the approval task + **/ + public WorkflowCreation approvalTaskDescription(String approvalTaskDescription) { + + this.approvalTaskDescription = approvalTaskDescription; + return this; + } + + @ApiModelProperty(example = "Approval task to validate and approve new user registrations before account activation", value = "Description of the approval task") + @JsonProperty("ApprovalTaskDescription") + @Valid + public String getApprovalTaskDescription() { + return approvalTaskDescription; + } + public void setApprovalTaskDescription(String approvalTaskDescription) { + this.approvalTaskDescription = approvalTaskDescription; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WorkflowCreation workflowCreation = (WorkflowCreation) o; + return Objects.equals(this.workflowName, workflowCreation.workflowName) && + Objects.equals(this.workflowDescription, workflowCreation.workflowDescription) && + Objects.equals(this.workflowTemplate, workflowCreation.workflowTemplate) && + Objects.equals(this.workflowEngine, workflowCreation.workflowEngine) && + Objects.equals(this.approvalTask, workflowCreation.approvalTask) && + Objects.equals(this.approvalTaskDescription, workflowCreation.approvalTaskDescription); + } + + @Override + public int hashCode() { + return Objects.hash(workflowName, workflowDescription, workflowTemplate, workflowEngine, approvalTask, approvalTaskDescription); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class WorkflowCreation {\n"); + + sb.append(" workflowName: ").append(toIndentedString(workflowName)).append("\n"); + sb.append(" workflowDescription: ").append(toIndentedString(workflowDescription)).append("\n"); + sb.append(" workflowTemplate: ").append(toIndentedString(workflowTemplate)).append("\n"); + sb.append(" workflowEngine: ").append(toIndentedString(workflowEngine)).append("\n"); + sb.append(" approvalTask: ").append(toIndentedString(approvalTask)).append("\n"); + sb.append(" approvalTaskDescription: ").append(toIndentedString(approvalTaskDescription)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowEngine.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowEngine.java new file mode 100644 index 0000000000..725b001c9b --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowEngine.java @@ -0,0 +1,167 @@ +/* + * 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.rest.api.server.workflow.engine.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; + + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; + +public class WorkflowEngine { + + private String profileName; + private String workerHostURL; + private String managerHostURL; + private String userName; + + /** + * A unique name for the workflow engine. + **/ + public WorkflowEngine profileName(String profileName) { + + this.profileName = profileName; + return this; + } + + @ApiModelProperty(example = "embedded_bps", required = true, value = "A unique name for the workflow engine.") + @JsonProperty("profileName") + @Valid + @NotNull(message = "Property profileName cannot be null.") + + public String getProfileName() { + return profileName; + } + public void setProfileName(String profileName) { + this.profileName = profileName; + } + + /** + * URL of the workflow worker node. + **/ + public WorkflowEngine workerHostURL(String workerHostURL) { + + this.workerHostURL = workerHostURL; + return this; + } + + @ApiModelProperty(example = "https://localhost:9443/services", value = "URL of the workflow worker node.") + @JsonProperty("workerHostURL") + @Valid + public String getWorkerHostURL() { + return workerHostURL; + } + public void setWorkerHostURL(String workerHostURL) { + this.workerHostURL = workerHostURL; + } + + /** + * URL of the workflow manager node. + **/ + public WorkflowEngine managerHostURL(String managerHostURL) { + + this.managerHostURL = managerHostURL; + return this; + } + + @ApiModelProperty(example = "https://localhost:9443/services", value = "URL of the workflow manager node.") + @JsonProperty("managerHostURL") + @Valid + public String getManagerHostURL() { + return managerHostURL; + } + public void setManagerHostURL(String managerHostURL) { + this.managerHostURL = managerHostURL; + } + + /** + * Username of the creator of the workflow engine. + **/ + public WorkflowEngine userName(String userName) { + + this.userName = userName; + return this; + } + + @ApiModelProperty(example = "challengeQuestion1", value = "Username of the creator of the workflow engine.") + @JsonProperty("userName") + @Valid + public String getUserName() { + return userName; + } + public void setUserName(String userName) { + this.userName = userName; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WorkflowEngine workflowEngine = (WorkflowEngine) o; + return Objects.equals(this.profileName, workflowEngine.profileName) && + Objects.equals(this.workerHostURL, workflowEngine.workerHostURL) && + Objects.equals(this.managerHostURL, workflowEngine.managerHostURL) && + Objects.equals(this.userName, workflowEngine.userName); + } + + @Override + public int hashCode() { + return Objects.hash(profileName, workerHostURL, managerHostURL, userName); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class WorkflowEngine {\n"); + + sb.append(" profileName: ").append(toIndentedString(profileName)).append("\n"); + sb.append(" workerHostURL: ").append(toIndentedString(workerHostURL)).append("\n"); + sb.append(" managerHostURL: ").append(toIndentedString(managerHostURL)).append("\n"); + sb.append(" userName: ").append(toIndentedString(userName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowSummary.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowSummary.java new file mode 100644 index 0000000000..639bb6bdaf --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowSummary.java @@ -0,0 +1,187 @@ +/* + * 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.rest.api.server.workflow.engine.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; + + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; + +public class WorkflowSummary { + + private String id; + private String workflowName; + private String workflowDescription; + private String workflowTemplate; + private String deployment; + + /** + * Unique id to represent a workflow + **/ + public WorkflowSummary id(String id) { + + this.id = id; + return this; + } + + @ApiModelProperty(example = "100", value = "Unique id to represent a workflow") + @JsonProperty("id") + @Valid + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + + /** + * Display name of the workflow + **/ + public WorkflowSummary workflowName(String workflowName) { + + this.workflowName = workflowName; + return this; + } + + @ApiModelProperty(example = "User Role Approval", value = "Display name of the workflow") + @JsonProperty("workflowName") + @Valid + public String getWorkflowName() { + return workflowName; + } + public void setWorkflowName(String workflowName) { + this.workflowName = workflowName; + } + + /** + * Detailed description of the workflow + **/ + public WorkflowSummary workflowDescription(String workflowDescription) { + + this.workflowDescription = workflowDescription; + return this; + } + + @ApiModelProperty(example = "Workflow to approve new user registrations before account activation", value = "Detailed description of the workflow") + @JsonProperty("workflowDescription") + @Valid + public String getWorkflowDescription() { + return workflowDescription; + } + public void setWorkflowDescription(String workflowDescription) { + this.workflowDescription = workflowDescription; + } + + /** + * Template defining the approval process for the workflow + **/ + public WorkflowSummary workflowTemplate(String workflowTemplate) { + + this.workflowTemplate = workflowTemplate; + return this; + } + + @ApiModelProperty(example = "MultiStepApprovalTemplate", value = "Template defining the approval process for the workflow") + @JsonProperty("workflowTemplate") + @Valid + public String getWorkflowTemplate() { + return workflowTemplate; + } + public void setWorkflowTemplate(String workflowTemplate) { + this.workflowTemplate = workflowTemplate; + } + + /** + * Category in which the workflow is deployed + **/ + public WorkflowSummary deployment(String deployment) { + + this.deployment = deployment; + return this; + } + + @ApiModelProperty(example = "ApprovalWorkflow", value = "Category in which the workflow is deployed") + @JsonProperty("deployment") + @Valid + public String getDeployment() { + return deployment; + } + public void setDeployment(String deployment) { + this.deployment = deployment; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WorkflowSummary workflowSummary = (WorkflowSummary) o; + return Objects.equals(this.id, workflowSummary.id) && + Objects.equals(this.workflowName, workflowSummary.workflowName) && + Objects.equals(this.workflowDescription, workflowSummary.workflowDescription) && + Objects.equals(this.workflowTemplate, workflowSummary.workflowTemplate) && + Objects.equals(this.deployment, workflowSummary.deployment); + } + + @Override + public int hashCode() { + return Objects.hash(id, workflowName, workflowDescription, workflowTemplate, deployment); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class WorkflowSummary {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" workflowName: ").append(toIndentedString(workflowName)).append("\n"); + sb.append(" workflowDescription: ").append(toIndentedString(workflowDescription)).append("\n"); + sb.append(" workflowTemplate: ").append(toIndentedString(workflowTemplate)).append("\n"); + sb.append(" deployment: ").append(toIndentedString(deployment)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowTemplate.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowTemplate.java new file mode 100644 index 0000000000..fd1b12cdb8 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowTemplate.java @@ -0,0 +1,132 @@ +/* + * 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.rest.api.server.workflow.engine.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowTemplateParameters; +import javax.validation.constraints.*; + + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; + +public class WorkflowTemplate { + + private String name; + private List<WorkflowTemplateParameters> steps = null; + + + /** + * Name of the workflow template + **/ + public WorkflowTemplate name(String name) { + + this.name = name; + return this; + } + + @ApiModelProperty(example = "MultiStepApproval", value = "Name of the workflow template") + @JsonProperty("name") + @Valid + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + /** + **/ + public WorkflowTemplate steps(List<WorkflowTemplateParameters> steps) { + + this.steps = steps; + return this; + } + + @ApiModelProperty(value = "") + @JsonProperty("steps") + @Valid @Size(min=1) + public List<WorkflowTemplateParameters> getSteps() { + return steps; + } + public void setSteps(List<WorkflowTemplateParameters> steps) { + this.steps = steps; + } + + public WorkflowTemplate addStepsItem(WorkflowTemplateParameters stepsItem) { + if (this.steps == null) { + this.steps = new ArrayList<>(); + } + this.steps.add(stepsItem); + return this; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WorkflowTemplate workflowTemplate = (WorkflowTemplate) o; + return Objects.equals(this.name, workflowTemplate.name) && + Objects.equals(this.steps, workflowTemplate.steps); + } + + @Override + public int hashCode() { + return Objects.hash(name, steps); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class WorkflowTemplate {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" steps: ").append(toIndentedString(steps)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowTemplateParameters.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowTemplateParameters.java new file mode 100644 index 0000000000..8ec1c8a66e --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowTemplateParameters.java @@ -0,0 +1,130 @@ +/* + * 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.rest.api.server.workflow.engine.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.OptionDetails; +import javax.validation.constraints.*; + + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; + +public class WorkflowTemplateParameters { + + private Integer step; + private List<OptionDetails> options = new ArrayList<>(); + + + /** + **/ + public WorkflowTemplateParameters step(Integer step) { + + this.step = step; + return this; + } + + @ApiModelProperty(example = "1", value = "") + @JsonProperty("step") + @Valid + public Integer getStep() { + return step; + } + public void setStep(Integer step) { + this.step = step; + } + + /** + **/ + public WorkflowTemplateParameters options(List<OptionDetails> options) { + + this.options = options; + return this; + } + + @ApiModelProperty(example = "[{\"entity\":\"roles\",\"values\":\"admin\"},{\"entity\":\"users\",\"values\":\"John\"}]", required = true, value = "") + @JsonProperty("options") + @Valid + @NotNull(message = "Property options cannot be null.") + @Size(min=2) + public List<OptionDetails> getOptions() { + return options; + } + public void setOptions(List<OptionDetails> options) { + this.options = options; + } + + public WorkflowTemplateParameters addOptionsItem(OptionDetails optionsItem) { + this.options.add(optionsItem); + return this; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WorkflowTemplateParameters workflowTemplateParameters = (WorkflowTemplateParameters) o; + return Objects.equals(this.step, workflowTemplateParameters.step) && + Objects.equals(this.options, workflowTemplateParameters.options); + } + + @Override + public int hashCode() { + return Objects.hash(step, options); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class WorkflowTemplateParameters {\n"); + + sb.append(" step: ").append(toIndentedString(step)).append("\n"); + sb.append(" options: ").append(toIndentedString(options)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkFLowEngineService.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkFLowEngineService.java new file mode 100644 index 0000000000..48591c0d66 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkFLowEngineService.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2019, WSO2 LLC. (https://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.rest.api.server.workflow.engine.v1.core; + +import org.wso2.carbon.identity.api.server.common.ContextLoader; +import org.wso2.carbon.identity.api.server.common.error.APIError; +import org.wso2.carbon.identity.api.server.common.error.ErrorResponse; +import org.wso2.carbon.identity.core.util.IdentityTenantUtil; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.core.function.BPSProfilesToExternal; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.dto.WorkFlowEngineDTO; +import org.wso2.carbon.identity.workflow.impl.WorkflowImplException; +import org.wso2.carbon.identity.workflow.impl.WorkflowImplServiceImpl; + +import java.util.List; +import java.util.stream.Collectors; +import javax.ws.rs.core.Response; + +import static org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.core.WorkflowEngineConstants.ErrorMessage.ERROR_CODE_ERROR_RETRIEVING_BPS_PROFILES; + +/** + * Workflow engine service class + */ +public class WorkFLowEngineService { + + private WorkflowImplServiceImpl getWorkflowService() { + + return new WorkflowImplServiceImpl(); + /** + * TODO + * Improve https://github.com/wso2-extensions/identity-workflow-impl-bps to register as a service and + * refer the osgi service here + */ + } + + public List<WorkFlowEngineDTO> listWorkflowEngines() { + + try { + return getWorkflowService() + .listBPSProfiles(IdentityTenantUtil.getTenantId(ContextLoader.getTenantDomainFromContext())) + .stream().map(new BPSProfilesToExternal()).collect(Collectors.toList()); + } catch (WorkflowImplException e) { + throw handleError(Response.Status.INTERNAL_SERVER_ERROR, ERROR_CODE_ERROR_RETRIEVING_BPS_PROFILES); + } + } + + private APIError handleError(Response.Status status, WorkflowEngineConstants.ErrorMessage error) { + return new APIError(status, getErrorBuilder(error).build()); + } + + private ErrorResponse.Builder getErrorBuilder(WorkflowEngineConstants.ErrorMessage errorMsg) { + + return new ErrorResponse.Builder().withCode(errorMsg.getCode()).withMessage(errorMsg.getMessage()) + .withDescription(errorMsg.getDescription()); + } +} diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkflowEngineConstants.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkflowEngineConstants.java new file mode 100644 index 0000000000..ce883f51ac --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkflowEngineConstants.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2019, WSO2 LLC. (https://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.rest.api.server.workflow.engine.v1.core; + +/** + * Workflow engine constants class + */ +public class WorkflowEngineConstants { + + public static final String WORKFLOW_ENGINE_PREFIX = "BPS-"; + + /** + * Enum for server workflow engine related errors in the format of + * Error Code - code to identify the error + * Error Message - What went wrong + * Error Description - Why it went wrong + */ + public enum ErrorMessage { + + ERROR_CODE_ERROR_RETRIEVING_BPS_PROFILES("50001", + "Unable to list workflow engines.", + "Server Encountered an error while retrieving the workflow engines."); + + 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 WorkflowEngineConstants.WORKFLOW_ENGINE_PREFIX + code; + } + + public String getMessage() { + return message; + } + + public String getDescription() { + return description; + } + + @Override + public String toString() { + return code + " | " + message; + } + + } +} diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkflowService.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkflowService.java new file mode 100644 index 0000000000..e6d33fba73 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkflowService.java @@ -0,0 +1,482 @@ +package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.core; + +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.CarbonContext; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.*; +import org.wso2.carbon.identity.workflow.mgt.WorkflowManagementAdminService; +import org.wso2.carbon.identity.workflow.mgt.WorkflowManagementService; +import org.wso2.carbon.identity.workflow.mgt.WorkflowManagementServiceImpl; +import org.wso2.carbon.identity.workflow.mgt.bean.Parameter; +import org.wso2.carbon.identity.workflow.mgt.bean.Workflow; +import org.wso2.carbon.identity.workflow.mgt.dao.WorkflowDAO; +import org.wso2.carbon.identity.workflow.mgt.dto.Association; +import org.wso2.carbon.identity.workflow.mgt.dto.Template; +import org.wso2.carbon.identity.workflow.mgt.exception.WorkflowException; +import org.wso2.carbon.identity.workflow.mgt.exception.WorkflowRuntimeException; +import org.wso2.carbon.identity.workflow.mgt.internal.WorkflowServiceDataHolder; + +import java.util.*; + + +public class WorkflowService { + + private static final Log log = LogFactory.getLog(WorkflowManagementAdminService.class); + private final WorkflowManagementService workflowManagementService; + //WorkflowManagementService worWorkflowServiceHolder. + + public WorkflowService(WorkflowManagementService workflowManagementService){ + this.workflowManagementService = workflowManagementService; + } + + private WorkflowSummary getWorkflow(Workflow workflowBean) { + + WorkflowSummary workflow = null; + + if (workflowBean != null) { + + workflow = new WorkflowSummary(); + + workflow.setId(workflowBean.getWorkflowId()); + workflow.setWorkflowName(workflowBean.getWorkflowName()); + workflow.setWorkflowDescription(workflowBean.getWorkflowDescription()); + workflow.setWorkflowTemplate(workflowBean.getTemplateId()); + workflow.setDeployment(workflowBean.getWorkflowImplId()); + } + return workflow; + } + + private WorkflowAssociation getAssociation(Association associationBean) { + + WorkflowAssociation association = null; + + if (associationBean != null) { + + association = new WorkflowAssociation(); + + association.setId(associationBean.getWorkflowId()); + association.setWorkflowAssociationName(associationBean.getAssociationName()); + association.setOperation(associationBean.getEventName()); + association.setWorkflowName(associationBean.getWorkflowName()); + association.setIsEnabled(associationBean.isEnabled()); + } + return association; + } + + private Parameter setWorkflowImplParameters(String workflowId, String paramName, String paramValue, String qName, String holder){ + Parameter parameter = new Parameter(); + parameter.setWorkflowId(workflowId); + parameter.setParamName(paramName); + parameter.setParamValue(paramValue); + parameter.setqName(qName); + parameter.setHolder(holder); + return parameter; + } + + /** + * Add new workflow + * + * Request Body: WorkflowCreation + * { + * "workflowName": "User Registration Workflow", + * "workflowDescription": "Workflow to approve new user registrations before account activation", + * "workflowTemplate": { + * "name": "MultiStepApproval", + * "steps": [ + * { + * "step": 1, + * "options": [ + * { + * "entity": "roles", + * "values": "Internal/admin" + * }, + * { + * "entity": "users", + * "values": "John" + * } + * + * ] + * }, + * { + * "step": 2, + * "options": [ + * { + * "entity": "roles", + * "values": "Manager" + * }, + * { + * "entity": "users", + * "values": "" + * } + * + * ] + * } + * ] + * }, + * "workflowEngine": "workflowImplSimple", + * "ApprovalTask": "User Registration Approval", + * "ApprovalTaskDescription": "Approval task to validate and approve new user registrations before account activation" + * } + * + * Response: WorkflowSummary + * { + * "id": "748159b8-67fe-4030-9348-bf322d32b267", + * "workflowName": "User Registration Workflow", + * "workflowDescription": "Workflow to approve new user registrations before account activation", + * "workflowTemplate": "MultiStepApprovalTemplate", + * "deployment": "workflowImplSimple" + * } + * + * @param workflow Workflow details + * @throws WorkflowException + */ + public WorkflowSummary addWorkflow(WorkflowCreation workflow, String id) { + + if (StringUtils.isBlank(id)) { + id = UUID.randomUUID().toString(); + } + int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); + WorkflowSummary workflowSummary = new WorkflowSummary(); + Workflow workflowBean = new Workflow(); + + try { + workflowBean.setWorkflowId(id); + workflowBean.setWorkflowName(workflow.getWorkflowName()); + workflowBean.setWorkflowDescription(workflow.getWorkflowDescription()); +// String templateId = workflow.getTemplateId() == null ? workflow.getTemplate().getTemplateId() : +// workflow.getTemplateId(); + String templateId = workflow.getWorkflowTemplate().getName(); + if (templateId == null) { + throw new WorkflowException("template id can't be empty"); + } + workflowBean.setTemplateId(templateId); +// String workflowImplId = +// workflow.getWorkflowImplId() == null ? workflow.getWorkflowImpl().getWorkflowImplId() : +// workflow.getWorkflowImplId(); + String workflowImplId = workflow.getWorkflowEngine(); + if (workflowImplId == null) { + throw new WorkflowException("workflowimpl id can't be empty"); + } + workflowBean.setWorkflowImplId(workflowImplId); + + // Setting up the Template ParameterList + + List<WorkflowTemplateParameters> templateProperties = workflow.getWorkflowTemplate().getSteps(); + + List<Parameter> parameterList = new ArrayList<>(); + + for (WorkflowTemplateParameters properties: templateProperties){ + for (OptionDetails options: properties.getOptions() ){ + Parameter parameter = setWorkflowImplParameters(null, "UserAndRole", options.getValues(), "UserAndRole-step-" + properties.getStep() + "-" + options.getEntity(), "Template"); + parameterList.add(parameter); + } + + } + + // Setting up workflow impl parameter list + Parameter taskParameterDesc; + if (StringUtils.isBlank(id)) { + taskParameterDesc = setWorkflowImplParameters(null,"HTDescription" , workflow.getApprovalTaskDescription(), "HTDescription", "Workflowimpl" ); + } else { + taskParameterDesc = setWorkflowImplParameters(id,"HTDescription" , workflow.getApprovalTaskDescription(), "HTDescription", "Workflowimpl" ); + } + parameterList.add(taskParameterDesc); + + Parameter taskParameterSubject; + if (StringUtils.isBlank(id)) { + taskParameterSubject = setWorkflowImplParameters(null,"HTSubject" , workflow.getApprovalTask(), "HTSubject", "Workflowimpl" ); + } else { + taskParameterSubject = setWorkflowImplParameters(id,"HTSubject" , workflow.getApprovalTask(), "HTSubject", "Workflowimpl" ); + } + parameterList.add(taskParameterSubject); + + Parameter workflowParameter = setWorkflowImplParameters(id,"WorkflowName" , workflow.getWorkflowName(), "WorkflowName", "Workflowimpl" ); + parameterList.add(workflowParameter); + +// +// List<Parameter> parameterList = new ArrayList<>(); +// if (workflow.getTemplateParameters() != null) { +// parameterList.addAll(Arrays.asList(workflow.getTemplateParameters())); +// } +// if (workflow.getWorkflowImplParameters() != null) { +// parameterList.addAll(Arrays.asList(workflow.getWorkflowImplParameters())); +// } + +// WorkflowServiceDataHolder.getInstance().getWorkflowService() +// .addWorkflow(workflowBean, parameterList, tenantId); + workflowManagementService.addWorkflow(workflowBean, parameterList, tenantId); + workflowSummary = getWorkflow(workflowBean); + } catch (WorkflowRuntimeException e) { +// throw new WorkflowException(e.getMessage()); + + } catch (WorkflowException e) { +// throw new WorkflowException("Server error occured when adding the workflow"); + } + return getWorkflow(workflowBean); + } + + + + /** + * Retrieve workflow from workflow ID + * + * @param workflowId workflow id + * @return + * @throws WorkflowException + */ + public DetailedWorkflow getWorkflow(String workflowId) { + + try { +// Workflow workflowBean = +// WorkflowServiceDataHolder.getInstance().getWorkflowService().getWorkflow(workflowId); + Workflow workflowBean = workflowManagementService.getWorkflow(workflowId); + List<Parameter> workflowParameters = workflowManagementService.getWorkflowParameters(workflowId); + + return getDetailedWorkflow(workflowBean, workflowParameters); + } catch (WorkflowException e) { + + log.error("Server error when retrieving workflow by the given id ", e); + + } + return null; + } + + private DetailedWorkflow getDetailedWorkflow(Workflow workflowBean, List<Parameter> workflowParameters) throws WorkflowException{ + + DetailedWorkflow detailedWorkflow = new DetailedWorkflow(); + + detailedWorkflow.setWorkflowName(workflowBean.getWorkflowName()); + detailedWorkflow.setWorkflowDescription(workflowBean.getWorkflowDescription()); + + DetailedWorkflowTemplate workflowTemplate = new DetailedWorkflowTemplate(); + workflowTemplate.setName(workflowBean.getTemplateId()); + + Template template = workflowManagementService.getTemplate(workflowBean.getTemplateId()); + workflowTemplate.setTemplateDescription(template.getDescription()); + + List<WorkflowTemplateParameters> additionalProperties = new ArrayList<>(); + Map<Integer, WorkflowTemplateParameters> templateParamsMap = new HashMap<>(); + + for (Parameter parameter : workflowParameters) { + + if ("Template".equals(parameter.getHolder())) { + String[] params = parameter.getqName().split("-"); + int stepNumber = Integer.parseInt(params[2]); + + // Check if there's already a WorkflowTemplateParameters object for this step + WorkflowTemplateParameters templateParameters = templateParamsMap.getOrDefault(stepNumber, new WorkflowTemplateParameters()); + templateParameters.setStep(stepNumber); + + // Create and add new OptionDetails + OptionDetails details = new OptionDetails(); + details.setEntity(params[3]); + details.setValues(parameter.getParamValue()); + + // Ensure the list exists and add new details + if (templateParameters.getOptions() == null) { + templateParameters.setOptions(new ArrayList<>()); + } + templateParameters.getOptions().add(details); + + // Update the map + templateParamsMap.put(stepNumber, templateParameters); + } else if ("HTSubject".equals(parameter.getParamName())){ + + if (parameter.getParamName().equals("HTSubject")){ + detailedWorkflow.setApprovalTask(parameter.getParamValue()); + } else if ("HTDescription".equals(parameter.getParamName())){ + detailedWorkflow.setApprovalTaskDescription(parameter.getParamValue()); + } + } + } + List<WorkflowTemplateParameters> templateParams = new ArrayList<>(templateParamsMap.values()); + + workflowTemplate.setProperties(templateParams); + detailedWorkflow.setWorkflowTemplate(workflowTemplate); + detailedWorkflow.setWorkflowEngine(workflowBean.getWorkflowImplId()); + + return detailedWorkflow; + } + + + /** + * List paginated workflows of a tenant. + * + * @param limit Limit + * @param offset Offset + * @param filter filter + * @return WorkflowWizard[] + * @throws WorkflowException + */ + + public WorkflowSummary[] listPaginatedWorkflows(Integer limit, Integer offset, String filter) { + + List<WorkflowSummary> workflowSummaryList = new ArrayList<>(); + List<Workflow> workflowBeans = null; + int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); + try { + if (limit == null || offset == null){ + limit = 15; + offset = 0; + } else { + limit = limit.intValue(); + offset = offset.intValue(); + } + //workflowBeans = WorkflowServiceDataHolder.getInstance().getWorkflowService().listPaginatedWorkflows(tenantId, limit, offset, filter); + workflowBeans = workflowManagementService.listPaginatedWorkflows(tenantId, limit, offset, filter); + for (Workflow workflow : workflowBeans) { + WorkflowSummary workflowTmp = getWorkflow(workflow); + workflowSummaryList.add(workflowTmp); + } + + } catch (WorkflowException e) { + log.error("Server error when retrieving available workflows ", e); + + } + return workflowSummaryList.toArray(new WorkflowSummary[workflowSummaryList.size()]); + + } + + /** + * Remove a workflow + * + * @param id ID of workflow to remove + * @return + * @throws WorkflowException + */ + public WorkflowSummary removeWorkflow(String id) { + + try { + //WorkflowServiceDataHolder.getInstance().getWorkflowService().removeWorkflow(id); + WorkflowSummary workflow = getWorkflow(workflowManagementService.getWorkflow(id)); + workflowManagementService.removeWorkflow(id); + + return workflow; + } catch (WorkflowException e) { + //throw new WorkflowException("Server error occurred when removing workflow"); + log.error("Error occurred when removing workflow with ID: " + id, e); + } + return null; + } + + /** + * List paginated associations of a tenant. + * + * @param limit Limit + * @param offset Offset + * @param filter Filter + * @return Association[] + * @throws WorkflowException + */ + public WorkflowAssociation[] listPaginatedAssociations(Integer limit, Integer offset, String filter) { + + List<WorkflowAssociation> associations = new ArrayList<>(); + List<Association> associationBeans = null; + + try { + + if (limit == null || offset == null){ + limit = 15; + offset = 0; + } else { + limit = limit.intValue(); + offset = offset.intValue(); + } + int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); +// associationBeans = WorkflowServiceDataHolder.getInstance().getWorkflowService().listPaginatedAssociations(tenantId, limit, offset, filter); + associationBeans = workflowManagementService.listPaginatedAssociations(tenantId, limit, offset, filter); + for (Association associationBean: associationBeans){ + WorkflowAssociation associationTmp = getAssociation(associationBean); + associations.add(associationTmp); + } + + } catch (WorkflowException e) { +// throw new WorkflowException(WFConstant.Exceptions.ERROR_LISTING_ASSOCIATIONS, e); + log.error("Error occurred when retrieving all the available workflow associations", e); + + } + if (CollectionUtils.isEmpty(associations)) { + return new WorkflowAssociation[0]; + } + return associations.toArray(new WorkflowAssociation[associations.size()]); + } + + /** + * Remove association + * + * @param associationId ID of association to remove + * @throws WorkflowException + */ + public String removeAssociation(int associationId) { + + try { +// WorkflowServiceDataHolder.getInstance().getWorkflowService() +// .removeAssociation(Integer.parseInt(associationId)); + workflowManagementService.removeAssociation(associationId); + return "Workflow association successfully removed!"; + } catch (WorkflowException e) { + log.error("Server error when removing association " + associationId, e); + return "Server error when removing association" + associationId; + } + } + + /** + * Add new workflow association + * + * @param associationName Name for the association + * @param workflowId Workflow to associate + * @param eventId Event to associate + * @param condition Condition to check the event for associating + * @throws WorkflowException + */ + private String addAssociation(String associationName, String workflowId, String eventId, String condition) { + + try { +// WorkflowServiceDataHolder.getInstance().getWorkflowService() +// .addAssociation(associationName, workflowId, eventId, condition); + workflowManagementService.addAssociation(associationName, workflowId, eventId, condition); + return "Workflow Association successfully added!"; + + } catch (WorkflowRuntimeException e) { + log.error("Error when adding association " + associationName, e); + return "Error when adding association" + associationName; + } catch (WorkflowException e) { + log.error("Server error when adding association of workflow " + workflowId + " with " + eventId, e); + return "Server error when adding association of workflow" + workflowId + " with " + eventId; + } + } + + public String addAssociation(WorkflowAssociationCreation workflowAssociation){ + return addAssociation(workflowAssociation.getAssociationName(), workflowAssociation.getWorkflowId(), workflowAssociation.getOperationName(), workflowAssociation.getAssociationCondition()); + } + + /** + * Enable or disable association + * + * @param associationId Association ID + * @param isEnable New state + * @throws WorkflowException + */ + private String changeAssociationState(String associationId, boolean isEnable) { + try { +// WorkflowServiceDataHolder.getInstance().getWorkflowService() +// .changeAssociationState(associationId, isEnable); + workflowManagementService.changeAssociationState(associationId, isEnable); + } catch (WorkflowRuntimeException e) { + log.error("Error when changing an association ", e); + } catch (WorkflowException e) { + log.error("Server error when changing state of association ", e); + } + return "Workflow Association Status successfully updated!"; + + } + public String changeAssociationState(Integer associationId, Status status){ + boolean isEnable = (status.getAction() == ActionStatus.ENABLE); + String id = Integer.toString(associationId); + return changeAssociationState(id, isEnable); + } + +} + diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/function/BPSProfilesToExternal.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/function/BPSProfilesToExternal.java new file mode 100644 index 0000000000..c48a313456 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/function/BPSProfilesToExternal.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2019, WSO2 LLC. (https://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.rest.api.server.workflow.engine.v1.core.function; + +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.dto.WorkFlowEngineDTO; +import org.wso2.carbon.identity.workflow.impl.bean.BPSProfile; + +import java.util.function.Function; + +/** + * Transform BPSProfile to WorkFlowEngineDTO + */ +public class BPSProfilesToExternal implements Function<BPSProfile, WorkFlowEngineDTO> { + + @Override + public WorkFlowEngineDTO apply(BPSProfile bpsProfile) { + + WorkFlowEngineDTO workFlowEngineDTO = new WorkFlowEngineDTO(); + workFlowEngineDTO.setProfileName(bpsProfile.getProfileName()); + workFlowEngineDTO.setManagerHostURL(bpsProfile.getManagerHostURL()); + workFlowEngineDTO.setWorkerHostURL(bpsProfile.getWorkerHostURL()); + workFlowEngineDTO.setUserName(bpsProfile.getUsername()); + return workFlowEngineDTO; + } +} diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowServiceFactory.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowServiceFactory.java new file mode 100644 index 0000000000..acc49e6fe1 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowServiceFactory.java @@ -0,0 +1,34 @@ +package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.factories; + +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.core.WorkflowService; +import org.wso2.carbon.identity.workflow.mgt.WorkflowManagementService; +import org.wso2.carbon.identity.workflow.mgt.WorkflowManagementServiceImpl; + +/** + * Factory class for WorkflowService. + */ +public class WorkflowServiceFactory { + + private static final WorkflowService SERVICE; + + static { + WorkflowManagementService workflowManagementService = new WorkflowManagementServiceImpl(); + + if (workflowManagementService == null) { + throw new IllegalStateException("WorkflowManagementService is not available."); + } + + SERVICE = new WorkflowService(workflowManagementService); + } + + /** + * Get WorkflowService. + * + * @return WorkflowService. + */ + public static WorkflowService getWorkflowService() { + + return SERVICE; + } + +} diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowAssociationsApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowAssociationsApiServiceImpl.java new file mode 100644 index 0000000000..50524f4873 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowAssociationsApiServiceImpl.java @@ -0,0 +1,69 @@ +/* + * 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.rest.api.server.workflow.engine.v1.impl; + +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.*; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.core.WorkflowService; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.factories.WorkflowServiceFactory; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.*; +import java.util.List; + +import javax.ws.rs.core.Response; + +public class WorkflowAssociationsApiServiceImpl implements WorkflowAssociationsApiService { + + private final WorkflowService workflowService; + + public WorkflowAssociationsApiServiceImpl() { + + try { + this.workflowService = WorkflowServiceFactory.getWorkflowService(); + } catch (IllegalStateException e) { + throw new RuntimeException("Error occurred while initiating Workflow Service", e); + } + } + + @Override + public Response createWorkflowAssociation(WorkflowAssociationCreation requestBody) { + + // do some magic! + return Response.ok().entity(workflowService.addAssociation(requestBody)).build(); + } + + @Override + public Response deleteWorkflowAssociationById(Integer associationId) { + + // do some magic! + return Response.ok().entity(workflowService.removeAssociation(associationId)).build(); + } + + @Override + public Response listWorkflowAssociations(Integer limit, Integer offset, String filter) { + + // do some magic! + return Response.ok().entity(workflowService.listPaginatedAssociations(limit, offset, filter)).build(); + } + + @Override + public Response updateWorkflowAssociationStatus(Integer associationId, Status status) { + + // do some magic! + return Response.ok().entity(workflowService.changeAssociationState(associationId, status)).build(); + } +} diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowEnginesApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowEnginesApiServiceImpl.java new file mode 100644 index 0000000000..988fa95bc6 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowEnginesApiServiceImpl.java @@ -0,0 +1,35 @@ +/* + * 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.rest.api.server.workflow.engine.v1.impl; + +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.*; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.*; +import java.util.List; + +import javax.ws.rs.core.Response; + +public class WorkflowEnginesApiServiceImpl implements WorkflowEnginesApiService { + + @Override + public Response searchWorkFlowEngines() { + + // do some magic! + return Response.ok().entity("magic!").build(); + } +} diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowsApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowsApiServiceImpl.java new file mode 100644 index 0000000000..2d86a1fd2c --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowsApiServiceImpl.java @@ -0,0 +1,76 @@ +/* + * 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.rest.api.server.workflow.engine.v1.impl; + +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.*; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.core.WorkflowService; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.factories.WorkflowServiceFactory; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.*; +import java.util.List; + +import javax.ws.rs.core.Response; + +public class WorkflowsApiServiceImpl implements WorkflowsApiService { + + private final WorkflowService workflowService; + + public WorkflowsApiServiceImpl() { + + try { + this.workflowService = WorkflowServiceFactory.getWorkflowService(); + } catch (IllegalStateException e) { + throw new RuntimeException("Error occurred while initiating Workflow Service", e); + } + } + + @Override + public Response createWorkflow(WorkflowCreation requestBody) { + + // do some magic! + return Response.ok().entity(workflowService.addWorkflow(requestBody, null)).build(); + } + + @Override + public Response deleteWorkflowById(String workflowId) { + + // do some magic! + return Response.ok().entity(workflowService.removeWorkflow(workflowId)).build(); + } + + @Override + public Response getWorkflowById(String workflowId) { + + // do some magic! + return Response.ok().entity(workflowService.getWorkflow(workflowId)).build(); + } + + @Override + public Response listWorkflows(Integer limit, Integer offset, String filter) { + + // do some magic! + return Response.ok().entity(workflowService.listPaginatedWorkflows(limit, offset, filter)).build(); + } + + @Override + public Response updateWorkflow(String workflowId, WorkflowCreation requestBody) { + + // do some magic! + return Response.ok().entity(workflowService.addWorkflow(requestBody, workflowId)).build(); + } +} diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/resources/workflow-engine.yaml b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/resources/workflow-engine.yaml new file mode 100644 index 0000000000..25cfa7d0ff --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/resources/workflow-engine.yaml @@ -0,0 +1,718 @@ +openapi: 3.0.0 +info: + title: WorkFlow Engine + description: This is the RESTful API for managing WorkFlow Engines in WSO2 Identity + Server + contact: + name: WSO2 Identity Server + url: https://wso2.com/identity-and-access-management/ + email: architecture@wso2.com + license: + name: Apache 2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + version: v1 +servers: + - url: "https://localhost:9443/t/{tenant-domain}/api/server/v1" +security: + - OAuth2: [] + - BasicAuth: [] +tags: + - name: default + description: Secured Admin-only calls +paths: + /workflow-engines: + get: + summary: Retrieve all the available workflow engines. + description: | + Retrieve metadata information of all the workflow engines in the system. + + <b>Permission required:</b> + * /permission/admin/manage/humantask/viewtasks + operationId: searchWorkFlowEngines + responses: + "200": + description: search results matching criteria + content: + '*/*': + schema: + type: array + items: + $ref: '#/components/schemas/WorkflowEngine' + '400': + $ref: '#/components/responses/InvalidInput' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/ServerError' + /workflows: + get: + summary: Retrieve all the available workflows. + description: | + Retrieve all the available workflows in the system. + + <b>Permission required:</b> + * /permission/admin/manage/humantask/viewtasks + operationId: listWorkflows + parameters: + - $ref: '#/components/parameters/limitQueryParam' + - $ref: '#/components/parameters/offsetQueryParam' + - $ref: '#/components/parameters/filterQueryParam' + responses: + "200": + description: Array of workflows + content: + 'application/json': + schema: + type: array + items: + $ref: '#/components/schemas/WorkflowSummary' + example: + - id: "100" + workflowName: User Registration Approval + workflowDescription: Approves new user registrations before account + activation + workflowTemplate: MultiStepApprovalTemplate + deployment: ApprovalWorkflow + - id: "101" + workflowName: Role Change Request + workflowDescription: Approves requests for changing user roles + workflowTemplate: MultiStepApprovalTemplate + deployment: ApprovalWorkflow + - id: "102" + workflowName: User Deactivation Workflow + workflowDescription: Ensures proper approvals before deactivating + a user account + workflowTemplate: SingleStepApprovalTemplate + deployment: ApprovalWorkflow + '400': + $ref: '#/components/responses/InvalidInput' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/ServerError' + post: + summary: Create a new workflow. + description: | + Create a new workflow using the specified workflow template and execution engine. + + <b>Permission required:</b> + * /permission/admin/manage/humantask/viewtasks + operationId: createWorkflow + requestBody: + description: Contains the details of the newly created workflow. + content: + 'application/json': + schema: + $ref: '#/components/schemas/WorkflowCreation' + required: true + responses: + "201": + description: Item Created + content: + 'application/json': + schema: + $ref: '#/components/schemas/WorkflowSummary' + example: + id: "100" + workflowName: User Registration Approval + workflowDescription: Approves new user registrations before account + activation + workflowTemplate: MultiStepApprovalTemplate + deployment: ApprovalWorkflow + '400': + $ref: '#/components/responses/InvalidInput' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '409': + $ref: '#/components/responses/Conflict' + '500': + $ref: '#/components/responses/ServerError' + x-codegen-request-body-name: Request Body + /workflows/{workflow-id}: + get: + summary: Retrieve the workflow by workflow id. + description: "Retrieve information about a specific workflow identified by the\ + \ workflow id.\n \n <b>Permission required:</b>\n * /permission/admin/manage/humantask/viewtasks\n" + operationId: getWorkflowById + parameters: + - $ref: '#/components/parameters/workflowIdPathParam' + responses: + "200": + description: Information about the workflow identified by the workflow-id. + content: + 'application/json': + schema: + $ref: '#/components/schemas/DetailedWorkflow' + example: + id: "100" + workflowName: User Registration Approval + workflowDescription: Approves new user registrations before account + activation + workflowTemplate: + name: MultiStepApproval + templateDescription: "The operation should be approved by an authorized\ + \ person with given role, to complete." + properties: + - paramName: UserAndRole + paramValue: Internal/admin + qName: UserAndRoles-step-1-roles + - paramName: UserAndRole + paramValue: John + qName: UserAndRoles-step-1-users + - paramName: UserAndRole + paramValue: "" + qName: UserAndRoles-step-2-roles + - paramName: UserAndRole + paramValue: "John,Tom" + qName: UserAndRoles-step-2-users + workflowEngine: Simple Workflow Engine + ApprovalTask: Sample Approval Task + ApprovalTaskDescription: This is an approval task + '400': + $ref: '#/components/responses/InvalidInput' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/ServerError' + put: + summary: Update an existing workflow. + description: | + Update a workflow identified by workflow-id. + + <b>Permission required:</b> + * /permission/admin/manage/humantask/viewtasks + operationId: updateWorkflow + parameters: + - $ref: '#/components/parameters/workflowIdPathParam' + requestBody: + description: Contains the details of the updated workflow. + content: + 'application/json': + schema: + $ref: '#/components/schemas/WorkflowCreation' + required: false + responses: + '200': + $ref: '#/components/responses/Updated' + '400': + $ref: '#/components/responses/InvalidInput' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/ServerError' + x-codegen-request-body-name: Request Body + delete: + summary: Delete the workflow by workflow-id. + description: "Delete a specific workflow identified by the workflow-id.\n \n\ + \ <b>Permission required:</b>\n * /permission/admin/manage/humantask/viewtasks\n" + operationId: deleteWorkflowById + parameters: + - $ref: '#/components/parameters/workflowIdPathParam' + responses: + '204': + $ref: '#/components/responses/Deleted' + '400': + $ref: '#/components/responses/InvalidInput' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/ServerError' + /workflow-associations: + get: + summary: Retrieve all the available workflow associations. + description: "Retrieve all the available workflow associations in the system.\n\ + \ \n <b>Permission required:</b>\n * /permission/admin/manage/humantask/viewtasks\n" + operationId: listWorkflowAssociations + parameters: + - $ref: '#/components/parameters/limitQueryParam' + - $ref: '#/components/parameters/offsetQueryParam' + - $ref: '#/components/parameters/filterQueryParam' + responses: + "200": + description: Array of workflow associations matching the search criteria + content: + 'application/json': + schema: + type: array + items: + $ref: '#/components/schemas/WorkflowAssociation' + example: + - id: "500" + workflowAssociationName: User Registration Workflow Association + operation: Add User + workflowName: User Registration Approval + associationCondition: "true" + isEnabled: "true" + - id: "501" + workflowAssociationName: Role Update Workflow Association + operation: Update Role + workflowName: Role Change Request + associationCondition: "false" + isEnabled: "true" + - id: "502" + workflowAssociationName: Delete User Workflow Association + operation: Delete User + workflowName: User Deactivation Workflow + associationCondition: "false" + isEnabled: "false" + '400': + $ref: '#/components/responses/InvalidInput' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/ServerError' + post: + summary: Create a new workflow association. + description: | + Create a new workflow association by assigning a user operation to an existing workflow. + + <b>Permission required:</b> + * /permission/admin/manage/humantask/viewtasks + operationId: createWorkflowAssociation + requestBody: + description: Contains the details of the newly created workflow association. + content: + 'application/json': + schema: + $ref: '#/components/schemas/WorkflowAssociationCreation' + required: true + responses: + "201": + description: Item Created + content: + 'application/json': + schema: + $ref: '#/components/schemas/WorkflowAssociation' + '400': + $ref: '#/components/responses/InvalidInput' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '409': + $ref: '#/components/responses/Conflict' + '500': + $ref: '#/components/responses/ServerError' + x-codegen-request-body-name: Request Body + /workflow-associations/{association-id}: + delete: + summary: Delete the workflow association by association id. + description: "Delete a specific workflow association identified by the association\ + \ id.\n \n <b>Permission required:</b>\n * /permission/admin/manage/humantask/viewtasks\n" + operationId: deleteWorkflowAssociationById + parameters: + - $ref: '#/components/parameters/associationIdPathParam' + responses: + '204': + $ref: '#/components/responses/Deleted' + '400': + $ref: '#/components/responses/InvalidInput' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/ServerError' + /workflow-associations/{association-id}/status: + put: + summary: Update the status of a workflow association. + description: | + Enable or disable a specific workflow association. + + <b>Permission required:</b> + * /permission/admin/manage/humantask/viewtasks + operationId: updateWorkflowAssociationStatus + parameters: + - $ref: '#/components/parameters/associationIdPathParam' + requestBody: + description: Status of the workflow association (enable/disable) + content: + 'application/json': + schema: + $ref: "#/components/schemas/Status" + required: false + responses: + '200': + $ref: '#/components/responses/Updated' + '400': + $ref: '#/components/responses/InvalidInput' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/ServerError' + x-codegen-request-body-name: status +components: + schemas: + WorkflowEngine: + type: object + required: + - profileName + properties: + profileName: + type: string + example: embedded_bps + description: A unique name for the workflow engine. + workerHostURL: + type: string + example: https://localhost:9443/services + description: URL of the workflow worker node. + managerHostURL: + type: string + example: https://localhost:9443/services + description: URL of the workflow manager node. + userName: + type: string + example: challengeQuestion1 + description: Username of the creator of the workflow engine. + + WorkflowTemplateParameters: + type: object + properties: + step: + type: integer + example: 1 + options: + type: array + minItems: 2 + items: + $ref: "#/components/schemas/OptionDetails" + example: [ + { + "entity": "roles", + "values": "admin" + }, + { + "entity": "users", + "values": "John" + } + ] + required: ["steps", "options"] + + OptionDetails: + type: object + properties: + entity: + type: string + example: "roles" + values: + type: string + example: "admin" + + WorkflowSummary: + type: object + properties: + id: + type: string + example: 100 + description: "Unique id to represent a workflow" + workflowName: + type: string + example: "User Role Approval" + description: "Display name of the workflow" + workflowDescription: + type: string + example: "Workflow to approve new user registrations before account activation" + description: "Detailed description of the workflow" + workflowTemplate: + type: string + example: "MultiStepApprovalTemplate" + description: "Template defining the approval process for the workflow" + deployment: + type: string + example: "ApprovalWorkflow" + description: "Category in which the workflow is deployed" + + DetailedWorkflow: + type: object + required: + - workflowName + - workflowEngine + - ApprovalTask + properties: + workflowName: + type: string + example: "User Registration Workflow" + description: "Name of the created workflow" + workflowDescription: + type: string + example: "Workflow to approve new user registrations before account activation" + description: "Description of the created workflow" + workflowTemplate: + $ref: "#/components/schemas/DetailedWorkflowTemplate" + workflowEngine: + type: string + example: "Simple Workflow Engine" + description: "Name of the selected workflow engine" + ApprovalTask: + type: string + example: "User Registration Approval" + description: "Approval task subject to display" + ApprovalTaskDescription: + type: string + example: "Approval task to validate and approve new user registrations before account activation" + description: "Description of the approval task" + + + DetailedWorkflowTemplate: + type: object + properties: + name: + type: string + example: "MultiStepApproval" + description: "Name of the workflow template" + templateDescription: + type: string + example: "The operation should be approved by an authorized person with given role, to complete." + description: "Description of the workflow template" + properties: + type: array + items: + $ref: "#/components/schemas/WorkflowTemplateParameters" + required: + - name + + + WorkflowAssociation: + type: object + properties: + id: + type: string + example: "500" + description: "Unique id to represent a workflow association" + workflowAssociationName: + type: string + example: "User registration Workflow Association" + description: "Name of the workflow association" + operation: + type: string + example: "Add User" + description: "User Operation" + workflowName: + type: string + example: "User Registration Approval" + description: "Assigned Workflow" + isEnabled: + type: boolean + example: true + description: "Association Status" + + WorkflowCreation: + type: object + required: + - workflowName + - workflowTemplate + - workflowEngine + - ApprovalTask + properties: + workflowName: + type: string + example: "User Registration Workflow" + description: "Name of the created workflow" + workflowDescription: + type: string + example: "Workflow to approve new user registrations before account activation" + description: "Description of the created workflow" + workflowTemplate: + $ref: "#/components/schemas/WorkflowTemplate" + workflowEngine: + type: string + example: "Simple Workflow Engine" + description: "Name of the selected workflow engine" + ApprovalTask: + type: string + example: "User Registration Approval" + description: "Approval task subject to display" + ApprovalTaskDescription: + type: string + example: "Approval task to validate and approve new user registrations before account activation" + description: "Description of the approval task" + + WorkflowTemplate: + type: object + properties: + name: + type: string + example: "MultiStepApproval" + description: "Name of the workflow template" + steps: + type: array + minItems: 1 + items: + $ref: "#/components/schemas/WorkflowTemplateParameters" + + + WorkflowAssociationCreation: + type: object + required: + - associationName + - operationCategory + - operationName + - workflowId + properties: + associationName: + type: string + example: "User Registration Workflow Association" + description: "Name of the workflow association" + operationCategory: + type: string + example: "User Store Operations" + description: "Operation type" + operationName: + type: string + example: "Add User" + description: "Name of the user operation" + workflowId: + type: string + example: "456" + description: "Id of the assigned workflow" + associationCondition: + type: string + example: "Role Name equals Manager" + description: "Condition added to the association" + + Status: + type: object + properties: + action: + $ref: "#/components/schemas/ActionStatus" + + ActionStatus: + type: string + enum: + - ENABLE + - DISABLE + description: "Indicates whether to enable or disable the workflow association" + + Error: + required: + - code + - message + type: object + properties: + code: + type: string + example: some_error_code + message: + type: string + example: Some Error Message + description: + type: string + example: Some Error Description + traceId: + type: string + example: Some Trace ID + responses: + NotFound: + description: The specified resource is not found + content: + 'application/json': + schema: + $ref: '#/components/schemas/Error' + Unauthorized: + description: Unauthorized + Forbidden: + description: Forbidden + ServerError: + description: Internal Server Error + content: + 'application/json': + schema: + $ref: '#/components/schemas/Error' + InvalidInput: + description: Invalid input request + content: + 'application/json': + schema: + $ref: '#/components/schemas/Error' + Conflict: + description: Item Already Exists + content: + 'application/json': + schema: + $ref: '#/components/schemas/Error' + Deleted: + description: Item Deleted + Updated: + description: Item Updated + parameters: + workflowIdPathParam: + name: workflow-id + in: path + description: Workflow ID + required: true + schema: + type: string + associationIdPathParam: + name: association-id + in: path + description: Workflow Association ID + required: true + schema: + type: integer + format: int32 + offsetQueryParam: + name: offset + in: query + description: Number of records to skip for pagination + schema: + minimum: 0 + type: integer + format: int32 + limitQueryParam: + name: limit + in: query + description: Maximum number of records to return + schema: + minimum: 15 + type: integer + format: int32 + filterQueryParam: + name: filter + in: query + description: "Records, filtered by their name" + schema: + type: string + securitySchemes: + BasicAuth: + type: http + scheme: basic + OAuth2: + type: oauth2 + flows: + authorizationCode: + authorizationUrl: https://localhost:9443/oauth2/authorize + tokenUrl: https://localhost:9443/oauth2/token + scopes: {} +x-original-swagger-version: "2.0" diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/pom.xml b/components/org.wso2.carbon.identity.api.server.workflow.engine/pom.xml new file mode 100644 index 0000000000..20baec3fe9 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/pom.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ 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. + --> +<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"> + <parent> + <artifactId>identity-api-server</artifactId> + <groupId>org.wso2.carbon.identity.server.api</groupId> + <version>1.3.84-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent> + <packaging>pom</packaging> + <modules> + <module>org.wso2.carbon.identity.api.server.workflow.engine.common</module> + <module>org.wso2.carbon.identity.rest.api.server.workflow.engine.v1</module> + </modules> + <modelVersion>4.0.0</modelVersion> + + <artifactId>org.wso2.carbon.identity.api.server.workflow.engine</artifactId> + + <properties> + <maven.compiler.source>11</maven.compiler.source> + <maven.compiler.target>11</maven.compiler.target> + </properties> + +</project> \ No newline at end of file From ade64befd625314837c3243351349a789b5250f5 Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Sat, 1 Mar 2025 23:32:46 +0530 Subject: [PATCH 03/47] Update copyright banner --- .../pom.xml | 19 ++++++ .../engine/common/WorkflowServiceHolder.java | 18 +++++ .../pom.xml | 68 +++++++++---------- .../engine/v1/WorkflowAssociationsApi.java | 10 +-- .../v1/WorkflowAssociationsApiService.java | 10 +-- .../engine/v1/WorkflowEnginesApi.java | 11 +-- .../engine/v1/WorkflowEnginesApiService.java | 10 +-- .../workflow/engine/v1/WorkflowsApi.java | 8 +-- .../engine/v1/WorkflowsApiService.java | 11 +-- .../workflow/engine/v1/dto/ErrorDTO.java | 11 +-- .../engine/v1/dto/WorkFlowEngineDTO.java | 6 +- ...WorkflowAssociationsApiServiceFactory.java | 2 +- .../WorkflowEnginesApiServiceFactory.java | 2 +- .../factories/WorkflowsApiServiceFactory.java | 2 +- .../engine/v1/core/WorkFLowEngineService.java | 6 +- .../v1/core/WorkflowEngineConstants.java | 6 +- .../engine/v1/core/WorkflowService.java | 20 ++++++ .../core/function/BPSProfilesToExternal.java | 6 +- .../v1/factories/WorkflowServiceFactory.java | 18 +++++ .../WorkflowAssociationsApiServiceImpl.java | 6 +- .../impl/WorkflowEnginesApiServiceImpl.java | 5 +- .../v1/impl/WorkflowsApiServiceImpl.java | 7 +- .../pom.xml | 2 +- 23 files changed, 146 insertions(+), 118 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.api.server.workflow.engine.common/pom.xml b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.api.server.workflow.engine.common/pom.xml index 1e13c41c38..594658e6ae 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.api.server.workflow.engine.common/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.api.server.workflow.engine.common/pom.xml @@ -1,4 +1,23 @@ <?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"> diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.api.server.workflow.engine.common/src/main/java/org/wso2/carbon/identity/api/server/workflow/engine/common/WorkflowServiceHolder.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.api.server.workflow.engine.common/src/main/java/org/wso2/carbon/identity/api/server/workflow/engine/common/WorkflowServiceHolder.java index b08d7f0bab..43680c05a9 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.api.server.workflow.engine.common/src/main/java/org/wso2/carbon/identity/api/server/workflow/engine/common/WorkflowServiceHolder.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.api.server.workflow.engine.common/src/main/java/org/wso2/carbon/identity/api/server/workflow/engine/common/WorkflowServiceHolder.java @@ -1,3 +1,21 @@ +/* + * 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.engine.common; import org.wso2.carbon.identity.workflow.mgt.WorkflowManagementService; diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/pom.xml b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/pom.xml index 94f6f03f9f..9d87c03652 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - ~ Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + ~ 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 @@ -37,39 +37,39 @@ <target>1.8</target> </configuration> </plugin> -<!-- <plugin>--> -<!-- <groupId>org.openapitools</groupId>--> -<!-- <artifactId>openapi-generator-maven-plugin</artifactId>--> -<!-- <version>4.1.2</version>--> -<!-- <executions>--> -<!-- <execution>--> -<!-- <goals>--> -<!-- <goal>generate</goal>--> -<!-- </goals>--> -<!-- <configuration>--> -<!-- <inputSpec>${project.basedir}/src/main/resources/workflow-engine.yaml</inputSpec>--> -<!-- <generatorName>org.wso2.carbon.codegen.CxfWso2Generator</generatorName>--> -<!-- <configOptions>--> -<!-- <sourceFolder>src/gen/java</sourceFolder>--> -<!-- <apiPackage>org.wso2.carbon.identity.rest.api.server.workflow.engine.v1</apiPackage>--> -<!-- <modelPackage>org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model</modelPackage>--> -<!-- <packageName>org.wso2.carbon.identity.rest.api.server.workflow.engine.v1</packageName>--> -<!-- <dateLibrary>java8</dateLibrary>--> -<!-- <hideGenerationTimestamp>true</hideGenerationTimestamp>--> -<!-- </configOptions>--> -<!-- <output>.</output>--> -<!-- <skipOverwrite>false</skipOverwrite>--> -<!-- </configuration>--> -<!-- </execution>--> -<!-- </executions>--> -<!-- <dependencies>--> -<!-- <dependency>--> -<!-- <groupId>org.openapitools</groupId>--> -<!-- <artifactId>cxf-wso2-openapi-generator</artifactId>--> -<!-- <version>1.0.0</version>--> -<!-- </dependency>--> -<!-- </dependencies>--> -<!-- </plugin>--> + <plugin> + <groupId>org.openapitools</groupId> + <artifactId>openapi-generator-maven-plugin</artifactId> + <version>4.1.2</version> + <executions> + <execution> + <goals> + <goal>generate</goal> + </goals> + <configuration> + <inputSpec>${project.basedir}/src/main/resources/workflow-engine.yaml</inputSpec> + <generatorName>org.wso2.carbon.codegen.CxfWso2Generator</generatorName> + <configOptions> + <sourceFolder>src/gen/java</sourceFolder> + <apiPackage>org.wso2.carbon.identity.rest.api.server.workflow.engine.v1</apiPackage> + <modelPackage>org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model</modelPackage> + <packageName>org.wso2.carbon.identity.rest.api.server.workflow.engine.v1</packageName> + <dateLibrary>java8</dateLibrary> + <hideGenerationTimestamp>true</hideGenerationTimestamp> + </configOptions> + <output>.</output> + <skipOverwrite>false</skipOverwrite> + </configuration> + </execution> + </executions> + <dependencies> + <dependency> + <groupId>org.openapitools</groupId> + <artifactId>cxf-wso2-openapi-generator</artifactId> + <version>1.0.0</version> + </dependency> + </dependencies> + </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowAssociationsApi.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowAssociationsApi.java index 8be520a003..4e1e83a6aa 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowAssociationsApi.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowAssociationsApi.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * 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 @@ -47,7 +47,7 @@ public WorkflowAssociationsApi(){ @Consumes({ "application/json" }) @Produces({ "application/json" }) - @ApiOperation(value = "Create a new workflow association.", notes = "Create a new workflow association by assigning a user operation to an existing workflow. <b>Permission required:</b> * /permission/admin/manage/humantask/viewtasks ", response = WorkflowAssociation.class, authorizations = { + @ApiOperation(value = "Create a new workflow association.", notes = "Create a new workflow association by assigning a user operation to an existing workflow. ", response = WorkflowAssociation.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -71,7 +71,7 @@ public Response createWorkflowAssociation(@ApiParam(value = "Contains the detail @Path("/{association-id}") @Produces({ "application/json" }) - @ApiOperation(value = "Delete the workflow association by association id.", notes = "Delete a specific workflow association identified by the association id. <b>Permission required:</b> * /permission/admin/manage/humantask/viewtasks ", response = Void.class, authorizations = { + @ApiOperation(value = "Delete the workflow association by association id.", notes = "Delete a specific workflow association identified by the association. ", response = Void.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -95,7 +95,7 @@ public Response deleteWorkflowAssociationById(@ApiParam(value = "Workflow Associ @Produces({ "application/json" }) - @ApiOperation(value = "Retrieve all the available workflow associations.", notes = "Retrieve all the available workflow associations in the system. <b>Permission required:</b> * /permission/admin/manage/humantask/viewtasks ", response = WorkflowAssociation.class, responseContainer = "List", authorizations = { + @ApiOperation(value = "Retrieve all the available workflow associations.", notes = "Retrieve all the available workflow associations in the system. ", response = WorkflowAssociation.class, responseContainer = "List", authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -119,7 +119,7 @@ public Response listWorkflowAssociations( @Valid @Min(15)@ApiParam(value = "M @Path("/{association-id}/status") @Consumes({ "application/json" }) @Produces({ "application/json" }) - @ApiOperation(value = "Update the status of a workflow association.", notes = "Enable or disable a specific workflow association. <b>Permission required:</b> * /permission/admin/manage/humantask/viewtasks ", response = Void.class, authorizations = { + @ApiOperation(value = "Update the status of a workflow association.", notes = "Enable or disable a specific workflow association. ", response = Void.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowAssociationsApiService.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowAssociationsApiService.java index a10c9d535b..5a699d8c90 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowAssociationsApiService.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowAssociationsApiService.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * 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 @@ -18,15 +18,7 @@ package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.*; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.*; -import org.apache.cxf.jaxrs.ext.multipart.Attachment; -import org.apache.cxf.jaxrs.ext.multipart.Multipart; -import java.io.InputStream; -import java.util.List; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.Error; import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.Status; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowAssociation; import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowAssociationCreation; import javax.ws.rs.core.Response; diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowEnginesApi.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowEnginesApi.java index edd01214f7..5712945804 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowEnginesApi.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowEnginesApi.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * 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 @@ -18,7 +18,6 @@ package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.factories.WorkflowEnginesApiServiceFactory; import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.Error; import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowEngine; @@ -33,18 +32,14 @@ public class WorkflowEnginesApi { - private final WorkflowEnginesApiService delegate; - - public WorkflowEnginesApi(){ - this.delegate = WorkflowEnginesApiServiceFactory.getWorkflowEnginesApi(); - } + private WorkflowEnginesApiService delegate; @Valid @GET @Produces({ "*/*", "application/json" }) - @ApiOperation(value = "Retrieve all the available workflow engines.", notes = "Retrieve metadata information of all the workflow engines in the system. <b>Permission required:</b> * /permission/admin/manage/humantask/viewtasks ", response = WorkflowEngine.class, responseContainer = "List", authorizations = { + @ApiOperation(value = "Retrieve all the available workflow engines.", notes = "Retrieve metadata information of all the workflow engines in the system. ", response = WorkflowEngine.class, responseContainer = "List", authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowEnginesApiService.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowEnginesApiService.java index fd30932df0..957723a474 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowEnginesApiService.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowEnginesApiService.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * 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 @@ -18,14 +18,6 @@ package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.*; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.*; -import org.apache.cxf.jaxrs.ext.multipart.Attachment; -import org.apache.cxf.jaxrs.ext.multipart.Multipart; -import java.io.InputStream; -import java.util.List; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.Error; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowEngine; import javax.ws.rs.core.Response; diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowsApi.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowsApi.java index 4bf6706f2a..a9764630df 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowsApi.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowsApi.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * 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 @@ -47,7 +47,7 @@ public WorkflowsApi(){ @Consumes({ "application/json" }) @Produces({ "application/json" }) - @ApiOperation(value = "Create a new workflow.", notes = "Create a new workflow using the specified workflow template and execution engine. <b>Permission required:</b> * /permission/admin/manage/humantask/viewtasks ", response = WorkflowSummary.class, authorizations = { + @ApiOperation(value = "Create a new workflow.", notes = "Create a new workflow using the specified workflow template and execution engine. ", response = WorkflowSummary.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -119,7 +119,7 @@ public Response getWorkflowById(@ApiParam(value = "Workflow ID",required=true) @ @Produces({ "application/json" }) - @ApiOperation(value = "Retrieve all the available workflows.", notes = "Retrieve all the available workflows in the system. <b>Permission required:</b> * /permission/admin/manage/humantask/viewtasks ", response = WorkflowSummary.class, responseContainer = "List", authorizations = { + @ApiOperation(value = "Retrieve all the available workflows.", notes = "Retrieve all the available workflows in the system. ", response = WorkflowSummary.class, responseContainer = "List", authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -143,7 +143,7 @@ public Response listWorkflows( @Valid @Min(15)@ApiParam(value = "Maximum numb @Path("/{workflow-id}") @Consumes({ "application/json" }) @Produces({ "application/json" }) - @ApiOperation(value = "Update an existing workflow.", notes = "Update a workflow identified by workflow-id. <b>Permission required:</b> * /permission/admin/manage/humantask/viewtasks ", response = Void.class, authorizations = { + @ApiOperation(value = "Update an existing workflow.", notes = "Update a workflow identified by workflow-id. ", response = Void.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowsApiService.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowsApiService.java index a06e65f3ed..437e7b57fb 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowsApiService.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowsApiService.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * 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 @@ -18,16 +18,7 @@ package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.*; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.*; -import org.apache.cxf.jaxrs.ext.multipart.Attachment; -import org.apache.cxf.jaxrs.ext.multipart.Multipart; -import java.io.InputStream; -import java.util.List; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.DetailedWorkflow; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.Error; import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowCreation; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowSummary; import javax.ws.rs.core.Response; diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/dto/ErrorDTO.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/dto/ErrorDTO.java index baec5819d6..45a472b905 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/dto/ErrorDTO.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/dto/ErrorDTO.java @@ -1,17 +1,17 @@ /* - * Copyright (c) 2019, WSO2 LLC. (https://www.wso2.com). + * 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 + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -23,11 +23,6 @@ import com.fasterxml.jackson.annotation.*; import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; - - - - @ApiModel(description = "") public class ErrorDTO { diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/dto/WorkFlowEngineDTO.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/dto/WorkFlowEngineDTO.java index 8d2047505e..2f472dcd01 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/dto/WorkFlowEngineDTO.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/dto/WorkFlowEngineDTO.java @@ -1,17 +1,17 @@ /* - * Copyright (c) 2019, WSO2 LLC. (https://www.wso2.com). + * 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 + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowAssociationsApiServiceFactory.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowAssociationsApiServiceFactory.java index cc19a4caae..5f64a3f6ec 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowAssociationsApiServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowAssociationsApiServiceFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * 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 diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowEnginesApiServiceFactory.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowEnginesApiServiceFactory.java index a2936bdc1e..f850d18955 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowEnginesApiServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowEnginesApiServiceFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * 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 diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowsApiServiceFactory.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowsApiServiceFactory.java index 692efa5888..0974d8df89 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowsApiServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowsApiServiceFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * 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 diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkFLowEngineService.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkFLowEngineService.java index 48591c0d66..0cf0bfba3c 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkFLowEngineService.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkFLowEngineService.java @@ -1,17 +1,17 @@ /* - * Copyright (c) 2019, WSO2 LLC. (https://www.wso2.com). + * 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 + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkflowEngineConstants.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkflowEngineConstants.java index ce883f51ac..35314c596f 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkflowEngineConstants.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkflowEngineConstants.java @@ -1,17 +1,17 @@ /* - * Copyright (c) 2019, WSO2 LLC. (https://www.wso2.com). + * 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 + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkflowService.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkflowService.java index e6d33fba73..b947e0b0ab 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkflowService.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkflowService.java @@ -1,3 +1,21 @@ +/* + * 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.rest.api.server.workflow.engine.v1.core; import org.apache.commons.collections.CollectionUtils; @@ -28,7 +46,9 @@ public class WorkflowService { //WorkflowManagementService worWorkflowServiceHolder. public WorkflowService(WorkflowManagementService workflowManagementService){ + this.workflowManagementService = workflowManagementService; + } private WorkflowSummary getWorkflow(Workflow workflowBean) { diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/function/BPSProfilesToExternal.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/function/BPSProfilesToExternal.java index c48a313456..95e4e137b5 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/function/BPSProfilesToExternal.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/function/BPSProfilesToExternal.java @@ -1,17 +1,17 @@ /* - * Copyright (c) 2019, WSO2 LLC. (https://www.wso2.com). + * 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 + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowServiceFactory.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowServiceFactory.java index acc49e6fe1..b5d9e8cd67 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowServiceFactory.java @@ -1,3 +1,21 @@ +/* + * 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.rest.api.server.workflow.engine.v1.factories; import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.core.WorkflowService; diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowAssociationsApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowAssociationsApiServiceImpl.java index 50524f4873..880e5e6794 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowAssociationsApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowAssociationsApiServiceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * 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 @@ -42,28 +42,24 @@ public WorkflowAssociationsApiServiceImpl() { @Override public Response createWorkflowAssociation(WorkflowAssociationCreation requestBody) { - // do some magic! return Response.ok().entity(workflowService.addAssociation(requestBody)).build(); } @Override public Response deleteWorkflowAssociationById(Integer associationId) { - // do some magic! return Response.ok().entity(workflowService.removeAssociation(associationId)).build(); } @Override public Response listWorkflowAssociations(Integer limit, Integer offset, String filter) { - // do some magic! return Response.ok().entity(workflowService.listPaginatedAssociations(limit, offset, filter)).build(); } @Override public Response updateWorkflowAssociationStatus(Integer associationId, Status status) { - // do some magic! return Response.ok().entity(workflowService.changeAssociationState(associationId, status)).build(); } } diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowEnginesApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowEnginesApiServiceImpl.java index 988fa95bc6..ea41810b32 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowEnginesApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowEnginesApiServiceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * 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 @@ -19,8 +19,6 @@ package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.impl; import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.*; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.*; -import java.util.List; import javax.ws.rs.core.Response; @@ -29,7 +27,6 @@ public class WorkflowEnginesApiServiceImpl implements WorkflowEnginesApiService @Override public Response searchWorkFlowEngines() { - // do some magic! return Response.ok().entity("magic!").build(); } } diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowsApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowsApiServiceImpl.java index 2d86a1fd2c..8847477633 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowsApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowsApiServiceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * 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 @@ -42,35 +42,30 @@ public WorkflowsApiServiceImpl() { @Override public Response createWorkflow(WorkflowCreation requestBody) { - // do some magic! return Response.ok().entity(workflowService.addWorkflow(requestBody, null)).build(); } @Override public Response deleteWorkflowById(String workflowId) { - // do some magic! return Response.ok().entity(workflowService.removeWorkflow(workflowId)).build(); } @Override public Response getWorkflowById(String workflowId) { - // do some magic! return Response.ok().entity(workflowService.getWorkflow(workflowId)).build(); } @Override public Response listWorkflows(Integer limit, Integer offset, String filter) { - // do some magic! return Response.ok().entity(workflowService.listPaginatedWorkflows(limit, offset, filter)).build(); } @Override public Response updateWorkflow(String workflowId, WorkflowCreation requestBody) { - // do some magic! return Response.ok().entity(workflowService.addWorkflow(requestBody, workflowId)).build(); } } diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/pom.xml b/components/org.wso2.carbon.identity.api.server.workflow.engine/pom.xml index 20baec3fe9..c86a7b62d4 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - ~ Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + ~ 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 From 127972341eaaa43f3c46e0a78b7a0bbb563737d3 Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Sat, 1 Mar 2025 23:33:01 +0530 Subject: [PATCH 04/47] Update API specification --- .../src/main/resources/workflow-engine.yaml | 22 +++++-------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/resources/workflow-engine.yaml b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/resources/workflow-engine.yaml index 25cfa7d0ff..d159f9dc1c 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/resources/workflow-engine.yaml +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/resources/workflow-engine.yaml @@ -26,8 +26,6 @@ paths: description: | Retrieve metadata information of all the workflow engines in the system. - <b>Permission required:</b> - * /permission/admin/manage/humantask/viewtasks operationId: searchWorkFlowEngines responses: "200": @@ -53,9 +51,7 @@ paths: summary: Retrieve all the available workflows. description: | Retrieve all the available workflows in the system. - - <b>Permission required:</b> - * /permission/admin/manage/humantask/viewtasks + operationId: listWorkflows parameters: - $ref: '#/components/parameters/limitQueryParam' @@ -103,8 +99,6 @@ paths: description: | Create a new workflow using the specified workflow template and execution engine. - <b>Permission required:</b> - * /permission/admin/manage/humantask/viewtasks operationId: createWorkflow requestBody: description: Contains the details of the newly created workflow. @@ -193,8 +187,6 @@ paths: description: | Update a workflow identified by workflow-id. - <b>Permission required:</b> - * /permission/admin/manage/humantask/viewtasks operationId: updateWorkflow parameters: - $ref: '#/components/parameters/workflowIdPathParam' @@ -242,8 +234,8 @@ paths: /workflow-associations: get: summary: Retrieve all the available workflow associations. - description: "Retrieve all the available workflow associations in the system.\n\ - \ \n <b>Permission required:</b>\n * /permission/admin/manage/humantask/viewtasks\n" + description: | + Retrieve all the available workflow associations in the system. operationId: listWorkflowAssociations parameters: - $ref: '#/components/parameters/limitQueryParam' @@ -292,8 +284,6 @@ paths: description: | Create a new workflow association by assigning a user operation to an existing workflow. - <b>Permission required:</b> - * /permission/admin/manage/humantask/viewtasks operationId: createWorkflowAssociation requestBody: description: Contains the details of the newly created workflow association. @@ -323,8 +313,8 @@ paths: /workflow-associations/{association-id}: delete: summary: Delete the workflow association by association id. - description: "Delete a specific workflow association identified by the association\ - \ id.\n \n <b>Permission required:</b>\n * /permission/admin/manage/humantask/viewtasks\n" + description: | + Delete a specific workflow association identified by the association. operationId: deleteWorkflowAssociationById parameters: - $ref: '#/components/parameters/associationIdPathParam' @@ -347,8 +337,6 @@ paths: description: | Enable or disable a specific workflow association. - <b>Permission required:</b> - * /permission/admin/manage/humantask/viewtasks operationId: updateWorkflowAssociationStatus parameters: - $ref: '#/components/parameters/associationIdPathParam' From 6de1f7c19b070e824b1025c585cfc50177f82d4f Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Mon, 3 Mar 2025 14:16:29 +0530 Subject: [PATCH 05/47] Update API specification with scopes --- .../src/main/resources/workflow-engine.yaml | 37 ++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/resources/workflow-engine.yaml b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/resources/workflow-engine.yaml index d159f9dc1c..6a27fc3020 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/resources/workflow-engine.yaml +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/resources/workflow-engine.yaml @@ -51,6 +51,9 @@ paths: summary: Retrieve all the available workflows. description: | Retrieve all the available workflows in the system. + + <b>Scope required:</b> + * internal_workflow_view operationId: listWorkflows parameters: @@ -98,6 +101,9 @@ paths: summary: Create a new workflow. description: | Create a new workflow using the specified workflow template and execution engine. + + <b>Scope required:</b> + * internal_workflow_create operationId: createWorkflow requestBody: @@ -135,8 +141,12 @@ paths: /workflows/{workflow-id}: get: summary: Retrieve the workflow by workflow id. - description: "Retrieve information about a specific workflow identified by the\ - \ workflow id.\n \n <b>Permission required:</b>\n * /permission/admin/manage/humantask/viewtasks\n" + description: | + Retrieve information about a specific workflow identified by the workflow id. + + <b>Scope required:</b> + * internal_workflow_view + operationId: getWorkflowById parameters: - $ref: '#/components/parameters/workflowIdPathParam' @@ -186,7 +196,9 @@ paths: summary: Update an existing workflow. description: | Update a workflow identified by workflow-id. - + + <b>Scope required:</b> + * internal_workflow_update operationId: updateWorkflow parameters: - $ref: '#/components/parameters/workflowIdPathParam' @@ -213,8 +225,11 @@ paths: x-codegen-request-body-name: Request Body delete: summary: Delete the workflow by workflow-id. - description: "Delete a specific workflow identified by the workflow-id.\n \n\ - \ <b>Permission required:</b>\n * /permission/admin/manage/humantask/viewtasks\n" + description: | + Delete a specific workflow identified by the workflow-id + + <b>Scope required:</b> + * internal_workflow_delete operationId: deleteWorkflowById parameters: - $ref: '#/components/parameters/workflowIdPathParam' @@ -236,6 +251,9 @@ paths: summary: Retrieve all the available workflow associations. description: | Retrieve all the available workflow associations in the system. + + <b>Scope required:</b> + * internal_workflow_associations_view operationId: listWorkflowAssociations parameters: - $ref: '#/components/parameters/limitQueryParam' @@ -283,6 +301,9 @@ paths: summary: Create a new workflow association. description: | Create a new workflow association by assigning a user operation to an existing workflow. + + <b>Scope required:</b> + * internal_workflow_associations_create operationId: createWorkflowAssociation requestBody: @@ -315,6 +336,9 @@ paths: summary: Delete the workflow association by association id. description: | Delete a specific workflow association identified by the association. + + <b>Scope required:</b> + * internal_workflow_associations_view operationId: deleteWorkflowAssociationById parameters: - $ref: '#/components/parameters/associationIdPathParam' @@ -336,6 +360,9 @@ paths: summary: Update the status of a workflow association. description: | Enable or disable a specific workflow association. + + <b>Scope required:</b> + * internal_workflow_associations_update operationId: updateWorkflowAssociationStatus parameters: From 575233663766142405035bad847097810a983d36 Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Mon, 3 Mar 2025 14:19:25 +0530 Subject: [PATCH 06/47] Update API specification --- .../src/main/resources/workflow-engine.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/resources/workflow-engine.yaml b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/resources/workflow-engine.yaml index 6a27fc3020..f604eeb41b 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/resources/workflow-engine.yaml +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/resources/workflow-engine.yaml @@ -137,7 +137,6 @@ paths: $ref: '#/components/responses/Conflict' '500': $ref: '#/components/responses/ServerError' - x-codegen-request-body-name: Request Body /workflows/{workflow-id}: get: summary: Retrieve the workflow by workflow id. @@ -222,7 +221,6 @@ paths: $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/ServerError' - x-codegen-request-body-name: Request Body delete: summary: Delete the workflow by workflow-id. description: | @@ -330,7 +328,6 @@ paths: $ref: '#/components/responses/Conflict' '500': $ref: '#/components/responses/ServerError' - x-codegen-request-body-name: Request Body /workflow-associations/{association-id}: delete: summary: Delete the workflow association by association id. @@ -387,7 +384,6 @@ paths: $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/ServerError' - x-codegen-request-body-name: status components: schemas: WorkflowEngine: @@ -730,4 +726,3 @@ components: authorizationUrl: https://localhost:9443/oauth2/authorize tokenUrl: https://localhost:9443/oauth2/token scopes: {} -x-original-swagger-version: "2.0" From d7f270cf0a6d4baa49cc953808526792978b7fd4 Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Tue, 4 Mar 2025 00:24:02 +0530 Subject: [PATCH 07/47] Update the copyright banner in the regenerated code --- .../engine/v1/model/ActionStatus.java | 2 +- .../engine/v1/model/DetailedWorkflow.java | 6 ++-- .../v1/model/DetailedWorkflowTemplate.java | 6 ++-- .../workflow/engine/v1/model/Error.java | 2 +- .../engine/v1/model/OptionDetails.java | 2 +- .../workflow/engine/v1/model/Status.java | 2 +- .../engine/v1/model/WorkflowAssociation.java | 2 +- .../v1/model/WorkflowAssociationCreation.java | 2 +- .../engine/v1/model/WorkflowCreation.java | 6 ++-- .../engine/v1/model/WorkflowEngine.java | 2 +- .../engine/v1/model/WorkflowTemplate.java | 2 +- .../v1/model/WorkflowTemplateParameters.java | 35 ++++++++++--------- .../v1/impl/WorkflowsApiServiceImpl.java | 5 ++- 13 files changed, 38 insertions(+), 36 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/ActionStatus.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/ActionStatus.java index 37f869427d..2b6bfb5c8a 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/ActionStatus.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/ActionStatus.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * 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 diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/DetailedWorkflow.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/DetailedWorkflow.java index 2e46c21ed2..fd22d78e7d 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/DetailedWorkflow.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/DetailedWorkflow.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * 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 @@ -129,7 +129,7 @@ public DetailedWorkflow approvalTask(String approvalTask) { } @ApiModelProperty(example = "User Registration Approval", required = true, value = "Approval task subject to display") - @JsonProperty("ApprovalTask") + @JsonProperty("approvalTask") @Valid @NotNull(message = "Property approvalTask cannot be null.") @@ -150,7 +150,7 @@ public DetailedWorkflow approvalTaskDescription(String approvalTaskDescription) } @ApiModelProperty(example = "Approval task to validate and approve new user registrations before account activation", value = "Description of the approval task") - @JsonProperty("ApprovalTaskDescription") + @JsonProperty("approvalTaskDescription") @Valid public String getApprovalTaskDescription() { return approvalTaskDescription; diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/DetailedWorkflowTemplate.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/DetailedWorkflowTemplate.java index 9acd1e5ab4..10127856d0 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/DetailedWorkflowTemplate.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/DetailedWorkflowTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * 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 @@ -49,9 +49,11 @@ public DetailedWorkflowTemplate name(String name) { return this; } - @ApiModelProperty(example = "MultiStepApproval", value = "Name of the workflow template") + @ApiModelProperty(example = "MultiStepApproval", required = true, value = "Name of the workflow template") @JsonProperty("name") @Valid + @NotNull(message = "Property name cannot be null.") + public String getName() { return name; } diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/Error.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/Error.java index 9e7fd34919..614a4f3d20 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/Error.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/Error.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * 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 diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/OptionDetails.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/OptionDetails.java index 5b804da4f1..a6a6616e10 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/OptionDetails.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/OptionDetails.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * 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 diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/Status.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/Status.java index 8caf0c3116..45cc023776 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/Status.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/Status.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * 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 diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociation.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociation.java index 17e36d69ba..d2e3e81509 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociation.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * 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 diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociationCreation.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociationCreation.java index 876beeddf0..75be6d3692 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociationCreation.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociationCreation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * 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 diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowCreation.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowCreation.java index 2a80cd47c6..a95ce28d56 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowCreation.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowCreation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * 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 @@ -131,7 +131,7 @@ public WorkflowCreation approvalTask(String approvalTask) { } @ApiModelProperty(example = "User Registration Approval", required = true, value = "Approval task subject to display") - @JsonProperty("ApprovalTask") + @JsonProperty("approvalTask") @Valid @NotNull(message = "Property approvalTask cannot be null.") @@ -152,7 +152,7 @@ public WorkflowCreation approvalTaskDescription(String approvalTaskDescription) } @ApiModelProperty(example = "Approval task to validate and approve new user registrations before account activation", value = "Description of the approval task") - @JsonProperty("ApprovalTaskDescription") + @JsonProperty("approvalTaskDescription") @Valid public String getApprovalTaskDescription() { return approvalTaskDescription; diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowEngine.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowEngine.java index 725b001c9b..ef4f96ce4f 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowEngine.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowEngine.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * 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 diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowTemplate.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowTemplate.java index fd1b12cdb8..dd565a503a 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowTemplate.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * 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 diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowTemplateParameters.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowTemplateParameters.java index 8ec1c8a66e..e9a15c1461 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowTemplateParameters.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowTemplateParameters.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * 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 @@ -35,26 +35,26 @@ public class WorkflowTemplateParameters { - private Integer step; - private List<OptionDetails> options = new ArrayList<>(); + private Integer steps; + private List<OptionDetails> options = null; /** **/ - public WorkflowTemplateParameters step(Integer step) { + public WorkflowTemplateParameters steps(Integer steps) { - this.step = step; + this.steps = steps; return this; } @ApiModelProperty(example = "1", value = "") - @JsonProperty("step") + @JsonProperty("steps") @Valid - public Integer getStep() { - return step; + public Integer getSteps() { + return steps; } - public void setStep(Integer step) { - this.step = step; + public void setSteps(Integer steps) { + this.steps = steps; } /** @@ -65,11 +65,9 @@ public WorkflowTemplateParameters options(List<OptionDetails> options) { return this; } - @ApiModelProperty(example = "[{\"entity\":\"roles\",\"values\":\"admin\"},{\"entity\":\"users\",\"values\":\"John\"}]", required = true, value = "") + @ApiModelProperty(example = "[{\"entity\":\"roles\",\"values\":\"admin\"},{\"entity\":\"users\",\"values\":\"John\"}]", value = "") @JsonProperty("options") - @Valid - @NotNull(message = "Property options cannot be null.") - @Size(min=2) + @Valid @Size(min=2) public List<OptionDetails> getOptions() { return options; } @@ -78,6 +76,9 @@ public void setOptions(List<OptionDetails> options) { } public WorkflowTemplateParameters addOptionsItem(OptionDetails optionsItem) { + if (this.options == null) { + this.options = new ArrayList<>(); + } this.options.add(optionsItem); return this; } @@ -94,13 +95,13 @@ public boolean equals(java.lang.Object o) { return false; } WorkflowTemplateParameters workflowTemplateParameters = (WorkflowTemplateParameters) o; - return Objects.equals(this.step, workflowTemplateParameters.step) && + return Objects.equals(this.steps, workflowTemplateParameters.steps) && Objects.equals(this.options, workflowTemplateParameters.options); } @Override public int hashCode() { - return Objects.hash(step, options); + return Objects.hash(steps, options); } @Override @@ -109,7 +110,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class WorkflowTemplateParameters {\n"); - sb.append(" step: ").append(toIndentedString(step)).append("\n"); + sb.append(" steps: ").append(toIndentedString(steps)).append("\n"); sb.append(" options: ").append(toIndentedString(options)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowsApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowsApiServiceImpl.java index 8847477633..960bcb3156 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowsApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowsApiServiceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com). + * 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 @@ -22,7 +22,6 @@ import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.core.WorkflowService; import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.factories.WorkflowServiceFactory; import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.*; -import java.util.List; import javax.ws.rs.core.Response; @@ -35,7 +34,7 @@ public WorkflowsApiServiceImpl() { try { this.workflowService = WorkflowServiceFactory.getWorkflowService(); } catch (IllegalStateException e) { - throw new RuntimeException("Error occurred while initiating Workflow Service", e); + throw new RuntimeException("Error occurred while initiating Workflow.", e); } } From 426f3d065e535f1c07092fec1cf7b8211128c364 Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Tue, 4 Mar 2025 00:24:21 +0530 Subject: [PATCH 08/47] Add a new line at the end --- .../pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.api.server.workflow.engine.common/pom.xml b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.api.server.workflow.engine.common/pom.xml index 594658e6ae..41d57b8ddb 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.api.server.workflow.engine.common/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.api.server.workflow.engine.common/pom.xml @@ -43,4 +43,4 @@ </dependency> </dependencies> -</project> \ No newline at end of file +</project> From 5fd8ac705cf5be57f8ace0ada52b13a0bcf1dfff Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Tue, 4 Mar 2025 00:25:09 +0530 Subject: [PATCH 09/47] Update the API spec with new endpoints --- .../src/main/resources/workflow-engine.yaml | 215 +++++++++++------- 1 file changed, 135 insertions(+), 80 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/resources/workflow-engine.yaml b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/resources/workflow-engine.yaml index f604eeb41b..5cb9e0a043 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/resources/workflow-engine.yaml +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/resources/workflow-engine.yaml @@ -28,10 +28,10 @@ paths: operationId: searchWorkFlowEngines responses: - "200": + '200': description: search results matching criteria content: - '*/*': + 'application/json': schema: type: array items: @@ -61,7 +61,7 @@ paths: - $ref: '#/components/parameters/offsetQueryParam' - $ref: '#/components/parameters/filterQueryParam' responses: - "200": + '200': description: Array of workflows content: 'application/json': @@ -70,23 +70,23 @@ paths: items: $ref: '#/components/schemas/WorkflowSummary' example: - - id: "100" + - id: 100 workflowName: User Registration Approval workflowDescription: Approves new user registrations before account activation workflowTemplate: MultiStepApprovalTemplate - deployment: ApprovalWorkflow - - id: "101" + workflowEngine: ApprovalWorkflow + - id: 101 workflowName: Role Change Request workflowDescription: Approves requests for changing user roles workflowTemplate: MultiStepApprovalTemplate - deployment: ApprovalWorkflow - - id: "102" + workflowEngine: ApprovalWorkflow + - id: 102 workflowName: User Deactivation Workflow workflowDescription: Ensures proper approvals before deactivating a user account workflowTemplate: SingleStepApprovalTemplate - deployment: ApprovalWorkflow + workflowEngine: ApprovalWorkflow '400': $ref: '#/components/responses/InvalidInput' '401': @@ -107,26 +107,26 @@ paths: operationId: createWorkflow requestBody: - description: Contains the details of the newly created workflow. + description: Contains the details of the newly created. content: 'application/json': schema: $ref: '#/components/schemas/WorkflowCreation' required: true responses: - "201": + '201': description: Item Created content: 'application/json': schema: $ref: '#/components/schemas/WorkflowSummary' example: - id: "100" + id: 100 workflowName: User Registration Approval workflowDescription: Approves new user registrations before account activation workflowTemplate: MultiStepApprovalTemplate - deployment: ApprovalWorkflow + workflowEngine: ApprovalWorkflow '400': $ref: '#/components/responses/InvalidInput' '401': @@ -150,37 +150,12 @@ paths: parameters: - $ref: '#/components/parameters/workflowIdPathParam' responses: - "200": + '200': description: Information about the workflow identified by the workflow-id. content: 'application/json': schema: $ref: '#/components/schemas/DetailedWorkflow' - example: - id: "100" - workflowName: User Registration Approval - workflowDescription: Approves new user registrations before account - activation - workflowTemplate: - name: MultiStepApproval - templateDescription: "The operation should be approved by an authorized\ - \ person with given role, to complete." - properties: - - paramName: UserAndRole - paramValue: Internal/admin - qName: UserAndRoles-step-1-roles - - paramName: UserAndRole - paramValue: John - qName: UserAndRoles-step-1-users - - paramName: UserAndRole - paramValue: "" - qName: UserAndRoles-step-2-roles - - paramName: UserAndRole - paramValue: "John,Tom" - qName: UserAndRoles-step-2-users - workflowEngine: Simple Workflow Engine - ApprovalTask: Sample Approval Task - ApprovalTaskDescription: This is an approval task '400': $ref: '#/components/responses/InvalidInput' '401': @@ -258,7 +233,7 @@ paths: - $ref: '#/components/parameters/offsetQueryParam' - $ref: '#/components/parameters/filterQueryParam' responses: - "200": + '200': description: Array of workflow associations matching the search criteria content: 'application/json': @@ -267,24 +242,24 @@ paths: items: $ref: '#/components/schemas/WorkflowAssociation' example: - - id: "500" + - id: 500 workflowAssociationName: User Registration Workflow Association operation: Add User workflowName: User Registration Approval - associationCondition: "true" - isEnabled: "true" - - id: "501" + associationCondition: true + isEnabled: true + - id: 501 workflowAssociationName: Role Update Workflow Association operation: Update Role workflowName: Role Change Request - associationCondition: "false" - isEnabled: "true" - - id: "502" + associationCondition: false + isEnabled: true + - id: 502 workflowAssociationName: Delete User Workflow Association operation: Delete User workflowName: User Deactivation Workflow - associationCondition: "false" - isEnabled: "false" + associationCondition: false + isEnabled: false '400': $ref: '#/components/responses/InvalidInput' '401': @@ -329,10 +304,44 @@ paths: '500': $ref: '#/components/responses/ServerError' /workflow-associations/{association-id}: + get: + summary: Get the workflow association by association id. + description: | + Get a specific workflow association identified by the association id. + + <b>Scope required:</b> + * internal_workflow_associations_view + operationId: getWorkflowAssociationById + parameters: + - $ref: '#/components/parameters/associationIdPathParam' + responses: + '200': + description: Array of workflow associations matching the search criteria + content: + 'application/json': + schema: + $ref: '#/components/schemas/WorkflowAssociation' + example: + id: 500 + workflowAssociationName: User Registration Workflow Association + operation: Add User + workflowName: User Registration Approval + associationCondition: Role Name equals Manager + isEnabled: true + '400': + $ref: '#/components/responses/InvalidInput' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/ServerError' delete: summary: Delete the workflow association by association id. description: | - Delete a specific workflow association identified by the association. + Delete a specific workflow association identified by the association ID. <b>Scope required:</b> * internal_workflow_associations_view @@ -352,38 +361,58 @@ paths: $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/ServerError' - /workflow-associations/{association-id}/status: - put: - summary: Update the status of a workflow association. + patch: + summary: | + Partially update association by ID + operationId: patchAssociation description: | - Enable or disable a specific workflow association. + Partially update an application by ID.<br> - <b>Scope required:</b> - * internal_workflow_associations_update - - operationId: updateWorkflowAssociationStatus + <b>Scope required:</b> <br> + * internal_workflow_associations_update parameters: - $ref: '#/components/parameters/associationIdPathParam' requestBody: - description: Status of the workflow association (enable/disable) + description: Represents the association details to be updated. content: - 'application/json': + application/json: schema: - $ref: "#/components/schemas/Status" - required: false + $ref: '#/components/schemas/WorkflowAssociationPatch' + example: + id: "500" + workflowAssociationName: User Registration Workflow Association + operation: Add User + workflowName: User Registration Approval + associationCondition: true + associationStatus: + action: ENABLE responses: '200': - $ref: '#/components/responses/Updated' + description: Successfully Updated '400': - $ref: '#/components/responses/InvalidInput' + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/Error' '401': - $ref: '#/components/responses/Unauthorized' + description: Unauthorized '403': - $ref: '#/components/responses/Forbidden' - '404': - $ref: '#/components/responses/NotFound' + description: Forbidden + '409': + description: Conflict + content: + application/json: + schema: + $ref: '#/components/schemas/Error' '500': - $ref: '#/components/responses/ServerError' + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + + components: schemas: WorkflowEngine: @@ -411,7 +440,7 @@ components: WorkflowTemplateParameters: type: object properties: - step: + steps: type: integer example: 1 options: @@ -429,7 +458,6 @@ components: "values": "John" } ] - required: ["steps", "options"] OptionDetails: type: object @@ -460,7 +488,7 @@ components: type: string example: "MultiStepApprovalTemplate" description: "Template defining the approval process for the workflow" - deployment: + workflowEngine: type: string example: "ApprovalWorkflow" description: "Category in which the workflow is deployed" @@ -470,7 +498,7 @@ components: required: - workflowName - workflowEngine - - ApprovalTask + - approvalTask properties: workflowName: type: string @@ -486,11 +514,11 @@ components: type: string example: "Simple Workflow Engine" description: "Name of the selected workflow engine" - ApprovalTask: + approvalTask: type: string example: "User Registration Approval" description: "Approval task subject to display" - ApprovalTaskDescription: + approvalTaskDescription: type: string example: "Approval task to validate and approve new user registrations before account activation" description: "Description of the approval task" @@ -498,6 +526,8 @@ components: DetailedWorkflowTemplate: type: object + required: + - name properties: name: type: string @@ -511,8 +541,7 @@ components: type: array items: $ref: "#/components/schemas/WorkflowTemplateParameters" - required: - - name + WorkflowAssociation: @@ -545,7 +574,7 @@ components: - workflowName - workflowTemplate - workflowEngine - - ApprovalTask + - approvalTask properties: workflowName: type: string @@ -561,11 +590,11 @@ components: type: string example: "Simple Workflow Engine" description: "Name of the selected workflow engine" - ApprovalTask: + approvalTask: type: string example: "User Registration Approval" description: "Approval task subject to display" - ApprovalTaskDescription: + approvalTaskDescription: type: string example: "Approval task to validate and approve new user registrations before account activation" description: "Description of the approval task" @@ -613,6 +642,32 @@ components: example: "Role Name equals Manager" description: "Condition added to the association" + WorkflowAssociationPatch: + type: object + properties: + associationName: + type: string + example: "User Registration Workflow Association" + description: "Name of the workflow association" + operationCategory: + type: string + example: "User Store Operations" + description: "Operation type" + operationName: + type: string + example: "Add User" + description: "Name of the user operation" + workflowId: + type: string + example: "456" + description: "Id of the assigned workflow" + associationCondition: + type: string + example: "Role Name equals Manager" + description: "Condition added to the association" + associationStatus: + $ref: "#/components/schemas/Status" + Status: type: object properties: From cbdbd32a5a4ff907530a4a6645f5739975a82614 Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Tue, 4 Mar 2025 15:49:08 +0530 Subject: [PATCH 10/47] Update the API spec --- .../src/main/resources/workflow-engine.yaml | 106 +++++++++--------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/resources/workflow-engine.yaml b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/resources/workflow-engine.yaml index 5cb9e0a043..093d00e283 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/resources/workflow-engine.yaml +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/resources/workflow-engine.yaml @@ -70,23 +70,23 @@ paths: items: $ref: '#/components/schemas/WorkflowSummary' example: - - id: 100 + - id: "100" workflowName: User Registration Approval workflowDescription: Approves new user registrations before account activation + workflowEngine: Simple Workflow Engine workflowTemplate: MultiStepApprovalTemplate - workflowEngine: ApprovalWorkflow - - id: 101 + - id: "101" workflowName: Role Change Request workflowDescription: Approves requests for changing user roles + workflowEngine: Simple Workflow Engine workflowTemplate: MultiStepApprovalTemplate - workflowEngine: ApprovalWorkflow - - id: 102 + - id: "102" workflowName: User Deactivation Workflow workflowDescription: Ensures proper approvals before deactivating a user account + workflowEngine: Simple Workflow Engine workflowTemplate: SingleStepApprovalTemplate - workflowEngine: ApprovalWorkflow '400': $ref: '#/components/responses/InvalidInput' '401': @@ -121,12 +121,12 @@ paths: schema: $ref: '#/components/schemas/WorkflowSummary' example: - id: 100 + id: "100" workflowName: User Registration Approval workflowDescription: Approves new user registrations before account activation + workflowEngine: Simple Workflow Engine workflowTemplate: MultiStepApprovalTemplate - workflowEngine: ApprovalWorkflow '400': $ref: '#/components/responses/InvalidInput' '401': @@ -182,7 +182,6 @@ paths: 'application/json': schema: $ref: '#/components/schemas/WorkflowCreation' - required: false responses: '200': $ref: '#/components/responses/Updated' @@ -242,23 +241,23 @@ paths: items: $ref: '#/components/schemas/WorkflowAssociation' example: - - id: 500 + - id: "500" workflowAssociationName: User Registration Workflow Association - operation: Add User + operationName: Add User workflowName: User Registration Approval - associationCondition: true + associationCondition: Username equals John isEnabled: true - - id: 501 + - id: "501" workflowAssociationName: Role Update Workflow Association - operation: Update Role + operationName: Update Role workflowName: Role Change Request - associationCondition: false + associationCondition: Role equals Manager isEnabled: true - - id: 502 + - id: "502" workflowAssociationName: Delete User Workflow Association - operation: Delete User + operationName: Delete User workflowName: User Deactivation Workflow - associationCondition: false + associationCondition: Apply to all requests isEnabled: false '400': $ref: '#/components/responses/InvalidInput' @@ -322,11 +321,11 @@ paths: schema: $ref: '#/components/schemas/WorkflowAssociation' example: - id: 500 + id: "500" workflowAssociationName: User Registration Workflow Association - operation: Add User + operationName: Add User workflowName: User Registration Approval - associationCondition: Role Name equals Manager + associationCondition: Username equals John isEnabled: true '400': $ref: '#/components/responses/InvalidInput' @@ -366,7 +365,7 @@ paths: Partially update association by ID operationId: patchAssociation description: | - Partially update an application by ID.<br> + Partially update an association by ID.<br> <b>Scope required:</b> <br> * internal_workflow_associations_update @@ -379,11 +378,10 @@ paths: schema: $ref: '#/components/schemas/WorkflowAssociationPatch' example: - id: "500" workflowAssociationName: User Registration Workflow Association - operation: Add User - workflowName: User Registration Approval - associationCondition: true + operationName: Add User + workflowId: "500" + associationCondition: Role Name equals Employee associationStatus: action: ENABLE responses: @@ -439,13 +437,15 @@ components: WorkflowTemplateParameters: type: object + required: + - steps properties: steps: type: integer example: 1 options: type: array - minItems: 2 + minItems: 1 items: $ref: "#/components/schemas/OptionDetails" example: [ @@ -461,6 +461,9 @@ components: OptionDetails: type: object + required: + - entity + - values properties: entity: type: string @@ -474,7 +477,7 @@ components: properties: id: type: string - example: 100 + example: "100" description: "Unique id to represent a workflow" workflowName: type: string @@ -484,21 +487,18 @@ components: type: string example: "Workflow to approve new user registrations before account activation" description: "Detailed description of the workflow" + workflowEngine: + type: string + example: "Simple Workflow Engine" + description: "Category in which the workflow is deployed" workflowTemplate: type: string example: "MultiStepApprovalTemplate" description: "Template defining the approval process for the workflow" - workflowEngine: - type: string - example: "ApprovalWorkflow" - description: "Category in which the workflow is deployed" + DetailedWorkflow: type: object - required: - - workflowName - - workflowEngine - - approvalTask properties: workflowName: type: string @@ -508,12 +508,12 @@ components: type: string example: "Workflow to approve new user registrations before account activation" description: "Description of the created workflow" - workflowTemplate: - $ref: "#/components/schemas/DetailedWorkflowTemplate" workflowEngine: type: string example: "Simple Workflow Engine" description: "Name of the selected workflow engine" + workflowTemplate: + $ref: "#/components/schemas/DetailedWorkflowTemplate" approvalTask: type: string example: "User Registration Approval" @@ -555,7 +555,7 @@ components: type: string example: "User registration Workflow Association" description: "Name of the workflow association" - operation: + operationName: type: string example: "Add User" description: "User Operation" @@ -563,6 +563,10 @@ components: type: string example: "User Registration Approval" description: "Assigned Workflow" + associationCondition: + type: string + example: "Role equals Manager" + description: "Assigned Association Condition" isEnabled: type: boolean example: true @@ -572,7 +576,6 @@ components: type: object required: - workflowName - - workflowTemplate - workflowEngine - approvalTask properties: @@ -584,12 +587,12 @@ components: type: string example: "Workflow to approve new user registrations before account activation" description: "Description of the created workflow" - workflowTemplate: - $ref: "#/components/schemas/WorkflowTemplate" workflowEngine: type: string example: "Simple Workflow Engine" description: "Name of the selected workflow engine" + workflowTemplate: + $ref: "#/components/schemas/WorkflowTemplate" approvalTask: type: string example: "User Registration Approval" @@ -601,6 +604,8 @@ components: WorkflowTemplate: type: object + required: + - name properties: name: type: string @@ -617,7 +622,6 @@ components: type: object required: - associationName - - operationCategory - operationName - workflowId properties: @@ -625,10 +629,6 @@ components: type: string example: "User Registration Workflow Association" description: "Name of the workflow association" - operationCategory: - type: string - example: "User Store Operations" - description: "Operation type" operationName: type: string example: "Add User" @@ -641,6 +641,11 @@ components: type: string example: "Role Name equals Manager" description: "Condition added to the association" + isEnabled: + type: boolean + example: true + description: "Association Status" + default: true WorkflowAssociationPatch: type: object @@ -649,10 +654,6 @@ components: type: string example: "User Registration Workflow Association" description: "Name of the workflow association" - operationCategory: - type: string - example: "User Store Operations" - description: "Operation type" operationName: type: string example: "Add User" @@ -746,8 +747,7 @@ components: description: Workflow Association ID required: true schema: - type: integer - format: int32 + type: string offsetQueryParam: name: offset in: query From 26bd58c139487f42147b987b5e0799ae34f738c6 Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Tue, 4 Mar 2025 15:52:55 +0530 Subject: [PATCH 11/47] Regenerate the code after changine the specification --- .../engine/v1/WorkflowAssociationsApi.java | 56 +++++++++++++------ .../v1/WorkflowAssociationsApiService.java | 10 ++-- .../engine/v1/WorkflowEnginesApi.java | 10 +++- .../workflow/engine/v1/WorkflowsApi.java | 18 +++--- .../engine/v1/WorkflowsApiService.java | 4 +- .../engine/v1/model/DetailedWorkflow.java | 52 ++++++++--------- .../engine/v1/model/OptionDetails.java | 8 ++- .../engine/v1/model/WorkflowAssociation.java | 44 +++++++++++---- .../v1/model/WorkflowAssociationCreation.java | 50 ++++++++--------- .../engine/v1/model/WorkflowCreation.java | 46 ++++++++------- .../engine/v1/model/WorkflowSummary.java | 48 ++++++++-------- .../engine/v1/model/WorkflowTemplate.java | 4 +- .../v1/model/WorkflowTemplateParameters.java | 6 +- .../v1/impl/WorkflowsApiServiceImpl.java | 13 +++-- 14 files changed, 211 insertions(+), 158 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowAssociationsApi.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowAssociationsApi.java index 4e1e83a6aa..bf00082b38 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowAssociationsApi.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowAssociationsApi.java @@ -20,9 +20,9 @@ import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.factories.WorkflowAssociationsApiServiceFactory; import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.Error; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.Status; import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowAssociation; import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowAssociationCreation; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowAssociationPatch; import javax.validation.Valid; import javax.ws.rs.*; @@ -47,7 +47,7 @@ public WorkflowAssociationsApi(){ @Consumes({ "application/json" }) @Produces({ "application/json" }) - @ApiOperation(value = "Create a new workflow association.", notes = "Create a new workflow association by assigning a user operation to an existing workflow. ", response = WorkflowAssociation.class, authorizations = { + @ApiOperation(value = "Create a new workflow association.", notes = "Create a new workflow association by assigning a user operation to an existing workflow. <b>Scope required:</b> * internal_workflow_associations_create ", response = WorkflowAssociation.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -61,9 +61,9 @@ public WorkflowAssociationsApi(){ @ApiResponse(code = 409, message = "Item Already Exists", response = Error.class), @ApiResponse(code = 500, message = "Internal Server Error", response = Error.class) }) - public Response createWorkflowAssociation(@ApiParam(value = "Contains the details of the newly created workflow association." ,required=true) @Valid WorkflowAssociationCreation requestBody) { + public Response createWorkflowAssociation(@ApiParam(value = "Contains the details of the newly created workflow association." ,required=true) @Valid WorkflowAssociationCreation workflowAssociationCreation) { - return delegate.createWorkflowAssociation(requestBody ); + return delegate.createWorkflowAssociation(workflowAssociationCreation ); } @Valid @@ -71,7 +71,7 @@ public Response createWorkflowAssociation(@ApiParam(value = "Contains the detail @Path("/{association-id}") @Produces({ "application/json" }) - @ApiOperation(value = "Delete the workflow association by association id.", notes = "Delete a specific workflow association identified by the association. ", response = Void.class, authorizations = { + @ApiOperation(value = "Delete the workflow association by association id.", notes = "Delete a specific workflow association identified by the association ID. <b>Scope required:</b> * internal_workflow_associations_view ", response = Void.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -85,17 +85,41 @@ public Response createWorkflowAssociation(@ApiParam(value = "Contains the detail @ApiResponse(code = 404, message = "The specified resource is not found", response = Error.class), @ApiResponse(code = 500, message = "Internal Server Error", response = Error.class) }) - public Response deleteWorkflowAssociationById(@ApiParam(value = "Workflow Association ID",required=true) @PathParam("association-id") Integer associationId) { + public Response deleteWorkflowAssociationById(@ApiParam(value = "Workflow Association ID",required=true) @PathParam("association-id") String associationId) { return delegate.deleteWorkflowAssociationById(associationId ); } + @Valid + @GET + @Path("/{association-id}") + + @Produces({ "application/json" }) + @ApiOperation(value = "Get the workflow association by association id.", notes = "Get a specific workflow association identified by the association id. <b>Scope required:</b> * internal_workflow_associations_view ", response = WorkflowAssociation.class, authorizations = { + @Authorization(value = "BasicAuth"), + @Authorization(value = "OAuth2", scopes = { + + }) + }, tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Array of workflow associations matching the search criteria", response = WorkflowAssociation.class), + @ApiResponse(code = 400, message = "Invalid input request", response = Error.class), + @ApiResponse(code = 401, message = "Unauthorized", response = Void.class), + @ApiResponse(code = 403, message = "Forbidden", response = Void.class), + @ApiResponse(code = 404, message = "The specified resource is not found", response = Error.class), + @ApiResponse(code = 500, message = "Internal Server Error", response = Error.class) + }) + public Response getWorkflowAssociationById(@ApiParam(value = "Workflow Association ID",required=true) @PathParam("association-id") String associationId) { + + return delegate.getWorkflowAssociationById(associationId ); + } + @Valid @GET @Produces({ "application/json" }) - @ApiOperation(value = "Retrieve all the available workflow associations.", notes = "Retrieve all the available workflow associations in the system. ", response = WorkflowAssociation.class, responseContainer = "List", authorizations = { + @ApiOperation(value = "Retrieve all the available workflow associations.", notes = "Retrieve all the available workflow associations in the system. <b>Scope required:</b> * internal_workflow_associations_view ", response = WorkflowAssociation.class, responseContainer = "List", authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -115,27 +139,27 @@ public Response listWorkflowAssociations( @Valid @Min(15)@ApiParam(value = "M } @Valid - @PUT - @Path("/{association-id}/status") + @PATCH + @Path("/{association-id}") @Consumes({ "application/json" }) @Produces({ "application/json" }) - @ApiOperation(value = "Update the status of a workflow association.", notes = "Enable or disable a specific workflow association. ", response = Void.class, authorizations = { + @ApiOperation(value = "Partially update association by ID ", notes = "Partially update an association by ID.<br> <b>Scope required:</b> <br> * internal_workflow_associations_update ", response = Void.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { }) }, tags={ }) @ApiResponses(value = { - @ApiResponse(code = 200, message = "Item Updated", response = Void.class), - @ApiResponse(code = 400, message = "Invalid input request", response = Error.class), + @ApiResponse(code = 200, message = "Successfully Updated", response = Void.class), + @ApiResponse(code = 400, message = "Bad Request", response = Error.class), @ApiResponse(code = 401, message = "Unauthorized", response = Void.class), @ApiResponse(code = 403, message = "Forbidden", response = Void.class), - @ApiResponse(code = 404, message = "The specified resource is not found", response = Error.class), - @ApiResponse(code = 500, message = "Internal Server Error", response = Error.class) + @ApiResponse(code = 409, message = "Conflict", response = Error.class), + @ApiResponse(code = 500, message = "Server Error", response = Error.class) }) - public Response updateWorkflowAssociationStatus(@ApiParam(value = "Workflow Association ID",required=true) @PathParam("association-id") Integer associationId, @ApiParam(value = "Status of the workflow association (enable/disable)" ) @Valid Status status) { + public Response patchAssociation(@ApiParam(value = "Workflow Association ID",required=true) @PathParam("association-id") String associationId, @ApiParam(value = "Represents the association details to be updated." ) @Valid WorkflowAssociationPatch workflowAssociationPatch) { - return delegate.updateWorkflowAssociationStatus(associationId, status ); + return delegate.patchAssociation(associationId, workflowAssociationPatch ); } } diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowAssociationsApiService.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowAssociationsApiService.java index 5a699d8c90..4070ae3f05 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowAssociationsApiService.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowAssociationsApiService.java @@ -18,18 +18,20 @@ package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.Status; import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowAssociationCreation; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowAssociationPatch; import javax.ws.rs.core.Response; public interface WorkflowAssociationsApiService { - public Response createWorkflowAssociation(WorkflowAssociationCreation requestBody); + public Response createWorkflowAssociation(WorkflowAssociationCreation workflowAssociationCreation); - public Response deleteWorkflowAssociationById(Integer associationId); + public Response deleteWorkflowAssociationById(String associationId); + + public Response getWorkflowAssociationById(String associationId); public Response listWorkflowAssociations(Integer limit, Integer offset, String filter); - public Response updateWorkflowAssociationStatus(Integer associationId, Status status); + public Response patchAssociation(String associationId, WorkflowAssociationPatch workflowAssociationPatch); } diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowEnginesApi.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowEnginesApi.java index 5712945804..358ec81ed2 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowEnginesApi.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowEnginesApi.java @@ -18,6 +18,7 @@ package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.factories.WorkflowEnginesApiServiceFactory; import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.Error; import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowEngine; @@ -32,13 +33,18 @@ public class WorkflowEnginesApi { - private WorkflowEnginesApiService delegate; + private final WorkflowEnginesApiService delegate; + + public WorkflowEnginesApi(){ + + this.delegate = WorkflowEnginesApiServiceFactory.getWorkflowEnginesApi(); + } @Valid @GET - @Produces({ "*/*", "application/json" }) + @Produces({ "application/json" }) @ApiOperation(value = "Retrieve all the available workflow engines.", notes = "Retrieve metadata information of all the workflow engines in the system. ", response = WorkflowEngine.class, responseContainer = "List", authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowsApi.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowsApi.java index a9764630df..1d31fdaa7a 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowsApi.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowsApi.java @@ -47,7 +47,7 @@ public WorkflowsApi(){ @Consumes({ "application/json" }) @Produces({ "application/json" }) - @ApiOperation(value = "Create a new workflow.", notes = "Create a new workflow using the specified workflow template and execution engine. ", response = WorkflowSummary.class, authorizations = { + @ApiOperation(value = "Create a new workflow.", notes = "Create a new workflow using the specified workflow template and execution engine. <b>Scope required:</b> * internal_workflow_create ", response = WorkflowSummary.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -61,9 +61,9 @@ public WorkflowsApi(){ @ApiResponse(code = 409, message = "Item Already Exists", response = Error.class), @ApiResponse(code = 500, message = "Internal Server Error", response = Error.class) }) - public Response createWorkflow(@ApiParam(value = "Contains the details of the newly created workflow." ,required=true) @Valid WorkflowCreation requestBody) { + public Response createWorkflow(@ApiParam(value = "Contains the details of the newly created." ,required=true) @Valid WorkflowCreation workflowCreation) { - return delegate.createWorkflow(requestBody ); + return delegate.createWorkflow(workflowCreation ); } @Valid @@ -71,7 +71,7 @@ public Response createWorkflow(@ApiParam(value = "Contains the details of the ne @Path("/{workflow-id}") @Produces({ "application/json" }) - @ApiOperation(value = "Delete the workflow by workflow-id.", notes = "Delete a specific workflow identified by the workflow-id. <b>Permission required:</b> * /permission/admin/manage/humantask/viewtasks ", response = Void.class, authorizations = { + @ApiOperation(value = "Delete the workflow by workflow-id.", notes = "Delete a specific workflow identified by the workflow-id <b>Scope required:</b> * internal_workflow_delete ", response = Void.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -95,7 +95,7 @@ public Response deleteWorkflowById(@ApiParam(value = "Workflow ID",required=true @Path("/{workflow-id}") @Produces({ "application/json" }) - @ApiOperation(value = "Retrieve the workflow by workflow id.", notes = "Retrieve information about a specific workflow identified by the workflow id. <b>Permission required:</b> * /permission/admin/manage/humantask/viewtasks ", response = DetailedWorkflow.class, authorizations = { + @ApiOperation(value = "Retrieve the workflow by workflow id.", notes = "Retrieve information about a specific workflow identified by the workflow id. <b>Scope required:</b> * internal_workflow_view ", response = DetailedWorkflow.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -119,7 +119,7 @@ public Response getWorkflowById(@ApiParam(value = "Workflow ID",required=true) @ @Produces({ "application/json" }) - @ApiOperation(value = "Retrieve all the available workflows.", notes = "Retrieve all the available workflows in the system. ", response = WorkflowSummary.class, responseContainer = "List", authorizations = { + @ApiOperation(value = "Retrieve all the available workflows.", notes = "Retrieve all the available workflows in the system. <b>Scope required:</b> * internal_workflow_view ", response = WorkflowSummary.class, responseContainer = "List", authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -143,7 +143,7 @@ public Response listWorkflows( @Valid @Min(15)@ApiParam(value = "Maximum numb @Path("/{workflow-id}") @Consumes({ "application/json" }) @Produces({ "application/json" }) - @ApiOperation(value = "Update an existing workflow.", notes = "Update a workflow identified by workflow-id. ", response = Void.class, authorizations = { + @ApiOperation(value = "Update an existing workflow.", notes = "Update a workflow identified by workflow-id. <b>Scope required:</b> * internal_workflow_update ", response = Void.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -157,9 +157,9 @@ public Response listWorkflows( @Valid @Min(15)@ApiParam(value = "Maximum numb @ApiResponse(code = 404, message = "The specified resource is not found", response = Error.class), @ApiResponse(code = 500, message = "Internal Server Error", response = Error.class) }) - public Response updateWorkflow(@ApiParam(value = "Workflow ID",required=true) @PathParam("workflow-id") String workflowId, @ApiParam(value = "Contains the details of the updated workflow." ) @Valid WorkflowCreation requestBody) { + public Response updateWorkflow(@ApiParam(value = "Workflow ID",required=true) @PathParam("workflow-id") String workflowId, @ApiParam(value = "Contains the details of the updated workflow." ) @Valid WorkflowCreation workflowCreation) { - return delegate.updateWorkflow(workflowId, requestBody ); + return delegate.updateWorkflow(workflowId, workflowCreation ); } } diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowsApiService.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowsApiService.java index 437e7b57fb..d9024057ac 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowsApiService.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowsApiService.java @@ -24,7 +24,7 @@ public interface WorkflowsApiService { - public Response createWorkflow(WorkflowCreation requestBody); + public Response createWorkflow(WorkflowCreation workflowCreation); public Response deleteWorkflowById(String workflowId); @@ -32,5 +32,5 @@ public interface WorkflowsApiService { public Response listWorkflows(Integer limit, Integer offset, String filter); - public Response updateWorkflow(String workflowId, WorkflowCreation requestBody); + public Response updateWorkflow(String workflowId, WorkflowCreation workflowCreation); } diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/DetailedWorkflow.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/DetailedWorkflow.java index fd22d78e7d..54dfe5852b 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/DetailedWorkflow.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/DetailedWorkflow.java @@ -35,8 +35,8 @@ public class DetailedWorkflow { private String workflowName; private String workflowDescription; - private DetailedWorkflowTemplate workflowTemplate; private String workflowEngine; + private DetailedWorkflowTemplate workflowTemplate; private String approvalTask; private String approvalTaskDescription; @@ -49,11 +49,9 @@ public DetailedWorkflow workflowName(String workflowName) { return this; } - @ApiModelProperty(example = "User Registration Workflow", required = true, value = "Name of the created workflow") + @ApiModelProperty(example = "User Registration Workflow", value = "Name of the created workflow") @JsonProperty("workflowName") @Valid - @NotNull(message = "Property workflowName cannot be null.") - public String getWorkflowName() { return workflowName; } @@ -81,42 +79,40 @@ public void setWorkflowDescription(String workflowDescription) { } /** + * Name of the selected workflow engine **/ - public DetailedWorkflow workflowTemplate(DetailedWorkflowTemplate workflowTemplate) { + public DetailedWorkflow workflowEngine(String workflowEngine) { - this.workflowTemplate = workflowTemplate; + this.workflowEngine = workflowEngine; return this; } - @ApiModelProperty(value = "") - @JsonProperty("workflowTemplate") + @ApiModelProperty(example = "Simple Workflow Engine", value = "Name of the selected workflow engine") + @JsonProperty("workflowEngine") @Valid - public DetailedWorkflowTemplate getWorkflowTemplate() { - return workflowTemplate; + public String getWorkflowEngine() { + return workflowEngine; } - public void setWorkflowTemplate(DetailedWorkflowTemplate workflowTemplate) { - this.workflowTemplate = workflowTemplate; + public void setWorkflowEngine(String workflowEngine) { + this.workflowEngine = workflowEngine; } /** - * Name of the selected workflow engine **/ - public DetailedWorkflow workflowEngine(String workflowEngine) { + public DetailedWorkflow workflowTemplate(DetailedWorkflowTemplate workflowTemplate) { - this.workflowEngine = workflowEngine; + this.workflowTemplate = workflowTemplate; return this; } - @ApiModelProperty(example = "Simple Workflow Engine", required = true, value = "Name of the selected workflow engine") - @JsonProperty("workflowEngine") + @ApiModelProperty(value = "") + @JsonProperty("workflowTemplate") @Valid - @NotNull(message = "Property workflowEngine cannot be null.") - - public String getWorkflowEngine() { - return workflowEngine; + public DetailedWorkflowTemplate getWorkflowTemplate() { + return workflowTemplate; } - public void setWorkflowEngine(String workflowEngine) { - this.workflowEngine = workflowEngine; + public void setWorkflowTemplate(DetailedWorkflowTemplate workflowTemplate) { + this.workflowTemplate = workflowTemplate; } /** @@ -128,11 +124,9 @@ public DetailedWorkflow approvalTask(String approvalTask) { return this; } - @ApiModelProperty(example = "User Registration Approval", required = true, value = "Approval task subject to display") + @ApiModelProperty(example = "User Registration Approval", value = "Approval task subject to display") @JsonProperty("approvalTask") @Valid - @NotNull(message = "Property approvalTask cannot be null.") - public String getApprovalTask() { return approvalTask; } @@ -173,15 +167,15 @@ public boolean equals(java.lang.Object o) { DetailedWorkflow detailedWorkflow = (DetailedWorkflow) o; return Objects.equals(this.workflowName, detailedWorkflow.workflowName) && Objects.equals(this.workflowDescription, detailedWorkflow.workflowDescription) && - Objects.equals(this.workflowTemplate, detailedWorkflow.workflowTemplate) && Objects.equals(this.workflowEngine, detailedWorkflow.workflowEngine) && + Objects.equals(this.workflowTemplate, detailedWorkflow.workflowTemplate) && Objects.equals(this.approvalTask, detailedWorkflow.approvalTask) && Objects.equals(this.approvalTaskDescription, detailedWorkflow.approvalTaskDescription); } @Override public int hashCode() { - return Objects.hash(workflowName, workflowDescription, workflowTemplate, workflowEngine, approvalTask, approvalTaskDescription); + return Objects.hash(workflowName, workflowDescription, workflowEngine, workflowTemplate, approvalTask, approvalTaskDescription); } @Override @@ -192,8 +186,8 @@ public String toString() { sb.append(" workflowName: ").append(toIndentedString(workflowName)).append("\n"); sb.append(" workflowDescription: ").append(toIndentedString(workflowDescription)).append("\n"); - sb.append(" workflowTemplate: ").append(toIndentedString(workflowTemplate)).append("\n"); sb.append(" workflowEngine: ").append(toIndentedString(workflowEngine)).append("\n"); + sb.append(" workflowTemplate: ").append(toIndentedString(workflowTemplate)).append("\n"); sb.append(" approvalTask: ").append(toIndentedString(approvalTask)).append("\n"); sb.append(" approvalTaskDescription: ").append(toIndentedString(approvalTaskDescription)).append("\n"); sb.append("}"); diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/OptionDetails.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/OptionDetails.java index a6a6616e10..ab7ee42d73 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/OptionDetails.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/OptionDetails.java @@ -43,9 +43,11 @@ public OptionDetails entity(String entity) { return this; } - @ApiModelProperty(example = "roles", value = "") + @ApiModelProperty(example = "roles", required = true, value = "") @JsonProperty("entity") @Valid + @NotNull(message = "Property entity cannot be null.") + public String getEntity() { return entity; } @@ -61,9 +63,11 @@ public OptionDetails values(String values) { return this; } - @ApiModelProperty(example = "admin", value = "") + @ApiModelProperty(example = "admin", required = true, value = "") @JsonProperty("values") @Valid + @NotNull(message = "Property values cannot be null.") + public String getValues() { return values; } diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociation.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociation.java index d2e3e81509..bac6c7719c 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociation.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociation.java @@ -34,8 +34,9 @@ public class WorkflowAssociation { private String id; private String workflowAssociationName; - private String operation; + private String operationName; private String workflowName; + private String associationCondition; private Boolean isEnabled; /** @@ -79,20 +80,20 @@ public void setWorkflowAssociationName(String workflowAssociationName) { /** * User Operation **/ - public WorkflowAssociation operation(String operation) { + public WorkflowAssociation operationName(String operationName) { - this.operation = operation; + this.operationName = operationName; return this; } @ApiModelProperty(example = "Add User", value = "User Operation") - @JsonProperty("operation") + @JsonProperty("operationName") @Valid - public String getOperation() { - return operation; + public String getOperationName() { + return operationName; } - public void setOperation(String operation) { - this.operation = operation; + public void setOperationName(String operationName) { + this.operationName = operationName; } /** @@ -114,6 +115,25 @@ public void setWorkflowName(String workflowName) { this.workflowName = workflowName; } + /** + * Assigned Association Condition + **/ + public WorkflowAssociation associationCondition(String associationCondition) { + + this.associationCondition = associationCondition; + return this; + } + + @ApiModelProperty(example = "Role equals Manager", value = "Assigned Association Condition") + @JsonProperty("associationCondition") + @Valid + public String getAssociationCondition() { + return associationCondition; + } + public void setAssociationCondition(String associationCondition) { + this.associationCondition = associationCondition; + } + /** * Association Status **/ @@ -147,14 +167,15 @@ public boolean equals(java.lang.Object o) { WorkflowAssociation workflowAssociation = (WorkflowAssociation) o; return Objects.equals(this.id, workflowAssociation.id) && Objects.equals(this.workflowAssociationName, workflowAssociation.workflowAssociationName) && - Objects.equals(this.operation, workflowAssociation.operation) && + Objects.equals(this.operationName, workflowAssociation.operationName) && Objects.equals(this.workflowName, workflowAssociation.workflowName) && + Objects.equals(this.associationCondition, workflowAssociation.associationCondition) && Objects.equals(this.isEnabled, workflowAssociation.isEnabled); } @Override public int hashCode() { - return Objects.hash(id, workflowAssociationName, operation, workflowName, isEnabled); + return Objects.hash(id, workflowAssociationName, operationName, workflowName, associationCondition, isEnabled); } @Override @@ -165,8 +186,9 @@ public String toString() { sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" workflowAssociationName: ").append(toIndentedString(workflowAssociationName)).append("\n"); - sb.append(" operation: ").append(toIndentedString(operation)).append("\n"); + sb.append(" operationName: ").append(toIndentedString(operationName)).append("\n"); sb.append(" workflowName: ").append(toIndentedString(workflowName)).append("\n"); + sb.append(" associationCondition: ").append(toIndentedString(associationCondition)).append("\n"); sb.append(" isEnabled: ").append(toIndentedString(isEnabled)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociationCreation.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociationCreation.java index 75be6d3692..3cec767cd2 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociationCreation.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociationCreation.java @@ -33,10 +33,10 @@ public class WorkflowAssociationCreation { private String associationName; - private String operationCategory; private String operationName; private String workflowId; private String associationCondition; + private Boolean isEnabled = true; /** * Name of the workflow association @@ -59,27 +59,6 @@ public void setAssociationName(String associationName) { this.associationName = associationName; } - /** - * Operation type - **/ - public WorkflowAssociationCreation operationCategory(String operationCategory) { - - this.operationCategory = operationCategory; - return this; - } - - @ApiModelProperty(example = "User Store Operations", required = true, value = "Operation type") - @JsonProperty("operationCategory") - @Valid - @NotNull(message = "Property operationCategory cannot be null.") - - public String getOperationCategory() { - return operationCategory; - } - public void setOperationCategory(String operationCategory) { - this.operationCategory = operationCategory; - } - /** * Name of the user operation **/ @@ -141,6 +120,25 @@ public void setAssociationCondition(String associationCondition) { this.associationCondition = associationCondition; } + /** + * Association Status + **/ + public WorkflowAssociationCreation isEnabled(Boolean isEnabled) { + + this.isEnabled = isEnabled; + return this; + } + + @ApiModelProperty(example = "true", value = "Association Status") + @JsonProperty("isEnabled") + @Valid + public Boolean getIsEnabled() { + return isEnabled; + } + public void setIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + } + @Override @@ -154,15 +152,15 @@ public boolean equals(java.lang.Object o) { } WorkflowAssociationCreation workflowAssociationCreation = (WorkflowAssociationCreation) o; return Objects.equals(this.associationName, workflowAssociationCreation.associationName) && - Objects.equals(this.operationCategory, workflowAssociationCreation.operationCategory) && Objects.equals(this.operationName, workflowAssociationCreation.operationName) && Objects.equals(this.workflowId, workflowAssociationCreation.workflowId) && - Objects.equals(this.associationCondition, workflowAssociationCreation.associationCondition); + Objects.equals(this.associationCondition, workflowAssociationCreation.associationCondition) && + Objects.equals(this.isEnabled, workflowAssociationCreation.isEnabled); } @Override public int hashCode() { - return Objects.hash(associationName, operationCategory, operationName, workflowId, associationCondition); + return Objects.hash(associationName, operationName, workflowId, associationCondition, isEnabled); } @Override @@ -172,10 +170,10 @@ public String toString() { sb.append("class WorkflowAssociationCreation {\n"); sb.append(" associationName: ").append(toIndentedString(associationName)).append("\n"); - sb.append(" operationCategory: ").append(toIndentedString(operationCategory)).append("\n"); sb.append(" operationName: ").append(toIndentedString(operationName)).append("\n"); sb.append(" workflowId: ").append(toIndentedString(workflowId)).append("\n"); sb.append(" associationCondition: ").append(toIndentedString(associationCondition)).append("\n"); + sb.append(" isEnabled: ").append(toIndentedString(isEnabled)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowCreation.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowCreation.java index a95ce28d56..83332589e5 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowCreation.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowCreation.java @@ -35,8 +35,8 @@ public class WorkflowCreation { private String workflowName; private String workflowDescription; - private WorkflowTemplate workflowTemplate; private String workflowEngine; + private WorkflowTemplate workflowTemplate; private String approvalTask; private String approvalTaskDescription; @@ -80,26 +80,6 @@ public void setWorkflowDescription(String workflowDescription) { this.workflowDescription = workflowDescription; } - /** - **/ - public WorkflowCreation workflowTemplate(WorkflowTemplate workflowTemplate) { - - this.workflowTemplate = workflowTemplate; - return this; - } - - @ApiModelProperty(required = true, value = "") - @JsonProperty("workflowTemplate") - @Valid - @NotNull(message = "Property workflowTemplate cannot be null.") - - public WorkflowTemplate getWorkflowTemplate() { - return workflowTemplate; - } - public void setWorkflowTemplate(WorkflowTemplate workflowTemplate) { - this.workflowTemplate = workflowTemplate; - } - /** * Name of the selected workflow engine **/ @@ -121,6 +101,24 @@ public void setWorkflowEngine(String workflowEngine) { this.workflowEngine = workflowEngine; } + /** + **/ + public WorkflowCreation workflowTemplate(WorkflowTemplate workflowTemplate) { + + this.workflowTemplate = workflowTemplate; + return this; + } + + @ApiModelProperty(value = "") + @JsonProperty("workflowTemplate") + @Valid + public WorkflowTemplate getWorkflowTemplate() { + return workflowTemplate; + } + public void setWorkflowTemplate(WorkflowTemplate workflowTemplate) { + this.workflowTemplate = workflowTemplate; + } + /** * Approval task subject to display **/ @@ -175,15 +173,15 @@ public boolean equals(java.lang.Object o) { WorkflowCreation workflowCreation = (WorkflowCreation) o; return Objects.equals(this.workflowName, workflowCreation.workflowName) && Objects.equals(this.workflowDescription, workflowCreation.workflowDescription) && - Objects.equals(this.workflowTemplate, workflowCreation.workflowTemplate) && Objects.equals(this.workflowEngine, workflowCreation.workflowEngine) && + Objects.equals(this.workflowTemplate, workflowCreation.workflowTemplate) && Objects.equals(this.approvalTask, workflowCreation.approvalTask) && Objects.equals(this.approvalTaskDescription, workflowCreation.approvalTaskDescription); } @Override public int hashCode() { - return Objects.hash(workflowName, workflowDescription, workflowTemplate, workflowEngine, approvalTask, approvalTaskDescription); + return Objects.hash(workflowName, workflowDescription, workflowEngine, workflowTemplate, approvalTask, approvalTaskDescription); } @Override @@ -194,8 +192,8 @@ public String toString() { sb.append(" workflowName: ").append(toIndentedString(workflowName)).append("\n"); sb.append(" workflowDescription: ").append(toIndentedString(workflowDescription)).append("\n"); - sb.append(" workflowTemplate: ").append(toIndentedString(workflowTemplate)).append("\n"); sb.append(" workflowEngine: ").append(toIndentedString(workflowEngine)).append("\n"); + sb.append(" workflowTemplate: ").append(toIndentedString(workflowTemplate)).append("\n"); sb.append(" approvalTask: ").append(toIndentedString(approvalTask)).append("\n"); sb.append(" approvalTaskDescription: ").append(toIndentedString(approvalTaskDescription)).append("\n"); sb.append("}"); diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowSummary.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowSummary.java index 639bb6bdaf..9bc0658cd7 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowSummary.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowSummary.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * 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 @@ -35,8 +35,8 @@ public class WorkflowSummary { private String id; private String workflowName; private String workflowDescription; + private String workflowEngine; private String workflowTemplate; - private String deployment; /** * Unique id to represent a workflow @@ -96,41 +96,41 @@ public void setWorkflowDescription(String workflowDescription) { } /** - * Template defining the approval process for the workflow + * Category in which the workflow is deployed **/ - public WorkflowSummary workflowTemplate(String workflowTemplate) { + public WorkflowSummary workflowEngine(String workflowEngine) { - this.workflowTemplate = workflowTemplate; + this.workflowEngine = workflowEngine; return this; } - @ApiModelProperty(example = "MultiStepApprovalTemplate", value = "Template defining the approval process for the workflow") - @JsonProperty("workflowTemplate") + @ApiModelProperty(example = "Simple Workflow Engine", value = "Category in which the workflow is deployed") + @JsonProperty("workflowEngine") @Valid - public String getWorkflowTemplate() { - return workflowTemplate; + public String getWorkflowEngine() { + return workflowEngine; } - public void setWorkflowTemplate(String workflowTemplate) { - this.workflowTemplate = workflowTemplate; + public void setWorkflowEngine(String workflowEngine) { + this.workflowEngine = workflowEngine; } /** - * Category in which the workflow is deployed + * Template defining the approval process for the workflow **/ - public WorkflowSummary deployment(String deployment) { + public WorkflowSummary workflowTemplate(String workflowTemplate) { - this.deployment = deployment; + this.workflowTemplate = workflowTemplate; return this; } - @ApiModelProperty(example = "ApprovalWorkflow", value = "Category in which the workflow is deployed") - @JsonProperty("deployment") + @ApiModelProperty(example = "MultiStepApprovalTemplate", value = "Template defining the approval process for the workflow") + @JsonProperty("workflowTemplate") @Valid - public String getDeployment() { - return deployment; + public String getWorkflowTemplate() { + return workflowTemplate; } - public void setDeployment(String deployment) { - this.deployment = deployment; + public void setWorkflowTemplate(String workflowTemplate) { + this.workflowTemplate = workflowTemplate; } @@ -148,13 +148,13 @@ public boolean equals(java.lang.Object o) { return Objects.equals(this.id, workflowSummary.id) && Objects.equals(this.workflowName, workflowSummary.workflowName) && Objects.equals(this.workflowDescription, workflowSummary.workflowDescription) && - Objects.equals(this.workflowTemplate, workflowSummary.workflowTemplate) && - Objects.equals(this.deployment, workflowSummary.deployment); + Objects.equals(this.workflowEngine, workflowSummary.workflowEngine) && + Objects.equals(this.workflowTemplate, workflowSummary.workflowTemplate); } @Override public int hashCode() { - return Objects.hash(id, workflowName, workflowDescription, workflowTemplate, deployment); + return Objects.hash(id, workflowName, workflowDescription, workflowEngine, workflowTemplate); } @Override @@ -166,8 +166,8 @@ public String toString() { sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" workflowName: ").append(toIndentedString(workflowName)).append("\n"); sb.append(" workflowDescription: ").append(toIndentedString(workflowDescription)).append("\n"); + sb.append(" workflowEngine: ").append(toIndentedString(workflowEngine)).append("\n"); sb.append(" workflowTemplate: ").append(toIndentedString(workflowTemplate)).append("\n"); - sb.append(" deployment: ").append(toIndentedString(deployment)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowTemplate.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowTemplate.java index dd565a503a..42441bc3a4 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowTemplate.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowTemplate.java @@ -48,9 +48,11 @@ public WorkflowTemplate name(String name) { return this; } - @ApiModelProperty(example = "MultiStepApproval", value = "Name of the workflow template") + @ApiModelProperty(example = "MultiStepApproval", required = true, value = "Name of the workflow template") @JsonProperty("name") @Valid + @NotNull(message = "Property name cannot be null.") + public String getName() { return name; } diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowTemplateParameters.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowTemplateParameters.java index e9a15c1461..c9affabcff 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowTemplateParameters.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowTemplateParameters.java @@ -47,9 +47,11 @@ public WorkflowTemplateParameters steps(Integer steps) { return this; } - @ApiModelProperty(example = "1", value = "") + @ApiModelProperty(example = "1", required = true, value = "") @JsonProperty("steps") @Valid + @NotNull(message = "Property steps cannot be null.") + public Integer getSteps() { return steps; } @@ -67,7 +69,7 @@ public WorkflowTemplateParameters options(List<OptionDetails> options) { @ApiModelProperty(example = "[{\"entity\":\"roles\",\"values\":\"admin\"},{\"entity\":\"users\",\"values\":\"John\"}]", value = "") @JsonProperty("options") - @Valid @Size(min=2) + @Valid @Size(min=1) public List<OptionDetails> getOptions() { return options; } diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowsApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowsApiServiceImpl.java index 960bcb3156..0e9d5081db 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowsApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowsApiServiceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * 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 @@ -22,6 +22,7 @@ import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.core.WorkflowService; import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.factories.WorkflowServiceFactory; import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.*; +import java.util.List; import javax.ws.rs.core.Response; @@ -34,14 +35,14 @@ public WorkflowsApiServiceImpl() { try { this.workflowService = WorkflowServiceFactory.getWorkflowService(); } catch (IllegalStateException e) { - throw new RuntimeException("Error occurred while initiating Workflow.", e); + throw new RuntimeException("Error occurred while initiating WorkflowService.", e); } } @Override - public Response createWorkflow(WorkflowCreation requestBody) { + public Response createWorkflow(WorkflowCreation workflowCreation) { - return Response.ok().entity(workflowService.addWorkflow(requestBody, null)).build(); + return Response.ok().entity(workflowService.addWorkflow(workflowCreation, null)).build(); } @Override @@ -63,8 +64,8 @@ public Response listWorkflows(Integer limit, Integer offset, String filter) { } @Override - public Response updateWorkflow(String workflowId, WorkflowCreation requestBody) { + public Response updateWorkflow(String workflowId, WorkflowCreation workflowCreation) { - return Response.ok().entity(workflowService.addWorkflow(requestBody, workflowId)).build(); + return Response.ok().entity(workflowService.addWorkflow(workflowCreation, workflowId)).build(); } } From 7a1438a2bd0efff27631b9498434ee10dda2cb5b Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Tue, 4 Mar 2025 15:54:15 +0530 Subject: [PATCH 12/47] Implement methods for recently added API endpoints --- .../engine/v1/core/WorkflowService.java | 219 ++++++++++++++---- .../WorkflowAssociationsApiServiceImpl.java | 19 +- 2 files changed, 181 insertions(+), 57 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkflowService.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkflowService.java index b947e0b0ab..f85184cc58 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkflowService.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkflowService.java @@ -23,6 +23,8 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.CarbonContext; +import org.wso2.carbon.identity.api.server.common.error.APIError; +import org.wso2.carbon.identity.api.server.common.error.ErrorResponse; import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.*; import org.wso2.carbon.identity.workflow.mgt.WorkflowManagementAdminService; import org.wso2.carbon.identity.workflow.mgt.WorkflowManagementService; @@ -32,10 +34,13 @@ import org.wso2.carbon.identity.workflow.mgt.dao.WorkflowDAO; import org.wso2.carbon.identity.workflow.mgt.dto.Association; import org.wso2.carbon.identity.workflow.mgt.dto.Template; +import org.wso2.carbon.identity.workflow.mgt.exception.WorkflowClientException; import org.wso2.carbon.identity.workflow.mgt.exception.WorkflowException; import org.wso2.carbon.identity.workflow.mgt.exception.WorkflowRuntimeException; import org.wso2.carbon.identity.workflow.mgt.internal.WorkflowServiceDataHolder; +import org.wso2.carbon.identity.workflow.mgt.util.WFConstant; +import javax.ws.rs.core.Response; import java.util.*; @@ -43,7 +48,6 @@ public class WorkflowService { private static final Log log = LogFactory.getLog(WorkflowManagementAdminService.class); private final WorkflowManagementService workflowManagementService; - //WorkflowManagementService worWorkflowServiceHolder. public WorkflowService(WorkflowManagementService workflowManagementService){ @@ -63,7 +67,7 @@ private WorkflowSummary getWorkflow(Workflow workflowBean) { workflow.setWorkflowName(workflowBean.getWorkflowName()); workflow.setWorkflowDescription(workflowBean.getWorkflowDescription()); workflow.setWorkflowTemplate(workflowBean.getTemplateId()); - workflow.setDeployment(workflowBean.getWorkflowImplId()); + workflow.setWorkflowEngine(workflowBean.getWorkflowImplId()); } return workflow; } @@ -78,14 +82,16 @@ private WorkflowAssociation getAssociation(Association associationBean) { association.setId(associationBean.getWorkflowId()); association.setWorkflowAssociationName(associationBean.getAssociationName()); - association.setOperation(associationBean.getEventName()); + association.setOperationName(associationBean.getEventName()); association.setWorkflowName(associationBean.getWorkflowName()); + association.setAssociationCondition(associationBean.getCondition()); association.setIsEnabled(associationBean.isEnabled()); } return association; } private Parameter setWorkflowImplParameters(String workflowId, String paramName, String paramValue, String qName, String holder){ + Parameter parameter = new Parameter(); parameter.setWorkflowId(workflowId); parameter.setParamName(paramName); @@ -150,18 +156,25 @@ private Parameter setWorkflowImplParameters(String workflowId, String paramName, * } * * @param workflow Workflow details + * @param id Workflow ID * @throws WorkflowException */ - public WorkflowSummary addWorkflow(WorkflowCreation workflow, String id) { + public WorkflowSummary addWorkflow(WorkflowCreation workflow, String id) { - if (StringUtils.isBlank(id)) { - id = UUID.randomUUID().toString(); - } int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); - WorkflowSummary workflowSummary = new WorkflowSummary(); + WorkflowSummary workflowSummary; Workflow workflowBean = new Workflow(); try { + if (StringUtils.isBlank(id)) { + id = UUID.randomUUID().toString(); + } else { + Workflow existingWorkflow = workflowManagementService.getWorkflow(id); + + if (existingWorkflow == null) { + throw new WorkflowClientException("Invalid workflow ID provided."); + } + } workflowBean.setWorkflowId(id); workflowBean.setWorkflowName(workflow.getWorkflowName()); workflowBean.setWorkflowDescription(workflow.getWorkflowDescription()); @@ -187,9 +200,9 @@ public WorkflowSummary addWorkflow(WorkflowCreation workflow, String id) { List<Parameter> parameterList = new ArrayList<>(); - for (WorkflowTemplateParameters properties: templateProperties){ - for (OptionDetails options: properties.getOptions() ){ - Parameter parameter = setWorkflowImplParameters(null, "UserAndRole", options.getValues(), "UserAndRole-step-" + properties.getStep() + "-" + options.getEntity(), "Template"); + for (WorkflowTemplateParameters properties : templateProperties) { + for (OptionDetails options : properties.getOptions()) { + Parameter parameter = setWorkflowImplParameters(null, "UserAndRole", options.getValues(), "UserAndRole-step-" + properties.getSteps() + "-" + options.getEntity(), "Template"); parameterList.add(parameter); } @@ -198,21 +211,21 @@ public WorkflowSummary addWorkflow(WorkflowCreation workflow, String id) { // Setting up workflow impl parameter list Parameter taskParameterDesc; if (StringUtils.isBlank(id)) { - taskParameterDesc = setWorkflowImplParameters(null,"HTDescription" , workflow.getApprovalTaskDescription(), "HTDescription", "Workflowimpl" ); + taskParameterDesc = setWorkflowImplParameters(null, "HTDescription", workflow.getApprovalTaskDescription(), "HTDescription", "Workflowimpl"); } else { - taskParameterDesc = setWorkflowImplParameters(id,"HTDescription" , workflow.getApprovalTaskDescription(), "HTDescription", "Workflowimpl" ); + taskParameterDesc = setWorkflowImplParameters(id, "HTDescription", workflow.getApprovalTaskDescription(), "HTDescription", "Workflowimpl"); } parameterList.add(taskParameterDesc); Parameter taskParameterSubject; if (StringUtils.isBlank(id)) { - taskParameterSubject = setWorkflowImplParameters(null,"HTSubject" , workflow.getApprovalTask(), "HTSubject", "Workflowimpl" ); + taskParameterSubject = setWorkflowImplParameters(null, "HTSubject", workflow.getApprovalTask(), "HTSubject", "Workflowimpl"); } else { - taskParameterSubject = setWorkflowImplParameters(id,"HTSubject" , workflow.getApprovalTask(), "HTSubject", "Workflowimpl" ); + taskParameterSubject = setWorkflowImplParameters(id, "HTSubject", workflow.getApprovalTask(), "HTSubject", "Workflowimpl"); } parameterList.add(taskParameterSubject); - Parameter workflowParameter = setWorkflowImplParameters(id,"WorkflowName" , workflow.getWorkflowName(), "WorkflowName", "Workflowimpl" ); + Parameter workflowParameter = setWorkflowImplParameters(id, "WorkflowName", workflow.getWorkflowName(), "WorkflowName", "Workflowimpl"); parameterList.add(workflowParameter); // @@ -226,19 +239,29 @@ public WorkflowSummary addWorkflow(WorkflowCreation workflow, String id) { // WorkflowServiceDataHolder.getInstance().getWorkflowService() // .addWorkflow(workflowBean, parameterList, tenantId); - workflowManagementService.addWorkflow(workflowBean, parameterList, tenantId); + + try { + workflowManagementService.addWorkflow(workflowBean, parameterList, tenantId); + } catch (NullPointerException e) { + throw new WorkflowException(e.getMessage()); + } + workflowSummary = getWorkflow(workflowBean); - } catch (WorkflowRuntimeException e) { -// throw new WorkflowException(e.getMessage()); + + } catch (WorkflowClientException e){ + + throw handleClientError(e.getErrorCode(),e.getMessage(), "", e); } catch (WorkflowException e) { + // throw new WorkflowException("Server error occured when adding the workflow"); + throw handleServerError(e.getErrorCode(),e.getMessage(), "", e); + } - return getWorkflow(workflowBean); + return workflowSummary; } - /** * Retrieve workflow from workflow ID * @@ -252,15 +275,23 @@ public DetailedWorkflow getWorkflow(String workflowId) { // Workflow workflowBean = // WorkflowServiceDataHolder.getInstance().getWorkflowService().getWorkflow(workflowId); Workflow workflowBean = workflowManagementService.getWorkflow(workflowId); + + if (workflowBean == null) { + throw new WorkflowClientException("Invalid workflow ID provided."); + } List<Parameter> workflowParameters = workflowManagementService.getWorkflowParameters(workflowId); return getDetailedWorkflow(workflowBean, workflowParameters); + } catch (WorkflowClientException e){ + + throw handleClientError(e.getErrorCode(),e.getMessage(), "", e); + } catch (WorkflowException e) { - log.error("Server error when retrieving workflow by the given id ", e); +// throw new WorkflowException("Server error occured when adding the workflow"); + throw handleServerError(e.getErrorCode(),e.getMessage(), "", e); } - return null; } private DetailedWorkflow getDetailedWorkflow(Workflow workflowBean, List<Parameter> workflowParameters) throws WorkflowException{ @@ -287,7 +318,7 @@ private DetailedWorkflow getDetailedWorkflow(Workflow workflowBean, List<Paramet // Check if there's already a WorkflowTemplateParameters object for this step WorkflowTemplateParameters templateParameters = templateParamsMap.getOrDefault(stepNumber, new WorkflowTemplateParameters()); - templateParameters.setStep(stepNumber); + templateParameters.setSteps(stepNumber); // Create and add new OptionDetails OptionDetails details = new OptionDetails(); @@ -350,12 +381,12 @@ public WorkflowSummary[] listPaginatedWorkflows(Integer limit, Integer offset, S WorkflowSummary workflowTmp = getWorkflow(workflow); workflowSummaryList.add(workflowTmp); } + return workflowSummaryList.toArray(new WorkflowSummary[workflowSummaryList.size()]); } catch (WorkflowException e) { - log.error("Server error when retrieving available workflows ", e); + throw handleServerError(e.getErrorCode(),e.getMessage(), "", e); } - return workflowSummaryList.toArray(new WorkflowSummary[workflowSummaryList.size()]); } @@ -369,16 +400,22 @@ public WorkflowSummary[] listPaginatedWorkflows(Integer limit, Integer offset, S public WorkflowSummary removeWorkflow(String id) { try { + //WorkflowServiceDataHolder.getInstance().getWorkflowService().removeWorkflow(id); WorkflowSummary workflow = getWorkflow(workflowManagementService.getWorkflow(id)); + if (workflow == null) { + throw new WorkflowClientException("Invalid Workflow ID provided."); + } workflowManagementService.removeWorkflow(id); return workflow; - } catch (WorkflowException e) { + } catch (WorkflowClientException e) { //throw new WorkflowException("Server error occurred when removing workflow"); - log.error("Error occurred when removing workflow with ID: " + id, e); + throw handleClientError(e.getErrorCode(),e.getMessage(), "", e); + } catch (WorkflowException e) { + + throw handleServerError(e.getErrorCode(),e.getMessage(), "", e); } - return null; } /** @@ -415,6 +452,7 @@ public WorkflowAssociation[] listPaginatedAssociations(Integer limit, Integer of } catch (WorkflowException e) { // throw new WorkflowException(WFConstant.Exceptions.ERROR_LISTING_ASSOCIATIONS, e); log.error("Error occurred when retrieving all the available workflow associations", e); + throw handleServerError(e.getErrorCode(), e.getMessage(), "", e); } if (CollectionUtils.isEmpty(associations)) { @@ -429,16 +467,23 @@ public WorkflowAssociation[] listPaginatedAssociations(Integer limit, Integer of * @param associationId ID of association to remove * @throws WorkflowException */ - public String removeAssociation(int associationId) { + public String removeAssociation(String associationId) { try { // WorkflowServiceDataHolder.getInstance().getWorkflowService() // .removeAssociation(Integer.parseInt(associationId)); - workflowManagementService.removeAssociation(associationId); + + Association association = workflowManagementService.getAssociation(associationId); + if (association == null) { + throw new WorkflowClientException("Invalid Association ID provided."); + } + workflowManagementService.removeAssociation(Integer.parseInt(associationId)); return "Workflow association successfully removed!"; - } catch (WorkflowException e) { - log.error("Server error when removing association " + associationId, e); - return "Server error when removing association" + associationId; + } catch (WorkflowClientException e){ + throw handleClientError(e.getErrorCode(),e.getMessage(), "", e); + }catch (WorkflowException e) { +// log.error("Server error when removing association " + associationId, e); + throw handleServerError(e.getErrorCode(), e.getMessage(), "", e); } } @@ -463,39 +508,113 @@ private String addAssociation(String associationName, String workflowId, String log.error("Error when adding association " + associationName, e); return "Error when adding association" + associationName; } catch (WorkflowException e) { - log.error("Server error when adding association of workflow " + workflowId + " with " + eventId, e); - return "Server error when adding association of workflow" + workflowId + " with " + eventId; +// log.error("Server error when adding association of workflow " + workflowId + " with " + eventId, e); +// return "Server error when adding association of workflow" + workflowId + " with " + eventId; + throw handleServerError(e.getErrorCode(), e.getMessage(), "", e); } } public String addAssociation(WorkflowAssociationCreation workflowAssociation){ + return addAssociation(workflowAssociation.getAssociationName(), workflowAssociation.getWorkflowId(), workflowAssociation.getOperationName(), workflowAssociation.getAssociationCondition()); } /** - * Enable or disable association + * Get an association by ID + * @param associationId Association ID + * @throws WorkflowException + */ + public WorkflowAssociation getAssociation(String associationId) { + + WorkflowAssociation workflowAssociation = new WorkflowAssociation(); + try { + Association association = workflowManagementService.getAssociation(associationId); + if (association == null) { + throw new WorkflowClientException("Invalid workflow association ID provided."); + } + return getAssociation(association); + } catch (WorkflowClientException e) { + throw handleClientError(e.getErrorCode(), e.getMessage(), "", e); + } catch (WorkflowException e) { + throw handleServerError(e.getErrorCode(), e.getMessage(), "", e); + } + } + + + private boolean getAssociationState(String associationId, Status status){ + + boolean isEnable; + try { + + if (status == null) { + + isEnable = workflowManagementService.getAssociation(associationId).isEnabled(); + } else { + isEnable = (status.getAction() == ActionStatus.ENABLE); + } + return isEnable; + + } catch (WorkflowException e) { + throw handleServerError(e.getErrorCode(),e.getMessage(), "", e); + } + } + + /** + * Partially update an association * * @param associationId Association ID - * @param isEnable New state + * @param workflowAssociation Association Details * @throws WorkflowException */ - private String changeAssociationState(String associationId, boolean isEnable) { + public String changeAssociation(String associationId, WorkflowAssociationPatch workflowAssociation){ + try { -// WorkflowServiceDataHolder.getInstance().getWorkflowService() -// .changeAssociationState(associationId, isEnable); - workflowManagementService.changeAssociationState(associationId, isEnable); - } catch (WorkflowRuntimeException e) { - log.error("Error when changing an association ", e); + Association association = workflowManagementService.getAssociation(associationId); + if (association == null ) { + throw new WorkflowClientException("Invalid workflow association ID provided."); + } + boolean isEnable = getAssociationState(associationId, workflowAssociation.getAssociationStatus()); + workflowManagementService.changeAssociation(associationId, workflowAssociation.getAssociationName(), workflowAssociation.getWorkflowId(), workflowAssociation.getOperationName(), workflowAssociation.getAssociationCondition(), isEnable); + return "Workflow association successfully updated!"; + + } catch (WorkflowClientException e) { + throw handleClientError(e.getErrorCode(), e.getMessage(), "", e); } catch (WorkflowException e) { - log.error("Server error when changing state of association ", e); + throw handleServerError(e.getErrorCode(), e.getMessage(), "", e); + } + } + + private ErrorResponse.Builder getErrorBuilder(String errorCode, String errorMsg, String data) { + + return new ErrorResponse.Builder().withCode(errorCode).withMessage(errorMsg) + .withDescription(includeData(errorMsg, data)); + } + + private static String includeData(String errorMsg, String data) { + + String message = errorMsg; + if (data != null) { + message = String.format(errorMsg, data); } - return "Workflow Association Status successfully updated!"; + return message; + } + + private APIError handleServerError(String errorCode, String errorMsg, String data, Exception e) { + + ErrorResponse errorResponse = getErrorBuilder(errorCode, errorMsg, data).build(log, + e, includeData(errorMsg, data)); + + return new APIError(Response.Status.INTERNAL_SERVER_ERROR, errorResponse); } - public String changeAssociationState(Integer associationId, Status status){ - boolean isEnable = (status.getAction() == ActionStatus.ENABLE); - String id = Integer.toString(associationId); - return changeAssociationState(id, isEnable); + + private APIError handleClientError(String errorCode, String errorMsg, String data, WorkflowClientException e) { + + ErrorResponse errorResponse = getErrorBuilder(errorCode, errorMsg, data).build(log, + e, includeData(errorMsg, data)); + + return new APIError(Response.Status.BAD_REQUEST, errorResponse); + } } diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowAssociationsApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowAssociationsApiServiceImpl.java index 880e5e6794..bfb716def5 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowAssociationsApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowAssociationsApiServiceImpl.java @@ -22,7 +22,6 @@ import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.core.WorkflowService; import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.factories.WorkflowServiceFactory; import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.*; -import java.util.List; import javax.ws.rs.core.Response; @@ -35,22 +34,28 @@ public WorkflowAssociationsApiServiceImpl() { try { this.workflowService = WorkflowServiceFactory.getWorkflowService(); } catch (IllegalStateException e) { - throw new RuntimeException("Error occurred while initiating Workflow Service", e); + throw new RuntimeException("Error occurred while initiating WorkflowService.", e); } } @Override - public Response createWorkflowAssociation(WorkflowAssociationCreation requestBody) { + public Response createWorkflowAssociation(WorkflowAssociationCreation workflowAssociationCreation) { - return Response.ok().entity(workflowService.addAssociation(requestBody)).build(); + return Response.ok().entity(workflowService.addAssociation(workflowAssociationCreation)).build(); } @Override - public Response deleteWorkflowAssociationById(Integer associationId) { + public Response deleteWorkflowAssociationById(String associationId) { return Response.ok().entity(workflowService.removeAssociation(associationId)).build(); } + @Override + public Response getWorkflowAssociationById(String associationId) { + + return Response.ok().entity(workflowService.getAssociation(associationId)).build(); + } + @Override public Response listWorkflowAssociations(Integer limit, Integer offset, String filter) { @@ -58,8 +63,8 @@ public Response listWorkflowAssociations(Integer limit, Integer offset, String f } @Override - public Response updateWorkflowAssociationStatus(Integer associationId, Status status) { + public Response patchAssociation(String associationId, WorkflowAssociationPatch workflowAssociationPatch) { - return Response.ok().entity(workflowService.changeAssociationState(associationId, status)).build(); + return Response.ok().entity(workflowService.changeAssociation(associationId, workflowAssociationPatch)).build(); } } From 760e523e32bb04d13c56ed867f05b4854b0bb3aa Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Tue, 4 Mar 2025 15:55:14 +0530 Subject: [PATCH 13/47] Add new model for updating an association --- .../v1/model/WorkflowAssociationPatch.java | 187 ++++++++++++++++++ 1 file changed, 187 insertions(+) create mode 100644 components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociationPatch.java diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociationPatch.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociationPatch.java new file mode 100644 index 0000000000..589f2a5901 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociationPatch.java @@ -0,0 +1,187 @@ +/* + * 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.rest.api.server.workflow.engine.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.Status; +import javax.validation.constraints.*; + + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; + +public class WorkflowAssociationPatch { + + private String associationName; + private String operationName; + private String workflowId; + private String associationCondition; + private Status associationStatus; + + /** + * Name of the workflow association + **/ + public WorkflowAssociationPatch associationName(String associationName) { + + this.associationName = associationName; + return this; + } + + @ApiModelProperty(example = "User Registration Workflow Association", value = "Name of the workflow association") + @JsonProperty("associationName") + @Valid + public String getAssociationName() { + return associationName; + } + public void setAssociationName(String associationName) { + this.associationName = associationName; + } + + /** + * Name of the user operation + **/ + public WorkflowAssociationPatch operationName(String operationName) { + + this.operationName = operationName; + return this; + } + + @ApiModelProperty(example = "Add User", value = "Name of the user operation") + @JsonProperty("operationName") + @Valid + public String getOperationName() { + return operationName; + } + public void setOperationName(String operationName) { + this.operationName = operationName; + } + + /** + * Id of the assigned workflow + **/ + public WorkflowAssociationPatch workflowId(String workflowId) { + + this.workflowId = workflowId; + return this; + } + + @ApiModelProperty(example = "456", value = "Id of the assigned workflow") + @JsonProperty("workflowId") + @Valid + public String getWorkflowId() { + return workflowId; + } + public void setWorkflowId(String workflowId) { + this.workflowId = workflowId; + } + + /** + * Condition added to the association + **/ + public WorkflowAssociationPatch associationCondition(String associationCondition) { + + this.associationCondition = associationCondition; + return this; + } + + @ApiModelProperty(example = "Role Name equals Manager", value = "Condition added to the association") + @JsonProperty("associationCondition") + @Valid + public String getAssociationCondition() { + return associationCondition; + } + public void setAssociationCondition(String associationCondition) { + this.associationCondition = associationCondition; + } + + /** + **/ + public WorkflowAssociationPatch associationStatus(Status associationStatus) { + + this.associationStatus = associationStatus; + return this; + } + + @ApiModelProperty(value = "") + @JsonProperty("associationStatus") + @Valid + public Status getAssociationStatus() { + return associationStatus; + } + public void setAssociationStatus(Status associationStatus) { + this.associationStatus = associationStatus; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WorkflowAssociationPatch workflowAssociationPatch = (WorkflowAssociationPatch) o; + return Objects.equals(this.associationName, workflowAssociationPatch.associationName) && + Objects.equals(this.operationName, workflowAssociationPatch.operationName) && + Objects.equals(this.workflowId, workflowAssociationPatch.workflowId) && + Objects.equals(this.associationCondition, workflowAssociationPatch.associationCondition) && + Objects.equals(this.associationStatus, workflowAssociationPatch.associationStatus); + } + + @Override + public int hashCode() { + return Objects.hash(associationName, operationName, workflowId, associationCondition, associationStatus); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class WorkflowAssociationPatch {\n"); + + sb.append(" associationName: ").append(toIndentedString(associationName)).append("\n"); + sb.append(" operationName: ").append(toIndentedString(operationName)).append("\n"); + sb.append(" workflowId: ").append(toIndentedString(workflowId)).append("\n"); + sb.append(" associationCondition: ").append(toIndentedString(associationCondition)).append("\n"); + sb.append(" associationStatus: ").append(toIndentedString(associationStatus)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + From 06ad4b7dae4d58de5a0d4b4c5f5d1a2e3c887110 Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Tue, 4 Mar 2025 18:35:55 +0530 Subject: [PATCH 14/47] Add null checks in a function --- .../engine/v1/core/WorkflowService.java | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkflowService.java b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkflowService.java index f85184cc58..cb4cc31799 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkflowService.java +++ b/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkflowService.java @@ -34,6 +34,7 @@ import org.wso2.carbon.identity.workflow.mgt.dao.WorkflowDAO; import org.wso2.carbon.identity.workflow.mgt.dto.Association; import org.wso2.carbon.identity.workflow.mgt.dto.Template; +import org.wso2.carbon.identity.workflow.mgt.dto.WorkflowEvent; import org.wso2.carbon.identity.workflow.mgt.exception.WorkflowClientException; import org.wso2.carbon.identity.workflow.mgt.exception.WorkflowException; import org.wso2.carbon.identity.workflow.mgt.exception.WorkflowRuntimeException; @@ -240,11 +241,8 @@ public WorkflowSummary addWorkflow(WorkflowCreation workflow, String id) { // WorkflowServiceDataHolder.getInstance().getWorkflowService() // .addWorkflow(workflowBean, parameterList, tenantId); - try { - workflowManagementService.addWorkflow(workflowBean, parameterList, tenantId); - } catch (NullPointerException e) { - throw new WorkflowException(e.getMessage()); - } + + workflowManagementService.addWorkflow(workflowBean, parameterList, tenantId); workflowSummary = getWorkflow(workflowBean); @@ -501,12 +499,24 @@ private String addAssociation(String associationName, String workflowId, String try { // WorkflowServiceDataHolder.getInstance().getWorkflowService() // .addAssociation(associationName, workflowId, eventId, condition); + Workflow workflowBean = workflowManagementService.getWorkflow(workflowId); + + WorkflowEvent event = workflowManagementService.getEvent(eventId); + + if (workflowBean == null) { + throw new WorkflowClientException("Invalid workflow ID provided."); + } + + if (event == null) { + throw new WorkflowClientException("Invalid event ID provided."); + } + workflowManagementService.addAssociation(associationName, workflowId, eventId, condition); return "Workflow Association successfully added!"; - } catch (WorkflowRuntimeException e) { - log.error("Error when adding association " + associationName, e); - return "Error when adding association" + associationName; + } catch (WorkflowClientException e) { + + throw handleClientError(e.getErrorCode(), e.getMessage(), "", e); } catch (WorkflowException e) { // log.error("Server error when adding association of workflow " + workflowId + " with " + eventId, e); // return "Server error when adding association of workflow" + workflowId + " with " + eventId; From c6e674c66d49638d3c6b53d8dc88442f921fa936 Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Wed, 5 Mar 2025 18:59:36 +0530 Subject: [PATCH 15/47] Change package name from workflow-engine to workflow --- .../pom.xml | 80 +++++++++---------- .../pom.xml | 8 +- pom.xml | 2 +- 3 files changed, 42 insertions(+), 48 deletions(-) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1 => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1}/pom.xml (70%) rename components/{org.wso2.carbon.identity.api.server.workflow.engine => org.wso2.carbon.identity.api.server.workflow}/pom.xml (88%) diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/pom.xml b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/pom.xml similarity index 70% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/pom.xml rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/pom.xml index 9d87c03652..66ba86c3d7 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/pom.xml @@ -19,13 +19,13 @@ <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"> <parent> <groupId>org.wso2.carbon.identity.server.api</groupId> - <artifactId>org.wso2.carbon.identity.api.server.workflow.engine</artifactId> + <artifactId>org.wso2.carbon.identity.api.server.workflow</artifactId> <relativePath>../pom.xml</relativePath> <version>1.3.84-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> - <artifactId>org.wso2.carbon.identity.rest.api.server.workflow.engine.v1</artifactId> + <artifactId>org.wso2.carbon.identity.rest.api.server.workflow.v1</artifactId> <build> <plugins> @@ -37,39 +37,39 @@ <target>1.8</target> </configuration> </plugin> - <plugin> - <groupId>org.openapitools</groupId> - <artifactId>openapi-generator-maven-plugin</artifactId> - <version>4.1.2</version> - <executions> - <execution> - <goals> - <goal>generate</goal> - </goals> - <configuration> - <inputSpec>${project.basedir}/src/main/resources/workflow-engine.yaml</inputSpec> - <generatorName>org.wso2.carbon.codegen.CxfWso2Generator</generatorName> - <configOptions> - <sourceFolder>src/gen/java</sourceFolder> - <apiPackage>org.wso2.carbon.identity.rest.api.server.workflow.engine.v1</apiPackage> - <modelPackage>org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model</modelPackage> - <packageName>org.wso2.carbon.identity.rest.api.server.workflow.engine.v1</packageName> - <dateLibrary>java8</dateLibrary> - <hideGenerationTimestamp>true</hideGenerationTimestamp> - </configOptions> - <output>.</output> - <skipOverwrite>false</skipOverwrite> - </configuration> - </execution> - </executions> - <dependencies> - <dependency> - <groupId>org.openapitools</groupId> - <artifactId>cxf-wso2-openapi-generator</artifactId> - <version>1.0.0</version> - </dependency> - </dependencies> - </plugin> +<!-- <plugin>--> +<!-- <groupId>org.openapitools</groupId>--> +<!-- <artifactId>openapi-generator-maven-plugin</artifactId>--> +<!-- <version>4.1.2</version>--> +<!-- <executions>--> +<!-- <execution>--> +<!-- <goals>--> +<!-- <goal>generate</goal>--> +<!-- </goals>--> +<!-- <configuration>--> +<!-- <inputSpec>${project.basedir}/src/main/resources/workflow-engine.yaml</inputSpec>--> +<!-- <generatorName>org.wso2.carbon.codegen.CxfWso2Generator</generatorName>--> +<!-- <configOptions>--> +<!-- <sourceFolder>src/gen/java</sourceFolder>--> +<!-- <apiPackage>org.wso2.carbon.identity.rest.api.server.workflow.engine.v1</apiPackage>--> +<!-- <modelPackage>org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model</modelPackage>--> +<!-- <packageName>org.wso2.carbon.identity.rest.api.server.workflow.engine.v1</packageName>--> +<!-- <dateLibrary>java8</dateLibrary>--> +<!-- <hideGenerationTimestamp>true</hideGenerationTimestamp>--> +<!-- </configOptions>--> +<!-- <output>.</output>--> +<!-- <skipOverwrite>false</skipOverwrite>--> +<!-- </configuration>--> +<!-- </execution>--> +<!-- </executions>--> +<!-- <dependencies>--> +<!-- <dependency>--> +<!-- <groupId>org.openapitools</groupId>--> +<!-- <artifactId>cxf-wso2-openapi-generator</artifactId>--> +<!-- <version>1.0.0</version>--> +<!-- </dependency>--> +<!-- </dependencies>--> +<!-- </plugin>--> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> @@ -163,13 +163,7 @@ <groupId>org.wso2.carbon.identity.server.api</groupId> <artifactId>org.wso2.carbon.identity.api.server.common</artifactId> <scope>provided</scope> - <version>1.2.131</version> </dependency> - <!--<dependency>--> - <!--<groupId>org.wso2.carbon.identity.framework</groupId>--> - <!--<artifactId>org.wso2.carbon.identity.base</artifactId>--> - <!--<scope>provided</scope>--> - <!--</dependency>--> - </dependencies> + </dependencies> -</project> \ No newline at end of file +</project> diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/pom.xml b/components/org.wso2.carbon.identity.api.server.workflow/pom.xml similarity index 88% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/pom.xml rename to components/org.wso2.carbon.identity.api.server.workflow/pom.xml index c86a7b62d4..aed8aca1f3 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.workflow/pom.xml @@ -25,16 +25,16 @@ </parent> <packaging>pom</packaging> <modules> - <module>org.wso2.carbon.identity.api.server.workflow.engine.common</module> - <module>org.wso2.carbon.identity.rest.api.server.workflow.engine.v1</module> + <module>org.wso2.carbon.identity.api.server.workflow.common</module> + <module>org.wso2.carbon.identity.rest.api.server.workflow.v1</module> </modules> <modelVersion>4.0.0</modelVersion> - <artifactId>org.wso2.carbon.identity.api.server.workflow.engine</artifactId> + <artifactId>org.wso2.carbon.identity.api.server.workflow</artifactId> <properties> <maven.compiler.source>11</maven.compiler.source> <maven.compiler.target>11</maven.compiler.target> </properties> -</project> \ No newline at end of file +</project> diff --git a/pom.xml b/pom.xml index ff5b79e5cc..3829e30646 100644 --- a/pom.xml +++ b/pom.xml @@ -948,7 +948,7 @@ <module>components/org.wso2.carbon.identity.api.server.action.management</module> <module>components/org.wso2.carbon.identity.api.server.notification.template</module> <module>components/org.wso2.carbon.identity.api.server.rule.metadata</module> - <module>components/org.wso2.carbon.identity.api.server.workflow.engine</module> + <module>components/org.wso2.carbon.identity.api.server.workflow</module> </modules> </project> From b87a9d5cabaaecf77e62042b7aa67e2c4678c903 Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Wed, 5 Mar 2025 19:01:23 +0530 Subject: [PATCH 16/47] Change package name and add maven plugin --- .../pom.xml | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.api.server.workflow.engine.common => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.api.server.workflow.common}/pom.xml (69%) diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.api.server.workflow.engine.common/pom.xml b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.api.server.workflow.common/pom.xml similarity index 69% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.api.server.workflow.engine.common/pom.xml rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.api.server.workflow.common/pom.xml index 41d57b8ddb..c80eafbcb9 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.api.server.workflow.engine.common/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.api.server.workflow.common/pom.xml @@ -24,22 +24,41 @@ <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.wso2.carbon.identity.server.api</groupId> - <artifactId>org.wso2.carbon.identity.api.server.workflow.engine</artifactId> + <artifactId>workflow</artifactId> <relativePath>../pom.xml</relativePath> <version>1.3.84-SNAPSHOT</version> </parent> - <artifactId>org.wso2.carbon.identity.api.server.workflow.engine.common</artifactId> + <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> <properties> <maven.compiler.source>21</maven.compiler.source> <maven.compiler.target>21</maven.compiler.target> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> + <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> </dependency> </dependencies> From 3c83660a3d7dbb770ed3662cba25c4dcff1c7d74 Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Wed, 5 Mar 2025 19:05:37 +0530 Subject: [PATCH 17/47] Resolve formatting issues and create a factory object --- .../workflow}/common/WorkflowServiceHolder.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.api.server.workflow.engine.common/src/main/java/org/wso2/carbon/identity/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.api.server.workflow.common/src/main/java/org/wso2/carbon/identity/api/server/workflow}/common/WorkflowServiceHolder.java (74%) diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.api.server.workflow.engine.common/src/main/java/org/wso2/carbon/identity/api/server/workflow/engine/common/WorkflowServiceHolder.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.api.server.workflow.common/src/main/java/org/wso2/carbon/identity/api/server/workflow/common/WorkflowServiceHolder.java similarity index 74% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.api.server.workflow.engine.common/src/main/java/org/wso2/carbon/identity/api/server/workflow/engine/common/WorkflowServiceHolder.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.api.server.workflow.common/src/main/java/org/wso2/carbon/identity/api/server/workflow/common/WorkflowServiceHolder.java index 43680c05a9..6fd23b0053 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.api.server.workflow.engine.common/src/main/java/org/wso2/carbon/identity/api/server/workflow/engine/common/WorkflowServiceHolder.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.api.server.workflow.common/src/main/java/org/wso2/carbon/identity/api/server/workflow/common/WorkflowServiceHolder.java @@ -16,18 +16,27 @@ * under the License. */ -package org.wso2.carbon.identity.api.server.workflow.engine.common; +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; public class WorkflowServiceHolder { + private final static WorkflowManagementService service = new WorkflowManagementServiceImpl(); + private final static WorkflowImplServiceImpl implService = new WorkflowImplServiceImpl(); + + public static WorkflowManagementService getWorkflowManagementService() { - public static WorkflowManagementService getWorkflowManagementService() - { return service; + } + public static WorkflowImplServiceImpl getWorkflowImplService() { + + return implService; + + } } From 4bd026d3b0cfe421149c80c0fddf4fafd4e4fd0f Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Wed, 5 Mar 2025 19:07:31 +0530 Subject: [PATCH 18/47] Resolve formatting issues --- .../WorkflowAssociationsApiServiceFactory.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow}/v1/factories/WorkflowAssociationsApiServiceFactory.java (74%) diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowAssociationsApiServiceFactory.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowAssociationsApiServiceFactory.java similarity index 74% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowAssociationsApiServiceFactory.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowAssociationsApiServiceFactory.java index 5f64a3f6ec..4aa54239a3 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowAssociationsApiServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowAssociationsApiServiceFactory.java @@ -16,17 +16,18 @@ * under the License. */ -package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.factories; +package org.wso2.carbon.identity.rest.api.server.workflow.v1.factories; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.WorkflowAssociationsApiService; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.impl.WorkflowAssociationsApiServiceImpl; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.WorkflowAssociationsApiService; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.impl.WorkflowAssociationsApiServiceImpl; public class WorkflowAssociationsApiServiceFactory { private final static WorkflowAssociationsApiService service = new WorkflowAssociationsApiServiceImpl(); - public static WorkflowAssociationsApiService getWorkflowAssociationsApi() - { + public static WorkflowAssociationsApiService getWorkflowAssociationsApi() { + return service; + } } From 6400666fda763bac8b85fc9fc6e9e43c9c9735ce Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Wed, 5 Mar 2025 19:09:20 +0530 Subject: [PATCH 19/47] Update exception handling and add a separate method for workflow update --- .../workflow}/v1/core/WorkflowService.java | 472 +++++++++--------- 1 file changed, 233 insertions(+), 239 deletions(-) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow}/v1/core/WorkflowService.java (54%) diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkflowService.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowService.java similarity index 54% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkflowService.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowService.java index cb4cc31799..c834b4c770 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkflowService.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowService.java @@ -16,30 +16,26 @@ * under the License. */ -package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.core; +package org.wso2.carbon.identity.rest.api.server.workflow.v1.core; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.CarbonContext; +import org.wso2.carbon.identity.api.server.workflow.common.Constants; import org.wso2.carbon.identity.api.server.common.error.APIError; import org.wso2.carbon.identity.api.server.common.error.ErrorResponse; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.*; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.*; import org.wso2.carbon.identity.workflow.mgt.WorkflowManagementAdminService; import org.wso2.carbon.identity.workflow.mgt.WorkflowManagementService; -import org.wso2.carbon.identity.workflow.mgt.WorkflowManagementServiceImpl; import org.wso2.carbon.identity.workflow.mgt.bean.Parameter; import org.wso2.carbon.identity.workflow.mgt.bean.Workflow; -import org.wso2.carbon.identity.workflow.mgt.dao.WorkflowDAO; import org.wso2.carbon.identity.workflow.mgt.dto.Association; import org.wso2.carbon.identity.workflow.mgt.dto.Template; import org.wso2.carbon.identity.workflow.mgt.dto.WorkflowEvent; import org.wso2.carbon.identity.workflow.mgt.exception.WorkflowClientException; import org.wso2.carbon.identity.workflow.mgt.exception.WorkflowException; -import org.wso2.carbon.identity.workflow.mgt.exception.WorkflowRuntimeException; -import org.wso2.carbon.identity.workflow.mgt.internal.WorkflowServiceDataHolder; -import org.wso2.carbon.identity.workflow.mgt.util.WFConstant; import javax.ws.rs.core.Response; import java.util.*; @@ -50,7 +46,7 @@ public class WorkflowService { private static final Log log = LogFactory.getLog(WorkflowManagementAdminService.class); private final WorkflowManagementService workflowManagementService; - public WorkflowService(WorkflowManagementService workflowManagementService){ + public WorkflowService(WorkflowManagementService workflowManagementService) { this.workflowManagementService = workflowManagementService; @@ -91,7 +87,8 @@ private WorkflowAssociation getAssociation(Association associationBean) { return association; } - private Parameter setWorkflowImplParameters(String workflowId, String paramName, String paramValue, String qName, String holder){ + private Parameter setWorkflowImplParameters(String workflowId, String paramName, String paramValue, String qName, + String holder) { Parameter parameter = new Parameter(); parameter.setWorkflowId(workflowId); @@ -102,98 +99,44 @@ private Parameter setWorkflowImplParameters(String workflowId, String paramName, return parameter; } + private Workflow createWorkflow(WorkflowCreation workflow, String workflowId) throws WorkflowException { + + Workflow workflowBean = new Workflow(); + + workflowBean.setWorkflowId(workflowId); + workflowBean.setWorkflowName(workflow.getWorkflowName()); + workflowBean.setWorkflowDescription(workflow.getWorkflowDescription()); + String templateId = workflow.getWorkflowTemplate().getName(); + + if (templateId == null) { + throw new WorkflowException("Template id can't be empty"); + } + workflowBean.setTemplateId(templateId); + + String workflowImplId = workflow.getWorkflowEngine(); + if (workflowImplId == null) { + throw new WorkflowException("Workflowimpl id can't be empty"); + } + workflowBean.setWorkflowImplId(workflowImplId); + + return workflowBean; + + } + /** * Add new workflow * - * Request Body: WorkflowCreation - * { - * "workflowName": "User Registration Workflow", - * "workflowDescription": "Workflow to approve new user registrations before account activation", - * "workflowTemplate": { - * "name": "MultiStepApproval", - * "steps": [ - * { - * "step": 1, - * "options": [ - * { - * "entity": "roles", - * "values": "Internal/admin" - * }, - * { - * "entity": "users", - * "values": "John" - * } - * - * ] - * }, - * { - * "step": 2, - * "options": [ - * { - * "entity": "roles", - * "values": "Manager" - * }, - * { - * "entity": "users", - * "values": "" - * } - * - * ] - * } - * ] - * }, - * "workflowEngine": "workflowImplSimple", - * "ApprovalTask": "User Registration Approval", - * "ApprovalTaskDescription": "Approval task to validate and approve new user registrations before account activation" - * } - * - * Response: WorkflowSummary - * { - * "id": "748159b8-67fe-4030-9348-bf322d32b267", - * "workflowName": "User Registration Workflow", - * "workflowDescription": "Workflow to approve new user registrations before account activation", - * "workflowTemplate": "MultiStepApprovalTemplate", - * "deployment": "workflowImplSimple" - * } - * - * @param workflow Workflow details - * @param id Workflow ID - * @throws WorkflowException + * @param workflow Workflow details + * @return WorkflowSummary */ - public WorkflowSummary addWorkflow(WorkflowCreation workflow, String id) { + public WorkflowSummary addWorkflow(WorkflowCreation workflow) { - int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); WorkflowSummary workflowSummary; - Workflow workflowBean = new Workflow(); + Workflow workflowBean; try { - if (StringUtils.isBlank(id)) { - id = UUID.randomUUID().toString(); - } else { - Workflow existingWorkflow = workflowManagementService.getWorkflow(id); - - if (existingWorkflow == null) { - throw new WorkflowClientException("Invalid workflow ID provided."); - } - } - workflowBean.setWorkflowId(id); - workflowBean.setWorkflowName(workflow.getWorkflowName()); - workflowBean.setWorkflowDescription(workflow.getWorkflowDescription()); -// String templateId = workflow.getTemplateId() == null ? workflow.getTemplate().getTemplateId() : -// workflow.getTemplateId(); - String templateId = workflow.getWorkflowTemplate().getName(); - if (templateId == null) { - throw new WorkflowException("template id can't be empty"); - } - workflowBean.setTemplateId(templateId); -// String workflowImplId = -// workflow.getWorkflowImplId() == null ? workflow.getWorkflowImpl().getWorkflowImplId() : -// workflow.getWorkflowImplId(); - String workflowImplId = workflow.getWorkflowEngine(); - if (workflowImplId == null) { - throw new WorkflowException("workflowimpl id can't be empty"); - } - workflowBean.setWorkflowImplId(workflowImplId); + String workflowId = UUID.randomUUID().toString(); + workflowBean = createWorkflow(workflow, workflowId); // Setting up the Template ParameterList @@ -203,58 +146,103 @@ public WorkflowSummary addWorkflow(WorkflowCreation workflow, String id) { for (WorkflowTemplateParameters properties : templateProperties) { for (OptionDetails options : properties.getOptions()) { - Parameter parameter = setWorkflowImplParameters(null, "UserAndRole", options.getValues(), "UserAndRole-step-" + properties.getSteps() + "-" + options.getEntity(), "Template"); + Parameter parameter = setWorkflowImplParameters(null, "UserAndRole", + options.getValues(), + "UserAndRole-step-" + properties.getSteps() + "-" + options.getEntity(), + "Template"); parameterList.add(parameter); } } // Setting up workflow impl parameter list - Parameter taskParameterDesc; - if (StringUtils.isBlank(id)) { - taskParameterDesc = setWorkflowImplParameters(null, "HTDescription", workflow.getApprovalTaskDescription(), "HTDescription", "Workflowimpl"); - } else { - taskParameterDesc = setWorkflowImplParameters(id, "HTDescription", workflow.getApprovalTaskDescription(), "HTDescription", "Workflowimpl"); - } + + Parameter taskParameterDesc = setWorkflowImplParameters(null, "HTDescription", + workflow.getApprovalTaskDescription(), "HTDescription", "Workflowimpl"); parameterList.add(taskParameterDesc); - Parameter taskParameterSubject; - if (StringUtils.isBlank(id)) { - taskParameterSubject = setWorkflowImplParameters(null, "HTSubject", workflow.getApprovalTask(), "HTSubject", "Workflowimpl"); - } else { - taskParameterSubject = setWorkflowImplParameters(id, "HTSubject", workflow.getApprovalTask(), "HTSubject", "Workflowimpl"); - } + Parameter taskParameterSubject = setWorkflowImplParameters(null, "HTSubject", + workflow.getApprovalTask(), "HTSubject", "Workflowimpl"); parameterList.add(taskParameterSubject); - Parameter workflowParameter = setWorkflowImplParameters(id, "WorkflowName", workflow.getWorkflowName(), "WorkflowName", "Workflowimpl"); + Parameter workflowParameter = setWorkflowImplParameters(workflowId, "WorkflowName", + workflow.getWorkflowName(), "WorkflowName", "Workflowimpl"); parameterList.add(workflowParameter); -// -// List<Parameter> parameterList = new ArrayList<>(); -// if (workflow.getTemplateParameters() != null) { -// parameterList.addAll(Arrays.asList(workflow.getTemplateParameters())); -// } -// if (workflow.getWorkflowImplParameters() != null) { -// parameterList.addAll(Arrays.asList(workflow.getWorkflowImplParameters())); -// } + workflowManagementService.addWorkflow(workflowBean, parameterList, + CarbonContext.getThreadLocalCarbonContext().getTenantId()); + workflowSummary = getWorkflow(workflowBean); + + } catch (WorkflowClientException e) { + throw handleClientError(Constants.ErrorMessage.ERROR_CODE_ERROR_ADDING_WORKFLOW, null, e); + } catch (WorkflowException e) { + throw handleServerError(Constants.ErrorMessage.ERROR_CODE_ERROR_ADDING_WORKFLOW, null, e); + } + return workflowSummary; + } -// WorkflowServiceDataHolder.getInstance().getWorkflowService() -// .addWorkflow(workflowBean, parameterList, tenantId); + /** + * Update an existing workflow + * + * @param workflow Workflow details + * @param workflowId Workflow ID + * @return WorkflowSummary + */ + public WorkflowSummary updateWorkflow(WorkflowCreation workflow, String workflowId) { + WorkflowSummary workflowSummary; + Workflow workflowBean; - workflowManagementService.addWorkflow(workflowBean, parameterList, tenantId); + try { - workflowSummary = getWorkflow(workflowBean); + Workflow existingWorkflow = workflowManagementService.getWorkflow(workflowId); - } catch (WorkflowClientException e){ + if (existingWorkflow == null) { + throw new WorkflowClientException("Workflow ID: " + workflowId + " does not exist"); + } - throw handleClientError(e.getErrorCode(),e.getMessage(), "", e); + workflowBean = createWorkflow(workflow, workflowId); - } catch (WorkflowException e) { + // Setting up the Template ParameterList -// throw new WorkflowException("Server error occured when adding the workflow"); - throw handleServerError(e.getErrorCode(),e.getMessage(), "", e); + List<WorkflowTemplateParameters> templateProperties = workflow.getWorkflowTemplate().getSteps(); + + List<Parameter> parameterList = new ArrayList<>(); + + for (WorkflowTemplateParameters properties : templateProperties) { + for (OptionDetails options : properties.getOptions()) { + Parameter parameter = setWorkflowImplParameters(workflowId, "UserAndRole", + options.getValues(), + "UserAndRole-step-" + properties.getSteps() + "-" + options.getEntity(), + "Template"); + parameterList.add(parameter); + } + + } + + // Setting up workflow impl parameter list + + Parameter taskParameterDesc = setWorkflowImplParameters(workflowId, "HTDescription", + workflow.getApprovalTaskDescription(), "HTDescription", "Workflowimpl"); + parameterList.add(taskParameterDesc); + Parameter taskParameterSubject = setWorkflowImplParameters(workflowId, "HTSubject", + workflow.getApprovalTask(), "HTSubject", "Workflowimpl"); + parameterList.add(taskParameterSubject); + + Parameter workflowParameter = setWorkflowImplParameters(workflowId, "WorkflowName", + workflow.getWorkflowName(), "WorkflowName", "Workflowimpl"); + parameterList.add(workflowParameter); + + workflowManagementService.addWorkflow(workflowBean, parameterList, + CarbonContext.getThreadLocalCarbonContext().getTenantId()); + + workflowSummary = getWorkflow(workflowBean); + + } catch (WorkflowClientException e) { + throw handleClientError(Constants.ErrorMessage.ERROR_CODE_ERROR_UPDATING_WORKFLOW, workflowId, e); + } catch (WorkflowException e) { + throw handleServerError(Constants.ErrorMessage.ERROR_CODE_ERROR_UPDATING_WORKFLOW, workflowId, e); } return workflowSummary; } @@ -263,36 +251,31 @@ public WorkflowSummary addWorkflow(WorkflowCreation workflow, String id) { /** * Retrieve workflow from workflow ID * - * @param workflowId workflow id - * @return - * @throws WorkflowException + * @param workflowId workflow id + * @return DetailedWorkflow */ public DetailedWorkflow getWorkflow(String workflowId) { try { -// Workflow workflowBean = -// WorkflowServiceDataHolder.getInstance().getWorkflowService().getWorkflow(workflowId); Workflow workflowBean = workflowManagementService.getWorkflow(workflowId); - if (workflowBean == null) { - throw new WorkflowClientException("Invalid workflow ID provided."); - } List<Parameter> workflowParameters = workflowManagementService.getWorkflowParameters(workflowId); - return getDetailedWorkflow(workflowBean, workflowParameters); - } catch (WorkflowClientException e){ - - throw handleClientError(e.getErrorCode(),e.getMessage(), "", e); + if (workflowBean == null || workflowParameters == null) { + throw handleException(Response.Status.NOT_FOUND, Constants.ErrorMessage.ERROR_CODE_WORKFLOW_NOT_FOUND, + workflowId); + } + return getDetailedWorkflow(workflowBean, workflowParameters); + } catch (WorkflowClientException e) { + throw handleClientError(Constants.ErrorMessage.ERROR_CODE_ERROR_RETRIEVING_WORKFLOW, workflowId, e); } catch (WorkflowException e) { - -// throw new WorkflowException("Server error occured when adding the workflow"); - throw handleServerError(e.getErrorCode(),e.getMessage(), "", e); - + throw handleServerError(Constants.ErrorMessage.ERROR_CODE_ERROR_RETRIEVING_WORKFLOW, workflowId, e); } } - private DetailedWorkflow getDetailedWorkflow(Workflow workflowBean, List<Parameter> workflowParameters) throws WorkflowException{ + private DetailedWorkflow getDetailedWorkflow(Workflow workflowBean, List<Parameter> workflowParameters) + throws WorkflowException { DetailedWorkflow detailedWorkflow = new DetailedWorkflow(); @@ -315,7 +298,8 @@ private DetailedWorkflow getDetailedWorkflow(Workflow workflowBean, List<Paramet int stepNumber = Integer.parseInt(params[2]); // Check if there's already a WorkflowTemplateParameters object for this step - WorkflowTemplateParameters templateParameters = templateParamsMap.getOrDefault(stepNumber, new WorkflowTemplateParameters()); + WorkflowTemplateParameters templateParameters = templateParamsMap.getOrDefault(stepNumber, + new WorkflowTemplateParameters()); templateParameters.setSteps(stepNumber); // Create and add new OptionDetails @@ -331,11 +315,11 @@ private DetailedWorkflow getDetailedWorkflow(Workflow workflowBean, List<Paramet // Update the map templateParamsMap.put(stepNumber, templateParameters); - } else if ("HTSubject".equals(parameter.getParamName())){ + } else if ("HTSubject".equals(parameter.getParamName())) { - if (parameter.getParamName().equals("HTSubject")){ + if (parameter.getParamName().equals("HTSubject")) { detailedWorkflow.setApprovalTask(parameter.getParamValue()); - } else if ("HTDescription".equals(parameter.getParamName())){ + } else if ("HTDescription".equals(parameter.getParamName())) { detailedWorkflow.setApprovalTaskDescription(parameter.getParamValue()); } } @@ -353,77 +337,67 @@ private DetailedWorkflow getDetailedWorkflow(Workflow workflowBean, List<Paramet /** * List paginated workflows of a tenant. * - * @param limit Limit + * @param limit Items per page * @param offset Offset - * @param filter filter - * @return WorkflowWizard[] - * @throws WorkflowException + * @param filter filter string + * @return WorkflowSummary[] */ public WorkflowSummary[] listPaginatedWorkflows(Integer limit, Integer offset, String filter) { List<WorkflowSummary> workflowSummaryList = new ArrayList<>(); - List<Workflow> workflowBeans = null; + List<Workflow> workflowBeans; int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); try { - if (limit == null || offset == null){ + if (limit == null || offset == null) { limit = 15; offset = 0; } else { limit = limit.intValue(); offset = offset.intValue(); } - //workflowBeans = WorkflowServiceDataHolder.getInstance().getWorkflowService().listPaginatedWorkflows(tenantId, limit, offset, filter); workflowBeans = workflowManagementService.listPaginatedWorkflows(tenantId, limit, offset, filter); for (Workflow workflow : workflowBeans) { WorkflowSummary workflowTmp = getWorkflow(workflow); workflowSummaryList.add(workflowTmp); } return workflowSummaryList.toArray(new WorkflowSummary[workflowSummaryList.size()]); - + } catch (WorkflowClientException e) { + throw handleClientError(Constants.ErrorMessage.ERROR_CODE_ERROR_LISTING_WORKFLOWS, null, e); } catch (WorkflowException e) { - throw handleServerError(e.getErrorCode(),e.getMessage(), "", e); + throw handleServerError(Constants.ErrorMessage.ERROR_CODE_ERROR_LISTING_WORKFLOWS, null, e); } } /** - * Remove a workflow + * Remove a workflow by a given workflow ID * - * @param id ID of workflow to remove - * @return - * @throws WorkflowException + * @param workflowId ID of workflow to remove + * @return Return Success Message */ - public WorkflowSummary removeWorkflow(String id) { + public String removeWorkflow(String workflowId) { try { - //WorkflowServiceDataHolder.getInstance().getWorkflowService().removeWorkflow(id); - WorkflowSummary workflow = getWorkflow(workflowManagementService.getWorkflow(id)); - if (workflow == null) { - throw new WorkflowClientException("Invalid Workflow ID provided."); - } - workflowManagementService.removeWorkflow(id); + workflowManagementService.removeWorkflow(workflowId); - return workflow; + return "Workflow successfully removed!"; } catch (WorkflowClientException e) { - //throw new WorkflowException("Server error occurred when removing workflow"); - throw handleClientError(e.getErrorCode(),e.getMessage(), "", e); + throw handleClientError(Constants.ErrorMessage.ERROR_CODE_ERROR_REMOVING_WORKFLOW, workflowId, e); } catch (WorkflowException e) { - - throw handleServerError(e.getErrorCode(),e.getMessage(), "", e); + throw handleServerError(Constants.ErrorMessage.ERROR_CODE_ERROR_REMOVING_WORKFLOW, workflowId, e); } } /** * List paginated associations of a tenant. * - * @param limit Limit + * @param limit Items per page * @param offset Offset * @param filter Filter - * @return Association[] - * @throws WorkflowException + * @return WorkflowAssociation[] */ public WorkflowAssociation[] listPaginatedAssociations(Integer limit, Integer offset, String filter) { @@ -431,27 +405,24 @@ public WorkflowAssociation[] listPaginatedAssociations(Integer limit, Integer of List<Association> associationBeans = null; try { - - if (limit == null || offset == null){ + if (limit == null || offset == null) { limit = 15; offset = 0; } else { limit = limit.intValue(); offset = offset.intValue(); } - int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); -// associationBeans = WorkflowServiceDataHolder.getInstance().getWorkflowService().listPaginatedAssociations(tenantId, limit, offset, filter); - associationBeans = workflowManagementService.listPaginatedAssociations(tenantId, limit, offset, filter); - for (Association associationBean: associationBeans){ + associationBeans = workflowManagementService.listPaginatedAssociations(CarbonContext.getThreadLocalCarbonContext().getTenantId(), + limit, offset, filter); + for (Association associationBean : associationBeans) { WorkflowAssociation associationTmp = getAssociation(associationBean); associations.add(associationTmp); } - } catch (WorkflowException e) { -// throw new WorkflowException(WFConstant.Exceptions.ERROR_LISTING_ASSOCIATIONS, e); - log.error("Error occurred when retrieving all the available workflow associations", e); - throw handleServerError(e.getErrorCode(), e.getMessage(), "", e); - + } catch (WorkflowClientException e) { + throw handleClientError(Constants.ErrorMessage.ERROR_CODE_ERROR_LISTING_ASSOCIATIONS, null, e); + } catch (WorkflowException e) { + throw handleServerError(Constants.ErrorMessage.ERROR_CODE_ERROR_LISTING_ASSOCIATIONS, null, e); } if (CollectionUtils.isEmpty(associations)) { return new WorkflowAssociation[0]; @@ -462,45 +433,38 @@ public WorkflowAssociation[] listPaginatedAssociations(Integer limit, Integer of /** * Remove association * - * @param associationId ID of association to remove - * @throws WorkflowException + * @param associationId ID of association to remove + * @return Success message */ public String removeAssociation(String associationId) { try { -// WorkflowServiceDataHolder.getInstance().getWorkflowService() -// .removeAssociation(Integer.parseInt(associationId)); - Association association = workflowManagementService.getAssociation(associationId); if (association == null) { - throw new WorkflowClientException("Invalid Association ID provided."); + throw new WorkflowClientException("Invalid Association ID provided"); } workflowManagementService.removeAssociation(Integer.parseInt(associationId)); return "Workflow association successfully removed!"; - } catch (WorkflowClientException e){ - throw handleClientError(e.getErrorCode(),e.getMessage(), "", e); - }catch (WorkflowException e) { -// log.error("Server error when removing association " + associationId, e); - throw handleServerError(e.getErrorCode(), e.getMessage(), "", e); + } catch (WorkflowClientException e) { + throw handleClientError(Constants.ErrorMessage.ERROR_CODE_ERROR_REMOVING_ASSOCIATION, associationId, e); + } catch (WorkflowException e) { + throw handleServerError(Constants.ErrorMessage.ERROR_CODE_ERROR_REMOVING_ASSOCIATION, associationId, e); } } /** * Add new workflow association * - * @param associationName Name for the association - * @param workflowId Workflow to associate - * @param eventId Event to associate - * @param condition Condition to check the event for associating - * @throws WorkflowException + * @param associationName Name for the association + * @param workflowId Workflow to associate + * @param eventId Event to associate + * @param condition Condition to check the event for associating + * @return Return success message */ private String addAssociation(String associationName, String workflowId, String eventId, String condition) { try { -// WorkflowServiceDataHolder.getInstance().getWorkflowService() -// .addAssociation(associationName, workflowId, eventId, condition); Workflow workflowBean = workflowManagementService.getWorkflow(workflowId); - WorkflowEvent event = workflowManagementService.getEvent(eventId); if (workflowBean == null) { @@ -515,24 +479,23 @@ private String addAssociation(String associationName, String workflowId, String return "Workflow Association successfully added!"; } catch (WorkflowClientException e) { - - throw handleClientError(e.getErrorCode(), e.getMessage(), "", e); + throw handleClientError(Constants.ErrorMessage.ERROR_CODE_ERROR_ADDING_ASSOCIATION, null, e); } catch (WorkflowException e) { -// log.error("Server error when adding association of workflow " + workflowId + " with " + eventId, e); -// return "Server error when adding association of workflow" + workflowId + " with " + eventId; - throw handleServerError(e.getErrorCode(), e.getMessage(), "", e); + throw handleServerError(Constants.ErrorMessage.ERROR_CODE_ERROR_ADDING_ASSOCIATION, null, e); } } - public String addAssociation(WorkflowAssociationCreation workflowAssociation){ + public String addAssociation(WorkflowAssociationCreation workflowAssociation) { - return addAssociation(workflowAssociation.getAssociationName(), workflowAssociation.getWorkflowId(), workflowAssociation.getOperationName(), workflowAssociation.getAssociationCondition()); + return addAssociation(workflowAssociation.getAssociationName(), workflowAssociation.getWorkflowId(), + workflowAssociation.getOperationName(), workflowAssociation.getAssociationCondition()); } /** * Get an association by ID - * @param associationId Association ID - * @throws WorkflowException + * + * @param associationId Association ID + * @return WorkflowAssociation */ public WorkflowAssociation getAssociation(String associationId) { @@ -540,24 +503,24 @@ public WorkflowAssociation getAssociation(String associationId) { try { Association association = workflowManagementService.getAssociation(associationId); if (association == null) { - throw new WorkflowClientException("Invalid workflow association ID provided."); + throw handleException(Response.Status.NOT_FOUND, + Constants.ErrorMessage.ERROR_CODE_ASSOCIATION_NOT_FOUND, + associationId); } return getAssociation(association); } catch (WorkflowClientException e) { - throw handleClientError(e.getErrorCode(), e.getMessage(), "", e); + throw handleClientError(Constants.ErrorMessage.ERROR_CODE_ERROR_RETRIEVING_ASSOCIATION, associationId, e); } catch (WorkflowException e) { - throw handleServerError(e.getErrorCode(), e.getMessage(), "", e); + throw handleServerError(Constants.ErrorMessage.ERROR_CODE_ERROR_RETRIEVING_ASSOCIATION, associationId, e); } } - private boolean getAssociationState(String associationId, Status status){ + private boolean getAssociationState(String associationId, Status status) { boolean isEnable; try { - if (status == null) { - isEnable = workflowManagementService.getAssociation(associationId).isEnabled(); } else { isEnable = (status.getAction() == ActionStatus.ENABLE); @@ -565,35 +528,39 @@ private boolean getAssociationState(String associationId, Status status){ return isEnable; } catch (WorkflowException e) { - throw handleServerError(e.getErrorCode(),e.getMessage(), "", e); + throw handleServerError(Constants.ErrorMessage.ERROR_CODE_ERROR_RETRIEVING_ASSOCIATION, associationId, e); } } /** * Partially update an association * - * @param associationId Association ID - * @param workflowAssociation Association Details - * @throws WorkflowException + * @param associationId Association ID + * @param workflowAssociation Association Details + * @return Success message */ - public String changeAssociation(String associationId, WorkflowAssociationPatch workflowAssociation){ + public String changeAssociation(String associationId, WorkflowAssociationPatch workflowAssociation) { try { - Association association = workflowManagementService.getAssociation(associationId); - if (association == null ) { - throw new WorkflowClientException("Invalid workflow association ID provided."); - } boolean isEnable = getAssociationState(associationId, workflowAssociation.getAssociationStatus()); - workflowManagementService.changeAssociation(associationId, workflowAssociation.getAssociationName(), workflowAssociation.getWorkflowId(), workflowAssociation.getOperationName(), workflowAssociation.getAssociationCondition(), isEnable); + workflowManagementService.changeAssociation(associationId, workflowAssociation.getAssociationName(), + workflowAssociation.getWorkflowId(), workflowAssociation.getOperationName(), + workflowAssociation.getAssociationCondition(), isEnable); return "Workflow association successfully updated!"; - } catch (WorkflowClientException e) { - throw handleClientError(e.getErrorCode(), e.getMessage(), "", e); + } catch (WorkflowClientException e) { + throw handleClientError(Constants.ErrorMessage.ERROR_CODE_ERROR_UPDATING_ASSOCIATION, associationId, e); } catch (WorkflowException e) { - throw handleServerError(e.getErrorCode(), e.getMessage(), "", e); + throw handleServerError(Constants.ErrorMessage.ERROR_CODE_ERROR_UPDATING_ASSOCIATION, associationId, e); } } + private ErrorResponse.Builder getErrorBuilder(Constants.ErrorMessage errorMsg, String data) { + + return new ErrorResponse.Builder().withCode(errorMsg.getCode()).withMessage(errorMsg.getMessage()) + .withDescription(includeData(errorMsg, data)); + } + private ErrorResponse.Builder getErrorBuilder(String errorCode, String errorMsg, String data) { return new ErrorResponse.Builder().withCode(errorCode).withMessage(errorMsg) @@ -609,23 +576,50 @@ private static String includeData(String errorMsg, String data) { return message; } - private APIError handleServerError(String errorCode, String errorMsg, String data, Exception e) { + private static String includeData(Constants.ErrorMessage error, String data) { + + String message; + if (StringUtils.isNotBlank(data)) { + message = String.format(error.getDescription(), data); + } else { + message = String.format(error.getDescription(), ""); + } + return message; + } + + /** + * Handle exceptions generated in API. + * + * @param status HTTP Status. + * @param error Error Message information. + * @return APIError. + */ + private APIError handleException(Response.Status status, Constants.ErrorMessage error, String data) { + + return new APIError(status, getErrorBuilder(error, data).build()); + } + + private APIError handleServerError(Constants.ErrorMessage errorEnum, String data, Exception e) { - ErrorResponse errorResponse = getErrorBuilder(errorCode, errorMsg, data).build(log, - e, includeData(errorMsg, data)); + ErrorResponse errorResponse = getErrorBuilder(errorEnum, data).build(log, e, includeData(e.getMessage(), data)); return new APIError(Response.Status.INTERNAL_SERVER_ERROR, errorResponse); } - private APIError handleClientError(String errorCode, String errorMsg, String data, WorkflowClientException e) { + private APIError handleClientError(Constants.ErrorMessage errorEnum, String data, WorkflowClientException e) { - ErrorResponse errorResponse = getErrorBuilder(errorCode, errorMsg, data).build(log, - e, includeData(errorMsg, data)); + ErrorResponse errorResponse; + + if (e.getMessage() != null) { + String errorMessage = e.getMessage(); + errorResponse = getErrorBuilder(errorEnum, data).build(log, e.getMessage()); + errorResponse.setMessage(errorMessage); + } else { + errorResponse = getErrorBuilder(errorEnum, data).build(log, e, includeData(e.getMessage(), data)); + } return new APIError(Response.Status.BAD_REQUEST, errorResponse); } - } - From 2034cc82aec5c660a6c2b76697c205dcc350b575 Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Wed, 5 Mar 2025 19:14:25 +0530 Subject: [PATCH 20/47] Change package name --- .../workflow}/v1/WorkflowAssociationsApi.java | 15 ++++++------ .../v1/WorkflowAssociationsApiService.java | 6 ++--- .../workflow}/v1/WorkflowEnginesApi.java | 8 +++---- .../v1/WorkflowEnginesApiService.java | 2 +- .../api/server/workflow}/v1/WorkflowsApi.java | 15 ++++++------ .../workflow}/v1/WorkflowsApiService.java | 4 ++-- .../api/server/workflow}/v1/dto/ErrorDTO.java | 2 +- .../workflow}/v1/dto/WorkFlowEngineDTO.java | 2 +- .../WorkflowEnginesApiServiceFactory.java | 11 +++++---- .../factories/WorkflowsApiServiceFactory.java | 11 +++++---- .../workflow}/v1/model/ActionStatus.java | 5 +--- .../workflow}/v1/model/DetailedWorkflow.java | 8 +------ .../v1/model/DetailedWorkflowTemplate.java | 7 +----- .../api/server/workflow}/v1/model/Error.java | 6 +---- .../workflow}/v1/model/OptionDetails.java | 6 +---- .../api/server/workflow}/v1/model/Status.java | 8 +------ .../v1/model/WorkflowAssociation.java | 7 +----- .../v1/model/WorkflowAssociationCreation.java | 6 +---- .../v1/model/WorkflowAssociationPatch.java | 8 +------ .../workflow}/v1/model/WorkflowCreation.java | 8 ++----- .../workflow}/v1/model/WorkflowEngine.java | 6 +---- .../workflow}/v1/model/WorkflowSummary.java | 7 +----- .../workflow}/v1/model/WorkflowTemplate.java | 7 +----- .../v1/model/WorkflowTemplateParameters.java | 23 ++++++++----------- .../v1/core/WorkFLowEngineService.java | 17 ++++++++++---- .../v1/core/WorkflowEngineConstants.java | 2 +- .../core/function/BPSProfilesToExternal.java | 4 ++-- .../v1/factories/WorkflowServiceFactory.java | 9 ++------ .../WorkflowAssociationsApiServiceImpl.java | 15 +++++++----- .../impl/WorkflowEnginesApiServiceImpl.java | 5 ++-- .../v1/impl/WorkflowsApiServiceImpl.java | 17 +++++++------- 31 files changed, 102 insertions(+), 155 deletions(-) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow}/v1/WorkflowAssociationsApi.java (93%) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow}/v1/WorkflowAssociationsApiService.java (81%) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow}/v1/WorkflowEnginesApi.java (86%) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow}/v1/WorkflowEnginesApiService.java (91%) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow}/v1/WorkflowsApi.java (93%) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow}/v1/WorkflowsApiService.java (87%) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow}/v1/dto/ErrorDTO.java (96%) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow}/v1/dto/WorkFlowEngineDTO.java (97%) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow}/v1/factories/WorkflowEnginesApiServiceFactory.java (75%) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow}/v1/factories/WorkflowsApiServiceFactory.java (71%) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow}/v1/model/ActionStatus.java (91%) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow}/v1/model/DetailedWorkflow.java (94%) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow}/v1/model/DetailedWorkflowTemplate.java (92%) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow}/v1/model/Error.java (94%) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow}/v1/model/OptionDetails.java (92%) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow}/v1/model/Status.java (85%) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow}/v1/model/WorkflowAssociation.java (95%) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow}/v1/model/WorkflowAssociationCreation.java (96%) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow}/v1/model/WorkflowAssociationPatch.java (94%) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow}/v1/model/WorkflowCreation.java (95%) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow}/v1/model/WorkflowEngine.java (95%) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow}/v1/model/WorkflowSummary.java (95%) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow}/v1/model/WorkflowTemplate.java (90%) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow}/v1/model/WorkflowTemplateParameters.java (81%) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow}/v1/core/WorkFLowEngineService.java (78%) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow}/v1/core/WorkflowEngineConstants.java (96%) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow}/v1/core/function/BPSProfilesToExternal.java (88%) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow}/v1/factories/WorkflowServiceFactory.java (80%) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow}/v1/impl/WorkflowAssociationsApiServiceImpl.java (77%) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow}/v1/impl/WorkflowEnginesApiServiceImpl.java (80%) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow}/v1/impl/WorkflowsApiServiceImpl.java (74%) diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowAssociationsApi.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowAssociationsApi.java similarity index 93% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowAssociationsApi.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowAssociationsApi.java index bf00082b38..bedd8cfedb 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowAssociationsApi.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowAssociationsApi.java @@ -16,13 +16,13 @@ * under the License. */ -package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1; +package org.wso2.carbon.identity.rest.api.server.workflow.v1; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.factories.WorkflowAssociationsApiServiceFactory; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.Error; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowAssociation; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowAssociationCreation; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowAssociationPatch; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.factories.WorkflowAssociationsApiServiceFactory; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.Error; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowAssociation; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowAssociationCreation; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowAssociationPatch; import javax.validation.Valid; import javax.ws.rs.*; @@ -38,7 +38,8 @@ public class WorkflowAssociationsApi { private final WorkflowAssociationsApiService delegate; - public WorkflowAssociationsApi(){ + public WorkflowAssociationsApi() { + this.delegate = WorkflowAssociationsApiServiceFactory.getWorkflowAssociationsApi(); } diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowAssociationsApiService.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowAssociationsApiService.java similarity index 81% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowAssociationsApiService.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowAssociationsApiService.java index 4070ae3f05..b1124eb069 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowAssociationsApiService.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowAssociationsApiService.java @@ -16,10 +16,10 @@ * under the License. */ -package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1; +package org.wso2.carbon.identity.rest.api.server.workflow.v1; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowAssociationCreation; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowAssociationPatch; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowAssociationCreation; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowAssociationPatch; import javax.ws.rs.core.Response; diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowEnginesApi.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowEnginesApi.java similarity index 86% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowEnginesApi.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowEnginesApi.java index 358ec81ed2..aa866e2b0e 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowEnginesApi.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowEnginesApi.java @@ -16,11 +16,11 @@ * under the License. */ -package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1; +package org.wso2.carbon.identity.rest.api.server.workflow.v1; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.factories.WorkflowEnginesApiServiceFactory; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.Error; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowEngine; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.factories.WorkflowEnginesApiServiceFactory; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.Error; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowEngine; import javax.validation.Valid; import javax.ws.rs.*; diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowEnginesApiService.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowEnginesApiService.java similarity index 91% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowEnginesApiService.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowEnginesApiService.java index 957723a474..f741c9a42d 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowEnginesApiService.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowEnginesApiService.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1; +package org.wso2.carbon.identity.rest.api.server.workflow.v1; import javax.ws.rs.core.Response; diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowsApi.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowsApi.java similarity index 93% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowsApi.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowsApi.java index 1d31fdaa7a..23b39cfd7c 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowsApi.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowsApi.java @@ -16,13 +16,13 @@ * under the License. */ -package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1; +package org.wso2.carbon.identity.rest.api.server.workflow.v1; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.factories.WorkflowsApiServiceFactory; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.DetailedWorkflow; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.Error; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowCreation; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowSummary; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.factories.WorkflowsApiServiceFactory; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.DetailedWorkflow; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.Error; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowCreation; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowSummary; import javax.validation.Valid; import javax.ws.rs.*; @@ -38,7 +38,8 @@ public class WorkflowsApi { private final WorkflowsApiService delegate; - public WorkflowsApi(){ + public WorkflowsApi() { + this.delegate = WorkflowsApiServiceFactory.getWorkflowsApi(); } diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowsApiService.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowsApiService.java similarity index 87% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowsApiService.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowsApiService.java index d9024057ac..5af23dccf6 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/WorkflowsApiService.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowsApiService.java @@ -16,9 +16,9 @@ * under the License. */ -package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1; +package org.wso2.carbon.identity.rest.api.server.workflow.v1; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowCreation; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowCreation; import javax.ws.rs.core.Response; diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/dto/ErrorDTO.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/dto/ErrorDTO.java similarity index 96% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/dto/ErrorDTO.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/dto/ErrorDTO.java index 45a472b905..72e7cbc88d 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/dto/ErrorDTO.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/dto/ErrorDTO.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.dto; +package org.wso2.carbon.identity.rest.api.server.workflow.v1.dto; import io.swagger.annotations.*; diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/dto/WorkFlowEngineDTO.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/dto/WorkFlowEngineDTO.java similarity index 97% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/dto/WorkFlowEngineDTO.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/dto/WorkFlowEngineDTO.java index 2f472dcd01..d32773490c 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/dto/WorkFlowEngineDTO.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/dto/WorkFlowEngineDTO.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.dto; +package org.wso2.carbon.identity.rest.api.server.workflow.v1.dto; import io.swagger.annotations.*; diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowEnginesApiServiceFactory.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowEnginesApiServiceFactory.java similarity index 75% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowEnginesApiServiceFactory.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowEnginesApiServiceFactory.java index f850d18955..757ddf8048 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowEnginesApiServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowEnginesApiServiceFactory.java @@ -16,17 +16,18 @@ * under the License. */ -package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.factories; +package org.wso2.carbon.identity.rest.api.server.workflow.v1.factories; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.WorkflowEnginesApiService; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.impl.WorkflowEnginesApiServiceImpl; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.WorkflowEnginesApiService; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.impl.WorkflowEnginesApiServiceImpl; public class WorkflowEnginesApiServiceFactory { private final static WorkflowEnginesApiService service = new WorkflowEnginesApiServiceImpl(); - public static WorkflowEnginesApiService getWorkflowEnginesApi() - { + public static WorkflowEnginesApiService getWorkflowEnginesApi() { + return service; + } } diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowsApiServiceFactory.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowsApiServiceFactory.java similarity index 71% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowsApiServiceFactory.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowsApiServiceFactory.java index 0974d8df89..f0b792ef5c 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowsApiServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowsApiServiceFactory.java @@ -16,17 +16,18 @@ * under the License. */ -package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.factories; +package org.wso2.carbon.identity.rest.api.server.workflow.v1.factories; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.WorkflowsApiService; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.impl.WorkflowsApiServiceImpl; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.WorkflowsApiService; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.impl.WorkflowsApiServiceImpl; public class WorkflowsApiServiceFactory { private final static WorkflowsApiService service = new WorkflowsApiServiceImpl(); - public static WorkflowsApiService getWorkflowsApi() - { + public static WorkflowsApiService getWorkflowsApi() { + return service; + } } diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/ActionStatus.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/ActionStatus.java similarity index 91% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/ActionStatus.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/ActionStatus.java index 2b6bfb5c8a..d17c8bf879 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/ActionStatus.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/ActionStatus.java @@ -16,10 +16,7 @@ * under the License. */ -package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model; - -import io.swagger.annotations.ApiModel; -import javax.validation.constraints.*; +package org.wso2.carbon.identity.rest.api.server.workflow.v1.model; /** * Indicates whether to enable or disable the workflow association diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/DetailedWorkflow.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/DetailedWorkflow.java similarity index 94% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/DetailedWorkflow.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/DetailedWorkflow.java index 54dfe5852b..f6396a6a1c 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/DetailedWorkflow.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/DetailedWorkflow.java @@ -16,20 +16,14 @@ * under the License. */ -package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model; +package org.wso2.carbon.identity.rest.api.server.workflow.v1.model; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.DetailedWorkflowTemplate; -import javax.validation.constraints.*; -import io.swagger.annotations.*; import java.util.Objects; import javax.validation.Valid; -import javax.xml.bind.annotation.*; public class DetailedWorkflow { diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/DetailedWorkflowTemplate.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/DetailedWorkflowTemplate.java similarity index 92% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/DetailedWorkflowTemplate.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/DetailedWorkflowTemplate.java index 10127856d0..8215dfd641 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/DetailedWorkflowTemplate.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/DetailedWorkflowTemplate.java @@ -16,22 +16,17 @@ * under the License. */ -package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model; +package org.wso2.carbon.identity.rest.api.server.workflow.v1.model; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowTemplateParameters; import javax.validation.constraints.*; -import io.swagger.annotations.*; import java.util.Objects; import javax.validation.Valid; -import javax.xml.bind.annotation.*; public class DetailedWorkflowTemplate { diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/Error.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/Error.java similarity index 94% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/Error.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/Error.java index 614a4f3d20..df7c6f72dd 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/Error.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/Error.java @@ -16,19 +16,15 @@ * under the License. */ -package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model; +package org.wso2.carbon.identity.rest.api.server.workflow.v1.model; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; -import io.swagger.annotations.*; import java.util.Objects; import javax.validation.Valid; -import javax.xml.bind.annotation.*; public class Error { diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/OptionDetails.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/OptionDetails.java similarity index 92% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/OptionDetails.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/OptionDetails.java index ab7ee42d73..778e83e197 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/OptionDetails.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/OptionDetails.java @@ -16,19 +16,15 @@ * under the License. */ -package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model; +package org.wso2.carbon.identity.rest.api.server.workflow.v1.model; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; -import io.swagger.annotations.*; import java.util.Objects; import javax.validation.Valid; -import javax.xml.bind.annotation.*; public class OptionDetails { diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/Status.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/Status.java similarity index 85% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/Status.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/Status.java index 45cc023776..27c00b3387 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/Status.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/Status.java @@ -16,20 +16,14 @@ * under the License. */ -package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model; +package org.wso2.carbon.identity.rest.api.server.workflow.v1.model; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.ActionStatus; -import javax.validation.constraints.*; -import io.swagger.annotations.*; import java.util.Objects; import javax.validation.Valid; -import javax.xml.bind.annotation.*; public class Status { diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociation.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociation.java similarity index 95% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociation.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociation.java index bac6c7719c..3adc5c5f1b 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociation.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociation.java @@ -16,19 +16,14 @@ * under the License. */ -package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model; +package org.wso2.carbon.identity.rest.api.server.workflow.v1.model; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import javax.validation.constraints.*; -import io.swagger.annotations.*; import java.util.Objects; import javax.validation.Valid; -import javax.xml.bind.annotation.*; public class WorkflowAssociation { diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociationCreation.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociationCreation.java similarity index 96% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociationCreation.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociationCreation.java index 3cec767cd2..1fbcec088d 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociationCreation.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociationCreation.java @@ -16,19 +16,15 @@ * under the License. */ -package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model; +package org.wso2.carbon.identity.rest.api.server.workflow.v1.model; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; -import io.swagger.annotations.*; import java.util.Objects; import javax.validation.Valid; -import javax.xml.bind.annotation.*; public class WorkflowAssociationCreation { diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociationPatch.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociationPatch.java similarity index 94% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociationPatch.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociationPatch.java index 589f2a5901..9fb9498613 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowAssociationPatch.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociationPatch.java @@ -16,20 +16,14 @@ * under the License. */ -package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model; +package org.wso2.carbon.identity.rest.api.server.workflow.v1.model; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.Status; -import javax.validation.constraints.*; -import io.swagger.annotations.*; import java.util.Objects; import javax.validation.Valid; -import javax.xml.bind.annotation.*; public class WorkflowAssociationPatch { diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowCreation.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowCreation.java similarity index 95% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowCreation.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowCreation.java index 83332589e5..917db953bc 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowCreation.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowCreation.java @@ -16,20 +16,16 @@ * under the License. */ -package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model; +package org.wso2.carbon.identity.rest.api.server.workflow.v1.model; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowTemplate; + import javax.validation.constraints.*; -import io.swagger.annotations.*; import java.util.Objects; import javax.validation.Valid; -import javax.xml.bind.annotation.*; public class WorkflowCreation { diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowEngine.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowEngine.java similarity index 95% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowEngine.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowEngine.java index ef4f96ce4f..4af7eb1789 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowEngine.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowEngine.java @@ -16,19 +16,15 @@ * under the License. */ -package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model; +package org.wso2.carbon.identity.rest.api.server.workflow.v1.model; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; -import io.swagger.annotations.*; import java.util.Objects; import javax.validation.Valid; -import javax.xml.bind.annotation.*; public class WorkflowEngine { diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowSummary.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowSummary.java similarity index 95% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowSummary.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowSummary.java index 9bc0658cd7..adf5d569cb 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowSummary.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowSummary.java @@ -16,19 +16,14 @@ * under the License. */ -package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model; +package org.wso2.carbon.identity.rest.api.server.workflow.v1.model; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import javax.validation.constraints.*; -import io.swagger.annotations.*; import java.util.Objects; import javax.validation.Valid; -import javax.xml.bind.annotation.*; public class WorkflowSummary { diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowTemplate.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowTemplate.java similarity index 90% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowTemplate.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowTemplate.java index 42441bc3a4..3e283c5d29 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowTemplate.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowTemplate.java @@ -16,22 +16,17 @@ * under the License. */ -package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model; +package org.wso2.carbon.identity.rest.api.server.workflow.v1.model; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.WorkflowTemplateParameters; import javax.validation.constraints.*; -import io.swagger.annotations.*; import java.util.Objects; import javax.validation.Valid; -import javax.xml.bind.annotation.*; public class WorkflowTemplate { diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowTemplateParameters.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowTemplateParameters.java similarity index 81% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowTemplateParameters.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowTemplateParameters.java index c9affabcff..2e362ff0c0 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/model/WorkflowTemplateParameters.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowTemplateParameters.java @@ -16,34 +16,29 @@ * under the License. */ -package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model; +package org.wso2.carbon.identity.rest.api.server.workflow.v1.model; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.OptionDetails; import javax.validation.constraints.*; -import io.swagger.annotations.*; import java.util.Objects; import javax.validation.Valid; -import javax.xml.bind.annotation.*; public class WorkflowTemplateParameters { - private Integer steps; + private Integer step; private List<OptionDetails> options = null; /** **/ - public WorkflowTemplateParameters steps(Integer steps) { + public WorkflowTemplateParameters step(Integer step) { - this.steps = steps; + this.step = step; return this; } @@ -53,10 +48,10 @@ public WorkflowTemplateParameters steps(Integer steps) { @NotNull(message = "Property steps cannot be null.") public Integer getSteps() { - return steps; + return step; } public void setSteps(Integer steps) { - this.steps = steps; + this.step = step; } /** @@ -97,13 +92,13 @@ public boolean equals(java.lang.Object o) { return false; } WorkflowTemplateParameters workflowTemplateParameters = (WorkflowTemplateParameters) o; - return Objects.equals(this.steps, workflowTemplateParameters.steps) && + return Objects.equals(this.step, workflowTemplateParameters.step) && Objects.equals(this.options, workflowTemplateParameters.options); } @Override public int hashCode() { - return Objects.hash(steps, options); + return Objects.hash(step, options); } @Override @@ -112,7 +107,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class WorkflowTemplateParameters {\n"); - sb.append(" steps: ").append(toIndentedString(steps)).append("\n"); + sb.append(" steps: ").append(toIndentedString(step)).append("\n"); sb.append(" options: ").append(toIndentedString(options)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkFLowEngineService.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkFLowEngineService.java similarity index 78% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkFLowEngineService.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkFLowEngineService.java index 0cf0bfba3c..9e24cdb7b8 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkFLowEngineService.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkFLowEngineService.java @@ -16,14 +16,16 @@ * under the License. */ -package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.core; +package org.wso2.carbon.identity.rest.api.server.workflow.v1.core; import org.wso2.carbon.identity.api.server.common.ContextLoader; import org.wso2.carbon.identity.api.server.common.error.APIError; import org.wso2.carbon.identity.api.server.common.error.ErrorResponse; +import org.wso2.carbon.identity.api.server.workflow.common.WorkflowServiceHolder; import org.wso2.carbon.identity.core.util.IdentityTenantUtil; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.core.function.BPSProfilesToExternal; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.dto.WorkFlowEngineDTO; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.WorkflowEnginesApi; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.core.function.BPSProfilesToExternal; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.dto.WorkFlowEngineDTO; import org.wso2.carbon.identity.workflow.impl.WorkflowImplException; import org.wso2.carbon.identity.workflow.impl.WorkflowImplServiceImpl; @@ -31,7 +33,7 @@ import java.util.stream.Collectors; import javax.ws.rs.core.Response; -import static org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.core.WorkflowEngineConstants.ErrorMessage.ERROR_CODE_ERROR_RETRIEVING_BPS_PROFILES; +import static org.wso2.carbon.identity.rest.api.server.workflow.v1.core.WorkflowEngineConstants.ErrorMessage.ERROR_CODE_ERROR_RETRIEVING_BPS_PROFILES; /** * Workflow engine service class @@ -48,6 +50,13 @@ private WorkflowImplServiceImpl getWorkflowService() { */ } + private WorkflowImplServiceImpl workflowImplService; + + public WorkFLowEngineService() { + + this.workflowImplService = WorkflowServiceHolder.getWorkflowImplService() ; + } + public List<WorkFlowEngineDTO> listWorkflowEngines() { try { diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkflowEngineConstants.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowEngineConstants.java similarity index 96% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkflowEngineConstants.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowEngineConstants.java index 35314c596f..6f4787fc12 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/WorkflowEngineConstants.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowEngineConstants.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.core; +package org.wso2.carbon.identity.rest.api.server.workflow.v1.core; /** * Workflow engine constants class diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/function/BPSProfilesToExternal.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/function/BPSProfilesToExternal.java similarity index 88% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/function/BPSProfilesToExternal.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/function/BPSProfilesToExternal.java index 95e4e137b5..72eab6f54e 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/core/function/BPSProfilesToExternal.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/function/BPSProfilesToExternal.java @@ -16,9 +16,9 @@ * under the License. */ -package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.core.function; +package org.wso2.carbon.identity.rest.api.server.workflow.v1.core.function; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.dto.WorkFlowEngineDTO; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.dto.WorkFlowEngineDTO; import org.wso2.carbon.identity.workflow.impl.bean.BPSProfile; import java.util.function.Function; diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowServiceFactory.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowServiceFactory.java similarity index 80% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowServiceFactory.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowServiceFactory.java index b5d9e8cd67..a70d57619b 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/factories/WorkflowServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowServiceFactory.java @@ -16,9 +16,9 @@ * under the License. */ -package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.factories; +package org.wso2.carbon.identity.rest.api.server.workflow.v1.factories; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.core.WorkflowService; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.core.WorkflowService; import org.wso2.carbon.identity.workflow.mgt.WorkflowManagementService; import org.wso2.carbon.identity.workflow.mgt.WorkflowManagementServiceImpl; @@ -31,11 +31,6 @@ public class WorkflowServiceFactory { static { WorkflowManagementService workflowManagementService = new WorkflowManagementServiceImpl(); - - if (workflowManagementService == null) { - throw new IllegalStateException("WorkflowManagementService is not available."); - } - SERVICE = new WorkflowService(workflowManagementService); } diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowAssociationsApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowAssociationsApiServiceImpl.java similarity index 77% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowAssociationsApiServiceImpl.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowAssociationsApiServiceImpl.java index bfb716def5..cb30c7307d 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowAssociationsApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowAssociationsApiServiceImpl.java @@ -16,12 +16,15 @@ * under the License. */ -package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.impl; - -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.*; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.core.WorkflowService; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.factories.WorkflowServiceFactory; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.*; +package org.wso2.carbon.identity.rest.api.server.workflow.v1.impl; + +import org.wso2.carbon.identity.rest.api.server.workflow.v1.*; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.WorkflowAssociationsApiService; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.core.WorkflowService; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.factories.WorkflowServiceFactory; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.*; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowAssociationCreation; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowAssociationPatch; import javax.ws.rs.core.Response; diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowEnginesApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowEnginesApiServiceImpl.java similarity index 80% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowEnginesApiServiceImpl.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowEnginesApiServiceImpl.java index ea41810b32..e49d23f7f2 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowEnginesApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowEnginesApiServiceImpl.java @@ -16,9 +16,10 @@ * under the License. */ -package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.impl; +package org.wso2.carbon.identity.rest.api.server.workflow.v1.impl; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.*; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.*; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.WorkflowEnginesApiService; import javax.ws.rs.core.Response; diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowsApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowsApiServiceImpl.java similarity index 74% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowsApiServiceImpl.java rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowsApiServiceImpl.java index 0e9d5081db..b14ce8b42e 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/engine/v1/impl/WorkflowsApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowsApiServiceImpl.java @@ -16,13 +16,14 @@ * under the License. */ -package org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.impl; +package org.wso2.carbon.identity.rest.api.server.workflow.v1.impl; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.*; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.core.WorkflowService; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.factories.WorkflowServiceFactory; -import org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model.*; -import java.util.List; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.*; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.WorkflowsApiService; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.core.WorkflowService; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.factories.WorkflowServiceFactory; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.*; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowCreation; import javax.ws.rs.core.Response; @@ -42,7 +43,7 @@ public WorkflowsApiServiceImpl() { @Override public Response createWorkflow(WorkflowCreation workflowCreation) { - return Response.ok().entity(workflowService.addWorkflow(workflowCreation, null)).build(); + return Response.ok().entity(workflowService.addWorkflow(workflowCreation)).build(); } @Override @@ -66,6 +67,6 @@ public Response listWorkflows(Integer limit, Integer offset, String filter) { @Override public Response updateWorkflow(String workflowId, WorkflowCreation workflowCreation) { - return Response.ok().entity(workflowService.addWorkflow(workflowCreation, workflowId)).build(); + return Response.ok().entity(workflowService.updateWorkflow(workflowCreation, workflowId)).build(); } } From d3f9e6bf0c23c601ceee2642f3ee92d3aa4d0d37 Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Wed, 5 Mar 2025 19:14:48 +0530 Subject: [PATCH 21/47] Add a new class to define error messages --- .../api/server/workflow/common/Constants.java | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.api.server.workflow.common/src/main/java/org/wso2/carbon/identity/api/server/workflow/common/Constants.java diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.api.server.workflow.common/src/main/java/org/wso2/carbon/identity/api/server/workflow/common/Constants.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.api.server.workflow.common/src/main/java/org/wso2/carbon/identity/api/server/workflow/common/Constants.java new file mode 100644 index 0000000000..af20055349 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.api.server.workflow.common/src/main/java/org/wso2/carbon/identity/api/server/workflow/common/Constants.java @@ -0,0 +1,91 @@ +/* + * 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"; + + private Constants() { + + } + + /** + * Enum for error messages. + */ + public enum ErrorMessage { + + ERROR_CODE_ERROR_LISTING_WORKFLOWS("50020", "Unable to list existing workflows", + "Encountered an error while listing the workflows."), + ERROR_CODE_ERROR_REMOVING_WORKFLOW("50021", "Unable to delete the workflow","Encountered an error while " + + "deleting the workflow for the identifier %s."), + ERROR_CODE_WORKFLOW_NOT_FOUND("50022", "Resource not found.", "Unable to find a resource matching the provided " + + "workflow 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", + "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 workflows associations", + "Encountered an error while listing the workflow associations."), + ERROR_CODE_ERROR_REMOVING_ASSOCIATION("50028", "Unable to delete the workflow association","Encountered an " + + "error while deleting the workflow association."), + ERROR_CODE_ERROR_RETRIEVING_ASSOCIATION("50029", + "Unable to retrieve workflow.", + "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."), + ERROR_CODE_ASSOCIATION_NOT_FOUND("50031", "Resource not found.", "Unable to find a resource matching the " + + "provided workflow association identifier %s."); + + 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; + } + } +} From d1cee68c9a34349304a171e24fc59e70fe0ccdfc Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Wed, 5 Mar 2025 19:18:39 +0530 Subject: [PATCH 22/47] Renamed workflow-engine.yaml --- .../src/main/resources/workflow-engine.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename components/{org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1 => org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1}/src/main/resources/workflow-engine.yaml (100%) diff --git a/components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/resources/workflow-engine.yaml b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/resources/workflow-engine.yaml similarity index 100% rename from components/org.wso2.carbon.identity.api.server.workflow.engine/org.wso2.carbon.identity.rest.api.server.workflow.engine.v1/src/main/resources/workflow-engine.yaml rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/resources/workflow-engine.yaml From 96915dd1fb81f0ef2d38b5e1db01d962461c4a70 Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Thu, 6 Mar 2025 11:47:17 +0530 Subject: [PATCH 23/47] Remove unnecessary properties from pom.xml file --- .../pom.xml | 7 ------- .../org.wso2.carbon.identity.api.server.workflow/pom.xml | 6 ------ 2 files changed, 13 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.api.server.workflow.common/pom.xml b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.api.server.workflow.common/pom.xml index c80eafbcb9..da5fd4ce81 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.api.server.workflow.common/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.api.server.workflow.common/pom.xml @@ -44,12 +44,6 @@ </plugins> </build> - <properties> - <maven.compiler.source>21</maven.compiler.source> - <maven.compiler.target>21</maven.compiler.target> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - </properties> - <dependencies> <dependency> <groupId>org.wso2.carbon.identity.workflow.impl.bps</groupId> @@ -61,5 +55,4 @@ <artifactId>org.wso2.carbon.identity.workflow.impl</artifactId> </dependency> </dependencies> - </project> diff --git a/components/org.wso2.carbon.identity.api.server.workflow/pom.xml b/components/org.wso2.carbon.identity.api.server.workflow/pom.xml index aed8aca1f3..1f1ef4f20b 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.workflow/pom.xml @@ -31,10 +31,4 @@ <modelVersion>4.0.0</modelVersion> <artifactId>org.wso2.carbon.identity.api.server.workflow</artifactId> - - <properties> - <maven.compiler.source>11</maven.compiler.source> - <maven.compiler.target>11</maven.compiler.target> - </properties> - </project> From 3f193da99bdf7527877cb711e709a3e60626707b Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Thu, 6 Mar 2025 11:50:13 +0530 Subject: [PATCH 24/47] Remove unnecessary try-catch blocks --- .../v1/impl/WorkflowAssociationsApiServiceImpl.java | 4 ---- .../server/workflow/v1/impl/WorkflowsApiServiceImpl.java | 6 +----- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowAssociationsApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowAssociationsApiServiceImpl.java index cb30c7307d..637c014554 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowAssociationsApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowAssociationsApiServiceImpl.java @@ -34,11 +34,7 @@ public class WorkflowAssociationsApiServiceImpl implements WorkflowAssociationsA public WorkflowAssociationsApiServiceImpl() { - try { this.workflowService = WorkflowServiceFactory.getWorkflowService(); - } catch (IllegalStateException e) { - throw new RuntimeException("Error occurred while initiating WorkflowService.", e); - } } @Override diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowsApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowsApiServiceImpl.java index b14ce8b42e..1373e07bbd 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowsApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowsApiServiceImpl.java @@ -33,11 +33,7 @@ public class WorkflowsApiServiceImpl implements WorkflowsApiService { public WorkflowsApiServiceImpl() { - try { - this.workflowService = WorkflowServiceFactory.getWorkflowService(); - } catch (IllegalStateException e) { - throw new RuntimeException("Error occurred while initiating WorkflowService.", e); - } + this.workflowService = WorkflowServiceFactory.getWorkflowService(); } @Override From a20e3bb0ce33516547c3b38274f3f5c3767be944 Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Thu, 6 Mar 2025 12:02:09 +0530 Subject: [PATCH 25/47] Invoke corresponding service methods --- .../WorkflowEngineServiceFactory.java | 41 +++++++++++++++++++ .../impl/WorkflowEnginesApiServiceImpl.java | 12 +++++- 2 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowEngineServiceFactory.java diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowEngineServiceFactory.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowEngineServiceFactory.java new file mode 100644 index 0000000000..a2db38acff --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowEngineServiceFactory.java @@ -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.rest.api.server.workflow.v1.factories; + +import org.wso2.carbon.identity.rest.api.server.workflow.v1.core.WorkflowEngineService; + +public class WorkflowEngineServiceFactory { + + private static final WorkflowEngineService SERVICE; + + static { + SERVICE = new WorkflowEngineService(); + } + + /** + * Get WorkflowEngineService. + * + * @return WorkflowEngineService. + */ + public static WorkflowEngineService getWorkflowEngineService() { + + return SERVICE; + } + +} diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowEnginesApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowEnginesApiServiceImpl.java index e49d23f7f2..aaef34b525 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowEnginesApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowEnginesApiServiceImpl.java @@ -18,16 +18,24 @@ package org.wso2.carbon.identity.rest.api.server.workflow.v1.impl; -import org.wso2.carbon.identity.rest.api.server.workflow.v1.*; import org.wso2.carbon.identity.rest.api.server.workflow.v1.WorkflowEnginesApiService; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.core.WorkflowEngineService; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.factories.WorkflowEngineServiceFactory; import javax.ws.rs.core.Response; public class WorkflowEnginesApiServiceImpl implements WorkflowEnginesApiService { + private final WorkflowEngineService workflowEngineService; + + public WorkflowEnginesApiServiceImpl() { + + this.workflowEngineService = WorkflowEngineServiceFactory.getWorkflowEngineService(); + } + @Override public Response searchWorkFlowEngines() { - return Response.ok().entity("magic!").build(); + return Response.ok().entity(workflowEngineService.listWorkflowEngines()).build(); } } From 42cf497cae4eb69c76037439fefb805ac092f5db Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Thu, 6 Mar 2025 13:27:04 +0530 Subject: [PATCH 26/47] Remove unnecessary new lines and move private methods to the bottom --- .../workflow/v1/core/WorkflowService.java | 326 ++++++++---------- 1 file changed, 138 insertions(+), 188 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowService.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowService.java index c834b4c770..978ca0b4e6 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowService.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowService.java @@ -27,7 +27,6 @@ import org.wso2.carbon.identity.api.server.common.error.APIError; import org.wso2.carbon.identity.api.server.common.error.ErrorResponse; import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.*; -import org.wso2.carbon.identity.workflow.mgt.WorkflowManagementAdminService; import org.wso2.carbon.identity.workflow.mgt.WorkflowManagementService; import org.wso2.carbon.identity.workflow.mgt.bean.Parameter; import org.wso2.carbon.identity.workflow.mgt.bean.Workflow; @@ -43,84 +42,12 @@ public class WorkflowService { - private static final Log log = LogFactory.getLog(WorkflowManagementAdminService.class); + private static final Log log = LogFactory.getLog(WorkflowService.class); private final WorkflowManagementService workflowManagementService; public WorkflowService(WorkflowManagementService workflowManagementService) { this.workflowManagementService = workflowManagementService; - - } - - private WorkflowSummary getWorkflow(Workflow workflowBean) { - - WorkflowSummary workflow = null; - - if (workflowBean != null) { - - workflow = new WorkflowSummary(); - - workflow.setId(workflowBean.getWorkflowId()); - workflow.setWorkflowName(workflowBean.getWorkflowName()); - workflow.setWorkflowDescription(workflowBean.getWorkflowDescription()); - workflow.setWorkflowTemplate(workflowBean.getTemplateId()); - workflow.setWorkflowEngine(workflowBean.getWorkflowImplId()); - } - return workflow; - } - - private WorkflowAssociation getAssociation(Association associationBean) { - - WorkflowAssociation association = null; - - if (associationBean != null) { - - association = new WorkflowAssociation(); - - association.setId(associationBean.getWorkflowId()); - association.setWorkflowAssociationName(associationBean.getAssociationName()); - association.setOperationName(associationBean.getEventName()); - association.setWorkflowName(associationBean.getWorkflowName()); - association.setAssociationCondition(associationBean.getCondition()); - association.setIsEnabled(associationBean.isEnabled()); - } - return association; - } - - private Parameter setWorkflowImplParameters(String workflowId, String paramName, String paramValue, String qName, - String holder) { - - Parameter parameter = new Parameter(); - parameter.setWorkflowId(workflowId); - parameter.setParamName(paramName); - parameter.setParamValue(paramValue); - parameter.setqName(qName); - parameter.setHolder(holder); - return parameter; - } - - private Workflow createWorkflow(WorkflowCreation workflow, String workflowId) throws WorkflowException { - - Workflow workflowBean = new Workflow(); - - workflowBean.setWorkflowId(workflowId); - workflowBean.setWorkflowName(workflow.getWorkflowName()); - workflowBean.setWorkflowDescription(workflow.getWorkflowDescription()); - String templateId = workflow.getWorkflowTemplate().getName(); - - if (templateId == null) { - throw new WorkflowException("Template id can't be empty"); - } - workflowBean.setTemplateId(templateId); - - String workflowImplId = workflow.getWorkflowEngine(); - if (workflowImplId == null) { - throw new WorkflowException("Workflowimpl id can't be empty"); - } - workflowBean.setWorkflowImplId(workflowImplId); - - return workflowBean; - } /** @@ -133,15 +60,10 @@ public WorkflowSummary addWorkflow(WorkflowCreation workflow) { WorkflowSummary workflowSummary; Workflow workflowBean; - try { String workflowId = UUID.randomUUID().toString(); workflowBean = createWorkflow(workflow, workflowId); - - // Setting up the Template ParameterList - List<WorkflowTemplateParameters> templateProperties = workflow.getWorkflowTemplate().getSteps(); - List<Parameter> parameterList = new ArrayList<>(); for (WorkflowTemplateParameters properties : templateProperties) { @@ -152,11 +74,8 @@ public WorkflowSummary addWorkflow(WorkflowCreation workflow) { "Template"); parameterList.add(parameter); } - } - // Setting up workflow impl parameter list - Parameter taskParameterDesc = setWorkflowImplParameters(null, "HTDescription", workflow.getApprovalTaskDescription(), "HTDescription", "Workflowimpl"); parameterList.add(taskParameterDesc); @@ -172,7 +91,6 @@ public WorkflowSummary addWorkflow(WorkflowCreation workflow) { workflowManagementService.addWorkflow(workflowBean, parameterList, CarbonContext.getThreadLocalCarbonContext().getTenantId()); workflowSummary = getWorkflow(workflowBean); - } catch (WorkflowClientException e) { throw handleClientError(Constants.ErrorMessage.ERROR_CODE_ERROR_ADDING_WORKFLOW, null, e); } catch (WorkflowException e) { @@ -192,21 +110,14 @@ public WorkflowSummary updateWorkflow(WorkflowCreation workflow, String workflow WorkflowSummary workflowSummary; Workflow workflowBean; - try { - Workflow existingWorkflow = workflowManagementService.getWorkflow(workflowId); if (existingWorkflow == null) { - throw new WorkflowClientException("Workflow ID: " + workflowId + " does not exist"); + throw new WorkflowClientException("Invalid Workflow ID provided"); } - workflowBean = createWorkflow(workflow, workflowId); - - // Setting up the Template ParameterList - List<WorkflowTemplateParameters> templateProperties = workflow.getWorkflowTemplate().getSteps(); - List<Parameter> parameterList = new ArrayList<>(); for (WorkflowTemplateParameters properties : templateProperties) { @@ -217,11 +128,8 @@ public WorkflowSummary updateWorkflow(WorkflowCreation workflow, String workflow "Template"); parameterList.add(parameter); } - } - // Setting up workflow impl parameter list - Parameter taskParameterDesc = setWorkflowImplParameters(workflowId, "HTDescription", workflow.getApprovalTaskDescription(), "HTDescription", "Workflowimpl"); parameterList.add(taskParameterDesc); @@ -236,9 +144,7 @@ public WorkflowSummary updateWorkflow(WorkflowCreation workflow, String workflow workflowManagementService.addWorkflow(workflowBean, parameterList, CarbonContext.getThreadLocalCarbonContext().getTenantId()); - workflowSummary = getWorkflow(workflowBean); - } catch (WorkflowClientException e) { throw handleClientError(Constants.ErrorMessage.ERROR_CODE_ERROR_UPDATING_WORKFLOW, workflowId, e); } catch (WorkflowException e) { @@ -258,14 +164,12 @@ public DetailedWorkflow getWorkflow(String workflowId) { try { Workflow workflowBean = workflowManagementService.getWorkflow(workflowId); - List<Parameter> workflowParameters = workflowManagementService.getWorkflowParameters(workflowId); if (workflowBean == null || workflowParameters == null) { throw handleException(Response.Status.NOT_FOUND, Constants.ErrorMessage.ERROR_CODE_WORKFLOW_NOT_FOUND, workflowId); } - return getDetailedWorkflow(workflowBean, workflowParameters); } catch (WorkflowClientException e) { throw handleClientError(Constants.ErrorMessage.ERROR_CODE_ERROR_RETRIEVING_WORKFLOW, workflowId, e); @@ -274,66 +178,6 @@ public DetailedWorkflow getWorkflow(String workflowId) { } } - private DetailedWorkflow getDetailedWorkflow(Workflow workflowBean, List<Parameter> workflowParameters) - throws WorkflowException { - - DetailedWorkflow detailedWorkflow = new DetailedWorkflow(); - - detailedWorkflow.setWorkflowName(workflowBean.getWorkflowName()); - detailedWorkflow.setWorkflowDescription(workflowBean.getWorkflowDescription()); - - DetailedWorkflowTemplate workflowTemplate = new DetailedWorkflowTemplate(); - workflowTemplate.setName(workflowBean.getTemplateId()); - - Template template = workflowManagementService.getTemplate(workflowBean.getTemplateId()); - workflowTemplate.setTemplateDescription(template.getDescription()); - - List<WorkflowTemplateParameters> additionalProperties = new ArrayList<>(); - Map<Integer, WorkflowTemplateParameters> templateParamsMap = new HashMap<>(); - - for (Parameter parameter : workflowParameters) { - - if ("Template".equals(parameter.getHolder())) { - String[] params = parameter.getqName().split("-"); - int stepNumber = Integer.parseInt(params[2]); - - // Check if there's already a WorkflowTemplateParameters object for this step - WorkflowTemplateParameters templateParameters = templateParamsMap.getOrDefault(stepNumber, - new WorkflowTemplateParameters()); - templateParameters.setSteps(stepNumber); - - // Create and add new OptionDetails - OptionDetails details = new OptionDetails(); - details.setEntity(params[3]); - details.setValues(parameter.getParamValue()); - - // Ensure the list exists and add new details - if (templateParameters.getOptions() == null) { - templateParameters.setOptions(new ArrayList<>()); - } - templateParameters.getOptions().add(details); - - // Update the map - templateParamsMap.put(stepNumber, templateParameters); - } else if ("HTSubject".equals(parameter.getParamName())) { - - if (parameter.getParamName().equals("HTSubject")) { - detailedWorkflow.setApprovalTask(parameter.getParamValue()); - } else if ("HTDescription".equals(parameter.getParamName())) { - detailedWorkflow.setApprovalTaskDescription(parameter.getParamValue()); - } - } - } - List<WorkflowTemplateParameters> templateParams = new ArrayList<>(templateParamsMap.values()); - - workflowTemplate.setProperties(templateParams); - detailedWorkflow.setWorkflowTemplate(workflowTemplate); - detailedWorkflow.setWorkflowEngine(workflowBean.getWorkflowImplId()); - - return detailedWorkflow; - } - - /** * List paginated workflows of a tenant. * @@ -342,7 +186,6 @@ private DetailedWorkflow getDetailedWorkflow(Workflow workflowBean, List<Paramet * @param filter filter string * @return WorkflowSummary[] */ - public WorkflowSummary[] listPaginatedWorkflows(Integer limit, Integer offset, String filter) { List<WorkflowSummary> workflowSummaryList = new ArrayList<>(); @@ -380,9 +223,7 @@ public WorkflowSummary[] listPaginatedWorkflows(Integer limit, Integer offset, S public String removeWorkflow(String workflowId) { try { - workflowManagementService.removeWorkflow(workflowId); - return "Workflow successfully removed!"; } catch (WorkflowClientException e) { throw handleClientError(Constants.ErrorMessage.ERROR_CODE_ERROR_REMOVING_WORKFLOW, workflowId, e); @@ -402,8 +243,7 @@ public String removeWorkflow(String workflowId) { public WorkflowAssociation[] listPaginatedAssociations(Integer limit, Integer offset, String filter) { List<WorkflowAssociation> associations = new ArrayList<>(); - List<Association> associationBeans = null; - + List<Association> associationBeans; try { if (limit == null || offset == null) { limit = 15; @@ -412,13 +252,12 @@ public WorkflowAssociation[] listPaginatedAssociations(Integer limit, Integer of limit = limit.intValue(); offset = offset.intValue(); } - associationBeans = workflowManagementService.listPaginatedAssociations(CarbonContext.getThreadLocalCarbonContext().getTenantId(), - limit, offset, filter); + associationBeans = workflowManagementService.listPaginatedAssociations( + CarbonContext.getThreadLocalCarbonContext().getTenantId(), limit, offset, filter); for (Association associationBean : associationBeans) { WorkflowAssociation associationTmp = getAssociation(associationBean); associations.add(associationTmp); } - } catch (WorkflowClientException e) { throw handleClientError(Constants.ErrorMessage.ERROR_CODE_ERROR_LISTING_ASSOCIATIONS, null, e); } catch (WorkflowException e) { @@ -477,7 +316,6 @@ private String addAssociation(String associationName, String workflowId, String workflowManagementService.addAssociation(associationName, workflowId, eventId, condition); return "Workflow Association successfully added!"; - } catch (WorkflowClientException e) { throw handleClientError(Constants.ErrorMessage.ERROR_CODE_ERROR_ADDING_ASSOCIATION, null, e); } catch (WorkflowException e) { @@ -515,23 +353,6 @@ public WorkflowAssociation getAssociation(String associationId) { } } - - private boolean getAssociationState(String associationId, Status status) { - - boolean isEnable; - try { - if (status == null) { - isEnable = workflowManagementService.getAssociation(associationId).isEnabled(); - } else { - isEnable = (status.getAction() == ActionStatus.ENABLE); - } - return isEnable; - - } catch (WorkflowException e) { - throw handleServerError(Constants.ErrorMessage.ERROR_CODE_ERROR_RETRIEVING_ASSOCIATION, associationId, e); - } - } - /** * Partially update an association * @@ -547,7 +368,6 @@ public String changeAssociation(String associationId, WorkflowAssociationPatch w workflowAssociation.getWorkflowId(), workflowAssociation.getOperationName(), workflowAssociation.getAssociationCondition(), isEnable); return "Workflow association successfully updated!"; - } catch (WorkflowClientException e) { throw handleClientError(Constants.ErrorMessage.ERROR_CODE_ERROR_UPDATING_ASSOCIATION, associationId, e); } catch (WorkflowException e) { @@ -555,6 +375,139 @@ public String changeAssociation(String associationId, WorkflowAssociationPatch w } } + private boolean getAssociationState(String associationId, Status status) { + + boolean isEnable; + try { + if (status == null) { + isEnable = workflowManagementService.getAssociation(associationId).isEnabled(); + } else { + isEnable = (status.getAction() == ActionStatus.ENABLE); + } + return isEnable; + } catch (WorkflowException e) { + throw handleServerError(Constants.ErrorMessage.ERROR_CODE_ERROR_RETRIEVING_ASSOCIATION, associationId, e); + } + } + + private WorkflowSummary getWorkflow(Workflow workflowBean) { + + WorkflowSummary workflow = null; + if (workflowBean != null) { + workflow = new WorkflowSummary(); + workflow.setId(workflowBean.getWorkflowId()); + workflow.setWorkflowName(workflowBean.getWorkflowName()); + workflow.setWorkflowDescription(workflowBean.getWorkflowDescription()); + workflow.setWorkflowTemplate(workflowBean.getTemplateId()); + workflow.setWorkflowEngine(workflowBean.getWorkflowImplId()); + } + return workflow; + } + + private WorkflowAssociation getAssociation(Association associationBean) { + + WorkflowAssociation association = null; + + if (associationBean != null) { + association = new WorkflowAssociation(); + association.setId(associationBean.getWorkflowId()); + association.setWorkflowAssociationName(associationBean.getAssociationName()); + association.setOperationName(associationBean.getEventName()); + association.setWorkflowName(associationBean.getWorkflowName()); + association.setAssociationCondition(associationBean.getCondition()); + association.setIsEnabled(associationBean.isEnabled()); + } + return association; + } + + private Parameter setWorkflowImplParameters(String workflowId, String paramName, String paramValue, String qName, + String holder) { + + Parameter parameter = new Parameter(); + parameter.setWorkflowId(workflowId); + parameter.setParamName(paramName); + parameter.setParamValue(paramValue); + parameter.setqName(qName); + parameter.setHolder(holder); + return parameter; + } + + private Workflow createWorkflow(WorkflowCreation workflow, String workflowId) throws WorkflowException { + + Workflow workflowBean = new Workflow(); + workflowBean.setWorkflowId(workflowId); + workflowBean.setWorkflowName(workflow.getWorkflowName()); + workflowBean.setWorkflowDescription(workflow.getWorkflowDescription()); + String templateId = workflow.getWorkflowTemplate().getName(); + + if (templateId == null) { + throw new WorkflowException("Template id can't be empty"); + } + workflowBean.setTemplateId(templateId); + String workflowImplId = workflow.getWorkflowEngine(); + + if (workflowImplId == null) { + throw new WorkflowException("Workflowimpl id can't be empty"); + } + workflowBean.setWorkflowImplId(workflowImplId); + return workflowBean; + } + + private DetailedWorkflow getDetailedWorkflow(Workflow workflowBean, List<Parameter> workflowParameters) + throws WorkflowException { + + DetailedWorkflow detailedWorkflow = new DetailedWorkflow(); + detailedWorkflow.setWorkflowName(workflowBean.getWorkflowName()); + detailedWorkflow.setWorkflowDescription(workflowBean.getWorkflowDescription()); + DetailedWorkflowTemplate workflowTemplate = new DetailedWorkflowTemplate(); + workflowTemplate.setName(workflowBean.getTemplateId()); + + Template template = workflowManagementService.getTemplate(workflowBean.getTemplateId()); + workflowTemplate.setTemplateDescription(template.getDescription()); + + List<WorkflowTemplateParameters> additionalProperties = new ArrayList<>(); + Map<Integer, WorkflowTemplateParameters> templateParamsMap = new HashMap<>(); + + for (Parameter parameter : workflowParameters) { + + if ("Template".equals(parameter.getHolder())) { + String[] params = parameter.getqName().split("-"); + int stepNumber = Integer.parseInt(params[2]); + + // Check if there's already a WorkflowTemplateParameters object for this step + WorkflowTemplateParameters templateParameters = templateParamsMap.getOrDefault(stepNumber, + new WorkflowTemplateParameters()); + templateParameters.setSteps(stepNumber); + + // Create and add new OptionDetails + OptionDetails details = new OptionDetails(); + details.setEntity(params[3]); + details.setValues(parameter.getParamValue()); + + // Ensure the list exists and add new details + if (templateParameters.getOptions() == null) { + templateParameters.setOptions(new ArrayList<>()); + } + templateParameters.getOptions().add(details); + + // Update the map + templateParamsMap.put(stepNumber, templateParameters); + } else if ("HTSubject".equals(parameter.getParamName())) { + + if (parameter.getParamName().equals("HTSubject")) { + detailedWorkflow.setApprovalTask(parameter.getParamValue()); + } else if ("HTDescription".equals(parameter.getParamName())) { + detailedWorkflow.setApprovalTaskDescription(parameter.getParamValue()); + } + } + } + List<WorkflowTemplateParameters> templateParams = new ArrayList<>(templateParamsMap.values()); + workflowTemplate.setProperties(templateParams); + detailedWorkflow.setWorkflowTemplate(workflowTemplate); + detailedWorkflow.setWorkflowEngine(workflowBean.getWorkflowImplId()); + return detailedWorkflow; + } + private ErrorResponse.Builder getErrorBuilder(Constants.ErrorMessage errorMsg, String data) { return new ErrorResponse.Builder().withCode(errorMsg.getCode()).withMessage(errorMsg.getMessage()) @@ -602,7 +555,6 @@ private APIError handleException(Response.Status status, Constants.ErrorMessage private APIError handleServerError(Constants.ErrorMessage errorEnum, String data, Exception e) { ErrorResponse errorResponse = getErrorBuilder(errorEnum, data).build(log, e, includeData(e.getMessage(), data)); - return new APIError(Response.Status.INTERNAL_SERVER_ERROR, errorResponse); } @@ -618,8 +570,6 @@ private APIError handleClientError(Constants.ErrorMessage errorEnum, String data } else { errorResponse = getErrorBuilder(errorEnum, data).build(log, e, includeData(e.getMessage(), data)); } - return new APIError(Response.Status.BAD_REQUEST, errorResponse); - } } From ac7f81f5ecb530aa81dd967b0ac9ffcce8a81312 Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Sun, 9 Mar 2025 12:34:19 +0530 Subject: [PATCH 27/47] Update the API Specification with new changes --- .../{workflow-engine.yaml => workflow.yaml} | 377 ++++++++++-------- 1 file changed, 200 insertions(+), 177 deletions(-) rename components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/resources/{workflow-engine.yaml => workflow.yaml} (79%) diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/resources/workflow-engine.yaml b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/resources/workflow.yaml similarity index 79% rename from components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/resources/workflow-engine.yaml rename to components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/resources/workflow.yaml index 093d00e283..aa39cee365 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/resources/workflow-engine.yaml +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/resources/workflow.yaml @@ -71,22 +71,20 @@ paths: $ref: '#/components/schemas/WorkflowSummary' example: - id: "100" - workflowName: User Registration Approval - workflowDescription: Approves new user registrations before account - activation - workflowEngine: Simple Workflow Engine - workflowTemplate: MultiStepApprovalTemplate + name: User Approval Workflow + description: Approves requests for user related tasks + engine: Simple Workflow Engine + template: MultiStepApprovalTemplate - id: "101" - workflowName: Role Change Request - workflowDescription: Approves requests for changing user roles - workflowEngine: Simple Workflow Engine - workflowTemplate: MultiStepApprovalTemplate + name: User Role Approval Workflow + description: Approves requests for user role related tasks + engine: Simple Workflow Engine + template: MultiStepApprovalTemplate - id: "102" - workflowName: User Deactivation Workflow - workflowDescription: Ensures proper approvals before deactivating - a user account - workflowEngine: Simple Workflow Engine - workflowTemplate: SingleStepApprovalTemplate + name: User Claim Approval Workflow + description: Approves requests for user claim related tasks + engine: Simple Workflow Engine + template: SingleStepApprovalTemplate '400': $ref: '#/components/responses/InvalidInput' '401': @@ -122,11 +120,10 @@ paths: $ref: '#/components/schemas/WorkflowSummary' example: id: "100" - workflowName: User Registration Approval - workflowDescription: Approves new user registrations before account - activation - workflowEngine: Simple Workflow Engine - workflowTemplate: MultiStepApprovalTemplate + name: User Approval Workflow + description: Workflow to approve user role related requests + engine: Simple Workflow Engine + template: MultiStepApprovalTemplate '400': $ref: '#/components/responses/InvalidInput' '401': @@ -155,7 +152,7 @@ paths: content: 'application/json': schema: - $ref: '#/components/schemas/DetailedWorkflow' + $ref: '#/components/schemas/WorkflowDetails' '400': $ref: '#/components/responses/InvalidInput' '401': @@ -239,25 +236,22 @@ paths: schema: type: array items: - $ref: '#/components/schemas/WorkflowAssociation' + $ref: '#/components/schemas/WorkflowAssociationSummary' example: - id: "500" - workflowAssociationName: User Registration Workflow Association - operationName: Add User - workflowName: User Registration Approval - associationCondition: Username equals John + associationName: User Registration Workflow Association + operation: ADD_USER + workflowName: User Approval Workflow isEnabled: true - id: "501" - workflowAssociationName: Role Update Workflow Association - operationName: Update Role - workflowName: Role Change Request - associationCondition: Role equals Manager + associationName: Role Update Workflow Association + operation: UPDATE_ROLE + workflowName: User Role Approval Workflow isEnabled: true - id: "502" - workflowAssociationName: Delete User Workflow Association - operationName: Delete User - workflowName: User Deactivation Workflow - associationCondition: Apply to all requests + associationName: User Deletion Workflow Association + operation: DELETE_USER + workflowName: User Approval Workflow isEnabled: false '400': $ref: '#/components/responses/InvalidInput' @@ -291,7 +285,7 @@ paths: content: 'application/json': schema: - $ref: '#/components/schemas/WorkflowAssociation' + $ref: '#/components/schemas/WorkflowAssociationCreation' '400': $ref: '#/components/responses/InvalidInput' '401': @@ -304,7 +298,7 @@ paths: $ref: '#/components/responses/ServerError' /workflow-associations/{association-id}: get: - summary: Get the workflow association by association id. + summary: Get the workflow association by association-id. description: | Get a specific workflow association identified by the association id. @@ -322,9 +316,9 @@ paths: $ref: '#/components/schemas/WorkflowAssociation' example: id: "500" - workflowAssociationName: User Registration Workflow Association - operationName: Add User - workflowName: User Registration Approval + associationName: User Registration Workflow Association + operation: ADD_USER + workflowName: User Approval Workflow associationCondition: Username equals John isEnabled: true '400': @@ -338,7 +332,7 @@ paths: '500': $ref: '#/components/responses/ServerError' delete: - summary: Delete the workflow association by association id. + summary: Delete the workflow association by association-id. description: | Delete a specific workflow association identified by the association ID. @@ -362,10 +356,10 @@ paths: $ref: '#/components/responses/ServerError' patch: summary: | - Partially update association by ID + Partially update association by association-id. operationId: patchAssociation description: | - Partially update an association by ID.<br> + Partially update an association by association-id.<br> <b>Scope required:</b> <br> * internal_workflow_associations_update @@ -378,12 +372,11 @@ paths: schema: $ref: '#/components/schemas/WorkflowAssociationPatch' example: - workflowAssociationName: User Registration Workflow Association - operationName: Add User + associationName: User Registration Workflow Association + operation: ADD_USER workflowId: "500" associationCondition: Role Name equals Employee - associationStatus: - action: ENABLE + isEnabled: true responses: '200': description: Successfully Updated @@ -435,43 +428,6 @@ components: example: challengeQuestion1 description: Username of the creator of the workflow engine. - WorkflowTemplateParameters: - type: object - required: - - steps - properties: - steps: - type: integer - example: 1 - options: - type: array - minItems: 1 - items: - $ref: "#/components/schemas/OptionDetails" - example: [ - { - "entity": "roles", - "values": "admin" - }, - { - "entity": "users", - "values": "John" - } - ] - - OptionDetails: - type: object - required: - - entity - - values - properties: - entity: - type: string - example: "roles" - values: - type: string - example: "admin" - WorkflowSummary: type: object properties: @@ -479,70 +435,169 @@ components: type: string example: "100" description: "Unique id to represent a workflow" - workflowName: + name: type: string example: "User Role Approval" description: "Display name of the workflow" - workflowDescription: + description: type: string - example: "Workflow to approve new user registrations before account activation" + example: "Workflow to approve user role related requests" description: "Detailed description of the workflow" - workflowEngine: + engine: type: string example: "Simple Workflow Engine" description: "Category in which the workflow is deployed" - workflowTemplate: + template: type: string example: "MultiStepApprovalTemplate" description: "Template defining the approval process for the workflow" - - DetailedWorkflow: + WorkflowDetails: type: object properties: - workflowName: + name: type: string - example: "User Registration Workflow" + example: "User Approval Workflow" description: "Name of the created workflow" - workflowDescription: + description: type: string - example: "Workflow to approve new user registrations before account activation" + example: "Workflow to approve user role related requests" description: "Description of the created workflow" - workflowEngine: + engine: type: string example: "Simple Workflow Engine" description: "Name of the selected workflow engine" - workflowTemplate: - $ref: "#/components/schemas/DetailedWorkflowTemplate" + template: + $ref: "#/components/schemas/WorkflowTemplateBase" approvalTask: type: string - example: "User Registration Approval" + example: "Approval Required" description: "Approval task subject to display" approvalTaskDescription: type: string - example: "Approval task to validate and approve new user registrations before account activation" + example: "Your approval is needed to complete this task" description: "Description of the approval task" - - DetailedWorkflowTemplate: + WorkflowCreation: type: object required: - name + - engine + - approvalTask + properties: + name: + type: string + example: "User Approval Workflow" + description: "Name of the created workflow" + description: + type: string + example: "Workflow to approve user role related requests" + description: "Description of the created workflow" + engine: + type: string + example: "Simple Workflow Engine" + description: "Name of the selected workflow engine" + template: + type: object + allOf: + - $ref: "#/components/schemas/WorkflowTemplate" + required: [name] + approvalTask: + type: string + example: "Approval Required" + description: "Approval task subject to display" + approvalTaskDescription: + type: string + example: "Your approval is needed to complete this task" + description: "Description of the approval task" + + WorkflowTemplate: + type: object properties: name: type: string example: "MultiStepApproval" description: "Name of the workflow template" - templateDescription: + steps: + type: array + minItems: 1 + items: + type: object + allOf: + - $ref: "#/components/schemas/WorkflowTemplateParameters" + required: [step] + + WorkflowTemplateParameters: + type: object + properties: + step: + type: integer + example: 1 + options: + type: array + minItems: 1 + items: + type: object + allOf: + - $ref: "#/components/schemas/OptionDetails" + required: [entity, values] + example: [ + { + "entity": "roles", + "values": ["admin", "manager"] + }, + { + "entity": "users", + "values": ["John", "Tom"] + } + ] + + WorkflowTemplateBase: + type: object + properties: + name: type: string - example: "The operation should be approved by an authorized person with given role, to complete." - description: "Description of the workflow template" - properties: + example: "MultiStepApproval" + description: "Name of the workflow template" + steps: type: array + minItems: 1 items: - $ref: "#/components/schemas/WorkflowTemplateParameters" + $ref: "#/components/schemas/WorkflowTemplateParametersBase" + WorkflowTemplateParametersBase: + type: object + properties: + step: + type: integer + example: 1 + options: + type: array + minItems: 1 + items: + $ref: "#/components/schemas/OptionDetails" + example: [ + { + "entity": "roles", + "values": ["admin", "manager"] + }, + { + "entity": "users", + "values": ["John", "Tom"] + } + ] + OptionDetails: + type: object + properties: + entity: + type: string + example: "roles" + values: + type: array + items: + type: string + example: "admin" WorkflowAssociation: type: object @@ -551,88 +606,54 @@ components: type: string example: "500" description: "Unique id to represent a workflow association" - workflowAssociationName: + associationName: type: string - example: "User registration Workflow Association" + example: "User Registration Workflow Association" description: "Name of the workflow association" - operationName: - type: string - example: "Add User" - description: "User Operation" + operation: + $ref: "#/components/schemas/Operation" workflowName: type: string - example: "User Registration Approval" + example: "User Approval Workflow" description: "Assigned Workflow" - associationCondition: - type: string - example: "Role equals Manager" - description: "Assigned Association Condition" isEnabled: type: boolean example: true description: "Association Status" - WorkflowCreation: + WorkflowAssociationSummary: type: object - required: - - workflowName - - workflowEngine - - approvalTask properties: - workflowName: - type: string - example: "User Registration Workflow" - description: "Name of the created workflow" - workflowDescription: - type: string - example: "Workflow to approve new user registrations before account activation" - description: "Description of the created workflow" - workflowEngine: - type: string - example: "Simple Workflow Engine" - description: "Name of the selected workflow engine" - workflowTemplate: - $ref: "#/components/schemas/WorkflowTemplate" - approvalTask: + id: type: string - example: "User Registration Approval" - description: "Approval task subject to display" - approvalTaskDescription: + example: "500" + description: "Unique id to represent a workflow association" + associationName: type: string - example: "Approval task to validate and approve new user registrations before account activation" - description: "Description of the approval task" - - WorkflowTemplate: - type: object - required: - - name - properties: - name: + example: "User Registration Workflow Association" + description: "Name of the workflow association" + workflowName: type: string - example: "MultiStepApproval" - description: "Name of the workflow template" - steps: - type: array - minItems: 1 - items: - $ref: "#/components/schemas/WorkflowTemplateParameters" - + example: "User Approval Workflow" + description: "Assigned Workflow" + isEnabled: + type: boolean + example: true + description: "Association Status" WorkflowAssociationCreation: type: object required: - associationName - - operationName + - operation - workflowId properties: associationName: type: string example: "User Registration Workflow Association" description: "Name of the workflow association" - operationName: - type: string - example: "Add User" - description: "Name of the user operation" + operation: + $ref: "#/components/schemas/Operation" workflowId: type: string example: "456" @@ -654,10 +675,8 @@ components: type: string example: "User Registration Workflow Association" description: "Name of the workflow association" - operationName: - type: string - example: "Add User" - description: "Name of the user operation" + operation: + $ref: "#/components/schemas/Operation" workflowId: type: string example: "456" @@ -666,21 +685,25 @@ components: type: string example: "Role Name equals Manager" description: "Condition added to the association" - associationStatus: - $ref: "#/components/schemas/Status" - - Status: - type: object - properties: - action: - $ref: "#/components/schemas/ActionStatus" + isEnabled: + type: boolean + example: true + description: "Association Status" - ActionStatus: + Operation: type: string enum: - - ENABLE - - DISABLE - description: "Indicates whether to enable or disable the workflow association" + - ADD_USER + - DELETE_USER + - UPDATE_ROLES_OF_USERS + - ADD_ROLE + - DELETE_ROLE + - UPDATE_ROLE_NAME + - UPDATE_USERS_OF_ROLES + - DELETE_USER_CLAIMS + - UPDATE_USER_CLAIMS + description: "Name of the user operation" + Error: required: From 5d3c6a471fdf66e3d07cb57c2a9a33e7a08cfec5 Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Sun, 9 Mar 2025 12:35:14 +0530 Subject: [PATCH 28/47] Remove unnecessary files --- .../workflow/v1/model/ActionStatus.java | 61 ------ .../workflow/v1/model/DetailedWorkflow.java | 203 ------------------ .../v1/model/DetailedWorkflowTemplate.java | 151 ------------- .../api/server/workflow/v1/model/Status.java | 93 -------- 4 files changed, 508 deletions(-) delete mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/ActionStatus.java delete mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/DetailedWorkflow.java delete mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/DetailedWorkflowTemplate.java delete mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/Status.java diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/ActionStatus.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/ActionStatus.java deleted file mode 100644 index d17c8bf879..0000000000 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/ActionStatus.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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.rest.api.server.workflow.v1.model; - -/** - * Indicates whether to enable or disable the workflow association - **/ -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlEnumValue; - -@XmlType(name="") -@XmlEnum(String.class) -public enum ActionStatus { - - @XmlEnumValue("ENABLE") ENABLE(String.valueOf("ENABLE")), @XmlEnumValue("DISABLE") DISABLE(String.valueOf("DISABLE")); - - - private String value; - - ActionStatus(String v) { - value = v; - } - - public String value() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static ActionStatus fromValue(String value) { - for (ActionStatus b : ActionStatus.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } -} - - - diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/DetailedWorkflow.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/DetailedWorkflow.java deleted file mode 100644 index f6396a6a1c..0000000000 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/DetailedWorkflow.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * 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.rest.api.server.workflow.v1.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModelProperty; - - -import java.util.Objects; -import javax.validation.Valid; - -public class DetailedWorkflow { - - private String workflowName; - private String workflowDescription; - private String workflowEngine; - private DetailedWorkflowTemplate workflowTemplate; - private String approvalTask; - private String approvalTaskDescription; - - /** - * Name of the created workflow - **/ - public DetailedWorkflow workflowName(String workflowName) { - - this.workflowName = workflowName; - return this; - } - - @ApiModelProperty(example = "User Registration Workflow", value = "Name of the created workflow") - @JsonProperty("workflowName") - @Valid - public String getWorkflowName() { - return workflowName; - } - public void setWorkflowName(String workflowName) { - this.workflowName = workflowName; - } - - /** - * Description of the created workflow - **/ - public DetailedWorkflow workflowDescription(String workflowDescription) { - - this.workflowDescription = workflowDescription; - return this; - } - - @ApiModelProperty(example = "Workflow to approve new user registrations before account activation", value = "Description of the created workflow") - @JsonProperty("workflowDescription") - @Valid - public String getWorkflowDescription() { - return workflowDescription; - } - public void setWorkflowDescription(String workflowDescription) { - this.workflowDescription = workflowDescription; - } - - /** - * Name of the selected workflow engine - **/ - public DetailedWorkflow workflowEngine(String workflowEngine) { - - this.workflowEngine = workflowEngine; - return this; - } - - @ApiModelProperty(example = "Simple Workflow Engine", value = "Name of the selected workflow engine") - @JsonProperty("workflowEngine") - @Valid - public String getWorkflowEngine() { - return workflowEngine; - } - public void setWorkflowEngine(String workflowEngine) { - this.workflowEngine = workflowEngine; - } - - /** - **/ - public DetailedWorkflow workflowTemplate(DetailedWorkflowTemplate workflowTemplate) { - - this.workflowTemplate = workflowTemplate; - return this; - } - - @ApiModelProperty(value = "") - @JsonProperty("workflowTemplate") - @Valid - public DetailedWorkflowTemplate getWorkflowTemplate() { - return workflowTemplate; - } - public void setWorkflowTemplate(DetailedWorkflowTemplate workflowTemplate) { - this.workflowTemplate = workflowTemplate; - } - - /** - * Approval task subject to display - **/ - public DetailedWorkflow approvalTask(String approvalTask) { - - this.approvalTask = approvalTask; - return this; - } - - @ApiModelProperty(example = "User Registration Approval", value = "Approval task subject to display") - @JsonProperty("approvalTask") - @Valid - public String getApprovalTask() { - return approvalTask; - } - public void setApprovalTask(String approvalTask) { - this.approvalTask = approvalTask; - } - - /** - * Description of the approval task - **/ - public DetailedWorkflow approvalTaskDescription(String approvalTaskDescription) { - - this.approvalTaskDescription = approvalTaskDescription; - return this; - } - - @ApiModelProperty(example = "Approval task to validate and approve new user registrations before account activation", value = "Description of the approval task") - @JsonProperty("approvalTaskDescription") - @Valid - public String getApprovalTaskDescription() { - return approvalTaskDescription; - } - public void setApprovalTaskDescription(String approvalTaskDescription) { - this.approvalTaskDescription = approvalTaskDescription; - } - - - - @Override - public boolean equals(java.lang.Object o) { - - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DetailedWorkflow detailedWorkflow = (DetailedWorkflow) o; - return Objects.equals(this.workflowName, detailedWorkflow.workflowName) && - Objects.equals(this.workflowDescription, detailedWorkflow.workflowDescription) && - Objects.equals(this.workflowEngine, detailedWorkflow.workflowEngine) && - Objects.equals(this.workflowTemplate, detailedWorkflow.workflowTemplate) && - Objects.equals(this.approvalTask, detailedWorkflow.approvalTask) && - Objects.equals(this.approvalTaskDescription, detailedWorkflow.approvalTaskDescription); - } - - @Override - public int hashCode() { - return Objects.hash(workflowName, workflowDescription, workflowEngine, workflowTemplate, approvalTask, approvalTaskDescription); - } - - @Override - public String toString() { - - StringBuilder sb = new StringBuilder(); - sb.append("class DetailedWorkflow {\n"); - - sb.append(" workflowName: ").append(toIndentedString(workflowName)).append("\n"); - sb.append(" workflowDescription: ").append(toIndentedString(workflowDescription)).append("\n"); - sb.append(" workflowEngine: ").append(toIndentedString(workflowEngine)).append("\n"); - sb.append(" workflowTemplate: ").append(toIndentedString(workflowTemplate)).append("\n"); - sb.append(" approvalTask: ").append(toIndentedString(approvalTask)).append("\n"); - sb.append(" approvalTaskDescription: ").append(toIndentedString(approvalTaskDescription)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n"); - } -} - diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/DetailedWorkflowTemplate.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/DetailedWorkflowTemplate.java deleted file mode 100644 index 8215dfd641..0000000000 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/DetailedWorkflowTemplate.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * 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.rest.api.server.workflow.v1.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModelProperty; -import java.util.ArrayList; -import java.util.List; -import javax.validation.constraints.*; - - -import java.util.Objects; -import javax.validation.Valid; - -public class DetailedWorkflowTemplate { - - private String name; - private String templateDescription; - private List<WorkflowTemplateParameters> properties = null; - - - /** - * Name of the workflow template - **/ - public DetailedWorkflowTemplate name(String name) { - - this.name = name; - return this; - } - - @ApiModelProperty(example = "MultiStepApproval", required = true, value = "Name of the workflow template") - @JsonProperty("name") - @Valid - @NotNull(message = "Property name cannot be null.") - - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - /** - * Description of the workflow template - **/ - public DetailedWorkflowTemplate templateDescription(String templateDescription) { - - this.templateDescription = templateDescription; - return this; - } - - @ApiModelProperty(example = "The operation should be approved by an authorized person with given role, to complete.", value = "Description of the workflow template") - @JsonProperty("templateDescription") - @Valid - public String getTemplateDescription() { - return templateDescription; - } - public void setTemplateDescription(String templateDescription) { - this.templateDescription = templateDescription; - } - - /** - **/ - public DetailedWorkflowTemplate properties(List<WorkflowTemplateParameters> properties) { - - this.properties = properties; - return this; - } - - @ApiModelProperty(value = "") - @JsonProperty("properties") - @Valid - public List<WorkflowTemplateParameters> getProperties() { - return properties; - } - public void setProperties(List<WorkflowTemplateParameters> properties) { - this.properties = properties; - } - - public DetailedWorkflowTemplate addPropertiesItem(WorkflowTemplateParameters propertiesItem) { - if (this.properties == null) { - this.properties = new ArrayList<>(); - } - this.properties.add(propertiesItem); - return this; - } - - - - @Override - public boolean equals(java.lang.Object o) { - - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DetailedWorkflowTemplate detailedWorkflowTemplate = (DetailedWorkflowTemplate) o; - return Objects.equals(this.name, detailedWorkflowTemplate.name) && - Objects.equals(this.templateDescription, detailedWorkflowTemplate.templateDescription) && - Objects.equals(this.properties, detailedWorkflowTemplate.properties); - } - - @Override - public int hashCode() { - return Objects.hash(name, templateDescription, properties); - } - - @Override - public String toString() { - - StringBuilder sb = new StringBuilder(); - sb.append("class DetailedWorkflowTemplate {\n"); - - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" templateDescription: ").append(toIndentedString(templateDescription)).append("\n"); - sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n"); - } -} - diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/Status.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/Status.java deleted file mode 100644 index 27c00b3387..0000000000 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/Status.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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.rest.api.server.workflow.v1.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModelProperty; - - -import java.util.Objects; -import javax.validation.Valid; - -public class Status { - - private ActionStatus action; - - /** - **/ - public Status action(ActionStatus action) { - - this.action = action; - return this; - } - - @ApiModelProperty(value = "") - @JsonProperty("action") - @Valid - public ActionStatus getAction() { - return action; - } - public void setAction(ActionStatus action) { - this.action = action; - } - - - - @Override - public boolean equals(java.lang.Object o) { - - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Status status = (Status) o; - return Objects.equals(this.action, status.action); - } - - @Override - public int hashCode() { - return Objects.hash(action); - } - - @Override - public String toString() { - - StringBuilder sb = new StringBuilder(); - sb.append("class Status {\n"); - - sb.append(" action: ").append(toIndentedString(action)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n"); - } -} - From 8f5bfcdd58c54b76a7e3ed93f7ddf74cbf64359a Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Sun, 9 Mar 2025 12:35:40 +0530 Subject: [PATCH 29/47] Add new constants --- .../api/server/workflow/common/Constants.java | 82 +++++++++++++------ 1 file changed, 57 insertions(+), 25 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.api.server.workflow.common/src/main/java/org/wso2/carbon/identity/api/server/workflow/common/Constants.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.api.server.workflow.common/src/main/java/org/wso2/carbon/identity/api/server/workflow/common/Constants.java index af20055349..604ecbed31 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.api.server.workflow.common/src/main/java/org/wso2/carbon/identity/api/server/workflow/common/Constants.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.api.server.workflow.common/src/main/java/org/wso2/carbon/identity/api/server/workflow/common/Constants.java @@ -23,7 +23,16 @@ */ public class Constants { - public static final String WORKFLOW_PREFIX = "WF"; + 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() { @@ -34,32 +43,55 @@ private Constants() { */ public enum ErrorMessage { - ERROR_CODE_ERROR_LISTING_WORKFLOWS("50020", "Unable to list existing workflows", + // 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_ERROR_REMOVING_WORKFLOW("50021", "Unable to delete the workflow","Encountered an error while " + - "deleting the workflow for the identifier %s."), - ERROR_CODE_WORKFLOW_NOT_FOUND("50022", "Resource not found.", "Unable to find a resource matching the provided " + - "workflow 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_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", - "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 workflows associations", - "Encountered an error while listing the workflow associations."), - ERROR_CODE_ERROR_REMOVING_ASSOCIATION("50028", "Unable to delete the workflow association","Encountered an " + - "error while deleting the workflow association."), - ERROR_CODE_ERROR_RETRIEVING_ASSOCIATION("50029", - "Unable to retrieve workflow.", - "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."), - ERROR_CODE_ASSOCIATION_NOT_FOUND("50031", "Resource not found.", "Unable to find a resource matching the " + - "provided workflow association identifier %s."); + "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; From 65754f5764c1f0cc6c002be2d3e81e965304de7d Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Sun, 9 Mar 2025 12:37:09 +0530 Subject: [PATCH 30/47] Remove unnecessary files and regenerate the code --- .../workflow/v1/WorkflowAssociationsApi.java | 22 +- .../api/server/workflow/v1/WorkflowsApi.java | 11 +- ...WorkflowAssociationsApiServiceFactory.java | 5 +- .../factories/WorkflowsApiServiceFactory.java | 5 +- .../v1/model/WorkflowAssociation.java | 204 ----------------- .../v1/model/WorkflowAssociationCreation.java | 189 ---------------- .../v1/model/WorkflowAssociationPatch.java | 181 --------------- .../workflow/v1/model/WorkflowCreation.java | 211 ------------------ .../workflow/v1/model/WorkflowEngine.java | 163 -------------- .../workflow/v1/model/WorkflowSummary.java | 182 --------------- .../workflow/v1/model/WorkflowTemplate.java | 129 ----------- .../v1/model/WorkflowTemplateParameters.java | 128 ----------- .../WorkflowAssociationsApiServiceImpl.java | 8 +- .../v1/impl/WorkflowsApiServiceImpl.java | 8 +- 14 files changed, 28 insertions(+), 1418 deletions(-) delete mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociation.java delete mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociationCreation.java delete mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociationPatch.java delete mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowCreation.java delete mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowEngine.java delete mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowSummary.java delete mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowTemplate.java delete mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowTemplateParameters.java diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowAssociationsApi.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowAssociationsApi.java index bedd8cfedb..730f94882a 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowAssociationsApi.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowAssociationsApi.java @@ -19,15 +19,15 @@ package org.wso2.carbon.identity.rest.api.server.workflow.v1; import org.wso2.carbon.identity.rest.api.server.workflow.v1.factories.WorkflowAssociationsApiServiceFactory; -import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.Error; -import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowAssociation; -import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowAssociationCreation; -import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowAssociationPatch; import javax.validation.Valid; import javax.ws.rs.*; import javax.ws.rs.core.Response; import io.swagger.annotations.*; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowAssociation; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowAssociationCreation; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowAssociationPatch; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowAssociationSummary; import javax.validation.constraints.*; @@ -48,14 +48,14 @@ public WorkflowAssociationsApi() { @Consumes({ "application/json" }) @Produces({ "application/json" }) - @ApiOperation(value = "Create a new workflow association.", notes = "Create a new workflow association by assigning a user operation to an existing workflow. <b>Scope required:</b> * internal_workflow_associations_create ", response = WorkflowAssociation.class, authorizations = { + @ApiOperation(value = "Create a new workflow association.", notes = "Create a new workflow association by assigning a user operation to an existing workflow. <b>Scope required:</b> * internal_workflow_associations_create ", response = WorkflowAssociationCreation.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { }) }, tags={ }) @ApiResponses(value = { - @ApiResponse(code = 201, message = "Item Created", response = WorkflowAssociation.class), + @ApiResponse(code = 201, message = "Item Created", response = WorkflowAssociationCreation.class), @ApiResponse(code = 400, message = "Invalid input request", response = Error.class), @ApiResponse(code = 401, message = "Unauthorized", response = Void.class), @ApiResponse(code = 403, message = "Forbidden", response = Void.class), @@ -72,7 +72,7 @@ public Response createWorkflowAssociation(@ApiParam(value = "Contains the detail @Path("/{association-id}") @Produces({ "application/json" }) - @ApiOperation(value = "Delete the workflow association by association id.", notes = "Delete a specific workflow association identified by the association ID. <b>Scope required:</b> * internal_workflow_associations_view ", response = Void.class, authorizations = { + @ApiOperation(value = "Delete the workflow association by association-id.", notes = "Delete a specific workflow association identified by the association ID. <b>Scope required:</b> * internal_workflow_associations_view ", response = Void.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -96,7 +96,7 @@ public Response deleteWorkflowAssociationById(@ApiParam(value = "Workflow Associ @Path("/{association-id}") @Produces({ "application/json" }) - @ApiOperation(value = "Get the workflow association by association id.", notes = "Get a specific workflow association identified by the association id. <b>Scope required:</b> * internal_workflow_associations_view ", response = WorkflowAssociation.class, authorizations = { + @ApiOperation(value = "Get the workflow association by association-id.", notes = "Get a specific workflow association identified by the association id. <b>Scope required:</b> * internal_workflow_associations_view ", response = WorkflowAssociation.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -120,14 +120,14 @@ public Response getWorkflowAssociationById(@ApiParam(value = "Workflow Associati @Produces({ "application/json" }) - @ApiOperation(value = "Retrieve all the available workflow associations.", notes = "Retrieve all the available workflow associations in the system. <b>Scope required:</b> * internal_workflow_associations_view ", response = WorkflowAssociation.class, responseContainer = "List", authorizations = { + @ApiOperation(value = "Retrieve all the available workflow associations.", notes = "Retrieve all the available workflow associations in the system. <b>Scope required:</b> * internal_workflow_associations_view ", response = WorkflowAssociationSummary.class, responseContainer = "List", authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { }) }, tags={ }) @ApiResponses(value = { - @ApiResponse(code = 200, message = "Array of workflow associations matching the search criteria", response = WorkflowAssociation.class, responseContainer = "List"), + @ApiResponse(code = 200, message = "Array of workflow associations matching the search criteria", response = WorkflowAssociationSummary.class, responseContainer = "List"), @ApiResponse(code = 400, message = "Invalid input request", response = Error.class), @ApiResponse(code = 401, message = "Unauthorized", response = Void.class), @ApiResponse(code = 403, message = "Forbidden", response = Void.class), @@ -144,7 +144,7 @@ public Response listWorkflowAssociations( @Valid @Min(15)@ApiParam(value = "M @Path("/{association-id}") @Consumes({ "application/json" }) @Produces({ "application/json" }) - @ApiOperation(value = "Partially update association by ID ", notes = "Partially update an association by ID.<br> <b>Scope required:</b> <br> * internal_workflow_associations_update ", response = Void.class, authorizations = { + @ApiOperation(value = "Partially update association by association-id. ", notes = "Partially update an association by association-id.<br> <b>Scope required:</b> <br> * internal_workflow_associations_update ", response = Void.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowsApi.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowsApi.java index 23b39cfd7c..ff2ae260ec 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowsApi.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowsApi.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com). + * 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 @@ -19,9 +19,9 @@ package org.wso2.carbon.identity.rest.api.server.workflow.v1; import org.wso2.carbon.identity.rest.api.server.workflow.v1.factories.WorkflowsApiServiceFactory; -import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.DetailedWorkflow; import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.Error; import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowCreation; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowDetails; import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowSummary; import javax.validation.Valid; @@ -38,8 +38,7 @@ public class WorkflowsApi { private final WorkflowsApiService delegate; - public WorkflowsApi() { - + public WorkflowsApi(){ this.delegate = WorkflowsApiServiceFactory.getWorkflowsApi(); } @@ -96,14 +95,14 @@ public Response deleteWorkflowById(@ApiParam(value = "Workflow ID",required=true @Path("/{workflow-id}") @Produces({ "application/json" }) - @ApiOperation(value = "Retrieve the workflow by workflow id.", notes = "Retrieve information about a specific workflow identified by the workflow id. <b>Scope required:</b> * internal_workflow_view ", response = DetailedWorkflow.class, authorizations = { + @ApiOperation(value = "Retrieve the workflow by workflow id.", notes = "Retrieve information about a specific workflow identified by the workflow id. <b>Scope required:</b> * internal_workflow_view ", response = WorkflowDetails.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { }) }, tags={ }) @ApiResponses(value = { - @ApiResponse(code = 200, message = "Information about the workflow identified by the workflow-id.", response = DetailedWorkflow.class), + @ApiResponse(code = 200, message = "Information about the workflow identified by the workflow-id.", response = WorkflowDetails.class), @ApiResponse(code = 400, message = "Invalid input request", response = Error.class), @ApiResponse(code = 401, message = "Unauthorized", response = Void.class), @ApiResponse(code = 403, message = "Forbidden", response = Void.class), diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowAssociationsApiServiceFactory.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowAssociationsApiServiceFactory.java index 4aa54239a3..9d8106f6db 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowAssociationsApiServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowAssociationsApiServiceFactory.java @@ -25,9 +25,8 @@ public class WorkflowAssociationsApiServiceFactory { private final static WorkflowAssociationsApiService service = new WorkflowAssociationsApiServiceImpl(); - public static WorkflowAssociationsApiService getWorkflowAssociationsApi() { - + public static WorkflowAssociationsApiService getWorkflowAssociationsApi() + { return service; - } } diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowsApiServiceFactory.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowsApiServiceFactory.java index f0b792ef5c..af0e923edb 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowsApiServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowsApiServiceFactory.java @@ -25,9 +25,8 @@ public class WorkflowsApiServiceFactory { private final static WorkflowsApiService service = new WorkflowsApiServiceImpl(); - public static WorkflowsApiService getWorkflowsApi() { - + public static WorkflowsApiService getWorkflowsApi() + { return service; - } } diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociation.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociation.java deleted file mode 100644 index 3adc5c5f1b..0000000000 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociation.java +++ /dev/null @@ -1,204 +0,0 @@ -/* - * 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.rest.api.server.workflow.v1.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModelProperty; - - -import java.util.Objects; -import javax.validation.Valid; - -public class WorkflowAssociation { - - private String id; - private String workflowAssociationName; - private String operationName; - private String workflowName; - private String associationCondition; - private Boolean isEnabled; - - /** - * Unique id to represent a workflow association - **/ - public WorkflowAssociation id(String id) { - - this.id = id; - return this; - } - - @ApiModelProperty(example = "500", value = "Unique id to represent a workflow association") - @JsonProperty("id") - @Valid - public String getId() { - return id; - } - public void setId(String id) { - this.id = id; - } - - /** - * Name of the workflow association - **/ - public WorkflowAssociation workflowAssociationName(String workflowAssociationName) { - - this.workflowAssociationName = workflowAssociationName; - return this; - } - - @ApiModelProperty(example = "User registration Workflow Association", value = "Name of the workflow association") - @JsonProperty("workflowAssociationName") - @Valid - public String getWorkflowAssociationName() { - return workflowAssociationName; - } - public void setWorkflowAssociationName(String workflowAssociationName) { - this.workflowAssociationName = workflowAssociationName; - } - - /** - * User Operation - **/ - public WorkflowAssociation operationName(String operationName) { - - this.operationName = operationName; - return this; - } - - @ApiModelProperty(example = "Add User", value = "User Operation") - @JsonProperty("operationName") - @Valid - public String getOperationName() { - return operationName; - } - public void setOperationName(String operationName) { - this.operationName = operationName; - } - - /** - * Assigned Workflow - **/ - public WorkflowAssociation workflowName(String workflowName) { - - this.workflowName = workflowName; - return this; - } - - @ApiModelProperty(example = "User Registration Approval", value = "Assigned Workflow") - @JsonProperty("workflowName") - @Valid - public String getWorkflowName() { - return workflowName; - } - public void setWorkflowName(String workflowName) { - this.workflowName = workflowName; - } - - /** - * Assigned Association Condition - **/ - public WorkflowAssociation associationCondition(String associationCondition) { - - this.associationCondition = associationCondition; - return this; - } - - @ApiModelProperty(example = "Role equals Manager", value = "Assigned Association Condition") - @JsonProperty("associationCondition") - @Valid - public String getAssociationCondition() { - return associationCondition; - } - public void setAssociationCondition(String associationCondition) { - this.associationCondition = associationCondition; - } - - /** - * Association Status - **/ - public WorkflowAssociation isEnabled(Boolean isEnabled) { - - this.isEnabled = isEnabled; - return this; - } - - @ApiModelProperty(example = "true", value = "Association Status") - @JsonProperty("isEnabled") - @Valid - public Boolean getIsEnabled() { - return isEnabled; - } - public void setIsEnabled(Boolean isEnabled) { - this.isEnabled = isEnabled; - } - - - - @Override - public boolean equals(java.lang.Object o) { - - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - WorkflowAssociation workflowAssociation = (WorkflowAssociation) o; - return Objects.equals(this.id, workflowAssociation.id) && - Objects.equals(this.workflowAssociationName, workflowAssociation.workflowAssociationName) && - Objects.equals(this.operationName, workflowAssociation.operationName) && - Objects.equals(this.workflowName, workflowAssociation.workflowName) && - Objects.equals(this.associationCondition, workflowAssociation.associationCondition) && - Objects.equals(this.isEnabled, workflowAssociation.isEnabled); - } - - @Override - public int hashCode() { - return Objects.hash(id, workflowAssociationName, operationName, workflowName, associationCondition, isEnabled); - } - - @Override - public String toString() { - - StringBuilder sb = new StringBuilder(); - sb.append("class WorkflowAssociation {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" workflowAssociationName: ").append(toIndentedString(workflowAssociationName)).append("\n"); - sb.append(" operationName: ").append(toIndentedString(operationName)).append("\n"); - sb.append(" workflowName: ").append(toIndentedString(workflowName)).append("\n"); - sb.append(" associationCondition: ").append(toIndentedString(associationCondition)).append("\n"); - sb.append(" isEnabled: ").append(toIndentedString(isEnabled)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n"); - } -} - diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociationCreation.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociationCreation.java deleted file mode 100644 index 1fbcec088d..0000000000 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociationCreation.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * 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.rest.api.server.workflow.v1.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModelProperty; -import javax.validation.constraints.*; - - -import java.util.Objects; -import javax.validation.Valid; - -public class WorkflowAssociationCreation { - - private String associationName; - private String operationName; - private String workflowId; - private String associationCondition; - private Boolean isEnabled = true; - - /** - * Name of the workflow association - **/ - public WorkflowAssociationCreation associationName(String associationName) { - - this.associationName = associationName; - return this; - } - - @ApiModelProperty(example = "User Registration Workflow Association", required = true, value = "Name of the workflow association") - @JsonProperty("associationName") - @Valid - @NotNull(message = "Property associationName cannot be null.") - - public String getAssociationName() { - return associationName; - } - public void setAssociationName(String associationName) { - this.associationName = associationName; - } - - /** - * Name of the user operation - **/ - public WorkflowAssociationCreation operationName(String operationName) { - - this.operationName = operationName; - return this; - } - - @ApiModelProperty(example = "Add User", required = true, value = "Name of the user operation") - @JsonProperty("operationName") - @Valid - @NotNull(message = "Property operationName cannot be null.") - - public String getOperationName() { - return operationName; - } - public void setOperationName(String operationName) { - this.operationName = operationName; - } - - /** - * Id of the assigned workflow - **/ - public WorkflowAssociationCreation workflowId(String workflowId) { - - this.workflowId = workflowId; - return this; - } - - @ApiModelProperty(example = "456", required = true, value = "Id of the assigned workflow") - @JsonProperty("workflowId") - @Valid - @NotNull(message = "Property workflowId cannot be null.") - - public String getWorkflowId() { - return workflowId; - } - public void setWorkflowId(String workflowId) { - this.workflowId = workflowId; - } - - /** - * Condition added to the association - **/ - public WorkflowAssociationCreation associationCondition(String associationCondition) { - - this.associationCondition = associationCondition; - return this; - } - - @ApiModelProperty(example = "Role Name equals Manager", value = "Condition added to the association") - @JsonProperty("associationCondition") - @Valid - public String getAssociationCondition() { - return associationCondition; - } - public void setAssociationCondition(String associationCondition) { - this.associationCondition = associationCondition; - } - - /** - * Association Status - **/ - public WorkflowAssociationCreation isEnabled(Boolean isEnabled) { - - this.isEnabled = isEnabled; - return this; - } - - @ApiModelProperty(example = "true", value = "Association Status") - @JsonProperty("isEnabled") - @Valid - public Boolean getIsEnabled() { - return isEnabled; - } - public void setIsEnabled(Boolean isEnabled) { - this.isEnabled = isEnabled; - } - - - - @Override - public boolean equals(java.lang.Object o) { - - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - WorkflowAssociationCreation workflowAssociationCreation = (WorkflowAssociationCreation) o; - return Objects.equals(this.associationName, workflowAssociationCreation.associationName) && - Objects.equals(this.operationName, workflowAssociationCreation.operationName) && - Objects.equals(this.workflowId, workflowAssociationCreation.workflowId) && - Objects.equals(this.associationCondition, workflowAssociationCreation.associationCondition) && - Objects.equals(this.isEnabled, workflowAssociationCreation.isEnabled); - } - - @Override - public int hashCode() { - return Objects.hash(associationName, operationName, workflowId, associationCondition, isEnabled); - } - - @Override - public String toString() { - - StringBuilder sb = new StringBuilder(); - sb.append("class WorkflowAssociationCreation {\n"); - - sb.append(" associationName: ").append(toIndentedString(associationName)).append("\n"); - sb.append(" operationName: ").append(toIndentedString(operationName)).append("\n"); - sb.append(" workflowId: ").append(toIndentedString(workflowId)).append("\n"); - sb.append(" associationCondition: ").append(toIndentedString(associationCondition)).append("\n"); - sb.append(" isEnabled: ").append(toIndentedString(isEnabled)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n"); - } -} - diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociationPatch.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociationPatch.java deleted file mode 100644 index 9fb9498613..0000000000 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociationPatch.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * 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.rest.api.server.workflow.v1.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModelProperty; - - -import java.util.Objects; -import javax.validation.Valid; - -public class WorkflowAssociationPatch { - - private String associationName; - private String operationName; - private String workflowId; - private String associationCondition; - private Status associationStatus; - - /** - * Name of the workflow association - **/ - public WorkflowAssociationPatch associationName(String associationName) { - - this.associationName = associationName; - return this; - } - - @ApiModelProperty(example = "User Registration Workflow Association", value = "Name of the workflow association") - @JsonProperty("associationName") - @Valid - public String getAssociationName() { - return associationName; - } - public void setAssociationName(String associationName) { - this.associationName = associationName; - } - - /** - * Name of the user operation - **/ - public WorkflowAssociationPatch operationName(String operationName) { - - this.operationName = operationName; - return this; - } - - @ApiModelProperty(example = "Add User", value = "Name of the user operation") - @JsonProperty("operationName") - @Valid - public String getOperationName() { - return operationName; - } - public void setOperationName(String operationName) { - this.operationName = operationName; - } - - /** - * Id of the assigned workflow - **/ - public WorkflowAssociationPatch workflowId(String workflowId) { - - this.workflowId = workflowId; - return this; - } - - @ApiModelProperty(example = "456", value = "Id of the assigned workflow") - @JsonProperty("workflowId") - @Valid - public String getWorkflowId() { - return workflowId; - } - public void setWorkflowId(String workflowId) { - this.workflowId = workflowId; - } - - /** - * Condition added to the association - **/ - public WorkflowAssociationPatch associationCondition(String associationCondition) { - - this.associationCondition = associationCondition; - return this; - } - - @ApiModelProperty(example = "Role Name equals Manager", value = "Condition added to the association") - @JsonProperty("associationCondition") - @Valid - public String getAssociationCondition() { - return associationCondition; - } - public void setAssociationCondition(String associationCondition) { - this.associationCondition = associationCondition; - } - - /** - **/ - public WorkflowAssociationPatch associationStatus(Status associationStatus) { - - this.associationStatus = associationStatus; - return this; - } - - @ApiModelProperty(value = "") - @JsonProperty("associationStatus") - @Valid - public Status getAssociationStatus() { - return associationStatus; - } - public void setAssociationStatus(Status associationStatus) { - this.associationStatus = associationStatus; - } - - - - @Override - public boolean equals(java.lang.Object o) { - - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - WorkflowAssociationPatch workflowAssociationPatch = (WorkflowAssociationPatch) o; - return Objects.equals(this.associationName, workflowAssociationPatch.associationName) && - Objects.equals(this.operationName, workflowAssociationPatch.operationName) && - Objects.equals(this.workflowId, workflowAssociationPatch.workflowId) && - Objects.equals(this.associationCondition, workflowAssociationPatch.associationCondition) && - Objects.equals(this.associationStatus, workflowAssociationPatch.associationStatus); - } - - @Override - public int hashCode() { - return Objects.hash(associationName, operationName, workflowId, associationCondition, associationStatus); - } - - @Override - public String toString() { - - StringBuilder sb = new StringBuilder(); - sb.append("class WorkflowAssociationPatch {\n"); - - sb.append(" associationName: ").append(toIndentedString(associationName)).append("\n"); - sb.append(" operationName: ").append(toIndentedString(operationName)).append("\n"); - sb.append(" workflowId: ").append(toIndentedString(workflowId)).append("\n"); - sb.append(" associationCondition: ").append(toIndentedString(associationCondition)).append("\n"); - sb.append(" associationStatus: ").append(toIndentedString(associationStatus)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n"); - } -} - diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowCreation.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowCreation.java deleted file mode 100644 index 917db953bc..0000000000 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowCreation.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * 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.rest.api.server.workflow.v1.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModelProperty; - -import javax.validation.constraints.*; - - -import java.util.Objects; -import javax.validation.Valid; - -public class WorkflowCreation { - - private String workflowName; - private String workflowDescription; - private String workflowEngine; - private WorkflowTemplate workflowTemplate; - private String approvalTask; - private String approvalTaskDescription; - - /** - * Name of the created workflow - **/ - public WorkflowCreation workflowName(String workflowName) { - - this.workflowName = workflowName; - return this; - } - - @ApiModelProperty(example = "User Registration Workflow", required = true, value = "Name of the created workflow") - @JsonProperty("workflowName") - @Valid - @NotNull(message = "Property workflowName cannot be null.") - - public String getWorkflowName() { - return workflowName; - } - public void setWorkflowName(String workflowName) { - this.workflowName = workflowName; - } - - /** - * Description of the created workflow - **/ - public WorkflowCreation workflowDescription(String workflowDescription) { - - this.workflowDescription = workflowDescription; - return this; - } - - @ApiModelProperty(example = "Workflow to approve new user registrations before account activation", value = "Description of the created workflow") - @JsonProperty("workflowDescription") - @Valid - public String getWorkflowDescription() { - return workflowDescription; - } - public void setWorkflowDescription(String workflowDescription) { - this.workflowDescription = workflowDescription; - } - - /** - * Name of the selected workflow engine - **/ - public WorkflowCreation workflowEngine(String workflowEngine) { - - this.workflowEngine = workflowEngine; - return this; - } - - @ApiModelProperty(example = "Simple Workflow Engine", required = true, value = "Name of the selected workflow engine") - @JsonProperty("workflowEngine") - @Valid - @NotNull(message = "Property workflowEngine cannot be null.") - - public String getWorkflowEngine() { - return workflowEngine; - } - public void setWorkflowEngine(String workflowEngine) { - this.workflowEngine = workflowEngine; - } - - /** - **/ - public WorkflowCreation workflowTemplate(WorkflowTemplate workflowTemplate) { - - this.workflowTemplate = workflowTemplate; - return this; - } - - @ApiModelProperty(value = "") - @JsonProperty("workflowTemplate") - @Valid - public WorkflowTemplate getWorkflowTemplate() { - return workflowTemplate; - } - public void setWorkflowTemplate(WorkflowTemplate workflowTemplate) { - this.workflowTemplate = workflowTemplate; - } - - /** - * Approval task subject to display - **/ - public WorkflowCreation approvalTask(String approvalTask) { - - this.approvalTask = approvalTask; - return this; - } - - @ApiModelProperty(example = "User Registration Approval", required = true, value = "Approval task subject to display") - @JsonProperty("approvalTask") - @Valid - @NotNull(message = "Property approvalTask cannot be null.") - - public String getApprovalTask() { - return approvalTask; - } - public void setApprovalTask(String approvalTask) { - this.approvalTask = approvalTask; - } - - /** - * Description of the approval task - **/ - public WorkflowCreation approvalTaskDescription(String approvalTaskDescription) { - - this.approvalTaskDescription = approvalTaskDescription; - return this; - } - - @ApiModelProperty(example = "Approval task to validate and approve new user registrations before account activation", value = "Description of the approval task") - @JsonProperty("approvalTaskDescription") - @Valid - public String getApprovalTaskDescription() { - return approvalTaskDescription; - } - public void setApprovalTaskDescription(String approvalTaskDescription) { - this.approvalTaskDescription = approvalTaskDescription; - } - - - - @Override - public boolean equals(java.lang.Object o) { - - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - WorkflowCreation workflowCreation = (WorkflowCreation) o; - return Objects.equals(this.workflowName, workflowCreation.workflowName) && - Objects.equals(this.workflowDescription, workflowCreation.workflowDescription) && - Objects.equals(this.workflowEngine, workflowCreation.workflowEngine) && - Objects.equals(this.workflowTemplate, workflowCreation.workflowTemplate) && - Objects.equals(this.approvalTask, workflowCreation.approvalTask) && - Objects.equals(this.approvalTaskDescription, workflowCreation.approvalTaskDescription); - } - - @Override - public int hashCode() { - return Objects.hash(workflowName, workflowDescription, workflowEngine, workflowTemplate, approvalTask, approvalTaskDescription); - } - - @Override - public String toString() { - - StringBuilder sb = new StringBuilder(); - sb.append("class WorkflowCreation {\n"); - - sb.append(" workflowName: ").append(toIndentedString(workflowName)).append("\n"); - sb.append(" workflowDescription: ").append(toIndentedString(workflowDescription)).append("\n"); - sb.append(" workflowEngine: ").append(toIndentedString(workflowEngine)).append("\n"); - sb.append(" workflowTemplate: ").append(toIndentedString(workflowTemplate)).append("\n"); - sb.append(" approvalTask: ").append(toIndentedString(approvalTask)).append("\n"); - sb.append(" approvalTaskDescription: ").append(toIndentedString(approvalTaskDescription)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n"); - } -} - diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowEngine.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowEngine.java deleted file mode 100644 index 4af7eb1789..0000000000 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowEngine.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * 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.rest.api.server.workflow.v1.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModelProperty; -import javax.validation.constraints.*; - - -import java.util.Objects; -import javax.validation.Valid; - -public class WorkflowEngine { - - private String profileName; - private String workerHostURL; - private String managerHostURL; - private String userName; - - /** - * A unique name for the workflow engine. - **/ - public WorkflowEngine profileName(String profileName) { - - this.profileName = profileName; - return this; - } - - @ApiModelProperty(example = "embedded_bps", required = true, value = "A unique name for the workflow engine.") - @JsonProperty("profileName") - @Valid - @NotNull(message = "Property profileName cannot be null.") - - public String getProfileName() { - return profileName; - } - public void setProfileName(String profileName) { - this.profileName = profileName; - } - - /** - * URL of the workflow worker node. - **/ - public WorkflowEngine workerHostURL(String workerHostURL) { - - this.workerHostURL = workerHostURL; - return this; - } - - @ApiModelProperty(example = "https://localhost:9443/services", value = "URL of the workflow worker node.") - @JsonProperty("workerHostURL") - @Valid - public String getWorkerHostURL() { - return workerHostURL; - } - public void setWorkerHostURL(String workerHostURL) { - this.workerHostURL = workerHostURL; - } - - /** - * URL of the workflow manager node. - **/ - public WorkflowEngine managerHostURL(String managerHostURL) { - - this.managerHostURL = managerHostURL; - return this; - } - - @ApiModelProperty(example = "https://localhost:9443/services", value = "URL of the workflow manager node.") - @JsonProperty("managerHostURL") - @Valid - public String getManagerHostURL() { - return managerHostURL; - } - public void setManagerHostURL(String managerHostURL) { - this.managerHostURL = managerHostURL; - } - - /** - * Username of the creator of the workflow engine. - **/ - public WorkflowEngine userName(String userName) { - - this.userName = userName; - return this; - } - - @ApiModelProperty(example = "challengeQuestion1", value = "Username of the creator of the workflow engine.") - @JsonProperty("userName") - @Valid - public String getUserName() { - return userName; - } - public void setUserName(String userName) { - this.userName = userName; - } - - - - @Override - public boolean equals(java.lang.Object o) { - - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - WorkflowEngine workflowEngine = (WorkflowEngine) o; - return Objects.equals(this.profileName, workflowEngine.profileName) && - Objects.equals(this.workerHostURL, workflowEngine.workerHostURL) && - Objects.equals(this.managerHostURL, workflowEngine.managerHostURL) && - Objects.equals(this.userName, workflowEngine.userName); - } - - @Override - public int hashCode() { - return Objects.hash(profileName, workerHostURL, managerHostURL, userName); - } - - @Override - public String toString() { - - StringBuilder sb = new StringBuilder(); - sb.append("class WorkflowEngine {\n"); - - sb.append(" profileName: ").append(toIndentedString(profileName)).append("\n"); - sb.append(" workerHostURL: ").append(toIndentedString(workerHostURL)).append("\n"); - sb.append(" managerHostURL: ").append(toIndentedString(managerHostURL)).append("\n"); - sb.append(" userName: ").append(toIndentedString(userName)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n"); - } -} - diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowSummary.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowSummary.java deleted file mode 100644 index adf5d569cb..0000000000 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowSummary.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * 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.rest.api.server.workflow.v1.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModelProperty; - - -import java.util.Objects; -import javax.validation.Valid; - -public class WorkflowSummary { - - private String id; - private String workflowName; - private String workflowDescription; - private String workflowEngine; - private String workflowTemplate; - - /** - * Unique id to represent a workflow - **/ - public WorkflowSummary id(String id) { - - this.id = id; - return this; - } - - @ApiModelProperty(example = "100", value = "Unique id to represent a workflow") - @JsonProperty("id") - @Valid - public String getId() { - return id; - } - public void setId(String id) { - this.id = id; - } - - /** - * Display name of the workflow - **/ - public WorkflowSummary workflowName(String workflowName) { - - this.workflowName = workflowName; - return this; - } - - @ApiModelProperty(example = "User Role Approval", value = "Display name of the workflow") - @JsonProperty("workflowName") - @Valid - public String getWorkflowName() { - return workflowName; - } - public void setWorkflowName(String workflowName) { - this.workflowName = workflowName; - } - - /** - * Detailed description of the workflow - **/ - public WorkflowSummary workflowDescription(String workflowDescription) { - - this.workflowDescription = workflowDescription; - return this; - } - - @ApiModelProperty(example = "Workflow to approve new user registrations before account activation", value = "Detailed description of the workflow") - @JsonProperty("workflowDescription") - @Valid - public String getWorkflowDescription() { - return workflowDescription; - } - public void setWorkflowDescription(String workflowDescription) { - this.workflowDescription = workflowDescription; - } - - /** - * Category in which the workflow is deployed - **/ - public WorkflowSummary workflowEngine(String workflowEngine) { - - this.workflowEngine = workflowEngine; - return this; - } - - @ApiModelProperty(example = "Simple Workflow Engine", value = "Category in which the workflow is deployed") - @JsonProperty("workflowEngine") - @Valid - public String getWorkflowEngine() { - return workflowEngine; - } - public void setWorkflowEngine(String workflowEngine) { - this.workflowEngine = workflowEngine; - } - - /** - * Template defining the approval process for the workflow - **/ - public WorkflowSummary workflowTemplate(String workflowTemplate) { - - this.workflowTemplate = workflowTemplate; - return this; - } - - @ApiModelProperty(example = "MultiStepApprovalTemplate", value = "Template defining the approval process for the workflow") - @JsonProperty("workflowTemplate") - @Valid - public String getWorkflowTemplate() { - return workflowTemplate; - } - public void setWorkflowTemplate(String workflowTemplate) { - this.workflowTemplate = workflowTemplate; - } - - - - @Override - public boolean equals(java.lang.Object o) { - - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - WorkflowSummary workflowSummary = (WorkflowSummary) o; - return Objects.equals(this.id, workflowSummary.id) && - Objects.equals(this.workflowName, workflowSummary.workflowName) && - Objects.equals(this.workflowDescription, workflowSummary.workflowDescription) && - Objects.equals(this.workflowEngine, workflowSummary.workflowEngine) && - Objects.equals(this.workflowTemplate, workflowSummary.workflowTemplate); - } - - @Override - public int hashCode() { - return Objects.hash(id, workflowName, workflowDescription, workflowEngine, workflowTemplate); - } - - @Override - public String toString() { - - StringBuilder sb = new StringBuilder(); - sb.append("class WorkflowSummary {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" workflowName: ").append(toIndentedString(workflowName)).append("\n"); - sb.append(" workflowDescription: ").append(toIndentedString(workflowDescription)).append("\n"); - sb.append(" workflowEngine: ").append(toIndentedString(workflowEngine)).append("\n"); - sb.append(" workflowTemplate: ").append(toIndentedString(workflowTemplate)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n"); - } -} - diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowTemplate.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowTemplate.java deleted file mode 100644 index 3e283c5d29..0000000000 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowTemplate.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * 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.rest.api.server.workflow.v1.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModelProperty; -import java.util.ArrayList; -import java.util.List; -import javax.validation.constraints.*; - - -import java.util.Objects; -import javax.validation.Valid; - -public class WorkflowTemplate { - - private String name; - private List<WorkflowTemplateParameters> steps = null; - - - /** - * Name of the workflow template - **/ - public WorkflowTemplate name(String name) { - - this.name = name; - return this; - } - - @ApiModelProperty(example = "MultiStepApproval", required = true, value = "Name of the workflow template") - @JsonProperty("name") - @Valid - @NotNull(message = "Property name cannot be null.") - - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - /** - **/ - public WorkflowTemplate steps(List<WorkflowTemplateParameters> steps) { - - this.steps = steps; - return this; - } - - @ApiModelProperty(value = "") - @JsonProperty("steps") - @Valid @Size(min=1) - public List<WorkflowTemplateParameters> getSteps() { - return steps; - } - public void setSteps(List<WorkflowTemplateParameters> steps) { - this.steps = steps; - } - - public WorkflowTemplate addStepsItem(WorkflowTemplateParameters stepsItem) { - if (this.steps == null) { - this.steps = new ArrayList<>(); - } - this.steps.add(stepsItem); - return this; - } - - - - @Override - public boolean equals(java.lang.Object o) { - - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - WorkflowTemplate workflowTemplate = (WorkflowTemplate) o; - return Objects.equals(this.name, workflowTemplate.name) && - Objects.equals(this.steps, workflowTemplate.steps); - } - - @Override - public int hashCode() { - return Objects.hash(name, steps); - } - - @Override - public String toString() { - - StringBuilder sb = new StringBuilder(); - sb.append("class WorkflowTemplate {\n"); - - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" steps: ").append(toIndentedString(steps)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n"); - } -} - diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowTemplateParameters.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowTemplateParameters.java deleted file mode 100644 index 2e362ff0c0..0000000000 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowTemplateParameters.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * 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.rest.api.server.workflow.v1.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModelProperty; -import java.util.ArrayList; -import java.util.List; -import javax.validation.constraints.*; - - -import java.util.Objects; -import javax.validation.Valid; - -public class WorkflowTemplateParameters { - - private Integer step; - private List<OptionDetails> options = null; - - - /** - **/ - public WorkflowTemplateParameters step(Integer step) { - - this.step = step; - return this; - } - - @ApiModelProperty(example = "1", required = true, value = "") - @JsonProperty("steps") - @Valid - @NotNull(message = "Property steps cannot be null.") - - public Integer getSteps() { - return step; - } - public void setSteps(Integer steps) { - this.step = step; - } - - /** - **/ - public WorkflowTemplateParameters options(List<OptionDetails> options) { - - this.options = options; - return this; - } - - @ApiModelProperty(example = "[{\"entity\":\"roles\",\"values\":\"admin\"},{\"entity\":\"users\",\"values\":\"John\"}]", value = "") - @JsonProperty("options") - @Valid @Size(min=1) - public List<OptionDetails> getOptions() { - return options; - } - public void setOptions(List<OptionDetails> options) { - this.options = options; - } - - public WorkflowTemplateParameters addOptionsItem(OptionDetails optionsItem) { - if (this.options == null) { - this.options = new ArrayList<>(); - } - this.options.add(optionsItem); - return this; - } - - - - @Override - public boolean equals(java.lang.Object o) { - - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - WorkflowTemplateParameters workflowTemplateParameters = (WorkflowTemplateParameters) o; - return Objects.equals(this.step, workflowTemplateParameters.step) && - Objects.equals(this.options, workflowTemplateParameters.options); - } - - @Override - public int hashCode() { - return Objects.hash(step, options); - } - - @Override - public String toString() { - - StringBuilder sb = new StringBuilder(); - sb.append("class WorkflowTemplateParameters {\n"); - - sb.append(" steps: ").append(toIndentedString(step)).append("\n"); - sb.append(" options: ").append(toIndentedString(options)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n"); - } -} - diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowAssociationsApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowAssociationsApiServiceImpl.java index 637c014554..5897207784 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowAssociationsApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowAssociationsApiServiceImpl.java @@ -19,12 +19,10 @@ package org.wso2.carbon.identity.rest.api.server.workflow.v1.impl; import org.wso2.carbon.identity.rest.api.server.workflow.v1.*; -import org.wso2.carbon.identity.rest.api.server.workflow.v1.WorkflowAssociationsApiService; import org.wso2.carbon.identity.rest.api.server.workflow.v1.core.WorkflowService; import org.wso2.carbon.identity.rest.api.server.workflow.v1.factories.WorkflowServiceFactory; import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.*; -import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowAssociationCreation; -import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowAssociationPatch; +import java.util.List; import javax.ws.rs.core.Response; @@ -62,8 +60,8 @@ public Response listWorkflowAssociations(Integer limit, Integer offset, String f } @Override - public Response patchAssociation(String associationId, WorkflowAssociationPatch workflowAssociationPatch) { + public Response patchAssociation(String associationId, WorkflowAssociationPatch workflowAssociation) { - return Response.ok().entity(workflowService.changeAssociation(associationId, workflowAssociationPatch)).build(); + return Response.ok().entity(workflowService.changeAssociation(associationId, workflowAssociation)).build(); } } diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowsApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowsApiServiceImpl.java index 1373e07bbd..432e1e694f 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowsApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowsApiServiceImpl.java @@ -19,11 +19,9 @@ package org.wso2.carbon.identity.rest.api.server.workflow.v1.impl; import org.wso2.carbon.identity.rest.api.server.workflow.v1.*; -import org.wso2.carbon.identity.rest.api.server.workflow.v1.WorkflowsApiService; import org.wso2.carbon.identity.rest.api.server.workflow.v1.core.WorkflowService; import org.wso2.carbon.identity.rest.api.server.workflow.v1.factories.WorkflowServiceFactory; import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.*; -import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowCreation; import javax.ws.rs.core.Response; @@ -33,7 +31,11 @@ public class WorkflowsApiServiceImpl implements WorkflowsApiService { public WorkflowsApiServiceImpl() { - this.workflowService = WorkflowServiceFactory.getWorkflowService(); + try { + this.workflowService = WorkflowServiceFactory.getWorkflowService(); + } catch (IllegalStateException e) { + throw new RuntimeException("Error occurred while initiating Workflow.", e); + } } @Override From 8a9dc6a20f55a75f5355c4814d0b0a3e0c682d49 Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Sun, 9 Mar 2025 12:37:37 +0530 Subject: [PATCH 31/47] Update the implementation logic according to the changes --- .../workflow/v1/core/WorkflowService.java | 166 ++++++++---------- 1 file changed, 69 insertions(+), 97 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowService.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowService.java index 978ca0b4e6..5d53d8fc80 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowService.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowService.java @@ -63,36 +63,32 @@ public WorkflowSummary addWorkflow(WorkflowCreation workflow) { try { String workflowId = UUID.randomUUID().toString(); workflowBean = createWorkflow(workflow, workflowId); - List<WorkflowTemplateParameters> templateProperties = workflow.getWorkflowTemplate().getSteps(); + List<WorkflowTemplateParameters> templateProperties = workflow.getTemplate().getSteps(); List<Parameter> parameterList = new ArrayList<>(); for (WorkflowTemplateParameters properties : templateProperties) { for (OptionDetails options : properties.getOptions()) { - Parameter parameter = setWorkflowImplParameters(null, "UserAndRole", - options.getValues(), - "UserAndRole-step-" + properties.getSteps() + "-" + options.getEntity(), - "Template"); + Parameter parameter = setWorkflowImplParameters(null, Constants.APPROVAL_STEPS, + String.join(",", options.getValues()), + Constants.APPROVAL_STEP + properties.getStep() + "-" + options.getEntity(), + Constants.TEMPLATE); parameterList.add(parameter); } } - Parameter taskParameterDesc = setWorkflowImplParameters(null, "HTDescription", - workflow.getApprovalTaskDescription(), "HTDescription", "Workflowimpl"); + Parameter taskParameterDesc = setWorkflowImplParameters(null, Constants.APPROVAL_TASK_DESCRIPTION, + workflow.getApprovalTaskDescription(), Constants.APPROVAL_TASK_DESCRIPTION, Constants.WORKFLOW_IMPLEMENTATION); parameterList.add(taskParameterDesc); - Parameter taskParameterSubject = setWorkflowImplParameters(null, "HTSubject", - workflow.getApprovalTask(), "HTSubject", "Workflowimpl"); + Parameter taskParameterSubject = setWorkflowImplParameters(null, Constants.APPROVAL_TASK_SUBJECT, + workflow.getApprovalTask(), Constants.APPROVAL_TASK_SUBJECT, Constants.WORKFLOW_IMPLEMENTATION); parameterList.add(taskParameterSubject); - Parameter workflowParameter = setWorkflowImplParameters(workflowId, "WorkflowName", - workflow.getWorkflowName(), "WorkflowName", "Workflowimpl"); - parameterList.add(workflowParameter); - workflowManagementService.addWorkflow(workflowBean, parameterList, CarbonContext.getThreadLocalCarbonContext().getTenantId()); workflowSummary = getWorkflow(workflowBean); } catch (WorkflowClientException e) { - throw handleClientError(Constants.ErrorMessage.ERROR_CODE_ERROR_ADDING_WORKFLOW, null, e); + throw handleClientError(Constants.ErrorMessage.ERROR_CODE_CLIENT_ERROR_ADDING_WORKFLOW, null, e); } catch (WorkflowException e) { throw handleServerError(Constants.ErrorMessage.ERROR_CODE_ERROR_ADDING_WORKFLOW, null, e); } @@ -114,39 +110,35 @@ public WorkflowSummary updateWorkflow(WorkflowCreation workflow, String workflow Workflow existingWorkflow = workflowManagementService.getWorkflow(workflowId); if (existingWorkflow == null) { - throw new WorkflowClientException("Invalid Workflow ID provided"); + throw new WorkflowClientException("Workflow with ID: " + workflowId + "doesn't exist"); } workflowBean = createWorkflow(workflow, workflowId); - List<WorkflowTemplateParameters> templateProperties = workflow.getWorkflowTemplate().getSteps(); + List<WorkflowTemplateParameters> templateProperties = workflow.getTemplate().getSteps(); List<Parameter> parameterList = new ArrayList<>(); for (WorkflowTemplateParameters properties : templateProperties) { for (OptionDetails options : properties.getOptions()) { - Parameter parameter = setWorkflowImplParameters(workflowId, "UserAndRole", - options.getValues(), - "UserAndRole-step-" + properties.getSteps() + "-" + options.getEntity(), - "Template"); + Parameter parameter = setWorkflowImplParameters(workflowId, Constants.APPROVAL_STEPS, + String.join(",", options.getValues()), + Constants.APPROVAL_STEP + properties.getStep() + "-" + options.getEntity(), + Constants.TEMPLATE); parameterList.add(parameter); } } - Parameter taskParameterDesc = setWorkflowImplParameters(workflowId, "HTDescription", - workflow.getApprovalTaskDescription(), "HTDescription", "Workflowimpl"); + Parameter taskParameterDesc = setWorkflowImplParameters(workflowId, Constants.APPROVAL_TASK_DESCRIPTION, + workflow.getApprovalTaskDescription(), Constants.APPROVAL_TASK_DESCRIPTION, Constants.TEMPLATE); parameterList.add(taskParameterDesc); - Parameter taskParameterSubject = setWorkflowImplParameters(workflowId, "HTSubject", - workflow.getApprovalTask(), "HTSubject", "Workflowimpl"); + Parameter taskParameterSubject = setWorkflowImplParameters(workflowId, Constants.APPROVAL_TASK_SUBJECT, + workflow.getApprovalTask(), Constants.APPROVAL_TASK_SUBJECT, Constants.WORKFLOW_IMPLEMENTATION); parameterList.add(taskParameterSubject); - Parameter workflowParameter = setWorkflowImplParameters(workflowId, "WorkflowName", - workflow.getWorkflowName(), "WorkflowName", "Workflowimpl"); - parameterList.add(workflowParameter); - workflowManagementService.addWorkflow(workflowBean, parameterList, CarbonContext.getThreadLocalCarbonContext().getTenantId()); workflowSummary = getWorkflow(workflowBean); } catch (WorkflowClientException e) { - throw handleClientError(Constants.ErrorMessage.ERROR_CODE_ERROR_UPDATING_WORKFLOW, workflowId, e); + throw handleClientError(Constants.ErrorMessage.ERROR_CODE_CLIENT_ERROR_UPDATING_WORKFLOW, workflowId, e); } catch (WorkflowException e) { throw handleServerError(Constants.ErrorMessage.ERROR_CODE_ERROR_UPDATING_WORKFLOW, workflowId, e); } @@ -160,7 +152,7 @@ public WorkflowSummary updateWorkflow(WorkflowCreation workflow, String workflow * @param workflowId workflow id * @return DetailedWorkflow */ - public DetailedWorkflow getWorkflow(String workflowId) { + public WorkflowDetails getWorkflow(String workflowId) { try { Workflow workflowBean = workflowManagementService.getWorkflow(workflowId); @@ -170,9 +162,9 @@ public DetailedWorkflow getWorkflow(String workflowId) { throw handleException(Response.Status.NOT_FOUND, Constants.ErrorMessage.ERROR_CODE_WORKFLOW_NOT_FOUND, workflowId); } - return getDetailedWorkflow(workflowBean, workflowParameters); + return getWorkflowDetails(workflowBean, workflowParameters); } catch (WorkflowClientException e) { - throw handleClientError(Constants.ErrorMessage.ERROR_CODE_ERROR_RETRIEVING_WORKFLOW, workflowId, e); + throw handleClientError(Constants.ErrorMessage.ERROR_CODE_WORKFLOW_NOT_FOUND, workflowId, e); } catch (WorkflowException e) { throw handleServerError(Constants.ErrorMessage.ERROR_CODE_ERROR_RETRIEVING_WORKFLOW, workflowId, e); } @@ -206,7 +198,7 @@ public WorkflowSummary[] listPaginatedWorkflows(Integer limit, Integer offset, S } return workflowSummaryList.toArray(new WorkflowSummary[workflowSummaryList.size()]); } catch (WorkflowClientException e) { - throw handleClientError(Constants.ErrorMessage.ERROR_CODE_ERROR_LISTING_WORKFLOWS, null, e); + throw handleClientError(Constants.ErrorMessage.ERROR_CODE_CLIENT_ERROR_LISTING_WORKFLOWS, null, e); } catch (WorkflowException e) { throw handleServerError(Constants.ErrorMessage.ERROR_CODE_ERROR_LISTING_WORKFLOWS, null, e); @@ -226,7 +218,7 @@ public String removeWorkflow(String workflowId) { workflowManagementService.removeWorkflow(workflowId); return "Workflow successfully removed!"; } catch (WorkflowClientException e) { - throw handleClientError(Constants.ErrorMessage.ERROR_CODE_ERROR_REMOVING_WORKFLOW, workflowId, e); + throw handleClientError(Constants.ErrorMessage.ERROR_CODE_WORKFLOW_NOT_FOUND, workflowId, e); } catch (WorkflowException e) { throw handleServerError(Constants.ErrorMessage.ERROR_CODE_ERROR_REMOVING_WORKFLOW, workflowId, e); } @@ -259,7 +251,7 @@ public WorkflowAssociation[] listPaginatedAssociations(Integer limit, Integer of associations.add(associationTmp); } } catch (WorkflowClientException e) { - throw handleClientError(Constants.ErrorMessage.ERROR_CODE_ERROR_LISTING_ASSOCIATIONS, null, e); + throw handleClientError(Constants.ErrorMessage.ERROR_CODE_CLIENT_ERROR_LISTING_ASSOCIATIONS, null, e); } catch (WorkflowException e) { throw handleServerError(Constants.ErrorMessage.ERROR_CODE_ERROR_LISTING_ASSOCIATIONS, null, e); } @@ -280,12 +272,12 @@ public String removeAssociation(String associationId) { try { Association association = workflowManagementService.getAssociation(associationId); if (association == null) { - throw new WorkflowClientException("Invalid Association ID provided"); + throw new WorkflowClientException("Workflow association with ID: " + associationId + "doesn't exist"); } workflowManagementService.removeAssociation(Integer.parseInt(associationId)); return "Workflow association successfully removed!"; } catch (WorkflowClientException e) { - throw handleClientError(Constants.ErrorMessage.ERROR_CODE_ERROR_REMOVING_ASSOCIATION, associationId, e); + throw handleClientError(Constants.ErrorMessage.ERROR_CODE_ASSOCIATION_NOT_FOUND, associationId, e); } catch (WorkflowException e) { throw handleServerError(Constants.ErrorMessage.ERROR_CODE_ERROR_REMOVING_ASSOCIATION, associationId, e); } @@ -307,17 +299,17 @@ private String addAssociation(String associationName, String workflowId, String WorkflowEvent event = workflowManagementService.getEvent(eventId); if (workflowBean == null) { - throw new WorkflowClientException("Invalid workflow ID provided."); + throw new WorkflowClientException("Workflow with ID: " + workflowId + "doesn't exist"); } if (event == null) { - throw new WorkflowClientException("Invalid event ID provided."); + throw new WorkflowClientException("Event with ID: " + eventId + "doesn't exist"); } workflowManagementService.addAssociation(associationName, workflowId, eventId, condition); return "Workflow Association successfully added!"; } catch (WorkflowClientException e) { - throw handleClientError(Constants.ErrorMessage.ERROR_CODE_ERROR_ADDING_ASSOCIATION, null, e); + throw handleClientError(Constants.ErrorMessage.ERROR_CODE_CLIENT_ERROR_ADDING_ASSOCIATION, null, e); } catch (WorkflowException e) { throw handleServerError(Constants.ErrorMessage.ERROR_CODE_ERROR_ADDING_ASSOCIATION, null, e); } @@ -326,7 +318,7 @@ private String addAssociation(String associationName, String workflowId, String public String addAssociation(WorkflowAssociationCreation workflowAssociation) { return addAssociation(workflowAssociation.getAssociationName(), workflowAssociation.getWorkflowId(), - workflowAssociation.getOperationName(), workflowAssociation.getAssociationCondition()); + workflowAssociation.getOperation().toString(), workflowAssociation.getAssociationCondition()); } /** @@ -337,7 +329,6 @@ public String addAssociation(WorkflowAssociationCreation workflowAssociation) { */ public WorkflowAssociation getAssociation(String associationId) { - WorkflowAssociation workflowAssociation = new WorkflowAssociation(); try { Association association = workflowManagementService.getAssociation(associationId); if (association == null) { @@ -347,7 +338,7 @@ public WorkflowAssociation getAssociation(String associationId) { } return getAssociation(association); } catch (WorkflowClientException e) { - throw handleClientError(Constants.ErrorMessage.ERROR_CODE_ERROR_RETRIEVING_ASSOCIATION, associationId, e); + throw handleClientError(Constants.ErrorMessage.ERROR_CODE_ASSOCIATION_NOT_FOUND, associationId, e); } catch (WorkflowException e) { throw handleServerError(Constants.ErrorMessage.ERROR_CODE_ERROR_RETRIEVING_ASSOCIATION, associationId, e); } @@ -363,32 +354,18 @@ public WorkflowAssociation getAssociation(String associationId) { public String changeAssociation(String associationId, WorkflowAssociationPatch workflowAssociation) { try { - boolean isEnable = getAssociationState(associationId, workflowAssociation.getAssociationStatus()); + boolean isEnable = workflowAssociation.getIsEnabled(); workflowManagementService.changeAssociation(associationId, workflowAssociation.getAssociationName(), - workflowAssociation.getWorkflowId(), workflowAssociation.getOperationName(), + workflowAssociation.getWorkflowId(), workflowAssociation.getOperation().toString(), workflowAssociation.getAssociationCondition(), isEnable); return "Workflow association successfully updated!"; } catch (WorkflowClientException e) { - throw handleClientError(Constants.ErrorMessage.ERROR_CODE_ERROR_UPDATING_ASSOCIATION, associationId, e); + throw handleClientError(Constants.ErrorMessage.ERROR_CODE_CLIENT_ERROR_UPDATING_ASSOCIATION, associationId, e); } catch (WorkflowException e) { throw handleServerError(Constants.ErrorMessage.ERROR_CODE_ERROR_UPDATING_ASSOCIATION, associationId, e); } } - private boolean getAssociationState(String associationId, Status status) { - - boolean isEnable; - try { - if (status == null) { - isEnable = workflowManagementService.getAssociation(associationId).isEnabled(); - } else { - isEnable = (status.getAction() == ActionStatus.ENABLE); - } - return isEnable; - } catch (WorkflowException e) { - throw handleServerError(Constants.ErrorMessage.ERROR_CODE_ERROR_RETRIEVING_ASSOCIATION, associationId, e); - } - } private WorkflowSummary getWorkflow(Workflow workflowBean) { @@ -396,10 +373,10 @@ private WorkflowSummary getWorkflow(Workflow workflowBean) { if (workflowBean != null) { workflow = new WorkflowSummary(); workflow.setId(workflowBean.getWorkflowId()); - workflow.setWorkflowName(workflowBean.getWorkflowName()); - workflow.setWorkflowDescription(workflowBean.getWorkflowDescription()); - workflow.setWorkflowTemplate(workflowBean.getTemplateId()); - workflow.setWorkflowEngine(workflowBean.getWorkflowImplId()); + workflow.setName(workflowBean.getWorkflowName()); + workflow.setDescription(workflowBean.getWorkflowDescription()); + workflow.setTemplate(workflowBean.getTemplateId()); + workflow.setEngine(workflowBean.getWorkflowImplId()); } return workflow; } @@ -410,11 +387,10 @@ private WorkflowAssociation getAssociation(Association associationBean) { if (associationBean != null) { association = new WorkflowAssociation(); - association.setId(associationBean.getWorkflowId()); - association.setWorkflowAssociationName(associationBean.getAssociationName()); - association.setOperationName(associationBean.getEventName()); + association.setId(associationBean.getAssociationId()); + association.setAssociationName(associationBean.getAssociationName()); + association.setOperation(Operation.valueOf(associationBean.getEventId())); association.setWorkflowName(associationBean.getWorkflowName()); - association.setAssociationCondition(associationBean.getCondition()); association.setIsEnabled(associationBean.isEnabled()); } return association; @@ -436,15 +412,15 @@ private Workflow createWorkflow(WorkflowCreation workflow, String workflowId) th Workflow workflowBean = new Workflow(); workflowBean.setWorkflowId(workflowId); - workflowBean.setWorkflowName(workflow.getWorkflowName()); - workflowBean.setWorkflowDescription(workflow.getWorkflowDescription()); - String templateId = workflow.getWorkflowTemplate().getName(); + workflowBean.setWorkflowName(workflow.getName()); + workflowBean.setWorkflowDescription(workflow.getDescription()); + String templateId = workflow.getTemplate().getName(); if (templateId == null) { throw new WorkflowException("Template id can't be empty"); } workflowBean.setTemplateId(templateId); - String workflowImplId = workflow.getWorkflowEngine(); + String workflowImplId = workflow.getEngine(); if (workflowImplId == null) { throw new WorkflowException("Workflowimpl id can't be empty"); @@ -453,36 +429,32 @@ private Workflow createWorkflow(WorkflowCreation workflow, String workflowId) th return workflowBean; } - private DetailedWorkflow getDetailedWorkflow(Workflow workflowBean, List<Parameter> workflowParameters) + private WorkflowDetails getWorkflowDetails(Workflow workflowBean, List<Parameter> workflowParameters) throws WorkflowException { - DetailedWorkflow detailedWorkflow = new DetailedWorkflow(); - detailedWorkflow.setWorkflowName(workflowBean.getWorkflowName()); - detailedWorkflow.setWorkflowDescription(workflowBean.getWorkflowDescription()); - DetailedWorkflowTemplate workflowTemplate = new DetailedWorkflowTemplate(); + WorkflowDetails detailedWorkflow = new WorkflowDetails(); + detailedWorkflow.setName(workflowBean.getWorkflowName()); + detailedWorkflow.setDescription(workflowBean.getWorkflowDescription()); + WorkflowTemplateBase workflowTemplate = new WorkflowTemplateBase(); workflowTemplate.setName(workflowBean.getTemplateId()); - Template template = workflowManagementService.getTemplate(workflowBean.getTemplateId()); - workflowTemplate.setTemplateDescription(template.getDescription()); - - List<WorkflowTemplateParameters> additionalProperties = new ArrayList<>(); - Map<Integer, WorkflowTemplateParameters> templateParamsMap = new HashMap<>(); + Map<Integer, WorkflowTemplateParametersBase> templateParamsMap = new HashMap<>(); for (Parameter parameter : workflowParameters) { - if ("Template".equals(parameter.getHolder())) { + if (Constants.TEMPLATE.equals(parameter.getHolder())) { String[] params = parameter.getqName().split("-"); - int stepNumber = Integer.parseInt(params[2]); + int stepNumber = Integer.parseInt(params[1]); // Check if there's already a WorkflowTemplateParameters object for this step - WorkflowTemplateParameters templateParameters = templateParamsMap.getOrDefault(stepNumber, - new WorkflowTemplateParameters()); - templateParameters.setSteps(stepNumber); + WorkflowTemplateParametersBase templateParameters = templateParamsMap.getOrDefault(stepNumber, + new WorkflowTemplateParametersBase()); + templateParameters.setStep(stepNumber); // Create and add new OptionDetails OptionDetails details = new OptionDetails(); - details.setEntity(params[3]); - details.setValues(parameter.getParamValue()); + details.setEntity(params[2]); + details.setValues(Arrays.asList(parameter.getParamValue().split(","))); // Ensure the list exists and add new details if (templateParameters.getOptions() == null) { @@ -492,19 +464,19 @@ private DetailedWorkflow getDetailedWorkflow(Workflow workflowBean, List<Paramet // Update the map templateParamsMap.put(stepNumber, templateParameters); - } else if ("HTSubject".equals(parameter.getParamName())) { + } else if (Constants.WORKFLOW_IMPLEMENTATION.equals(parameter.getHolder())) { - if (parameter.getParamName().equals("HTSubject")) { + if (parameter.getParamName().equals(Constants.APPROVAL_TASK_SUBJECT)) { detailedWorkflow.setApprovalTask(parameter.getParamValue()); - } else if ("HTDescription".equals(parameter.getParamName())) { + } else if (Constants.APPROVAL_TASK_DESCRIPTION.equals(parameter.getParamName())) { detailedWorkflow.setApprovalTaskDescription(parameter.getParamValue()); } } } - List<WorkflowTemplateParameters> templateParams = new ArrayList<>(templateParamsMap.values()); - workflowTemplate.setProperties(templateParams); - detailedWorkflow.setWorkflowTemplate(workflowTemplate); - detailedWorkflow.setWorkflowEngine(workflowBean.getWorkflowImplId()); + List<WorkflowTemplateParametersBase> templateParams = new ArrayList<>(templateParamsMap.values()); + workflowTemplate.setSteps(templateParams); + detailedWorkflow.setTemplate(workflowTemplate); + detailedWorkflow.setEngine(workflowBean.getWorkflowImplId()); return detailedWorkflow; } @@ -566,7 +538,7 @@ private APIError handleClientError(Constants.ErrorMessage errorEnum, String data if (e.getMessage() != null) { String errorMessage = e.getMessage(); errorResponse = getErrorBuilder(errorEnum, data).build(log, e.getMessage()); - errorResponse.setMessage(errorMessage); + errorResponse.setDescription(errorMessage); } else { errorResponse = getErrorBuilder(errorEnum, data).build(log, e, includeData(e.getMessage(), data)); } From 49811bf462e11285f47aa9cc5011d8b65257f9be Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Sun, 9 Mar 2025 12:38:40 +0530 Subject: [PATCH 32/47] Update pom file with new file names and artifact ids --- .../pom.xml | 3 ++- .../pom.xml | 20 ++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.api.server.workflow.common/pom.xml b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.api.server.workflow.common/pom.xml index da5fd4ce81..0c11fc1095 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.api.server.workflow.common/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.api.server.workflow.common/pom.xml @@ -24,7 +24,7 @@ <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.wso2.carbon.identity.server.api</groupId> - <artifactId>workflow</artifactId> + <artifactId>org.wso2.carbon.identity.api.server.workflow</artifactId> <relativePath>../pom.xml</relativePath> <version>1.3.84-SNAPSHOT</version> </parent> @@ -53,6 +53,7 @@ <dependency> <groupId>org.wso2.carbon.identity.workflow.impl.bps</groupId> <artifactId>org.wso2.carbon.identity.workflow.impl</artifactId> + <scope>provided</scope> </dependency> </dependencies> </project> diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/pom.xml b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/pom.xml index 66ba86c3d7..f2d723d159 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/pom.xml @@ -47,13 +47,13 @@ <!-- <goal>generate</goal>--> <!-- </goals>--> <!-- <configuration>--> -<!-- <inputSpec>${project.basedir}/src/main/resources/workflow-engine.yaml</inputSpec>--> +<!-- <inputSpec>${project.basedir}/src/main/resources/workflow.yaml</inputSpec>--> <!-- <generatorName>org.wso2.carbon.codegen.CxfWso2Generator</generatorName>--> <!-- <configOptions>--> <!-- <sourceFolder>src/gen/java</sourceFolder>--> -<!-- <apiPackage>org.wso2.carbon.identity.rest.api.server.workflow.engine.v1</apiPackage>--> -<!-- <modelPackage>org.wso2.carbon.identity.rest.api.server.workflow.engine.v1.model</modelPackage>--> -<!-- <packageName>org.wso2.carbon.identity.rest.api.server.workflow.engine.v1</packageName>--> +<!-- <apiPackage>org.wso2.carbon.identity.rest.api.server.workflow.v1</apiPackage>--> +<!-- <modelPackage>org.wso2.carbon.identity.rest.api.server.workflow.v1.model</modelPackage>--> +<!-- <packageName>org.wso2.carbon.identity.rest.api.server.workflow.v1</packageName>--> <!-- <dateLibrary>java8</dateLibrary>--> <!-- <hideGenerationTimestamp>true</hideGenerationTimestamp>--> <!-- </configOptions>--> @@ -164,6 +164,16 @@ <artifactId>org.wso2.carbon.identity.api.server.common</artifactId> <scope>provided</scope> </dependency> - </dependencies> + <dependency> + <groupId>org.wso2.carbon.identity.server.api</groupId> + <artifactId>org.wso2.carbon.identity.api.server.workflow.common</artifactId> + <version>1.3.84-SNAPSHOT</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.wso2.carbon.identity.workflow.impl.bps</groupId> + <artifactId>org.wso2.carbon.identity.workflow.mgt</artifactId> + </dependency> + </dependencies> </project> From b2957d54ad4e0a34608b9f359b987409d3ab6991 Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Sun, 9 Mar 2025 17:56:35 +0530 Subject: [PATCH 33/47] Improve formatting --- .../v1/core/WorkflowEngineConstants.java | 10 ++- .../v1/core/WorkflowEngineService.java | 62 +++++++++++++++++++ 2 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowEngineService.java diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowEngineConstants.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowEngineConstants.java index 6f4787fc12..6f0367474c 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowEngineConstants.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowEngineConstants.java @@ -23,7 +23,7 @@ */ public class WorkflowEngineConstants { - public static final String WORKFLOW_ENGINE_PREFIX = "BPS-"; + public static final String WORKFLOW_ENGINE_PREFIX = "WE-"; /** * Enum for server workflow engine related errors in the format of @@ -42,27 +42,31 @@ public enum ErrorMessage { private final String description; ErrorMessage(String code, String message, String description) { + this.code = code; this.message = message; this.description = description; } public String getCode() { + return WorkflowEngineConstants.WORKFLOW_ENGINE_PREFIX + code; } public String getMessage() { + return message; } public String getDescription() { + return description; } @Override public String toString() { + return code + " | " + message; } - - } + } } diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowEngineService.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowEngineService.java new file mode 100644 index 0000000000..2f34b23928 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowEngineService.java @@ -0,0 +1,62 @@ +/* + * 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.rest.api.server.workflow.v1.core; + +import org.wso2.carbon.identity.api.server.common.ContextLoader; +import org.wso2.carbon.identity.api.server.common.error.APIError; +import org.wso2.carbon.identity.api.server.common.error.ErrorResponse; +import org.wso2.carbon.identity.api.server.workflow.common.WorkflowServiceHolder; +import org.wso2.carbon.identity.core.util.IdentityTenantUtil; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.core.function.BPSProfilesToExternal; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.dto.WorkFlowEngineDTO; +import org.wso2.carbon.identity.workflow.impl.WorkflowImplException; + +import java.util.List; +import java.util.stream.Collectors; +import javax.ws.rs.core.Response; + +import static org.wso2.carbon.identity.rest.api.server.workflow.v1.core.WorkflowEngineConstants.ErrorMessage.ERROR_CODE_ERROR_RETRIEVING_BPS_PROFILES; + +/** + * Workflow engine service class + */ +public class WorkflowEngineService { + + public List<WorkFlowEngineDTO> listWorkflowEngines() { + + try { + return WorkflowServiceHolder.getWorkflowImplService() + .listBPSProfiles(IdentityTenantUtil.getTenantId(ContextLoader.getTenantDomainFromContext())) + .stream().map(new BPSProfilesToExternal()).collect(Collectors.toList()); + } catch (WorkflowImplException e) { + throw handleError(Response.Status.INTERNAL_SERVER_ERROR, ERROR_CODE_ERROR_RETRIEVING_BPS_PROFILES); + } + } + + private APIError handleError(Response.Status status, WorkflowEngineConstants.ErrorMessage error) { + + return new APIError(status, getErrorBuilder(error).build()); + } + + private ErrorResponse.Builder getErrorBuilder(WorkflowEngineConstants.ErrorMessage errorMsg) { + + return new ErrorResponse.Builder().withCode(errorMsg.getCode()).withMessage(errorMsg.getMessage()) + .withDescription(errorMsg.getDescription()); + } +} From 5c0d4eaf3e496bd6242000ee333527ab3601e4b1 Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Sun, 9 Mar 2025 18:35:29 +0530 Subject: [PATCH 34/47] Improve formatting and remove unwanted files --- .../api/server/workflow/v1/dto/ErrorDTO.java | 105 ------------ .../api/server/workflow/v1/model/Error.java | 161 ------------------ .../workflow/v1/model/OptionDetails.java | 119 ------------- .../v1/core/WorkFLowEngineService.java | 80 --------- .../v1/factories/WorkflowServiceFactory.java | 1 - 5 files changed, 466 deletions(-) delete mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/dto/ErrorDTO.java delete mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/Error.java delete mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/OptionDetails.java delete mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkFLowEngineService.java diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/dto/ErrorDTO.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/dto/ErrorDTO.java deleted file mode 100644 index 72e7cbc88d..0000000000 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/dto/ErrorDTO.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * 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.rest.api.server.workflow.v1.dto; - - -import io.swagger.annotations.*; -import com.fasterxml.jackson.annotation.*; - -import javax.validation.constraints.NotNull; - -@ApiModel(description = "") -public class ErrorDTO { - - - @NotNull - private String code = null; - - @NotNull - private String message = null; - - - private String description = null; - - - private String traceId = null; - - - /** - **/ - @ApiModelProperty(required = true, value = "") - @JsonProperty("code") - public String getCode() { - return code; - } - public void setCode(String code) { - this.code = code; - } - - - /** - **/ - @ApiModelProperty(required = true, value = "") - @JsonProperty("message") - public String getMessage() { - return message; - } - public void setMessage(String message) { - this.message = message; - } - - - /** - **/ - @ApiModelProperty(value = "") - @JsonProperty("description") - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } - - - /** - **/ - @ApiModelProperty(value = "") - @JsonProperty("traceId") - public String getTraceId() { - return traceId; - } - public void setTraceId(String traceId) { - this.traceId = traceId; - } - - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ErrorDTO {\n"); - - sb.append(" code: ").append(code).append("\n"); - sb.append(" message: ").append(message).append("\n"); - sb.append(" description: ").append(description).append("\n"); - sb.append(" traceId: ").append(traceId).append("\n"); - sb.append("}\n"); - return sb.toString(); - } -} diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/Error.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/Error.java deleted file mode 100644 index df7c6f72dd..0000000000 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/Error.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * 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.rest.api.server.workflow.v1.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModelProperty; -import javax.validation.constraints.*; - - -import java.util.Objects; -import javax.validation.Valid; - -public class Error { - - private String code; - private String message; - private String description; - private String traceId; - - /** - **/ - public Error code(String code) { - - this.code = code; - return this; - } - - @ApiModelProperty(example = "some_error_code", required = true, value = "") - @JsonProperty("code") - @Valid - @NotNull(message = "Property code cannot be null.") - - public String getCode() { - return code; - } - public void setCode(String code) { - this.code = code; - } - - /** - **/ - public Error message(String message) { - - this.message = message; - return this; - } - - @ApiModelProperty(example = "Some Error Message", required = true, value = "") - @JsonProperty("message") - @Valid - @NotNull(message = "Property message cannot be null.") - - public String getMessage() { - return message; - } - public void setMessage(String message) { - this.message = message; - } - - /** - **/ - public Error description(String description) { - - this.description = description; - return this; - } - - @ApiModelProperty(example = "Some Error Description", value = "") - @JsonProperty("description") - @Valid - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } - - /** - **/ - public Error traceId(String traceId) { - - this.traceId = traceId; - return this; - } - - @ApiModelProperty(example = "Some Trace ID", value = "") - @JsonProperty("traceId") - @Valid - public String getTraceId() { - return traceId; - } - public void setTraceId(String traceId) { - this.traceId = traceId; - } - - - - @Override - public boolean equals(java.lang.Object o) { - - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Error error = (Error) o; - return Objects.equals(this.code, error.code) && - Objects.equals(this.message, error.message) && - Objects.equals(this.description, error.description) && - Objects.equals(this.traceId, error.traceId); - } - - @Override - public int hashCode() { - return Objects.hash(code, message, description, traceId); - } - - @Override - public String toString() { - - StringBuilder sb = new StringBuilder(); - sb.append("class Error {\n"); - - sb.append(" code: ").append(toIndentedString(code)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" traceId: ").append(toIndentedString(traceId)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n"); - } -} - diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/OptionDetails.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/OptionDetails.java deleted file mode 100644 index 778e83e197..0000000000 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/OptionDetails.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * 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.rest.api.server.workflow.v1.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModelProperty; -import javax.validation.constraints.*; - - -import java.util.Objects; -import javax.validation.Valid; - -public class OptionDetails { - - private String entity; - private String values; - - /** - **/ - public OptionDetails entity(String entity) { - - this.entity = entity; - return this; - } - - @ApiModelProperty(example = "roles", required = true, value = "") - @JsonProperty("entity") - @Valid - @NotNull(message = "Property entity cannot be null.") - - public String getEntity() { - return entity; - } - public void setEntity(String entity) { - this.entity = entity; - } - - /** - **/ - public OptionDetails values(String values) { - - this.values = values; - return this; - } - - @ApiModelProperty(example = "admin", required = true, value = "") - @JsonProperty("values") - @Valid - @NotNull(message = "Property values cannot be null.") - - public String getValues() { - return values; - } - public void setValues(String values) { - this.values = values; - } - - - - @Override - public boolean equals(java.lang.Object o) { - - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - OptionDetails optionDetails = (OptionDetails) o; - return Objects.equals(this.entity, optionDetails.entity) && - Objects.equals(this.values, optionDetails.values); - } - - @Override - public int hashCode() { - return Objects.hash(entity, values); - } - - @Override - public String toString() { - - StringBuilder sb = new StringBuilder(); - sb.append("class OptionDetails {\n"); - - sb.append(" entity: ").append(toIndentedString(entity)).append("\n"); - sb.append(" values: ").append(toIndentedString(values)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n"); - } -} - diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkFLowEngineService.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkFLowEngineService.java deleted file mode 100644 index 9e24cdb7b8..0000000000 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkFLowEngineService.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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.rest.api.server.workflow.v1.core; - -import org.wso2.carbon.identity.api.server.common.ContextLoader; -import org.wso2.carbon.identity.api.server.common.error.APIError; -import org.wso2.carbon.identity.api.server.common.error.ErrorResponse; -import org.wso2.carbon.identity.api.server.workflow.common.WorkflowServiceHolder; -import org.wso2.carbon.identity.core.util.IdentityTenantUtil; -import org.wso2.carbon.identity.rest.api.server.workflow.v1.WorkflowEnginesApi; -import org.wso2.carbon.identity.rest.api.server.workflow.v1.core.function.BPSProfilesToExternal; -import org.wso2.carbon.identity.rest.api.server.workflow.v1.dto.WorkFlowEngineDTO; -import org.wso2.carbon.identity.workflow.impl.WorkflowImplException; -import org.wso2.carbon.identity.workflow.impl.WorkflowImplServiceImpl; - -import java.util.List; -import java.util.stream.Collectors; -import javax.ws.rs.core.Response; - -import static org.wso2.carbon.identity.rest.api.server.workflow.v1.core.WorkflowEngineConstants.ErrorMessage.ERROR_CODE_ERROR_RETRIEVING_BPS_PROFILES; - -/** - * Workflow engine service class - */ -public class WorkFLowEngineService { - - private WorkflowImplServiceImpl getWorkflowService() { - - return new WorkflowImplServiceImpl(); - /** - * TODO - * Improve https://github.com/wso2-extensions/identity-workflow-impl-bps to register as a service and - * refer the osgi service here - */ - } - - private WorkflowImplServiceImpl workflowImplService; - - public WorkFLowEngineService() { - - this.workflowImplService = WorkflowServiceHolder.getWorkflowImplService() ; - } - - public List<WorkFlowEngineDTO> listWorkflowEngines() { - - try { - return getWorkflowService() - .listBPSProfiles(IdentityTenantUtil.getTenantId(ContextLoader.getTenantDomainFromContext())) - .stream().map(new BPSProfilesToExternal()).collect(Collectors.toList()); - } catch (WorkflowImplException e) { - throw handleError(Response.Status.INTERNAL_SERVER_ERROR, ERROR_CODE_ERROR_RETRIEVING_BPS_PROFILES); - } - } - - private APIError handleError(Response.Status status, WorkflowEngineConstants.ErrorMessage error) { - return new APIError(status, getErrorBuilder(error).build()); - } - - private ErrorResponse.Builder getErrorBuilder(WorkflowEngineConstants.ErrorMessage errorMsg) { - - return new ErrorResponse.Builder().withCode(errorMsg.getCode()).withMessage(errorMsg.getMessage()) - .withDescription(errorMsg.getDescription()); - } -} diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowServiceFactory.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowServiceFactory.java index a70d57619b..c51a02eae4 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowServiceFactory.java @@ -43,5 +43,4 @@ public static WorkflowService getWorkflowService() { return SERVICE; } - } From 5a3a0366ada46b2a53e8bf415b8011eb2a46fa2b Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Sun, 9 Mar 2025 18:36:46 +0530 Subject: [PATCH 35/47] Change return type of some methods and update response --- .../workflow/v1/core/WorkflowService.java | 79 ++++++++++--------- .../WorkflowAssociationsApiServiceImpl.java | 8 +- .../v1/impl/WorkflowsApiServiceImpl.java | 6 +- 3 files changed, 49 insertions(+), 44 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowService.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowService.java index 5d53d8fc80..ed54d46f61 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowService.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowService.java @@ -31,7 +31,6 @@ import org.wso2.carbon.identity.workflow.mgt.bean.Parameter; import org.wso2.carbon.identity.workflow.mgt.bean.Workflow; import org.wso2.carbon.identity.workflow.mgt.dto.Association; -import org.wso2.carbon.identity.workflow.mgt.dto.Template; import org.wso2.carbon.identity.workflow.mgt.dto.WorkflowEvent; import org.wso2.carbon.identity.workflow.mgt.exception.WorkflowClientException; import org.wso2.carbon.identity.workflow.mgt.exception.WorkflowException; @@ -100,9 +99,9 @@ public WorkflowSummary addWorkflow(WorkflowCreation workflow) { * * @param workflow Workflow details * @param workflowId Workflow ID - * @return WorkflowSummary + * @return */ - public WorkflowSummary updateWorkflow(WorkflowCreation workflow, String workflowId) { + public void updateWorkflow(WorkflowCreation workflow, String workflowId) { WorkflowSummary workflowSummary; Workflow workflowBean; @@ -110,7 +109,7 @@ public WorkflowSummary updateWorkflow(WorkflowCreation workflow, String workflow Workflow existingWorkflow = workflowManagementService.getWorkflow(workflowId); if (existingWorkflow == null) { - throw new WorkflowClientException("Workflow with ID: " + workflowId + "doesn't exist"); + throw new WorkflowClientException("A workflow with ID: " + workflowId + "doesn't exist."); } workflowBean = createWorkflow(workflow, workflowId); List<WorkflowTemplateParameters> templateProperties = workflow.getTemplate().getSteps(); @@ -136,13 +135,11 @@ public WorkflowSummary updateWorkflow(WorkflowCreation workflow, String workflow workflowManagementService.addWorkflow(workflowBean, parameterList, CarbonContext.getThreadLocalCarbonContext().getTenantId()); - workflowSummary = getWorkflow(workflowBean); } catch (WorkflowClientException e) { throw handleClientError(Constants.ErrorMessage.ERROR_CODE_CLIENT_ERROR_UPDATING_WORKFLOW, workflowId, e); } catch (WorkflowException e) { throw handleServerError(Constants.ErrorMessage.ERROR_CODE_ERROR_UPDATING_WORKFLOW, workflowId, e); } - return workflowSummary; } @@ -150,7 +147,7 @@ public WorkflowSummary updateWorkflow(WorkflowCreation workflow, String workflow * Retrieve workflow from workflow ID * * @param workflowId workflow id - * @return DetailedWorkflow + * @return WorkflowDetails */ public WorkflowDetails getWorkflow(String workflowId) { @@ -210,13 +207,12 @@ public WorkflowSummary[] listPaginatedWorkflows(Integer limit, Integer offset, S * Remove a workflow by a given workflow ID * * @param workflowId ID of workflow to remove - * @return Return Success Message + * @return */ - public String removeWorkflow(String workflowId) { + public void removeWorkflow(String workflowId) { try { workflowManagementService.removeWorkflow(workflowId); - return "Workflow successfully removed!"; } catch (WorkflowClientException e) { throw handleClientError(Constants.ErrorMessage.ERROR_CODE_WORKFLOW_NOT_FOUND, workflowId, e); } catch (WorkflowException e) { @@ -247,8 +243,7 @@ public WorkflowAssociation[] listPaginatedAssociations(Integer limit, Integer of associationBeans = workflowManagementService.listPaginatedAssociations( CarbonContext.getThreadLocalCarbonContext().getTenantId(), limit, offset, filter); for (Association associationBean : associationBeans) { - WorkflowAssociation associationTmp = getAssociation(associationBean); - associations.add(associationTmp); + associations.add(getAssociation(associationBean)); } } catch (WorkflowClientException e) { throw handleClientError(Constants.ErrorMessage.ERROR_CODE_CLIENT_ERROR_LISTING_ASSOCIATIONS, null, e); @@ -267,15 +262,15 @@ public WorkflowAssociation[] listPaginatedAssociations(Integer limit, Integer of * @param associationId ID of association to remove * @return Success message */ - public String removeAssociation(String associationId) { + public void removeAssociation(String associationId) { try { Association association = workflowManagementService.getAssociation(associationId); if (association == null) { - throw new WorkflowClientException("Workflow association with ID: " + associationId + "doesn't exist"); + throw new WorkflowClientException("A workflow association with ID: " + associationId + + "doesn't exist."); } workflowManagementService.removeAssociation(Integer.parseInt(associationId)); - return "Workflow association successfully removed!"; } catch (WorkflowClientException e) { throw handleClientError(Constants.ErrorMessage.ERROR_CODE_ASSOCIATION_NOT_FOUND, associationId, e); } catch (WorkflowException e) { @@ -286,28 +281,29 @@ public String removeAssociation(String associationId) { /** * Add new workflow association * - * @param associationName Name for the association - * @param workflowId Workflow to associate - * @param eventId Event to associate - * @param condition Condition to check the event for associating + * @param workflowAssociation Workflow association details * @return Return success message */ - private String addAssociation(String associationName, String workflowId, String eventId, String condition) { + public WorkflowAssociationCreation addAssociation(WorkflowAssociationCreation workflowAssociation) { try { - Workflow workflowBean = workflowManagementService.getWorkflow(workflowId); - WorkflowEvent event = workflowManagementService.getEvent(eventId); + Workflow workflowBean = workflowManagementService.getWorkflow(workflowAssociation.getWorkflowId()); + WorkflowEvent event = workflowManagementService.getEvent(workflowAssociation.getOperation().toString()); if (workflowBean == null) { - throw new WorkflowClientException("Workflow with ID: " + workflowId + "doesn't exist"); + throw new WorkflowClientException("A workflow with ID: " + + workflowAssociation.getWorkflowId() + "doesn't exist."); } if (event == null) { - throw new WorkflowClientException("Event with ID: " + eventId + "doesn't exist"); + throw new WorkflowClientException("An event with ID: " + + workflowAssociation.getOperation().toString() + "doesn't exist."); } - workflowManagementService.addAssociation(associationName, workflowId, eventId, condition); - return "Workflow Association successfully added!"; + workflowManagementService.addAssociation(workflowAssociation.getAssociationName(), + workflowAssociation.getWorkflowId(), workflowAssociation.getOperation().toString(), + workflowAssociation.getAssociationCondition()); + return workflowAssociation; } catch (WorkflowClientException e) { throw handleClientError(Constants.ErrorMessage.ERROR_CODE_CLIENT_ERROR_ADDING_ASSOCIATION, null, e); } catch (WorkflowException e) { @@ -315,12 +311,6 @@ private String addAssociation(String associationName, String workflowId, String } } - public String addAssociation(WorkflowAssociationCreation workflowAssociation) { - - return addAssociation(workflowAssociation.getAssociationName(), workflowAssociation.getWorkflowId(), - workflowAssociation.getOperation().toString(), workflowAssociation.getAssociationCondition()); - } - /** * Get an association by ID * @@ -349,16 +339,27 @@ public WorkflowAssociation getAssociation(String associationId) { * * @param associationId Association ID * @param workflowAssociation Association Details - * @return Success message + * @return */ - public String changeAssociation(String associationId, WorkflowAssociationPatch workflowAssociation) { + public void changeAssociation(String associationId, WorkflowAssociationPatch workflowAssociation) { + boolean isEnable; + String eventId; try { - boolean isEnable = workflowAssociation.getIsEnabled(); + if (workflowAssociation.getIsEnabled() == null) { + isEnable = workflowManagementService.getAssociation(associationId).isEnabled(); + } else { + isEnable = workflowAssociation.getIsEnabled(); + } + + if (workflowAssociation.getOperation() == null) { + eventId = null; + } else { + eventId = workflowAssociation.getOperation().toString(); + } workflowManagementService.changeAssociation(associationId, workflowAssociation.getAssociationName(), - workflowAssociation.getWorkflowId(), workflowAssociation.getOperation().toString(), + workflowAssociation.getWorkflowId(), eventId, workflowAssociation.getAssociationCondition(), isEnable); - return "Workflow association successfully updated!"; } catch (WorkflowClientException e) { throw handleClientError(Constants.ErrorMessage.ERROR_CODE_CLIENT_ERROR_UPDATING_ASSOCIATION, associationId, e); } catch (WorkflowException e) { @@ -417,13 +418,13 @@ private Workflow createWorkflow(WorkflowCreation workflow, String workflowId) th String templateId = workflow.getTemplate().getName(); if (templateId == null) { - throw new WorkflowException("Template id can't be empty"); + throw new WorkflowException("Template ID can't be empty"); } workflowBean.setTemplateId(templateId); String workflowImplId = workflow.getEngine(); if (workflowImplId == null) { - throw new WorkflowException("Workflowimpl id can't be empty"); + throw new WorkflowException("Workflowimpl ID can't be empty"); } workflowBean.setWorkflowImplId(workflowImplId); return workflowBean; diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowAssociationsApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowAssociationsApiServiceImpl.java index 5897207784..98a2871fb0 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowAssociationsApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowAssociationsApiServiceImpl.java @@ -32,7 +32,7 @@ public class WorkflowAssociationsApiServiceImpl implements WorkflowAssociationsA public WorkflowAssociationsApiServiceImpl() { - this.workflowService = WorkflowServiceFactory.getWorkflowService(); + this.workflowService = WorkflowServiceFactory.getWorkflowService(); } @Override @@ -44,7 +44,8 @@ public Response createWorkflowAssociation(WorkflowAssociationCreation workflowAs @Override public Response deleteWorkflowAssociationById(String associationId) { - return Response.ok().entity(workflowService.removeAssociation(associationId)).build(); + workflowService.removeAssociation(associationId); + return Response.ok().build(); } @Override @@ -62,6 +63,7 @@ public Response listWorkflowAssociations(Integer limit, Integer offset, String f @Override public Response patchAssociation(String associationId, WorkflowAssociationPatch workflowAssociation) { - return Response.ok().entity(workflowService.changeAssociation(associationId, workflowAssociation)).build(); + workflowService.changeAssociation(associationId, workflowAssociation); + return Response.ok().build(); } } diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowsApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowsApiServiceImpl.java index 432e1e694f..62756c24dc 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowsApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowsApiServiceImpl.java @@ -47,7 +47,8 @@ public Response createWorkflow(WorkflowCreation workflowCreation) { @Override public Response deleteWorkflowById(String workflowId) { - return Response.ok().entity(workflowService.removeWorkflow(workflowId)).build(); + workflowService.removeWorkflow(workflowId); + return Response.ok().build(); } @Override @@ -65,6 +66,7 @@ public Response listWorkflows(Integer limit, Integer offset, String filter) { @Override public Response updateWorkflow(String workflowId, WorkflowCreation workflowCreation) { - return Response.ok().entity(workflowService.updateWorkflow(workflowCreation, workflowId)).build(); + workflowService.updateWorkflow(workflowCreation, workflowId); + return Response.ok().build(); } } From 18f514f6ce0a39ca9d2a7912341f038e0471ada6 Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Sun, 9 Mar 2025 18:37:22 +0530 Subject: [PATCH 36/47] Update dependencies --- .../org.wso2.carbon.identity.rest.api.server.workflow.v1/pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/pom.xml b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/pom.xml index f2d723d159..5c8013ef72 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/pom.xml @@ -167,7 +167,6 @@ <dependency> <groupId>org.wso2.carbon.identity.server.api</groupId> <artifactId>org.wso2.carbon.identity.api.server.workflow.common</artifactId> - <version>1.3.84-SNAPSHOT</version> <scope>compile</scope> </dependency> <dependency> From ab73c7d37d71225ce94282661e807d14d71fe5b8 Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Sun, 9 Mar 2025 18:37:34 +0530 Subject: [PATCH 37/47] Update dependencies --- pom.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pom.xml b/pom.xml index 3829e30646..a4bf5e8945 100644 --- a/pom.xml +++ b/pom.xml @@ -251,17 +251,25 @@ <groupId>org.wso2.carbon.identity.workflow.impl.bps</groupId> <artifactId>org.wso2.carbon.identity.workflow.impl</artifactId> <version>${workflow.imple.bps.version}</version> + <scope>provided</scope> </dependency> <dependency> <groupId>org.wso2.carbon.identity.workflow.impl.bps</groupId> <artifactId>org.wso2.carbon.identity.workflow.mgt</artifactId> <version>${workflow.imple.bps.version}</version> + <scope>provided</scope> </dependency> <dependency> <groupId>org.wso2.carbon.identity.server.api</groupId> <artifactId>org.wso2.carbon.identity.api.server.common</artifactId> + <version>${project.version}</version> <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.wso2.carbon.identity.server.api</groupId> + <artifactId>org.wso2.carbon.identity.api.server.workflow.common</artifactId> <version>${project.version}</version> + <scope>compile</scope> </dependency> <dependency> <groupId>org.wso2.carbon.identity.server.api</groupId> From 15694749b3634579a020681b0817ff986cc1afcc Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Wed, 12 Mar 2025 15:13:31 +0530 Subject: [PATCH 38/47] Update the API specification --- .../src/main/resources/workflow.yaml | 110 +++++++++++++++--- 1 file changed, 93 insertions(+), 17 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/resources/workflow.yaml b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/resources/workflow.yaml index aa39cee365..73b6116c9e 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/resources/workflow.yaml +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/resources/workflow.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: - title: WorkFlow Engine - description: This is the RESTful API for managing WorkFlow Engines in WSO2 Identity + title: Workflows + description: This is the RESTful API for managing workflows in WSO2 Identity Server contact: name: WSO2 Identity Server @@ -117,13 +117,27 @@ paths: content: 'application/json': schema: - $ref: '#/components/schemas/WorkflowSummary' + $ref: '#/components/schemas/WorkflowDetails' example: id: "100" name: User Approval Workflow description: Workflow to approve user role related requests engine: Simple Workflow Engine - template: MultiStepApprovalTemplate + template: + name: MultiStepApprovalTemplate + steps: + - step: 1 + options: + - entity: roles + values: + - admin + - manager + - entity: users + values: + - John + - Tom + approvalTask: Approval Required + approvalTaskDescription: Your approval is needed to complete this task '400': $ref: '#/components/responses/InvalidInput' '401': @@ -179,9 +193,50 @@ paths: 'application/json': schema: $ref: '#/components/schemas/WorkflowCreation' + example: + id: "100" + name: User Approval Workflow + description: Workflow to approve user role related requests + engine: Simple Workflow Engine + template: + name: MultiStepApprovalTemplate + steps: + - step: 1 + options: + - entity: roles + values: + - admin + - entity: users + values: + - John + approvalTask: Approval Required + approvalTaskDescription: Your approval is needed to complete this task + responses: '200': - $ref: '#/components/responses/Updated' + description: Information about the workflow identified by the workflow-id. + content: + 'application/json': + schema: + $ref: '#/components/schemas/WorkflowDetails' + example: + id: "100" + name: User Approval Workflow + description: Workflow to approve user role related requests + engine: Simple Workflow Engine + template: + name: MultiStepApprovalTemplate + steps: + - step: 1 + options: + - entity: roles + values: + - admin + - entity: users + values: + - John + approvalTask: Approval Required + approvalTaskDescription: Your approval is needed to complete this task '400': $ref: '#/components/responses/InvalidInput' '401': @@ -236,7 +291,7 @@ paths: schema: type: array items: - $ref: '#/components/schemas/WorkflowAssociationSummary' + $ref: '#/components/schemas/WorkflowAssociation' example: - id: "500" associationName: User Registration Workflow Association @@ -313,13 +368,13 @@ paths: content: 'application/json': schema: - $ref: '#/components/schemas/WorkflowAssociation' + $ref: '#/components/schemas/WorkflowAssociationDetails' example: id: "500" associationName: User Registration Workflow Association operation: ADD_USER workflowName: User Approval Workflow - associationCondition: Username equals John + associationCondition: //*[local-name()='parameter'][@name='Username']/*[local-name()='value']/*[local-name()='itemValue']/text()='John' isEnabled: true '400': $ref: '#/components/responses/InvalidInput' @@ -357,7 +412,7 @@ paths: patch: summary: | Partially update association by association-id. - operationId: patchAssociation + operationId: updateAssociation description: | Partially update an association by association-id.<br> @@ -374,12 +429,23 @@ paths: example: associationName: User Registration Workflow Association operation: ADD_USER - workflowId: "500" - associationCondition: Role Name equals Employee + workflowId: "100" + associationCondition: //*[local-name()='parameter'][@name='Rolename']/*[local-name()='value']/*[local-name()='itemValue']/text()='Employee' isEnabled: true responses: '200': description: Successfully Updated + content: + 'application/json': + schema: + $ref: '#/components/schemas/WorkflowAssociationDetails' + example: + id: "500" + associationName: User Registration Workflow Association + operation: ADD_USER + workflowName: User Approval Workflow + associationCondition: //*[local-name()='parameter'][@name='Username']/*[local-name()='value']/*[local-name()='itemValue']/text()='John' + isEnabled: true '400': description: Bad Request content: @@ -455,6 +521,10 @@ components: WorkflowDetails: type: object properties: + id: + type: string + example: "100" + description: "Id of the workflow" name: type: string example: "User Approval Workflow" @@ -516,7 +586,7 @@ components: properties: name: type: string - example: "MultiStepApproval" + example: "MultiStepApprovalTemplate" description: "Name of the workflow template" steps: type: array @@ -621,7 +691,7 @@ components: example: true description: "Association Status" - WorkflowAssociationSummary: + WorkflowAssociationDetails: type: object properties: id: @@ -632,10 +702,16 @@ components: type: string example: "User Registration Workflow Association" description: "Name of the workflow association" + operation: + $ref: "#/components/schemas/Operation" workflowName: type: string example: "User Approval Workflow" description: "Assigned Workflow" + associationCondition: + type: string + example: "//*[local-name()='parameter'][@name='Rolename']/*[local-name()='value']/*[local-name()='itemValue']/text()='Employee'" + description: "Condition added to the association" isEnabled: type: boolean example: true @@ -656,11 +732,11 @@ components: $ref: "#/components/schemas/Operation" workflowId: type: string - example: "456" + example: "100" description: "Id of the assigned workflow" associationCondition: type: string - example: "Role Name equals Manager" + example: "//*[local-name()='parameter'][@name='Rolename']/*[local-name()='value']/*[local-name()='itemValue']/text()='Employee'" description: "Condition added to the association" isEnabled: type: boolean @@ -679,11 +755,11 @@ components: $ref: "#/components/schemas/Operation" workflowId: type: string - example: "456" + example: "100" description: "Id of the assigned workflow" associationCondition: type: string - example: "Role Name equals Manager" + example: "//*[local-name()='parameter'][@name='Rolename']/*[local-name()='value']/*[local-name()='itemValue']/text()='Employee'" description: "Condition added to the association" isEnabled: type: boolean From b58755080f36030d90789b8df1279b11890dd2f5 Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Wed, 12 Mar 2025 15:14:23 +0530 Subject: [PATCH 39/47] Change a method name --- .../workflow/v1/WorkflowAssociationsApi.java | 22 ++++++++++--------- .../v1/WorkflowAssociationsApiService.java | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowAssociationsApi.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowAssociationsApi.java index 730f94882a..8139d06c8b 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowAssociationsApi.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowAssociationsApi.java @@ -20,14 +20,16 @@ import org.wso2.carbon.identity.rest.api.server.workflow.v1.factories.WorkflowAssociationsApiServiceFactory; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.Error; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowAssociation; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowAssociationCreation; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowAssociationPatch; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowAssociationDetails; + import javax.validation.Valid; import javax.ws.rs.*; import javax.ws.rs.core.Response; import io.swagger.annotations.*; -import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowAssociation; -import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowAssociationCreation; -import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowAssociationPatch; -import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowAssociationSummary; import javax.validation.constraints.*; @@ -120,14 +122,14 @@ public Response getWorkflowAssociationById(@ApiParam(value = "Workflow Associati @Produces({ "application/json" }) - @ApiOperation(value = "Retrieve all the available workflow associations.", notes = "Retrieve all the available workflow associations in the system. <b>Scope required:</b> * internal_workflow_associations_view ", response = WorkflowAssociationSummary.class, responseContainer = "List", authorizations = { + @ApiOperation(value = "Retrieve all the available workflow associations.", notes = "Retrieve all the available workflow associations in the system. <b>Scope required:</b> * internal_workflow_associations_view ", response = WorkflowAssociationDetails.class, responseContainer = "List", authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { }) }, tags={ }) @ApiResponses(value = { - @ApiResponse(code = 200, message = "Array of workflow associations matching the search criteria", response = WorkflowAssociationSummary.class, responseContainer = "List"), + @ApiResponse(code = 200, message = "Array of workflow associations matching the search criteria", response = WorkflowAssociationDetails.class, responseContainer = "List"), @ApiResponse(code = 400, message = "Invalid input request", response = Error.class), @ApiResponse(code = 401, message = "Unauthorized", response = Void.class), @ApiResponse(code = 403, message = "Forbidden", response = Void.class), @@ -144,23 +146,23 @@ public Response listWorkflowAssociations( @Valid @Min(15)@ApiParam(value = "M @Path("/{association-id}") @Consumes({ "application/json" }) @Produces({ "application/json" }) - @ApiOperation(value = "Partially update association by association-id. ", notes = "Partially update an association by association-id.<br> <b>Scope required:</b> <br> * internal_workflow_associations_update ", response = Void.class, authorizations = { + @ApiOperation(value = "Partially update association by association-id. ", notes = "Partially update an association by association-id.<br> <b>Scope required:</b> <br> * internal_workflow_associations_update ", response = WorkflowAssociation.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { }) }, tags={ }) @ApiResponses(value = { - @ApiResponse(code = 200, message = "Successfully Updated", response = Void.class), + @ApiResponse(code = 200, message = "Successfully Updated", response = WorkflowAssociation.class), @ApiResponse(code = 400, message = "Bad Request", response = Error.class), @ApiResponse(code = 401, message = "Unauthorized", response = Void.class), @ApiResponse(code = 403, message = "Forbidden", response = Void.class), @ApiResponse(code = 409, message = "Conflict", response = Error.class), @ApiResponse(code = 500, message = "Server Error", response = Error.class) }) - public Response patchAssociation(@ApiParam(value = "Workflow Association ID",required=true) @PathParam("association-id") String associationId, @ApiParam(value = "Represents the association details to be updated." ) @Valid WorkflowAssociationPatch workflowAssociationPatch) { + public Response updateAssociation(@ApiParam(value = "Workflow Association ID",required=true) @PathParam("association-id") String associationId, @ApiParam(value = "Represents the association details to be updated." ) @Valid WorkflowAssociationPatch workflowAssociationPatch) { - return delegate.patchAssociation(associationId, workflowAssociationPatch ); + return delegate.updateAssociation(associationId, workflowAssociationPatch ); } } diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowAssociationsApiService.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowAssociationsApiService.java index b1124eb069..78a4be4896 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowAssociationsApiService.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowAssociationsApiService.java @@ -33,5 +33,5 @@ public interface WorkflowAssociationsApiService { public Response listWorkflowAssociations(Integer limit, Integer offset, String filter); - public Response patchAssociation(String associationId, WorkflowAssociationPatch workflowAssociationPatch); + public Response updateAssociation(String associationId, WorkflowAssociationPatch workflowAssociationPatch); } From 47b8db6ddc1053d88348200ea0b3334b7497399e Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Wed, 12 Mar 2025 15:25:24 +0530 Subject: [PATCH 40/47] Add class comments --- .../WorkflowAssociationsApiServiceFactory.java | 3 +++ .../WorkflowEnginesApiServiceFactory.java | 4 +++- .../factories/WorkflowEngineServiceFactory.java | 3 +++ .../impl/WorkflowAssociationsApiServiceImpl.java | 9 +++++---- .../v1/impl/WorkflowEnginesApiServiceImpl.java | 7 ++++++- .../workflow/v1/impl/WorkflowsApiServiceImpl.java | 15 +++++++-------- 6 files changed, 27 insertions(+), 14 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowAssociationsApiServiceFactory.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowAssociationsApiServiceFactory.java index 9d8106f6db..56ffcb6b17 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowAssociationsApiServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowAssociationsApiServiceFactory.java @@ -21,6 +21,9 @@ import org.wso2.carbon.identity.rest.api.server.workflow.v1.WorkflowAssociationsApiService; import org.wso2.carbon.identity.rest.api.server.workflow.v1.impl.WorkflowAssociationsApiServiceImpl; +/** + * Implementation of Workflow Association Management REST API. + */ public class WorkflowAssociationsApiServiceFactory { private final static WorkflowAssociationsApiService service = new WorkflowAssociationsApiServiceImpl(); diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowEnginesApiServiceFactory.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowEnginesApiServiceFactory.java index 757ddf8048..edc0dd174e 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowEnginesApiServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowEnginesApiServiceFactory.java @@ -21,6 +21,9 @@ import org.wso2.carbon.identity.rest.api.server.workflow.v1.WorkflowEnginesApiService; import org.wso2.carbon.identity.rest.api.server.workflow.v1.impl.WorkflowEnginesApiServiceImpl; +/** + * Implementation of Workflow Engine Management REST API. + */ public class WorkflowEnginesApiServiceFactory { private final static WorkflowEnginesApiService service = new WorkflowEnginesApiServiceImpl(); @@ -28,6 +31,5 @@ public class WorkflowEnginesApiServiceFactory { public static WorkflowEnginesApiService getWorkflowEnginesApi() { return service; - } } diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowEngineServiceFactory.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowEngineServiceFactory.java index a2db38acff..31b6c34553 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowEngineServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowEngineServiceFactory.java @@ -20,6 +20,9 @@ import org.wso2.carbon.identity.rest.api.server.workflow.v1.core.WorkflowEngineService; +/** + * Factory class for WorkflowEngineService. + */ public class WorkflowEngineServiceFactory { private static final WorkflowEngineService SERVICE; diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowAssociationsApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowAssociationsApiServiceImpl.java index 98a2871fb0..6327ea04e0 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowAssociationsApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowAssociationsApiServiceImpl.java @@ -22,10 +22,12 @@ import org.wso2.carbon.identity.rest.api.server.workflow.v1.core.WorkflowService; import org.wso2.carbon.identity.rest.api.server.workflow.v1.factories.WorkflowServiceFactory; import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.*; -import java.util.List; import javax.ws.rs.core.Response; +/** + * Implementation of workflow association management REST API. + */ public class WorkflowAssociationsApiServiceImpl implements WorkflowAssociationsApiService { private final WorkflowService workflowService; @@ -61,9 +63,8 @@ public Response listWorkflowAssociations(Integer limit, Integer offset, String f } @Override - public Response patchAssociation(String associationId, WorkflowAssociationPatch workflowAssociation) { + public Response updateAssociation(String associationId, WorkflowAssociationPatch workflowAssociation) { - workflowService.changeAssociation(associationId, workflowAssociation); - return Response.ok().build(); + return Response.ok().entity(workflowService.changeAssociation(associationId, workflowAssociation)).build(); } } diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowEnginesApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowEnginesApiServiceImpl.java index aaef34b525..08e6480d13 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowEnginesApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowEnginesApiServiceImpl.java @@ -18,12 +18,17 @@ package org.wso2.carbon.identity.rest.api.server.workflow.v1.impl; -import org.wso2.carbon.identity.rest.api.server.workflow.v1.WorkflowEnginesApiService; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.*; import org.wso2.carbon.identity.rest.api.server.workflow.v1.core.WorkflowEngineService; import org.wso2.carbon.identity.rest.api.server.workflow.v1.factories.WorkflowEngineServiceFactory; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.*; +import java.util.List; import javax.ws.rs.core.Response; +/** + * Implementation of workflow engines REST API. + */ public class WorkflowEnginesApiServiceImpl implements WorkflowEnginesApiService { private final WorkflowEngineService workflowEngineService; diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowsApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowsApiServiceImpl.java index 62756c24dc..aa5a4e4da8 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowsApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowsApiServiceImpl.java @@ -22,20 +22,20 @@ import org.wso2.carbon.identity.rest.api.server.workflow.v1.core.WorkflowService; import org.wso2.carbon.identity.rest.api.server.workflow.v1.factories.WorkflowServiceFactory; import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.*; +import java.util.List; import javax.ws.rs.core.Response; +/** + * Implementation of Workflow Management REST API. + */ public class WorkflowsApiServiceImpl implements WorkflowsApiService { private final WorkflowService workflowService; public WorkflowsApiServiceImpl() { - try { - this.workflowService = WorkflowServiceFactory.getWorkflowService(); - } catch (IllegalStateException e) { - throw new RuntimeException("Error occurred while initiating Workflow.", e); - } + this.workflowService = WorkflowServiceFactory.getWorkflowService(); } @Override @@ -64,9 +64,8 @@ public Response listWorkflows(Integer limit, Integer offset, String filter) { } @Override - public Response updateWorkflow(String workflowId, WorkflowCreation workflowCreation) { + public Response updateWorkflow(String workflowId, WorkflowCreation workflow) { - workflowService.updateWorkflow(workflowCreation, workflowId); - return Response.ok().build(); + return Response.ok().entity(workflowService.updateWorkflow(workflow, workflowId)).build(); } } From b36e846c831af9b56f57652148ffb66aeeb9d7b9 Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Wed, 12 Mar 2025 15:26:37 +0530 Subject: [PATCH 41/47] Change return types of some methods --- .../workflow/v1/core/WorkflowService.java | 122 ++++++++++-------- 1 file changed, 71 insertions(+), 51 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowService.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowService.java index ed54d46f61..0ae51d6fec 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowService.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowService.java @@ -38,7 +38,9 @@ import javax.ws.rs.core.Response; import java.util.*; - +/** + * Workflow service class + */ public class WorkflowService { private static final Log log = LogFactory.getLog(WorkflowService.class); @@ -53,21 +55,20 @@ public WorkflowService(WorkflowManagementService workflowManagementService) { * Add new workflow * * @param workflow Workflow details - * @return WorkflowSummary + * @return WorkflowDetails */ - public WorkflowSummary addWorkflow(WorkflowCreation workflow) { + public WorkflowDetails addWorkflow(WorkflowCreation workflow) { - WorkflowSummary workflowSummary; - Workflow workflowBean; + Workflow currentWorkflow; try { String workflowId = UUID.randomUUID().toString(); - workflowBean = createWorkflow(workflow, workflowId); + currentWorkflow = createWorkflow(workflow, workflowId); List<WorkflowTemplateParameters> templateProperties = workflow.getTemplate().getSteps(); List<Parameter> parameterList = new ArrayList<>(); for (WorkflowTemplateParameters properties : templateProperties) { for (OptionDetails options : properties.getOptions()) { - Parameter parameter = setWorkflowImplParameters(null, Constants.APPROVAL_STEPS, + Parameter parameter = setWorkflowImplParameters(workflowId, Constants.APPROVAL_STEPS, String.join(",", options.getValues()), Constants.APPROVAL_STEP + properties.getStep() + "-" + options.getEntity(), Constants.TEMPLATE); @@ -75,23 +76,22 @@ public WorkflowSummary addWorkflow(WorkflowCreation workflow) { } } - Parameter taskParameterDesc = setWorkflowImplParameters(null, Constants.APPROVAL_TASK_DESCRIPTION, + Parameter taskParameterDesc = setWorkflowImplParameters(workflowId, Constants.APPROVAL_TASK_DESCRIPTION, workflow.getApprovalTaskDescription(), Constants.APPROVAL_TASK_DESCRIPTION, Constants.WORKFLOW_IMPLEMENTATION); parameterList.add(taskParameterDesc); - Parameter taskParameterSubject = setWorkflowImplParameters(null, Constants.APPROVAL_TASK_SUBJECT, + Parameter taskParameterSubject = setWorkflowImplParameters(workflowId, Constants.APPROVAL_TASK_SUBJECT, workflow.getApprovalTask(), Constants.APPROVAL_TASK_SUBJECT, Constants.WORKFLOW_IMPLEMENTATION); parameterList.add(taskParameterSubject); - workflowManagementService.addWorkflow(workflowBean, parameterList, + workflowManagementService.addWorkflow(currentWorkflow, parameterList, CarbonContext.getThreadLocalCarbonContext().getTenantId()); - workflowSummary = getWorkflow(workflowBean); + return getWorkflow(workflowId); } catch (WorkflowClientException e) { throw handleClientError(Constants.ErrorMessage.ERROR_CODE_CLIENT_ERROR_ADDING_WORKFLOW, null, e); } catch (WorkflowException e) { throw handleServerError(Constants.ErrorMessage.ERROR_CODE_ERROR_ADDING_WORKFLOW, null, e); } - return workflowSummary; } /** @@ -99,19 +99,18 @@ public WorkflowSummary addWorkflow(WorkflowCreation workflow) { * * @param workflow Workflow details * @param workflowId Workflow ID - * @return + * @return WorkflowDetails */ - public void updateWorkflow(WorkflowCreation workflow, String workflowId) { + public WorkflowDetails updateWorkflow(WorkflowCreation workflow, String workflowId) { - WorkflowSummary workflowSummary; - Workflow workflowBean; + Workflow currentWorkflow; try { Workflow existingWorkflow = workflowManagementService.getWorkflow(workflowId); if (existingWorkflow == null) { throw new WorkflowClientException("A workflow with ID: " + workflowId + "doesn't exist."); } - workflowBean = createWorkflow(workflow, workflowId); + currentWorkflow = createWorkflow(workflow, workflowId); List<WorkflowTemplateParameters> templateProperties = workflow.getTemplate().getSteps(); List<Parameter> parameterList = new ArrayList<>(); @@ -126,15 +125,16 @@ public void updateWorkflow(WorkflowCreation workflow, String workflowId) { } Parameter taskParameterDesc = setWorkflowImplParameters(workflowId, Constants.APPROVAL_TASK_DESCRIPTION, - workflow.getApprovalTaskDescription(), Constants.APPROVAL_TASK_DESCRIPTION, Constants.TEMPLATE); + workflow.getApprovalTaskDescription(), Constants.APPROVAL_TASK_DESCRIPTION, Constants.WORKFLOW_IMPLEMENTATION); parameterList.add(taskParameterDesc); Parameter taskParameterSubject = setWorkflowImplParameters(workflowId, Constants.APPROVAL_TASK_SUBJECT, workflow.getApprovalTask(), Constants.APPROVAL_TASK_SUBJECT, Constants.WORKFLOW_IMPLEMENTATION); parameterList.add(taskParameterSubject); - workflowManagementService.addWorkflow(workflowBean, parameterList, + workflowManagementService.addWorkflow(currentWorkflow, parameterList, CarbonContext.getThreadLocalCarbonContext().getTenantId()); + return getWorkflow(workflowId); } catch (WorkflowClientException e) { throw handleClientError(Constants.ErrorMessage.ERROR_CODE_CLIENT_ERROR_UPDATING_WORKFLOW, workflowId, e); } catch (WorkflowException e) { @@ -152,14 +152,14 @@ public void updateWorkflow(WorkflowCreation workflow, String workflowId) { public WorkflowDetails getWorkflow(String workflowId) { try { - Workflow workflowBean = workflowManagementService.getWorkflow(workflowId); + Workflow currentWorkflow = workflowManagementService.getWorkflow(workflowId); List<Parameter> workflowParameters = workflowManagementService.getWorkflowParameters(workflowId); - if (workflowBean == null || workflowParameters == null) { + if (currentWorkflow == null || workflowParameters == null) { throw handleException(Response.Status.NOT_FOUND, Constants.ErrorMessage.ERROR_CODE_WORKFLOW_NOT_FOUND, workflowId); } - return getWorkflowDetails(workflowBean, workflowParameters); + return getWorkflowDetails(currentWorkflow, workflowParameters); } catch (WorkflowClientException e) { throw handleClientError(Constants.ErrorMessage.ERROR_CODE_WORKFLOW_NOT_FOUND, workflowId, e); } catch (WorkflowException e) { @@ -178,7 +178,7 @@ public WorkflowDetails getWorkflow(String workflowId) { public WorkflowSummary[] listPaginatedWorkflows(Integer limit, Integer offset, String filter) { List<WorkflowSummary> workflowSummaryList = new ArrayList<>(); - List<Workflow> workflowBeans; + List<Workflow> currentWorkflows; int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); try { if (limit == null || offset == null) { @@ -188,8 +188,8 @@ public WorkflowSummary[] listPaginatedWorkflows(Integer limit, Integer offset, S limit = limit.intValue(); offset = offset.intValue(); } - workflowBeans = workflowManagementService.listPaginatedWorkflows(tenantId, limit, offset, filter); - for (Workflow workflow : workflowBeans) { + currentWorkflows = workflowManagementService.listPaginatedWorkflows(tenantId, limit, offset, filter); + for (Workflow workflow : currentWorkflows) { WorkflowSummary workflowTmp = getWorkflow(workflow); workflowSummaryList.add(workflowTmp); } @@ -287,10 +287,10 @@ public void removeAssociation(String associationId) { public WorkflowAssociationCreation addAssociation(WorkflowAssociationCreation workflowAssociation) { try { - Workflow workflowBean = workflowManagementService.getWorkflow(workflowAssociation.getWorkflowId()); + Workflow currentWorkflow = workflowManagementService.getWorkflow(workflowAssociation.getWorkflowId()); WorkflowEvent event = workflowManagementService.getEvent(workflowAssociation.getOperation().toString()); - if (workflowBean == null) { + if (currentWorkflow == null) { throw new WorkflowClientException("A workflow with ID: " + workflowAssociation.getWorkflowId() + "doesn't exist."); } @@ -315,9 +315,9 @@ public WorkflowAssociationCreation addAssociation(WorkflowAssociationCreation wo * Get an association by ID * * @param associationId Association ID - * @return WorkflowAssociation + * @return WorkflowAssociationDetails */ - public WorkflowAssociation getAssociation(String associationId) { + public WorkflowAssociationDetails getAssociation(String associationId) { try { Association association = workflowManagementService.getAssociation(associationId); @@ -326,7 +326,7 @@ public WorkflowAssociation getAssociation(String associationId) { Constants.ErrorMessage.ERROR_CODE_ASSOCIATION_NOT_FOUND, associationId); } - return getAssociation(association); + return getAssociationDetails(association); } catch (WorkflowClientException e) { throw handleClientError(Constants.ErrorMessage.ERROR_CODE_ASSOCIATION_NOT_FOUND, associationId, e); } catch (WorkflowException e) { @@ -339,9 +339,9 @@ public WorkflowAssociation getAssociation(String associationId) { * * @param associationId Association ID * @param workflowAssociation Association Details - * @return + * @return WorkflowAssociationDetails */ - public void changeAssociation(String associationId, WorkflowAssociationPatch workflowAssociation) { + public WorkflowAssociationDetails changeAssociation(String associationId, WorkflowAssociationPatch workflowAssociation) { boolean isEnable; String eventId; @@ -360,6 +360,7 @@ public void changeAssociation(String associationId, WorkflowAssociationPatch wor workflowManagementService.changeAssociation(associationId, workflowAssociation.getAssociationName(), workflowAssociation.getWorkflowId(), eventId, workflowAssociation.getAssociationCondition(), isEnable); + return getAssociation(associationId); } catch (WorkflowClientException e) { throw handleClientError(Constants.ErrorMessage.ERROR_CODE_CLIENT_ERROR_UPDATING_ASSOCIATION, associationId, e); } catch (WorkflowException e) { @@ -368,16 +369,16 @@ public void changeAssociation(String associationId, WorkflowAssociationPatch wor } - private WorkflowSummary getWorkflow(Workflow workflowBean) { + private WorkflowSummary getWorkflow(Workflow currentWorkflow) { WorkflowSummary workflow = null; - if (workflowBean != null) { + if (currentWorkflow != null) { workflow = new WorkflowSummary(); - workflow.setId(workflowBean.getWorkflowId()); - workflow.setName(workflowBean.getWorkflowName()); - workflow.setDescription(workflowBean.getWorkflowDescription()); - workflow.setTemplate(workflowBean.getTemplateId()); - workflow.setEngine(workflowBean.getWorkflowImplId()); + workflow.setId(currentWorkflow.getWorkflowId()); + workflow.setName(currentWorkflow.getWorkflowName()); + workflow.setDescription(currentWorkflow.getWorkflowDescription()); + workflow.setTemplate(currentWorkflow.getTemplateId()); + workflow.setEngine(currentWorkflow.getWorkflowImplId()); } return workflow; } @@ -397,6 +398,24 @@ private WorkflowAssociation getAssociation(Association associationBean) { return association; } + private WorkflowAssociationDetails getAssociationDetails(Association associationBean) { + + WorkflowAssociationDetails association = null; + + if (associationBean != null) { + association = new WorkflowAssociationDetails(); + association.setId(associationBean.getAssociationId()); + association.setAssociationName(associationBean.getAssociationName()); + association.setOperation(Operation.valueOf(associationBean.getEventId())); + association.setWorkflowName(associationBean.getWorkflowName()); + association.setAssociationCondition(associationBean.getCondition()); + association.setIsEnabled(associationBean.isEnabled()); + } + return association; + } + + + private Parameter setWorkflowImplParameters(String workflowId, String paramName, String paramValue, String qName, String holder) { @@ -411,33 +430,34 @@ private Parameter setWorkflowImplParameters(String workflowId, String paramName, private Workflow createWorkflow(WorkflowCreation workflow, String workflowId) throws WorkflowException { - Workflow workflowBean = new Workflow(); - workflowBean.setWorkflowId(workflowId); - workflowBean.setWorkflowName(workflow.getName()); - workflowBean.setWorkflowDescription(workflow.getDescription()); + Workflow currentWorkflow = new Workflow(); + currentWorkflow.setWorkflowId(workflowId); + currentWorkflow.setWorkflowName(workflow.getName()); + currentWorkflow.setWorkflowDescription(workflow.getDescription()); String templateId = workflow.getTemplate().getName(); if (templateId == null) { throw new WorkflowException("Template ID can't be empty"); } - workflowBean.setTemplateId(templateId); + currentWorkflow.setTemplateId(templateId); String workflowImplId = workflow.getEngine(); if (workflowImplId == null) { throw new WorkflowException("Workflowimpl ID can't be empty"); } - workflowBean.setWorkflowImplId(workflowImplId); - return workflowBean; + currentWorkflow.setWorkflowImplId(workflowImplId); + return currentWorkflow; } - private WorkflowDetails getWorkflowDetails(Workflow workflowBean, List<Parameter> workflowParameters) + private WorkflowDetails getWorkflowDetails(Workflow currentWorkflow, List<Parameter> workflowParameters) throws WorkflowException { WorkflowDetails detailedWorkflow = new WorkflowDetails(); - detailedWorkflow.setName(workflowBean.getWorkflowName()); - detailedWorkflow.setDescription(workflowBean.getWorkflowDescription()); + detailedWorkflow.setId(currentWorkflow.getWorkflowId()); + detailedWorkflow.setName(currentWorkflow.getWorkflowName()); + detailedWorkflow.setDescription(currentWorkflow.getWorkflowDescription()); WorkflowTemplateBase workflowTemplate = new WorkflowTemplateBase(); - workflowTemplate.setName(workflowBean.getTemplateId()); + workflowTemplate.setName(currentWorkflow.getTemplateId()); Map<Integer, WorkflowTemplateParametersBase> templateParamsMap = new HashMap<>(); @@ -477,7 +497,7 @@ private WorkflowDetails getWorkflowDetails(Workflow workflowBean, List<Parameter List<WorkflowTemplateParametersBase> templateParams = new ArrayList<>(templateParamsMap.values()); workflowTemplate.setSteps(templateParams); detailedWorkflow.setTemplate(workflowTemplate); - detailedWorkflow.setEngine(workflowBean.getWorkflowImplId()); + detailedWorkflow.setEngine(currentWorkflow.getWorkflowImplId()); return detailedWorkflow; } From 9345fe64fe3b54d9082f31c83849c603b12a0857 Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Wed, 12 Mar 2025 15:27:57 +0530 Subject: [PATCH 42/47] Change payloads of several methods --- .../rest/api/server/workflow/v1/WorkflowsApi.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowsApi.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowsApi.java index ff2ae260ec..668d7af2e4 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowsApi.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/WorkflowsApi.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * 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 @@ -47,14 +47,14 @@ public WorkflowsApi(){ @Consumes({ "application/json" }) @Produces({ "application/json" }) - @ApiOperation(value = "Create a new workflow.", notes = "Create a new workflow using the specified workflow template and execution engine. <b>Scope required:</b> * internal_workflow_create ", response = WorkflowSummary.class, authorizations = { + @ApiOperation(value = "Create a new workflow.", notes = "Create a new workflow using the specified workflow template and execution engine. <b>Scope required:</b> * internal_workflow_create ", response = WorkflowDetails.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { }) }, tags={ }) @ApiResponses(value = { - @ApiResponse(code = 201, message = "Item Created", response = WorkflowSummary.class), + @ApiResponse(code = 201, message = "Item Created", response = WorkflowDetails.class), @ApiResponse(code = 400, message = "Invalid input request", response = Error.class), @ApiResponse(code = 401, message = "Unauthorized", response = Void.class), @ApiResponse(code = 403, message = "Forbidden", response = Void.class), @@ -143,14 +143,14 @@ public Response listWorkflows( @Valid @Min(15)@ApiParam(value = "Maximum numb @Path("/{workflow-id}") @Consumes({ "application/json" }) @Produces({ "application/json" }) - @ApiOperation(value = "Update an existing workflow.", notes = "Update a workflow identified by workflow-id. <b>Scope required:</b> * internal_workflow_update ", response = Void.class, authorizations = { + @ApiOperation(value = "Update an existing workflow.", notes = "Update a workflow identified by workflow-id. <b>Scope required:</b> * internal_workflow_update ", response = WorkflowDetails.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { }) }, tags={ }) @ApiResponses(value = { - @ApiResponse(code = 200, message = "Item Updated", response = Void.class), + @ApiResponse(code = 200, message = "Information about the workflow identified by the workflow-id.", response = WorkflowDetails.class), @ApiResponse(code = 400, message = "Invalid input request", response = Error.class), @ApiResponse(code = 401, message = "Unauthorized", response = Void.class), @ApiResponse(code = 403, message = "Forbidden", response = Void.class), From 4e6eedf6be40233ebdd77cc3aaad641da33e57f6 Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Wed, 12 Mar 2025 15:28:15 +0530 Subject: [PATCH 43/47] Improve formatting --- .../workflow/v1/factories/WorkflowsApiServiceFactory.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowsApiServiceFactory.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowsApiServiceFactory.java index af0e923edb..cef856258d 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowsApiServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowsApiServiceFactory.java @@ -25,8 +25,8 @@ public class WorkflowsApiServiceFactory { private final static WorkflowsApiService service = new WorkflowsApiServiceImpl(); - public static WorkflowsApiService getWorkflowsApi() - { + public static WorkflowsApiService getWorkflowsApi() { + return service; } } From 04ae6eae35988f7855272601a8de905cc3e3635e Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Wed, 12 Mar 2025 15:31:29 +0530 Subject: [PATCH 44/47] Regenerate the code after changing the specification --- .../api/server/workflow/v1/model/Error.java | 165 +++++++++++++ .../server/workflow/v1/model/Operation.java | 64 +++++ .../workflow/v1/model/OptionDetails.java | 130 ++++++++++ .../v1/model/WorkflowAssociation.java | 187 ++++++++++++++ .../v1/model/WorkflowAssociationCreation.java | 193 +++++++++++++++ .../v1/model/WorkflowAssociationDetails.java | 178 ++++++++++++++ .../v1/model/WorkflowAssociationPatch.java | 187 ++++++++++++++ .../workflow/v1/model/WorkflowCreation.java | 215 ++++++++++++++++ .../workflow/v1/model/WorkflowDetails.java | 231 ++++++++++++++++++ .../workflow/v1/model/WorkflowEngine.java | 167 +++++++++++++ .../workflow/v1/model/WorkflowSummary.java | 187 ++++++++++++++ .../workflow/v1/model/WorkflowTemplate.java | 132 ++++++++++ .../v1/model/WorkflowTemplateBase.java | 132 ++++++++++ .../v1/model/WorkflowTemplateParameters.java | 131 ++++++++++ .../model/WorkflowTemplateParametersBase.java | 131 ++++++++++ 15 files changed, 2430 insertions(+) create mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/Error.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/Operation.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/OptionDetails.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociation.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociationCreation.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociationDetails.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociationPatch.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowCreation.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowDetails.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowEngine.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowSummary.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowTemplate.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowTemplateBase.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowTemplateParameters.java create mode 100644 components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowTemplateParametersBase.java diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/Error.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/Error.java new file mode 100644 index 0000000000..264a0ca39d --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/Error.java @@ -0,0 +1,165 @@ +/* + * 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.rest.api.server.workflow.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; + + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; + +public class Error { + + private String code; + private String message; + private String description; + private String traceId; + + /** + **/ + public Error code(String code) { + + this.code = code; + return this; + } + + @ApiModelProperty(example = "some_error_code", required = true, value = "") + @JsonProperty("code") + @Valid + @NotNull(message = "Property code cannot be null.") + + public String getCode() { + return code; + } + public void setCode(String code) { + this.code = code; + } + + /** + **/ + public Error message(String message) { + + this.message = message; + return this; + } + + @ApiModelProperty(example = "Some Error Message", required = true, value = "") + @JsonProperty("message") + @Valid + @NotNull(message = "Property message cannot be null.") + + public String getMessage() { + return message; + } + public void setMessage(String message) { + this.message = message; + } + + /** + **/ + public Error description(String description) { + + this.description = description; + return this; + } + + @ApiModelProperty(example = "Some Error Description", value = "") + @JsonProperty("description") + @Valid + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + + /** + **/ + public Error traceId(String traceId) { + + this.traceId = traceId; + return this; + } + + @ApiModelProperty(example = "Some Trace ID", value = "") + @JsonProperty("traceId") + @Valid + public String getTraceId() { + return traceId; + } + public void setTraceId(String traceId) { + this.traceId = traceId; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Error error = (Error) o; + return Objects.equals(this.code, error.code) && + Objects.equals(this.message, error.message) && + Objects.equals(this.description, error.description) && + Objects.equals(this.traceId, error.traceId); + } + + @Override + public int hashCode() { + return Objects.hash(code, message, description, traceId); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class Error {\n"); + + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" traceId: ").append(toIndentedString(traceId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/Operation.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/Operation.java new file mode 100644 index 0000000000..061cf99274 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/Operation.java @@ -0,0 +1,64 @@ +/* + * 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.rest.api.server.workflow.v1.model; + +import io.swagger.annotations.ApiModel; +import javax.validation.constraints.*; + +/** + * Name of the user operation + **/ +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; + +@XmlType(name="") +@XmlEnum(String.class) +public enum Operation { + + @XmlEnumValue("ADD_USER") ADD_USER(String.valueOf("ADD_USER")), @XmlEnumValue("DELETE_USER") DELETE_USER(String.valueOf("DELETE_USER")), @XmlEnumValue("UPDATE_ROLES_OF_USERS") UPDATE_ROLES_OF_USERS(String.valueOf("UPDATE_ROLES_OF_USERS")), @XmlEnumValue("ADD_ROLE") ADD_ROLE(String.valueOf("ADD_ROLE")), @XmlEnumValue("DELETE_ROLE") DELETE_ROLE(String.valueOf("DELETE_ROLE")), @XmlEnumValue("UPDATE_ROLE_NAME") UPDATE_ROLE_NAME(String.valueOf("UPDATE_ROLE_NAME")), @XmlEnumValue("UPDATE_USERS_OF_ROLES") UPDATE_USERS_OF_ROLES(String.valueOf("UPDATE_USERS_OF_ROLES")), @XmlEnumValue("DELETE_USER_CLAIMS") DELETE_USER_CLAIMS(String.valueOf("DELETE_USER_CLAIMS")), @XmlEnumValue("UPDATE_USER_CLAIMS") UPDATE_USER_CLAIMS(String.valueOf("UPDATE_USER_CLAIMS")); + + + private String value; + + Operation(String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static Operation fromValue(String value) { + for (Operation b : Operation.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + + diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/OptionDetails.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/OptionDetails.java new file mode 100644 index 0000000000..3cfd69ac36 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/OptionDetails.java @@ -0,0 +1,130 @@ +/* + * 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.rest.api.server.workflow.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import javax.validation.constraints.*; + + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; + +public class OptionDetails { + + private String entity; + private List<String> values = null; + + + /** + **/ + public OptionDetails entity(String entity) { + + this.entity = entity; + return this; + } + + @ApiModelProperty(example = "roles", value = "") + @JsonProperty("entity") + @Valid + public String getEntity() { + return entity; + } + public void setEntity(String entity) { + this.entity = entity; + } + + /** + **/ + public OptionDetails values(List<String> values) { + + this.values = values; + return this; + } + + @ApiModelProperty(value = "") + @JsonProperty("values") + @Valid + public List<String> getValues() { + return values; + } + public void setValues(List<String> values) { + this.values = values; + } + + public OptionDetails addValuesItem(String valuesItem) { + if (this.values == null) { + this.values = new ArrayList<>(); + } + this.values.add(valuesItem); + return this; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OptionDetails optionDetails = (OptionDetails) o; + return Objects.equals(this.entity, optionDetails.entity) && + Objects.equals(this.values, optionDetails.values); + } + + @Override + public int hashCode() { + return Objects.hash(entity, values); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class OptionDetails {\n"); + + sb.append(" entity: ").append(toIndentedString(entity)).append("\n"); + sb.append(" values: ").append(toIndentedString(values)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociation.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociation.java new file mode 100644 index 0000000000..447d5fabdc --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociation.java @@ -0,0 +1,187 @@ +/* + * 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.rest.api.server.workflow.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.Operation; +import javax.validation.constraints.*; + + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; + +public class WorkflowAssociation { + + private String id; + private String associationName; + private Operation operation; + private String workflowName; + private Boolean isEnabled; + + /** + * Unique id to represent a workflow association + **/ + public WorkflowAssociation id(String id) { + + this.id = id; + return this; + } + + @ApiModelProperty(example = "500", value = "Unique id to represent a workflow association") + @JsonProperty("id") + @Valid + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + + /** + * Name of the workflow association + **/ + public WorkflowAssociation associationName(String associationName) { + + this.associationName = associationName; + return this; + } + + @ApiModelProperty(example = "User Registration Workflow Association", value = "Name of the workflow association") + @JsonProperty("associationName") + @Valid + public String getAssociationName() { + return associationName; + } + public void setAssociationName(String associationName) { + this.associationName = associationName; + } + + /** + **/ + public WorkflowAssociation operation(Operation operation) { + + this.operation = operation; + return this; + } + + @ApiModelProperty(value = "") + @JsonProperty("operation") + @Valid + public Operation getOperation() { + return operation; + } + public void setOperation(Operation operation) { + this.operation = operation; + } + + /** + * Assigned Workflow + **/ + public WorkflowAssociation workflowName(String workflowName) { + + this.workflowName = workflowName; + return this; + } + + @ApiModelProperty(example = "User Approval Workflow", value = "Assigned Workflow") + @JsonProperty("workflowName") + @Valid + public String getWorkflowName() { + return workflowName; + } + public void setWorkflowName(String workflowName) { + this.workflowName = workflowName; + } + + /** + * Association Status + **/ + public WorkflowAssociation isEnabled(Boolean isEnabled) { + + this.isEnabled = isEnabled; + return this; + } + + @ApiModelProperty(example = "true", value = "Association Status") + @JsonProperty("isEnabled") + @Valid + public Boolean getIsEnabled() { + return isEnabled; + } + public void setIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WorkflowAssociation workflowAssociation = (WorkflowAssociation) o; + return Objects.equals(this.id, workflowAssociation.id) && + Objects.equals(this.associationName, workflowAssociation.associationName) && + Objects.equals(this.operation, workflowAssociation.operation) && + Objects.equals(this.workflowName, workflowAssociation.workflowName) && + Objects.equals(this.isEnabled, workflowAssociation.isEnabled); + } + + @Override + public int hashCode() { + return Objects.hash(id, associationName, operation, workflowName, isEnabled); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class WorkflowAssociation {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" associationName: ").append(toIndentedString(associationName)).append("\n"); + sb.append(" operation: ").append(toIndentedString(operation)).append("\n"); + sb.append(" workflowName: ").append(toIndentedString(workflowName)).append("\n"); + sb.append(" isEnabled: ").append(toIndentedString(isEnabled)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociationCreation.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociationCreation.java new file mode 100644 index 0000000000..6a0ebccb6a --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociationCreation.java @@ -0,0 +1,193 @@ +/* + * 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.rest.api.server.workflow.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.Operation; +import javax.validation.constraints.*; + + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; + +public class WorkflowAssociationCreation { + + private String associationName; + private Operation operation; + private String workflowId; + private String associationCondition; + private Boolean isEnabled = true; + + /** + * Name of the workflow association + **/ + public WorkflowAssociationCreation associationName(String associationName) { + + this.associationName = associationName; + return this; + } + + @ApiModelProperty(example = "User Registration Workflow Association", required = true, value = "Name of the workflow association") + @JsonProperty("associationName") + @Valid + @NotNull(message = "Property associationName cannot be null.") + + public String getAssociationName() { + return associationName; + } + public void setAssociationName(String associationName) { + this.associationName = associationName; + } + + /** + **/ + public WorkflowAssociationCreation operation(Operation operation) { + + this.operation = operation; + return this; + } + + @ApiModelProperty(required = true, value = "") + @JsonProperty("operation") + @Valid + @NotNull(message = "Property operation cannot be null.") + + public Operation getOperation() { + return operation; + } + public void setOperation(Operation operation) { + this.operation = operation; + } + + /** + * Id of the assigned workflow + **/ + public WorkflowAssociationCreation workflowId(String workflowId) { + + this.workflowId = workflowId; + return this; + } + + @ApiModelProperty(example = "100", required = true, value = "Id of the assigned workflow") + @JsonProperty("workflowId") + @Valid + @NotNull(message = "Property workflowId cannot be null.") + + public String getWorkflowId() { + return workflowId; + } + public void setWorkflowId(String workflowId) { + this.workflowId = workflowId; + } + + /** + * Condition added to the association + **/ + public WorkflowAssociationCreation associationCondition(String associationCondition) { + + this.associationCondition = associationCondition; + return this; + } + + @ApiModelProperty(example = "//_*[local-name()='parameter'][@name='Rolename']/_*[local-name()='value']/_*[local-name()='itemValue']/text()='Employee'", value = "Condition added to the association") + @JsonProperty("associationCondition") + @Valid + public String getAssociationCondition() { + return associationCondition; + } + public void setAssociationCondition(String associationCondition) { + this.associationCondition = associationCondition; + } + + /** + * Association Status + **/ + public WorkflowAssociationCreation isEnabled(Boolean isEnabled) { + + this.isEnabled = isEnabled; + return this; + } + + @ApiModelProperty(example = "true", value = "Association Status") + @JsonProperty("isEnabled") + @Valid + public Boolean getIsEnabled() { + return isEnabled; + } + public void setIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WorkflowAssociationCreation workflowAssociationCreation = (WorkflowAssociationCreation) o; + return Objects.equals(this.associationName, workflowAssociationCreation.associationName) && + Objects.equals(this.operation, workflowAssociationCreation.operation) && + Objects.equals(this.workflowId, workflowAssociationCreation.workflowId) && + Objects.equals(this.associationCondition, workflowAssociationCreation.associationCondition) && + Objects.equals(this.isEnabled, workflowAssociationCreation.isEnabled); + } + + @Override + public int hashCode() { + return Objects.hash(associationName, operation, workflowId, associationCondition, isEnabled); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class WorkflowAssociationCreation {\n"); + + sb.append(" associationName: ").append(toIndentedString(associationName)).append("\n"); + sb.append(" operation: ").append(toIndentedString(operation)).append("\n"); + sb.append(" workflowId: ").append(toIndentedString(workflowId)).append("\n"); + sb.append(" associationCondition: ").append(toIndentedString(associationCondition)).append("\n"); + sb.append(" isEnabled: ").append(toIndentedString(isEnabled)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociationDetails.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociationDetails.java new file mode 100644 index 0000000000..1f98fcb66a --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociationDetails.java @@ -0,0 +1,178 @@ +/* + * 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.rest.api.server.workflow.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + + +import java.util.Objects; +import javax.validation.Valid; + +public class WorkflowAssociationDetails { + + private String id; + private String associationName; + private Operation operation; + private String workflowName; + private String associationCondition; + private Boolean isEnabled = true; + + /** + * Unique id to represent a workflow association + **/ + public WorkflowAssociationDetails id(String id) { + + this.id = id; + return this; + } + + @ApiModelProperty(example = "500", value = "Unique id to represent a workflow association") + @JsonProperty("id") + @Valid + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + + /** + * Name of the workflow association + **/ + public WorkflowAssociationDetails associationName(String associationName) { + + this.associationName = associationName; + return this; + } + + @ApiModelProperty(example = "User Registration Workflow Association", value = "Name of the workflow association") + @JsonProperty("associationName") + @Valid + public String getAssociationName() { + return associationName; + } + public void setAssociationName(String associationName) { + this.associationName = associationName; + } + + /** + * Assigned Workflow + **/ + public WorkflowAssociationDetails workflowName(String workflowName) { + + this.workflowName = workflowName; + return this; + } + + @ApiModelProperty(example = "User Approval Workflow", value = "Assigned Workflow") + @JsonProperty("workflowName") + @Valid + public String getWorkflowName() { + return workflowName; + } + public void setWorkflowName(String workflowName) { + this.workflowName = workflowName; + } + + /** + * Association Status + **/ + public WorkflowAssociationDetails isEnabled(Boolean isEnabled) { + + this.isEnabled = isEnabled; + return this; + } + + @ApiModelProperty(example = "true", value = "Association Status") + @JsonProperty("isEnabled") + @Valid + public Boolean getIsEnabled() { + return isEnabled; + } + public void setIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WorkflowAssociationDetails workflowAssociationSummary = (WorkflowAssociationDetails) o; + return Objects.equals(this.id, workflowAssociationSummary.id) && + Objects.equals(this.associationName, workflowAssociationSummary.associationName) && + Objects.equals(this.workflowName, workflowAssociationSummary.workflowName) && + Objects.equals(this.isEnabled, workflowAssociationSummary.isEnabled); + } + + @Override + public int hashCode() { + return Objects.hash(id, associationName, workflowName, isEnabled); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class WorkflowAssociationSummary {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" associationName: ").append(toIndentedString(associationName)).append("\n"); + sb.append(" workflowName: ").append(toIndentedString(workflowName)).append("\n"); + sb.append(" isEnabled: ").append(toIndentedString(isEnabled)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public Operation getOperation() { + return operation; + } + + public void setOperation(Operation operation) { + this.operation = operation; + } + + public String getAssociationCondition() { + return associationCondition; + } + + public void setAssociationCondition(String associationCondition) { + this.associationCondition = associationCondition; + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociationPatch.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociationPatch.java new file mode 100644 index 0000000000..11a3676e71 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowAssociationPatch.java @@ -0,0 +1,187 @@ +/* + * 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.rest.api.server.workflow.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.Operation; +import javax.validation.constraints.*; + + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; + +public class WorkflowAssociationPatch { + + private String associationName; + private Operation operation; + private String workflowId; + private String associationCondition; + private Boolean isEnabled; + + /** + * Name of the workflow association + **/ + public WorkflowAssociationPatch associationName(String associationName) { + + this.associationName = associationName; + return this; + } + + @ApiModelProperty(example = "User Registration Workflow Association", value = "Name of the workflow association") + @JsonProperty("associationName") + @Valid + public String getAssociationName() { + return associationName; + } + public void setAssociationName(String associationName) { + this.associationName = associationName; + } + + /** + **/ + public WorkflowAssociationPatch operation(Operation operation) { + + this.operation = operation; + return this; + } + + @ApiModelProperty(value = "") + @JsonProperty("operation") + @Valid + public Operation getOperation() { + return operation; + } + public void setOperation(Operation operation) { + this.operation = operation; + } + + /** + * Id of the assigned workflow + **/ + public WorkflowAssociationPatch workflowId(String workflowId) { + + this.workflowId = workflowId; + return this; + } + + @ApiModelProperty(example = "100", value = "Id of the assigned workflow") + @JsonProperty("workflowId") + @Valid + public String getWorkflowId() { + return workflowId; + } + public void setWorkflowId(String workflowId) { + this.workflowId = workflowId; + } + + /** + * Condition added to the association + **/ + public WorkflowAssociationPatch associationCondition(String associationCondition) { + + this.associationCondition = associationCondition; + return this; + } + + @ApiModelProperty(example = "//_*[local-name()='parameter'][@name='Rolename']/_*[local-name()='value']/_*[local-name()='itemValue']/text()='Employee'", value = "Condition added to the association") + @JsonProperty("associationCondition") + @Valid + public String getAssociationCondition() { + return associationCondition; + } + public void setAssociationCondition(String associationCondition) { + this.associationCondition = associationCondition; + } + + /** + * Association Status + **/ + public WorkflowAssociationPatch isEnabled(Boolean isEnabled) { + + this.isEnabled = isEnabled; + return this; + } + + @ApiModelProperty(example = "true", value = "Association Status") + @JsonProperty("isEnabled") + @Valid + public Boolean getIsEnabled() { + return isEnabled; + } + public void setIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WorkflowAssociationPatch workflowAssociationPatch = (WorkflowAssociationPatch) o; + return Objects.equals(this.associationName, workflowAssociationPatch.associationName) && + Objects.equals(this.operation, workflowAssociationPatch.operation) && + Objects.equals(this.workflowId, workflowAssociationPatch.workflowId) && + Objects.equals(this.associationCondition, workflowAssociationPatch.associationCondition) && + Objects.equals(this.isEnabled, workflowAssociationPatch.isEnabled); + } + + @Override + public int hashCode() { + return Objects.hash(associationName, operation, workflowId, associationCondition, isEnabled); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class WorkflowAssociationPatch {\n"); + + sb.append(" associationName: ").append(toIndentedString(associationName)).append("\n"); + sb.append(" operation: ").append(toIndentedString(operation)).append("\n"); + sb.append(" workflowId: ").append(toIndentedString(workflowId)).append("\n"); + sb.append(" associationCondition: ").append(toIndentedString(associationCondition)).append("\n"); + sb.append(" isEnabled: ").append(toIndentedString(isEnabled)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowCreation.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowCreation.java new file mode 100644 index 0000000000..2fe629e7d7 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowCreation.java @@ -0,0 +1,215 @@ +/* + * 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.rest.api.server.workflow.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowTemplate; +import javax.validation.constraints.*; + + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; + +public class WorkflowCreation { + + private String name; + private String description; + private String engine; + private WorkflowTemplate template; + private String approvalTask; + private String approvalTaskDescription; + + /** + * Name of the created workflow + **/ + public WorkflowCreation name(String name) { + + this.name = name; + return this; + } + + @ApiModelProperty(example = "User Approval Workflow", required = true, value = "Name of the created workflow") + @JsonProperty("name") + @Valid + @NotNull(message = "Property name cannot be null.") + + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + /** + * Description of the created workflow + **/ + public WorkflowCreation description(String description) { + + this.description = description; + return this; + } + + @ApiModelProperty(example = "Workflow to approve user role related requests", value = "Description of the created workflow") + @JsonProperty("description") + @Valid + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + + /** + * Name of the selected workflow engine + **/ + public WorkflowCreation engine(String engine) { + + this.engine = engine; + return this; + } + + @ApiModelProperty(example = "Simple Workflow Engine", required = true, value = "Name of the selected workflow engine") + @JsonProperty("engine") + @Valid + @NotNull(message = "Property engine cannot be null.") + + public String getEngine() { + return engine; + } + public void setEngine(String engine) { + this.engine = engine; + } + + /** + **/ + public WorkflowCreation template(WorkflowTemplate template) { + + this.template = template; + return this; + } + + @ApiModelProperty(value = "") + @JsonProperty("template") + @Valid + public WorkflowTemplate getTemplate() { + return template; + } + public void setTemplate(WorkflowTemplate template) { + this.template = template; + } + + /** + * Approval task subject to display + **/ + public WorkflowCreation approvalTask(String approvalTask) { + + this.approvalTask = approvalTask; + return this; + } + + @ApiModelProperty(example = "Approval Required", required = true, value = "Approval task subject to display") + @JsonProperty("approvalTask") + @Valid + @NotNull(message = "Property approvalTask cannot be null.") + + public String getApprovalTask() { + return approvalTask; + } + public void setApprovalTask(String approvalTask) { + this.approvalTask = approvalTask; + } + + /** + * Description of the approval task + **/ + public WorkflowCreation approvalTaskDescription(String approvalTaskDescription) { + + this.approvalTaskDescription = approvalTaskDescription; + return this; + } + + @ApiModelProperty(example = "Your approval is needed to complete this task", value = "Description of the approval task") + @JsonProperty("approvalTaskDescription") + @Valid + public String getApprovalTaskDescription() { + return approvalTaskDescription; + } + public void setApprovalTaskDescription(String approvalTaskDescription) { + this.approvalTaskDescription = approvalTaskDescription; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WorkflowCreation workflowCreation = (WorkflowCreation) o; + return Objects.equals(this.name, workflowCreation.name) && + Objects.equals(this.description, workflowCreation.description) && + Objects.equals(this.engine, workflowCreation.engine) && + Objects.equals(this.template, workflowCreation.template) && + Objects.equals(this.approvalTask, workflowCreation.approvalTask) && + Objects.equals(this.approvalTaskDescription, workflowCreation.approvalTaskDescription); + } + + @Override + public int hashCode() { + return Objects.hash(name, description, engine, template, approvalTask, approvalTaskDescription); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class WorkflowCreation {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" engine: ").append(toIndentedString(engine)).append("\n"); + sb.append(" template: ").append(toIndentedString(template)).append("\n"); + sb.append(" approvalTask: ").append(toIndentedString(approvalTask)).append("\n"); + sb.append(" approvalTaskDescription: ").append(toIndentedString(approvalTaskDescription)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowDetails.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowDetails.java new file mode 100644 index 0000000000..e643bfe6e6 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowDetails.java @@ -0,0 +1,231 @@ +/* + * 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.rest.api.server.workflow.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowTemplateBase; +import javax.validation.constraints.*; + + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; + +public class WorkflowDetails { + + private String id; + private String name; + private String description; + private String engine; + private WorkflowTemplateBase template; + private String approvalTask; + private String approvalTaskDescription; + + /** + * Id of the workflow + **/ + public WorkflowDetails id(String id) { + + this.id = id; + return this; + } + + @ApiModelProperty(example = "100", value = "Id of the workflow") + @JsonProperty("id") + @Valid + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + + /** + * Name of the created workflow + **/ + public WorkflowDetails name(String name) { + + this.name = name; + return this; + } + + @ApiModelProperty(example = "User Approval Workflow", value = "Name of the created workflow") + @JsonProperty("name") + @Valid + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + /** + * Description of the created workflow + **/ + public WorkflowDetails description(String description) { + + this.description = description; + return this; + } + + @ApiModelProperty(example = "Workflow to approve user role related requests", value = "Description of the created workflow") + @JsonProperty("description") + @Valid + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + + /** + * Name of the selected workflow engine + **/ + public WorkflowDetails engine(String engine) { + + this.engine = engine; + return this; + } + + @ApiModelProperty(example = "Simple Workflow Engine", value = "Name of the selected workflow engine") + @JsonProperty("engine") + @Valid + public String getEngine() { + return engine; + } + public void setEngine(String engine) { + this.engine = engine; + } + + /** + **/ + public WorkflowDetails template(WorkflowTemplateBase template) { + + this.template = template; + return this; + } + + @ApiModelProperty(value = "") + @JsonProperty("template") + @Valid + public WorkflowTemplateBase getTemplate() { + return template; + } + public void setTemplate(WorkflowTemplateBase template) { + this.template = template; + } + + /** + * Approval task subject to display + **/ + public WorkflowDetails approvalTask(String approvalTask) { + + this.approvalTask = approvalTask; + return this; + } + + @ApiModelProperty(example = "Approval Required", value = "Approval task subject to display") + @JsonProperty("approvalTask") + @Valid + public String getApprovalTask() { + return approvalTask; + } + public void setApprovalTask(String approvalTask) { + this.approvalTask = approvalTask; + } + + /** + * Description of the approval task + **/ + public WorkflowDetails approvalTaskDescription(String approvalTaskDescription) { + + this.approvalTaskDescription = approvalTaskDescription; + return this; + } + + @ApiModelProperty(example = "Your approval is needed to complete this task", value = "Description of the approval task") + @JsonProperty("approvalTaskDescription") + @Valid + public String getApprovalTaskDescription() { + return approvalTaskDescription; + } + public void setApprovalTaskDescription(String approvalTaskDescription) { + this.approvalTaskDescription = approvalTaskDescription; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WorkflowDetails workflowDetails = (WorkflowDetails) o; + return Objects.equals(this.id, workflowDetails.id) && + Objects.equals(this.name, workflowDetails.name) && + Objects.equals(this.description, workflowDetails.description) && + Objects.equals(this.engine, workflowDetails.engine) && + Objects.equals(this.template, workflowDetails.template) && + Objects.equals(this.approvalTask, workflowDetails.approvalTask) && + Objects.equals(this.approvalTaskDescription, workflowDetails.approvalTaskDescription); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, description, engine, template, approvalTask, approvalTaskDescription); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class WorkflowDetails {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" engine: ").append(toIndentedString(engine)).append("\n"); + sb.append(" template: ").append(toIndentedString(template)).append("\n"); + sb.append(" approvalTask: ").append(toIndentedString(approvalTask)).append("\n"); + sb.append(" approvalTaskDescription: ").append(toIndentedString(approvalTaskDescription)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowEngine.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowEngine.java new file mode 100644 index 0000000000..4570058c58 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowEngine.java @@ -0,0 +1,167 @@ +/* + * 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.rest.api.server.workflow.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; + + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; + +public class WorkflowEngine { + + private String profileName; + private String workerHostURL; + private String managerHostURL; + private String userName; + + /** + * A unique name for the workflow engine. + **/ + public WorkflowEngine profileName(String profileName) { + + this.profileName = profileName; + return this; + } + + @ApiModelProperty(example = "embedded_bps", required = true, value = "A unique name for the workflow engine.") + @JsonProperty("profileName") + @Valid + @NotNull(message = "Property profileName cannot be null.") + + public String getProfileName() { + return profileName; + } + public void setProfileName(String profileName) { + this.profileName = profileName; + } + + /** + * URL of the workflow worker node. + **/ + public WorkflowEngine workerHostURL(String workerHostURL) { + + this.workerHostURL = workerHostURL; + return this; + } + + @ApiModelProperty(example = "https://localhost:9443/services", value = "URL of the workflow worker node.") + @JsonProperty("workerHostURL") + @Valid + public String getWorkerHostURL() { + return workerHostURL; + } + public void setWorkerHostURL(String workerHostURL) { + this.workerHostURL = workerHostURL; + } + + /** + * URL of the workflow manager node. + **/ + public WorkflowEngine managerHostURL(String managerHostURL) { + + this.managerHostURL = managerHostURL; + return this; + } + + @ApiModelProperty(example = "https://localhost:9443/services", value = "URL of the workflow manager node.") + @JsonProperty("managerHostURL") + @Valid + public String getManagerHostURL() { + return managerHostURL; + } + public void setManagerHostURL(String managerHostURL) { + this.managerHostURL = managerHostURL; + } + + /** + * Username of the creator of the workflow engine. + **/ + public WorkflowEngine userName(String userName) { + + this.userName = userName; + return this; + } + + @ApiModelProperty(example = "challengeQuestion1", value = "Username of the creator of the workflow engine.") + @JsonProperty("userName") + @Valid + public String getUserName() { + return userName; + } + public void setUserName(String userName) { + this.userName = userName; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WorkflowEngine workflowEngine = (WorkflowEngine) o; + return Objects.equals(this.profileName, workflowEngine.profileName) && + Objects.equals(this.workerHostURL, workflowEngine.workerHostURL) && + Objects.equals(this.managerHostURL, workflowEngine.managerHostURL) && + Objects.equals(this.userName, workflowEngine.userName); + } + + @Override + public int hashCode() { + return Objects.hash(profileName, workerHostURL, managerHostURL, userName); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class WorkflowEngine {\n"); + + sb.append(" profileName: ").append(toIndentedString(profileName)).append("\n"); + sb.append(" workerHostURL: ").append(toIndentedString(workerHostURL)).append("\n"); + sb.append(" managerHostURL: ").append(toIndentedString(managerHostURL)).append("\n"); + sb.append(" userName: ").append(toIndentedString(userName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowSummary.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowSummary.java new file mode 100644 index 0000000000..091e01a87c --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowSummary.java @@ -0,0 +1,187 @@ +/* + * 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.rest.api.server.workflow.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; + + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; + +public class WorkflowSummary { + + private String id; + private String name; + private String description; + private String engine; + private String template; + + /** + * Unique id to represent a workflow + **/ + public WorkflowSummary id(String id) { + + this.id = id; + return this; + } + + @ApiModelProperty(example = "100", value = "Unique id to represent a workflow") + @JsonProperty("id") + @Valid + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + + /** + * Display name of the workflow + **/ + public WorkflowSummary name(String name) { + + this.name = name; + return this; + } + + @ApiModelProperty(example = "User Role Approval", value = "Display name of the workflow") + @JsonProperty("name") + @Valid + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + /** + * Detailed description of the workflow + **/ + public WorkflowSummary description(String description) { + + this.description = description; + return this; + } + + @ApiModelProperty(example = "Workflow to approve user role related requests", value = "Detailed description of the workflow") + @JsonProperty("description") + @Valid + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + + /** + * Category in which the workflow is deployed + **/ + public WorkflowSummary engine(String engine) { + + this.engine = engine; + return this; + } + + @ApiModelProperty(example = "Simple Workflow Engine", value = "Category in which the workflow is deployed") + @JsonProperty("engine") + @Valid + public String getEngine() { + return engine; + } + public void setEngine(String engine) { + this.engine = engine; + } + + /** + * Template defining the approval process for the workflow + **/ + public WorkflowSummary template(String template) { + + this.template = template; + return this; + } + + @ApiModelProperty(example = "MultiStepApprovalTemplate", value = "Template defining the approval process for the workflow") + @JsonProperty("template") + @Valid + public String getTemplate() { + return template; + } + public void setTemplate(String template) { + this.template = template; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WorkflowSummary workflowSummary = (WorkflowSummary) o; + return Objects.equals(this.id, workflowSummary.id) && + Objects.equals(this.name, workflowSummary.name) && + Objects.equals(this.description, workflowSummary.description) && + Objects.equals(this.engine, workflowSummary.engine) && + Objects.equals(this.template, workflowSummary.template); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, description, engine, template); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class WorkflowSummary {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" engine: ").append(toIndentedString(engine)).append("\n"); + sb.append(" template: ").append(toIndentedString(template)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowTemplate.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowTemplate.java new file mode 100644 index 0000000000..2297f8a90d --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowTemplate.java @@ -0,0 +1,132 @@ +/* + * 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.rest.api.server.workflow.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowTemplateParameters; +import javax.validation.constraints.*; + + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; + +public class WorkflowTemplate { + + private String name; + private List<WorkflowTemplateParameters> steps = null; + + + /** + * Name of the workflow template + **/ + public WorkflowTemplate name(String name) { + + this.name = name; + return this; + } + + @ApiModelProperty(example = "MultiStepApprovalTemplate", value = "Name of the workflow template") + @JsonProperty("name") + @Valid + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + /** + **/ + public WorkflowTemplate steps(List<WorkflowTemplateParameters> steps) { + + this.steps = steps; + return this; + } + + @ApiModelProperty(value = "") + @JsonProperty("steps") + @Valid @Size(min=1) + public List<WorkflowTemplateParameters> getSteps() { + return steps; + } + public void setSteps(List<WorkflowTemplateParameters> steps) { + this.steps = steps; + } + + public WorkflowTemplate addStepsItem(WorkflowTemplateParameters stepsItem) { + if (this.steps == null) { + this.steps = new ArrayList<>(); + } + this.steps.add(stepsItem); + return this; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WorkflowTemplate workflowTemplate = (WorkflowTemplate) o; + return Objects.equals(this.name, workflowTemplate.name) && + Objects.equals(this.steps, workflowTemplate.steps); + } + + @Override + public int hashCode() { + return Objects.hash(name, steps); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class WorkflowTemplate {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" steps: ").append(toIndentedString(steps)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowTemplateBase.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowTemplateBase.java new file mode 100644 index 0000000000..5bc8b2354b --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowTemplateBase.java @@ -0,0 +1,132 @@ +/* + * 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.rest.api.server.workflow.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.WorkflowTemplateParametersBase; +import javax.validation.constraints.*; + + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; + +public class WorkflowTemplateBase { + + private String name; + private List<WorkflowTemplateParametersBase> steps = null; + + + /** + * Name of the workflow template + **/ + public WorkflowTemplateBase name(String name) { + + this.name = name; + return this; + } + + @ApiModelProperty(example = "MultiStepApproval", value = "Name of the workflow template") + @JsonProperty("name") + @Valid + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + /** + **/ + public WorkflowTemplateBase steps(List<WorkflowTemplateParametersBase> steps) { + + this.steps = steps; + return this; + } + + @ApiModelProperty(value = "") + @JsonProperty("steps") + @Valid @Size(min=1) + public List<WorkflowTemplateParametersBase> getSteps() { + return steps; + } + public void setSteps(List<WorkflowTemplateParametersBase> steps) { + this.steps = steps; + } + + public WorkflowTemplateBase addStepsItem(WorkflowTemplateParametersBase stepsItem) { + if (this.steps == null) { + this.steps = new ArrayList<>(); + } + this.steps.add(stepsItem); + return this; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WorkflowTemplateBase workflowTemplateBase = (WorkflowTemplateBase) o; + return Objects.equals(this.name, workflowTemplateBase.name) && + Objects.equals(this.steps, workflowTemplateBase.steps); + } + + @Override + public int hashCode() { + return Objects.hash(name, steps); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class WorkflowTemplateBase {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" steps: ").append(toIndentedString(steps)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowTemplateParameters.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowTemplateParameters.java new file mode 100644 index 0000000000..20b8b272de --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowTemplateParameters.java @@ -0,0 +1,131 @@ +/* + * 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.rest.api.server.workflow.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.OptionDetails; +import javax.validation.constraints.*; + + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; + +public class WorkflowTemplateParameters { + + private Integer step; + private List<OptionDetails> options = null; + + + /** + **/ + public WorkflowTemplateParameters step(Integer step) { + + this.step = step; + return this; + } + + @ApiModelProperty(example = "1", value = "") + @JsonProperty("step") + @Valid + public Integer getStep() { + return step; + } + public void setStep(Integer step) { + this.step = step; + } + + /** + **/ + public WorkflowTemplateParameters options(List<OptionDetails> options) { + + this.options = options; + return this; + } + + @ApiModelProperty(example = "[{\"entity\":\"roles\",\"values\":[\"admin\",\"manager\"]},{\"entity\":\"users\",\"values\":[\"John\",\"Tom\"]}]", value = "") + @JsonProperty("options") + @Valid @Size(min=1) + public List<OptionDetails> getOptions() { + return options; + } + public void setOptions(List<OptionDetails> options) { + this.options = options; + } + + public WorkflowTemplateParameters addOptionsItem(OptionDetails optionsItem) { + if (this.options == null) { + this.options = new ArrayList<>(); + } + this.options.add(optionsItem); + return this; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WorkflowTemplateParameters workflowTemplateParameters = (WorkflowTemplateParameters) o; + return Objects.equals(this.step, workflowTemplateParameters.step) && + Objects.equals(this.options, workflowTemplateParameters.options); + } + + @Override + public int hashCode() { + return Objects.hash(step, options); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class WorkflowTemplateParameters {\n"); + + sb.append(" step: ").append(toIndentedString(step)).append("\n"); + sb.append(" options: ").append(toIndentedString(options)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowTemplateParametersBase.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowTemplateParametersBase.java new file mode 100644 index 0000000000..4e3224012f --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/model/WorkflowTemplateParametersBase.java @@ -0,0 +1,131 @@ +/* + * 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.rest.api.server.workflow.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.wso2.carbon.identity.rest.api.server.workflow.v1.model.OptionDetails; +import javax.validation.constraints.*; + + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; + +public class WorkflowTemplateParametersBase { + + private Integer step; + private List<OptionDetails> options = null; + + + /** + **/ + public WorkflowTemplateParametersBase step(Integer step) { + + this.step = step; + return this; + } + + @ApiModelProperty(example = "1", value = "") + @JsonProperty("step") + @Valid + public Integer getStep() { + return step; + } + public void setStep(Integer step) { + this.step = step; + } + + /** + **/ + public WorkflowTemplateParametersBase options(List<OptionDetails> options) { + + this.options = options; + return this; + } + + @ApiModelProperty(example = "[{\"entity\":\"roles\",\"values\":[\"admin\",\"manager\"]},{\"entity\":\"users\",\"values\":[\"John\",\"Tom\"]}]", value = "") + @JsonProperty("options") + @Valid @Size(min=1) + public List<OptionDetails> getOptions() { + return options; + } + public void setOptions(List<OptionDetails> options) { + this.options = options; + } + + public WorkflowTemplateParametersBase addOptionsItem(OptionDetails optionsItem) { + if (this.options == null) { + this.options = new ArrayList<>(); + } + this.options.add(optionsItem); + return this; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WorkflowTemplateParametersBase workflowTemplateParametersBase = (WorkflowTemplateParametersBase) o; + return Objects.equals(this.step, workflowTemplateParametersBase.step) && + Objects.equals(this.options, workflowTemplateParametersBase.options); + } + + @Override + public int hashCode() { + return Objects.hash(step, options); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class WorkflowTemplateParametersBase {\n"); + + sb.append(" step: ").append(toIndentedString(step)).append("\n"); + sb.append(" options: ").append(toIndentedString(options)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + From 74e32547f3c4ce4c3a5f8ba5505a4f91fe0a85a4 Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Mon, 17 Mar 2025 10:01:14 +0530 Subject: [PATCH 45/47] Improve formatting and add class comments --- .../identity/api/server/workflow/common/Constants.java | 9 +++++---- .../server/workflow/common/WorkflowServiceHolder.java | 6 +++--- .../factories/WorkflowAssociationsApiServiceFactory.java | 4 ++-- .../v1/factories/WorkflowEngineServiceFactory.java | 1 - 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.api.server.workflow.common/src/main/java/org/wso2/carbon/identity/api/server/workflow/common/Constants.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.api.server.workflow.common/src/main/java/org/wso2/carbon/identity/api/server/workflow/common/Constants.java index 604ecbed31..bf1eceba45 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.api.server.workflow.common/src/main/java/org/wso2/carbon/identity/api/server/workflow/common/Constants.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.api.server.workflow.common/src/main/java/org/wso2/carbon/identity/api/server/workflow/common/Constants.java @@ -24,7 +24,6 @@ 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"; @@ -33,7 +32,6 @@ public class Constants { public static final String WORKFLOW_IMPLEMENTATION = "Workflowimpl"; public static final String WORKFLOW_NAME = "WorkflowName"; - private Constants() { } @@ -91,32 +89,35 @@ public enum ErrorMessage { "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; } } diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.api.server.workflow.common/src/main/java/org/wso2/carbon/identity/api/server/workflow/common/WorkflowServiceHolder.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.api.server.workflow.common/src/main/java/org/wso2/carbon/identity/api/server/workflow/common/WorkflowServiceHolder.java index 6fd23b0053..d8520ae24f 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.api.server.workflow.common/src/main/java/org/wso2/carbon/identity/api/server/workflow/common/WorkflowServiceHolder.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.api.server.workflow.common/src/main/java/org/wso2/carbon/identity/api/server/workflow/common/WorkflowServiceHolder.java @@ -22,6 +22,9 @@ 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(); @@ -30,13 +33,10 @@ public class WorkflowServiceHolder { public static WorkflowManagementService getWorkflowManagementService() { return service; - } public static WorkflowImplServiceImpl getWorkflowImplService() { return implService; - } - } diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowAssociationsApiServiceFactory.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowAssociationsApiServiceFactory.java index 56ffcb6b17..6302e8b003 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowAssociationsApiServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowAssociationsApiServiceFactory.java @@ -28,8 +28,8 @@ public class WorkflowAssociationsApiServiceFactory { private final static WorkflowAssociationsApiService service = new WorkflowAssociationsApiServiceImpl(); - public static WorkflowAssociationsApiService getWorkflowAssociationsApi() - { + public static WorkflowAssociationsApiService getWorkflowAssociationsApi() { + return service; } } diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowEngineServiceFactory.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowEngineServiceFactory.java index 31b6c34553..0baeea03c7 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowEngineServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowEngineServiceFactory.java @@ -40,5 +40,4 @@ public static WorkflowEngineService getWorkflowEngineService() { return SERVICE; } - } From 1ee09d42f9266c42cea81aed8cfcaa09e987ba3d Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Mon, 17 Mar 2025 10:02:57 +0530 Subject: [PATCH 46/47] Update method names --- .../server/workflow/v1/core/WorkflowService.java | 13 ++----------- .../v1/impl/WorkflowAssociationsApiServiceImpl.java | 2 +- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowService.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowService.java index 0ae51d6fec..1e33dcb20f 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowService.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/core/WorkflowService.java @@ -184,9 +184,6 @@ public WorkflowSummary[] listPaginatedWorkflows(Integer limit, Integer offset, S if (limit == null || offset == null) { limit = 15; offset = 0; - } else { - limit = limit.intValue(); - offset = offset.intValue(); } currentWorkflows = workflowManagementService.listPaginatedWorkflows(tenantId, limit, offset, filter); for (Workflow workflow : currentWorkflows) { @@ -198,9 +195,7 @@ public WorkflowSummary[] listPaginatedWorkflows(Integer limit, Integer offset, S throw handleClientError(Constants.ErrorMessage.ERROR_CODE_CLIENT_ERROR_LISTING_WORKFLOWS, null, e); } catch (WorkflowException e) { throw handleServerError(Constants.ErrorMessage.ERROR_CODE_ERROR_LISTING_WORKFLOWS, null, e); - } - } /** @@ -236,9 +231,6 @@ public WorkflowAssociation[] listPaginatedAssociations(Integer limit, Integer of if (limit == null || offset == null) { limit = 15; offset = 0; - } else { - limit = limit.intValue(); - offset = offset.intValue(); } associationBeans = workflowManagementService.listPaginatedAssociations( CarbonContext.getThreadLocalCarbonContext().getTenantId(), limit, offset, filter); @@ -341,7 +333,7 @@ public WorkflowAssociationDetails getAssociation(String associationId) { * @param workflowAssociation Association Details * @return WorkflowAssociationDetails */ - public WorkflowAssociationDetails changeAssociation(String associationId, WorkflowAssociationPatch workflowAssociation) { + public WorkflowAssociationDetails updateAssociation(String associationId, WorkflowAssociationPatch workflowAssociation) { boolean isEnable; String eventId; @@ -357,7 +349,7 @@ public WorkflowAssociationDetails changeAssociation(String associationId, Workfl } else { eventId = workflowAssociation.getOperation().toString(); } - workflowManagementService.changeAssociation(associationId, workflowAssociation.getAssociationName(), + workflowManagementService.updateAssociation(associationId, workflowAssociation.getAssociationName(), workflowAssociation.getWorkflowId(), eventId, workflowAssociation.getAssociationCondition(), isEnable); return getAssociation(associationId); @@ -549,7 +541,6 @@ private APIError handleServerError(Constants.ErrorMessage errorEnum, String data ErrorResponse errorResponse = getErrorBuilder(errorEnum, data).build(log, e, includeData(e.getMessage(), data)); return new APIError(Response.Status.INTERNAL_SERVER_ERROR, errorResponse); - } private APIError handleClientError(Constants.ErrorMessage errorEnum, String data, WorkflowClientException e) { diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowAssociationsApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowAssociationsApiServiceImpl.java index 6327ea04e0..b9cfa7c6e7 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowAssociationsApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/impl/WorkflowAssociationsApiServiceImpl.java @@ -65,6 +65,6 @@ public Response listWorkflowAssociations(Integer limit, Integer offset, String f @Override public Response updateAssociation(String associationId, WorkflowAssociationPatch workflowAssociation) { - return Response.ok().entity(workflowService.changeAssociation(associationId, workflowAssociation)).build(); + return Response.ok().entity(workflowService.updateAssociation(associationId, workflowAssociation)).build(); } } From 24a1a3e6aa63ec1993933c917cc8cad3cca8fbc8 Mon Sep 17 00:00:00 2001 From: senudyl <senurimallikarachchi@gmail.com> Date: Mon, 17 Mar 2025 10:03:37 +0530 Subject: [PATCH 47/47] Add class comments --- .../workflow/v1/factories/WorkflowsApiServiceFactory.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowsApiServiceFactory.java b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowsApiServiceFactory.java index cef856258d..84f3512f43 100644 --- a/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowsApiServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.workflow/org.wso2.carbon.identity.rest.api.server.workflow.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/workflow/v1/factories/WorkflowsApiServiceFactory.java @@ -21,6 +21,9 @@ import org.wso2.carbon.identity.rest.api.server.workflow.v1.WorkflowsApiService; import org.wso2.carbon.identity.rest.api.server.workflow.v1.impl.WorkflowsApiServiceImpl; +/** + * Implementation of Workflow Management REST API. + */ public class WorkflowsApiServiceFactory { private final static WorkflowsApiService service = new WorkflowsApiServiceImpl();