diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/AbstractNotificationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/AbstractNotificationDAOImpl.java index aa6ebe316a..abe94ea4b9 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/AbstractNotificationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/AbstractNotificationDAOImpl.java @@ -18,12 +18,8 @@ package org.wso2.carbon.device.mgt.core.notification.mgt.dao.impl; -import org.wso2.carbon.device.mgt.common.PaginationRequest; -import org.wso2.carbon.device.mgt.common.PaginationResult; import org.wso2.carbon.device.mgt.common.notification.mgt.Notification; import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException; -import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException; -import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil; import org.wso2.carbon.device.mgt.core.notification.mgt.dao.NotificationDAO; import org.wso2.carbon.device.mgt.core.notification.mgt.dao.NotificationManagementDAOFactory; import org.wso2.carbon.device.mgt.core.notification.mgt.dao.util.NotificationDAOUtil; @@ -79,8 +75,8 @@ public abstract class AbstractNotificationDAOImpl implements NotificationDAO { try { conn = NotificationManagementDAOFactory.getConnection(); String sql = - "SELECT NOTIFICATION_ID, OPERATION_ID, DESCRIPTION, STATUS FROM DM_NOTIFICATION WHERE " + - "TENANT_ID = ? AND NOTIFICATION_ID = ?"; + "SELECT NOTIFICATION_ID, OPERATION_ID, DESCRIPTION, STATUS, DEVICE_IDENTIFICATION, DEVICE_NAME, " + + "DEVICE TYPE FROM DM_NOTIFICATION WHERE TENANT_ID = ? AND NOTIFICATION_ID = ?"; stmt = conn.prepareStatement(sql); stmt.setInt(1, tenantId); stmt.setInt(2, notificationId); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java index 200291ce4c..83eae4cff4 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java @@ -33,8 +33,23 @@ import java.util.List; */ public interface DeviceManagementProviderService { + /** + * Method to retrieve all the devices of a given device type. + * + * @param deviceType Device-type of the required devices + * @return List of devices of given device-type. + * @throws DeviceManagementException If some unusual behaviour is observed while fetching the + * devices. + */ List getAllDevices(String deviceType) throws DeviceManagementException; + /** + * Method to retrieve all the devices registered in the system. + * + * @return List of registered devices. + * @throws DeviceManagementException If some unusual behaviour is observed while fetching the + * devices. + */ List getAllDevices() throws DeviceManagementException; /** diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DeviceTaskManagerImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DeviceTaskManagerImpl.java index 263237f7d5..5041f71a6c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DeviceTaskManagerImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DeviceTaskManagerImpl.java @@ -84,29 +84,28 @@ public class DeviceTaskManagerImpl implements DeviceTaskManager { @Override public void addOperations() throws DeviceMgtTaskException { - DeviceManagementProviderService deviceManagementProviderService = - DeviceManagementDataHolder.getInstance().getDeviceManagementProvider(); + DeviceManagementProviderService deviceManagementProviderService = DeviceManagementDataHolder.getInstance(). + getDeviceManagementProvider(); try { - List devices = deviceManagementProviderService.getAllDevices(); + List deviceTypes = deviceManagementProviderService.getAvailableDeviceTypes(); + List devices; List operations = this.getValidOperationNames(); - if (!devices.isEmpty()) { - for (String str : operations) { - CommandOperation operation = new CommandOperation(); - operation.setEnabled(true); - operation.setType(Operation.Type.COMMAND); - operation.setCode(str); - //TODO: Fix this properly later adding device type to be passed in when the task manage executes "addOperations()" - String type = null; - if (devices.size() > 0) { - type = devices.get(0).getType(); + for (String deviceType : deviceTypes) { + devices = deviceManagementProviderService.getAllDevices(deviceType); + if (!devices.isEmpty()) { + for (String str : operations) { + CommandOperation operation = new CommandOperation(); + operation.setEnabled(true); + operation.setType(Operation.Type.COMMAND); + operation.setCode(str); + deviceManagementProviderService.addOperation(deviceType, operation, + DeviceManagerUtil.getValidDeviceIdentifiers(devices)); + } + } else { + if (log.isDebugEnabled()) { + log.debug("No devices are available to perform the operations."); } - deviceManagementProviderService.addOperation(type, operation, - DeviceManagerUtil.convertDevices(devices)); - } - } else { - if (log.isDebugEnabled()) { - log.debug("No devices are available to perform the operations."); } } } catch (InvalidDeviceException e) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java index 17023a5a31..033e3fccca 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java @@ -184,6 +184,27 @@ public final class DeviceManagerUtil { return deviceIdentifiers; } + public static List getValidDeviceIdentifiers(List devices) { + List deviceIdentifiers = new ArrayList<>(); + for (Device device : devices) { + if (device.getEnrolmentInfo() != null) { + switch (device.getEnrolmentInfo().getStatus()) { + case BLOCKED: + case REMOVED: + case SUSPENDED: + break; + default: + DeviceIdentifier identifier = new DeviceIdentifier(); + identifier.setId(device.getDeviceIdentifier()); + identifier.setType(device.getType()); + deviceIdentifiers.add(identifier); + } + } + } + return deviceIdentifiers; + } + + public static String getServerBaseHttpsUrl() { String hostName = "localhost"; try { diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImpl.java index 26d896886a..28ab6040c7 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImpl.java @@ -54,6 +54,8 @@ public class PolicyManagerServiceImpl implements PolicyManagerService { policyAdministratorPoint = new PolicyAdministratorPointImpl(); monitoringManager = new MonitoringManagerImpl(); policyManager = new PolicyManagerImpl(); + PolicyManagementDataHolder.getInstance().setMonitoringManager(monitoringManager); + PolicyManagementDataHolder.getInstance().setPolicyManager(policyManager); } @Override diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/internal/PolicyManagementDataHolder.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/internal/PolicyManagementDataHolder.java index dd4519eb5b..584bd2ec08 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/internal/PolicyManagementDataHolder.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/internal/PolicyManagementDataHolder.java @@ -23,6 +23,8 @@ import org.wso2.carbon.ntask.core.service.TaskService; import org.wso2.carbon.policy.mgt.common.PolicyEvaluationPoint; import org.wso2.carbon.policy.mgt.common.PolicyInformationPoint; import org.wso2.carbon.policy.mgt.common.spi.PolicyMonitoringService; +import org.wso2.carbon.policy.mgt.core.mgt.MonitoringManager; +import org.wso2.carbon.policy.mgt.core.mgt.PolicyManager; import org.wso2.carbon.user.core.service.RealmService; import org.wso2.carbon.user.core.tenant.TenantManager; @@ -36,6 +38,8 @@ public class PolicyManagementDataHolder { private PolicyEvaluationPoint policyEvaluationPoint; private PolicyInformationPoint policyInformationPoint; private DeviceManagementProviderService deviceManagementService; + private MonitoringManager monitoringManager; + private PolicyManager policyManager; private Map policyMonitoringServiceMap = new HashMap<>(); private TaskService taskService; @@ -47,6 +51,22 @@ public class PolicyManagementDataHolder { return thisInstance; } + public PolicyManager getPolicyManager() { + return policyManager; + } + + public void setPolicyManager(PolicyManager policyManager) { + this.policyManager = policyManager; + } + + public MonitoringManager getMonitoringManager() { + return monitoringManager; + } + + public void setMonitoringManager(MonitoringManager monitoringManager) { + this.monitoringManager = monitoringManager; + } + public RealmService getRealmService() { return realmService; } diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/MonitoringManager.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/MonitoringManager.java index 883d49237d..2b6e7d5eae 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/MonitoringManager.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/MonitoringManager.java @@ -21,7 +21,6 @@ package org.wso2.carbon.policy.mgt.core.mgt; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; -import org.wso2.carbon.device.mgt.core.dto.DeviceType; import org.wso2.carbon.policy.mgt.common.monitor.ComplianceData; import org.wso2.carbon.policy.mgt.common.monitor.ComplianceFeature; import org.wso2.carbon.policy.mgt.common.monitor.PolicyComplianceException; @@ -40,6 +39,6 @@ public interface MonitoringManager { void addMonitoringOperation(List devices) throws PolicyComplianceException; - List getDeviceTypes() throws PolicyComplianceException; + List getDeviceTypes() throws PolicyComplianceException; } diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/MonitoringManagerImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/MonitoringManagerImpl.java index adebb6ed38..b83839e587 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/MonitoringManagerImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/MonitoringManagerImpl.java @@ -21,7 +21,6 @@ package org.wso2.carbon.policy.mgt.core.mgt.impl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceManagementException; @@ -30,12 +29,8 @@ import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager; import org.wso2.carbon.device.mgt.core.config.policy.PolicyConfiguration; -import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory; -import org.wso2.carbon.device.mgt.core.dao.DeviceTypeDAO; -import org.wso2.carbon.device.mgt.core.dto.DeviceType; import org.wso2.carbon.device.mgt.core.operation.mgt.CommandOperation; import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; -import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderServiceImpl; import org.wso2.carbon.policy.mgt.common.Policy; import org.wso2.carbon.policy.mgt.common.PolicyManagementException; import org.wso2.carbon.policy.mgt.common.ProfileFeature; @@ -56,8 +51,6 @@ import java.util.Map; public class MonitoringManagerImpl implements MonitoringManager { private PolicyDAO policyDAO; - // private DeviceDAO deviceDAO; - private DeviceTypeDAO deviceTypeDAO; private MonitoringDAO monitoringDAO; private ComplianceDecisionPoint complianceDecisionPoint; private PolicyConfiguration policyConfiguration; @@ -69,8 +62,6 @@ public class MonitoringManagerImpl implements MonitoringManager { public MonitoringManagerImpl() { this.policyDAO = PolicyManagementDAOFactory.getPolicyDAO(); -// this.deviceDAO = DeviceManagementDAOFactory.getDeviceDAO(); - this.deviceTypeDAO = DeviceManagementDAOFactory.getDeviceTypeDAO(); this.monitoringDAO = PolicyManagementDAOFactory.getMonitoringDAO(); this.complianceDecisionPoint = new ComplianceDecisionPointImpl(); this.policyConfiguration = @@ -84,8 +75,8 @@ public class MonitoringManagerImpl implements MonitoringManager { List complianceFeatures = new ArrayList<>(); try { - DeviceManagementProviderService service = new DeviceManagementProviderServiceImpl(); - PolicyManager manager = new PolicyManagerImpl(); + DeviceManagementProviderService service = PolicyManagementDataHolder.getInstance().getDeviceManagementService(); + PolicyManager manager = PolicyManagementDataHolder.getInstance().getPolicyManager(); Device device = service.getDevice(deviceIdentifier); Policy policy = manager.getAppliedPolicyToDevice(deviceIdentifier); if (policy != null) { @@ -179,7 +170,7 @@ public class MonitoringManagerImpl implements MonitoringManager { @Override public boolean isCompliance(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException { try { - DeviceManagementProviderService service = new DeviceManagementProviderServiceImpl(); + DeviceManagementProviderService service = PolicyManagementDataHolder.getInstance().getDeviceManagementService(); Device device = service.getDevice(deviceIdentifier); PolicyManagementDAOFactory.openConnection(); ComplianceData complianceData = monitoringDAO.getCompliance(device.getId(), device.getEnrolmentInfo() @@ -209,7 +200,7 @@ public class MonitoringManagerImpl implements MonitoringManager { ComplianceData complianceData; try { PolicyManagementDAOFactory.openConnection(); - DeviceManagementProviderService service = new DeviceManagementProviderServiceImpl(); + DeviceManagementProviderService service = PolicyManagementDataHolder.getInstance().getDeviceManagementService(); Device device = service.getDevice(deviceIdentifier); complianceData = monitoringDAO.getCompliance(device.getId(), device.getEnrolmentInfo().getId()); List complianceFeatures = @@ -374,17 +365,13 @@ public class MonitoringManagerImpl implements MonitoringManager { } @Override - public List getDeviceTypes() throws PolicyComplianceException { + public List getDeviceTypes() throws PolicyComplianceException { - List deviceTypes = new ArrayList<>(); + List deviceTypes = new ArrayList<>(); try { - DeviceManagementDAOFactory.openConnection(); - int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); - deviceTypes = deviceTypeDAO.getDeviceTypes(tenantId); - } catch (Exception e) { - log.error("Error occurred while getting the device types.", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); + deviceTypes = PolicyManagementDataHolder.getInstance().getDeviceManagementService().getAvailableDeviceTypes(); + } catch (DeviceManagementException e) { + throw new PolicyComplianceException("Error occurred while getting the device types.", e); } return deviceTypes; } diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/PolicyManagerImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/PolicyManagerImpl.java index a8e8250c56..3c390780e6 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/PolicyManagerImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/PolicyManagerImpl.java @@ -26,9 +26,6 @@ import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroup; import org.wso2.carbon.device.mgt.common.group.mgt.GroupManagementException; -import org.wso2.carbon.device.mgt.core.dao.DeviceDAO; -import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory; -import org.wso2.carbon.device.mgt.core.dto.DeviceType; import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderServiceImpl; import org.wso2.carbon.device.mgt.core.service.GroupManagementProviderService; @@ -50,14 +47,12 @@ public class PolicyManagerImpl implements PolicyManager { private ProfileDAO profileDAO; private FeatureDAO featureDAO; private ProfileManager profileManager; - private DeviceDAO deviceDAO; private static Log log = LogFactory.getLog(PolicyManagerImpl.class); public PolicyManagerImpl() { this.policyDAO = PolicyManagementDAOFactory.getPolicyDAO(); this.profileDAO = PolicyManagementDAOFactory.getProfileDAO(); this.featureDAO = PolicyManagementDAOFactory.getFeatureDAO(); - this.deviceDAO = DeviceManagementDAOFactory.getDeviceDAO(); this.profileManager = new ProfileManagerImpl(); } diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/task/MonitoringTask.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/task/MonitoringTask.java index 09987a5d19..d579cd746d 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/task/MonitoringTask.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/task/MonitoringTask.java @@ -40,7 +40,6 @@ import java.util.Map; public class MonitoringTask implements Task { - private DeviceTypeDAO deviceTypeDAO; private static Log log = LogFactory.getLog(MonitoringTask.class); Map properties; @@ -53,7 +52,6 @@ public class MonitoringTask implements Task { @Override public void init() { - deviceTypeDAO = DeviceManagementDAOFactory.getDeviceTypeDAO(); } @Override @@ -63,9 +61,9 @@ public class MonitoringTask implements Task { log.debug("Monitoring task started to run."); } - MonitoringManager monitoringManager = new MonitoringManagerImpl(); + MonitoringManager monitoringManager = PolicyManagementDataHolder.getInstance().getMonitoringManager(); - List deviceTypes = new ArrayList<>(); + List deviceTypes = new ArrayList<>(); try { deviceTypes = monitoringManager.getDeviceTypes(); } catch (PolicyComplianceException e) { @@ -79,15 +77,15 @@ public class MonitoringTask implements Task { DeviceManagementProviderService deviceManagementProviderService = PolicyManagementDataHolder.getInstance().getDeviceManagementService(); - for (DeviceType deviceType : deviceTypes) { + for (String deviceType : deviceTypes) { if (log.isDebugEnabled()) { - log.debug("Running task for device type : " + deviceType.getName()); + log.debug("Running task for device type : " + deviceType); } PolicyMonitoringService monitoringService = - PolicyManagementDataHolder.getInstance().getPolicyMonitoringService(deviceType.getName()); - List devices = deviceManagementProviderService.getAllDevices(deviceType.getName()); + PolicyManagementDataHolder.getInstance().getPolicyMonitoringService(deviceType); + List devices = deviceManagementProviderService.getAllDevices(deviceType); if (monitoringService != null && !devices.isEmpty()) { @@ -95,7 +93,7 @@ public class MonitoringTask implements Task { if (log.isDebugEnabled()) { log.debug("Removing inactive and blocked devices from the list for the device type : " + - deviceType.getName()); + deviceType); } for (Device device : devices) { EnrolmentInfo.Status status = device.getEnrolmentInfo().getStatus(); @@ -111,8 +109,7 @@ public class MonitoringTask implements Task { } } if (log.isDebugEnabled()) { - log.debug("Following devices selected to send the notification for " + - deviceType.getName()); + log.debug("Following devices selected to send the notification for " + deviceType); for (Device device : notifiableDevices) { log.debug(device.getDeviceIdentifier()); } diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/util/PolicyManagerUtil.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/util/PolicyManagerUtil.java index d0d9fce352..e5c983ed6f 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/util/PolicyManagerUtil.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/util/PolicyManagerUtil.java @@ -22,6 +22,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.w3c.dom.Document; import org.wso2.carbon.device.mgt.common.Device; +import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationManagementException; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/h2.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/h2.sql index 4684ec127c..d561d89e88 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/h2.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/h2.sql @@ -370,7 +370,7 @@ CREATE TABLE IF NOT EXISTS DM_NOTIFICATION ( OPERATION_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL, STATUS VARCHAR(10) NULL, - DESCRIPTION VARCHAR(100) NULL, + DESCRIPTION VARCHAR(1000) NULL, PRIMARY KEY (NOTIFICATION_ID), CONSTRAINT fk_dm_device_notification FOREIGN KEY (DEVICE_ID) REFERENCES DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mssql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mssql.sql index 1ee37a2e90..e54e5705ca 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mssql.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mssql.sql @@ -367,7 +367,7 @@ CREATE TABLE DM_NOTIFICATION ( OPERATION_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL, STATUS VARCHAR(10) NULL, - DESCRIPTION VARCHAR(100) NULL, + DESCRIPTION VARCHAR(1000) NULL, PRIMARY KEY (NOTIFICATION_ID), CONSTRAINT FL_DM_NOTIFICATION FOREIGN KEY (DEVICE_ID) REFERENCES DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mysql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mysql.sql index e8cb6f4f27..0bb2700f76 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mysql.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mysql.sql @@ -428,7 +428,7 @@ CREATE TABLE IF NOT EXISTS DM_NOTIFICATION ( OPERATION_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL, STATUS VARCHAR(10) NULL, - DESCRIPTION VARCHAR(100) NULL, + DESCRIPTION VARCHAR(1000) NULL, PRIMARY KEY (NOTIFICATION_ID), CONSTRAINT fk_dm_device_notification FOREIGN KEY (DEVICE_ID) REFERENCES DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/oracle.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/oracle.sql index c49d530140..e889251f93 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/oracle.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/oracle.sql @@ -706,7 +706,7 @@ CREATE TABLE DM_NOTIFICATION ( OPERATION_ID NUMBER(10) NOT NULL, TENANT_ID NUMBER(10) NOT NULL, STATUS VARCHAR2(10) NULL, - DESCRIPTION VARCHAR2(100) NULL, + DESCRIPTION VARCHAR2(1000) NULL, CONSTRAINT PK_DM_NOTIFICATION PRIMARY KEY (NOTIFICATION_ID), CONSTRAINT FK_DM_DEVICE_NOTIFICATION FOREIGN KEY (DEVICE_ID) REFERENCES DM_DEVICE (ID), diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql index 828eca58cb..c124b0d496 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql @@ -409,7 +409,7 @@ CREATE TABLE IF NOT EXISTS DM_NOTIFICATION ( OPERATION_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL, STATUS VARCHAR(10) NULL, - DESCRIPTION VARCHAR(100) NULL, + DESCRIPTION VARCHAR(1000) NULL, CONSTRAINT fk_dm_device_notification FOREIGN KEY (DEVICE_ID) REFERENCES DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT fk_dm_operation_notification FOREIGN KEY (OPERATION_ID) REFERENCES