forked from community/device-mgt-core
Merge branch 'master' of https://github.com/wso2/carbon-device-mgt
commit
682b5f81e0
102
components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/NotificationDAOImpl.java → components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/AbstractNotificationDAOImpl.java
102
components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/NotificationDAOImpl.java → components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/AbstractNotificationDAOImpl.java
@ -0,0 +1,122 @@
|
|||||||
|
/*
|
||||||
|
* 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.notification.mgt.dao.impl;
|
||||||
|
|
||||||
|
import org.wso2.carbon.device.mgt.common.PaginationRequest;
|
||||||
|
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.notification.mgt.dao.NotificationManagementDAOFactory;
|
||||||
|
import org.wso2.carbon.device.mgt.core.notification.mgt.dao.util.NotificationDAOUtil;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class holds the generic implementation of NotificationDAO which can be used to support ANSI db syntax.
|
||||||
|
*/
|
||||||
|
public class GenericNotificationDAOImpl extends AbstractNotificationDAOImpl {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Notification> getAllNotifications(PaginationRequest request, int tenantId) throws
|
||||||
|
NotificationManagementException {
|
||||||
|
Connection conn;
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
List<Notification> notifications = null;
|
||||||
|
try {
|
||||||
|
conn = NotificationManagementDAOFactory.getConnection();
|
||||||
|
String sql =
|
||||||
|
"SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS, n1.DESCRIPTION," +
|
||||||
|
" d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT " +
|
||||||
|
"NOTIFICATION_ID, DEVICE_ID, OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " +
|
||||||
|
"TENANT_ID = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID AND TENANT_ID = ?";
|
||||||
|
|
||||||
|
sql = sql + " LIMIT ?,?";
|
||||||
|
|
||||||
|
stmt = conn.prepareStatement(sql);
|
||||||
|
stmt.setInt(1, tenantId);
|
||||||
|
stmt.setInt(2, tenantId);
|
||||||
|
int paramIdx = 3;
|
||||||
|
|
||||||
|
stmt.setInt(paramIdx++, request.getStartIndex());
|
||||||
|
stmt.setInt(paramIdx, request.getRowCount());
|
||||||
|
|
||||||
|
rs = stmt.executeQuery();
|
||||||
|
notifications = new ArrayList<>();
|
||||||
|
while (rs.next()) {
|
||||||
|
notifications.add(NotificationDAOUtil.getNotification(rs));
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new NotificationManagementException(
|
||||||
|
"Error occurred while retrieving information of all notifications", e);
|
||||||
|
} finally {
|
||||||
|
NotificationDAOUtil.cleanupResources(stmt, rs);
|
||||||
|
}
|
||||||
|
return notifications;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Notification> getNotificationsByStatus(PaginationRequest request, Notification.Status status, int tenantId) throws
|
||||||
|
NotificationManagementException{
|
||||||
|
Connection conn;
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
List<Notification> notifications = null;
|
||||||
|
try {
|
||||||
|
conn = NotificationManagementDAOFactory.getConnection();
|
||||||
|
String sql = "SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS," +
|
||||||
|
" n1.DESCRIPTION, d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM " +
|
||||||
|
"DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT NOTIFICATION_ID, DEVICE_ID, " +
|
||||||
|
"OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " +
|
||||||
|
"TENANT_ID = ? AND STATUS = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID " +
|
||||||
|
"AND TENANT_ID = ?";
|
||||||
|
|
||||||
|
sql = sql + " LIMIT ?,?";
|
||||||
|
|
||||||
|
stmt = conn.prepareStatement(sql);
|
||||||
|
stmt.setInt(1, tenantId);
|
||||||
|
stmt.setString(2, status.toString());
|
||||||
|
stmt.setInt(3, tenantId);
|
||||||
|
|
||||||
|
int paramIdx = 4;
|
||||||
|
|
||||||
|
stmt.setInt(paramIdx++, request.getStartIndex());
|
||||||
|
stmt.setInt(paramIdx, request.getRowCount());
|
||||||
|
|
||||||
|
|
||||||
|
rs = stmt.executeQuery();
|
||||||
|
notifications = new ArrayList<>();
|
||||||
|
while (rs.next()) {
|
||||||
|
notifications.add(NotificationDAOUtil.getNotification(rs));
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new NotificationManagementException(
|
||||||
|
"Error occurred while retrieving information of all " +
|
||||||
|
"notifications by status : " + status, e);
|
||||||
|
} finally {
|
||||||
|
NotificationDAOUtil.cleanupResources(stmt, rs);
|
||||||
|
}
|
||||||
|
return notifications;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,122 @@
|
|||||||
|
/*
|
||||||
|
* 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.notification.mgt.dao.impl;
|
||||||
|
|
||||||
|
import org.wso2.carbon.device.mgt.common.PaginationRequest;
|
||||||
|
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.notification.mgt.dao.NotificationManagementDAOFactory;
|
||||||
|
import org.wso2.carbon.device.mgt.core.notification.mgt.dao.util.NotificationDAOUtil;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class holds the Oracle implementation of NotificationDAO which can be used to support Oracle db syntax.
|
||||||
|
*/
|
||||||
|
public class OracleNotificationDAOImpl extends AbstractNotificationDAOImpl {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Notification> getAllNotifications(PaginationRequest request, int tenantId) throws
|
||||||
|
NotificationManagementException {
|
||||||
|
Connection conn;
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
List<Notification> notifications = null;
|
||||||
|
try {
|
||||||
|
conn = NotificationManagementDAOFactory.getConnection();
|
||||||
|
String sql =
|
||||||
|
"SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS, n1.DESCRIPTION," +
|
||||||
|
" d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT " +
|
||||||
|
"NOTIFICATION_ID, DEVICE_ID, OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " +
|
||||||
|
"TENANT_ID = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID AND TENANT_ID = ?";
|
||||||
|
|
||||||
|
sql = sql + " WHERE OFFSET >= ? AND ROWNUM <= ?";
|
||||||
|
|
||||||
|
stmt = conn.prepareStatement(sql);
|
||||||
|
stmt.setInt(1, tenantId);
|
||||||
|
stmt.setInt(2, tenantId);
|
||||||
|
int paramIdx = 3;
|
||||||
|
|
||||||
|
stmt.setInt(paramIdx++, request.getStartIndex());
|
||||||
|
stmt.setInt(paramIdx, request.getRowCount());
|
||||||
|
|
||||||
|
rs = stmt.executeQuery();
|
||||||
|
notifications = new ArrayList<>();
|
||||||
|
while (rs.next()) {
|
||||||
|
notifications.add(NotificationDAOUtil.getNotification(rs));
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new NotificationManagementException(
|
||||||
|
"Error occurred while retrieving information of all notifications", e);
|
||||||
|
} finally {
|
||||||
|
NotificationDAOUtil.cleanupResources(stmt, rs);
|
||||||
|
}
|
||||||
|
return notifications;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Notification> getNotificationsByStatus(PaginationRequest request, Notification.Status status, int tenantId) throws
|
||||||
|
NotificationManagementException{
|
||||||
|
Connection conn;
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
List<Notification> notifications = null;
|
||||||
|
try {
|
||||||
|
conn = NotificationManagementDAOFactory.getConnection();
|
||||||
|
String sql = "SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS," +
|
||||||
|
" n1.DESCRIPTION, d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM " +
|
||||||
|
"DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT NOTIFICATION_ID, DEVICE_ID, " +
|
||||||
|
"OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " +
|
||||||
|
"TENANT_ID = ? AND STATUS = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID " +
|
||||||
|
"AND TENANT_ID = ?";
|
||||||
|
|
||||||
|
sql = sql + " OFFSET >= ? AND ROWNUM <= ?";
|
||||||
|
|
||||||
|
stmt = conn.prepareStatement(sql);
|
||||||
|
stmt.setInt(1, tenantId);
|
||||||
|
stmt.setString(2, status.toString());
|
||||||
|
stmt.setInt(3, tenantId);
|
||||||
|
|
||||||
|
int paramIdx = 4;
|
||||||
|
|
||||||
|
stmt.setInt(paramIdx++, request.getStartIndex());
|
||||||
|
stmt.setInt(paramIdx, request.getRowCount());
|
||||||
|
|
||||||
|
|
||||||
|
rs = stmt.executeQuery();
|
||||||
|
notifications = new ArrayList<>();
|
||||||
|
while (rs.next()) {
|
||||||
|
notifications.add(NotificationDAOUtil.getNotification(rs));
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new NotificationManagementException(
|
||||||
|
"Error occurred while retrieving information of all " +
|
||||||
|
"notifications by status : " + status, e);
|
||||||
|
} finally {
|
||||||
|
NotificationDAOUtil.cleanupResources(stmt, rs);
|
||||||
|
}
|
||||||
|
return notifications;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,122 @@
|
|||||||
|
/*
|
||||||
|
* 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.notification.mgt.dao.impl;
|
||||||
|
|
||||||
|
import org.wso2.carbon.device.mgt.common.PaginationRequest;
|
||||||
|
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.notification.mgt.dao.NotificationManagementDAOFactory;
|
||||||
|
import org.wso2.carbon.device.mgt.core.notification.mgt.dao.util.NotificationDAOUtil;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class holds the implementation of NotificationDAO which can be used to support PostgreSQL db syntax.
|
||||||
|
*/
|
||||||
|
public class PostgreSQLNotificationDAOImpl extends AbstractNotificationDAOImpl {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Notification> getAllNotifications(PaginationRequest request, int tenantId) throws
|
||||||
|
NotificationManagementException {
|
||||||
|
Connection conn;
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
List<Notification> notifications = null;
|
||||||
|
try {
|
||||||
|
conn = NotificationManagementDAOFactory.getConnection();
|
||||||
|
String sql =
|
||||||
|
"SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS, n1.DESCRIPTION," +
|
||||||
|
" d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT " +
|
||||||
|
"NOTIFICATION_ID, DEVICE_ID, OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " +
|
||||||
|
"TENANT_ID = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID AND TENANT_ID = ?";
|
||||||
|
|
||||||
|
sql = sql + " LIMIT ? OFFSET ?";
|
||||||
|
|
||||||
|
stmt = conn.prepareStatement(sql);
|
||||||
|
stmt.setInt(1, tenantId);
|
||||||
|
stmt.setInt(2, tenantId);
|
||||||
|
int paramIdx = 3;
|
||||||
|
|
||||||
|
stmt.setInt(paramIdx++, request.getRowCount());
|
||||||
|
stmt.setInt(paramIdx, request.getStartIndex());
|
||||||
|
|
||||||
|
rs = stmt.executeQuery();
|
||||||
|
notifications = new ArrayList<>();
|
||||||
|
while (rs.next()) {
|
||||||
|
notifications.add(NotificationDAOUtil.getNotification(rs));
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new NotificationManagementException(
|
||||||
|
"Error occurred while retrieving information of all notifications", e);
|
||||||
|
} finally {
|
||||||
|
NotificationDAOUtil.cleanupResources(stmt, rs);
|
||||||
|
}
|
||||||
|
return notifications;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Notification> getNotificationsByStatus(PaginationRequest request, Notification.Status status, int tenantId) throws
|
||||||
|
NotificationManagementException{
|
||||||
|
Connection conn;
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
List<Notification> notifications = null;
|
||||||
|
try {
|
||||||
|
conn = NotificationManagementDAOFactory.getConnection();
|
||||||
|
String sql = "SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS," +
|
||||||
|
" n1.DESCRIPTION, d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM " +
|
||||||
|
"DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT NOTIFICATION_ID, DEVICE_ID, " +
|
||||||
|
"OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " +
|
||||||
|
"TENANT_ID = ? AND STATUS = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID " +
|
||||||
|
"AND TENANT_ID = ?";
|
||||||
|
|
||||||
|
sql = sql + " LIMIT ? OFFSET ?";
|
||||||
|
|
||||||
|
stmt = conn.prepareStatement(sql);
|
||||||
|
stmt.setInt(1, tenantId);
|
||||||
|
stmt.setString(2, status.toString());
|
||||||
|
stmt.setInt(3, tenantId);
|
||||||
|
|
||||||
|
int paramIdx = 4;
|
||||||
|
|
||||||
|
stmt.setInt(paramIdx++, request.getRowCount());
|
||||||
|
stmt.setInt(paramIdx, request.getStartIndex());
|
||||||
|
|
||||||
|
|
||||||
|
rs = stmt.executeQuery();
|
||||||
|
notifications = new ArrayList<>();
|
||||||
|
while (rs.next()) {
|
||||||
|
notifications.add(NotificationDAOUtil.getNotification(rs));
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new NotificationManagementException(
|
||||||
|
"Error occurred while retrieving information of all " +
|
||||||
|
"notifications by status : " + status, e);
|
||||||
|
} finally {
|
||||||
|
NotificationDAOUtil.cleanupResources(stmt, rs);
|
||||||
|
}
|
||||||
|
return notifications;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,122 @@
|
|||||||
|
/*
|
||||||
|
* 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.notification.mgt.dao.impl;
|
||||||
|
|
||||||
|
import org.wso2.carbon.device.mgt.common.PaginationRequest;
|
||||||
|
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.notification.mgt.dao.NotificationManagementDAOFactory;
|
||||||
|
import org.wso2.carbon.device.mgt.core.notification.mgt.dao.util.NotificationDAOUtil;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class holds the implementation of NotificationDAO which can be used to support SQLServer db syntax.
|
||||||
|
*/
|
||||||
|
public class SQLServerNotificationDAOImpl extends AbstractNotificationDAOImpl {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Notification> getAllNotifications(PaginationRequest request, int tenantId) throws
|
||||||
|
NotificationManagementException {
|
||||||
|
Connection conn;
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
List<Notification> notifications = null;
|
||||||
|
try {
|
||||||
|
conn = NotificationManagementDAOFactory.getConnection();
|
||||||
|
String sql =
|
||||||
|
"SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS, n1.DESCRIPTION," +
|
||||||
|
" d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT " +
|
||||||
|
"NOTIFICATION_ID, DEVICE_ID, OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " +
|
||||||
|
"TENANT_ID = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID AND TENANT_ID = ?";
|
||||||
|
|
||||||
|
sql = sql + " OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
|
||||||
|
|
||||||
|
stmt = conn.prepareStatement(sql);
|
||||||
|
stmt.setInt(1, tenantId);
|
||||||
|
stmt.setInt(2, tenantId);
|
||||||
|
int paramIdx = 3;
|
||||||
|
|
||||||
|
stmt.setInt(paramIdx++, request.getStartIndex());
|
||||||
|
stmt.setInt(paramIdx, request.getRowCount());
|
||||||
|
|
||||||
|
rs = stmt.executeQuery();
|
||||||
|
notifications = new ArrayList<>();
|
||||||
|
while (rs.next()) {
|
||||||
|
notifications.add(NotificationDAOUtil.getNotification(rs));
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new NotificationManagementException(
|
||||||
|
"Error occurred while retrieving information of all notifications", e);
|
||||||
|
} finally {
|
||||||
|
NotificationDAOUtil.cleanupResources(stmt, rs);
|
||||||
|
}
|
||||||
|
return notifications;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Notification> getNotificationsByStatus(PaginationRequest request, Notification.Status status, int tenantId) throws
|
||||||
|
NotificationManagementException{
|
||||||
|
Connection conn;
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
List<Notification> notifications = null;
|
||||||
|
try {
|
||||||
|
conn = NotificationManagementDAOFactory.getConnection();
|
||||||
|
String sql = "SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS," +
|
||||||
|
" n1.DESCRIPTION, d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM " +
|
||||||
|
"DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT NOTIFICATION_ID, DEVICE_ID, " +
|
||||||
|
"OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " +
|
||||||
|
"TENANT_ID = ? AND STATUS = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID " +
|
||||||
|
"AND TENANT_ID = ?";
|
||||||
|
|
||||||
|
sql = sql + " OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
|
||||||
|
|
||||||
|
stmt = conn.prepareStatement(sql);
|
||||||
|
stmt.setInt(1, tenantId);
|
||||||
|
stmt.setString(2, status.toString());
|
||||||
|
stmt.setInt(3, tenantId);
|
||||||
|
|
||||||
|
int paramIdx = 4;
|
||||||
|
|
||||||
|
stmt.setInt(paramIdx++, request.getStartIndex());
|
||||||
|
stmt.setInt(paramIdx, request.getRowCount());
|
||||||
|
|
||||||
|
|
||||||
|
rs = stmt.executeQuery();
|
||||||
|
notifications = new ArrayList<>();
|
||||||
|
while (rs.next()) {
|
||||||
|
notifications.add(NotificationDAOUtil.getNotification(rs));
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new NotificationManagementException(
|
||||||
|
"Error occurred while retrieving information of all " +
|
||||||
|
"notifications by status : " + status, e);
|
||||||
|
} finally {
|
||||||
|
NotificationDAOUtil.cleanupResources(stmt, rs);
|
||||||
|
}
|
||||||
|
return notifications;
|
||||||
|
}
|
||||||
|
}
|
@ -1,25 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015, 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.policy.mgt;
|
|
||||||
|
|
||||||
public class EvaluationContext {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015, 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.policy.mgt;
|
|
||||||
|
|
||||||
public class PolicyEvaluationException extends Exception {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015, 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.policy.mgt;
|
|
||||||
|
|
||||||
public interface PolicyEvaluationStrategy {
|
|
||||||
|
|
||||||
Profile execute(EvaluationContext ctx) throws PolicyEvaluationException;
|
|
||||||
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015, 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.policy.mgt;
|
|
||||||
|
|
||||||
public class PolicyManagementException extends Exception {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015, 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.policy.mgt;
|
|
||||||
|
|
||||||
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
|
||||||
import org.wso2.carbon.device.mgt.core.policy.mgt.policy.Policy;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface PolicyManager {
|
|
||||||
|
|
||||||
public enum Type {
|
|
||||||
USER_BASED, ROLE_BASED, PLATFORM_BASED
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean addPolicy(Policy policy) throws PolicyManagementException;
|
|
||||||
|
|
||||||
boolean removePolicy(String policyId) throws PolicyManagementException;
|
|
||||||
|
|
||||||
boolean updatePolicy(Policy policy) throws PolicyManagementException;
|
|
||||||
|
|
||||||
Policy getPolicy(String policyId) throws PolicyManagementException;
|
|
||||||
|
|
||||||
List<Policy> getPolicies() throws PolicyManagementException;
|
|
||||||
|
|
||||||
List<Policy> getUserBasedPolicies(String user) throws PolicyManagementException;
|
|
||||||
|
|
||||||
List<Policy> getRoleBasedPolicies(String role) throws PolicyManagementException;
|
|
||||||
|
|
||||||
List<Policy> getPlatformBasedPolicies(String platform) throws PolicyManagementException;
|
|
||||||
|
|
||||||
boolean assignRoleBasedPolicy(String policyId, String role) throws PolicyManagementException;
|
|
||||||
|
|
||||||
boolean assignRoleBasedPolicy(String policyId, List<String> roles) throws PolicyManagementException;
|
|
||||||
|
|
||||||
boolean assignUserBasedPolicy(String policyId, String user) throws PolicyManagementException;
|
|
||||||
|
|
||||||
boolean assignUserBasedPolicy(String policyId, List<String> users) throws PolicyManagementException;
|
|
||||||
|
|
||||||
boolean assignPlatformBasedPolicy(String policyId, String platform) throws PolicyManagementException;
|
|
||||||
|
|
||||||
Profile getEffectiveProfile(DeviceIdentifier deviceId) throws PolicyManagementException;
|
|
||||||
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015, 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.policy.mgt;
|
|
||||||
|
|
||||||
import org.wso2.carbon.device.mgt.core.policy.mgt.policy.Policy;
|
|
||||||
|
|
||||||
public interface PolicyRepository {
|
|
||||||
|
|
||||||
public enum Type {
|
|
||||||
USER_BASED, ROLE_BASED, PLATFORM_BASED
|
|
||||||
}
|
|
||||||
|
|
||||||
void addPolicy(Policy policy) throws PolicyManagementException;
|
|
||||||
|
|
||||||
void remotePolicy(Policy policy) throws PolicyManagementException;
|
|
||||||
|
|
||||||
void getPolicy(String id) throws PolicyManagementException;
|
|
||||||
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015, 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.policy.mgt;
|
|
||||||
|
|
||||||
public class Profile {
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015, 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.policy.mgt;
|
|
||||||
|
|
||||||
public class Rule {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015, 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.policy.mgt;
|
|
||||||
|
|
||||||
public interface RuleCombiningStrategy {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015, 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.policy.mgt.dao;
|
|
||||||
|
|
||||||
public interface PolicyDAO {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015, 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.policy.mgt.dao;
|
|
||||||
|
|
||||||
public class PolicyDAOFactory {
|
|
||||||
|
|
||||||
public static PolicyDAO getPolicyDAO() {
|
|
||||||
return new PolicyDAOImpl();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015, 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.policy.mgt.dao;
|
|
||||||
|
|
||||||
public class PolicyDAOImpl implements PolicyDAO {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015, 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.policy.mgt.policy;
|
|
||||||
|
|
||||||
public class PlatformBasedPolicy extends Policy {
|
|
||||||
|
|
||||||
private String platform;
|
|
||||||
|
|
||||||
public String getPlatform() {
|
|
||||||
return platform;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPlatform(String platform) {
|
|
||||||
this.platform = platform;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015, 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.policy.mgt.policy;
|
|
||||||
|
|
||||||
public class Policy {
|
|
||||||
|
|
||||||
private String id;
|
|
||||||
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(String id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015, 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.policy.mgt.policy;
|
|
||||||
|
|
||||||
public class RoleBasedPolicy extends Policy {
|
|
||||||
|
|
||||||
private String role;
|
|
||||||
|
|
||||||
public String getRole() {
|
|
||||||
return role;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRole(String role) {
|
|
||||||
this.role = role;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015, 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.policy.mgt.policy;
|
|
||||||
|
|
||||||
public class UsedBasedPolicy extends Policy {
|
|
||||||
|
|
||||||
private String username;
|
|
||||||
|
|
||||||
public String getUsername() {
|
|
||||||
return username;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUsername(String username) {
|
|
||||||
this.username = username;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in new issue