diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationEnrolmentMapping.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationEnrolmentMapping.java index 4bccaaca929..faa0eab13b4 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationEnrolmentMapping.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationEnrolmentMapping.java @@ -25,12 +25,12 @@ import org.wso2.carbon.device.mgt.common.EnrolmentInfo; */ public class OperationEnrolmentMapping { - int enrolmentId; - int tenantId; - long createdTime; - String deviceType; - String deviceId; - EnrolmentInfo.Status deviceStatus; + private int enrolmentId; + private int tenantId; + private long createdTime; + private String deviceType; + private String deviceId; + private EnrolmentInfo.Status deviceStatus; public int getTenantId() { return tenantId; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationMgtConstants.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationMgtConstants.java index b0bd195dee3..8da340170a4 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationMgtConstants.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationMgtConstants.java @@ -22,7 +22,6 @@ public class OperationMgtConstants { public final class DeviceConstants { private DeviceConstants() { - throw new AssertionError(); } public static final String DEVICE_ID_NOT_FOUND = "Device not found for device id: %s"; @@ -30,8 +29,8 @@ public class OperationMgtConstants { public final class OperationCodes { private OperationCodes() { - throw new AssertionError(); } + public static final String POLICY_REVOKE = "POLICY_REVOKE"; } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/OperationDAO.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/OperationDAO.java index 58b0083b056..e58341da8af 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/OperationDAO.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/OperationDAO.java @@ -31,8 +31,6 @@ public interface OperationDAO { int addOperation(Operation operation) throws OperationManagementDAOException; - void updateOperation(Operation operation) throws OperationManagementDAOException; - Operation getOperation(int operationId) throws OperationManagementDAOException; Operation getOperationByDeviceAndId(int enrolmentId, int operationId) throws OperationManagementDAOException; @@ -66,8 +64,6 @@ public interface OperationDAO { Activity getActivityByDevice(int operationId, int deviceId) throws OperationManagementDAOException; - List getActivitiesUpdatedAfter(long timestamp) throws OperationManagementDAOException; - List getActivitiesUpdatedAfter(long timestamp, int limit, int offset) throws OperationManagementDAOException; int getActivityCountUpdatedAfter(long timestamp) throws OperationManagementDAOException; 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/CommandOperationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/CommandOperationDAOImpl.java index ac64d6550c5..ca5c5a46ea7 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/CommandOperationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/CommandOperationDAOImpl.java @@ -53,23 +53,6 @@ public class CommandOperationDAOImpl extends GenericOperationDAOImpl { return operationId; } - @Override - public void updateOperation(Operation operation) throws OperationManagementDAOException { - PreparedStatement stmt = null; - try { - Connection connection = OperationManagementDAOFactory.getConnection(); - stmt = connection.prepareStatement( - "UPDATE DM_COMMAND_OPERATION SET ENABLED = ? WHERE OPERATION_ID = ?"); - stmt.setBoolean(1, operation.isEnabled()); - stmt.setInt(2, operation.getId()); - stmt.executeUpdate(); - } catch (SQLException e) { - throw new OperationManagementDAOException("Error occurred while adding operation metadata", e); - } finally { - OperationManagementDAOUtil.cleanupResources(stmt); - } - } - public CommandOperation getOperation(int id) throws OperationManagementDAOException { PreparedStatement stmt = null; ResultSet rs = null; 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/ConfigOperationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ConfigOperationDAOImpl.java index a2aefc111fc..632d3dec993 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ConfigOperationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ConfigOperationDAOImpl.java @@ -58,46 +58,6 @@ public class ConfigOperationDAOImpl extends GenericOperationDAOImpl { return operationId; } - @Override - public void updateOperation(Operation operation) throws OperationManagementDAOException { - PreparedStatement stmt = null; - ByteArrayOutputStream bao = null; - ObjectOutputStream oos = null; - try { - super.updateOperation(operation); - Connection connection = OperationManagementDAOFactory.getConnection(); - stmt = connection.prepareStatement("UPDATE FROM DM_CONFIG_OPERATION SET OPERATION_CONFIG = ? " + - "WHERE OPERATION_ID = ?"); - bao = new ByteArrayOutputStream(); - oos = new ObjectOutputStream(bao); - oos.writeObject(operation); - - stmt.setBytes(1, bao.toByteArray()); - stmt.setInt(2, operation.getId()); - stmt.executeUpdate(); - } catch (SQLException e) { - throw new OperationManagementDAOException("Error occurred while update policy operation metadata", e); - } catch (IOException e) { - throw new OperationManagementDAOException("Error occurred while serializing policy operation object", e); - } finally { - if (bao != null) { - try { - bao.close(); - } catch (IOException e) { - log.warn("Error occurred while closing ByteArrayOutputStream", e); - } - } - if (oos != null) { - try { - oos.close(); - } catch (IOException e) { - log.warn("Error occurred while closing ObjectOutputStream", e); - } - } - OperationManagementDAOUtil.cleanupResources(stmt); - } - } - @Override public Operation getOperation(int operationId) throws OperationManagementDAOException { PreparedStatement stmt = null; 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 7ab5a4bd94d..a575d18cf3e 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 @@ -85,23 +85,6 @@ public class GenericOperationDAOImpl implements OperationDAO { } } - @Override - public void updateOperation(Operation operation) throws OperationManagementDAOException { - PreparedStatement stmt = null; - try { - Connection connection = OperationManagementDAOFactory.getConnection(); - stmt = connection.prepareStatement("UPDATE DM_OPERATION SET RECEIVED_TIMESTAMP=? " + - "WHERE ID=?"); - stmt.setTimestamp(1, new Timestamp(new Date().getTime())); - stmt.setInt(2, operation.getId()); - stmt.executeUpdate(); - } catch (SQLException e) { - throw new OperationManagementDAOException("Error occurred while update operation metadata", e); - } finally { - OperationManagementDAOUtil.cleanupResources(stmt); - } - } - public boolean updateOperationStatus(int enrolmentId, int operationId, Operation.Status status) throws OperationManagementDAOException { PreparedStatement stmt = null; @@ -403,11 +386,6 @@ public class GenericOperationDAOImpl implements OperationDAO { return activity; } - @Override - public List getActivitiesUpdatedAfter(long timestamp) throws OperationManagementDAOException { - return this.getActivitiesUpdatedAfter(timestamp, 0, 0); - } - @Override public List getActivitiesUpdatedAfter(long timestamp, int limit, int offset) throws OperationManagementDAOException { 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/PolicyOperationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/PolicyOperationDAOImpl.java index f24cfb3ae3b..7f142b7d04c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/PolicyOperationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/PolicyOperationDAOImpl.java @@ -82,46 +82,6 @@ public class PolicyOperationDAOImpl extends GenericOperationDAOImpl { return operationId; } - @Override - public void updateOperation(Operation operation) throws OperationManagementDAOException { - PreparedStatement stmt = null; - ByteArrayOutputStream bao = null; - ObjectOutputStream oos = null; - try { - super.updateOperation(operation); - Connection connection = OperationManagementDAOFactory.getConnection(); - stmt = connection.prepareStatement("UPDATE DM_POLICY_OPERATION SET OPERATION_DETAILS=? " + - "WHERE OPERATION_ID=?"); - bao = new ByteArrayOutputStream(); - oos = new ObjectOutputStream(bao); - oos.writeObject(operation); - - stmt.setBytes(1, bao.toByteArray()); - stmt.setInt(2, operation.getId()); - stmt.executeUpdate(); - } catch (SQLException e) { - throw new OperationManagementDAOException("Error occurred while update policy operation metadata", e); - } catch (IOException e) { - throw new OperationManagementDAOException("Error occurred while serializing policy operation object", e); - } finally { - if (bao != null) { - try { - bao.close(); - } catch (IOException e) { - log.warn("Error occurred while closing ByteArrayOutputStream", e); - } - } - if (oos != null) { - try { - oos.close(); - } catch (IOException e) { - log.warn("Error occurred while closing ObjectOutputStream", e); - } - } - OperationManagementDAOUtil.cleanupResources(stmt); - } - } - @Override public Operation getOperation(int operationId) throws OperationManagementDAOException { PreparedStatement stmt = null; 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/ProfileOperationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ProfileOperationDAOImpl.java index 78b88f9855f..9223b3c030a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ProfileOperationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ProfileOperationDAOImpl.java @@ -82,47 +82,6 @@ public class ProfileOperationDAOImpl extends GenericOperationDAOImpl { return operationId; } - @Override - public void updateOperation(Operation operation) throws OperationManagementDAOException { - PreparedStatement stmt = null; - ByteArrayOutputStream bao = null; - ObjectOutputStream oos = null; - try { - super.updateOperation(operation); - Connection connection = OperationManagementDAOFactory.getConnection(); - stmt = connection.prepareStatement("UPDATE DM_PROFILE_OPERATION SET OPERATION_DETAILS=? " + - "WHERE OPERATION_ID=?"); - - bao = new ByteArrayOutputStream(); - oos = new ObjectOutputStream(bao); - oos.writeObject(operation); - - stmt.setBytes(1, bao.toByteArray()); - stmt.setInt(2, operation.getId()); - stmt.executeUpdate(); - } catch (SQLException e) { - throw new OperationManagementDAOException("Error occurred while update operation metadata", e); - } catch (IOException e) { - throw new OperationManagementDAOException("Error occurred while serializing profile operation object", e); - } finally { - if (bao != null) { - try { - bao.close(); - } catch (IOException e) { - log.warn("Error occurred while closing ByteArrayOutputStream", e); - } - } - if (oos != null) { - try { - oos.close(); - } catch (IOException e) { - log.warn("Error occurred while closing ObjectOutputStream", e); - } - } - OperationManagementDAOUtil.cleanupResources(stmt); - } - } - public Operation getOperation(int id) throws OperationManagementDAOException { PreparedStatement stmt = null; ResultSet rs = null;