diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/TraccarManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/TraccarManagementService.java index a5f3e71f5e7..39bb7d85ef5 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/TraccarManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/TraccarManagementService.java @@ -1,3 +1,21 @@ +/* + * Copyright (c) 2023, 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.device.mgt.common.spi; import org.wso2.carbon.device.mgt.common.Device; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java index 73259d71422..7dde5efb162 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java @@ -270,14 +270,14 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem applicationDAO.removeApplications(new ArrayList<>(appsToRemove.values()), device.getId(), device.getEnrolmentInfo().getId(), tenantId); } -// if (!appsToUpdate.isEmpty()) { -// applicationDAO.updateApplications(new ArrayList<>(appsToUpdate.values()), device.getId(), -// device.getEnrolmentInfo().getId(), tenantId); -// } -// if (!appsToInsert.isEmpty()) { -// applicationDAO.addApplications(new ArrayList<>(appsToInsert.values()), device.getId(), -// device.getEnrolmentInfo().getId(), tenantId); -// } + if (!appsToUpdate.isEmpty()) { + applicationDAO.updateApplications(new ArrayList<>(appsToUpdate.values()), device.getId(), + device.getEnrolmentInfo().getId(), tenantId); + } + if (!appsToInsert.isEmpty()) { + applicationDAO.addApplications(new ArrayList<>(appsToInsert.values()), device.getId(), + device.getEnrolmentInfo().getId(), tenantId); + } DeviceManagementDAOFactory.commitTransaction(); String reportingHost = HttpReportingUtil.getReportingHost(); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceManagementDataHolder.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceManagementDataHolder.java index 51375d98c46..9d560b04831 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceManagementDataHolder.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceManagementDataHolder.java @@ -370,7 +370,6 @@ public class DeviceManagementDataHolder { TraccarManagementService.class, null); if (traccarManagementService == null) { String msg = "Traccar management service not initialized."; -// log.error(msg); throw new IllegalStateException(msg); } return traccarManagementService; 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 6873494890f..820b9dadc25 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 @@ -787,6 +787,7 @@ CREATE TABLE IF NOT EXISTS DYNAMIC_TASK_PROPERTIES ( DYNAMIC_TASK (DYNAMIC_TASK_ID) ON DELETE CASCADE ON UPDATE CASCADE ); -- END OF DYNAMIC TASK TABLE-- + -- DM_TRACCAR_UNSYNCED_DEVICES TABLE -- CREATE TABLE IF NOT EXISTS DM_TRACCAR_UNSYNCED_DEVICES ( ID INT NOT NULL AUTO_INCREMENT, @@ -800,14 +801,6 @@ CREATE TABLE IF NOT EXISTS DM_TRACCAR_UNSYNCED_DEVICES ( ); -- END OF DM_TRACCAR_UNSYNCED_DEVICES TABLE -- --- DM_TRACCAR_USER_MAPPING TABLE -- -CREATE TABLE IF NOT EXISTS DM_TRACCAR_USER_MAPPING ( - USER_EMAIL VARCHAR(100) NOT NULL UNIQUE, - USER_ID INT NOT NULL, - PRIMARY KEY (USER_EMAIL,USER_ID) -); --- END OF DM_TRACCAR_USER_MAPPING TABLE -- - -- DM_TRACCAR_USER_MAPPING TABLE -- CREATE TABLE IF NOT EXISTS DM_TRACCAR_DEVICE_MAPPING ( DEVICE_UNIQUE_ID VARCHAR(100) NOT NULL,