-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement workflow approvalService #1
base: main
Are you sure you want to change the base?
Changes from all commits
643a396
0f8bc6d
1efe729
42e8139
80ed261
5589a4c
4a884a4
93cce6d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<?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> | ||
<artifactId>default.workflow.engine</artifactId> | ||
<groupId>org.wso2.carbon.identity.workflow.engine</groupId> | ||
<version>1.0-SNAPSHOT</version> | ||
<relativePath>../../pom.xml</relativePath> | ||
</parent> | ||
<artifactId>workflow.engine</artifactId> | ||
<packaging>bundle</packaging> | ||
<name>WSO2 Carbon - Workflow Engine Simple</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.wso2.carbon.identity.framework</groupId> | ||
<artifactId>org.wso2.carbon.identity.configuration.mgt.core</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.wso2.carbon.identity.framework</groupId> | ||
<artifactId>org.wso2.carbon.user.mgt.common</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.wso2.carbon.identity.framework</groupId> | ||
<artifactId>org.wso2.carbon.user.mgt</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.wso2.carbon.identity.framework</groupId> | ||
<artifactId>org.wso2.carbon.identity.workflow.mgt</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.felix</groupId> | ||
<artifactId>org.apache.felix.scr.ds-annotations</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.wso2.carbon.identity.framework</groupId> | ||
<artifactId>org.wso2.carbon.user.mgt</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.felix</groupId> | ||
<artifactId>maven-bundle-plugin</artifactId> | ||
<version>3.2.0</version> | ||
<extensions>true</extensions> | ||
<configuration> | ||
<obrRepository>NONE</obrRepository> | ||
<instructions> | ||
<SCM-Revision>${buildNumber}</SCM-Revision> | ||
<Private-Package> | ||
org.wso2.carbon.identity.workflow.engine.internal, | ||
</Private-Package> | ||
<Export-Package> | ||
!org.wso2.carbon.identity.workflow.engine.internal, | ||
org.wso2.carbon.identity.workflow.engine.*; | ||
</Export-Package> | ||
</instructions> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>findbugs-maven-plugin</artifactId> | ||
<version>${maven.findbugsplugin.version}</version> | ||
<configuration> | ||
<excludeFilterFile>findbugs-exclude.xml</excludeFilterFile> | ||
<effort>Max</effort> | ||
<threshold>Low</threshold> | ||
<xmlOutput>true</xmlOutput> | ||
<findbugsXmlOutputDirectory>${project.build.directory}/findbugs</findbugsXmlOutputDirectory> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>analyze-compile</id> | ||
<phase>compile</phase> | ||
<goals> | ||
<goal>check</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package org.wso2.carbon.identity.workflow.engine; | ||
|
||
import org.wso2.carbon.identity.workflow.mgt.bean.Parameter; | ||
import org.wso2.carbon.identity.workflow.mgt.bean.metadata.InputData; | ||
import org.wso2.carbon.identity.workflow.mgt.bean.metadata.Item; | ||
import org.wso2.carbon.identity.workflow.mgt.bean.metadata.MapType; | ||
import org.wso2.carbon.identity.workflow.mgt.bean.metadata.ParameterMetaData; | ||
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.workflow.AbstractWorkflow; | ||
import org.wso2.carbon.identity.workflow.mgt.workflow.TemplateInitializer; | ||
import org.wso2.carbon.identity.workflow.mgt.workflow.WorkFlowExecutor; | ||
|
||
import java.util.List; | ||
|
||
import static org.wso2.carbon.identity.workflow.engine.util.WorkflowEngineConstants.ParameterName.BPS_PROFILE; | ||
import static org.wso2.carbon.identity.workflow.engine.util.WorkflowEngineConstants.ParameterName.HT_SUBJECT; | ||
|
||
/** | ||
* The class that extends the AbstractWorkflow class. | ||
*/ | ||
public class DefaultApprovalWorkflow extends AbstractWorkflow { | ||
|
||
|
||
public DefaultApprovalWorkflow(Class<? extends TemplateInitializer> templateInitializerClass, | ||
Class<? extends WorkFlowExecutor> workFlowExecutorClass, String metaDataXML) | ||
throws WorkflowRuntimeException { | ||
|
||
super(templateInitializerClass, workFlowExecutorClass, metaDataXML); | ||
} | ||
|
||
/** | ||
*{@inheritDoc} | ||
*/ | ||
@Override | ||
protected InputData getInputData(ParameterMetaData parameterMetaData) { | ||
|
||
InputData inputData = null; | ||
if (parameterMetaData != null && parameterMetaData.getName() != null) { | ||
String parameterName = parameterMetaData.getName(); | ||
if (BPS_PROFILE.equals(parameterName)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove BPS profile There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. addressed with commit 032e778 of 2nd PR. |
||
inputData = new InputData(); | ||
MapType mapType = new MapType(); | ||
inputData.setMapType(mapType); | ||
Item item = new Item(); | ||
item.setKey("embeded_bps"); | ||
item.setValue("embeded_bps"); | ||
mapType.setItem(new Item[]{item}); | ||
} else if (HT_SUBJECT.equals(parameterName)) { | ||
inputData = new InputData(); | ||
MapType mapType = new MapType(); | ||
inputData.setMapType(mapType); | ||
Item item1 = new Item(); | ||
item1.setKey("subject1"); | ||
item1.setValue("subject1"); | ||
Item item2 = new Item(); | ||
item2.setKey("subject2"); | ||
item2.setValue("subject2"); | ||
mapType.setItem(new Item[]{item1, item2}); | ||
} | ||
} | ||
return inputData; | ||
} | ||
|
||
/** | ||
*{@inheritDoc} | ||
*/ | ||
@Override | ||
public void deploy(List<Parameter> parameterList) throws WorkflowException { | ||
|
||
super.deploy(parameterList); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package org.wso2.carbon.identity.workflow.engine; | ||
|
||
import org.wso2.carbon.identity.workflow.mgt.bean.Parameter; | ||
import org.wso2.carbon.identity.workflow.mgt.bean.WorkflowAssociation; | ||
import org.wso2.carbon.identity.workflow.mgt.dto.WorkflowRequest; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Default Workflow Event Request service interface. | ||
*/ | ||
public interface DefaultWorkflowEventRequest { | ||
|
||
/** | ||
* Add who approves the relevant request. | ||
* | ||
* @param request workflow request object. | ||
* @param parameterList parameterList. | ||
*/ | ||
void addApproversOfRequests(WorkflowRequest request, List<Parameter> parameterList); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rename methods. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. addressed these type of issues from 032e778 of 2nd PR. |
||
|
||
/** | ||
* Get taskId from WF_REQUEST_APPROVAL_RELATION table. | ||
* | ||
* @param eventId the request ID that need to be checked. | ||
* @return task Id. | ||
*/ | ||
String getApprovalOfRequest(String eventId); | ||
|
||
/** | ||
* Delete approver details using task Id. | ||
* | ||
* @param taskId random generated unique Id. | ||
*/ | ||
void deleteApprovalOfRequest(String taskId); | ||
|
||
/** | ||
* Add current step. | ||
* | ||
* @param eventId the request ID that need to be checked. | ||
* @param workflowId workflow id. | ||
* @param currentStep current step of the flow. | ||
*/ | ||
void createStatesOfRequest(String eventId, String workflowId, int currentStep); | ||
|
||
/** | ||
* Get current step from the table. | ||
* | ||
* @param eventId the request ID that need to be checked. | ||
* @param workflowId workflow Id. | ||
* @return currentStep. | ||
*/ | ||
int getStateOfRequest(String eventId, String workflowId); | ||
|
||
/** | ||
*Update current step according to the eventId and workflowId. | ||
* | ||
* @param eventId the request ID that need to be checked. | ||
* @param workflowId workflow Id. | ||
*/ | ||
void updateStateOfRequest(String eventId, String workflowId); | ||
|
||
/** | ||
* Get related associations. | ||
* | ||
* @param workflowRequest request object. | ||
* @return association list. | ||
*/ | ||
List<WorkflowAssociation> getAssociations(WorkflowRequest workflowRequest); | ||
|
||
/** | ||
* Get relevant workflow id to request. | ||
* | ||
* @param request request object. | ||
* @return workflow Id. | ||
*/ | ||
String getWorkflowId(WorkflowRequest request); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add property
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addresses this issue from 032e778 of 2nd PR.