mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merge branch 'master' of https://github.com/wso2/carbon-device-mgt
This commit is contained in:
commit
23fe8b1fdb
@ -81,7 +81,7 @@ public class ActivityProviderServiceImpl implements ActivityInfoProviderService
|
|||||||
long timestamp = 0;
|
long timestamp = 0;
|
||||||
boolean isIfModifiedSinceSet = false;
|
boolean isIfModifiedSinceSet = false;
|
||||||
boolean isSinceSet = false;
|
boolean isSinceSet = false;
|
||||||
|
RequestValidationUtil.validatePaginationParameters(offset, limit);
|
||||||
if (ifModifiedSince != null && !ifModifiedSince.isEmpty()) {
|
if (ifModifiedSince != null && !ifModifiedSince.isEmpty()) {
|
||||||
Date ifSinceDate;
|
Date ifSinceDate;
|
||||||
SimpleDateFormat format = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z");
|
SimpleDateFormat format = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z");
|
||||||
|
|||||||
@ -74,7 +74,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|||||||
@QueryParam("limit") int limit) {
|
@QueryParam("limit") int limit) {
|
||||||
try {
|
try {
|
||||||
// RequestValidationUtil.validateSelectionCriteria(type, user, roleName, ownership, status);
|
// RequestValidationUtil.validateSelectionCriteria(type, user, roleName, ownership, status);
|
||||||
|
RequestValidationUtil.validatePaginationParameters(offset, limit);
|
||||||
DeviceManagementProviderService dms = DeviceMgtAPIUtils.getDeviceManagementService();
|
DeviceManagementProviderService dms = DeviceMgtAPIUtils.getDeviceManagementService();
|
||||||
PaginationRequest request = new PaginationRequest(offset, limit);
|
PaginationRequest request = new PaginationRequest(offset, limit);
|
||||||
PaginationResult result;
|
PaginationResult result;
|
||||||
@ -154,6 +154,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|||||||
public Response getDeviceByUser(@QueryParam("offset") int offset,
|
public Response getDeviceByUser(@QueryParam("offset") int offset,
|
||||||
@QueryParam("limit") int limit) {
|
@QueryParam("limit") int limit) {
|
||||||
|
|
||||||
|
RequestValidationUtil.validatePaginationParameters(offset, limit);
|
||||||
PaginationRequest request = new PaginationRequest(offset, limit);
|
PaginationRequest request = new PaginationRequest(offset, limit);
|
||||||
PaginationResult result;
|
PaginationResult result;
|
||||||
DeviceList devices = new DeviceList();
|
DeviceList devices = new DeviceList();
|
||||||
@ -292,6 +293,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|||||||
@QueryParam("offset") int offset,
|
@QueryParam("offset") int offset,
|
||||||
@QueryParam("limit") int limit) {
|
@QueryParam("limit") int limit) {
|
||||||
OperationList operationsList = new OperationList();
|
OperationList operationsList = new OperationList();
|
||||||
|
RequestValidationUtil.validatePaginationParameters(offset, limit);
|
||||||
PaginationRequest request = new PaginationRequest(offset, limit);
|
PaginationRequest request = new PaginationRequest(offset, limit);
|
||||||
PaginationResult result;
|
PaginationResult result;
|
||||||
DeviceManagementProviderService dms;
|
DeviceManagementProviderService dms;
|
||||||
|
|||||||
@ -50,6 +50,7 @@ public class NotificationManagementServiceImpl implements NotificationManagement
|
|||||||
@HeaderParam("If-Modified-Since") String ifModifiedSince,
|
@HeaderParam("If-Modified-Since") String ifModifiedSince,
|
||||||
@QueryParam("offset") int offset, @QueryParam("limit") int limit) {
|
@QueryParam("offset") int offset, @QueryParam("limit") int limit) {
|
||||||
|
|
||||||
|
RequestValidationUtil.validatePaginationParameters(offset, limit);
|
||||||
PaginationRequest request = new PaginationRequest(offset, limit);
|
PaginationRequest request = new PaginationRequest(offset, limit);
|
||||||
PaginationResult result;
|
PaginationResult result;
|
||||||
|
|
||||||
|
|||||||
@ -140,6 +140,7 @@ public class PolicyManagementServiceImpl implements PolicyManagementService {
|
|||||||
@HeaderParam("If-Modified-Since") String ifModifiedSince,
|
@HeaderParam("If-Modified-Since") String ifModifiedSince,
|
||||||
@QueryParam("offset") int offset,
|
@QueryParam("offset") int offset,
|
||||||
@QueryParam("limit") int limit) {
|
@QueryParam("limit") int limit) {
|
||||||
|
RequestValidationUtil.validatePaginationParameters(offset, limit);
|
||||||
PolicyManagerService policyManagementService = DeviceMgtAPIUtils.getPolicyManagementService();
|
PolicyManagerService policyManagementService = DeviceMgtAPIUtils.getPolicyManagementService();
|
||||||
List<Policy> policies;
|
List<Policy> policies;
|
||||||
List<Policy> filteredPolicies;
|
List<Policy> filteredPolicies;
|
||||||
|
|||||||
@ -61,6 +61,7 @@ public class RoleManagementServiceImpl implements RoleManagementService {
|
|||||||
@QueryParam("user-store") String userStore,
|
@QueryParam("user-store") String userStore,
|
||||||
@HeaderParam("If-Modified-Since") String ifModifiedSince,
|
@HeaderParam("If-Modified-Since") String ifModifiedSince,
|
||||||
@QueryParam("offset") int offset, @QueryParam("limit") int limit) {
|
@QueryParam("offset") int offset, @QueryParam("limit") int limit) {
|
||||||
|
RequestValidationUtil.validatePaginationParameters(offset, limit);
|
||||||
List<String> filteredRoles;
|
List<String> filteredRoles;
|
||||||
RoleList targetRoles = new RoleList();
|
RoleList targetRoles = new RoleList();
|
||||||
|
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
|
|||||||
import org.wso2.carbon.device.mgt.core.service.EmailMetaInfo;
|
import org.wso2.carbon.device.mgt.core.service.EmailMetaInfo;
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.beans.*;
|
import org.wso2.carbon.device.mgt.jaxrs.beans.*;
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.service.api.UserManagementService;
|
import org.wso2.carbon.device.mgt.jaxrs.service.api.UserManagementService;
|
||||||
|
import org.wso2.carbon.device.mgt.jaxrs.service.impl.util.RequestValidationUtil;
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.util.Constants;
|
import org.wso2.carbon.device.mgt.jaxrs.util.Constants;
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.util.CredentialManagementResponseBuilder;
|
import org.wso2.carbon.device.mgt.jaxrs.util.CredentialManagementResponseBuilder;
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.util.DeviceMgtAPIUtils;
|
import org.wso2.carbon.device.mgt.jaxrs.util.DeviceMgtAPIUtils;
|
||||||
@ -264,6 +265,7 @@ public class UserManagementServiceImpl implements UserManagementService {
|
|||||||
log.debug("Getting the list of users with all user-related information");
|
log.debug("Getting the list of users with all user-related information");
|
||||||
}
|
}
|
||||||
List<BasicUserInfo> userList, offsetList;
|
List<BasicUserInfo> userList, offsetList;
|
||||||
|
RequestValidationUtil.validatePaginationParameters(offset, limit);
|
||||||
String appliedFilter = ((filter == null) || filter.isEmpty() ? "*" : filter);
|
String appliedFilter = ((filter == null) || filter.isEmpty() ? "*" : filter);
|
||||||
int appliedLimit = (limit <= 0) ? -1 : (limit + offset);
|
int appliedLimit = (limit <= 0) ? -1 : (limit + offset);
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,7 @@ import org.wso2.carbon.device.mgt.common.DeviceManagementException;
|
|||||||
import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceList;
|
import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceList;
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse;
|
import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse;
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.service.api.admin.DeviceManagementAdminService;
|
import org.wso2.carbon.device.mgt.jaxrs.service.api.admin.DeviceManagementAdminService;
|
||||||
|
import org.wso2.carbon.device.mgt.jaxrs.service.impl.util.RequestValidationUtil;
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.util.DeviceMgtAPIUtils;
|
import org.wso2.carbon.device.mgt.jaxrs.util.DeviceMgtAPIUtils;
|
||||||
|
|
||||||
import javax.ws.rs.*;
|
import javax.ws.rs.*;
|
||||||
@ -50,6 +51,7 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
|
|||||||
@HeaderParam("If-Modified-Since") String ifModifiedSince,
|
@HeaderParam("If-Modified-Since") String ifModifiedSince,
|
||||||
@QueryParam("offset") int offset,
|
@QueryParam("offset") int offset,
|
||||||
@QueryParam("limit") int limit) {
|
@QueryParam("limit") int limit) {
|
||||||
|
RequestValidationUtil.validatePaginationParameters(offset, limit);
|
||||||
try {
|
try {
|
||||||
int currentTenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
|
int currentTenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||||
if (MultitenantConstants.SUPER_TENANT_ID != currentTenantId) {
|
if (MultitenantConstants.SUPER_TENANT_ID != currentTenantId) {
|
||||||
|
|||||||
@ -19,6 +19,7 @@
|
|||||||
package org.wso2.carbon.device.mgt.jaxrs.service.impl.util;
|
package org.wso2.carbon.device.mgt.jaxrs.service.impl.util;
|
||||||
|
|
||||||
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||||
|
import org.wso2.carbon.device.mgt.common.PaginationRequest;
|
||||||
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
|
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
|
||||||
import org.wso2.carbon.device.mgt.common.notification.mgt.Notification;
|
import org.wso2.carbon.device.mgt.common.notification.mgt.Notification;
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.beans.*;
|
import org.wso2.carbon.device.mgt.jaxrs.beans.*;
|
||||||
@ -312,4 +313,17 @@ public class RequestValidationUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void validatePaginationParameters(int offset, int limit) {
|
||||||
|
if (offset < 0) {
|
||||||
|
throw new InputValidationException(
|
||||||
|
new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage("Request parameter offset is s " +
|
||||||
|
"negative value.").build());
|
||||||
|
}
|
||||||
|
if (limit < 0) {
|
||||||
|
throw new InputValidationException(
|
||||||
|
new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage("Request parameter limit is a " +
|
||||||
|
"negative value.").build());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,6 +18,7 @@
|
|||||||
package org.wso2.carbon.device.mgt.core.config;
|
package org.wso2.carbon.device.mgt.core.config;
|
||||||
|
|
||||||
import org.wso2.carbon.device.mgt.core.config.identity.IdentityConfigurations;
|
import org.wso2.carbon.device.mgt.core.config.identity.IdentityConfigurations;
|
||||||
|
import org.wso2.carbon.device.mgt.core.config.pagination.PaginationConfiguration;
|
||||||
import org.wso2.carbon.device.mgt.core.config.policy.PolicyConfiguration;
|
import org.wso2.carbon.device.mgt.core.config.policy.PolicyConfiguration;
|
||||||
import org.wso2.carbon.device.mgt.core.config.task.TaskConfiguration;
|
import org.wso2.carbon.device.mgt.core.config.task.TaskConfiguration;
|
||||||
|
|
||||||
@ -37,6 +38,7 @@ public final class DeviceManagementConfig {
|
|||||||
private TaskConfiguration taskConfiguration;
|
private TaskConfiguration taskConfiguration;
|
||||||
private IdentityConfigurations identityConfigurations;
|
private IdentityConfigurations identityConfigurations;
|
||||||
private PolicyConfiguration policyConfiguration;
|
private PolicyConfiguration policyConfiguration;
|
||||||
|
private PaginationConfiguration paginationConfiguration;
|
||||||
private List<String> pushNotificationProviders;
|
private List<String> pushNotificationProviders;
|
||||||
|
|
||||||
|
|
||||||
@ -87,5 +89,14 @@ public final class DeviceManagementConfig {
|
|||||||
this.pushNotificationProviders = pushNotificationProviders;
|
this.pushNotificationProviders = pushNotificationProviders;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "PaginationConfiguration", required = true)
|
||||||
|
public PaginationConfiguration getPaginationConfiguration() {
|
||||||
|
return paginationConfiguration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPaginationConfiguration(PaginationConfiguration paginationConfiguration) {
|
||||||
|
this.paginationConfiguration = paginationConfiguration;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016, 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.core.config.pagination;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class represents the information related to Pagination configuration.
|
||||||
|
*/
|
||||||
|
@XmlRootElement(name = "PaginationConfiguration")
|
||||||
|
public class PaginationConfiguration {
|
||||||
|
|
||||||
|
private int deviceListPageSize;
|
||||||
|
private int operationListPageSize;
|
||||||
|
private int notificationListPageSize;
|
||||||
|
private int activityListPageSize;
|
||||||
|
|
||||||
|
public int getDeviceListPageSize() {
|
||||||
|
return deviceListPageSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "DeviceListPageSize", required = true)
|
||||||
|
public void setDeviceListPageSize(int deviceListPageSize) {
|
||||||
|
this.deviceListPageSize = deviceListPageSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getOperationListPageSize() {
|
||||||
|
return operationListPageSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "OperationListPageSize", required = true)
|
||||||
|
public void setOperationListPageSize(int operationListPageSize) {
|
||||||
|
this.operationListPageSize = operationListPageSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNotificationListPageSize() {
|
||||||
|
return notificationListPageSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "NotificationListPageSize", required = true)
|
||||||
|
public void setNotificationListPageSize(int notificationListPageSize) {
|
||||||
|
this.notificationListPageSize = notificationListPageSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getActivityListPageSize() {
|
||||||
|
return activityListPageSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "ActivityListPageSize", required = true)
|
||||||
|
public void setActivityListPageSize(int activityListPageSize) {
|
||||||
|
this.activityListPageSize = activityListPageSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -102,7 +102,7 @@ public class ApplicationMappingDAOImpl implements ApplicationMappingDAO {
|
|||||||
Connection conn;
|
Connection conn;
|
||||||
PreparedStatement stmt = null;
|
PreparedStatement stmt = null;
|
||||||
try {
|
try {
|
||||||
String sql = "DELETE DM_DEVICE_APPLICATION_MAPPING WHERE DEVICE_ID = ? AND " +
|
String sql = "DELETE FROM DM_DEVICE_APPLICATION_MAPPING WHERE DEVICE_ID = ? AND " +
|
||||||
"APPLICATION_ID = ? AND TENANT_ID = ?";
|
"APPLICATION_ID = ? AND TENANT_ID = ?";
|
||||||
|
|
||||||
conn = this.getConnection();
|
conn = this.getConnection();
|
||||||
@ -114,7 +114,7 @@ public class ApplicationMappingDAOImpl implements ApplicationMappingDAO {
|
|||||||
stmt.execute();
|
stmt.execute();
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw new DeviceManagementDAOException("Error occurred while adding device application mapping", e);
|
throw new DeviceManagementDAOException("Error occurred while removing device application mapping", e);
|
||||||
} finally {
|
} finally {
|
||||||
DeviceManagementDAOUtil.cleanupResources(stmt, null);
|
DeviceManagementDAOUtil.cleanupResources(stmt, null);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -129,7 +129,7 @@ public class EnrollmentDAOImpl implements EnrollmentDAO {
|
|||||||
int status = -1;
|
int status = -1;
|
||||||
try {
|
try {
|
||||||
conn = this.getConnection();
|
conn = this.getConnection();
|
||||||
String sql = "DELETE DM_ENROLMENT WHERE DEVICE_ID = ? AND OWNER = ? AND TENANT_ID = ?";
|
String sql = "DELETE FROM DM_ENROLMENT WHERE DEVICE_ID = ? AND OWNER = ? AND TENANT_ID = ?";
|
||||||
stmt = conn.prepareStatement(sql, new String[] {"id"});
|
stmt = conn.prepareStatement(sql, new String[] {"id"});
|
||||||
stmt.setInt(1, deviceId);
|
stmt.setInt(1, deviceId);
|
||||||
stmt.setString(2, currentOwner);
|
stmt.setString(2, currentOwner);
|
||||||
|
|||||||
@ -35,6 +35,7 @@ import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory;
|
|||||||
import org.wso2.carbon.device.mgt.core.notification.mgt.dao.NotificationDAO;
|
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.NotificationManagementDAOFactory;
|
||||||
import org.wso2.carbon.device.mgt.core.notification.mgt.dao.util.NotificationDAOUtil;
|
import org.wso2.carbon.device.mgt.core.notification.mgt.dao.util.NotificationDAOUtil;
|
||||||
|
import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -177,6 +178,7 @@ public class NotificationManagementServiceImpl implements NotificationManagement
|
|||||||
public PaginationResult getAllNotifications(PaginationRequest request) throws NotificationManagementException {
|
public PaginationResult getAllNotifications(PaginationRequest request) throws NotificationManagementException {
|
||||||
PaginationResult paginationResult = new PaginationResult();
|
PaginationResult paginationResult = new PaginationResult();
|
||||||
List<Notification> notifications = new ArrayList<>();
|
List<Notification> notifications = new ArrayList<>();
|
||||||
|
request = DeviceManagerUtil.validateNotificationListPageSize(request);
|
||||||
int count =0;
|
int count =0;
|
||||||
try {
|
try {
|
||||||
NotificationManagementDAOFactory.openConnection();
|
NotificationManagementDAOFactory.openConnection();
|
||||||
@ -199,6 +201,7 @@ public class NotificationManagementServiceImpl implements NotificationManagement
|
|||||||
PaginationRequest request) throws NotificationManagementException{
|
PaginationRequest request) throws NotificationManagementException{
|
||||||
PaginationResult paginationResult = new PaginationResult();
|
PaginationResult paginationResult = new PaginationResult();
|
||||||
List<Notification> notifications = new ArrayList<>();
|
List<Notification> notifications = new ArrayList<>();
|
||||||
|
request = DeviceManagerUtil.validateNotificationListPageSize(request);
|
||||||
int count =0;
|
int count =0;
|
||||||
try {
|
try {
|
||||||
NotificationManagementDAOFactory.openConnection();
|
NotificationManagementDAOFactory.openConnection();
|
||||||
|
|||||||
@ -508,6 +508,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|||||||
int count = 0;
|
int count = 0;
|
||||||
int tenantId = this.getTenantId();
|
int tenantId = this.getTenantId();
|
||||||
String deviceType = request.getDeviceType();
|
String deviceType = request.getDeviceType();
|
||||||
|
request = DeviceManagerUtil.validateDeviceListPageSize(request);
|
||||||
try {
|
try {
|
||||||
DeviceManagementDAOFactory.openConnection();
|
DeviceManagementDAOFactory.openConnection();
|
||||||
allDevices = deviceDAO.getDevices(request, tenantId);
|
allDevices = deviceDAO.getDevices(request, tenantId);
|
||||||
@ -569,6 +570,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|||||||
List<Device> allDevices = new ArrayList<>();
|
List<Device> allDevices = new ArrayList<>();
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int tenantId = this.getTenantId();
|
int tenantId = this.getTenantId();
|
||||||
|
request = DeviceManagerUtil.validateDeviceListPageSize(request);
|
||||||
try {
|
try {
|
||||||
DeviceManagementDAOFactory.openConnection();
|
DeviceManagementDAOFactory.openConnection();
|
||||||
allDevices = deviceDAO.getDevices(request, tenantId);
|
allDevices = deviceDAO.getDevices(request, tenantId);
|
||||||
@ -1031,6 +1033,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|||||||
@Override
|
@Override
|
||||||
public PaginationResult getOperations(DeviceIdentifier deviceId, PaginationRequest request)
|
public PaginationResult getOperations(DeviceIdentifier deviceId, PaginationRequest request)
|
||||||
throws OperationManagementException {
|
throws OperationManagementException {
|
||||||
|
request = DeviceManagerUtil.validateOperationListPageSize(request);
|
||||||
return pluginRepository.getOperationManager(deviceId.getType(), this.getTenantId())
|
return pluginRepository.getOperationManager(deviceId.getType(), this.getTenantId())
|
||||||
.getOperations(deviceId, request);
|
.getOperations(deviceId, request);
|
||||||
}
|
}
|
||||||
@ -1091,6 +1094,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Activity> getActivitiesUpdatedAfter(long timestamp, int limit, int offset) throws OperationManagementException {
|
public List<Activity> getActivitiesUpdatedAfter(long timestamp, int limit, int offset) throws OperationManagementException {
|
||||||
|
limit = DeviceManagerUtil.validateActivityListPageSize(limit);
|
||||||
return DeviceManagementDataHolder.getInstance().getOperationManager().getActivitiesUpdatedAfter(timestamp, limit, offset);
|
return DeviceManagementDataHolder.getInstance().getOperationManager().getActivitiesUpdatedAfter(timestamp, limit, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1176,6 +1180,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|||||||
String username = request.getOwner();
|
String username = request.getOwner();
|
||||||
List<Device> devices = new ArrayList<>();
|
List<Device> devices = new ArrayList<>();
|
||||||
List<Device> userDevices = new ArrayList<>();
|
List<Device> userDevices = new ArrayList<>();
|
||||||
|
request = DeviceManagerUtil.validateDeviceListPageSize(request);
|
||||||
try {
|
try {
|
||||||
DeviceManagementDAOFactory.openConnection();
|
DeviceManagementDAOFactory.openConnection();
|
||||||
userDevices = deviceDAO.getDevicesOfUser(request, tenantId);
|
userDevices = deviceDAO.getDevicesOfUser(request, tenantId);
|
||||||
@ -1253,6 +1258,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|||||||
int deviceCount = 0;
|
int deviceCount = 0;
|
||||||
int tenantId = this.getTenantId();
|
int tenantId = this.getTenantId();
|
||||||
String ownerShip = request.getOwnership();
|
String ownerShip = request.getOwnership();
|
||||||
|
request = DeviceManagerUtil.validateDeviceListPageSize(request);
|
||||||
try {
|
try {
|
||||||
DeviceManagementDAOFactory.openConnection();
|
DeviceManagementDAOFactory.openConnection();
|
||||||
allDevices = deviceDAO.getDevicesByOwnership(request, tenantId);
|
allDevices = deviceDAO.getDevicesByOwnership(request, tenantId);
|
||||||
@ -1412,6 +1418,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|||||||
public List<Device> getDevicesByNameAndType(String deviceName, String type, int offset, int limit) throws DeviceManagementException {
|
public List<Device> getDevicesByNameAndType(String deviceName, String type, int offset, int limit) throws DeviceManagementException {
|
||||||
List<Device> devices = new ArrayList<>();
|
List<Device> devices = new ArrayList<>();
|
||||||
List<Device> allDevices;
|
List<Device> allDevices;
|
||||||
|
limit = DeviceManagerUtil.validateDeviceListPageSize(limit);
|
||||||
try {
|
try {
|
||||||
DeviceManagementDAOFactory.openConnection();
|
DeviceManagementDAOFactory.openConnection();
|
||||||
allDevices = deviceDAO.getDevicesByNameAndType(deviceName, type, this.getTenantId(), offset, limit);
|
allDevices = deviceDAO.getDevicesByNameAndType(deviceName, type, this.getTenantId(), offset, limit);
|
||||||
@ -1474,6 +1481,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|||||||
List<Device> devices = new ArrayList<>();
|
List<Device> devices = new ArrayList<>();
|
||||||
List<Device> allDevices = new ArrayList<>();
|
List<Device> allDevices = new ArrayList<>();
|
||||||
String deviceName = request.getDeviceName();
|
String deviceName = request.getDeviceName();
|
||||||
|
request = DeviceManagerUtil.validateDeviceListPageSize(request);
|
||||||
try {
|
try {
|
||||||
DeviceManagementDAOFactory.openConnection();
|
DeviceManagementDAOFactory.openConnection();
|
||||||
allDevices = deviceDAO.getDevicesByName(request, tenantId);
|
allDevices = deviceDAO.getDevicesByName(request, tenantId);
|
||||||
@ -1636,6 +1644,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|||||||
List<Device> allDevices = new ArrayList<>();
|
List<Device> allDevices = new ArrayList<>();
|
||||||
int tenantId = this.getTenantId();
|
int tenantId = this.getTenantId();
|
||||||
String status = request.getStatus();
|
String status = request.getStatus();
|
||||||
|
request = DeviceManagerUtil.validateDeviceListPageSize(request);
|
||||||
try {
|
try {
|
||||||
DeviceManagementDAOFactory.openConnection();
|
DeviceManagementDAOFactory.openConnection();
|
||||||
allDevices = deviceDAO.getDevicesByStatus(request, tenantId);
|
allDevices = deviceDAO.getDevicesByStatus(request, tenantId);
|
||||||
|
|||||||
@ -21,10 +21,11 @@ import org.apache.commons.logging.Log;
|
|||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.wso2.carbon.base.MultitenantConstants;
|
import org.wso2.carbon.base.MultitenantConstants;
|
||||||
import org.wso2.carbon.device.mgt.common.Device;
|
import org.wso2.carbon.device.mgt.common.*;
|
||||||
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException;
|
||||||
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
|
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
|
||||||
import org.wso2.carbon.device.mgt.common.TransactionManagementException;
|
import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager;
|
||||||
|
import org.wso2.carbon.device.mgt.core.config.DeviceManagementConfig;
|
||||||
import org.wso2.carbon.device.mgt.core.config.datasource.DataSourceConfig;
|
import org.wso2.carbon.device.mgt.core.config.datasource.DataSourceConfig;
|
||||||
import org.wso2.carbon.device.mgt.core.config.datasource.JNDILookupDefinition;
|
import org.wso2.carbon.device.mgt.core.config.datasource.JNDILookupDefinition;
|
||||||
import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException;
|
import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException;
|
||||||
@ -241,4 +242,79 @@ public final class DeviceManagerUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int validateActivityListPageSize(int limit) throws OperationManagementException {
|
||||||
|
if (limit == 0) {
|
||||||
|
DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance().
|
||||||
|
getDeviceManagementConfig();
|
||||||
|
if (deviceManagementConfig != null) {
|
||||||
|
return deviceManagementConfig.getPaginationConfiguration().getActivityListPageSize();
|
||||||
|
} else {
|
||||||
|
throw new OperationManagementException("Device-Mgt configuration has not initialized. Please check the " +
|
||||||
|
"cdm-config.xml file.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PaginationRequest validateOperationListPageSize(PaginationRequest paginationRequest) throws
|
||||||
|
OperationManagementException {
|
||||||
|
if (paginationRequest.getRowCount() == 0) {
|
||||||
|
DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance().
|
||||||
|
getDeviceManagementConfig();
|
||||||
|
if (deviceManagementConfig != null) {
|
||||||
|
paginationRequest.setRowCount(deviceManagementConfig.getPaginationConfiguration().
|
||||||
|
getOperationListPageSize());
|
||||||
|
} else {
|
||||||
|
throw new OperationManagementException("Device-Mgt configuration has not initialized. Please check the " +
|
||||||
|
"cdm-config.xml file.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return paginationRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PaginationRequest validateNotificationListPageSize(PaginationRequest paginationRequest) throws
|
||||||
|
NotificationManagementException {
|
||||||
|
if (paginationRequest.getRowCount() == 0) {
|
||||||
|
DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance().
|
||||||
|
getDeviceManagementConfig();
|
||||||
|
if (deviceManagementConfig != null) {
|
||||||
|
paginationRequest.setRowCount(deviceManagementConfig.getPaginationConfiguration().
|
||||||
|
getNotificationListPageSize());
|
||||||
|
} else {
|
||||||
|
throw new NotificationManagementException("Device-Mgt configuration has not initialized. Please check the " +
|
||||||
|
"cdm-config.xml file.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return paginationRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PaginationRequest validateDeviceListPageSize(PaginationRequest paginationRequest) throws
|
||||||
|
DeviceManagementException {
|
||||||
|
if (paginationRequest.getRowCount() == 0) {
|
||||||
|
DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance().
|
||||||
|
getDeviceManagementConfig();
|
||||||
|
if (deviceManagementConfig != null) {
|
||||||
|
paginationRequest.setRowCount(deviceManagementConfig.getPaginationConfiguration().
|
||||||
|
getDeviceListPageSize());
|
||||||
|
} else {
|
||||||
|
throw new DeviceManagementException("Device-Mgt configuration has not initialized. Please check the " +
|
||||||
|
"cdm-config.xml file.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return paginationRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int validateDeviceListPageSize(int limit) throws DeviceManagementException {
|
||||||
|
if (limit == 0) {
|
||||||
|
DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance().
|
||||||
|
getDeviceManagementConfig();
|
||||||
|
if (deviceManagementConfig != null) {
|
||||||
|
return deviceManagementConfig.getPaginationConfiguration().getDeviceListPageSize();
|
||||||
|
} else {
|
||||||
|
throw new DeviceManagementException("Device-Mgt configuration has not initialized. Please check the " +
|
||||||
|
"cdm-config.xml file.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return limit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,123 +16,119 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
var operationModule = function () {
|
||||||
@Deprecated New
|
var log = new Log("/app/modules/business-controllers/operation.js");
|
||||||
*/
|
var utility = require('/app/modules/utility.js').utility;
|
||||||
|
var constants = require('/app/modules/constants.js');
|
||||||
|
var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
|
||||||
|
var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"];
|
||||||
|
|
||||||
//var operationModule = function () {
|
var publicMethods = {};
|
||||||
// var log = new Log("/app/modules/business-controllers/operation.js");
|
var privateMethods = {};
|
||||||
// var utility = require('/app/modules/utility.js').utility;
|
|
||||||
// var constants = require('/app/modules/constants.js');
|
/**
|
||||||
// var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
|
* This method reads the token from the Token client and return the access token.
|
||||||
// var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"];
|
* If the token pair s not set in the session this will send a redirect to the login page.
|
||||||
//
|
*/
|
||||||
// var publicMethods = {};
|
function getAccessToken(deviceType, owner, deviceId) {
|
||||||
// var privateMethods = {};
|
var TokenClient = Packages.org.wso2.carbon.device.mgt.iot.apimgt.TokenClient;
|
||||||
//
|
var accessTokenClient = new TokenClient(deviceType);
|
||||||
// /**
|
var accessTokenInfo = accessTokenClient.getAccessToken(owner, deviceId);
|
||||||
// * This method reads the token from the Token client and return the access token.
|
return accessTokenInfo.getAccess_token();
|
||||||
// * If the token pair s not set in the session this will send a redirect to the login page.
|
}
|
||||||
// */
|
|
||||||
// function getAccessToken(deviceType, owner, deviceId) {
|
privateMethods.getOperationsFromFeatures = function (deviceType, operationType) {
|
||||||
// var TokenClient = Packages.org.wso2.carbon.device.mgt.iot.apimgt.TokenClient;
|
var url = devicemgtProps["httpsURL"] + constants.ADMIN_SERVICE_CONTEXT + "/features/" + deviceType;
|
||||||
// var accessTokenClient = new TokenClient(deviceType);
|
var featuresList = serviceInvokers.XMLHttp.get(url, function (responsePayload) {
|
||||||
// var accessTokenInfo = accessTokenClient.getAccessToken(owner, deviceId);
|
var features = responsePayload;
|
||||||
// return accessTokenInfo.getAccess_token();
|
var featureList = [];
|
||||||
// }
|
var feature;
|
||||||
//
|
for (var i = 0; i < features.length; i++) {
|
||||||
// privateMethods.getOperationsFromFeatures = function (deviceType, operationType) {
|
feature = {};
|
||||||
// var url = devicemgtProps["httpsURL"] + constants.ADMIN_SERVICE_CONTEXT + "/features/" + deviceType;
|
var analyticStreams = utility.getDeviceTypeConfig(deviceType)["analyticStreams"];
|
||||||
// var featuresList = serviceInvokers.XMLHttp.get(url, function (responsePayload) {
|
if (analyticStreams) {
|
||||||
// var features = responsePayload;
|
for (var stream in analyticStreams) {
|
||||||
// var featureList = [];
|
if (analyticStreams[stream].name == features[i].name) {
|
||||||
// var feature;
|
feature.ui_unit = analyticStreams[stream].ui_unit;
|
||||||
// for (var i = 0; i < features.length; i++) {
|
break;
|
||||||
// feature = {};
|
}
|
||||||
// var analyticStreams = utility.getDeviceTypeConfig(deviceType)["analyticStreams"];
|
}
|
||||||
// if (analyticStreams) {
|
}
|
||||||
// for (var stream in analyticStreams) {
|
|
||||||
// if (analyticStreams[stream].name == features[i].name) {
|
feature["operation"] = features[i].code;
|
||||||
// feature.ui_unit = analyticStreams[stream].ui_unit;
|
feature["name"] = features[i].name;
|
||||||
// break;
|
feature["description"] = features[i].description;
|
||||||
// }
|
feature["deviceType"] = deviceType;
|
||||||
// }
|
feature["params"] = [];
|
||||||
// }
|
var metaData = features[i].metadataEntries;
|
||||||
//
|
if (metaData) {
|
||||||
// feature["operation"] = features[i].code;
|
for (var j = 0; j < metaData.length; j++) {
|
||||||
// feature["name"] = features[i].name;
|
feature["params"].push(metaData[j].value);
|
||||||
// feature["description"] = features[i].description;
|
}
|
||||||
// feature["deviceType"] = deviceType;
|
featureList.push(feature);
|
||||||
// feature["params"] = [];
|
}
|
||||||
// var metaData = features[i].metadataEntries;
|
}
|
||||||
// if (metaData) {
|
return featureList;
|
||||||
// for (var j = 0; j < metaData.length; j++) {
|
}, function (responsePayload) {
|
||||||
// feature["params"].push(metaData[j].value);
|
var response = {};
|
||||||
// }
|
response["status"] = "error";
|
||||||
// featureList.push(feature);
|
return response;
|
||||||
// }
|
}
|
||||||
// }
|
);
|
||||||
// return featureList;
|
return featuresList;
|
||||||
// }, function (responsePayload) {
|
};
|
||||||
// var response = {};
|
|
||||||
// response["status"] = "error";
|
publicMethods.getControlOperations = function (deviceType) {
|
||||||
// return response;
|
var operations = privateMethods.getOperationsFromFeatures(deviceType, "operation");
|
||||||
// }
|
for (var op in operations) {
|
||||||
// );
|
var iconPath = utility.getOperationIcon(deviceType, operations[op].operation);
|
||||||
// return featuresList;
|
if (iconPath) {
|
||||||
// };
|
operations[op]["icon"] = iconPath;
|
||||||
//
|
}
|
||||||
// publicMethods.getControlOperations = function (deviceType) {
|
}
|
||||||
// var operations = privateMethods.getOperationsFromFeatures(deviceType, "operation");
|
return operations;
|
||||||
// for (var op in operations) {
|
};
|
||||||
// var iconPath = utility.getOperationIcon(deviceType, operations[op].operation);
|
|
||||||
// if (iconPath) {
|
publicMethods.getMonitorOperations = function (deviceType) {
|
||||||
// operations[op]["icon"] = iconPath;
|
return privateMethods.getOperationsFromFeatures(deviceType, "monitor");
|
||||||
// }
|
};
|
||||||
// }
|
|
||||||
// return operations;
|
publicMethods.handlePOSTOperation = function (deviceType, operation, deviceId, params) {
|
||||||
// };
|
var user = session.get(constants.USER_SESSION_KEY);
|
||||||
//
|
var endPoint = devicemgtProps["httpsURL"] + '/' + deviceType + "/controller/" + operation;
|
||||||
// publicMethods.getMonitorOperations = function (deviceType) {
|
var header = '{"owner":"' + user.username + '","deviceId":"' + deviceId +
|
||||||
// return privateMethods.getOperationsFromFeatures(deviceType, "monitor");
|
'","protocol":"mqtt", "sessionId":"' + session.getId() + '", "' +
|
||||||
// };
|
constants.AUTHORIZATION_HEADER + '":"' + constants.BEARER_PREFIX +
|
||||||
//
|
getAccessToken(deviceType, user.username, deviceId) + '"}';
|
||||||
// publicMethods.handlePOSTOperation = function (deviceType, operation, deviceId, params) {
|
return post(endPoint, params, JSON.parse(header), "json");
|
||||||
// var user = session.get(constants.USER_SESSION_KEY);
|
};
|
||||||
// var endPoint = devicemgtProps["httpsURL"] + '/' + deviceType + "/controller/" + operation;
|
|
||||||
// var header = '{"owner":"' + user.username + '","deviceId":"' + deviceId +
|
publicMethods.handleGETOperation = function (deviceType, operation, operationName, deviceId) {
|
||||||
// '","protocol":"mqtt", "sessionId":"' + session.getId() + '", "' +
|
var user = session.get(constants.USER_SESSION_KEY);
|
||||||
// constants.AUTHORIZATION_HEADER + '":"' + constants.BEARER_PREFIX +
|
var endPoint = devicemgtProps["httpsURL"] + '/' + deviceType + "/controller/" + operation;
|
||||||
// getAccessToken(deviceType, user.username, deviceId) + '"}';
|
var header = '{"owner":"' + user.username + '","deviceId":"' + deviceId +
|
||||||
// return post(endPoint, params, JSON.parse(header), "json");
|
'","protocol":"mqtt", "' + constants.AUTHORIZATION_HEADER + '":"' +
|
||||||
// };
|
constants.BEARER_PREFIX + getAccessToken(deviceType, user.username, deviceId) +
|
||||||
//
|
'"}';
|
||||||
// publicMethods.handleGETOperation = function (deviceType, operation, operationName, deviceId) {
|
var result = get(endPoint, {}, JSON.parse(header), "json");
|
||||||
// var user = session.get(constants.USER_SESSION_KEY);
|
if (result.data) {
|
||||||
// var endPoint = devicemgtProps["httpsURL"] + '/' + deviceType + "/controller/" + operation;
|
var values = result.data.sensorValue.split(',');
|
||||||
// var header = '{"owner":"' + user.username + '","deviceId":"' + deviceId +
|
if (operationName == 'gps') {
|
||||||
// '","protocol":"mqtt", "' + constants.AUTHORIZATION_HEADER + '":"' +
|
result.data.map = {
|
||||||
// constants.BEARER_PREFIX + getAccessToken(deviceType, user.username, deviceId) +
|
lat: parseFloat(values[0]),
|
||||||
// '"}';
|
lng: parseFloat(values[1])
|
||||||
// var result = get(endPoint, {}, JSON.parse(header), "json");
|
}
|
||||||
// if (result.data) {
|
} else {
|
||||||
// var values = result.data.sensorValue.split(',');
|
var sqSum = 0;
|
||||||
// if (operationName == 'gps') {
|
for (var v in values) {
|
||||||
// result.data.map = {
|
sqSum += Math.pow(values[v], 2);
|
||||||
// lat: parseFloat(values[0]),
|
}
|
||||||
// lng: parseFloat(values[1])
|
result.data[operationName] = Math.sqrt(sqSum);
|
||||||
// }
|
}
|
||||||
// } else {
|
delete result.data['sensorValue'];
|
||||||
// var sqSum = 0;
|
}
|
||||||
// for (var v in values) {
|
return result;
|
||||||
// sqSum += Math.pow(values[v], 2);
|
};
|
||||||
// }
|
|
||||||
// result.data[operationName] = Math.sqrt(sqSum);
|
return publicMethods;
|
||||||
// }
|
}();
|
||||||
// delete result.data['sensorValue'];
|
|
||||||
// }
|
|
||||||
// return result;
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// return publicMethods;
|
|
||||||
//}();
|
|
||||||
@ -37,6 +37,12 @@ var conf = function () {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
if (conf.generalConfig.host) {
|
||||||
|
//TODO: Move enrollment URL into app-conf.json
|
||||||
|
var enrollmentHost = conf.generalConfig.host.replace(/https:\/\/localhost(:\d+)?/, conf.httpsURL).replace(
|
||||||
|
/http:\/\/localhost(:\d+)?/, conf.httpURL);
|
||||||
|
conf.enrollmentUrl = enrollmentHost + conf.enrollmentDir;
|
||||||
|
}
|
||||||
application.put("CONF", conf);
|
application.put("CONF", conf);
|
||||||
}
|
}
|
||||||
return conf;
|
return conf;
|
||||||
|
|||||||
@ -27,8 +27,8 @@
|
|||||||
</ManagementRepository>
|
</ManagementRepository>
|
||||||
<PushNotificationProviders>
|
<PushNotificationProviders>
|
||||||
<Provider>org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm.GCMBasedPushNotificationProvider</Provider>
|
<Provider>org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm.GCMBasedPushNotificationProvider</Provider>
|
||||||
<Provider>org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.MQTTBasedPushNotificationProvider</Provider>
|
<!--<Provider>org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.MQTTBasedPushNotificationProvider</Provider>-->
|
||||||
<Provider>org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.XMPPBasedPushNotificationProvider</Provider>
|
<!--<Provider>org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.XMPPBasedPushNotificationProvider</Provider>-->
|
||||||
</PushNotificationProviders>
|
</PushNotificationProviders>
|
||||||
<IdentityConfiguration>
|
<IdentityConfiguration>
|
||||||
<ServerUrl>https://localhost:9443</ServerUrl>
|
<ServerUrl>https://localhost:9443</ServerUrl>
|
||||||
@ -37,14 +37,14 @@
|
|||||||
</IdentityConfiguration>
|
</IdentityConfiguration>
|
||||||
<PolicyConfiguration>
|
<PolicyConfiguration>
|
||||||
<MonitoringClass>org.wso2.carbon.policy.mgt</MonitoringClass>
|
<MonitoringClass>org.wso2.carbon.policy.mgt</MonitoringClass>
|
||||||
<MonitoringEnable>false</MonitoringEnable>
|
<MonitoringEnable>true</MonitoringEnable>
|
||||||
<MonitoringFrequency>60000</MonitoringFrequency>
|
<MonitoringFrequency>60000</MonitoringFrequency>
|
||||||
<MaxRetries>5</MaxRetries>
|
<MaxRetries>5</MaxRetries>
|
||||||
<MinRetriesToMarkUnreachable>8</MinRetriesToMarkUnreachable>
|
<MinRetriesToMarkUnreachable>8</MinRetriesToMarkUnreachable>
|
||||||
<MinRetriesToMarkInactive>20</MinRetriesToMarkInactive>
|
<MinRetriesToMarkInactive>20</MinRetriesToMarkInactive>
|
||||||
</PolicyConfiguration>
|
</PolicyConfiguration>
|
||||||
<TaskConfiguration>
|
<TaskConfiguration>
|
||||||
<Enable>false</Enable>
|
<Enable>true</Enable>
|
||||||
<Frequency>600000</Frequency>
|
<Frequency>600000</Frequency>
|
||||||
<TaskClass>org.wso2.carbon.device.mgt.core.task.impl.DeviceDetailsRetrieverTask</TaskClass>
|
<TaskClass>org.wso2.carbon.device.mgt.core.task.impl.DeviceDetailsRetrieverTask</TaskClass>
|
||||||
<Operations>
|
<Operations>
|
||||||
@ -62,5 +62,11 @@
|
|||||||
</Operation>
|
</Operation>
|
||||||
</Operations>
|
</Operations>
|
||||||
</TaskConfiguration>
|
</TaskConfiguration>
|
||||||
|
<PaginationConfiguration>
|
||||||
|
<DeviceListPageSize>20</DeviceListPageSize>
|
||||||
|
<NotificationListPageSize>20</NotificationListPageSize>
|
||||||
|
<ActivityListPageSize>20</ActivityListPageSize>
|
||||||
|
<OperationListPageSize>20</OperationListPageSize>
|
||||||
|
</PaginationConfiguration>
|
||||||
</DeviceMgtConfiguration>
|
</DeviceMgtConfiguration>
|
||||||
|
|
||||||
|
|||||||
@ -134,7 +134,7 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE (
|
|||||||
ID INT NOT NULL AUTO_INCREMENT ,
|
ID INT NOT NULL AUTO_INCREMENT ,
|
||||||
PROFILE_NAME VARCHAR(45) NOT NULL ,
|
PROFILE_NAME VARCHAR(45) NOT NULL ,
|
||||||
TENANT_ID INT NOT NULL ,
|
TENANT_ID INT NOT NULL ,
|
||||||
DEVICE_TYPE VARCHAR(20) NOT NULL ,
|
DEVICE_TYPE VARCHAR(300) NOT NULL ,
|
||||||
CREATED_TIME DATETIME NOT NULL ,
|
CREATED_TIME DATETIME NOT NULL ,
|
||||||
UPDATED_TIME DATETIME NOT NULL ,
|
UPDATED_TIME DATETIME NOT NULL ,
|
||||||
PRIMARY KEY (ID) ,
|
PRIMARY KEY (ID) ,
|
||||||
@ -195,7 +195,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY (
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY (
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY (
|
||||||
ID INT(11) NOT NULL ,
|
ID INT(11) NOT NULL ,
|
||||||
DEVICE_TYPE VARCHAR(20) NOT NULL ,
|
DEVICE_TYPE VARCHAR(300) NOT NULL ,
|
||||||
POLICY_ID INT(11) NOT NULL ,
|
POLICY_ID INT(11) NOT NULL ,
|
||||||
PRIMARY KEY (ID) ,
|
PRIMARY KEY (ID) ,
|
||||||
CONSTRAINT FK_DEVICE_TYPE_POLICY
|
CONSTRAINT FK_DEVICE_TYPE_POLICY
|
||||||
@ -218,7 +218,7 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE_FEATURES (
|
|||||||
ID INT(11) NOT NULL AUTO_INCREMENT,
|
ID INT(11) NOT NULL AUTO_INCREMENT,
|
||||||
PROFILE_ID INT(11) NOT NULL,
|
PROFILE_ID INT(11) NOT NULL,
|
||||||
FEATURE_CODE VARCHAR(100) NOT NULL,
|
FEATURE_CODE VARCHAR(100) NOT NULL,
|
||||||
DEVICE_TYPE VARCHAR(20) NOT NULL,
|
DEVICE_TYPE VARCHAR(300) NOT NULL,
|
||||||
TENANT_ID INT(11) NOT NULL ,
|
TENANT_ID INT(11) NOT NULL ,
|
||||||
CONTENT BLOB NULL DEFAULT NULL,
|
CONTENT BLOB NULL DEFAULT NULL,
|
||||||
PRIMARY KEY (ID),
|
PRIMARY KEY (ID),
|
||||||
@ -339,7 +339,7 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_STATUS (
|
|||||||
CREATE TABLE IF NOT EXISTS DM_POLICY_CHANGE_MGT (
|
CREATE TABLE IF NOT EXISTS DM_POLICY_CHANGE_MGT (
|
||||||
ID INT NOT NULL AUTO_INCREMENT,
|
ID INT NOT NULL AUTO_INCREMENT,
|
||||||
POLICY_ID INT NOT NULL,
|
POLICY_ID INT NOT NULL,
|
||||||
DEVICE_TYPE VARCHAR(20) NOT NULL,
|
DEVICE_TYPE VARCHAR(300) NOT NULL ,
|
||||||
TENANT_ID INT(11) NOT NULL,
|
TENANT_ID INT(11) NOT NULL,
|
||||||
PRIMARY KEY (ID)
|
PRIMARY KEY (ID)
|
||||||
);
|
);
|
||||||
|
|||||||
@ -135,13 +135,13 @@ CREATE TABLE DM_PROFILE (
|
|||||||
ID INTEGER NOT NULL IDENTITY ,
|
ID INTEGER NOT NULL IDENTITY ,
|
||||||
PROFILE_NAME VARCHAR(45) NOT NULL ,
|
PROFILE_NAME VARCHAR(45) NOT NULL ,
|
||||||
TENANT_ID INTEGER NOT NULL ,
|
TENANT_ID INTEGER NOT NULL ,
|
||||||
DEVICE_TYPE_ID INTEGER NOT NULL ,
|
DEVICE_TYPE VARCHAR(300) NOT NULL ,
|
||||||
CREATED_TIME DATETIME2(0) NOT NULL ,
|
CREATED_TIME DATETIME2(0) NOT NULL ,
|
||||||
UPDATED_TIME DATETIME2(0) NOT NULL ,
|
UPDATED_TIME DATETIME2(0) NOT NULL ,
|
||||||
PRIMARY KEY (ID) ,
|
PRIMARY KEY (ID) ,
|
||||||
CONSTRAINT DM_PROFILE_DEVICE_TYPE
|
CONSTRAINT DM_PROFILE_DEVICE_TYPE
|
||||||
FOREIGN KEY (DEVICE_TYPE_ID )
|
FOREIGN KEY (DEVICE_TYPE)
|
||||||
REFERENCES DM_DEVICE_TYPE (ID )
|
REFERENCES DM_DEVICE_TYPE (NAME )
|
||||||
ON DELETE NO ACTION
|
ON DELETE NO ACTION
|
||||||
ON UPDATE NO ACTION
|
ON UPDATE NO ACTION
|
||||||
);
|
);
|
||||||
@ -196,7 +196,7 @@ CREATE TABLE DM_DEVICE_POLICY (
|
|||||||
|
|
||||||
CREATE TABLE DM_DEVICE_TYPE_POLICY (
|
CREATE TABLE DM_DEVICE_TYPE_POLICY (
|
||||||
ID INTEGER NOT NULL ,
|
ID INTEGER NOT NULL ,
|
||||||
DEVICE_TYPE_ID INTEGER NOT NULL ,
|
DEVICE_TYPE VARCHAR(300) NOT NULL ,
|
||||||
POLICY_ID INTEGER NOT NULL ,
|
POLICY_ID INTEGER NOT NULL ,
|
||||||
PRIMARY KEY (ID) ,
|
PRIMARY KEY (ID) ,
|
||||||
CONSTRAINT FK_DEVICE_TYPE_POLICY
|
CONSTRAINT FK_DEVICE_TYPE_POLICY
|
||||||
@ -205,8 +205,8 @@ CREATE TABLE DM_DEVICE_TYPE_POLICY (
|
|||||||
ON DELETE NO ACTION
|
ON DELETE NO ACTION
|
||||||
ON UPDATE NO ACTION,
|
ON UPDATE NO ACTION,
|
||||||
CONSTRAINT FK_DEVICE_TYPE_POLICY_DEVICE_TYPE
|
CONSTRAINT FK_DEVICE_TYPE_POLICY_DEVICE_TYPE
|
||||||
FOREIGN KEY (DEVICE_TYPE_ID )
|
FOREIGN KEY (DEVICE_TYPE)
|
||||||
REFERENCES DM_DEVICE_TYPE (ID )
|
REFERENCES DM_DEVICE_TYPE (NAME )
|
||||||
ON DELETE NO ACTION
|
ON DELETE NO ACTION
|
||||||
ON UPDATE NO ACTION
|
ON UPDATE NO ACTION
|
||||||
);
|
);
|
||||||
@ -219,7 +219,7 @@ CREATE TABLE DM_PROFILE_FEATURES (
|
|||||||
ID INTEGER NOT NULL IDENTITY,
|
ID INTEGER NOT NULL IDENTITY,
|
||||||
PROFILE_ID INTEGER NOT NULL,
|
PROFILE_ID INTEGER NOT NULL,
|
||||||
FEATURE_CODE VARCHAR(100) NOT NULL,
|
FEATURE_CODE VARCHAR(100) NOT NULL,
|
||||||
DEVICE_TYPE_ID INTEGER NOT NULL,
|
DEVICE_TYPE VARCHAR(300) NOT NULL ,
|
||||||
TENANT_ID INTEGER NOT NULL ,
|
TENANT_ID INTEGER NOT NULL ,
|
||||||
CONTENT VARBINARY(max) NULL DEFAULT NULL,
|
CONTENT VARBINARY(max) NULL DEFAULT NULL,
|
||||||
PRIMARY KEY (ID),
|
PRIMARY KEY (ID),
|
||||||
@ -340,7 +340,7 @@ CREATE TABLE DM_POLICY_COMPLIANCE_STATUS (
|
|||||||
CREATE TABLE DM_POLICY_CHANGE_MGT (
|
CREATE TABLE DM_POLICY_CHANGE_MGT (
|
||||||
ID INTEGER NOT NULL IDENTITY,
|
ID INTEGER NOT NULL IDENTITY,
|
||||||
POLICY_ID INTEGER NOT NULL,
|
POLICY_ID INTEGER NOT NULL,
|
||||||
DEVICE_TYPE_ID INTEGER NOT NULL,
|
DEVICE_TYPE VARCHAR(300) NOT NULL,
|
||||||
TENANT_ID INTEGER NOT NULL,
|
TENANT_ID INTEGER NOT NULL,
|
||||||
PRIMARY KEY (ID)
|
PRIMARY KEY (ID)
|
||||||
);
|
);
|
||||||
|
|||||||
@ -5,6 +5,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE (
|
|||||||
SHARED_WITH_ALL_TENANTS BOOLEAN NOT NULL DEFAULT FALSE,
|
SHARED_WITH_ALL_TENANTS BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
PRIMARY KEY (ID)
|
PRIMARY KEY (ID)
|
||||||
)ENGINE = InnoDB;
|
)ENGINE = InnoDB;
|
||||||
|
CREATE INDEX device_type_name ON DM_DEVICE_TYPE (NAME);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS DM_DEVICE (
|
CREATE TABLE IF NOT EXISTS DM_DEVICE (
|
||||||
ID INTEGER AUTO_INCREMENT NOT NULL,
|
ID INTEGER AUTO_INCREMENT NOT NULL,
|
||||||
@ -117,13 +118,13 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE (
|
|||||||
ID INT NOT NULL AUTO_INCREMENT ,
|
ID INT NOT NULL AUTO_INCREMENT ,
|
||||||
PROFILE_NAME VARCHAR(45) NOT NULL ,
|
PROFILE_NAME VARCHAR(45) NOT NULL ,
|
||||||
TENANT_ID INT NOT NULL ,
|
TENANT_ID INT NOT NULL ,
|
||||||
DEVICE_TYPE_ID INT NOT NULL ,
|
DEVICE_TYPE VARCHAR(300) NOT NULL ,
|
||||||
CREATED_TIME DATETIME NOT NULL ,
|
CREATED_TIME DATETIME NOT NULL ,
|
||||||
UPDATED_TIME DATETIME NOT NULL ,
|
UPDATED_TIME DATETIME NOT NULL ,
|
||||||
PRIMARY KEY (ID) ,
|
PRIMARY KEY (ID) ,
|
||||||
CONSTRAINT DM_PROFILE_DEVICE_TYPE
|
CONSTRAINT DM_PROFILE_DEVICE_TYPE
|
||||||
FOREIGN KEY (DEVICE_TYPE_ID )
|
FOREIGN KEY (DEVICE_TYPE)
|
||||||
REFERENCES DM_DEVICE_TYPE (ID )
|
REFERENCES DM_DEVICE_TYPE (NAME)
|
||||||
ON DELETE NO ACTION
|
ON DELETE NO ACTION
|
||||||
ON UPDATE NO ACTION
|
ON UPDATE NO ACTION
|
||||||
)ENGINE = InnoDB;
|
)ENGINE = InnoDB;
|
||||||
@ -171,7 +172,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY (
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY (
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY (
|
||||||
ID INT(11) NOT NULL ,
|
ID INT(11) NOT NULL ,
|
||||||
DEVICE_TYPE_ID INT(11) NOT NULL ,
|
DEVICE_TYPE VARCHAR(300) NOT NULL ,
|
||||||
POLICY_ID INT(11) NOT NULL ,
|
POLICY_ID INT(11) NOT NULL ,
|
||||||
PRIMARY KEY (ID) ,
|
PRIMARY KEY (ID) ,
|
||||||
CONSTRAINT FK_DEVICE_TYPE_POLICY
|
CONSTRAINT FK_DEVICE_TYPE_POLICY
|
||||||
@ -180,8 +181,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY (
|
|||||||
ON DELETE NO ACTION
|
ON DELETE NO ACTION
|
||||||
ON UPDATE NO ACTION,
|
ON UPDATE NO ACTION,
|
||||||
CONSTRAINT FK_DEVICE_TYPE_POLICY_DEVICE_TYPE
|
CONSTRAINT FK_DEVICE_TYPE_POLICY_DEVICE_TYPE
|
||||||
FOREIGN KEY (DEVICE_TYPE_ID )
|
FOREIGN KEY (DEVICE_TYPE )
|
||||||
REFERENCES DM_DEVICE_TYPE (ID )
|
REFERENCES DM_DEVICE_TYPE (NAME )
|
||||||
ON DELETE NO ACTION
|
ON DELETE NO ACTION
|
||||||
ON UPDATE NO ACTION
|
ON UPDATE NO ACTION
|
||||||
)ENGINE = InnoDB;
|
)ENGINE = InnoDB;
|
||||||
@ -191,7 +192,7 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE_FEATURES (
|
|||||||
ID INT(11) NOT NULL AUTO_INCREMENT,
|
ID INT(11) NOT NULL AUTO_INCREMENT,
|
||||||
PROFILE_ID INT(11) NOT NULL,
|
PROFILE_ID INT(11) NOT NULL,
|
||||||
FEATURE_CODE VARCHAR(100) NOT NULL,
|
FEATURE_CODE VARCHAR(100) NOT NULL,
|
||||||
DEVICE_TYPE_ID INT NOT NULL,
|
DEVICE_TYPE VARCHAR(300) NOT NULL ,
|
||||||
TENANT_ID INT(11) NOT NULL ,
|
TENANT_ID INT(11) NOT NULL ,
|
||||||
CONTENT BLOB NULL DEFAULT NULL,
|
CONTENT BLOB NULL DEFAULT NULL,
|
||||||
PRIMARY KEY (ID),
|
PRIMARY KEY (ID),
|
||||||
@ -308,7 +309,7 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_STATUS (
|
|||||||
CREATE TABLE IF NOT EXISTS DM_POLICY_CHANGE_MGT (
|
CREATE TABLE IF NOT EXISTS DM_POLICY_CHANGE_MGT (
|
||||||
ID INT NOT NULL AUTO_INCREMENT,
|
ID INT NOT NULL AUTO_INCREMENT,
|
||||||
POLICY_ID INT NOT NULL,
|
POLICY_ID INT NOT NULL,
|
||||||
DEVICE_TYPE_ID INT NOT NULL,
|
DEVICE_TYPE VARCHAR(300) NOT NULL ,
|
||||||
TENANT_ID INT(11) NOT NULL,
|
TENANT_ID INT(11) NOT NULL,
|
||||||
PRIMARY KEY (ID)
|
PRIMARY KEY (ID)
|
||||||
)ENGINE = InnoDB;
|
)ENGINE = InnoDB;
|
||||||
|
|||||||
@ -250,13 +250,13 @@ CREATE TABLE DM_PROFILE (
|
|||||||
ID NUMBER(10) NOT NULL ,
|
ID NUMBER(10) NOT NULL ,
|
||||||
PROFILE_NAME VARCHAR2(45) NOT NULL ,
|
PROFILE_NAME VARCHAR2(45) NOT NULL ,
|
||||||
TENANT_ID NUMBER(10) NOT NULL ,
|
TENANT_ID NUMBER(10) NOT NULL ,
|
||||||
DEVICE_TYPE_ID NUMBER(10) NOT NULL ,
|
DEVICE_TYPE VARCHAR2(300) NOT NULL ,
|
||||||
CREATED_TIME TIMESTAMP(0) NOT NULL ,
|
CREATED_TIME TIMESTAMP(0) NOT NULL ,
|
||||||
UPDATED_TIME TIMESTAMP(0) NOT NULL ,
|
UPDATED_TIME TIMESTAMP(0) NOT NULL ,
|
||||||
CONSTRAINT PK_DM_PROFILE PRIMARY KEY (ID) ,
|
CONSTRAINT PK_DM_PROFILE PRIMARY KEY (ID) ,
|
||||||
CONSTRAINT DM_PROFILE_DEVICE_TYPE
|
CONSTRAINT DM_PROFILE_DEVICE_TYPE
|
||||||
FOREIGN KEY (DEVICE_TYPE_ID )
|
FOREIGN KEY (DEVICE_TYPE )
|
||||||
REFERENCES DM_DEVICE_TYPE (ID )
|
REFERENCES DM_DEVICE_TYPE (NAME )
|
||||||
)
|
)
|
||||||
/
|
/
|
||||||
-- Generate ID using sequence and trigger
|
-- Generate ID using sequence and trigger
|
||||||
@ -338,15 +338,15 @@ WHEN (NEW.ID IS NULL)
|
|||||||
|
|
||||||
CREATE TABLE DM_DEVICE_TYPE_POLICY (
|
CREATE TABLE DM_DEVICE_TYPE_POLICY (
|
||||||
ID NUMBER(10) NOT NULL ,
|
ID NUMBER(10) NOT NULL ,
|
||||||
DEVICE_TYPE_ID NUMBER(10) NOT NULL ,
|
DEVICE_TYPE VARCHAR2(300) NOT NULL ,
|
||||||
POLICY_ID NUMBER(10) NOT NULL ,
|
POLICY_ID NUMBER(10) NOT NULL ,
|
||||||
CONSTRAINT PK_DEV_TYPE_POLICY PRIMARY KEY (ID) ,
|
CONSTRAINT PK_DEV_TYPE_POLICY PRIMARY KEY (ID) ,
|
||||||
CONSTRAINT FK_DEV_TYPE_POLICY
|
CONSTRAINT FK_DEV_TYPE_POLICY
|
||||||
FOREIGN KEY (POLICY_ID )
|
FOREIGN KEY (POLICY_ID )
|
||||||
REFERENCES DM_POLICY (ID ),
|
REFERENCES DM_POLICY (ID ),
|
||||||
CONSTRAINT FK_DEV_TYPE_POLICY_DEV_TYPE
|
CONSTRAINT FK_DEV_TYPE_POLICY_DEV_TYPE
|
||||||
FOREIGN KEY (DEVICE_TYPE_ID )
|
FOREIGN KEY (DEVICE_TYPE )
|
||||||
REFERENCES DM_DEVICE_TYPE (ID )
|
REFERENCES DM_DEVICE_TYPE (NAME )
|
||||||
)
|
)
|
||||||
/
|
/
|
||||||
|
|
||||||
@ -355,7 +355,7 @@ CREATE TABLE DM_PROFILE_FEATURES (
|
|||||||
ID NUMBER(10) NOT NULL,
|
ID NUMBER(10) NOT NULL,
|
||||||
PROFILE_ID NUMBER(10) NOT NULL,
|
PROFILE_ID NUMBER(10) NOT NULL,
|
||||||
FEATURE_CODE VARCHAR2(100) NOT NULL,
|
FEATURE_CODE VARCHAR2(100) NOT NULL,
|
||||||
DEVICE_TYPE_ID NUMBER(10) NOT NULL,
|
DEVICE_TYPE VARCHAR2(300) NOT NULL ,
|
||||||
TENANT_ID NUMBER(10) NOT NULL ,
|
TENANT_ID NUMBER(10) NOT NULL ,
|
||||||
CONTENT BLOB DEFAULT NULL NULL,
|
CONTENT BLOB DEFAULT NULL NULL,
|
||||||
CONSTRAINT PK_DM_PROF_DM_POLICY_FEATURES PRIMARY KEY (ID),
|
CONSTRAINT PK_DM_PROF_DM_POLICY_FEATURES PRIMARY KEY (ID),
|
||||||
@ -566,7 +566,7 @@ WHEN (NEW.ID IS NULL)
|
|||||||
CREATE TABLE DM_POLICY_CHANGE_MGT (
|
CREATE TABLE DM_POLICY_CHANGE_MGT (
|
||||||
ID NUMBER(10) NOT NULL,
|
ID NUMBER(10) NOT NULL,
|
||||||
POLICY_ID NUMBER(10) NOT NULL,
|
POLICY_ID NUMBER(10) NOT NULL,
|
||||||
DEVICE_TYPE_ID NUMBER(10) NOT NULL,
|
DEVICE_TYPE VARCHAR2(300) NOT NULL,
|
||||||
TENANT_ID NUMBER(10) NOT NULL,
|
TENANT_ID NUMBER(10) NOT NULL,
|
||||||
CONSTRAINT PK_DM_POLICY_CHANGE_MGT PRIMARY KEY (ID)
|
CONSTRAINT PK_DM_POLICY_CHANGE_MGT PRIMARY KEY (ID)
|
||||||
)
|
)
|
||||||
|
|||||||
@ -103,12 +103,12 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE (
|
|||||||
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
||||||
PROFILE_NAME VARCHAR(45) NOT NULL ,
|
PROFILE_NAME VARCHAR(45) NOT NULL ,
|
||||||
TENANT_ID INTEGER NOT NULL ,
|
TENANT_ID INTEGER NOT NULL ,
|
||||||
DEVICE_TYPE_ID INTEGER NOT NULL ,
|
DEVICE_TYPE VARCHAR(300) NOT NULL ,
|
||||||
CREATED_TIME TIMESTAMP NOT NULL ,
|
CREATED_TIME TIMESTAMP NOT NULL ,
|
||||||
UPDATED_TIME TIMESTAMP NOT NULL ,
|
UPDATED_TIME TIMESTAMP NOT NULL ,
|
||||||
CONSTRAINT DM_PROFILE_DEVICE_TYPE
|
CONSTRAINT DM_PROFILE_DEVICE_TYPE
|
||||||
FOREIGN KEY (DEVICE_TYPE_ID )
|
FOREIGN KEY (DEVICE_TYPE )
|
||||||
REFERENCES DM_DEVICE_TYPE (ID )
|
REFERENCES DM_DEVICE_TYPE (NAME )
|
||||||
ON DELETE NO ACTION
|
ON DELETE NO ACTION
|
||||||
ON UPDATE NO ACTION
|
ON UPDATE NO ACTION
|
||||||
);
|
);
|
||||||
@ -151,7 +151,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY (
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY (
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY (
|
||||||
ID INTEGER NOT NULL,
|
ID INTEGER NOT NULL,
|
||||||
DEVICE_TYPE_ID INTEGER NOT NULL ,
|
DEVICE_TYPE VARCHAR(300) NOT NULL ,
|
||||||
POLICY_ID INTEGER NOT NULL ,
|
POLICY_ID INTEGER NOT NULL ,
|
||||||
PRIMARY KEY (ID) ,
|
PRIMARY KEY (ID) ,
|
||||||
CONSTRAINT FK_DEVICE_TYPE_POLICY
|
CONSTRAINT FK_DEVICE_TYPE_POLICY
|
||||||
@ -160,8 +160,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY (
|
|||||||
ON DELETE NO ACTION
|
ON DELETE NO ACTION
|
||||||
ON UPDATE NO ACTION,
|
ON UPDATE NO ACTION,
|
||||||
CONSTRAINT FK_DEVICE_TYPE_POLICY_DEVICE_TYPE
|
CONSTRAINT FK_DEVICE_TYPE_POLICY_DEVICE_TYPE
|
||||||
FOREIGN KEY (DEVICE_TYPE_ID )
|
FOREIGN KEY (DEVICE_TYPE )
|
||||||
REFERENCES DM_DEVICE_TYPE (ID )
|
REFERENCES DM_DEVICE_TYPE (NAME )
|
||||||
ON DELETE NO ACTION
|
ON DELETE NO ACTION
|
||||||
ON UPDATE NO ACTION
|
ON UPDATE NO ACTION
|
||||||
);
|
);
|
||||||
@ -170,7 +170,7 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE_FEATURES (
|
|||||||
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
||||||
PROFILE_ID INTEGER NOT NULL,
|
PROFILE_ID INTEGER NOT NULL,
|
||||||
FEATURE_CODE VARCHAR(100) NOT NULL,
|
FEATURE_CODE VARCHAR(100) NOT NULL,
|
||||||
DEVICE_TYPE_ID INT NOT NULL,
|
DEVICE_TYPE VARCHAR(300) NOT NULL ,
|
||||||
TENANT_ID INTEGER NOT NULL ,
|
TENANT_ID INTEGER NOT NULL ,
|
||||||
CONTENT BYTEA NULL DEFAULT NULL,
|
CONTENT BYTEA NULL DEFAULT NULL,
|
||||||
CONSTRAINT FK_DM_PROFILE_DM_POLICY_FEATURES
|
CONSTRAINT FK_DM_PROFILE_DM_POLICY_FEATURES
|
||||||
@ -272,7 +272,7 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_STATUS (
|
|||||||
CREATE TABLE IF NOT EXISTS DM_POLICY_CHANGE_MGT (
|
CREATE TABLE IF NOT EXISTS DM_POLICY_CHANGE_MGT (
|
||||||
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
||||||
POLICY_ID INTEGER NOT NULL,
|
POLICY_ID INTEGER NOT NULL,
|
||||||
DEVICE_TYPE_ID INTEGER NOT NULL,
|
DEVICE_TYPE VARCHAR(300) NOT NULL,
|
||||||
TENANT_ID INTEGER NOT NULL
|
TENANT_ID INTEGER NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user