requestEntities = requestEntityRelationshipDAO.getEntityNamesOfRequest(wfOperationType, wfStatus,
- entityType, idFilter, tenantID);
- for (WorkflowListener workflowListener : workflowListenerList) {
- if (workflowListener.isEnable()) {
- workflowListener.doPostListEntityNames(wfOperationType, wfStatus, entityType, tenantID, idFilter,
- requestEntities);
- }
- }
- return requestEntities;
- }
-
-
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/Entity.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/Entity.java
deleted file mode 100644
index 40b911d56507..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/Entity.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.bean;
-
-/**
- * This class is used to represent entities associated with workflows, eg:- User entity, Role entity
- */
-public class Entity {
-
- private String entityId;
- private String entityType;
- private int tenantId;
-
- public Entity(String entityId, String entityType, int tenantId) {
- this.entityId = entityId;
- this.entityType = entityType;
- this.tenantId = tenantId;
- }
-
- /**
- * Retrieve entity type
- *
- * @return
- */
- public String getEntityType() {
- return entityType;
- }
-
- /**
- * Set type of entity
- *
- * @param entityType value to set as entity type
- */
- public void setEntityType(String entityType) {
- this.entityType = entityType;
- }
-
- /**
- * Retrieve entity ID
- *
- * @return
- */
- public String getEntityId() {
- return entityId;
- }
-
- /**
- * Set entity ID
- *
- * @param entityId value to set as entity ID
- */
- public void setEntityId(String entityId) {
- this.entityId = entityId;
- }
-
- /**
- * Get ID of the tenant which entity belongs
- *
- * @return
- */
- public int getTenantId() {
- return tenantId;
- }
-
- /**
- * Set tenant ID for entity
- *
- * @param tenantId value to set as tenant ID
- */
- public void setTenantId(int tenantId) {
- this.tenantId = tenantId;
- }
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/Parameter.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/Parameter.java
deleted file mode 100644
index 63a9c9819555..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/Parameter.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.bean;
-
-import java.io.Serializable;
-
-/**
- * This is the Bean class that represent the Parameter per workflow.
- *
- * workflowId : Unique Id for the workflow
- * paramName : Parameter Name that is defined in the metafile
- * paramValue : Value for this parameter
- * qName : Fully qualified name for this parameter. There can be more than one Parameter in same ParamName and but unique by qName.
- * holder : This is represent either template or workflowImpl
- *
- *
- */
-public class Parameter implements Serializable {
-
- private static final long serialVersionUID = 7063803305644510640L;
-
- private String workflowId;
- private String paramName;
- private String paramValue;
- private String qName;
- private String holder;
-
- public Parameter() {
- }
-
-
- /**
- *
- * @param workflowId
- * @param paramName
- * @param paramValue
- * @param qName
- * @param holder
- */
- public Parameter(String workflowId, String paramName, String paramValue, String qName, String holder) {
- this.workflowId = workflowId;
- this.paramName = paramName;
- this.paramValue = paramValue;
- this.qName = qName;
- this.holder = holder;
- }
-
- public String getParamName() {
- return paramName;
- }
-
- public void setParamName(String paramName) {
- this.paramName = paramName;
- }
-
- public String getParamValue() {
- return paramValue;
- }
-
- public void setParamValue(String paramValue) {
- this.paramValue = paramValue;
- }
-
- public String getWorkflowId() {
- return workflowId;
- }
-
- public void setWorkflowId(String workflowId) {
- this.workflowId = workflowId;
- }
-
- public String getqName() {
- return qName;
- }
-
- public void setqName(String qName) {
- this.qName = qName;
- }
-
- public String getHolder() {
- return holder;
- }
-
- public void setHolder(String holder) {
- this.holder = holder;
- }
-
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- Parameter parameter = (Parameter) o;
-
- if (!workflowId.equals(parameter.workflowId)) return false;
- if (!paramName.equals(parameter.paramName)) return false;
- if (!qName.equals(parameter.qName)) return false;
- return holder.equals(parameter.holder);
-
- }
-
- @Override
- public int hashCode() {
- int result = workflowId.hashCode();
- result = 31 * result + paramName.hashCode();
- result = 31 * result + qName.hashCode();
- result = 31 * result + holder.hashCode();
- return result;
- }
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/RequestParameter.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/RequestParameter.java
deleted file mode 100644
index 8cef2409b807..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/RequestParameter.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.bean;
-
-import java.io.Serializable;
-
-public class RequestParameter implements Serializable{
-
- private static final long serialVersionUID = -8564170214424881696L;
-
- private String name;
- private Object value;
- private String valueType;
- private boolean requiredInWorkflow;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Object getValue() {
- return value;
- }
-
- public void setValue(Object value) {
- this.value = value;
- }
-
- public String getValueType() {
- return valueType;
- }
-
- public void setValueType(String valueType) {
- this.valueType = valueType;
- }
-
- public boolean isRequiredInWorkflow() {
- return requiredInWorkflow;
- }
-
- public void setRequiredInWorkflow(boolean requiredInWorkflow) {
- this.requiredInWorkflow = requiredInWorkflow;
- }
-
- @Override
- public String toString() {
- return "WorkflowParameter{" +
- "name='" + name + "\'\n" +
- ", value=" + value + "\n" +
- ", valueType='" + valueType + "\'\n" +
- ", requiredInWorkflow=" + requiredInWorkflow + "\n" +
- '}';
- }
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/Workflow.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/Workflow.java
deleted file mode 100644
index c050e02fedf6..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/Workflow.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.bean;
-
-import java.io.Serializable;
-
-/**
- * Simple Bean for Workflow
- */
-public class Workflow implements Serializable {
-
- private static final long serialVersionUID = -5191252401224311955L;
-
- private String workflowId;
- private String workflowName;
- private String workflowDescription;
-
- private String templateId;
- private String workflowImplId;
-
- public String getWorkflowId() {
- return workflowId;
- }
-
- public void setWorkflowId(String workflowId) {
- this.workflowId = workflowId;
- }
-
- public String getWorkflowName() {
- return workflowName;
- }
-
- public void setWorkflowName(String workflowName) {
- this.workflowName = workflowName;
- }
-
- public String getWorkflowDescription() {
- return workflowDescription;
- }
-
- public void setWorkflowDescription(String workflowDescription) {
- this.workflowDescription = workflowDescription;
- }
-
-
- public String getWorkflowImplId() {
- return workflowImplId;
- }
-
- public void setWorkflowImplId(String workflowImplId) {
- this.workflowImplId = workflowImplId;
- }
-
- public String getTemplateId() {
- return templateId;
- }
-
- public void setTemplateId(String templateId) {
- this.templateId = templateId;
- }
-
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/WorkflowAssociation.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/WorkflowAssociation.java
deleted file mode 100644
index e0dcfaf32f80..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/WorkflowAssociation.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.bean;
-
-public class WorkflowAssociation {
-
- private int associationId;
- private String associationName ;
- private String eventId;
- private String associationCondition;
- private String workflowId;
- private boolean isEnabled;
-
- public int getAssociationId() {
- return associationId;
- }
-
- public void setAssociationId(int associationId) {
- this.associationId = associationId;
- }
-
- public String getEventId() {
- return eventId;
- }
-
- public void setEventId(String eventId) {
- this.eventId = eventId;
- }
-
- public String getAssociationCondition() {
- return associationCondition;
- }
-
- public void setAssociationCondition(String associationCondition) {
- this.associationCondition = associationCondition;
- }
-
- public String getWorkflowId() {
- return workflowId;
- }
-
- public void setWorkflowId(String workflowId) {
- this.workflowId = workflowId;
- }
-
- public boolean isEnabled() {
- return isEnabled;
- }
-
- public void setIsEnabled(boolean isEnabled) {
- this.isEnabled = isEnabled;
- }
-
- public String getAssociationName() {
- return associationName;
- }
-
- public void setAssociationName(String associationName) {
- this.associationName = associationName;
- }
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/WorkflowRequest.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/WorkflowRequest.java
deleted file mode 100644
index 44e1375a360a..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/WorkflowRequest.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.bean;
-
-/**
- * This object represent a request associated with a workflow.
- */
-public class WorkflowRequest {
-
- private String requestId;
- private String eventType;
- private String createdAt;
- private String updatedAt;
- private String status;
- private String requestParams;
- private String createdBy;
-
- public String getRequestId() {
- return requestId;
- }
-
- public void setRequestId(String requestId) {
- this.requestId = requestId;
- }
-
- public String getEventType() {
- return eventType;
- }
-
- public void setEventType(String eventType) {
- this.eventType = eventType;
- }
-
- public String getRequestParams() {
- return requestParams;
- }
-
- public void setRequestParams(String requestParams) {
- this.requestParams = requestParams;
- }
-
- public String getUpdatedAt() {
- return updatedAt;
- }
-
- public void setUpdatedAt(String updatedAt) {
- this.updatedAt = updatedAt;
- }
-
- public String getStatus() {
- return status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
- public String getCreatedAt() {
- return createdAt;
- }
-
- public void setCreatedAt(String createdAt) {
- this.createdAt = createdAt;
- }
-
- public String getCreatedBy() {
- return createdBy;
- }
-
- public void setCreatedBy(String createdBy) {
- this.createdBy = createdBy;
- }
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/WorkflowRequestAssociation.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/WorkflowRequestAssociation.java
deleted file mode 100644
index a63d0d54874f..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/WorkflowRequestAssociation.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.bean;
-
-/**
- * This object represent a workflow association.
- */
-public class WorkflowRequestAssociation {
-
- private String workflowId;
- private String workflowName;
- private String lastUpdatedTime;
- private String status;
-
- public String getWorkflowId() {
- return workflowId;
- }
-
- public void setWorkflowId(String workflowId) {
- this.workflowId = workflowId;
- }
-
- public String getWorkflowName() {
- return workflowName;
- }
-
- public void setWorkflowName(String workflowName) {
- this.workflowName = workflowName;
- }
-
- public String getLastUpdatedTime() {
- return lastUpdatedTime;
- }
-
- public void setLastUpdatedTime(String lastUpdatedTime) {
- this.lastUpdatedTime = lastUpdatedTime;
- }
-
- public String getStatus() {
- return status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/metadata/InputData.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/metadata/InputData.java
deleted file mode 100644
index 83a693e00322..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/metadata/InputData.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.bean.metadata;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * Java class for InputData complex type.
- *
- *
The following schema fragment specifies the expected content contained within this class.
- *
- *
- * <complexType name="InputData">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <choice>
- * <element name="MapType" type="{http://metadata.bean.mgt.workflow.identity.carbon.wso2.org}MapType" minOccurs="0"/>
- * </choice>
- * </restriction>
- * </complexContent>
- * </complexType>
- *
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "InputData", propOrder = {
- "mapType"
-})
-public class InputData {
-
- @XmlElement(name = "MapType")
- protected MapType mapType;
-
- /**
- * Gets the value of the mapType property.
- *
- * @return
- * possible object is
- * {@link MapType }
- *
- */
- public MapType getMapType() {
- return mapType;
- }
-
- /**
- * Sets the value of the mapType property.
- *
- * @param value
- * allowed object is
- * {@link MapType }
- *
- */
- public void setMapType(MapType value) {
- this.mapType = value;
- }
-
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/metadata/Item.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/metadata/Item.java
deleted file mode 100644
index 1becec5eb82c..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/metadata/Item.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.bean.metadata;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * Java class for Item complex type.
- *
- *
The following schema fragment specifies the expected content contained within this class.
- *
- *
- * <complexType name="Item">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="Key" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="Value" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- *
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "Item", propOrder = {
- "key",
- "value"
-})
-public class Item {
-
- @XmlElement(name = "Key", required = true)
- protected String key;
- @XmlElement(name = "Value", required = true)
- protected String value;
-
- /**
- * Gets the value of the key property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getKey() {
- return key;
- }
-
- /**
- * Sets the value of the key property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setKey(String value) {
- this.key = value;
- }
-
- /**
- * Gets the value of the value property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getValue() {
- return value;
- }
-
- /**
- * Sets the value of the value property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setValue(String value) {
- this.value = value;
- }
-
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/metadata/MapType.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/metadata/MapType.java
deleted file mode 100644
index ace04991f981..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/metadata/MapType.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.bean.metadata;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * Java class for MapType complex type.
- *
- *
The following schema fragment specifies the expected content contained within this class.
- *
- *
- * <complexType name="MapType">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="Item" type="{http://metadata.bean.mgt.workflow.identity.carbon.wso2.org}Item" maxOccurs="unbounded"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- *
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "MapType", propOrder = {
- "item"
-})
-public class MapType {
-
- @XmlElement(name = "Item", required = true)
- protected Item[] item;
-
- public Item[] getItem() {
- return item;
- }
-
- public void setItem(Item[] item) {
- this.item = item;
- }
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/metadata/MetaData.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/metadata/MetaData.java
deleted file mode 100644
index 56e01f678407..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/metadata/MetaData.java
+++ /dev/null
@@ -1,443 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.bean.metadata;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * Java class for anonymous complex type.
- *
- *
The following schema fragment specifies the expected content contained within this class.
- *
- *
- * <complexType>
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <choice>
- * <element name="Template">
- * <complexType>
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="TemplateId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="TemplateName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="TemplateDescription" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="ParametersMetaData" type="{http://metadata.bean.mgt.workflow.identity.carbon.wso2.org}ParametersMetaData" minOccurs="0"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </element>
- * <element name="WorkflowImpl">
- * <complexType>
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="WorkflowImplId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="WorkflowImplName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="WorkflowImplDescription" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="TemplateId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="ParametersMetaData" type="{http://metadata.bean.mgt.workflow.identity.carbon.wso2.org}ParametersMetaData" minOccurs="0"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </element>
- * </choice>
- * </restriction>
- * </complexContent>
- * </complexType>
- *
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {
- "template",
- "workflowImpl"
-})
-@XmlRootElement(name = "MetaData")
-public class MetaData {
-
- @XmlElement(name = "Template")
- protected MetaData.Template template;
- @XmlElement(name = "WorkflowImpl")
- protected MetaData.WorkflowImpl workflowImpl;
-
- /**
- * Gets the value of the template property.
- *
- * @return
- * possible object is
- * {@link MetaData.Template }
- *
- */
- public MetaData.Template getTemplate() {
- return template;
- }
-
- /**
- * Sets the value of the template property.
- *
- * @param value
- * allowed object is
- * {@link MetaData.Template }
- *
- */
- public void setTemplate(MetaData.Template value) {
- this.template = value;
- }
-
- /**
- * Gets the value of the workflowImpl property.
- *
- * @return
- * possible object is
- * {@link MetaData.WorkflowImpl }
- *
- */
- public MetaData.WorkflowImpl getWorkflowImpl() {
- return workflowImpl;
- }
-
- /**
- * Sets the value of the workflowImpl property.
- *
- * @param value
- * allowed object is
- * {@link MetaData.WorkflowImpl }
- *
- */
- public void setWorkflowImpl(MetaData.WorkflowImpl value) {
- this.workflowImpl = value;
- }
-
-
- /**
- * Java class for anonymous complex type.
- *
- *
The following schema fragment specifies the expected content contained within this class.
- *
- *
- * <complexType>
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="TemplateId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="TemplateName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="TemplateDescription" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="ParametersMetaData" type="{http://metadata.bean.mgt.workflow.identity.carbon.wso2.org}ParametersMetaData" minOccurs="0"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- *
- *
- *
- */
- @XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {
- "templateId",
- "templateName",
- "templateDescription",
- "parametersMetaData"
- })
- public static class Template {
-
- @XmlElement(name = "TemplateId", required = true)
- protected String templateId;
- @XmlElement(name = "TemplateName", required = true)
- protected String templateName;
- @XmlElement(name = "TemplateDescription")
- protected String templateDescription;
- @XmlElement(name = "ParametersMetaData")
- protected ParametersMetaData parametersMetaData;
-
- /**
- * Gets the value of the templateId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getTemplateId() {
- return templateId;
- }
-
- /**
- * Sets the value of the templateId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setTemplateId(String value) {
- this.templateId = value;
- }
-
- /**
- * Gets the value of the templateName property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getTemplateName() {
- return templateName;
- }
-
- /**
- * Sets the value of the templateName property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setTemplateName(String value) {
- this.templateName = value;
- }
-
- /**
- * Gets the value of the templateDescription property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getTemplateDescription() {
- return templateDescription;
- }
-
- /**
- * Sets the value of the templateDescription property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setTemplateDescription(String value) {
- this.templateDescription = value;
- }
-
- /**
- * Gets the value of the parametersMetaData property.
- *
- * @return
- * possible object is
- * {@link ParametersMetaData }
- *
- */
- public ParametersMetaData getParametersMetaData() {
- return parametersMetaData;
- }
-
- /**
- * Sets the value of the parametersMetaData property.
- *
- * @param value
- * allowed object is
- * {@link ParametersMetaData }
- *
- */
- public void setParametersMetaData(ParametersMetaData value) {
- this.parametersMetaData = value;
- }
-
- }
-
-
- /**
- * Java class for anonymous complex type.
- *
- *
The following schema fragment specifies the expected content contained within this class.
- *
- *
- * <complexType>
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="WorkflowImplId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="WorkflowImplName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="WorkflowImplDescription" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="TemplateId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="ParametersMetaData" type="{http://metadata.bean.mgt.workflow.identity.carbon.wso2.org}ParametersMetaData" minOccurs="0"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- *
- *
- *
- */
- @XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {
- "workflowImplId",
- "workflowImplName",
- "workflowImplDescription",
- "templateId",
- "parametersMetaData"
- })
- public static class WorkflowImpl {
-
- @XmlElement(name = "WorkflowImplId", required = true)
- protected String workflowImplId;
- @XmlElement(name = "WorkflowImplName", required = true)
- protected String workflowImplName;
- @XmlElement(name = "WorkflowImplDescription")
- protected String workflowImplDescription;
- @XmlElement(name = "TemplateId", required = true)
- protected String templateId;
- @XmlElement(name = "ParametersMetaData")
- protected ParametersMetaData parametersMetaData;
-
- /**
- * Gets the value of the workflowImplId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getWorkflowImplId() {
- return workflowImplId;
- }
-
- /**
- * Sets the value of the workflowImplId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setWorkflowImplId(String value) {
- this.workflowImplId = value;
- }
-
- /**
- * Gets the value of the workflowImplName property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getWorkflowImplName() {
- return workflowImplName;
- }
-
- /**
- * Sets the value of the workflowImplName property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setWorkflowImplName(String value) {
- this.workflowImplName = value;
- }
-
- /**
- * Gets the value of the workflowImplDescription property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getWorkflowImplDescription() {
- return workflowImplDescription;
- }
-
- /**
- * Sets the value of the workflowImplDescription property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setWorkflowImplDescription(String value) {
- this.workflowImplDescription = value;
- }
-
- /**
- * Gets the value of the templateId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getTemplateId() {
- return templateId;
- }
-
- /**
- * Sets the value of the templateId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setTemplateId(String value) {
- this.templateId = value;
- }
-
- /**
- * Gets the value of the parametersMetaData property.
- *
- * @return
- * possible object is
- * {@link ParametersMetaData }
- *
- */
- public ParametersMetaData getParametersMetaData() {
- return parametersMetaData;
- }
-
- /**
- * Sets the value of the parametersMetaData property.
- *
- * @param value
- * allowed object is
- * {@link ParametersMetaData }
- *
- */
- public void setParametersMetaData(ParametersMetaData value) {
- this.parametersMetaData = value;
- }
-
- }
-
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/metadata/ObjectFactory.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/metadata/ObjectFactory.java
deleted file mode 100644
index fc98cea88528..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/metadata/ObjectFactory.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.bean.metadata;
-
-import javax.xml.bind.annotation.XmlRegistry;
-
-
-/**
- * This object contains factory methods for each
- * Java content interface and Java element interface
- * generated in the org.wso2.carbon.identity.workflow.mgt.bean.metadata package.
- * An ObjectFactory allows you to programatically
- * construct new instances of the Java representation
- * for XML content. The Java representation of XML
- * content can consist of schema derived interfaces
- * and classes representing the binding of schema
- * type definitions, element declarations and model
- * groups. Factory methods for each of these are
- * provided in this class.
- *
- */
-@XmlRegistry
-public class ObjectFactory {
-
-
- /**
- * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.wso2.carbon.identity.workflow.mgt.bean.metadata
- *
- */
- public ObjectFactory() {
- }
-
- /**
- * Create an instance of {@link MetaData }
- *
- */
- public MetaData createMetaData() {
- return new MetaData();
- }
-
- /**
- * Create an instance of {@link MetaData.Template }
- *
- */
- public MetaData.Template createMetaDataTemplate() {
- return new MetaData.Template();
- }
-
- /**
- * Create an instance of {@link MetaData.WorkflowImpl }
- *
- */
- public MetaData.WorkflowImpl createMetaDataWorkflowImpl() {
- return new MetaData.WorkflowImpl();
- }
-
- /**
- * Create an instance of {@link ParametersMetaData }
- *
- */
- public ParametersMetaData createParametersMetaData() {
- return new ParametersMetaData();
- }
-
- /**
- * Create an instance of {@link ParameterMetaData }
- *
- */
- public ParameterMetaData createParameterMetaData() {
- return new ParameterMetaData();
- }
-
- /**
- * Create an instance of {@link InputData }
- *
- */
- public InputData createInputData() {
- return new InputData();
- }
-
- /**
- * Create an instance of {@link MapType }
- *
- */
- public MapType createMapType() {
- return new MapType();
- }
-
- /**
- * Create an instance of {@link Item }
- *
- */
- public Item createItem() {
- return new Item();
- }
-
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/metadata/ParameterMetaData.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/metadata/ParameterMetaData.java
deleted file mode 100644
index 9f66672a8e8b..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/metadata/ParameterMetaData.java
+++ /dev/null
@@ -1,366 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.bean.metadata;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- *
Java class for ParameterMetaData complex type.
- *
- *
The following schema fragment specifies the expected content contained within this class.
- *
- *
- * <complexType name="ParameterMetaData">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="DisplayName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="DefaultValue" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="RegExForValidate" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="InputData" type="{http://metadata.bean.mgt.workflow.identity.carbon.wso2.org}InputData" minOccurs="0"/>
- * </sequence>
- * <attribute name="Name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- * <attribute name="DataType" type="{http://www.w3.org/2001/XMLSchema}string" />
- * <attribute name="InputType" type="{http://www.w3.org/2001/XMLSchema}string" />
- * <attribute name="CustomInputType" type="{http://www.w3.org/2001/XMLSchema}string" />
- * <attribute name="isRequired" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" />
- * <attribute name="Validate" type="{http://www.w3.org/2001/XMLSchema}boolean" default="true" />
- * <attribute name="isInputDataRequired" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" />
- * </restriction>
- * </complexContent>
- * </complexType>
- *
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "ParameterMetaData", propOrder = {
- "displayName",
- "defaultValue",
- "regExForValidate",
- "inputData"
-})
-public class ParameterMetaData {
-
- @XmlElement(name = "DisplayName", required = true)
- protected String displayName;
- @XmlElement(name = "DefaultValue")
- protected String defaultValue;
- @XmlElement(name = "RegExForValidate")
- protected String regExForValidate;
- @XmlElement(name = "InputData")
- protected InputData inputData;
- @XmlAttribute(name = "Name", required = true)
- protected String name;
- @XmlAttribute(name = "DataType")
- protected String dataType;
- @XmlAttribute(name = "InputType")
- protected String inputType;
- @XmlAttribute(name = "CustomInputType")
- protected String customInputType;
- @XmlAttribute(name = "isRequired")
- protected Boolean isRequired;
- @XmlAttribute(name = "Validate")
- protected Boolean validate;
- @XmlAttribute(name = "isInputDataRequired")
- protected Boolean isInputDataRequired;
-
- /**
- * Gets the value of the displayName property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getDisplayName() {
- return displayName;
- }
-
- /**
- * Sets the value of the displayName property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setDisplayName(String value) {
- this.displayName = value;
- }
-
- /**
- * Gets the value of the defaultValue property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getDefaultValue() {
- return defaultValue;
- }
-
- /**
- * Sets the value of the defaultValue property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setDefaultValue(String value) {
- this.defaultValue = value;
- }
-
- /**
- * Gets the value of the regExForValidate property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getRegExForValidate() {
- return regExForValidate;
- }
-
- /**
- * Sets the value of the regExForValidate property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setRegExForValidate(String value) {
- this.regExForValidate = value;
- }
-
- /**
- * Gets the value of the inputData property.
- *
- * @return
- * possible object is
- * {@link InputData }
- *
- */
- public InputData getInputData() {
- return inputData;
- }
-
- /**
- * Sets the value of the inputData property.
- *
- * @param value
- * allowed object is
- * {@link InputData }
- *
- */
- public void setInputData(InputData value) {
- this.inputData = value;
- }
-
- /**
- * Gets the value of the name property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets the value of the name property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setName(String value) {
- this.name = value;
- }
-
- /**
- * Gets the value of the dataType property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getDataType() {
- return dataType;
- }
-
- /**
- * Sets the value of the dataType property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setDataType(String value) {
- this.dataType = value;
- }
-
- /**
- * Gets the value of the inputType property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getInputType() {
- return inputType;
- }
-
- /**
- * Sets the value of the inputType property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setInputType(String value) {
- this.inputType = value;
- }
-
- /**
- * Gets the value of the customInputType property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getCustomInputType() {
- return customInputType;
- }
-
- /**
- * Sets the value of the customInputType property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setCustomInputType(String value) {
- this.customInputType = value;
- }
-
- /**
- * Gets the value of the isRequired property.
- *
- * @return
- * possible object is
- * {@link Boolean }
- *
- */
- public boolean isIsRequired() {
- if (isRequired == null) {
- return false;
- } else {
- return isRequired;
- }
- }
-
- /**
- * Sets the value of the isRequired property.
- *
- * @param value
- * allowed object is
- * {@link Boolean }
- *
- */
- public void setIsRequired(Boolean value) {
- this.isRequired = value;
- }
-
- /**
- * Gets the value of the validate property.
- *
- * @return
- * possible object is
- * {@link Boolean }
- *
- */
- public boolean isValidate() {
- if (validate == null) {
- return true;
- } else {
- return validate;
- }
- }
-
- /**
- * Sets the value of the validate property.
- *
- * @param value
- * allowed object is
- * {@link Boolean }
- *
- */
- public void setValidate(Boolean value) {
- this.validate = value;
- }
-
- /**
- * Gets the value of the isInputDataRequired property.
- *
- * @return
- * possible object is
- * {@link Boolean }
- *
- */
- public boolean isIsInputDataRequired() {
- if (isInputDataRequired == null) {
- return false;
- } else {
- return isInputDataRequired;
- }
- }
-
- /**
- * Sets the value of the isInputDataRequired property.
- *
- * @param value
- * allowed object is
- * {@link Boolean }
- *
- */
- public void setIsInputDataRequired(Boolean value) {
- this.isInputDataRequired = value;
- }
-
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/metadata/ParametersMetaData.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/metadata/ParametersMetaData.java
deleted file mode 100644
index 500f05fa48b8..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/metadata/ParametersMetaData.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.bean.metadata;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * Java class for ParametersMetaData complex type.
- *
- *
The following schema fragment specifies the expected content contained within this class.
- *
- *
- * <complexType name="ParametersMetaData">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="ParameterMetaData" type="{http://metadata.bean.mgt.workflow.identity.carbon.wso2.org}ParameterMetaData" maxOccurs="unbounded"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- *
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "ParametersMetaData", propOrder = {
- "parameterMetaData"
-})
-public class ParametersMetaData {
-
- @XmlElement(name = "ParameterMetaData", required = true)
- protected ParameterMetaData[] parameterMetaData;
-
- public ParameterMetaData[] getParameterMetaData() {
- return parameterMetaData;
- }
-
- public void setParameterMetaData(
- ParameterMetaData[] parameterMetaData) {
- this.parameterMetaData = parameterMetaData;
- }
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/metadata/package-info.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/metadata/package-info.java
deleted file mode 100644
index 51282f1a7d97..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/metadata/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.
- */
-
-@javax.xml.bind.annotation.XmlSchema(namespace = "http://metadata.bean.mgt.workflow.identity.carbon.wso2.org", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
-package org.wso2.carbon.identity.workflow.mgt.bean.metadata;
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/metadata/type/DataType.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/metadata/type/DataType.java
deleted file mode 100644
index 8dc26e9c9c6f..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/metadata/type/DataType.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.bean.metadata.type;
-
-
-public enum DataType {
-
- STRING("String"),
- DOUBLE("Double"),
- INTEGER("Integer"),
- BOOLEAN("Boolean"),
- DATE_TIME("DateTime");
- private final String value;
-
- DataType(String v) {
- value = v;
- }
-
- public String value() {
- return value;
- }
-
- public static DataType fromValue(String v) {
- for (DataType c: DataType.values()) {
- if (c.value.equals(v)) {
- return c;
- }
- }
- throw new IllegalArgumentException(v);
- }
-
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/metadata/type/InputType.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/metadata/type/InputType.java
deleted file mode 100644
index 439e1136a485..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/bean/metadata/type/InputType.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.bean.metadata.type;
-
-
-public enum InputType {
-
- SELECT("Select"),
- MULTIPLE_SELECT("Multiple_Select"),
- OPTION("Option"),
- SINGLE_CHECK_BOX("Single_CheckBox"),
- MULTIPLE_CHECK_BOX("Multiple_CheckBox"),
- TEXT_AREA("TextArea"),
- PASSWORD("Password"),
- TEXT("Text"),
- MULTIPLE_STEPS_USER_ROLE("Multiple_Steps_User_Role");
- private final String value;
-
- InputType(String v) {
- value = v;
- }
-
- public String value() {
- return value;
- }
-
- public static InputType fromValue(String v) {
- for (InputType c: InputType.values()) {
- if (c.value.equals(v)) {
- return c;
- }
- }
- throw new IllegalArgumentException(v);
- }
-
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/callback/WSParameter.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/callback/WSParameter.java
deleted file mode 100644
index 58f15850c25f..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/callback/WSParameter.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.callback;
-
-/**
- * Represent any additional parameters returned from the workflow
- */
-public class WSParameter {
-
- private String name;
- private String value;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/callback/WSWorkflowCallBackService.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/callback/WSWorkflowCallBackService.java
deleted file mode 100644
index 888d572243b9..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/callback/WSWorkflowCallBackService.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.callback;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.identity.workflow.mgt.WorkFlowExecutorManager;
-import org.wso2.carbon.identity.workflow.mgt.exception.WorkflowException;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * This is the Callback service for the WS Workflow requests. Once workflow executor completes its workflow,
- * it will call back this service with the results.
- */
-public class WSWorkflowCallBackService {
-
- private static final Log log = LogFactory.getLog(WSWorkflowCallBackService.class);
-
- /**
- * The callback operation to be called on the completion of the workflow executor service
- *
- * @param response Response received from workflow engine
- */
- public void onCallback(WSWorkflowResponse response) {
- if (response != null) {
- Map outputParams;
- if (response.getOutputParams() != null) {
- outputParams = new HashMap<>(response.getOutputParams().length);
- for (WSParameter parameter : response.getOutputParams()) {
- outputParams.put(parameter.getName(), parameter.getValue());
- }
- } else {
- outputParams = Collections.emptyMap();
- }
- try {
- WorkFlowExecutorManager.getInstance()
- .handleCallback(response.getUuid(), response.getStatus(), outputParams);
- } catch (WorkflowException e) {
- log.error("Error when handling callback for the workflow, id: " + response.getUuid() + ", status:" +
- response.getStatus(), e);
- }
- }
- }
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/callback/WSWorkflowResponse.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/callback/WSWorkflowResponse.java
deleted file mode 100644
index a7c9baa0ad1f..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/callback/WSWorkflowResponse.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.callback;
-
-/**
- * Represents the response from WS workflow executors
- */
-public class WSWorkflowResponse {
-
- private String uuid;
- private String status;
- private WSParameter[] outputParams;
-
- public String getUuid() {
- return uuid;
- }
-
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
- public String getStatus() {
- return status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
- public WSParameter[] getOutputParams() {
- return outputParams;
- }
-
- public void setOutputParams(WSParameter[] outputParams) {
- this.outputParams = outputParams;
- }
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/dao/AssociationDAO.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/dao/AssociationDAO.java
deleted file mode 100644
index 1b984bb1eb20..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/dao/AssociationDAO.java
+++ /dev/null
@@ -1,442 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.dao;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.database.utils.jdbc.exceptions.DataAccessException;
-import org.wso2.carbon.identity.core.util.IdentityDatabaseUtil;
-import org.wso2.carbon.identity.core.util.JdbcUtils;
-import org.wso2.carbon.identity.workflow.mgt.dto.Association;
-import org.wso2.carbon.identity.workflow.mgt.exception.InternalWorkflowException;
-import org.wso2.carbon.identity.workflow.mgt.util.SQLConstants;
-import org.wso2.carbon.identity.workflow.mgt.util.WFConstant;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Association related DAO operation provides by this class
- *
- */
-public class AssociationDAO {
-
- private final String errorMessage = "Error when executing the SQL query ";
- private static final Log log = LogFactory.getLog(WorkflowDAO.class);
-
- /**
- *
- * @param associationName
- * @param workflowId
- * @param eventId
- * @param condition
- * @throws InternalWorkflowException
- */
- public void addAssociation(String associationName, String workflowId, String eventId, String condition)
- throws InternalWorkflowException {
-
- Connection connection = IdentityDatabaseUtil.getDBConnection();
- PreparedStatement prepStmt = null;
-
- String query = SQLConstants.ASSOCIATE_WF_TO_EVENT;
- try {
- prepStmt = connection.prepareStatement(query);
- prepStmt.setString(1, eventId);
- prepStmt.setString(2, associationName);
- prepStmt.setString(3, condition);
- prepStmt.setString(4, workflowId);
- prepStmt.executeUpdate();
- IdentityDatabaseUtil.commitTransaction(connection);
- } catch (SQLException e) {
- IdentityDatabaseUtil.rollbackTransaction(connection);
- throw new InternalWorkflowException(errorMessage, e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, null, prepStmt);
- }
- }
-
-
- /**
- *
- * @param associationDTO
- * @throws InternalWorkflowException
- */
- public void updateAssociation(Association associationDTO)
- throws InternalWorkflowException {
-
- Connection connection = IdentityDatabaseUtil.getDBConnection();
- PreparedStatement prepStmt = null;
-
- String query = SQLConstants.UPDATE_ASSOCIATE_WF_TO_EVENT;
- try {
- prepStmt = connection.prepareStatement(query);
- prepStmt.setString(1, associationDTO.getEventId());
- prepStmt.setString(2, associationDTO.getAssociationName());
- prepStmt.setString(3, associationDTO.getCondition());
- prepStmt.setString(4, associationDTO.getWorkflowId());
- if (associationDTO.isEnabled()) {
- prepStmt.setString(5, "1");
- } else {
- prepStmt.setString(5, "0");
- }
- // As the WF_WORKFLOW_ASSOCIATION.ID is integer, this has to be set as a int to work with postgre
- prepStmt.setInt(6, Integer.parseInt(associationDTO.getAssociationId()));
- prepStmt.executeUpdate();
- IdentityDatabaseUtil.commitTransaction(connection);
- } catch (SQLException e) {
- IdentityDatabaseUtil.rollbackTransaction(connection);
- throw new InternalWorkflowException(errorMessage, e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, null, prepStmt);
- }
- }
-
- /**
- * Retrieve associations of a tenant with pagination.
- *
- * @param tenantId
- * @param filter
- * @param offset
- * @param limit
- * @return List
- * @throws InternalWorkflowException
- */
- public List listPaginatedAssociations(int tenantId, String filter, int offset, int limit) throws InternalWorkflowException{
-
- String sqlQuery;
- List associations = new ArrayList<>();
- try (Connection connection = IdentityDatabaseUtil.getDBConnection(false)) {
- String filterResolvedForSQL = resolveSQLFilter(filter);
- sqlQuery = getSqlQuery();
- try (PreparedStatement prepStmt = generatePrepStmt(connection, sqlQuery, tenantId,
- filterResolvedForSQL, offset, limit)) {
- try (ResultSet resultSet = prepStmt.executeQuery()) {
- while (resultSet.next()) {
- String condition = resultSet.getString(SQLConstants.CONDITION_COLUMN);
- String eventId = resultSet.getString(SQLConstants.EVENT_ID_COLUMN);
- String associationId = String.valueOf(resultSet.getInt(SQLConstants.ID_COLUMN));
- String associationName = resultSet.getString(SQLConstants.ASSOCIATION_NAME_COLUMN);
- String workflowName = resultSet.getString(SQLConstants.WF_NAME_COLUMN);
- String isEnable = resultSet.getString(SQLConstants.ASSOCIATION_IS_ENABLED);
- Association associationDTO = new Association();
- associationDTO.setCondition(condition);
- associationDTO.setAssociationId(associationId);
- associationDTO.setEventId(eventId);
- associationDTO.setAssociationName(associationName);
- associationDTO.setWorkflowName(workflowName);
- associations.add(associationDTO);
- if (isEnable.equals("1")) {
- associationDTO.setEnabled(true);
- } else {
- associationDTO.setEnabled(false);
- }
- }
- }
- }
- } catch (SQLException e) {
- handleException(WFConstant.Exceptions.SQL_ERROR_LISTING_ASSOCIATIONS, e);
- } catch (DataAccessException e) {
- handleException(e.getMessage(), e);
- }
- return associations;
- }
-
- /**
- *
- * @Deprecated Use {@link #listPaginatedAssociations(int, String, int, int)} instead.
- * @param tenantId Tenant ID
- * @return
- * @throws InternalWorkflowException
- */
- @Deprecated
- public List listAssociations(int tenantId) throws InternalWorkflowException {
-
- Connection connection = IdentityDatabaseUtil.getDBConnection(false);
- PreparedStatement prepStmt = null;
- ResultSet rs;
- List associations = new ArrayList<>();
- String query = SQLConstants.GET_ALL_ASSOCIATIONS_QUERY;
- try {
- prepStmt = connection.prepareStatement(query);
- prepStmt.setInt(1, tenantId);
- rs = prepStmt.executeQuery();
- while (rs.next()) {
- String condition = rs.getString(SQLConstants.CONDITION_COLUMN);
- String eventId = rs.getString(SQLConstants.EVENT_ID_COLUMN);
- String associationId = String.valueOf(rs.getInt(SQLConstants.ID_COLUMN));
- String associationName = rs.getString(SQLConstants.ASSOCIATION_NAME_COLUMN);
- String workflowName = rs.getString(SQLConstants.WF_NAME_COLUMN);
- String isEnable = rs.getString(SQLConstants.ASSOCIATION_IS_ENABLED);
- Association associationDTO = new Association();
- associationDTO.setCondition(condition);
- associationDTO.setAssociationId(associationId);
- associationDTO.setEventId(eventId);
- associationDTO.setAssociationName(associationName);
- associationDTO.setWorkflowName(workflowName);
- associations.add(associationDTO);
- if(isEnable.equals("1")){
- associationDTO.setEnabled(true);
- }else{
- associationDTO.setEnabled(false);
- }
- }
- } catch (SQLException e) {
- throw new InternalWorkflowException(errorMessage, e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, null, prepStmt);
- }
- return associations;
- }
-
- /**
- * Get associations count of a tenant.
- *
- * @param tenantId
- * @param filter
- * @return Return associations count
- * @throws InternalWorkflowException
- */
- public int getAssociationsCount(int tenantId, String filter) throws InternalWorkflowException{
-
- int count = 0;
- try (Connection connection = IdentityDatabaseUtil.getDBConnection(false)) {
- String filterResolvedForSQL = resolveSQLFilter(filter);
- try (PreparedStatement prepStmt = connection
- .prepareStatement(SQLConstants.GET_ASSOCIATIONS_COUNT_QUERY)) {
- prepStmt.setInt(1, tenantId);
- prepStmt.setString(2, filterResolvedForSQL);
- try (ResultSet resultSet = prepStmt.executeQuery()) {
- if (resultSet.next()) {
- count = resultSet.getInt(1);
- }
- }
- }
- } catch (SQLException e) {
- handleException(WFConstant.Exceptions.SQL_ERROR_GETTING_ASSOC_COUNT, e);
- }
- return count;
- }
-
- /**
- *
- * @param associationId
- * @return
- * @throws InternalWorkflowException
- */
- public Association getAssociation(String associationId) throws InternalWorkflowException {
-
- Connection connection = IdentityDatabaseUtil.getDBConnection(false);
- PreparedStatement prepStmt = null;
- ResultSet rs;
- Association associationDTO = null ;
- String query = SQLConstants.GET_ASSOCIATION_FOR_ASSOC_ID_QUERY;
- try {
- prepStmt = connection.prepareStatement(query);
- // As the WF_WORKFLOW_ASSOCIATION.ID is integer, this has to be set as a int to work with postgre
- prepStmt.setInt(1, Integer.parseInt(associationId));
-
- rs = prepStmt.executeQuery();
-
- while (rs.next()) {
- String condition = rs.getString(SQLConstants.CONDITION_COLUMN);
- String eventId = rs.getString(SQLConstants.EVENT_ID_COLUMN);
- String associationName = rs.getString(SQLConstants.ASSOCIATION_NAME_COLUMN);
- String workflowName = rs.getString(SQLConstants.WF_NAME_COLUMN);
- String workflowId = rs.getString(SQLConstants.WORKFLOW_ID_COLUMN);
- String isEnable = rs.getString(SQLConstants.ASSOCIATION_IS_ENABLED);
- associationDTO = new Association();
- associationDTO.setCondition(condition);
- associationDTO.setAssociationId(associationId);
- associationDTO.setEventId(eventId);
- associationDTO.setWorkflowId(workflowId);
- associationDTO.setAssociationName(associationName);
- associationDTO.setWorkflowName(workflowName);
-
- if(isEnable.equals("1")){
- associationDTO.setEnabled(true);
- }else{
- associationDTO.setEnabled(false);
- }
- }
- } catch (SQLException e) {
- throw new InternalWorkflowException(errorMessage, e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, null, prepStmt);
- }
- return associationDTO;
- }
-
- /**
- *
- * @param id
- * @throws InternalWorkflowException
- */
- public void removeAssociation(int id) throws InternalWorkflowException {
-
- Connection connection = IdentityDatabaseUtil.getDBConnection();
- PreparedStatement prepStmt = null;
- String query = SQLConstants.DELETE_ASSOCIATION_QUERY;
- try {
- prepStmt = connection.prepareStatement(query);
- prepStmt.setInt(1, id);
- prepStmt.executeUpdate();
- IdentityDatabaseUtil.commitTransaction(connection);
- } catch (SQLException e) {
- IdentityDatabaseUtil.rollbackTransaction(connection);
- throw new InternalWorkflowException(errorMessage, e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, null, prepStmt);
- }
- }
-
- /**
- *
- * @param workflowId
- * @return
- * @throws InternalWorkflowException
- */
- public List listAssociationsForWorkflow(String workflowId)
- throws InternalWorkflowException {
-
- Connection connection = IdentityDatabaseUtil.getDBConnection(false);
- PreparedStatement prepStmt = null;
- ResultSet rs;
- List associations = new ArrayList<>();
- String query = SQLConstants.GET_ASSOCIATIONS_FOR_WORKFLOW_QUERY;
- try {
- prepStmt = connection.prepareStatement(query);
- prepStmt.setString(1, workflowId);
- rs = prepStmt.executeQuery();
- while (rs.next()) {
- String condition = rs.getString(SQLConstants.CONDITION_COLUMN);
- String eventId = rs.getString(SQLConstants.EVENT_ID_COLUMN);
- String associationId = String.valueOf(rs.getInt(SQLConstants.ID_COLUMN));
- String associationName = rs.getString(SQLConstants.ASSOCIATION_NAME_COLUMN);
- String workflowName = rs.getString(SQLConstants.WF_NAME_COLUMN);
- Association associationDTO = new Association();
- associationDTO.setCondition(condition);
- associationDTO.setAssociationId(associationId);
- associationDTO.setEventId(eventId);
- associationDTO.setAssociationName(associationName);
- associationDTO.setWorkflowName(workflowName);
- associations.add(associationDTO);
- }
- } catch (SQLException e) {
- throw new InternalWorkflowException(errorMessage, e);
- }
- return associations;
- }
-
- /**
- *
- * @throws InternalWorkflowException
- * @throws DataAccessException
- */
- private String getSqlQuery() throws InternalWorkflowException, DataAccessException {
-
- String sqlQuery ;
- if (JdbcUtils.isH2DB() || JdbcUtils.isMySQLDB() || JdbcUtils.isMariaDB()) {
- sqlQuery = SQLConstants.GET_ASSOCIATIONS_BY_TENANT_AND_ASSOC_NAME_MYSQL;
- } else if (JdbcUtils.isOracleDB()) {
- sqlQuery = SQLConstants.GET_ASSOCIATIONS_BY_TENANT_AND_ASSOC_NAME_ORACLE;
- } else if (JdbcUtils.isMSSqlDB()) {
- sqlQuery = SQLConstants.GET_ASSOCIATIONS_BY_TENANT_AND_ASSOC_NAME_MSSQL;
- } else if (JdbcUtils.isPostgreSQLDB()) {
- sqlQuery = SQLConstants.GET_ASSOCIATIONS_BY_TENANT_AND_ASSOC_NAME_POSTGRESQL;
- } else if (JdbcUtils.isDB2DB()) {
- sqlQuery = SQLConstants.GET_ASSOCIATIONS_BY_TENANT_AND_ASSOC_NAME_DB2SQL;
- } else if (JdbcUtils.isInformixDB()) {
- sqlQuery = SQLConstants.GET_ASSOCIATIONS_BY_TENANT_AND_ASSOC_NAME_INFORMIX;
- } else {
- throw new InternalWorkflowException(WFConstant.Exceptions.ERROR_WHILE_LOADING_ASSOCIATIONS);
- }
- return sqlQuery;
- }
-
- /**
- * Create PreparedStatement.
- *
- * @param connection db connection
- * @param sqlQuery SQL query
- * @param tenantId Tenant ID
- * @param filterResolvedForSQL resolved filter for sql
- * @param offset offset
- * @param limit limit
- * @return PreparedStatement
- * @throws SQLException
- * @throws DataAccessException
- */
- private PreparedStatement generatePrepStmt(Connection connection, String sqlQuery, int tenantId, String filterResolvedForSQL, int offset, int limit) throws SQLException, DataAccessException {
-
- PreparedStatement prepStmt ;
- if (JdbcUtils.isPostgreSQLDB()) {
- prepStmt = connection.prepareStatement(sqlQuery);
- prepStmt.setInt(1, tenantId);
- prepStmt.setString(2, filterResolvedForSQL);
- prepStmt.setInt(3, limit);
- prepStmt.setInt(4, offset);
- } else {
- prepStmt = connection.prepareStatement(sqlQuery);
- prepStmt.setInt(1, tenantId);
- prepStmt.setString(2, filterResolvedForSQL);
- prepStmt.setInt(3, offset);
- prepStmt.setInt(4, limit);
- }
- return prepStmt;
- }
-
- /**
- * Resolve SQL Filter.
- *
- * @param filter
- * @return Return SQL filter
- * @throws InternalWorkflowException
- */
- private String resolveSQLFilter(String filter) {
-
- //To avoid any issues when the filter string is blank or null, assigning "%" to SQLFilter.
- String sqlFilter = "%";
- if (StringUtils.isNotBlank(filter)) {
- sqlFilter = filter.trim()
- .replace("*", "%")
- .replace("?", "_");
- }
- return sqlFilter;
- }
-
- /**
- * Logs and wraps the given exception.
- *
- * @param errorMsg Error message
- * @param e Exception
- * @throws InternalWorkflowException
- */
- private void handleException(String errorMsg, Exception e) throws InternalWorkflowException {
-
- if (log.isDebugEnabled()) {
- log.debug(errorMsg, e);
- }
- throw new InternalWorkflowException(errorMsg, e);
- }
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/dao/RequestEntityRelationshipDAO.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/dao/RequestEntityRelationshipDAO.java
deleted file mode 100644
index 39fd8c6fa9dd..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/dao/RequestEntityRelationshipDAO.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.dao;
-
-import org.wso2.carbon.identity.core.util.IdentityDatabaseUtil;
-import org.wso2.carbon.identity.workflow.mgt.bean.Entity;
-import org.wso2.carbon.identity.workflow.mgt.exception.InternalWorkflowException;
-import org.wso2.carbon.identity.workflow.mgt.util.SQLConstants;
-import org.wso2.carbon.identity.workflow.mgt.util.WorkflowRequestStatus;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.List;
-
-public class RequestEntityRelationshipDAO {
-
- /**
- * Add a new relationship between a workflow request and an entity.
- *
- * @param entity
- * @param uuid
- * @throws InternalWorkflowException
- */
- public void addRelationship(Entity entity, String uuid) throws InternalWorkflowException {
-
- Connection connection = IdentityDatabaseUtil.getDBConnection();
- PreparedStatement prepStmt = null;
- String query = SQLConstants.ADD_REQUEST_ENTITY_RELATIONSHIP;
- try {
- prepStmt = connection.prepareStatement(query);
- prepStmt.setString(1, uuid);
- prepStmt.setString(2, entity.getEntityId());
- prepStmt.setString(3, entity.getEntityType());
- prepStmt.setInt(4, entity.getTenantId());
- prepStmt.executeUpdate();
- IdentityDatabaseUtil.commitTransaction(connection);
- } catch (SQLException e) {
- IdentityDatabaseUtil.rollbackTransaction(connection);
- throw new InternalWorkflowException("Error when executing the sql query", e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, null, prepStmt);
- }
- }
-
- /**
- * Delete existing relationships of a request.
- *
- * @param uuid
- * @throws InternalWorkflowException
- */
- public void deleteRelationshipsOfRequest(String uuid) throws InternalWorkflowException {
-
- Connection connection = IdentityDatabaseUtil.getDBConnection();
- PreparedStatement prepStmt = null;
- String query = SQLConstants.DELETE_REQUEST_ENTITY_RELATIONSHIP;
- try {
- prepStmt = connection.prepareStatement(query);
- prepStmt.setString(1, uuid);
- prepStmt.executeUpdate();
- IdentityDatabaseUtil.commitTransaction(connection);
- } catch (SQLException e) {
- IdentityDatabaseUtil.rollbackTransaction(connection);
- throw new InternalWorkflowException("Error when executing the sql query", e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, null, prepStmt);
- }
- }
-
- /**
- * Check if a given entity has any pending workflow requests associated with it.
- *
- * @param entity
- * @return
- * @throws InternalWorkflowException
- */
- public boolean entityHasPendingWorkflows(Entity entity) throws InternalWorkflowException {
-
- Connection connection = IdentityDatabaseUtil.getDBConnection(false);
- PreparedStatement prepStmt = null;
- String query = SQLConstants.GET_PENDING_RELATIONSHIPS_OF_ENTITY;
- ResultSet resultSet = null;
- try {
- prepStmt = connection.prepareStatement(query);
- prepStmt.setString(1, entity.getEntityType());
- prepStmt.setString(2, entity.getEntityId());
- prepStmt.setString(3, WorkflowRequestStatus.PENDING.toString());
- prepStmt.setInt(4, entity.getTenantId());
- resultSet = prepStmt.executeQuery();
- if (resultSet.next()) {
- return true;
- }
- } catch (SQLException e) {
- throw new InternalWorkflowException("Error when executing the sql query", e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, resultSet, prepStmt);
- }
- return false;
- }
-
- /**
- * Check if a given entity as any pending workflows of a given type associated with it.
- *
- * @param entity
- * @param requsetType
- * @return
- * @throws InternalWorkflowException
- */
- public boolean entityHasPendingWorkflowsOfType(Entity entity, String requsetType) throws
- InternalWorkflowException {
-
- Connection connection = IdentityDatabaseUtil.getDBConnection(false);
- PreparedStatement prepStmt = null;
- String query = SQLConstants.GET_PENDING_RELATIONSHIPS_OF_GIVEN_TYPE_FOR_ENTITY;
- ResultSet resultSet = null;
- try {
- prepStmt = connection.prepareStatement(query);
- prepStmt.setString(1, entity.getEntityType());
- prepStmt.setString(2, entity.getEntityId());
- prepStmt.setString(3, WorkflowRequestStatus.PENDING.toString());
- prepStmt.setString(4, requsetType);
- prepStmt.setInt(5, entity.getTenantId());
- resultSet = prepStmt.executeQuery();
- if (resultSet.next()) {
- return true;
- }
- } catch (SQLException e) {
- throw new InternalWorkflowException("Error when executing the sql query", e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, resultSet, prepStmt);
- }
- return false;
- }
-
- /**
- * Check if there are any requests the associated with both entities.
- *
- * @param entity1
- * @param entity2
- * @return
- * @throws InternalWorkflowException
- */
- public boolean twoEntitiesAreRelated(Entity entity1, Entity entity2) throws InternalWorkflowException {
-
- Connection connection = IdentityDatabaseUtil.getDBConnection(false);
- PreparedStatement prepStmt = null;
- String query = SQLConstants.GET_REQUESTS_OF_TWO_ENTITIES;
- ResultSet resultSet = null;
- try {
- prepStmt = connection.prepareStatement(query);
- prepStmt.setString(1, entity1.getEntityId());
- prepStmt.setString(2, entity1.getEntityType());
- prepStmt.setString(3, entity2.getEntityId());
- prepStmt.setString(4, entity2.getEntityType());
- prepStmt.setInt(5, entity1.getTenantId());
- prepStmt.setInt(6, entity2.getTenantId());
- resultSet = prepStmt.executeQuery();
- if (resultSet.next()) {
- return true;
- }
- } catch (SQLException e) {
- throw new InternalWorkflowException("Error when executing the sql query", e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, resultSet, prepStmt);
- }
-
- return false;
- }
-
- /**
- * Retrieve List of associated Entity-types of the workflow requests.
- *
- * @param wfOperationType Operation Type of the Work-flow.
- * @param wfStatus Current Status of the Work-flow.
- * @param entityType Entity Type of the Work-flow.
- * @param idFilter Entity ID filter to search
- * @param tenantID Tenant ID of the currently Logged user.
- * @return
- * @throws InternalWorkflowException
- */
- public List getEntityNamesOfRequest(String wfOperationType, String wfStatus, String entityType, String
- idFilter, int tenantID) throws InternalWorkflowException {
-
- Connection connection = IdentityDatabaseUtil.getDBConnection(false);
- PreparedStatement prepStmt = null;
- ResultSet resultSet = null;
- String query = SQLConstants.GET_REQUEST_ENTITY_NAMES;
- List entityNames = new ArrayList();
- idFilter = idFilter.replaceAll("\\*","%");
- idFilter = idFilter.replaceAll("\\\\%", "*");
-
- try {
- prepStmt = connection.prepareStatement(query);
- prepStmt.setString(1, wfOperationType);
- prepStmt.setString(2, wfStatus);
- prepStmt.setString(3, entityType);
- prepStmt.setInt(4, tenantID);
- prepStmt.setString(5, idFilter);
- resultSet = prepStmt.executeQuery();
- while (resultSet.next()) {
- String entityName = resultSet.getString(SQLConstants.ENTITY_NAME_COLUMN);
- entityNames.add(entityName);
- }
- } catch (SQLException e) {
- throw new InternalWorkflowException("Error occurred when executing the sql query", e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, resultSet, prepStmt);
- }
- return entityNames;
- }
-
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/dao/WorkflowDAO.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/dao/WorkflowDAO.java
deleted file mode 100644
index 2b949e8da695..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/dao/WorkflowDAO.java
+++ /dev/null
@@ -1,521 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.dao;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.database.utils.jdbc.exceptions.DataAccessException;
-import org.wso2.carbon.identity.core.util.IdentityDatabaseUtil;
-import org.wso2.carbon.identity.core.util.JdbcUtils;
-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.exception.InternalWorkflowException;
-import org.wso2.carbon.identity.workflow.mgt.util.SQLConstants;
-import org.wso2.carbon.identity.workflow.mgt.util.WFConstant;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Workflow related DAO operation provides by this class
- *
- */
-public class WorkflowDAO {
-
- private final String errorMessage = "Error when executing the SQL query ";
- private static final Log log = LogFactory.getLog(WorkflowDAO.class);
-
- /**
- * Adding a workflow
- *
- * @param workflow Workflow bean object
- * @param tenantId Tenant ID
- * @throws InternalWorkflowException
- */
- public void addWorkflow(Workflow workflow, int
- tenantId) throws InternalWorkflowException {
-
- Connection connection = IdentityDatabaseUtil.getDBConnection();
- PreparedStatement prepStmt = null;
- String query = SQLConstants.ADD_WORKFLOW_QUERY;
- try {
- prepStmt = connection.prepareStatement(query);
- prepStmt.setString(1, workflow.getWorkflowId());
- prepStmt.setString(2, workflow.getWorkflowName());
- prepStmt.setString(3, workflow.getWorkflowDescription());
- prepStmt.setString(4, workflow.getTemplateId());
- prepStmt.setString(5, workflow.getWorkflowImplId());
- prepStmt.setInt(6, tenantId);
- prepStmt.executeUpdate();
- IdentityDatabaseUtil.commitTransaction(connection);
- } catch (SQLException e) {
- IdentityDatabaseUtil.rollbackTransaction(connection);
- throw new InternalWorkflowException(errorMessage , e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, null, prepStmt);
- }
- }
-
- /**
- * Get a Workflow object for given workflowid
- *
- * @param workflowId Workflow unique id
- * @return Workflow object
- * @throws InternalWorkflowException
- */
- public Workflow getWorkflow(String workflowId) throws InternalWorkflowException {
-
- Connection connection = IdentityDatabaseUtil.getDBConnection(false);
- PreparedStatement prepStmt = null;
- ResultSet rs = null;
- String query = SQLConstants.GET_WORKFLOW;
-
- Workflow workflow = null;
-
- try {
- prepStmt = connection.prepareStatement(query);
- prepStmt.setString(1, workflowId);
- rs = prepStmt.executeQuery();
- while (rs.next()) {
- String workflowName = rs.getString(SQLConstants.WF_NAME_COLUMN);
- String description = rs.getString(SQLConstants.DESCRIPTION_COLUMN);
- String templateId = rs.getString(SQLConstants.TEMPLATE_ID_COLUMN);
- String implId = rs.getString(SQLConstants.TEMPLATE_IMPL_ID_COLUMN);
- workflow = new Workflow();
- workflow.setWorkflowId(workflowId);
- workflow.setWorkflowName(workflowName);
- workflow.setWorkflowDescription(description);
- workflow.setTemplateId(templateId);
- workflow.setWorkflowImplId(implId);
-
- break;
- }
- } catch (SQLException e) {
- throw new InternalWorkflowException(errorMessage, e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, null, prepStmt);
- }
- return workflow;
- }
-
- /**
- * Remove Workflow from the DB
- *
- * @param workflowId workflow Id
- * @throws InternalWorkflowException
- */
- public void removeWorkflow(String workflowId) throws InternalWorkflowException {
-
- Connection connection = IdentityDatabaseUtil.getDBConnection();
- PreparedStatement prepStmt = null;
- String query = SQLConstants.DELETE_WORKFLOW_QUERY;
- try {
- prepStmt = connection.prepareStatement(query);
- prepStmt.setString(1, workflowId);
- prepStmt.executeUpdate();
- IdentityDatabaseUtil.commitTransaction(connection);
- } catch (SQLException e) {
- IdentityDatabaseUtil.rollbackTransaction(connection);
- throw new InternalWorkflowException(errorMessage, e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, null, prepStmt);
- }
- }
-
- /**
- * Remove all workflows of a given tenant id.
- *
- * @param tenantId The id of the tenant.
- * @throws InternalWorkflowException throws when an error occurs in removing workflows.
- */
- public void removeWorkflows(int tenantId) throws InternalWorkflowException {
-
- try (Connection connection = IdentityDatabaseUtil.getDBConnection(true)) {
- try (PreparedStatement prepStmt = connection.prepareStatement(SQLConstants
- .DELETE_WORKFLOW_BY_TENANT_ID_QUERY)) {
- prepStmt.setInt(1, tenantId);
- prepStmt.executeUpdate();
- IdentityDatabaseUtil.commitTransaction(connection);
- } catch (SQLException e) {
- throw new InternalWorkflowException(errorMessage, e);
- }
- } catch (SQLException e) {
- throw new InternalWorkflowException(errorMessage, e);
- }
- }
-
- /**
- * Update current workflow
- *
- * @param workflow Workflow object
- * @throws InternalWorkflowException
- */
- public void updateWorkflow(Workflow workflow)
- throws InternalWorkflowException {
-
- Connection connection = IdentityDatabaseUtil.getDBConnection();
- PreparedStatement prepStmt = null;
- String query = SQLConstants.UPDATE_WORKFLOW_QUERY;
- try {
- prepStmt = connection.prepareStatement(query);
- prepStmt.setString(1, workflow.getWorkflowName());
- prepStmt.setString(2, workflow.getWorkflowDescription());
- prepStmt.setString(3, workflow.getTemplateId());
- prepStmt.setString(4, workflow.getWorkflowImplId());
- prepStmt.setString(5, workflow.getWorkflowId());
- prepStmt.executeUpdate();
- IdentityDatabaseUtil.commitTransaction(connection);
- } catch (SQLException e) {
- IdentityDatabaseUtil.rollbackTransaction(connection);
- throw new InternalWorkflowException(errorMessage, e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, null, prepStmt);
- }
- }
-
- /**
- * Retrieve Workflows of a tenant with pagination.
- *
- * @param tenantId
- * @param filter
- * @param offset
- * @param limit
- * @return List
- * @throws InternalWorkflowException
- */
- public List listPaginatedWorkflows(int tenantId, String filter, int offset, int limit) throws InternalWorkflowException {
-
- String sqlQuery;
- List workflowList = new ArrayList<>();
- try (Connection connection = IdentityDatabaseUtil.getDBConnection(false)) {
- String filterResolvedForSQL = resolveSQLFilter(filter);
- sqlQuery = getSqlQuery();
- try (PreparedStatement prepStmt = generatePrepStmt(connection, sqlQuery, tenantId, filterResolvedForSQL, offset, limit);) {
- try (ResultSet resultSet = prepStmt.executeQuery()) {
- while (resultSet.next()) {
- String id = resultSet.getString(SQLConstants.ID_COLUMN);
- String name = resultSet.getString(SQLConstants.WF_NAME_COLUMN);
- String description = resultSet.getString(SQLConstants.DESCRIPTION_COLUMN);
- String templateId = resultSet.getString(SQLConstants.TEMPLATE_ID_COLUMN);
- String templateImplId = resultSet.getString(SQLConstants.TEMPLATE_IMPL_ID_COLUMN);
- Workflow workflowDTO = new Workflow();
- workflowDTO.setWorkflowId(id);
- workflowDTO.setWorkflowName(name);
- workflowDTO.setWorkflowDescription(description);
- workflowDTO.setTemplateId(templateId);
- workflowDTO.setWorkflowImplId(templateImplId);
- workflowList.add(workflowDTO);
- }
- }
- }
- } catch (SQLException e) {
- handleException(WFConstant.Exceptions.SQL_ERROR_LISTING_WORKFLOWS, e);
- } catch (DataAccessException e) {
- handleException(e.getMessage(), e);
- }
- return workflowList;
- }
-
- /**
- * Retrieve all the Workflows for a tenant
- *
- * @Deprecated Use {@link #listPaginatedWorkflows(int, String, int, int)} instead.
- * @param tenantId Tenant ID
- * @return List
- * @throws InternalWorkflowException
- */
- @Deprecated
- public List listWorkflows(int tenantId) throws InternalWorkflowException {
-
- Connection connection = IdentityDatabaseUtil.getDBConnection(false);
- PreparedStatement prepStmt = null;
- ResultSet rs = null;
- List workflowList = new ArrayList<>();
- String query = SQLConstants.LIST_WORKFLOWS_QUERY;
- try {
- prepStmt = connection.prepareStatement(query);
- prepStmt.setInt(1, tenantId);
- rs = prepStmt.executeQuery();
- while (rs.next()) {
- String id = rs.getString(SQLConstants.ID_COLUMN);
- String name = rs.getString(SQLConstants.WF_NAME_COLUMN);
- String description = rs.getString(SQLConstants.DESCRIPTION_COLUMN);
- String templateId = rs.getString(SQLConstants.TEMPLATE_ID_COLUMN);
- String templateImplId = rs.getString(SQLConstants.TEMPLATE_IMPL_ID_COLUMN);
- Workflow workflowDTO = new Workflow();
- workflowDTO.setWorkflowId(id);
- workflowDTO.setWorkflowName(name);
- workflowDTO.setWorkflowDescription(description);
- workflowDTO.setTemplateId(templateId);
- workflowDTO.setWorkflowImplId(templateImplId);
- workflowList.add(workflowDTO);
- }
- } catch (SQLException e) {
- throw new InternalWorkflowException(errorMessage, e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, null, prepStmt);
- }
- return workflowList;
- }
-
- /**
- * Get workflows count of a tenant.
- *
- * @param tenantId
- * @param filter
- * @return Return workflows count
- * @throws InternalWorkflowException
- */
- public int getWorkflowsCount(int tenantId, String filter) throws InternalWorkflowException{
-
- int count = 0;
- try (Connection connection = IdentityDatabaseUtil.getDBConnection(false)) {
- String filterResolvedForSQL = resolveSQLFilter(filter);
- try (PreparedStatement prepStmt = connection
- .prepareStatement(SQLConstants.GET_WORKFLOWS_COUNT_QUERY)) {
- prepStmt.setInt(1, tenantId);
- prepStmt.setString(2, filterResolvedForSQL);
- try (ResultSet resultSet = prepStmt.executeQuery()) {
- if (resultSet.next()) {
- count = resultSet.getInt(1);
- }
- }
- }
- } catch (SQLException e) {
- handleException(WFConstant.Exceptions.SQL_ERROR_GETTING_WORKFLOW_COUNT, e);
- }
- return count;
- }
-
-
- /**
- * Clear all the parameters that stored under workflow Id
- *
- * @param workflowId WorkflowId
- * @throws InternalWorkflowException
- */
- public void removeWorkflowParams(String workflowId) throws InternalWorkflowException {
-
- Connection connection = IdentityDatabaseUtil.getDBConnection();
- PreparedStatement prepStmt = null;
- String query = SQLConstants.DELETE_WORKFLOW_PARAMS_QUERY;
- try {
- prepStmt = connection.prepareStatement(query);
- prepStmt.setString(1, workflowId);
- prepStmt.executeUpdate();
- IdentityDatabaseUtil.commitTransaction(connection);
- } catch (SQLException e) {
- IdentityDatabaseUtil.rollbackTransaction(connection);
- throw new InternalWorkflowException(errorMessage, e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, null, prepStmt);
- }
- }
-
- /**
- * Clear all the parameters of all the workflows of a given tenant.
- *
- * @param tenantId The id of the tenant.
- * @throws InternalWorkflowException throws when an error occurs in removing workflows.
- */
- public void removeWorkflowParams(int tenantId) throws InternalWorkflowException {
-
- try (Connection connection = IdentityDatabaseUtil.getDBConnection(true)) {
- try (PreparedStatement prepStmt = connection.prepareStatement(SQLConstants
- .DELETE_WORKFLOW_PARAMS_BY_TENANT_ID_QUERY)) {
- prepStmt.setInt(1, tenantId);
- prepStmt.executeUpdate();
- IdentityDatabaseUtil.commitTransaction(connection);
- } catch (SQLException e) {
- throw new InternalWorkflowException(errorMessage, e);
- }
- } catch (SQLException e) {
- throw new InternalWorkflowException(errorMessage, e);
- }
- }
-
- /**
- * Add new parameter List to given workflow id
- *
- * @param parameterList Paramter List
- * @param workflowId Workflow Id
- * @throws InternalWorkflowException
- */
- public void addWorkflowParams(List parameterList, String workflowId, int tenantId) throws
- InternalWorkflowException {
-
- Connection connection = IdentityDatabaseUtil.getDBConnection();
- PreparedStatement prepStmt = null;
-
- String query = SQLConstants.ADD_WORKFLOW_PARAMS_QUERY;
- try {
- for (Parameter parameter : parameterList) {
- prepStmt = connection.prepareStatement(query);
- prepStmt.setString(1, workflowId);
- prepStmt.setString(2, parameter.getParamName());
- prepStmt.setString(3, parameter.getParamValue());
- prepStmt.setString(4, parameter.getqName());
- prepStmt.setString(5, parameter.getHolder());
- prepStmt.setInt(6, tenantId);
-
- prepStmt.executeUpdate();
- }
- IdentityDatabaseUtil.commitTransaction(connection);
- } catch (SQLException e) {
- IdentityDatabaseUtil.rollbackTransaction(connection);
- throw new InternalWorkflowException(errorMessage, e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, null, prepStmt);
- }
- }
-
- /**
- * Retrieve List of Parameters for given workflow id
- *
- * @param workflowId
- * @return
- * @throws InternalWorkflowException
- */
- public List getWorkflowParams(String workflowId) throws InternalWorkflowException {
-
- Connection connection = IdentityDatabaseUtil.getDBConnection(false);
- PreparedStatement prepStmt = null;
- ResultSet rs = null;
- List parameterList = new ArrayList<>();
- String query = SQLConstants.GET_WORKFLOW_PARAMS;
- try {
- prepStmt = connection.prepareStatement(query);
- prepStmt.setString(1, workflowId);
- rs = prepStmt.executeQuery();
- while (rs.next()) {
- String paramName = rs.getString(SQLConstants.PARAM_NAME_COLUMN);
- String paramValue = rs.getString(SQLConstants.PARAM_VALUE_COLUMN);
- String paramQName = rs.getString(SQLConstants.PARAM_QNAME_COLUMN);
- String paramHolder = rs.getString(SQLConstants.PARAM_HOLDER_COLUMN);
- if (StringUtils.isNotBlank(paramName)) {
- Parameter parameter = new Parameter(workflowId, paramName, paramValue, paramQName, paramHolder);
- parameterList.add(parameter);
- }
- }
- } catch (SQLException e) {
- IdentityDatabaseUtil.rollbackTransaction(connection);
- throw new InternalWorkflowException(errorMessage, e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, null, prepStmt);
- }
- return parameterList;
- }
-
- /**
- *
- * @throws InternalWorkflowException
- * @throws DataAccessException
- */
- private String getSqlQuery() throws InternalWorkflowException, DataAccessException {
-
- String sqlQuery ;
- if (JdbcUtils.isH2DB() || JdbcUtils.isMySQLDB() || JdbcUtils.isMariaDB()) {
- sqlQuery = SQLConstants.GET_WORKFLOWS_BY_TENANT_AND_WF_NAME_MYSQL;
- } else if (JdbcUtils.isOracleDB()) {
- sqlQuery = SQLConstants.GET_WORKFLOWS_BY_TENANT_AND_WF_NAME_ORACLE;
- } else if (JdbcUtils.isMSSqlDB()) {
- sqlQuery = SQLConstants.GET_WORKFLOWS_BY_TENANT_AND_WF_NAME_MSSQL;
- } else if (JdbcUtils.isPostgreSQLDB()) {
- sqlQuery = SQLConstants.GET_WORKFLOWS_BY_TENANT_AND_WF_NAME_POSTGRESQL;
- } else if (JdbcUtils.isDB2DB()) {
- sqlQuery = SQLConstants.GET_WORKFLOWS_BY_TENANT_AND_WF_NAME_DB2SQL;
- } else if (JdbcUtils.isInformixDB()) {
- sqlQuery = SQLConstants.GET_WORKFLOWS_BY_TENANT_AND_WF_NAME_INFORMIX;
- } else {
- throw new InternalWorkflowException(WFConstant.Exceptions.ERROR_WHILE_LOADING_WORKFLOWS);
- }
- return sqlQuery;
- }
-
- /**
- * Create PreparedStatement.
- *
- * @param connection db connection
- * @param sqlQuery SQL query
- * @param tenantId Tenant ID
- * @param filterResolvedForSQL resolved filter for sql
- * @param offset offset
- * @param limit limit
- * @return PreparedStatement
- * @throws SQLException
- * @throws DataAccessException
- */
- private PreparedStatement generatePrepStmt(Connection connection, String sqlQuery, int tenantId, String filterResolvedForSQL, int offset, int limit) throws SQLException, DataAccessException {
-
- PreparedStatement prepStmt;
- if (JdbcUtils.isPostgreSQLDB()) {
- prepStmt = connection.prepareStatement(sqlQuery);
- prepStmt.setInt(1, tenantId);
- prepStmt.setString(2, filterResolvedForSQL);
- prepStmt.setInt(3, limit);
- prepStmt.setInt(4, offset);
- } else {
- prepStmt = connection.prepareStatement(sqlQuery);
- prepStmt.setInt(1, tenantId);
- prepStmt.setString(2, filterResolvedForSQL);
- prepStmt.setInt(3, offset);
- prepStmt.setInt(4, limit);
- }
- return prepStmt;
- }
-
- /**
- * Resolve SQL Filter.
- *
- * @param filter
- * @return Return SQL filter.
- * @throws InternalWorkflowException
- */
- private String resolveSQLFilter(String filter) {
-
- //To avoid any issues when the filter string is blank or null, assigning "%" to SQLFilter.
- String sqlFilter = "%";
- if (StringUtils.isNotBlank(filter)) {
- sqlFilter = filter.trim()
- .replace("*", "%")
- .replace("?", "_");
- }
- return sqlFilter;
- }
-
- /**
- * Logs and wraps the given exception.
- *
- * @param errorMsg Error message
- * @param e Exception
- * @throws InternalWorkflowException
- */
- private void handleException(String errorMsg, Exception e) throws InternalWorkflowException {
-
- if (log.isDebugEnabled()) {
- log.debug(errorMsg, e);
- }
- throw new InternalWorkflowException(errorMsg, e);
- }
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/dao/WorkflowRequestAssociationDAO.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/dao/WorkflowRequestAssociationDAO.java
deleted file mode 100644
index 1a4c8c2cb47a..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/dao/WorkflowRequestAssociationDAO.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.dao;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.identity.core.util.IdentityDatabaseUtil;
-import org.wso2.carbon.identity.workflow.mgt.bean.WorkflowAssociation;
-import org.wso2.carbon.identity.workflow.mgt.bean.WorkflowRequestAssociation;
-import org.wso2.carbon.identity.workflow.mgt.exception.InternalWorkflowException;
-import org.wso2.carbon.identity.workflow.mgt.util.SQLConstants;
-import org.wso2.carbon.identity.workflow.mgt.util.WFConstant;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-public class WorkflowRequestAssociationDAO {
-
- private static final Log log = LogFactory.getLog(WorkflowRequestAssociationDAO.class);
-
- /**
- * Adds new workflow-request relationship to database
- *
- * @param relationshipId
- * @param workflowId
- * @param requestId
- * @param status
- * @throws InternalWorkflowException
- */
- public void addNewRelationship(String relationshipId, String workflowId, String requestId, String status,
- int tenantId) throws InternalWorkflowException {
- Connection connection = IdentityDatabaseUtil.getDBConnection();
- PreparedStatement prepStmt = null;
- String query = SQLConstants.ADD_WORKFLOW_REQUEST_RELATIONSHIP;
- try {
- Timestamp createdDateStamp = new Timestamp(System.currentTimeMillis());
- prepStmt = connection.prepareStatement(query);
- prepStmt.setString(1, relationshipId);
- prepStmt.setString(2, workflowId);
- prepStmt.setString(3, requestId);
- prepStmt.setTimestamp(4, createdDateStamp);
- prepStmt.setString(5, status);
- prepStmt.setInt(6, tenantId);
- prepStmt.execute();
- IdentityDatabaseUtil.commitTransaction(connection);
- } catch (SQLException e) {
- IdentityDatabaseUtil.rollbackTransaction(connection);
- throw new InternalWorkflowException("Error when executing the sql query:" + query, e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, null, prepStmt);
- }
- }
-
- /**
- * Get requestId of a relationship.
- *
- * @param relationshipId
- * @return
- * @throws InternalWorkflowException
- */
- public String getRequestIdOfRelationship(String relationshipId) throws InternalWorkflowException {
-
- Connection connection = IdentityDatabaseUtil.getDBConnection(false);
- PreparedStatement prepStmt = null;
- String query = SQLConstants.GET_REQUEST_ID_OF_RELATIONSHIP;
- ResultSet resultSet = null;
- try {
- prepStmt = connection.prepareStatement(query);
- prepStmt.setString(1, relationshipId);
- resultSet = prepStmt.executeQuery();
- if (resultSet.next()) {
- return resultSet.getString(SQLConstants.REQUEST_ID_COLUMN);
- }
- } catch (SQLException e) {
- throw new InternalWorkflowException("Error when executing the sql query:" + query, e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, resultSet, prepStmt);
- }
- return "";
- }
-
- /**
- * Update state of workflow of a request
- *
- * @param relationshipId
- * @throws InternalWorkflowException
- */
- public void updateStatusOfRelationship(String relationshipId, String status) throws InternalWorkflowException {
-
- Connection connection = IdentityDatabaseUtil.getDBConnection();
- PreparedStatement prepStmt = null;
- String query = SQLConstants.UPDATE_STATUS_OF_RELATIONSHIP;
- try {
- Timestamp updatedDateStamp = new Timestamp(System.currentTimeMillis());
- prepStmt = connection.prepareStatement(query);
- prepStmt.setString(1, status);
- prepStmt.setTimestamp(2, updatedDateStamp);
- prepStmt.setString(3, relationshipId);
- prepStmt.execute();
- IdentityDatabaseUtil.commitTransaction(connection);
- } catch (SQLException e) {
- IdentityDatabaseUtil.rollbackTransaction(connection);
- throw new InternalWorkflowException("Error when executing the sql query:" + query, e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, null, prepStmt);
- }
- }
-
- /**
- * Update state of workflow of a request
- *
- * @param requestId requestId to update relationships of.
- * @throws InternalWorkflowException
- */
- public void updateStatusOfRelationshipsOfPendingRequest(String requestId, String status) throws
- InternalWorkflowException {
-
- Connection connection = IdentityDatabaseUtil.getDBConnection();
- PreparedStatement prepStmt = null;
- String query = SQLConstants.UPDATE_STATUS_OF_RELATIONSHIPS_OF_REQUEST;
- try {
- Timestamp updatedDateStamp = new Timestamp(System.currentTimeMillis());
- prepStmt = connection.prepareStatement(query);
- prepStmt.setString(1, status);
- prepStmt.setTimestamp(2, updatedDateStamp);
- prepStmt.setString(3, requestId);
- prepStmt.setString(4, WFConstant.HT_STATE_PENDING);
- prepStmt.execute();
- IdentityDatabaseUtil.commitTransaction(connection);
- } catch (SQLException e) {
- IdentityDatabaseUtil.rollbackTransaction(connection);
- throw new InternalWorkflowException("Error when executing the sql query:" + query, e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, null, prepStmt);
- }
- }
-
- /**
- * Get list of states of workflows of a request
- *
- * @param requestId
- * @return
- * @throws InternalWorkflowException
- */
- public List getWorkflowStatesOfRequest(String requestId) throws InternalWorkflowException {
-
- List states = new ArrayList<>();
- Connection connection = IdentityDatabaseUtil.getDBConnection(false);
- PreparedStatement prepStmt = null;
- String query = SQLConstants.GET_STATES_OF_REQUEST;
- ResultSet resultSet = null;
- try {
- prepStmt = connection.prepareStatement(query);
- prepStmt.setString(1, requestId);
- resultSet = prepStmt.executeQuery();
- while (resultSet.next()) {
- states.add(resultSet.getString(SQLConstants.REQUEST_STATUS_COLUMN));
- }
- } catch (SQLException e) {
- throw new InternalWorkflowException("Error when executing the sql query:" + query, e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, resultSet, prepStmt);
- }
- return states;
- }
-
- /**
- * Get requestId of a relationship.
- *
- * @param relationshipId
- * @return
- * @throws InternalWorkflowException
- */
- public String getStatusOfRelationship(String relationshipId) throws InternalWorkflowException {
-
- Connection connection = IdentityDatabaseUtil.getDBConnection(false);
- PreparedStatement prepStmt = null;
- String query = SQLConstants.GET_STATUS_OF_RELATIONSHIP;
- ResultSet resultSet = null;
- try {
- prepStmt = connection.prepareStatement(query);
- prepStmt.setString(1, relationshipId);
- resultSet = prepStmt.executeQuery();
- if (resultSet.next()) {
- return resultSet.getString(SQLConstants.REQUEST_STATUS_COLUMN);
- }
- } catch (SQLException e) {
- throw new InternalWorkflowException("Error when executing the sql query:" + query, e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, resultSet, prepStmt);
- }
- return "";
- }
-
- /**
- * Get array of Workflows of a request
- *
- * @param requestId
- * @return
- * @throws InternalWorkflowException
- */
- public WorkflowRequestAssociation[] getWorkflowsOfRequest(String requestId) throws InternalWorkflowException {
-
- Connection connection = IdentityDatabaseUtil.getDBConnection(false);
- PreparedStatement prepStmt = null;
- String query = SQLConstants.GET_WORKFLOWS_OF_REQUEST;
- ResultSet resultSet = null;
- try {
- prepStmt = connection.prepareStatement(query);
- prepStmt.setString(1, requestId);
- resultSet = prepStmt.executeQuery();
- ArrayList workflowDTOs = new ArrayList<>();
- while (resultSet.next()) {
- WorkflowRequestAssociation workflowDTO = new WorkflowRequestAssociation();
- workflowDTO.setWorkflowId(resultSet.getString(SQLConstants.ID_COLUMN));
- workflowDTO.setWorkflowName(resultSet.getString(SQLConstants.WF_NAME_COLUMN));
- workflowDTO.setLastUpdatedTime(resultSet.getTimestamp(SQLConstants.REQUEST_UPDATED_AT_COLUMN)
- .toString());
- workflowDTO.setStatus(resultSet.getString(SQLConstants.REQUEST_STATUS_COLUMN));
- workflowDTOs.add(workflowDTO);
- }
- WorkflowRequestAssociation[] requestArray = new WorkflowRequestAssociation[workflowDTOs.size()];
- for (int i = 0; i < workflowDTOs.size(); i++) {
- requestArray[i] = workflowDTOs.get(i);
- }
- return requestArray;
- } catch (SQLException e) {
- throw new InternalWorkflowException("Error when executing the sql query:" + query, e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, resultSet, prepStmt);
- }
- }
-
- /**
- *
- * @param eventId
- * @param tenantId
- * @return
- * @throws InternalWorkflowException
- */
- public List getWorkflowAssociationsForRequest(String eventId, int tenantId)
- throws InternalWorkflowException {
-
- Connection connection = IdentityDatabaseUtil.getDBConnection(false);
- PreparedStatement prepStmt = null;
- ResultSet rs;
- List associations = new ArrayList<>();
- String query = SQLConstants.GET_ASSOCIATIONS_FOR_EVENT_QUERY;
- try {
- prepStmt = connection.prepareStatement(query);
- prepStmt.setString(1, eventId);
- prepStmt.setInt(2, tenantId);
- rs = prepStmt.executeQuery();
- while (rs.next()) {
-
- int id = rs.getInt(SQLConstants.ID_COLUMN);
- String condition = rs.getString(SQLConstants.CONDITION_COLUMN);
- String workflowId = rs.getString(SQLConstants.WORKFLOW_ID_COLUMN);
- String associationName = rs.getString(SQLConstants.ASSOCIATION_NAME_COLUMN);
-
- WorkflowAssociation association = new WorkflowAssociation();
- association.setWorkflowId(workflowId);
- association.setAssociationCondition(condition);
- association.setEventId(eventId);
- association.setAssociationId(id);
- association.setAssociationName(associationName);
-
- associations.add(association);
- }
- } catch (SQLException e) {
- throw new InternalWorkflowException("Error when executing the sql query:" + query, e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, null, prepStmt);
- }
- return associations;
- }
-
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/dao/WorkflowRequestDAO.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/dao/WorkflowRequestDAO.java
deleted file mode 100644
index 41f781141267..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/dao/WorkflowRequestDAO.java
+++ /dev/null
@@ -1,635 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.dao;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.identity.core.util.IdentityDatabaseUtil;
-import org.wso2.carbon.identity.workflow.mgt.dto.WorkflowRequest;
-import org.wso2.carbon.identity.workflow.mgt.exception.InternalWorkflowException;
-import org.wso2.carbon.identity.workflow.mgt.exception.WorkflowException;
-import org.wso2.carbon.identity.workflow.mgt.util.SQLConstants;
-import org.wso2.carbon.identity.workflow.mgt.util.WorkflowRequestStatus;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-
-public class WorkflowRequestDAO {
-
- public static final String UPDATED_AT_FILTER = "updatedAt";
- public static final String ALL_TASKS_FILTER = "allTasks";
- private static final Log log = LogFactory.getLog(WorkflowRequestDAO.class);
-
- /**
- * Persists WorkflowRequest to be used when workflow is completed
- *
- * @param workflow The workflow object to be persisted
- * @param currentUser Currently logged in user
- * @param tenantId Tenant ID of the currently Logged user.
- * @throws WorkflowException
- */
- public void addWorkflowEntry(WorkflowRequest workflow, String currentUser, int tenantId) throws WorkflowException {
- Connection connection = IdentityDatabaseUtil.getDBConnection();
- PreparedStatement prepStmt = null;
- String query = SQLConstants.ADD_WORKFLOW_REQUEST_QUERY;
- try {
- Timestamp createdDateStamp = new Timestamp(System.currentTimeMillis());
- prepStmt = connection.prepareStatement(query);
- prepStmt.setString(1, workflow.getUuid());
- prepStmt.setString(2, currentUser);
- prepStmt.setString(3, workflow.getEventType());
- prepStmt.setTimestamp(4, createdDateStamp);
- prepStmt.setTimestamp(5, createdDateStamp);
- prepStmt.setBytes(6, serializeWorkflowRequest(workflow));
- prepStmt.setString(7, WorkflowRequestStatus.PENDING.toString());
- prepStmt.setInt(8, tenantId);
- prepStmt.executeUpdate();
- IdentityDatabaseUtil.commitTransaction(connection);
- } catch (SQLException e) {
- IdentityDatabaseUtil.rollbackTransaction(connection);
- throw new InternalWorkflowException("Error when executing the sql query:" + query, e);
- } catch (IOException e) {
- throw new InternalWorkflowException("Error when serializing the workflow request: " + workflow, e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, null, prepStmt);
- }
- }
-
- /**
- * Serialize the workflow request to be persisted as blob
- *
- * @param workFlowRequest The workflow request to be persisted
- * @return
- * @throws IOException
- */
- private byte[] serializeWorkflowRequest(WorkflowRequest workFlowRequest) throws IOException {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ObjectOutputStream oos = new ObjectOutputStream(baos);
- oos.writeObject(workFlowRequest);
- oos.close();
- return baos.toByteArray();
- }
-
- /**
- * Retrieve workflow request specified by the given uuid
- *
- * @param uuid The uuid of the request to be retrieved
- * @return
- * @throws WorkflowException
- */
- public WorkflowRequest retrieveWorkflow(String uuid) throws InternalWorkflowException {
- Connection connection = IdentityDatabaseUtil.getDBConnection(false);
- PreparedStatement prepStmt = null;
- ResultSet rs = null;
-
- String query = SQLConstants.GET_WORKFLOW_REQUEST_QUERY;
- try {
- prepStmt = connection.prepareStatement(query);
- prepStmt.setString(1, uuid);
- rs = prepStmt.executeQuery();
- if (rs.next()) {
- byte[] requestBytes = rs.getBytes(SQLConstants.REQUEST_COLUMN);
- return deserializeWorkflowRequest(requestBytes);
- }
- } catch (SQLException e) {
- throw new InternalWorkflowException("Error when executing the sql query:" + query, e);
- } catch (ClassNotFoundException | IOException e) {
- throw new InternalWorkflowException("Error when deserializing the workflow request. uuid = " + uuid, e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, null, prepStmt);
- }
- return null;
- }
-
- /**
- * Get status of a request.
- *
- * @param uuid
- * @return
- * @throws InternalWorkflowException
- */
- public String retrieveStatusOfWorkflow(String uuid) throws InternalWorkflowException {
- Connection connection = IdentityDatabaseUtil.getDBConnection(false);
- PreparedStatement prepStmt = null;
- ResultSet resultSet = null;
-
- String query = SQLConstants.GET_WORKFLOW_REQUEST_QUERY;
- try {
- prepStmt = connection.prepareStatement(query);
- prepStmt.setString(1, uuid);
- resultSet = prepStmt.executeQuery();
- if (resultSet.next()) {
- String status = resultSet.getString(SQLConstants.REQUEST_STATUS_COLUMN);
- return status;
- }
- } catch (SQLException e) {
- throw new InternalWorkflowException("Error when executing the sql query:" + query, e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, resultSet, prepStmt);
- }
- return "";
- }
-
- /**
- * Get user who created the request.
- *
- * @param uuid
- * @return
- * @throws InternalWorkflowException
- */
- public String retrieveCreatedUserOfRequest(String uuid) throws InternalWorkflowException {
- Connection connection = IdentityDatabaseUtil.getDBConnection(false);
- PreparedStatement prepStmt = null;
- ResultSet resultSet = null;
-
- String query = SQLConstants.GET_WORKFLOW_REQUEST_QUERY;
- try {
- prepStmt = connection.prepareStatement(query);
- prepStmt.setString(1, uuid);
- resultSet = prepStmt.executeQuery();
- if (resultSet.next()) {
- return resultSet.getString(SQLConstants.CREATED_BY_COLUMN);
- }
- } catch (SQLException e) {
- throw new InternalWorkflowException("Error when executing the sql query:" + query, e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, resultSet, prepStmt);
- }
- return "";
- }
-
- /**
- * Deserialize the persisted Workflow request
- *
- * @param serializedData Serialized request
- * @return
- * @throws IOException
- * @throws ClassNotFoundException
- */
- private WorkflowRequest deserializeWorkflowRequest(byte[] serializedData) throws IOException,
- ClassNotFoundException {
- ByteArrayInputStream bais = new ByteArrayInputStream(serializedData);
- ObjectInputStream ois = new ObjectInputStream(bais);
- Object objectRead = ois.readObject();
- if (objectRead != null && objectRead instanceof WorkflowRequest) {
- return (WorkflowRequest) objectRead;
- }
- return null;
- }
-
- /**
- * Update state of a existing workflow request
- *
- * @param requestId
- * @param newState
- * @throws InternalWorkflowException
- */
- public void updateStatusOfRequest(String requestId, String newState) throws InternalWorkflowException {
-
- Connection connection = IdentityDatabaseUtil.getDBConnection();
- PreparedStatement prepStmt = null;
- String query = SQLConstants.UPDATE_STATUS_OF_REQUEST;
- try {
- prepStmt = connection.prepareStatement(query);
- prepStmt.setString(1, newState);
- prepStmt.setTimestamp(2, new Timestamp(System.currentTimeMillis()));
- prepStmt.setString(3, requestId);
- prepStmt.execute();
- IdentityDatabaseUtil.commitTransaction(connection);
- } catch (SQLException e) {
- IdentityDatabaseUtil.rollbackTransaction(connection);
- throw new InternalWorkflowException("Error when executing the sql query:" + query, e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, null, prepStmt);
- }
- }
-
- /**
- * Get requests of a given user.
- *
- * @param userName user name of user to get requests
- * @param tenantId user's tenant id
- * @return
- * @throws InternalWorkflowException
- */
- public org.wso2.carbon.identity.workflow.mgt.bean.WorkflowRequest[] getRequestsOfUser(String userName, int tenantId)
- throws InternalWorkflowException {
-
- Connection connection = IdentityDatabaseUtil.getDBConnection(false);
- PreparedStatement prepStmt = null;
- String query = SQLConstants.GET_REQUESTS_OF_USER;
- ResultSet resultSet = null;
- try {
- prepStmt = connection.prepareStatement(query);
- prepStmt.setString(1, userName);
- prepStmt.setInt(2, tenantId);
- resultSet = prepStmt.executeQuery();
- ArrayList requestDTOs = new ArrayList<>();
- while (resultSet.next()) {
- org.wso2.carbon.identity.workflow.mgt.bean.WorkflowRequest
- requestDTO = new org.wso2.carbon.identity.workflow.mgt.bean.WorkflowRequest();
- requestDTO.setRequestId(resultSet.getString(SQLConstants.REQUEST_UUID_COLUMN));
- requestDTO.setEventType(resultSet.getString(SQLConstants.REQUEST_OPERATION_TYPE_COLUMN));
- requestDTO.setCreatedAt(resultSet.getTimestamp(SQLConstants.REQUEST_CREATED_AT_COLUMN).toString());
- requestDTO.setUpdatedAt(resultSet.getTimestamp(SQLConstants.REQUEST_UPDATED_AT_COLUMN).toString());
- requestDTO.setStatus(resultSet.getString(SQLConstants.REQUEST_STATUS_COLUMN));
- requestDTO.setRequestParams((deserializeWorkflowRequest(resultSet.getBytes(SQLConstants
- .REQUEST_COLUMN)))
- .getRequestParameterAsString());
- requestDTO.setCreatedBy(resultSet.getString(SQLConstants.CREATED_BY_COLUMN));
- requestDTOs.add(requestDTO);
- }
- org.wso2.carbon.identity.workflow.mgt.bean.WorkflowRequest[] requestArray =
- new org.wso2.carbon.identity.workflow.mgt.bean.WorkflowRequest[requestDTOs.size()];
- for (int i = 0; i < requestDTOs.size(); i++) {
- requestArray[i] = requestDTOs.get(i);
- }
- return requestArray;
- } catch (SQLException e) {
- throw new InternalWorkflowException("Error when executing the sql query:" + query, e);
- } catch (ClassNotFoundException | IOException e) {
- throw new InternalWorkflowException("Error when deserializing a workflow request.", e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, resultSet, prepStmt);
- }
- }
-
- /**
- * Get requests of a user created/updated in given time period
- *
- * @param userName User to get requests of, empty String to retrieve requests of all users
- * @param beginTime lower limit of date range to filter
- * @param endTime upper limit of date range to filter
- * @param timeCategory filter by created time or last updated time ?
- * @param tenantId tenant id of currently logged in user
- * @return
- * @throws InternalWorkflowException
- */
- public org.wso2.carbon.identity.workflow.mgt.bean.WorkflowRequest[] getRequestsOfUserFilteredByTime(String
- userName, Timestamp beginTime, Timestamp endTime, String timeCategory, int tenantId, String status) throws
- InternalWorkflowException {
-
- Connection connection = IdentityDatabaseUtil.getDBConnection(false);
- PreparedStatement prepStmt = null;
- String query = "";
-
- ResultSet resultSet = null;
- try {
-
- String driverName = connection.getMetaData().getDriverName();
- if (driverName.contains("MySQL")
- || driverName.contains("MariaDB")
- || driverName.contains("H2")) {
- if (UPDATED_AT_FILTER.equals(timeCategory)) {
- if (status.equals(ALL_TASKS_FILTER) || status.equals("")) {
- query = SQLConstants.GET_REQUESTS_OF_USER_FILTER_FROM_UPDATED_TIME_MYSQL;
- } else {
- query = SQLConstants.GET_REQUESTS_OF_USER_FILTER_FROM_UPDATED_TIME_AND_STATUS_MYSQL;
- }
- } else {
- if (status.equals(ALL_TASKS_FILTER) || status.equals("")) {
- query = SQLConstants.GET_REQUESTS_OF_USER_FILTER_FROM_CREATED_TIME_MYSQL;
- } else {
- query = SQLConstants.GET_REQUESTS_OF_USER_FILTER_FROM_CREATED_TIME_AND_STATUS_MYSQL;
- }
- }
- } else if (connection.getMetaData().getDatabaseProductName().contains("DB2")) {
- if (UPDATED_AT_FILTER.equals(timeCategory)) {
- if (status.equals(ALL_TASKS_FILTER) || status.equals("")) {
- query = SQLConstants.GET_REQUESTS_OF_USER_FILTER_FROM_UPDATED_TIME_DB2SQl;
- } else {
- query = SQLConstants.GET_REQUESTS_OF_USER_FILTER_FROM_UPDATED_TIME_AND_STATUS_DB2SQL;
- }
- } else {
- if (status.equals(ALL_TASKS_FILTER) || status.equals("")) {
- query = SQLConstants.GET_REQUESTS_OF_USER_FILTER_FROM_CREATED_TIME_DB2SQL;
- } else {
- query = SQLConstants.GET_REQUESTS_OF_USER_FILTER_FROM_CREATED_TIME_AND_STATUS_DB2SQL;
- }
- }
- } else if (driverName.contains("MS SQL")) {
- if (UPDATED_AT_FILTER.equals(timeCategory)) {
- if (status.equals(ALL_TASKS_FILTER) || status.equals("")) {
- query = SQLConstants.GET_REQUESTS_OF_USER_FILTER_FROM_UPDATED_TIME_MSSQL;
- } else {
- query = SQLConstants.GET_REQUESTS_OF_USER_FILTER_FROM_UPDATED_TIME_AND_STATUS_MSSQL;
- }
- } else {
- if (status.equals(ALL_TASKS_FILTER) || status.equals("")) {
- query = SQLConstants.GET_REQUESTS_OF_USER_FILTER_FROM_CREATED_TIME_MSSQL;
- } else {
- query = SQLConstants.GET_REQUESTS_OF_USER_FILTER_FROM_CREATED_TIME_AND_STATUS_MSSQL;
- }
- }
- } else if (driverName.contains("Microsoft") || driverName.contains("microsoft")) {
- if (UPDATED_AT_FILTER.equals(timeCategory)) {
- if (status.equals(ALL_TASKS_FILTER) || status.equals("")) {
- query = SQLConstants.GET_REQUESTS_OF_USER_FILTER_FROM_UPDATED_TIME_MSSQL;
- } else {
- query = SQLConstants.GET_REQUESTS_OF_USER_FILTER_FROM_UPDATED_TIME_AND_STATUS_MSSQL;
- }
- } else {
- if (status.equals(ALL_TASKS_FILTER) || status.equals("")) {
- query = SQLConstants.GET_REQUESTS_OF_USER_FILTER_FROM_CREATED_TIME_MSSQL;
- } else {
- query = SQLConstants.GET_REQUESTS_OF_USER_FILTER_FROM_CREATED_TIME_AND_STATUS_MSSQL;
- }
- }
- } else if (driverName.contains("PostgreSQL")) {
- if (UPDATED_AT_FILTER.equals(timeCategory)) {
- if (status.equals(ALL_TASKS_FILTER) || status.equals("")) {
- query = SQLConstants.GET_REQUESTS_OF_USER_FILTER_FROM_UPDATED_TIME_POSTGRESQL;
- } else {
- query = SQLConstants.GET_REQUESTS_OF_USER_FILTER_FROM_UPDATED_TIME_AND_STATUS_POSTGRESQL;
- }
- } else {
- if (status.equals(ALL_TASKS_FILTER) || status.equals("")) {
- query = SQLConstants.GET_REQUESTS_OF_USER_FILTER_FROM_CREATED_TIME_POSTGRESQL;
- } else {
- query = SQLConstants.GET_REQUESTS_OF_USER_FILTER_FROM_CREATED_TIME_AND_STATUS_POSTGRESQL;
- }
- }
- } else if (driverName.contains("Informix")) {
- // Driver name = "IBM Informix JDBC Driver for IBM Informix Dynamic Server"
- if (UPDATED_AT_FILTER.equals(timeCategory)) {
- if (status.equals(ALL_TASKS_FILTER) || status.equals("")) {
- query = SQLConstants.GET_REQUESTS_OF_USER_FILTER_FROM_UPDATED_TIME_INFORMIX;
- } else {
- query = SQLConstants.GET_REQUESTS_OF_USER_FILTER_FROM_UPDATED_TIME_AND_STATUS_INFORMIX;
- }
- } else {
- if (status.equals(ALL_TASKS_FILTER) || status.equals("")) {
- query = SQLConstants.GET_REQUESTS_OF_USER_FILTER_FROM_CREATED_TIME_INFORMIX;
- } else {
- query = SQLConstants.GET_REQUESTS_OF_USER_FILTER_FROM_CREATED_TIME_AND_STATUS_INFORMIX;
- }
- }
-
- } else {
- if (UPDATED_AT_FILTER.equals(timeCategory)) {
- if (status.equals(ALL_TASKS_FILTER) || status.equals("")) {
- query = SQLConstants.GET_REQUESTS_OF_USER_FILTER_FROM_UPDATED_TIME_ORACLE;
- } else {
- query = SQLConstants.GET_REQUESTS_OF_USER_FILTER_FROM_UPDATED_TIME_AND_STATUS_ORACLE;
- }
- } else {
- if (status.equals(ALL_TASKS_FILTER) || status.equals("")) {
- query = SQLConstants.GET_REQUESTS_OF_USER_FILTER_FROM_CREATED_TIME_ORACLE;
- } else {
- query = SQLConstants.GET_REQUESTS_OF_USER_FILTER_FROM_CREATED_TIME_AND_STATUS_ORACLE;
- }
- }
- }
- prepStmt = connection.prepareStatement(query);
- prepStmt.setString(1, userName);
- prepStmt.setTimestamp(2, beginTime);
- prepStmt.setTimestamp(3, endTime);
- prepStmt.setInt(4, tenantId);
- if (!status.equals(ALL_TASKS_FILTER) && !status.equals("")) {
- prepStmt.setString(5, status);
- }
- resultSet = prepStmt.executeQuery();
- ArrayList requestDTOs = new ArrayList<>();
- while (resultSet.next()) {
- org.wso2.carbon.identity.workflow.mgt.bean.WorkflowRequest
- requestDTO = new org.wso2.carbon.identity.workflow.mgt.bean.WorkflowRequest();
- requestDTO.setRequestId(resultSet.getString(SQLConstants.REQUEST_UUID_COLUMN));
- requestDTO.setEventType(resultSet.getString(SQLConstants.REQUEST_OPERATION_TYPE_COLUMN));
- requestDTO.setCreatedAt(resultSet.getTimestamp(SQLConstants.REQUEST_CREATED_AT_COLUMN).toString());
- requestDTO.setUpdatedAt(resultSet.getTimestamp(SQLConstants.REQUEST_UPDATED_AT_COLUMN).toString());
- requestDTO.setStatus(resultSet.getString(SQLConstants.REQUEST_STATUS_COLUMN));
- requestDTO.setRequestParams((deserializeWorkflowRequest(resultSet.getBytes(SQLConstants
- .REQUEST_COLUMN)))
- .getRequestParameterAsString());
- requestDTO.setCreatedBy(resultSet.getString(SQLConstants.CREATED_BY_COLUMN));
- requestDTOs.add(requestDTO);
- }
- org.wso2.carbon.identity.workflow.mgt.bean.WorkflowRequest[] requestArray =
- new org.wso2.carbon.identity.workflow.mgt.bean.WorkflowRequest[requestDTOs.size()];
- for (int i = 0; i < requestDTOs.size(); i++) {
- requestArray[i] = requestDTOs.get(i);
- }
- return requestArray;
- } catch (SQLException e) {
- throw new InternalWorkflowException("Error when executing the sql query:" + query, e);
- } catch (ClassNotFoundException | IOException e) {
- throw new InternalWorkflowException("Error when deserializing a workflow request.", e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, resultSet, prepStmt);
- }
- }
-
- /**
- * Get requests created/updated in given time period
- *
- * @param beginTime lower limit of date range to filter
- * @param endTime upper limit of date range to filter
- * @param timeCategory filter by created time or last updated time ?
- * @param tenant tenant id of currently logged in user
- * @return
- * @throws InternalWorkflowException
- */
- public org.wso2.carbon.identity.workflow.mgt.bean.WorkflowRequest[]
- getRequestsFilteredByTime(Timestamp beginTime, Timestamp endTime, String timeCategory, int tenant, String status)
- throws InternalWorkflowException {
-
- Connection connection = IdentityDatabaseUtil.getDBConnection(false);
- PreparedStatement prepStmt = null;
- String query = "";
-
- ResultSet resultSet = null;
-
- try {
- String driverName = connection.getMetaData().getDriverName();
- if (driverName.contains("MySQL")
- || driverName.contains("MariaDB")
- || driverName.contains("H2")) {
- if (UPDATED_AT_FILTER.equals(timeCategory)) {
- if (status.equals(ALL_TASKS_FILTER) || status.equals("")) {
- query = SQLConstants.GET_REQUESTS_FILTER_FROM_UPDATED_TIME_MYSQL;
- } else {
- query = SQLConstants.GET_REQUESTS_FILTER_FROM_UPDATED_TIME_AND_STATUS_MYSQL;
- }
- } else {
- if (status.equals(ALL_TASKS_FILTER) || status.equals("")) {
- query = SQLConstants.GET_REQUESTS_FILTER_FROM_CREATED_TIME_MYSQL;
- } else {
- query = SQLConstants.GET_REQUESTS_FILTER_FROM_CREATED_TIME_AND_STATUS_MYSQL;
- }
- }
- } else if (connection.getMetaData().getDatabaseProductName().contains("DB2")) {
- if (UPDATED_AT_FILTER.equals(timeCategory)) {
- if (status.equals(ALL_TASKS_FILTER) || status.equals("")) {
- query = SQLConstants.GET_REQUESTS_FILTER_FROM_UPDATED_TIME_DB2SQL;
- } else {
- query = SQLConstants.GET_REQUESTS_FILTER_FROM_UPDATED_TIME_AND_STATUS_DB2SQL;
- }
- } else {
- if (status.equals(ALL_TASKS_FILTER) || status.equals("")) {
- query = SQLConstants.GET_REQUESTS_FILTER_FROM_CREATED_TIME_DB2SQL;
- } else {
- query = SQLConstants.GET_REQUESTS_FILTER_FROM_CREATED_TIME_AND_STATUS_DB2SQL;
- }
- }
- } else if (driverName.contains("MS SQL")) {
- if (UPDATED_AT_FILTER.equals(timeCategory)) {
- if (status.equals(ALL_TASKS_FILTER) || status.equals("")) {
- query = SQLConstants.GET_REQUESTS_FILTER_FROM_UPDATED_TIME_MSSQL;
- } else {
- query = SQLConstants.GET_REQUESTS_FILTER_FROM_UPDATED_TIME_AND_STATUS_MSSQL;
- }
- } else {
- if (status.equals(ALL_TASKS_FILTER) || status.equals("")) {
- query = SQLConstants.GET_REQUESTS_FILTER_FROM_CREATED_TIME_MSSQL;
- } else {
- query = SQLConstants.GET_REQUESTS_FILTER_FROM_CREATED_TIME_AND_STATUS_MSSQL;
- }
- }
- } else if (driverName.contains("Microsoft") || driverName.contains("microsoft")) {
- if (UPDATED_AT_FILTER.equals(timeCategory)) {
- if (status.equals(ALL_TASKS_FILTER) || status.equals("")) {
- query = SQLConstants.GET_REQUESTS_FILTER_FROM_UPDATED_TIME_MSSQL;
- } else {
- query = SQLConstants.GET_REQUESTS_FILTER_FROM_UPDATED_TIME_AND_STATUS_MSSQL;
- }
- } else {
- if (status.equals(ALL_TASKS_FILTER) || status.equals("")) {
- query = SQLConstants.GET_REQUESTS_FILTER_FROM_CREATED_TIME_MSSQL;
- } else {
- query = SQLConstants.GET_REQUESTS_FILTER_FROM_CREATED_TIME_AND_STATUS_MSSQL;
- }
- }
- } else if (driverName.contains("PostgreSQL")) {
- if (UPDATED_AT_FILTER.equals(timeCategory)) {
- if (status.equals(ALL_TASKS_FILTER) || status.equals("")) {
- query = SQLConstants.GET_REQUESTS_FILTER_FROM_UPDATED_TIME_POSTGRESQL;
- } else {
- query = SQLConstants.GET_REQUESTS_FILTER_FROM_UPDATED_TIME_AND_STATUS_POSTGRESQL;
- }
- } else {
- if (status.equals(ALL_TASKS_FILTER) || status.equals("")) {
- query = SQLConstants.GET_REQUESTS_FILTER_FROM_CREATED_TIME_POSTGRESQL;
- } else {
- query = SQLConstants.GET_REQUESTS_FILTER_FROM_CREATED_TIME_AND_STATUS_POSTGRESQL;
- }
- }
- } else if (driverName.contains("Informix")) {
- // Driver name = "IBM Informix JDBC Driver for IBM Informix Dynamic Server"
- if (UPDATED_AT_FILTER.equals(timeCategory)) {
- if (status.equals(ALL_TASKS_FILTER) || status.equals("")) {
- query = SQLConstants.GET_REQUESTS_FILTER_FROM_UPDATED_TIME_INFORMIX;
- } else {
- query = SQLConstants.GET_REQUESTS_FILTER_FROM_UPDATED_TIME_AND_STATUS_INFORMIX;
- }
- } else {
- if (status.equals(ALL_TASKS_FILTER) || status.equals("")) {
- query = SQLConstants.GET_REQUESTS_FILTER_FROM_CREATED_TIME_INFORMIX;
- } else {
- query = SQLConstants.GET_REQUESTS_FILTER_FROM_CREATED_TIME_AND_STATUS_INFORMIX;
- }
- }
-
- } else {
- if (timeCategory.equals(UPDATED_AT_FILTER)) {
- if (status.equals(ALL_TASKS_FILTER) || status.equals("")) {
- query = SQLConstants.GET_REQUESTS_FILTER_FROM_UPDATED_TIME_ORACLE;
- } else {
- query = SQLConstants.GET_REQUESTS_FILTER_FROM_UPDATED_TIME_AND_STATUS_ORACLE;
- }
- } else {
- if (status.equals(ALL_TASKS_FILTER) || status.equals("")) {
- query = SQLConstants.GET_REQUESTS_FILTER_FROM_CREATED_TIME_ORACLE;
- } else {
- query = SQLConstants.GET_REQUESTS_FILTER_FROM_CREATED_TIME_AND_STATUS_ORACLE;
- }
- }
- }
- prepStmt = connection.prepareStatement(query);
- prepStmt.setTimestamp(1, beginTime);
- prepStmt.setTimestamp(2, endTime);
- prepStmt.setInt(3, tenant);
- if (!status.equals(ALL_TASKS_FILTER) && !status.equals("")) {
- prepStmt.setString(4, status);
- }
- resultSet = prepStmt.executeQuery();
- ArrayList requestDTOs = new ArrayList<>();
- while (resultSet.next()) {
- org.wso2.carbon.identity.workflow.mgt.bean.WorkflowRequest
- requestDTO = new org.wso2.carbon.identity.workflow.mgt.bean.WorkflowRequest();
- requestDTO.setRequestId(resultSet.getString(SQLConstants.REQUEST_UUID_COLUMN));
- requestDTO.setEventType(resultSet.getString(SQLConstants.REQUEST_OPERATION_TYPE_COLUMN));
- requestDTO.setCreatedAt(resultSet.getTimestamp(SQLConstants.REQUEST_CREATED_AT_COLUMN).toString());
- requestDTO.setUpdatedAt(resultSet.getTimestamp(SQLConstants.REQUEST_UPDATED_AT_COLUMN).toString());
- requestDTO.setStatus(resultSet.getString(SQLConstants.REQUEST_STATUS_COLUMN));
- requestDTO.setRequestParams((deserializeWorkflowRequest(resultSet.getBytes(SQLConstants
- .REQUEST_COLUMN)))
- .getRequestParameterAsString());
- requestDTO.setCreatedBy(resultSet.getString(SQLConstants.CREATED_BY_COLUMN));
- requestDTOs.add(requestDTO);
- }
- org.wso2.carbon.identity.workflow.mgt.bean.WorkflowRequest[] requestArray =
- new org.wso2.carbon.identity.workflow.mgt.bean.WorkflowRequest[requestDTOs.size()];
- for (int i = 0; i < requestDTOs.size(); i++) {
- requestArray[i] = requestDTOs.get(i);
- }
- return requestArray;
- } catch (SQLException e) {
- throw new InternalWorkflowException("Error when executing the sql query:" + query, e);
- } catch (ClassNotFoundException | IOException e) {
- throw new InternalWorkflowException("Error when deserializing a workflow request.", e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, resultSet, prepStmt);
- }
- }
-
- /**
- * update last updated time of a request
- *
- * @param requestId
- * @throws InternalWorkflowException
- */
- public void updateLastUpdatedTimeOfRequest(String requestId) throws InternalWorkflowException {
-
- Connection connection = IdentityDatabaseUtil.getDBConnection();
- PreparedStatement prepStmt = null;
- String query = SQLConstants.UPDATE_UPDATED_AT_OF_REQUEST;
- try {
- prepStmt = connection.prepareStatement(query);
- prepStmt.setTimestamp(1, new Timestamp(System.currentTimeMillis()));
- prepStmt.setString(2, requestId);
- prepStmt.execute();
- IdentityDatabaseUtil.commitTransaction(connection);
- } catch (SQLException e) {
- IdentityDatabaseUtil.rollbackTransaction(connection);
- throw new InternalWorkflowException("Error when executing the sql query:" + query, e);
- } finally {
- IdentityDatabaseUtil.closeAllConnections(connection, null, prepStmt);
- }
- }
-
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/dto/Association.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/dto/Association.java
deleted file mode 100644
index 44df0a181c16..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/dto/Association.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.dto;
-
-public class Association {
-
- private String associationId;
- private String associationName;
- private String workflowName;
- private String workflowId;
- private String eventName;
- private String eventId;
- private String condition;
- private String eventCategory;
- private boolean enabled;
-
- public String getAssociationId() {
-
- return associationId;
- }
-
- public void setAssociationId(String associationId) {
-
- this.associationId = associationId;
- }
-
- public String getAssociationName() {
-
- return associationName;
- }
-
- public void setAssociationName(String associationName) {
-
- this.associationName = associationName;
- }
-
- public String getEventName() {
-
- return eventName;
- }
-
- public void setEventName(String eventName) {
-
- this.eventName = eventName;
- }
-
- public String getEventId() {
-
- return eventId;
- }
-
- public void setEventId(String eventId) {
-
- this.eventId = eventId;
- }
-
- public String getCondition() {
-
- return condition;
- }
-
- public void setCondition(String condition) {
-
- this.condition = condition;
- }
-
- public String getWorkflowName() {
-
- return workflowName;
- }
-
- public void setWorkflowName(String workflowName) {
-
- this.workflowName = workflowName;
- }
-
- public String getEventCategory() {
- return eventCategory;
- }
-
- public void setEventCategory(String eventCategory) {
- this.eventCategory = eventCategory;
- }
-
- public boolean isEnabled() {
- return enabled;
- }
-
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- }
-
- public String getWorkflowId() {
- return workflowId;
- }
-
- public void setWorkflowId(String workflowId) {
- this.workflowId = workflowId;
- }
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/dto/Template.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/dto/Template.java
deleted file mode 100644
index 0bbe12ba13cc..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/dto/Template.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.dto;
-
-import org.wso2.carbon.identity.workflow.mgt.bean.metadata.ParametersMetaData;
-
-/**
- * Template class is a DTO that is represent basic Template data and the
- * template specific MetaData
- *
- */
-public class Template {
-
- private String templateId;
- private String name;
- private String description;
-
- private ParametersMetaData parametersMetaData;
-
- public String getTemplateId() {
- return templateId;
- }
-
- public void setTemplateId(String templateId) {
- this.templateId = templateId;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public ParametersMetaData getParametersMetaData() {
- return parametersMetaData;
- }
-
- public void setParametersMetaData(ParametersMetaData parametersMetaData) {
- this.parametersMetaData = parametersMetaData;
- }
-
-
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/dto/WorkflowEvent.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/dto/WorkflowEvent.java
deleted file mode 100644
index c2b478391116..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/dto/WorkflowEvent.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.dto;
-
-import org.wso2.carbon.identity.workflow.mgt.bean.Parameter;
-
-public class WorkflowEvent {
-
- private String eventId;
- private String eventFriendlyName;
- private String eventDescription;
- private String eventCategory;
- private Parameter[] parameters;
-
- public String getEventId() {
- return eventId;
- }
-
- public void setEventId(String eventId) {
- this.eventId = eventId;
- }
-
- public String getEventFriendlyName() {
- return eventFriendlyName;
- }
-
- public void setEventFriendlyName(String eventFriendlyName) {
- this.eventFriendlyName = eventFriendlyName;
- }
-
- public String getEventCategory() {
- return eventCategory;
- }
-
- public void setEventCategory(String eventCategory) {
- this.eventCategory = eventCategory;
- }
-
- public Parameter[] getParameters() {
- return parameters;
- }
-
- public void setParameters(Parameter[] parameters) {
- this.parameters = parameters;
- }
-
- public String getEventDescription() {
- return eventDescription;
- }
-
- public void setEventDescription(String eventDescription) {
- this.eventDescription = eventDescription;
- }
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/dto/WorkflowImpl.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/dto/WorkflowImpl.java
deleted file mode 100644
index eb8bc8a9f2e0..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/dto/WorkflowImpl.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.dto;
-
-import org.wso2.carbon.identity.workflow.mgt.bean.metadata.ParametersMetaData;
-
-/**
- * WorkflowImpl class is a DTO that is represent basic Workflow Implementation
- * based on a Template and the Workflow Implementation specific MetaData
- */
-public class WorkflowImpl {
- private String workflowImplId;
- private String workflowImplName;
- private ParametersMetaData parametersMetaData;
-
- private String templateId;
-
- public String getWorkflowImplId() {
- return workflowImplId;
- }
-
- public void setWorkflowImplId(String workflowImplId) {
- this.workflowImplId = workflowImplId;
- }
-
- public String getWorkflowImplName() {
- return workflowImplName;
- }
-
- public void setWorkflowImplName(String workflowImplName) {
- this.workflowImplName = workflowImplName;
- }
-
- public ParametersMetaData getParametersMetaData() {
- return parametersMetaData;
- }
-
- public void setParametersMetaData(
- ParametersMetaData parametersMetaData) {
- this.parametersMetaData = parametersMetaData;
- }
-
- public String getTemplateId() {
- return templateId;
- }
-
- public void setTemplateId(String templateId) {
- this.templateId = templateId;
- }
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/dto/WorkflowRequest.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/dto/WorkflowRequest.java
deleted file mode 100644
index cb4858bce4bc..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/dto/WorkflowRequest.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.dto;
-
-import org.wso2.carbon.identity.workflow.mgt.bean.RequestParameter;
-
-import java.io.Serializable;
-import java.util.List;
-
-public class WorkflowRequest implements Serializable, Cloneable {
-
- private static final long serialVersionUID = 578401681187017212L;
-
- public static final String CREDENTIAL = "Credential";
- private String uuid;
- private String eventType;
- private int tenantId;
- private List requestParameters;
-
-
- public String getUuid() {
- return uuid;
- }
-
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
- public String getEventType() {
- return eventType;
- }
-
- public void setEventType(String eventType) {
- this.eventType = eventType;
- }
-
- public List getRequestParameters() {
- return requestParameters;
- }
-
- public void setRequestParameters(List requestParameters) {
- this.requestParameters = requestParameters;
- }
-
- public int getTenantId() {
- return tenantId;
- }
-
- public void setTenantId(int tenantId) {
- this.tenantId = tenantId;
- }
-
- @Override
- public String toString() {
- return "WorkFlowRequest{" +
- "uuid='" + uuid + "\'\n" +
- ", eventType='" + eventType + "\'\n" +
- ", tenantId=" + tenantId + '\n' +
- ", workflowParameters=" + requestParameters + '\n' +
- '}';
- }
-
- public String getRequestParameterAsString() {
-
- String requestParametersString = "{";
- for (int i = 0; i < requestParameters.size(); i++) {
- if(!CREDENTIAL.equals(requestParameters.get(i).getName())) {
- requestParametersString = requestParametersString + requestParameters.get(i).getName() + " : " +
- requestParameters.get(i).getValue();
- if (i != requestParameters.size() - 1) {
- requestParametersString = requestParametersString + ", \n";
- }
- }
- }
- requestParametersString = requestParametersString + "}";
- return requestParametersString;
- }
-
- @Override
- public WorkflowRequest clone() throws CloneNotSupportedException {
-
- return (WorkflowRequest) (super.clone());
- }
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/dto/WorkflowWizard.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/dto/WorkflowWizard.java
deleted file mode 100644
index 7e780f55117d..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/dto/WorkflowWizard.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.dto;
-
-import org.wso2.carbon.identity.workflow.mgt.bean.Parameter;
-
-/**
- * WorkflowWizard is a DTO that represent the complete Workflow related information in one class.
- * UI Workflow Wizard based on this class
- *
- */
-public class WorkflowWizard{
-
- private String workflowId;
- private String workflowName;
- private String workflowDescription;
- private String templateId;
- private String workflowImplId;
-
- private Template template ;
- private WorkflowImpl workflowImpl;
-
- private Parameter[] templateParameters ;
- private Parameter[] workflowImplParameters ;
-
- public String getWorkflowId() {
- return workflowId;
- }
-
- public void setWorkflowId(String workflowId) {
- this.workflowId = workflowId;
- }
-
- public String getWorkflowName() {
- return workflowName;
- }
-
- public void setWorkflowName(String workflowName) {
- this.workflowName = workflowName;
- }
-
- public String getWorkflowDescription() {
- return workflowDescription;
- }
-
- public void setWorkflowDescription(String workflowDescription) {
- this.workflowDescription = workflowDescription;
- }
-
-
-
- public String getTemplateId() {
- return templateId;
- }
-
- public void setTemplateId(String templateId) {
- this.templateId = templateId;
- }
-
- public String getWorkflowImplId() {
- return workflowImplId;
- }
-
- public void setWorkflowImplId(String workflowImplId) {
- this.workflowImplId = workflowImplId;
- }
-
-
- public Template getTemplate() {
- return template;
- }
-
- public void setTemplate(Template template) {
- this.template = template;
- }
-
- public WorkflowImpl getWorkflowImpl() {
- return workflowImpl;
- }
-
- public void setWorkflowImpl(WorkflowImpl workflowImpl) {
- this.workflowImpl = workflowImpl;
- }
-
- public Parameter[] getTemplateParameters() {
- return templateParameters;
- }
-
- public void setTemplateParameters(Parameter[] templateParameters) {
- this.templateParameters = templateParameters;
- }
-
- public Parameter[] getWorkflowImplParameters() {
- return workflowImplParameters;
- }
-
- public void setWorkflowImplParameters(Parameter[] workflowImplParameters) {
- this.workflowImplParameters = workflowImplParameters;
- }
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/exception/InternalWorkflowException.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/exception/InternalWorkflowException.java
deleted file mode 100644
index 78ad4a1692f4..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/exception/InternalWorkflowException.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.exception;
-
-public class InternalWorkflowException extends WorkflowException{
-
- private static final long serialVersionUID = -3175681683947439154L;
-
- public InternalWorkflowException(String message) {
- super(message);
- }
-
- public InternalWorkflowException(String message, Throwable e) {
- super(message, e);
- }
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/exception/WorkflowClientException.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/exception/WorkflowClientException.java
deleted file mode 100644
index a5294396d289..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/exception/WorkflowClientException.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.wso2.carbon.identity.workflow.mgt.exception;
-
-public class WorkflowClientException extends WorkflowException {
-
- private static final long serialVersionUID = -542581829909714581L;
-
- public WorkflowClientException(String message) {
- super(message);
- }
-
- public WorkflowClientException(String message, Throwable e) { super(message, e); }
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/exception/WorkflowException.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/exception/WorkflowException.java
deleted file mode 100644
index a9e8b3131a7e..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/exception/WorkflowException.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.exception;
-
-import org.wso2.carbon.identity.base.IdentityException;
-
-public class WorkflowException extends IdentityException {
-
- private static final long serialVersionUID = 737141405805528549L;
-
- public WorkflowException(String message) {
- super(message);
- }
-
- public WorkflowException(String message, String errorCode) {
-
- super(errorCode, message);
- }
-
- public WorkflowException(String message, Throwable e) {
- super(message, e);
- }
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/exception/WorkflowRuntimeException.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/exception/WorkflowRuntimeException.java
deleted file mode 100644
index 8802039308e8..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/exception/WorkflowRuntimeException.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.exception;
-
-public class WorkflowRuntimeException extends RuntimeException {
- public WorkflowRuntimeException(String message) {
- super(message);
- }
-
- public WorkflowRuntimeException(String message, Throwable e) {
- super(message, e);
- }
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/extension/AbstractWorkflowRequestHandler.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/extension/AbstractWorkflowRequestHandler.java
deleted file mode 100644
index cec809a7017c..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/extension/AbstractWorkflowRequestHandler.java
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.extension;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.context.CarbonContext;
-import org.wso2.carbon.identity.workflow.mgt.WorkFlowExecutorManager;
-import org.wso2.carbon.identity.workflow.mgt.WorkflowExecutorResult;
-import org.wso2.carbon.identity.workflow.mgt.bean.Entity;
-import org.wso2.carbon.identity.workflow.mgt.bean.RequestParameter;
-import org.wso2.carbon.identity.workflow.mgt.dto.WorkflowRequest;
-import org.wso2.carbon.identity.workflow.mgt.exception.InternalWorkflowException;
-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.ExecutorResultState;
-import org.wso2.carbon.identity.workflow.mgt.util.WFConstant;
-import org.wso2.carbon.identity.workflow.mgt.util.WorkflowDataType;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public abstract class AbstractWorkflowRequestHandler implements WorkflowRequestHandler {
-
- /**
- * Used to skip the workflow execution on the successive call after workflow completion.
- */
- private static ThreadLocal workFlowCompleted = new ThreadLocal();
-
- private static final Log log = LogFactory.getLog(AbstractWorkflowRequestHandler.class);
- public static void unsetWorkFlowCompleted() {
-
- AbstractWorkflowRequestHandler.workFlowCompleted.remove();
- }
- public static Boolean getWorkFlowCompleted() {
-
- return workFlowCompleted.get();
- }
- public static void setWorkFlowCompleted(Boolean workFlowCompleted) {
-
- AbstractWorkflowRequestHandler.workFlowCompleted.set(workFlowCompleted);
- }
-
- /**
- * Start a new workflow.
- *
- * @param wfParams Parameters related to workflow
- * @param nonWfParams Other parameters
- * @return
- * @throws WorkflowException
- */
- public WorkflowExecutorResult startWorkFlow(Map wfParams, Map nonWfParams)
- throws WorkflowException {
-
- return startWorkFlow(wfParams, nonWfParams, null);
- }
-
- /**
- * Start a new workflow.
- *
- * @param wfParams Parameters related to workflow
- * @param nonWfParams Other parameters
- * @param uuid Unique ID of request
- * @return
- * @throws WorkflowException
- */
- public WorkflowExecutorResult startWorkFlow(Map wfParams, Map nonWfParams, String uuid)
- throws WorkflowException {
-
- if (isWorkflowCompleted()) {
- return new WorkflowExecutorResult(ExecutorResultState.COMPLETED);
- }
- if (!isAssociated()) {
- return new WorkflowExecutorResult(ExecutorResultState.NO_ASSOCIATION);
- }
-
- WorkflowRequest workFlowRequest = new WorkflowRequest();
- List parameters = new ArrayList(wfParams.size() + nonWfParams.size() + 1);
- for (Map.Entry paramEntry : wfParams.entrySet()) {
- parameters.add(getParameter(paramEntry.getKey(), paramEntry.getValue(), true));
- }
- for (Map.Entry paramEntry : nonWfParams.entrySet()) {
- parameters.add(getParameter(paramEntry.getKey(), paramEntry.getValue(), false));
- }
- RequestParameter uuidParameter = new RequestParameter();
- uuidParameter.setName(WFConstant.REQUEST_ID);
- uuidParameter.setValue(uuid);
- uuidParameter.setRequiredInWorkflow(true);
- uuidParameter.setValueType(WorkflowDataType.STRING_TYPE);
- parameters.add(uuidParameter);
- workFlowRequest.setRequestParameters(parameters);
- workFlowRequest.setTenantId(CarbonContext.getThreadLocalCarbonContext().getTenantId());
- workFlowRequest.setUuid(uuid);
-
- engageWorkflow(workFlowRequest);
-
- WorkflowExecutorResult workflowExecutorResult =
- WorkFlowExecutorManager.getInstance().executeWorkflow(workFlowRequest);
-
- if(workflowExecutorResult.getExecutorResultState() == ExecutorResultState.FAILED){
- throw new WorkflowException(workflowExecutorResult.getMessage());
- }
-
- return workflowExecutorResult;
- }
-
- protected boolean isValueValid(String paramName, Object paramValue, String expectedType) {
-
- switch (expectedType) {
- case WorkflowDataType.BOOLEAN_TYPE:
- return paramValue instanceof Boolean;
- case WorkflowDataType.STRING_TYPE:
- return paramValue instanceof String;
- case WorkflowDataType.INTEGER_TYPE:
- return paramValue instanceof Integer || paramValue instanceof Long || paramValue instanceof Character ||
- paramValue instanceof Byte || paramValue instanceof Short;
- case WorkflowDataType.DOUBLE_TYPE:
- return paramValue instanceof Float || paramValue instanceof Double;
- case WorkflowDataType.STRING_LIST_TYPE:
- case WorkflowDataType.DOUBLE_LIST_TYPE:
- case WorkflowDataType.INTEGER_LIST_TYPE:
- case WorkflowDataType.BOOLEAN_LIST_TYPE:
- return paramValue instanceof Collection;
- case WorkflowDataType.STRING_STRING_MAP_TYPE:
- return paramValue instanceof Map;
- }
- return false;
- }
-
- /**
- * Wraps the parameters to the WorkflowParameter
- *
- * @param name Name of the parameter
- * @param value Value of the parameter
- * @param required Whether it is required to sent to the workflow executor
- * @return
- */
- protected RequestParameter getParameter(String name, Object value, boolean required)
- throws WorkflowRuntimeException {
-
- RequestParameter parameter = new RequestParameter();
- parameter.setName(name);
- parameter.setValue(value);
- parameter.setRequiredInWorkflow(required);
- String valueType = getParamDefinitions().get(name);
- if (valueType == null || value == null) {
- //null value as param, or undefined param
- parameter.setValueType(WorkflowDataType.OTHER_TYPE);
- } else {
- if (isValueValid(name, value, valueType)) {
- parameter.setValueType(valueType);
- } else {
- throw new WorkflowRuntimeException("Invalid value for '" + name + "', Expected: '" + valueType + "', " +
- "but was of " + value.getClass().getName());
- }
- }
- return parameter;
- }
-
- @Override
- public void engageWorkflow(WorkflowRequest workFlowRequest) throws WorkflowException {
-
- workFlowRequest.setEventType(getEventId());
-
- }
-
- @Override
- public void onWorkflowCompletion(String status, WorkflowRequest originalRequest, Map
- responseParams) throws WorkflowException {
-
- try {
- Map requestParams = new HashMap();
- for (RequestParameter parameter : originalRequest.getRequestParameters()) {
- requestParams.put(parameter.getName(), parameter.getValue());
- }
- if (retryNeedAtCallback()) {
- setWorkFlowCompleted(true);
- }
- onWorkflowCompletion(status, requestParams, responseParams, originalRequest.getTenantId());
- } finally {
- unsetWorkFlowCompleted();
- }
- }
-
- /**
- * Callback method from the executor
- *
- * @param status The return status from the workflow executor
- * @param requestParams The params that were in the original request
- * @param responseAdditionalParams The params sent from the workflow executor
- * @param tenantId
- */
- public abstract void onWorkflowCompletion(String status, Map requestParams, Map
- responseAdditionalParams, int tenantId) throws WorkflowException;
-
- /**
- * Whether the same request is initiated at the callback. If set to true
, this will take actions to
- * skip the request initiated at the callback.
- * Note: Do not set this to true unless necessary, It will lead to memory leaks
- *
- * @return
- */
- public abstract boolean retryNeedAtCallback();
-
- /**
- * Check if an operation engaged with a workflow valid to execute
- *
- * @param entities Array of entities involved in operation
- * @return
- */
- public boolean isValidOperation(Entity[] entities) throws WorkflowException {
- return true;
- }
-
- private boolean isWorkflowCompleted() {
-
- if (retryNeedAtCallback() && getWorkFlowCompleted() != null && getWorkFlowCompleted()) {
- return true;
- } else return false;
- }
-
- /**
- * We can check whether the current event type is already associated with
- * at-least one association or not by using isAssociated method.
- *
- * @return Boolean value for result of isAssociated
- * @throws WorkflowException
- */
- public boolean isAssociated() throws WorkflowException{
- boolean eventEngaged = false ;
- try {
- eventEngaged = WorkflowServiceDataHolder.getInstance().getWorkflowService().isEventAssociated(getEventId());
- } catch (InternalWorkflowException e) {
- String errorMsg = "Error occurred while checking any association for this event, " + e.getMessage() ;
- log.error(errorMsg, e);
- throw new WorkflowException(errorMsg,e);
- }
- return eventEngaged ;
- }
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/extension/WorkflowRequestHandler.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/extension/WorkflowRequestHandler.java
deleted file mode 100644
index dda5fdf7b01d..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/extension/WorkflowRequestHandler.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.extension;
-
-import org.wso2.carbon.identity.workflow.mgt.dto.WorkflowRequest;
-import org.wso2.carbon.identity.workflow.mgt.exception.WorkflowException;
-
-import java.util.Map;
-
-public interface WorkflowRequestHandler {
-
- /**
- * Creates the workflow request for an event and engage it.
- *
- * @param workFlowRequest
- * @throws WorkflowException
- */
- void engageWorkflow(WorkflowRequest workFlowRequest) throws WorkflowException;
-
- /**
- * Gets the event that this handler is subscribed, used when handling the callback
- *
- * @return
- */
- String getEventId();
-
- /**
- * Called on workflow completion
- *
- * @param status The workflow status
- * @param originalRequest The original request that was made by
- * {@link #engageWorkflow(WorkflowRequest)}
- * @param responseParams Additional data returned from workflow
- * @throws WorkflowException
- */
- void onWorkflowCompletion(String status, WorkflowRequest originalRequest, Map responseParams) throws
- WorkflowException;
-
- /**
- * Returns the parameter names and their types. Will be used in input validation and in UIs.
- *
- * @return
- */
- Map getParamDefinitions();
-
- /**
- * Gets the human friendly name for the event associated with this handler
- * @return
- */
- String getFriendlyName();
-
- /**
- * Gets the human friendly description for the event associated with this handler
- * @return
- */
- String getDescription();
-
- /**
- * Gets the category of the event associated with this handler
- * @return
- */
- String getCategory();
-
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/handler/WorkflowPendingUserAuthnHandler.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/handler/WorkflowPendingUserAuthnHandler.java
deleted file mode 100644
index e2dfe967db54..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/handler/WorkflowPendingUserAuthnHandler.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2021, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.handler;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.identity.base.IdentityRuntimeException;
-import org.wso2.carbon.identity.core.bean.context.MessageContext;
-import org.wso2.carbon.identity.core.handler.InitConfig;
-import org.wso2.carbon.identity.core.model.IdentityErrorMsgContext;
-import org.wso2.carbon.identity.core.util.IdentityCoreConstants;
-import org.wso2.carbon.identity.core.util.IdentityUtil;
-import org.wso2.carbon.identity.event.IdentityEventConstants;
-import org.wso2.carbon.identity.event.IdentityEventException;
-import org.wso2.carbon.identity.event.event.Event;
-import org.wso2.carbon.identity.event.handler.AbstractEventHandler;
-import org.wso2.carbon.identity.workflow.mgt.WorkflowManagementService;
-import org.wso2.carbon.identity.workflow.mgt.WorkflowManagementServiceImpl;
-import org.wso2.carbon.identity.workflow.mgt.bean.Entity;
-import org.wso2.carbon.identity.workflow.mgt.exception.WorkflowException;
-import org.wso2.carbon.identity.workflow.mgt.util.WFConstant;
-import org.wso2.carbon.identity.workflow.mgt.util.WorkflowErrorConstants;
-import org.wso2.carbon.utils.multitenancy.MultitenantUtils;
-
-import java.util.Map;
-
-/**
- * The WorkflowPendingUserAuthnHandler is to handle authentication when the ADD USER workflow is engaged.
- */
-public class WorkflowPendingUserAuthnHandler extends AbstractEventHandler {
-
- private static final Log log = LogFactory.getLog(WorkflowPendingUserAuthnHandler.class);
-
- @Override
- public void handleEvent(Event event) throws IdentityEventException {
-
- Map eventProperties = event.getEventProperties();
-
- if (log.isDebugEnabled()) {
- log.debug("Handling the event : " + event.getEventName());
- }
- String userName = (String) eventProperties.get(IdentityEventConstants.EventProperty.USER_NAME);
- int tenantId = (Integer) eventProperties.get(IdentityEventConstants.EventProperty.TENANT_ID);
- validatePendingApproval(userName, tenantId);
- }
-
- public String getName() {
-
- return "WorkflowPendingUserAuthnHandler";
- }
-
- public String getFriendlyName() {
-
- return "Workflow Pending User Authentication Handler";
- }
-
- @Override
- public void init(InitConfig configuration) throws IdentityRuntimeException {
-
- super.init(configuration);
- }
-
- @Override
- public int getPriority(MessageContext messageContext) {
-
- return 113;
- }
-
- /**
- * Validate whether the user account approval is pending.
- *
- * @param username Username.
- * @throws IdentityEventException If an error occurred while validating pending approval.
- */
- private void validatePendingApproval(String username, int tenantId) throws IdentityEventException {
-
- boolean isPendingApproval;
- try {
- Entity entity = new Entity(MultitenantUtils.getTenantAwareUsername(username),
- WFConstant.WORKFLOW_ENTITY_TYPE, tenantId);
- WorkflowManagementService workflowManagementService = new WorkflowManagementServiceImpl();
- isPendingApproval = workflowManagementService.entityHasPendingWorkflowsOfType(entity,
- WFConstant.WORKFLOW_REQUEST_TYPE);
- } catch (WorkflowException e) {
- throw new IdentityEventException("Error occurred while checking the pending approvals for " +
- "the account of the user: " + username, e);
- } catch (IdentityRuntimeException e) {
- throw new IdentityEventException("Can't find the tenant domain for the user: " + username, e);
- }
-
- if (isPendingApproval) {
- IdentityErrorMsgContext customErrorMessageContext =
- new IdentityErrorMsgContext(IdentityCoreConstants.USER_ACCOUNT_PENDING_APPROVAL_ERROR_CODE);
- IdentityUtil.setIdentityErrorMsg(customErrorMessageContext);
- throw new IdentityEventException(
- WorkflowErrorConstants.ErrorMessages.ERROR_CODE_USER_ACCOUNT_PENDING_APPROVAL.getCode(),
- WorkflowErrorConstants.ErrorMessages.ERROR_CODE_USER_ACCOUNT_PENDING_APPROVAL.getMessage());
- }
- }
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/internal/WorkflowMgtServiceComponent.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/internal/WorkflowMgtServiceComponent.java
deleted file mode 100644
index 196bbe8d43b3..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/internal/WorkflowMgtServiceComponent.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.internal;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.component.ComponentContext;
-import org.osgi.service.component.annotations.Activate;
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Reference;
-import org.osgi.service.component.annotations.ReferenceCardinality;
-import org.osgi.service.component.annotations.ReferencePolicy;
-import org.wso2.carbon.base.ServerConfiguration;
-import org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent;
-import org.wso2.carbon.identity.event.handler.AbstractEventHandler;
-import org.wso2.carbon.identity.workflow.mgt.handler.WorkflowPendingUserAuthnHandler;
-import org.wso2.carbon.identity.workflow.mgt.WorkflowManagementService;
-import org.wso2.carbon.identity.workflow.mgt.WorkflowManagementServiceImpl;
-import org.wso2.carbon.identity.workflow.mgt.extension.WorkflowRequestHandler;
-import org.wso2.carbon.identity.workflow.mgt.listener.WorkflowAuditLogger;
-import org.wso2.carbon.identity.workflow.mgt.listener.WorkflowExecutorAuditLogger;
-import org.wso2.carbon.identity.workflow.mgt.listener.WorkflowExecutorManagerListener;
-import org.wso2.carbon.identity.workflow.mgt.listener.WorkflowListener;
-import org.wso2.carbon.identity.workflow.mgt.listener.WorkflowTenantMgtListener;
-import org.wso2.carbon.identity.workflow.mgt.template.AbstractTemplate;
-import org.wso2.carbon.identity.workflow.mgt.util.WFConstant;
-import org.wso2.carbon.identity.workflow.mgt.workflow.AbstractWorkflow;
-import org.wso2.carbon.stratos.common.listeners.TenantMgtListener;
-import org.wso2.carbon.user.core.service.RealmService;
-import org.wso2.carbon.utils.ConfigurationContextService;
-
-@Component(
- name = "org.wso2.carbon.identity.workflow.mgt",
- immediate = true)
-public class WorkflowMgtServiceComponent {
-
- @Activate
- protected void activate(ComponentContext context) {
-
- try {
- BundleContext bundleContext = context.getBundleContext();
- WorkflowManagementService workflowService = new WorkflowManagementServiceImpl();
- bundleContext.registerService(WorkflowManagementService.class, workflowService, null);
- AbstractEventHandler workflowPendingUserAuthnHandler = new WorkflowPendingUserAuthnHandler();
- bundleContext.registerService(AbstractEventHandler.class, workflowPendingUserAuthnHandler, null);
- WorkflowServiceDataHolder.getInstance().setWorkflowService(workflowService);
- WorkflowServiceDataHolder.getInstance().setBundleContext(bundleContext);
- ServiceRegistration serviceRegistration = context.getBundleContext()
- .registerService(WorkflowListener.class.getName(), new WorkflowAuditLogger(), null);
- context.getBundleContext()
- .registerService(WorkflowExecutorManagerListener.class.getName(), new WorkflowExecutorAuditLogger(),
- null);
- context.getBundleContext()
- .registerService(TenantMgtListener.class.getName(), new WorkflowTenantMgtListener(), null);
-
- if (serviceRegistration != null) {
- if (log.isDebugEnabled()) {
- log.debug("WorkflowAuditLogger registered.");
- }
- } else {
- log.error("Workflow Audit Logger could not be registered.");
- }
- if (System.getProperty(WFConstant.KEYSTORE_SYSTEM_PROPERTY_ID) == null) {
- System.setProperty(WFConstant.KEYSTORE_SYSTEM_PROPERTY_ID,
- ServerConfiguration.getInstance().getFirstProperty(WFConstant.KEYSTORE_CARBON_CONFIG_PATH));
- }
- if (System.getProperty(WFConstant.KEYSTORE_PASSWORD_SYSTEM_PROPERTY_ID) == null) {
- System.setProperty(WFConstant.KEYSTORE_PASSWORD_SYSTEM_PROPERTY_ID, ServerConfiguration.getInstance()
- .getFirstProperty(WFConstant.KEYSTORE_PASSWORD_CARBON_CONFIG_PATH));
- }
- } catch (Throwable e) {
- log.error("Failed to start the WorkflowMgtServiceComponent", e);
- }
- }
-
- private static final Log log = LogFactory.getLog(WorkflowMgtServiceComponent.class);
-
- @Reference(
- name = "user.realmservice.default",
- service = org.wso2.carbon.user.core.service.RealmService.class,
- cardinality = ReferenceCardinality.MANDATORY,
- policy = ReferencePolicy.DYNAMIC,
- unbind = "unsetRealmService")
- protected void setRealmService(RealmService realmService) {
- WorkflowServiceDataHolder.getInstance().setRealmService(realmService);
- }
-
- protected void unsetRealmService(RealmService realmService) {
- WorkflowServiceDataHolder.getInstance().setRealmService(null);
- }
-
- protected void unsetConfigurationContextService(ConfigurationContextService contextService) {
- WorkflowServiceDataHolder.getInstance().setConfigurationContextService(null);
- }
-
- @Reference(
- name = "org.wso2.carbon.utils.contextservice",
- service = org.wso2.carbon.utils.ConfigurationContextService.class,
- cardinality = ReferenceCardinality.MANDATORY,
- policy = ReferencePolicy.DYNAMIC,
- unbind = "unsetConfigurationContextService")
- protected void setConfigurationContextService(ConfigurationContextService contextService) {
- WorkflowServiceDataHolder.getInstance().setConfigurationContextService(contextService);
- }
-
- @Reference(
- name = "org.wso2.carbon.identity.workflow.mgt.extension.requesthandler",
- service = org.wso2.carbon.identity.workflow.mgt.extension.WorkflowRequestHandler.class,
- cardinality = ReferenceCardinality.MULTIPLE,
- policy = ReferencePolicy.DYNAMIC,
- unbind = "unsetWorkflowRequestHandler")
- protected void setWorkflowRequestHandler(WorkflowRequestHandler workflowRequestHandler) {
- WorkflowServiceDataHolder.getInstance().addWorkflowRequestHandler(workflowRequestHandler);
- }
-
- protected void unsetWorkflowRequestHandler(WorkflowRequestHandler workflowRequestHandler) {
- WorkflowServiceDataHolder.getInstance().removeWorkflowRequestHandler(workflowRequestHandler);
- }
-
- @Reference(
- name = "org.wso2.carbon.identity.workflow.mgt.template.abtracttemplate",
- service = org.wso2.carbon.identity.workflow.mgt.template.AbstractTemplate.class,
- cardinality = ReferenceCardinality.MULTIPLE,
- policy = ReferencePolicy.DYNAMIC,
- unbind = "unsetTemplate")
- protected void setTemplate(AbstractTemplate template) {
- WorkflowServiceDataHolder.getInstance().addTemplate(template);
- }
-
- protected void unsetTemplate(AbstractTemplate template) {
- WorkflowServiceDataHolder.getInstance().removeTemplate(template);
- }
-
- @Reference(
- name = "org.wso2.carbon.identity.workflow.mgt.workflow.abstractworkflow",
- service = org.wso2.carbon.identity.workflow.mgt.workflow.AbstractWorkflow.class,
- cardinality = ReferenceCardinality.MULTIPLE,
- policy = ReferencePolicy.DYNAMIC,
- unbind = "unsetWorkflowImplementation")
- protected void setWorkflowImplementation(AbstractWorkflow workflowImplementation) {
- WorkflowServiceDataHolder.getInstance().addWorkflowImplementation(workflowImplementation);
- }
-
- protected void unsetWorkflowImplementation(AbstractWorkflow workflowImplementation) {
- WorkflowServiceDataHolder.getInstance().removeWorkflowImplementation(workflowImplementation);
- }
-
- @Reference(
- name = "org.wso2.carbon.identity.workflow.mgt.listener.deleterequest",
- service = org.wso2.carbon.identity.workflow.mgt.listener.WorkflowListener.class,
- cardinality = ReferenceCardinality.MULTIPLE,
- policy = ReferencePolicy.DYNAMIC,
- unbind = "unsetWorkflowRequestDeleteListener")
- protected void setWorkflowRequestDeleteListener(WorkflowListener workflowListener) {
- WorkflowServiceDataHolder.getInstance().getWorkflowListenerList().add(workflowListener);
- }
-
- protected void unsetWorkflowRequestDeleteListener(WorkflowListener workflowListener) {
- WorkflowServiceDataHolder.getInstance().getWorkflowListenerList().remove(workflowListener);
- }
-
- @Reference(
- name = "org.wso2.carbon.identity.workflow.mgt.listener.workflowexecutorlistner",
- service = org.wso2.carbon.identity.workflow.mgt.listener.WorkflowExecutorManagerListener.class,
- cardinality = ReferenceCardinality.MULTIPLE,
- policy = ReferencePolicy.DYNAMIC,
- unbind = "unsetWorkflowExecutorListener")
- protected void setWorkflowExecutorListener(WorkflowExecutorManagerListener workflowListener) {
- WorkflowServiceDataHolder.getInstance().getExecutorListenerList().add(workflowListener);
- }
-
- protected void unsetWorkflowExecutorListener(WorkflowExecutorManagerListener workflowListener) {
- WorkflowServiceDataHolder.getInstance().getExecutorListenerList().remove(workflowListener);
- }
-
- protected void unsetIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) {
- /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core
- is started */
- }
-
- @Reference(
- name = "identityCoreInitializedEventService",
- service = org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent.class,
- cardinality = ReferenceCardinality.MANDATORY,
- policy = ReferencePolicy.DYNAMIC,
- unbind = "unsetIdentityCoreInitializedEventService")
- protected void setIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) {
- /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core
- is started */
- }
-}
-
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/internal/WorkflowServiceDataHolder.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/internal/WorkflowServiceDataHolder.java
deleted file mode 100644
index e4525f21762d..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/internal/WorkflowServiceDataHolder.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.internal;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.osgi.framework.BundleContext;
-import org.wso2.carbon.identity.workflow.mgt.WorkflowManagementService;
-import org.wso2.carbon.identity.workflow.mgt.extension.WorkflowRequestHandler;
-import org.wso2.carbon.identity.workflow.mgt.listener.WorkflowExecutorManagerListener;
-import org.wso2.carbon.identity.workflow.mgt.listener.WorkflowListener;
-import org.wso2.carbon.identity.workflow.mgt.template.AbstractTemplate;
-import org.wso2.carbon.identity.workflow.mgt.workflow.AbstractWorkflow;
-import org.wso2.carbon.user.core.service.RealmService;
-import org.wso2.carbon.utils.ConfigurationContextService;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class WorkflowServiceDataHolder {
-
- private static WorkflowServiceDataHolder instance = new WorkflowServiceDataHolder();
- private static final Log log = LogFactory.getLog(WorkflowServiceDataHolder.class);
-
- private RealmService realmService;
- private ConfigurationContextService configurationContextService;
- private BundleContext bundleContext;
-
- private Map workflowRequestHandlers = new HashMap();
-
- private List workflowListenerList = new ArrayList<>();
- private List executorListenerList = new ArrayList<>();
-
- public List getWorkflowListenerList() {
- return workflowListenerList;
- }
-
- public void setWorkflowListenerList(
- List workflowListenerList) {
- this.workflowListenerList = workflowListenerList;
- }
-
- public List getExecutorListenerList() {
- return executorListenerList;
- }
-
- public void setExecutorListenerList(
- List executorListenerList) {
- this.executorListenerList = executorListenerList;
- }
-
- private Map templates = new HashMap();
- private Map> workflowImpls = new HashMap>();
-
- private WorkflowManagementService workflowService = null ;
-
- private WorkflowServiceDataHolder() {
-
- }
-
- public ConfigurationContextService getConfigurationContextService() {
-
- return configurationContextService;
- }
-
- public void setConfigurationContextService(
- ConfigurationContextService configurationContextService) {
-
- this.configurationContextService = configurationContextService;
- }
-
- public BundleContext getBundleContext() {
-
- return bundleContext;
- }
-
- public void setBundleContext(BundleContext bundleContext) {
-
- this.bundleContext = bundleContext;
- }
-
- public RealmService getRealmService() {
-
- return realmService;
- }
-
- public void setRealmService(RealmService realmService) {
-
- this.realmService = realmService;
- }
-
- public static WorkflowServiceDataHolder getInstance() {
-
- return instance;
- }
-
- public void addTemplate(AbstractTemplate template) {
- templates.put(template.getTemplateId(), template);
- }
-
- public void removeTemplate(AbstractTemplate template) {
- if (template != null && template.getTemplateId() != null) {
- templates.remove(template.getTemplateId());
- }
- }
-
-
- public Map getTemplates() {
- return templates;
- }
-
- public Map> getWorkflowImpls() {
- return workflowImpls;
- }
-
- public void addWorkflowImplementation(AbstractWorkflow abstractWorkflow) {
- Map abstractWorkflowMap = workflowImpls.get(abstractWorkflow.getTemplateId());
- if(abstractWorkflowMap == null){
- abstractWorkflowMap = new HashMap<>();
- workflowImpls.put(abstractWorkflow.getTemplateId(),abstractWorkflowMap);
- }
- abstractWorkflowMap.put(abstractWorkflow.getWorkflowImplId(),abstractWorkflow);
- }
-
- public void removeWorkflowImplementation(AbstractWorkflow abstractWorkflow) {
-
- if (abstractWorkflow != null && abstractWorkflow.getWorkflowImplId() != null) {
- workflowImpls.remove(abstractWorkflow.getWorkflowImplId());
- }
- }
-
-
- public void addWorkflowRequestHandler(WorkflowRequestHandler requestHandler) {
-
- if (requestHandler != null) {
- workflowRequestHandlers.put(requestHandler.getEventId(), requestHandler);
- }
- }
-
- public void removeWorkflowRequestHandler(WorkflowRequestHandler requestHandler) {
-
- if (requestHandler != null) {
- workflowRequestHandlers.remove(requestHandler.getEventId());
- }
- }
-
- public WorkflowRequestHandler getRequestHandler(String eventId) {
-
- return workflowRequestHandlers.get(eventId);
- }
-
- public List listRequestHandlers() {
-
- return new ArrayList<>(workflowRequestHandlers.values());
- }
-
-
- public WorkflowManagementService getWorkflowService() {
- return workflowService;
- }
-
- public void setWorkflowService(WorkflowManagementService workflowService) {
- this.workflowService = workflowService;
- }
-}
-
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/listener/AbstractWorkflowExecutorManagerListener.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/listener/AbstractWorkflowExecutorManagerListener.java
deleted file mode 100644
index 65d6561c3413..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/listener/AbstractWorkflowExecutorManagerListener.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.listener;
-
-import org.apache.commons.lang.StringUtils;
-import org.wso2.carbon.identity.core.model.IdentityEventListenerConfig;
-import org.wso2.carbon.identity.core.util.IdentityCoreConstants;
-import org.wso2.carbon.identity.core.util.IdentityUtil;
-import org.wso2.carbon.identity.workflow.mgt.WorkflowExecutorResult;
-import org.wso2.carbon.identity.workflow.mgt.dto.WorkflowRequest;
-import org.wso2.carbon.identity.workflow.mgt.exception.WorkflowException;
-
-import java.util.Map;
-
-public abstract class AbstractWorkflowExecutorManagerListener implements WorkflowExecutorManagerListener {
-
- /**
- * Trigger before executing a workflow request
- *
- * @param workFlowRequest Details of request to execute
- * @throws WorkflowException
- */
- @Override
- public void doPreExecuteWorkflow(WorkflowRequest workFlowRequest) throws WorkflowException {
-
- }
-
- /**
- * Trigger after executing a workflow request
- *
- * @param workFlowRequest Details of request to execute
- * @param result Result of the original operation
- * @throws WorkflowException
- */
- @Override
- public void doPostExecuteWorkflow(WorkflowRequest workFlowRequest, WorkflowExecutorResult result) throws
- WorkflowException {
-
- }
-
- /**
- * Trigger before handling a callback
- *
- * @param uuid UUID to request which callback received
- * @param status Status of call back
- * @param additionalParams Additional parameters required to execute request
- * @throws WorkflowException
- */
- @Override
- public void doPreHandleCallback(String uuid, String status, Map additionalParams) throws
- WorkflowException {
-
- }
-
- /**
- * Trigger after handling a callback
- *
- * @param uuid UUID to request which callback received
- * @param status Status of call back
- * @param additionalParams Additional parameters required to execute request
- * @throws WorkflowException
- */
- @Override
- public void doPostHandleCallback(String uuid, String status, Map additionalParams) throws
- WorkflowException {
-
- }
-
- /**
- * Check if listener is enabled or not.
- *
- * @return
- */
- public boolean isEnable() {
- IdentityEventListenerConfig listenerConfig = IdentityUtil.readEventListenerProperty
- (WorkflowExecutorManagerListener.class.getName(), this.getClass().getName());
-
- if (listenerConfig == null) {
- return true;
- }
-
- if (StringUtils.isNotBlank(listenerConfig.getEnable())) {
- return Boolean.parseBoolean(listenerConfig.getEnable());
- } else {
- return true;
- }
- }
-
- /**
- * get order ID (priority of current listener)
- *
- * @return
- */
- public int getOrderId() {
- IdentityEventListenerConfig listenerConfig = IdentityUtil.readEventListenerProperty
- (WorkflowExecutorManagerListener.class.getName(), this.getClass().getName());
- if (listenerConfig == null) {
- return IdentityCoreConstants.EVENT_LISTENER_ORDER_ID;
- }
- return listenerConfig.getOrder();
- }
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/listener/AbstractWorkflowListener.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/listener/AbstractWorkflowListener.java
deleted file mode 100644
index b8fa4d6a8777..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/listener/AbstractWorkflowListener.java
+++ /dev/null
@@ -1,774 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.listener;
-
-import org.apache.commons.lang.StringUtils;
-import org.wso2.carbon.identity.core.model.IdentityEventListenerConfig;
-import org.wso2.carbon.identity.core.util.IdentityCoreConstants;
-import org.wso2.carbon.identity.core.util.IdentityUtil;
-import org.wso2.carbon.identity.workflow.mgt.bean.Entity;
-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.bean.WorkflowRequest;
-import org.wso2.carbon.identity.workflow.mgt.bean.WorkflowRequestAssociation;
-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.dto.WorkflowImpl;
-import org.wso2.carbon.identity.workflow.mgt.exception.WorkflowException;
-
-import java.util.List;
-
-public abstract class AbstractWorkflowListener implements WorkflowListener {
-
- /**
- * Trigger Before Listing Workflow Events
- *
- * @throws WorkflowException
- */
- @Override
- public void doPreListWorkflowEvents() {
-
- }
-
- /**
- * Trigger After Listing Workflow Events
- *
- * @param result Result of the original operation
- */
- @Override
- public void doPostListWorkflowEvents(List result) {
-
- }
-
- /**
- * Trigger before delete the request
- *
- * @param workflowRequest Request to delete
- * @throws WorkflowException
- */
- @Override
- public void doPreDeleteWorkflowRequest(WorkflowRequest workflowRequest) throws WorkflowException {
-
- }
-
- /**
- * Trigger after deleting the request
- *
- * @param workflowRequest Request to delete
- * @throws WorkflowException
- */
- @Override
- public void doPostDeleteWorkflowRequest(WorkflowRequest workflowRequest) throws WorkflowException {
-
- }
-
- /**
- * Trigger before delete the workflow
- *
- * @param workflow Workflow to delete
- * @throws WorkflowException
- */
- @Override
- public void doPreDeleteWorkflow(Workflow workflow) throws WorkflowException {
-
- }
-
- /**
- * Trigger after delete the workflow
- *
- * @param workflow Workflow to delete
- * @throws WorkflowException
- */
- @Override
- public void doPostDeleteWorkflow(Workflow workflow) throws WorkflowException {
-
- }
-
- /**
- * Trigger after deleting workflows by tenant id.
- *
- * @param tenantId The id of the tenant.
- * @throws WorkflowException
- */
- @Override
- public void doPostDeleteWorkflows(int tenantId) throws WorkflowException {
-
- }
-
- /**
- * Trigger before listing workflow Impls
- *
- * @param templateId Template ID to trigger workflow Impls
- * @throws WorkflowException
- */
- @Override
- public void doPreListWorkflowImpls(String templateId) throws WorkflowException {
-
- }
-
- /**
- * Trigger after listing workflow Impls
- *
- * @param templateId Template ID to trigger workflow Impls
- * @param result Result of the original operation
- * @throws WorkflowException
- */
- @Override
- public void doPostListWorkflowImpls(String templateId, List result) throws WorkflowException {
-
- }
-
- /**
- * Trigger before retrieving event
- *
- * @param id Event ID
- * @throws WorkflowException
- */
- @Override
- public void doPreGetEvent(String id) {
-
- }
-
- /**
- * Trigger after retrieving event
- *
- * @param id Event ID
- * @param result Event returned by original method
- */
- @Override
- public void doPostGetEvent(String id, WorkflowEvent result) {
-
- }
-
- /**
- * Trigger before retrieving list of workflow templates
- *
- * @throws WorkflowException
- */
- @Override
- public void doPreListTemplates() throws WorkflowException {
-
- }
-
- /**
- * Trigger after retrieving list of workflow templates
- *
- * @param result Result returned by original operation
- * @throws WorkflowException
- */
- @Override
- public void doPostListTemplates(List result) throws WorkflowException {
-
- }
-
- /**
- * Trigger before retrieving workflow template
- *
- * @param templateId Template ID of template to retrieve
- * @throws WorkflowException
- */
- @Override
- public void doPreGetTemplate(String templateId) throws WorkflowException {
-
- }
-
- /**
- * Trigger after retrieving workflow template
- *
- * @param templateId Template ID of template to retrieve
- * @param result Template object retrieved by original method
- * @throws WorkflowException
- */
- @Override
- public void doPostGetTemplate(String templateId, Template result) throws WorkflowException {
-
- }
-
- /**
- * Trigger before retrieving workflow impl
- *
- * @param templateId Template id
- * @param workflowImplId Workflow impl id
- * @throws WorkflowException
- */
- @Override
- public void doPreGetWorkflowImpl(String templateId, String workflowImplId) throws WorkflowException {
-
- }
-
-
- /**
- * Trigger after retrieving workflow impl
- *
- * @param templateId Template id
- * @param workflowImplId Workflow impl id
- * @param result Result returned by original operation
- * @throws WorkflowException
- */
- @Override
- public void doPostGetWorkflowImpl(String templateId, String workflowImplId, WorkflowImpl result) throws
- WorkflowException {
-
- }
-
- /**
- * Trigger before adding a workflow
- *
- * @param workflowDTO Workflow details
- * @param parameterList List of parameters
- * @param tenantId tenant id
- * @throws WorkflowException
- */
- @Override
- public void doPreAddWorkflow(Workflow workflowDTO, List parameterList, int tenantId) throws
- WorkflowException {
-
- }
-
- /**
- * Trigger after adding a workflow
- *
- * @param workflowDTO Workflow details
- * @param parameterList List of parameters
- * @param tenantId tenant id
- * @throws WorkflowException
- */
- @Override
- public void doPostAddWorkflow(Workflow workflowDTO, List parameterList, int tenantId) throws
- WorkflowException {
-
- }
-
- /**
- * Trigger before retrieving a workflow
- *
- * @param workflowId Workflow id
- * @throws WorkflowException
- */
- @Override
- public void doPreGetWorkflow(String workflowId) throws WorkflowException {
-
- }
-
- /**
- * Trigger after retrieving a workflow
- *
- * @param workflowId Workflow id
- * @param result Workflow returned by original operation.
- * @throws WorkflowException
- */
- @Override
- public void doPostGetWorkflow(String workflowId, Workflow result) throws WorkflowException {
-
- }
-
- /**
- * Trigger before retrieving parameters of a workflow
- *
- * @param workflowId Workflow id
- * @throws WorkflowException
- */
- @Override
- public void doPreGetWorkflowParameters(String workflowId) throws WorkflowException {
-
- }
-
- /**
- * Trigger after retrieving parameters of a workflow
- *
- * @param workflowId Workflow id
- * @param result Workflow parameter list returned by original method
- * @throws WorkflowException
- */
- @Override
- public void doPostGetWorkflowParameters(String workflowId, List result) throws WorkflowException {
-
- }
-
- /**
- * Trigger before adding a 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
- */
- @Override
- public void doPreAddAssociation(String associationName, String workflowId, String eventId, String condition)
- throws WorkflowException {
-
- }
-
- /**
- * Trigger after adding a 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
- */
- @Override
- public void doPostAddAssociation(String associationName, String workflowId, String eventId, String condition)
- throws WorkflowException {
-
- }
-
- /**
- * Trigger before listing workflows of a tenant.
- *
- * @param tenantId Tenant ID
- * @param limit Limit
- * @param offset Offset
- * @param filter Filter
- * @throws WorkflowException
- */
- @Override
- public void doPreListPaginatedWorkflows(int tenantId, int limit, int offset, String filter) throws WorkflowException{
-
- }
-
- /**
- * Trigger after listing workflows of a tenant.
- *
- * @param tenantId Tenant ID
- * @param limit Limit
- * @param offset Offset
- * @param filter Filter
- * @param result List of workflows returned by original method.
- * @throws WorkflowException
- */
- @Override
- public void doPostListPaginatedWorkflows(int tenantId, int limit, int offset, String filter, List result) throws WorkflowException{
-
- }
-
- /**
- * Trigger before listing workflows of a tenant
- *
- * @deprecated Use {@link #doPreListPaginatedWorkflows(int, int, int, String)} instead.
- * @param tenantId Tenant ID
- * @throws WorkflowException
- */
- @Deprecated
- @Override
- public void doPreListWorkflows(int tenantId) throws WorkflowException {
-
- }
-
- /**
- * Trigger after listing workflows of a tenant
- *
- * @deprecated Use {@link #doPostListPaginatedWorkflows(int, int, int, String, List)} instead.
- * @param tenantId Tenant ID
- * @param result List of workflows returned by original method.
- * @throws WorkflowException
- */
- @Deprecated
- @Override
- public void doPostListWorkflows(int tenantId, List result) throws WorkflowException {
-
- }
-
- /**
- * Trigger before removing an association.
- *
- * @param associationId ID of association to remove
- * @throws WorkflowException
- */
- @Override
- public void doPreRemoveAssociation(int associationId) throws WorkflowException {
-
- }
-
- /**
- * Trigger after removing an association.
- *
- * @param associationId ID of association to remove
- * @throws WorkflowException
- */
- @Override
- public void doPostRemoveAssociation(int associationId) throws WorkflowException {
-
- }
-
- /**
- * Trigger before getting associations of a workflow
- *
- * @param workflowId Workflow ID
- * @throws WorkflowException
- */
- @Override
- public void doPreGetAssociationsForWorkflow(String workflowId) throws WorkflowException {
-
- }
-
- /**
- * Trigger before getting associations of a workflow
- *
- * @param workflowId Workflow ID
- * @param result Result of the original operation
- * @throws WorkflowException
- */
- @Override
- public void doPostGetAssociationsForWorkflow(String workflowId, List result) throws WorkflowException {
-
- }
-
- /**
- * Trigger before listing associations of a tenant.
- *
- * @param tenantId Tenant ID
- * @param limit Limit
- * @param offset Offset
- * @param filter Filter
- * @throws WorkflowException
- */
- @Override
- public void doPreListPaginatedAssociations(int tenantId, int limit, int offset, String filter){
-
- }
-
- /**
- * Trigger after listing associations of a tenant.
- *
- * @param tenantId Tenant ID
- * @param limit Limit
- * @param offset Offset
- * @param filter Filter
- * @param result Result of the original operation
- * @throws WorkflowException
- */
- @Override
- public void doPostListPaginatedAssociations(int tenantId, int limit, int offset, String filter, List result){
-
- }
-
- /**
- * Trigger before listing all associations
- *
- * @deprecated Use {@link #doPreListPaginatedAssociations(int, int, int, String)} instead.
- * @param tenantId Tenant ID
- * @throws WorkflowException
- */
- @Deprecated
- @Override
- public void doPreListAllAssociations(int tenantId) throws WorkflowException {
-
- }
-
- /**
- * Trigger after listing all associations
- *
- * @deprecated Use {@link #doPostListPaginatedAssociations(int, int, int, String, List)} instead.
- * @param tenantId Tenant ID
- * @param result Result of the original operation
- * @throws WorkflowException
- */
- @Deprecated
- @Override
- public void doPostListAllAssociations(int tenantId, List result) throws WorkflowException {
-
- }
-
- /**
- * Trigger before changing state of an association
- *
- * @param associationId Association ID
- * @param isEnable New state
- * @throws WorkflowException
- */
- @Override
- public void doPreChangeAssociationState(String associationId, boolean isEnable) throws WorkflowException {
-
- }
-
- /**
- * Trigger after changing state of an association
- *
- * @param associationId Association ID
- * @param isEnable New state
- * @throws WorkflowException
- */
- @Override
- public void doPostChangeAssociationState(String associationId, boolean isEnable) throws WorkflowException {
-
- }
-
- /**
- * Trigger before addEntityRequestEntityRelationships
- *
- * @param requestId Request ID
- * @param entities Entity list
- * @throws WorkflowException
- */
- @Override
- public void doPreAddRequestEntityRelationships(String requestId, Entity[] entities) throws WorkflowException {
-
- }
-
- /**
- * Trigger after addEntityRequestEntityRelationships
- *
- * @param requestId Request ID
- * @param entities Entity list @throws WorkflowException
- */
- @Override
- public void doPostAddRequestEntityRelationships(String requestId, Entity[] entities) throws WorkflowException {
-
- }
-
- /**
- * Trigger before checking if entity has pending workflows
- *
- * @param entity Entity object to test
- * @throws WorkflowException
- */
- @Override
- public void doPreEntityHasPendingWorkflows(Entity entity) throws WorkflowException {
-
- }
-
- /**
- * Trigger after checking if entity has pending workflows
- *
- * @param entity Entity object to test
- * @throws WorkflowException
- */
- @Override
- public void doPostEntityHasPendingWorkflows(Entity entity) throws WorkflowException {
-
- }
-
- /**
- * Trigger before checking if an entity has pending relationships of a given type
- *
- * @param entity Entity object to test
- * @param requestType Type of request, eg:- Add user
- * @throws WorkflowException
- */
- @Override
- public void doPreEntityHasPendingWorkflowsOfType(Entity entity, String requestType) throws WorkflowException {
-
- }
-
- /**
- * Trigger after checking if an entity has pending relationships of a given type
- *
- * @param entity Entity object to test
- * @param requestType Type of request, eg:- Add user
- * @throws WorkflowException
- */
- @Override
- public void doPostEntityHasPendingWorkflowsOfType(Entity entity, String requestType) throws WorkflowException {
-
- }
-
- /**
- * Trigger before checking if two entities are related
- *
- * @param entity1 first entity object to test
- * @param entity2 second entity object to test
- * @throws WorkflowException
- */
- @Override
- public void doPreAreTwoEntitiesRelated(Entity entity1, Entity entity2) throws WorkflowException {
-
- }
-
- /**
- * Trigger after checking if two entities are related
- *
- * @param entity1 first entity object to test
- * @param entity2 second entity object to test
- * @throws WorkflowException
- */
- @Override
- public void doPostAreTwoEntitiesRelated(Entity entity1, Entity entity2) throws WorkflowException {
-
- }
-
- /**
- * Trigger before checking if event is associated with a workflow
- *
- * @param eventType event type to check
- * @throws WorkflowException
- */
- @Override
- public void doPreIsEventAssociated(String eventType) throws WorkflowException {
-
- }
-
- /**
- * Trigger after checking if event is associated with a workflow
- *
- * @param eventType event type to check
- * @throws WorkflowException
- */
- @Override
- public void doPostIsEventAssociated(String eventType) throws WorkflowException {
-
- }
-
- /**
- * Trigger before retrieving requests created by user
- *
- * @param user User name
- * @param tenantId tenant ID
- * @throws WorkflowException
- */
- @Override
- public void doPreGetRequestsCreatedByUser(String user, int tenantId) throws WorkflowException {
-
- }
-
- /**
- * Trigger after retrieving requests created by user
- *
- * @param user User name
- * @param tenantId tenant ID
- * @param results Results returned by original operation
- * @throws WorkflowException
- */
- @Override
- public void doPostGetRequestsCreatedByUser(String user, int tenantId, WorkflowRequest[] results) throws
- WorkflowException {
-
- }
-
- /**
- * Trigger before retrieving workflows of request
- *
- * @param requestId Request ID of request to get workflows of
- * @throws WorkflowException
- */
- @Override
- public void doPreGetWorkflowsOfRequest(String requestId) throws WorkflowException {
-
- }
-
- /**
- * Trigger after retrieving workflows of request
- *
- * @param requestId Request ID of request to get workflows of
- * @param results Results returned by original request
- * @throws WorkflowException
- */
- @Override
- public void doPostGetWorkflowsOfRequest(String requestId, WorkflowRequestAssociation[] results) throws
- WorkflowException {
-
- }
-
- /**
- * @param user
- * @param beginDate
- * @param endDate
- * @param dateCategory
- * @param tenantId
- * @param status
- * @throws WorkflowException
- */
- @Override
- public void doPreGetRequestsFromFilter(String user, String beginDate, String endDate, String dateCategory, int
- tenantId, String status) throws WorkflowException {
-
- }
-
- /**
- * @param user
- * @param beginDate
- * @param endDate
- * @param dateCategory
- * @param tenantId
- * @param status
- * @param result
- * @throws WorkflowException
- */
- @Override
- public void doPostGetRequestsFromFilter(String user, String beginDate, String endDate, String dateCategory, int
- tenantId, String status, WorkflowRequest[] result) throws WorkflowException {
-
- }
-
- /**
- * @param wfOperationType
- * @param wfStatus
- * @param entityType
- * @param tenantID
- * @param idFilter
- * @throws WorkflowException
- */
- @Override
- public void doPreListEntityNames(String wfOperationType, String wfStatus, String entityType, int tenantID, String
- idFilter) throws WorkflowException {
-
- }
-
- /**
- * @param wfOperationType
- * @param wfStatus
- * @param entityType
- * @param tenantID
- * @param idFilter
- * @param result
- * @throws WorkflowException
- */
- @Override
- public void doPostListEntityNames(String wfOperationType, String wfStatus, String entityType, int tenantID,
- String idFilter, List result) throws WorkflowException {
-
- }
-
- /**
- * Check if listener is enabled or not.
- *
- * @return
- */
- public boolean isEnable() {
- IdentityEventListenerConfig workflowListener = IdentityUtil.readEventListenerProperty
- (WorkflowListener.class.getName(), this.getClass().getName());
-
- if (workflowListener == null) {
- return true;
- }
-
- if (StringUtils.isNotBlank(workflowListener.getEnable())) {
- return Boolean.parseBoolean(workflowListener.getEnable());
- } else {
- return true;
- }
- }
-
- /**
- * get order ID (priority of current listener)
- *
- * @return
- */
- public int getOrderId() {
- IdentityEventListenerConfig workflowListener = IdentityUtil.readEventListenerProperty
- (WorkflowListener.class.getName(), this.getClass().getName());
- if (workflowListener == null) {
- return IdentityCoreConstants.EVENT_LISTENER_ORDER_ID;
- }
- return workflowListener.getOrder();
- }
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/listener/WorkflowAuditLogger.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/listener/WorkflowAuditLogger.java
deleted file mode 100644
index d6616060ffcb..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/listener/WorkflowAuditLogger.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.listener;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.logging.Log;
-import org.wso2.carbon.CarbonConstants;
-import org.wso2.carbon.context.PrivilegedCarbonContext;
-import org.wso2.carbon.identity.central.log.mgt.utils.LoggerUtils;
-import org.wso2.carbon.identity.core.util.IdentityUtil;
-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.bean.WorkflowRequest;
-import org.wso2.carbon.identity.workflow.mgt.exception.WorkflowException;
-import org.wso2.carbon.user.core.util.UserCoreUtil;
-
-import java.util.List;
-
-public class WorkflowAuditLogger extends AbstractWorkflowListener {
-
- private static final Log AUDIT_LOG = CarbonConstants.AUDIT_LOG;
- private static final String AUDIT_MESSAGE = "Initiator : %s | Action : %s | Data : { %s } | Result : %s ";
- private static final String AUDIT_SUCCESS = "Success";
-
- /**
- * Trigger after deleting the request
- *
- * @param workflowRequest
- * @throws WorkflowException
- */
- @Override
- public void doPostDeleteWorkflowRequest(WorkflowRequest workflowRequest) throws WorkflowException {
- String loggedInUser = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
- if (StringUtils.isBlank(loggedInUser)) {
- loggedInUser = CarbonConstants.REGISTRY_SYSTEM_USERNAME;
- }
-
- String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
- loggedInUser = getInitiatorForLog(loggedInUser, tenantDomain);
-
- String auditData = "\"" + "Request ID" + "\" : \"" + workflowRequest.getRequestId() + "\"";
- AUDIT_LOG.info(String.format(AUDIT_MESSAGE, loggedInUser, "Remove workflow request", auditData,
- AUDIT_SUCCESS));
- }
-
- /**
- * Trigger after delete the workflow
- *
- * @param workflow
- * @throws WorkflowException
- */
- @Override
- public void doPostDeleteWorkflow(Workflow workflow) throws WorkflowException {
- String loggedInUser = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
- if (StringUtils.isBlank(loggedInUser)) {
- loggedInUser = CarbonConstants.REGISTRY_SYSTEM_USERNAME;
- }
-
- String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
- loggedInUser = getInitiatorForLog(loggedInUser, tenantDomain);
-
- String auditData = "\"" + "Workflow ID" + "\" : \"" + workflow.getWorkflowId() + "\"";
- AUDIT_LOG.info(String.format(AUDIT_MESSAGE, loggedInUser, "Remove workflow", auditData, AUDIT_SUCCESS));
- }
-
- /**
- * Trigger after deleting workflows by tenant id.
- *
- * @param tenantId The id of the tenant.
- * @throws WorkflowException
- */
- @Override
- public void doPostDeleteWorkflows(int tenantId) throws WorkflowException {
-
- String loggedInUser = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
- if (StringUtils.isBlank(loggedInUser)) {
- loggedInUser = CarbonConstants.REGISTRY_SYSTEM_USERNAME;
- }
-
- String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
- loggedInUser = getInitiatorForLog(loggedInUser, tenantDomain);
-
- String auditData = "\"" + "Tenant ID" + "\" : \"" + tenantId + "\"";
- AUDIT_LOG.info(String.format(AUDIT_MESSAGE, loggedInUser, "Remove all workflows of a tenant", auditData,
- AUDIT_SUCCESS));
- }
-
- /**
- * Trigger after adding a workflow
- *
- * @param workflowDTO
- * @param parameterList
- * @param tenantId
- * @throws WorkflowException
- */
- @Override
- public void doPostAddWorkflow(Workflow workflowDTO, List parameterList, int tenantId) throws
- WorkflowException {
- String loggedInUser = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
- if (StringUtils.isBlank(loggedInUser)) {
- loggedInUser = CarbonConstants.REGISTRY_SYSTEM_USERNAME;
- }
-
- String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
- loggedInUser = getInitiatorForLog(loggedInUser, tenantDomain);
-
- String auditData = "\"" + "Workflow Name" + "\" : \"" + workflowDTO.getWorkflowName() + "\",\""
- + "Workflow Impl ID" + "\" : \"" + workflowDTO.getWorkflowImplId() + "\",\""
- + "Workflow ID" + "\" : \"" + workflowDTO.getWorkflowId() + "\",\""
- + "Workflow Description" + "\" : \"" + workflowDTO.getWorkflowDescription() + "\",\""
- + "Template ID" + "\" : \"" + workflowDTO.getTemplateId() + "\"";
- AUDIT_LOG.info(String.format(AUDIT_MESSAGE, loggedInUser, "Add Workflow", auditData, AUDIT_SUCCESS));
- }
-
- /**
- * Trigger after adding a association
- *
- * @param associationName
- * @param workflowId
- * @param eventId
- * @param condition
- * @throws WorkflowException
- */
- @Override
- public void doPostAddAssociation(String associationName, String workflowId, String eventId, String condition)
- throws WorkflowException {
- String loggedInUser = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
- if (StringUtils.isBlank(loggedInUser)) {
- loggedInUser = CarbonConstants.REGISTRY_SYSTEM_USERNAME;
- }
-
- String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
- loggedInUser = getInitiatorForLog(loggedInUser, tenantDomain);
-
- String auditData = "\"" + "Association Name" + "\" : \"" + associationName + "\",\""
- + "Workflow ID" + "\" : \"" + workflowId + "\",\""
- + "Event ID" + "\" : \"" + eventId + "\",\""
- + "Condition" + "\" : \"" + condition + "\"";
- AUDIT_LOG.info(String.format(AUDIT_MESSAGE, loggedInUser, "Add Association", auditData, AUDIT_SUCCESS));
- }
-
- /**
- * Trigger after removing an association.
- *
- * @param associationId
- * @throws WorkflowException
- */
- @Override
- public void doPostRemoveAssociation(int associationId) throws WorkflowException {
- String loggedInUser = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
- if (StringUtils.isBlank(loggedInUser)) {
- loggedInUser = CarbonConstants.REGISTRY_SYSTEM_USERNAME;
- }
-
- String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
- loggedInUser = getInitiatorForLog(loggedInUser, tenantDomain);
-
- String auditData = "\"" + "Association ID" + "\" : \"" + associationId + "\"";
- AUDIT_LOG.info(String.format(AUDIT_MESSAGE, loggedInUser, "Remove Association", auditData, AUDIT_SUCCESS));
- }
-
- /**
- * Trigger after changing state of an association
- *
- * @param associationId
- * @param isEnable
- * @throws WorkflowException
- */
- @Override
- public void doPostChangeAssociationState(String associationId, boolean isEnable) throws WorkflowException {
- String loggedInUser = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
- if (StringUtils.isBlank(loggedInUser)) {
- loggedInUser = CarbonConstants.REGISTRY_SYSTEM_USERNAME;
- }
-
- String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
- loggedInUser = getInitiatorForLog(loggedInUser, tenantDomain);
-
- String auditData = "\"" + "Association ID" + "\" : \"" + associationId + "\",\""
- + "Resulting State" + "\" : \"" + isEnable + "\"";
- AUDIT_LOG.info(String.format(AUDIT_MESSAGE, loggedInUser, "Change Association State", auditData,
- AUDIT_SUCCESS));
- }
-
- /**
- * Get the initiator for audit logs.
- *
- * @param username Username of the initiator.
- * @param tenantDomain Tenant domain of the initiator.
- *
- * @return initiator for the log.
- */
- private String getInitiatorForLog(String username, String tenantDomain) {
-
- if (!LoggerUtils.isLogMaskingEnable) {
- // Append tenant domain to username.
- return UserCoreUtil.addTenantDomainToEntry(username, tenantDomain);
- }
- if (StringUtils.isNotBlank(username) && StringUtils.isNotBlank(tenantDomain)) {
- String initiator = IdentityUtil.getInitiatorId(username, tenantDomain);
- if (StringUtils.isNotBlank(initiator)) {
- return initiator;
- }
- }
- return LoggerUtils.getMaskedContent(username);
- }
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/listener/WorkflowExecutorAuditLogger.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/listener/WorkflowExecutorAuditLogger.java
deleted file mode 100644
index 4bfb8a498f04..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/listener/WorkflowExecutorAuditLogger.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.listener;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.logging.Log;
-import org.wso2.carbon.CarbonConstants;
-import org.wso2.carbon.context.PrivilegedCarbonContext;
-import org.wso2.carbon.identity.central.log.mgt.utils.LoggerUtils;
-import org.wso2.carbon.identity.core.util.IdentityUtil;
-import org.wso2.carbon.identity.workflow.mgt.WorkflowExecutorResult;
-import org.wso2.carbon.identity.workflow.mgt.dto.WorkflowRequest;
-import org.wso2.carbon.identity.workflow.mgt.exception.WorkflowException;
-import org.wso2.carbon.user.core.util.UserCoreUtil;
-
-import java.util.Map;
-
-public class WorkflowExecutorAuditLogger extends AbstractWorkflowExecutorManagerListener{
-
- private static final Log AUDIT_LOG = CarbonConstants.AUDIT_LOG;
- private static final String AUDIT_MESSAGE = "Initiator : %s | Action : %s | Data : { %s } | Result " +
- ": %s ";
- private static final String AUDIT_SUCCESS = "Success";
-
- /**
- * Trigger after executing a workflow request
- *
- * @param workFlowRequest
- * @throws WorkflowException
- */
- @Override
- public void doPostExecuteWorkflow(WorkflowRequest workFlowRequest, WorkflowExecutorResult result) throws
- WorkflowException {
- String loggedInUser = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
- if (StringUtils.isBlank(loggedInUser)) {
- loggedInUser = CarbonConstants.REGISTRY_SYSTEM_USERNAME;
- }
-
- String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
- loggedInUser = getInitiatorForLog(loggedInUser, tenantDomain);
-
- String auditData = "\"" + "Operation Type" + "\" : \"" + workFlowRequest.getEventType()
- + "\",\"" + "Request parameters" + "\" : \"" + workFlowRequest.getRequestParameterAsString()
- + "\"";
- AUDIT_LOG.info(String.format(AUDIT_MESSAGE, loggedInUser, "Initiate Workflow", auditData,
- AUDIT_SUCCESS));
- }
-
- /**
- * Trigger after handling a callback
- *
- * @param uuid
- * @param status
- * @param additionalParams
- * @throws WorkflowException
- */
- @Override
- public void doPostHandleCallback(String uuid, String status, Map additionalParams) throws WorkflowException {
- String loggedInUser = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
- if (StringUtils.isBlank(loggedInUser)) {
- loggedInUser = CarbonConstants.REGISTRY_SYSTEM_USERNAME;
- }
-
- String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
- loggedInUser = getInitiatorForLog(loggedInUser, tenantDomain);
-
- String auditData = "\"" + "Request ID" + "\" : \"" + uuid
- + "\",\"" + "Callback Status" + "\" : \"" + status
- + "\"";
- AUDIT_LOG.info(String.format(AUDIT_MESSAGE, loggedInUser, "Callback for Workflow Request", auditData,
- AUDIT_SUCCESS));
- }
-
- /**
- * Get the initiator for audit logs.
- *
- * @param username Username of the initiator.
- * @param tenantDomain Tenant domain of the initiator.
- *
- * @return initiator for the log.
- */
- private String getInitiatorForLog(String username, String tenantDomain) {
-
- if (!LoggerUtils.isLogMaskingEnable) {
- // Append tenant domain to username.
- return UserCoreUtil.addTenantDomainToEntry(username, tenantDomain);
- }
- if (StringUtils.isNotBlank(username) && StringUtils.isNotBlank(tenantDomain)) {
- String initiator = IdentityUtil.getInitiatorId(username, tenantDomain);
- if (StringUtils.isNotBlank(initiator)) {
- return initiator;
- }
- }
- return LoggerUtils.getMaskedContent(username);
- }
-}
diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/listener/WorkflowExecutorManagerListener.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/listener/WorkflowExecutorManagerListener.java
deleted file mode 100644
index e58f97cf8397..000000000000
--- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/listener/WorkflowExecutorManagerListener.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.workflow.mgt.listener;
-
-import org.wso2.carbon.identity.workflow.mgt.WorkflowExecutorResult;
-import org.wso2.carbon.identity.workflow.mgt.dto.WorkflowRequest;
-import org.wso2.carbon.identity.workflow.mgt.exception.WorkflowException;
-
-import java.util.Map;
-
-public interface WorkflowExecutorManagerListener {
-
- /**
- * Trigger before executing a workflow request
- *
- * @param workFlowRequest Details of request to execute
- * @throws WorkflowException
- */
- void doPreExecuteWorkflow(WorkflowRequest workFlowRequest) throws WorkflowException;
-
- /**
- * Trigger after executing a workflow request
- *
- * @param workFlowRequest Details of request to execute
- * @param result Result of the original operation
- * @throws WorkflowException
- */
- void doPostExecuteWorkflow(WorkflowRequest workFlowRequest, WorkflowExecutorResult result) throws WorkflowException;
-
- /**
- * Trigger before handling a callback
- *
- * @param uuid UUID to request which callback received
- * @param status Status of call back
- * @param additionalParams Additional parameters required to execute request
- * @throws WorkflowException
- */
- void doPreHandleCallback(String uuid, String status, Map additionalParams)
- throws WorkflowException;
-
- /**
- * Trigger after handling a callback
- *
- * @param uuid UUID to request which callback received
- * @param status Status of call back
- * @param additionalParams Additional parameters required to execute request
- * @throws WorkflowException
- */
- void doPostHandleCallback(String uuid, String status, Map