From 1d427aef73e8329f7e4bf1d555fddb62adbd45fd Mon Sep 17 00:00:00 2001 From: geethkokila Date: Mon, 13 Aug 2018 14:55:00 +0530 Subject: [PATCH] Fix https://github.com/wso2/product-iots/issues/1852 --- .../mgt/common/operation/mgt/Activity.java | 15 +++++++++++++++ .../mgt/common/operation/mgt/Operation.java | 14 ++++++++++++++ .../mgt/core/dto/operation/mgt/Operation.java | 8 ++++++++ .../operation/mgt/OperationManagerImpl.java | 16 +++++++++++++++- .../mgt/dao/impl/GenericOperationDAOImpl.java | 19 +++++++++++++------ .../impl/operation/MySQLOperationDAOImpl.java | 8 +++++++- .../src/test/resources/sql/h2.sql | 1 + .../src/test/resources/sql/CreateH2TestDB.sql | 1 + .../src/main/resources/dbscripts/cdm/h2.sql | 1 + .../main/resources/dbscripts/cdm/mssql.sql | 1 + .../main/resources/dbscripts/cdm/mysql.sql | 1 + .../main/resources/dbscripts/cdm/oracle.sql | 1 + .../resources/dbscripts/cdm/postgresql.sql | 3 ++- 13 files changed, 80 insertions(+), 9 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/operation/mgt/Activity.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/operation/mgt/Activity.java index e7d01bd5c4..3b4436fb02 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/operation/mgt/Activity.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/operation/mgt/Activity.java @@ -73,6 +73,13 @@ public class Activity { @JsonProperty("activityStatuses") private List activityStatus; + @ApiModelProperty( + name = "initiatedBy", + value = "Initiated user", + required = true) + @JsonProperty("initiatedBy") + private String initiatedBy; + public String getActivityId() { return activityId; } @@ -112,5 +119,13 @@ public class Activity { public void setActivityStatus(List activityStatus) { this.activityStatus = activityStatus; } + + public String getInitiatedBy() { + return initiatedBy; + } + + public void setInitiatedBy(String initiatedBy) { + this.initiatedBy = initiatedBy; + } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/operation/mgt/Operation.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/operation/mgt/Operation.java index 6add610c78..7e3b2fe7c6 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/operation/mgt/Operation.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/operation/mgt/Operation.java @@ -90,6 +90,12 @@ public class Operation implements Serializable { @ApiModelProperty(name = "activityId", value = "The identifier used to identify the operation uniquely.", required = true) private String activityId; + + @ApiModelProperty(name = "initiatedBy", value = "This identifies the person whom operation initiated. This could be " + + "EMM server or the one who initiated the API call to add an operation.", + required = true) + private String initiatedBy; + private List responses; @Override @@ -267,6 +273,14 @@ public class Operation implements Serializable { this.responses = responses; } + public String getInitiatedBy() { + return initiatedBy; + } + + public void setInitiatedBy(String initiatedBy) { + this.initiatedBy = initiatedBy; + } + @Override public String toString() { return "Operation{" + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dto/operation/mgt/Operation.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dto/operation/mgt/Operation.java index 3b5322bbf7..1b34b5d02b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dto/operation/mgt/Operation.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dto/operation/mgt/Operation.java @@ -51,6 +51,7 @@ public class Operation implements Serializable { private Object payLoad; private Object operationResponse; private String activityId; + private String initiatedBy; public String getCode() { return code; @@ -148,4 +149,11 @@ public class Operation implements Serializable { this.activityId = activityId; } + public String getInitiatedBy() { + return initiatedBy; + } + + public void setInitiatedBy(String initiatedBy) { + this.initiatedBy = initiatedBy; + } } \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java index d45fb2dead..78d393b048 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java @@ -82,6 +82,7 @@ public class OperationManagerImpl implements OperationManager { private static final Log log = LogFactory.getLog(OperationManagerImpl.class); private static final int CACHE_VALIDITY_PERIOD = 5 * 60 * 1000; private static final String NOTIFIER_TYPE_LOCAL = "LOCAL"; + private static final String SYSTEM = "system"; private OperationDAO commandOperationDAO; private OperationDAO configOperationDAO; @@ -171,11 +172,24 @@ public class OperationManagerImpl implements OperationManager { return activity; } + boolean isScheduledOperation = this.isTaskScheduledOperation(operation); + String initiatedBy = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername(); + if (initiatedBy == null && isScheduledOperation) { + if(log.isDebugEnabled()) { + log.debug("initiatedBy : " + SYSTEM); + } + operation.setInitiatedBy(SYSTEM); + } else { + if(log.isDebugEnabled()) { + log.debug("initiatedBy : " + initiatedBy); + } + operation.setInitiatedBy(initiatedBy); + } + OperationManagementDAOFactory.beginTransaction(); org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation operationDto = OperationDAOUtil.convertOperation(operation); int operationId = this.lookupOperationDAO(operation).addOperation(operationDto); - boolean isScheduledOperation = this.isTaskScheduledOperation(operation); boolean isNotRepeated = false; boolean isScheduled = false; NotificationStrategy notificationStrategy = getNotificationStrategy(); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java index 6c7225b80d..0078ce11d7 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java @@ -63,13 +63,14 @@ public class GenericOperationDAOImpl implements OperationDAO { ResultSet rs = null; try { Connection connection = OperationManagementDAOFactory.getConnection(); - String sql = "INSERT INTO DM_OPERATION(TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE) " + - "VALUES (?, ?, ?, ?)"; + String sql = "INSERT INTO DM_OPERATION(TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE, " + + "INITIATED_BY) VALUES (?, ?, ?, ?, ?)"; stmt = connection.prepareStatement(sql, new String[]{"id"}); stmt.setString(1, operation.getType().toString()); stmt.setTimestamp(2, new Timestamp(new Date().getTime())); stmt.setTimestamp(3, null); stmt.setString(4, operation.getCode()); + stmt.setString(5, operation.getInitiatedBy()); stmt.executeUpdate(); rs = stmt.getGeneratedKeys(); @@ -245,7 +246,7 @@ public class GenericOperationDAOImpl implements OperationDAO { "de.DEVICE_ID, d.DEVICE_IDENTIFICATION, \n" + "d.DEVICE_TYPE_ID, dt.NAME AS DEVICE_TYPE_NAME, eom.STATUS, eom.CREATED_TIMESTAMP, \n" + "eom.UPDATED_TIMESTAMP, op.OPERATION_CODE, op.TYPE AS OPERATION_TYPE, dor.OPERATION_RESPONSE, \n" + - "dor.RECEIVED_TIMESTAMP FROM DM_ENROLMENT_OP_MAPPING eom \n" + + "dor.RECEIVED_TIMESTAMP, op.INITIATED_BY FROM DM_ENROLMENT_OP_MAPPING eom \n" + "INNER JOIN DM_OPERATION op ON op.ID=eom.OPERATION_ID\n" + "INNER JOIN DM_ENROLMENT de ON de.ID=eom.ENROLMENT_ID\n" + "INNER JOIN DM_DEVICE d ON d.ID=de.DEVICE_ID \n" + @@ -268,6 +269,7 @@ public class GenericOperationDAOImpl implements OperationDAO { activity.setType(Activity.Type.valueOf(rs.getString("OPERATION_TYPE"))); activity.setCreatedTimeStamp(new java.util.Date(rs.getLong(("CREATED_TIMESTAMP")) * 1000).toString()); activity.setCode(rs.getString("OPERATION_CODE")); + activity.setInitiatedBy(rs.getString("INITIATED_BY")); } if (enrolmentId != rs.getInt("ENROLMENT_ID")) { activityStatus = new ActivityStatus(); @@ -325,7 +327,7 @@ public class GenericOperationDAOImpl implements OperationDAO { + "dor.ID AS OP_RES_ID, de.DEVICE_ID, d.DEVICE_IDENTIFICATION, d.DEVICE_TYPE_ID, " + "dt.NAME AS DEVICE_TYPE_NAME, eom.STATUS, eom.CREATED_TIMESTAMP, " + "eom.UPDATED_TIMESTAMP, op.OPERATION_CODE, op.TYPE AS OPERATION_TYPE, " - + "dor.OPERATION_RESPONSE, dor.RECEIVED_TIMESTAMP FROM " + + "dor.OPERATION_RESPONSE, op.INITIATED_BY, dor.RECEIVED_TIMESTAMP FROM " + "DM_ENROLMENT_OP_MAPPING eom INNER JOIN DM_OPERATION op " + "ON op.ID=eom.OPERATION_ID INNER JOIN DM_ENROLMENT de " + "ON de.ID=eom.ENROLMENT_ID INNER JOIN DM_DEVICE d ON d.ID=de.DEVICE_ID \n" @@ -359,6 +361,7 @@ public class GenericOperationDAOImpl implements OperationDAO { activity.setCreatedTimeStamp( new java.util.Date(rs.getLong(("CREATED_TIMESTAMP")) * 1000).toString()); activity.setCode(rs.getString("OPERATION_CODE")); + activity.setInitiatedBy(rs.getString("INITIATED_BY")); DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); deviceIdentifier.setId(rs.getString("DEVICE_IDENTIFICATION")); @@ -448,7 +451,7 @@ public class GenericOperationDAOImpl implements OperationDAO { "de.DEVICE_ID, d.DEVICE_IDENTIFICATION, \n" + "d.DEVICE_TYPE_ID, dt.NAME AS DEVICE_TYPE_NAME, eom.STATUS, eom.CREATED_TIMESTAMP, \n" + "eom.UPDATED_TIMESTAMP, op.OPERATION_CODE, op.TYPE AS OPERATION_TYPE, dor.OPERATION_RESPONSE, \n" + - "dor.RECEIVED_TIMESTAMP FROM DM_ENROLMENT_OP_MAPPING AS eom \n" + + "dor.RECEIVED_TIMESTAMP, op.INITIATED_BY FROM DM_ENROLMENT_OP_MAPPING AS eom \n" + "INNER JOIN DM_OPERATION AS op ON op.ID=eom.OPERATION_ID\n" + "INNER JOIN DM_ENROLMENT AS de ON de.ID=eom.ENROLMENT_ID\n" + "INNER JOIN DM_DEVICE AS d ON d.ID=de.DEVICE_ID \n" + @@ -472,6 +475,7 @@ public class GenericOperationDAOImpl implements OperationDAO { activity.setType(Activity.Type.valueOf(rs.getString("OPERATION_TYPE"))); activity.setCreatedTimeStamp(new java.util.Date(rs.getLong(("CREATED_TIMESTAMP")) * 1000).toString()); activity.setCode(rs.getString("OPERATION_CODE")); + activity.setInitiatedBy(rs.getString("INITIATED_BY")); } if (enrolmentId != rs.getInt("ENROLMENT_ID")) { activityStatus = new ActivityStatus(); @@ -535,7 +539,8 @@ public class GenericOperationDAOImpl implements OperationDAO { " opr.DEVICE_TYPE, " + " ops.RECEIVED_TIMESTAMP, " + " ops.ID OP_RES_ID, " + - " ops.OPERATION_RESPONSE " + + " ops.OPERATION_RESPONSE, " + + " opr.INITIATED_BY " + " FROM " + " (SELECT " + " opm.ID MAPPING_ID, " + @@ -544,6 +549,7 @@ public class GenericOperationDAOImpl implements OperationDAO { " opm.UPDATED_TIMESTAMP, " + " opm.OPERATION_ID, " + " op.OPERATION_CODE, " + + " op.INITIATED_BY, " + " op.TYPE OPERATION_TYPE, " + " opm.STATUS, " + " en.DEVICE_ID, " + @@ -595,6 +601,7 @@ public class GenericOperationDAOImpl implements OperationDAO { activity.setType(Activity.Type.valueOf(rs.getString("OPERATION_TYPE"))); activity.setCreatedTimeStamp(new java.util.Date(rs.getLong(("CREATED_TIMESTAMP")) * 1000).toString()); activity.setCode(rs.getString("OPERATION_CODE")); + activity.setInitiatedBy(rs.getString("INITIATED_BY")); DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); deviceIdentifier.setId(rs.getString("DEVICE_IDENTIFICATION")); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/operation/MySQLOperationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/operation/MySQLOperationDAOImpl.java index a197769c26..23377c695c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/operation/MySQLOperationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/operation/MySQLOperationDAOImpl.java @@ -91,7 +91,7 @@ public class MySQLOperationDAOImpl extends GenericOperationDAOImpl { + "dor.ID AS OP_RES_ID, de.DEVICE_ID, d.DEVICE_IDENTIFICATION, d.DEVICE_TYPE_ID, " + "dt.NAME AS DEVICE_TYPE_NAME, eom.STATUS, eom.CREATED_TIMESTAMP, " + "eom.UPDATED_TIMESTAMP, op.OPERATION_CODE, op.TYPE AS OPERATION_TYPE, " - + "dor.OPERATION_RESPONSE, dor.RECEIVED_TIMESTAMP FROM " + + "dor.OPERATION_RESPONSE, dor.RECEIVED_TIMESTAMP, op.INITIATED_BY FROM " + "DM_ENROLMENT_OP_MAPPING eom INNER JOIN DM_OPERATION op " + "ON op.ID=eom.OPERATION_ID INNER JOIN DM_ENROLMENT de " + "ON de.ID=eom.ENROLMENT_ID INNER JOIN DM_DEVICE d ON d.ID=de.DEVICE_ID \n" @@ -132,6 +132,7 @@ public class MySQLOperationDAOImpl extends GenericOperationDAOImpl { activity.setCreatedTimeStamp( new java.util.Date(rs.getLong(("CREATED_TIMESTAMP")) * 1000).toString()); activity.setCode(rs.getString("OPERATION_CODE")); + activity.setInitiatedBy(rs.getString("INITIATED_BY")); DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); deviceIdentifier.setId(rs.getString("DEVICE_IDENTIFICATION")); @@ -164,6 +165,7 @@ public class MySQLOperationDAOImpl extends GenericOperationDAOImpl { activity.setCreatedTimeStamp( new java.util.Date(rs.getLong(("CREATED_TIMESTAMP")) * 1000).toString()); activity.setCode(rs.getString("OPERATION_CODE")); + activity.setInitiatedBy(rs.getString("INITIATED_BY")); DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); deviceIdentifier.setId(rs.getString("DEVICE_IDENTIFICATION")); @@ -227,6 +229,7 @@ public class MySQLOperationDAOImpl extends GenericOperationDAOImpl { " opr.UPDATED_TIMESTAMP, " + " opr.OPERATION_ID, " + " opr.OPERATION_CODE, " + + " opr.INITIATED_BY, " + " opr.OPERATION_TYPE, " + " opr.STATUS, " + " opr.DEVICE_ID, " + @@ -243,6 +246,7 @@ public class MySQLOperationDAOImpl extends GenericOperationDAOImpl { " opm.UPDATED_TIMESTAMP, " + " opm.OPERATION_ID, " + " op.OPERATION_CODE, " + + " op.INITIATED_BY, " + " op.TYPE OPERATION_TYPE, " + " opm.STATUS, " + " en.DEVICE_ID, " + @@ -295,6 +299,7 @@ public class MySQLOperationDAOImpl extends GenericOperationDAOImpl { activity.setType(Activity.Type.valueOf(rs.getString("OPERATION_TYPE"))); activity.setCreatedTimeStamp(new java.util.Date(rs.getLong(("CREATED_TIMESTAMP")) * 1000).toString()); activity.setCode(rs.getString("OPERATION_CODE")); + activity.setInitiatedBy(rs.getString("INITIATED_BY")); DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); deviceIdentifier.setId(rs.getString("DEVICE_IDENTIFICATION")); @@ -326,6 +331,7 @@ public class MySQLOperationDAOImpl extends GenericOperationDAOImpl { activity.setType(Activity.Type.valueOf(rs.getString("OPERATION_TYPE"))); activity.setCreatedTimeStamp(new java.util.Date(rs.getLong(("CREATED_TIMESTAMP")) * 1000).toString()); activity.setCode(rs.getString("OPERATION_CODE")); + activity.setInitiatedBy(rs.getString("INITIATED_BY")); DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); deviceIdentifier.setId(rs.getString("DEVICE_IDENTIFICATION")); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/sql/h2.sql b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/sql/h2.sql index 845b0d0e36..232123d86f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/sql/h2.sql +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/sql/h2.sql @@ -68,6 +68,7 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION ( CREATED_TIMESTAMP TIMESTAMP NOT NULL, RECEIVED_TIMESTAMP TIMESTAMP NULL, OPERATION_CODE VARCHAR(1000) NOT NULL, + INITIATED_BY VARCHAR(100) NULL, PRIMARY KEY (ID) ); diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql index af592e6a81..5741059f38 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql @@ -75,6 +75,7 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION ( CREATED_TIMESTAMP TIMESTAMP NOT NULL, RECEIVED_TIMESTAMP TIMESTAMP NULL, OPERATION_CODE VARCHAR(1000) NOT NULL, + INITIATED_BY VARCHAR(100) NULL, PRIMARY KEY (ID) ); diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql index 9601b77742..e4a5a313e7 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql @@ -68,6 +68,7 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION ( CREATED_TIMESTAMP TIMESTAMP NOT NULL, RECEIVED_TIMESTAMP TIMESTAMP NULL, OPERATION_CODE VARCHAR(1000) NOT NULL, + INITIATED_BY VARCHAR(100) NULL, PRIMARY KEY (ID) ); diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql index 204fedd387..4f1b93310b 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql @@ -93,6 +93,7 @@ CREATE TABLE DM_OPERATION ( CREATED_TIMESTAMP DATETIME2 NOT NULL, RECEIVED_TIMESTAMP DATETIME2 NULL, OPERATION_CODE VARCHAR(50) NOT NULL, + INITIATED_BY VARCHAR(100) NULL, PRIMARY KEY (ID) ); diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql index b79a23f79e..c50d0a8a8b 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql @@ -83,6 +83,7 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION ( CREATED_TIMESTAMP TIMESTAMP NOT NULL, RECEIVED_TIMESTAMP TIMESTAMP NULL, OPERATION_CODE VARCHAR(50) NOT NULL, + INITIATED_BY VARCHAR(100) NULL, PRIMARY KEY (ID) )ENGINE = InnoDB; diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql index cc89ec76f3..a1c7b1327a 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql @@ -145,6 +145,7 @@ CREATE TABLE DM_OPERATION ( CREATED_TIMESTAMP TIMESTAMP(0) NOT NULL, RECEIVED_TIMESTAMP TIMESTAMP(0) NULL, OPERATION_CODE VARCHAR2(1000) NOT NULL, + INITIATED_BY VARCHAR2(100) NULL, CONSTRAINT PK_DM_OPERATION PRIMARY KEY (ID) ) / diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql index 7f74ab5246..363f055c9c 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql @@ -66,7 +66,8 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION ( TYPE VARCHAR(50) NOT NULL, CREATED_TIMESTAMP TIMESTAMP NOT NULL, RECEIVED_TIMESTAMP TIMESTAMP NULL, - OPERATION_CODE VARCHAR(1000) NOT NULL + OPERATION_CODE VARCHAR(1000) NOT NULL, + INITIATED_BY VARCHAR(50) NULL ); CREATE TABLE IF NOT EXISTS DM_CONFIG_OPERATION (