Compare commits

Invalid templates have been ignored

1 invalid template(s) found pull_request_template.md: frontmatter must start with a separator line

..

No commits in common. '30837f2f3d075b272d3c5711dc5a50d70f9d0d66' and '59056cc8ff06550ca0d5dcd9af69fe9007a0ff14' have entirely different histories.

@ -22,7 +22,7 @@ package io.entgra.device.mgt.core.application.mgt.common;
public class ReleaseVersionInfo {
private String version;
private String releaseType;
private double rating;
private String rating;
private String state;
private String uuid;
@ -38,11 +38,11 @@ public class ReleaseVersionInfo {
return releaseType;
}
public double getRating() {
public String getRating() {
return rating;
}
public void setRating(double rating) {
public void setRating(String rating) {
this.rating = rating;
}

@ -187,14 +187,11 @@ public interface SubscriptionManager {
* @param subType subscription type of the application.
* @param offsetValue offset value for get paginated request.
* @param limitValue limit value for get paginated request.
* @param uninstalled a Boolean flag indicating the filter criteria for retrieve subscription data
* @param searchName an optional search term to filter the results by name. If null or empty, no filtering by name is applied.
* @return {@link PaginationResult} pagination result of the category details.
* @throws {@link ApplicationManagementException} Exception of the application management
*/
PaginationResult getAppInstalledSubscribers(int offsetValue, int limitValue, String appUUID,
String subType, Boolean uninstalled, String searchName)
throws ApplicationManagementException;
String subType) throws ApplicationManagementException;
/**
* This method is responsible to provide application subscription data for given application release UUID.

@ -198,33 +198,14 @@ public interface SubscriptionDAO {
* @param offsetValue offset value for get paginated result
* @param limitValue limit value for get paginated result
* @param appReleaseId id of the application release.
* @param uninstalled a Boolean flag indicating the filter criteria for getting users:
* - `true` to get only unsubscribed users,
* - `false` to get only subscribed users,
* - `null` to get all users regardless of their unsubscription status.
* @param searchName an optional search term to filter the results by username.
* @return subscribedUsers - list of app subscribed users.
* @throws {@link ApplicationManagementDAOException} if connections establishment fails.
*/
List<String> getAppSubscribedUsers(int offsetValue, int limitValue, int appReleaseId,
int tenantId, Boolean uninstalled, String searchName)
int tenantId)
throws ApplicationManagementDAOException;
/**
* This method is used to get the count of users who are subscribed or unsubscribed to a specific application release.
*
* @param appReleaseId the ID of the application release for which the user count is to be retrieved.
* @param tenantId the ID of the current tenant.
* @param uninstalled a Boolean flag indicating the filter criteria for counting users:
* - `true` to count only unsubscribed users,
* - `false` to count only subscribed users,
* - `null` to count all users regardless of their unsubscription status.
* @param searchName an optional search term to filter the results by username.
* @return the count of users based on the specified criteria.
* @throws ApplicationManagementDAOException if an error occurs while establishing a database connection or executing the query.
*/
int getSubscribedUserCount(int appReleaseId, int tenantId, Boolean uninstalled, String searchName)
throws ApplicationManagementDAOException;
int getSubscribedUserCount(int appReleaseId, int tenantId) throws ApplicationManagementDAOException;
/**
* This method is used to get the details of roles
@ -233,34 +214,14 @@ public interface SubscriptionDAO {
* @param offsetValue offset value for get paginated request.
* @param limitValue limit value for get paginated request.
* @param appReleaseId id of the application release.
* @param uninstalled a Boolean flag indicating the filter criteria for getting roles:
* - `true` to get only unsubscribed roles,
* - `false` to get only subscribed roles,
* - `null` to get all roles regardless of their unsubscription status.
* @param searchName an optional search term to filter the results by role name.
* @return subscribedRoles - list of app subscribed roles.
* @throws {@link ApplicationManagementDAOException} if connections establishment fails.
*/
List<String> getAppSubscribedRoles(int offsetValue, int limitValue, int appReleaseId,
int tenantId, Boolean uninstalled, String searchName)
int tenantId)
throws ApplicationManagementDAOException;
/**
* This method retrieves the count of roles subscribed to a given application release.
* The count can be filtered based on the unsubscription status.
*
* @param appReleaseId the ID of the application release for which the subscribed roles are counted.
* @param tenantId the ID of the current tenant.
* @param uninstalled a Boolean flag indicating the filter criteria for counting roles:
* - `true` to count only unsubscribed roles,
* - `false` to count only subscribed roles,
* - `null` to count all roles regardless of their unsubscription status.
* @param searchName an optional search term to filter the results by role name.
* @return the count of roles that match the specified criteria.
* @throws ApplicationManagementDAOException if there is an error while accessing the database or processing the request.
*/
int getSubscribedRoleCount(int appReleaseId, int tenantId, Boolean uninstalled, String searchName)
throws ApplicationManagementDAOException;
int getSubscribedRoleCount(int appReleaseId, int tenantId) throws ApplicationManagementDAOException;
/**
* This method is used to get the details of subscribed groups
@ -269,33 +230,13 @@ public interface SubscriptionDAO {
* @param offsetValue offset value for get paginated request.
* @param limitValue limit value for get paginated request.
* @param appReleaseId id of the application release.
* @param uninstalled a Boolean flag indicating the filter criteria for getting groups:
* - `true` to get only unsubscribed groups,
* - `false` to get only subscribed groups,
* - `null` to get all groups regardless of their unsubscription status.
* @param searchName an optional search term to filter the results by group name.
* @return subscribedGroups - list of app subscribed groups.
* @throws {@link ApplicationManagementDAOException} if connections establishment fails.
*/
List<String> getAppSubscribedGroups(int offsetValue, int limitValue, int appReleaseId, int tenantId,
Boolean uninstalled, String searchName)
List<String> getAppSubscribedGroups(int offsetValue, int limitValue, int appReleaseId, int tenantId)
throws ApplicationManagementDAOException;
/**
* This method is used to get the count of subscribed groups
*
* @param tenantId id of the current tenant
* @param appReleaseId id of the application release.
* @param uninstalled a Boolean flag indicating the filter criteria for counting groups:
* - `true` to count only unsubscribed groups,
* - `false` to count only subscribed groups,
* - `null` to count all groups regardless of their unsubscription status.
* @param searchName an optional search term to filter the results by group name.
* @return subscribedGroups - list of app subscribed groups.
* @throws {@link ApplicationManagementDAOException} if connections establishment fails.
*/
int getSubscribedGroupCount(int appReleaseId, int tenantId,Boolean uninstalled, String searchName)
throws ApplicationManagementDAOException;
int getSubscribedGroupCount(int appReleaseId, int tenantId) throws ApplicationManagementDAOException;
/**
* This method is used to get the details of subscribed groups

@ -2075,7 +2075,7 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
releaseVersionInfo = new ReleaseVersionInfo();
releaseVersionInfo.setVersion(resultSet.getString("VERSION"));
releaseVersionInfo.setReleaseType(resultSet.getString("RELEASE_TYPE"));
releaseVersionInfo.setRating(resultSet.getDouble("RATING"));
releaseVersionInfo.setRating(resultSet.getString("RATING"));
releaseVersionInfo.setState(resultSet.getString("CURRENT_STATE"));
releaseVersionInfo.setUuid(resultSet.getString("UUID"));
releaseVersionInfos.add(releaseVersionInfo);

@ -967,37 +967,25 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
@Override
public List<String> getAppSubscribedUsers(int offsetValue, int limitValue, int appReleaseId,
int tenantId, Boolean uninstalled, String searchName)
int tenantId)
throws ApplicationManagementDAOException {
if (log.isDebugEnabled()) {
log.debug("Request received in DAO Layer to get subscribed/unsubscribed users for the given app release ID.");
log.debug("Request received in DAO Layer to get already subscribed users for " +
"given app release id.");
}
try {
Connection conn = this.getDBConnection();
List<String> subscribedUsers = new ArrayList<>();
String sql = "SELECT US.USER_NAME AS USER_NAME " +
"FROM AP_USER_SUBSCRIPTION US " +
"WHERE AP_APP_RELEASE_ID = ? " +
"AND TENANT_ID = ? ";
if (uninstalled != null) {
sql += "AND UNSUBSCRIBED = ? ";
}
if (searchName != null && !searchName.trim().isEmpty()) {
sql += "AND US.USER_NAME LIKE ? ";
}
sql += "LIMIT ? OFFSET ?";
String sql = "SELECT "
+ "US.USER_NAME AS USER_NAME "
+ "FROM AP_USER_SUBSCRIPTION US "
+ "WHERE "
+ "AP_APP_RELEASE_ID = ? AND TENANT_ID = ? LIMIT ? OFFSET ?";
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
int index = 1;
stmt.setInt(index++, appReleaseId);
stmt.setInt(index++, tenantId);
if (uninstalled != null) {
stmt.setBoolean(index++, uninstalled);
}
if (searchName != null && !searchName.trim().isEmpty()) {
stmt.setString(index++, "%" + searchName + "%");
}
stmt.setInt(index++, limitValue);
stmt.setInt(index, offsetValue);
stmt.setInt(1, appReleaseId);
stmt.setInt(2, tenantId);
stmt.setInt(3, limitValue);
stmt.setInt(4, offsetValue);
try (ResultSet rs = stmt.executeQuery()) {
while (rs.next()) {
subscribedUsers.add(rs.getString("USER_NAME"));
@ -1006,62 +994,50 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
return subscribedUsers;
}
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to get subscribed/unsubscribed users for the " +
"given app release ID.";
String msg = "Error occurred while obtaining the DB connection to get already " +
"subscribed users for given app release id.";
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred while getting subscribed/unsubscribed users for the given app release ID.";
String msg = "SQL Error occurred while getting subscribed users for given app release id.";
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@Override
public int getSubscribedUserCount(int appReleaseId, int tenantId, Boolean uninstalled, String searchName)
public int getSubscribedUserCount(int appReleaseId, int tenantId)
throws ApplicationManagementDAOException {
if (log.isDebugEnabled()) {
log.debug("Request received in DAO Layer to get already subscribed/unsubscribed users for " +
log.debug("Request received in DAO Layer to get already subscribed users for " +
"given app release id.");
}
try {
Connection conn = this.getDBConnection();
String sql = "SELECT COUNT(US.USER_NAME) AS USER_COUNT " +
"FROM AP_USER_SUBSCRIPTION US " +
"WHERE AP_APP_RELEASE_ID = ? " +
"AND TENANT_ID = ?";
if (uninstalled != null) {
sql += " AND UNSUBSCRIBED = ?";
}
if (searchName != null && !searchName.trim().isEmpty()) {
sql += " AND US.USER_NAME LIKE ?";
}
String sql = "SELECT "
+ "COUNT(US.USER_NAME) AS USER_NAME "
+ "FROM AP_USER_SUBSCRIPTION US "
+ "WHERE "
+ "AP_APP_RELEASE_ID = ? AND TENANT_ID = ?";
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
int index = 1;
stmt.setInt(index++, appReleaseId);
stmt.setInt(index++, tenantId);
stmt.setInt(1, appReleaseId);
stmt.setInt(2, tenantId);
if (uninstalled != null) {
stmt.setBoolean(index++, uninstalled);
}
if (searchName != null && !searchName.trim().isEmpty()) {
stmt.setString(index++, "%" + searchName + "%");
}
try (ResultSet rs = stmt.executeQuery()) {
if (rs.next()) {
return rs.getInt("USER_COUNT");
return rs.getInt("USER_NAME");
}
}
return 0;
}
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to get already " +
"subscribed/unsubscribed users count for given app release id.";
"subscribed users count for given app release id.";
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred while getting subscribed/unsubscribed users count for given app release id.";
String msg = "SQL Error occurred while getting subscribed users for given app release id.";
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
@ -1175,40 +1151,25 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
@Override
public List<String> getAppSubscribedRoles(int offsetValue, int limitValue, int appReleaseId,
int tenantId, Boolean uninstalled, String searchName)
int tenantId)
throws ApplicationManagementDAOException {
if (log.isDebugEnabled()) {
log.debug("Request received in DAO Layer to get already subscribed/unsubscribed roles for " +
log.debug("Request received in DAO Layer to get already subscribed roles for " +
"given app release id.");
}
try {
Connection conn = this.getDBConnection();
List<String> subscribedRoles = new ArrayList<>();
String sql = "SELECT "
+ "RS.ROLE_NAME AS ROLE "
+ "FROM AP_ROLE_SUBSCRIPTION RS "
+ "WHERE AP_APP_RELEASE_ID = ? "
+ "AND TENANT_ID = ?";
if (uninstalled != null) {
sql += " AND UNSUBSCRIBED = ?";
}
if (searchName != null && !searchName.trim().isEmpty()) {
sql += " AND RS.ROLE_NAME LIKE ?";
}
sql += " LIMIT ? OFFSET ?";
+ "RS.ROLE_NAME AS ROLE "
+ "FROM AP_ROLE_SUBSCRIPTION RS "
+ "WHERE "
+ "AP_APP_RELEASE_ID = ? AND TENANT_ID = ? LIMIT ? OFFSET ?";
try (PreparedStatement ps = conn.prepareStatement(sql)) {
int paramIndex = 1;
ps.setInt(paramIndex++, appReleaseId);
ps.setInt(paramIndex++, tenantId);
if (uninstalled != null) {
ps.setBoolean(paramIndex++, uninstalled);
}
if (searchName != null && !searchName.trim().isEmpty()) {
ps.setString(paramIndex++, "%" + searchName + "%");
}
ps.setInt(paramIndex++, limitValue);
ps.setInt(paramIndex, offsetValue);
ps.setInt(1, appReleaseId);
ps.setInt(2, tenantId);
ps.setInt(3, limitValue);
ps.setInt(4, offsetValue);
try (ResultSet rs = ps.executeQuery()) {
while (rs.next()) {
subscribedRoles.add(rs.getString("ROLE"));
@ -1218,61 +1179,49 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
}
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to get already " +
"subscribed/unsubscribed roles for given app release id.";
"subscribed roles for given app release id.";
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred while getting subscribed/unsubscribed roles for given app release id.";
String msg = "SQL Error occurred while getting subscribed roles for given app release id.";
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@Override
public int getSubscribedRoleCount(int appReleaseId, int tenantId, Boolean uninstalled, String searchName)
public int getSubscribedRoleCount(int appReleaseId, int tenantId)
throws ApplicationManagementDAOException {
if (log.isDebugEnabled()) {
log.debug("Request received in DAO Layer to get already subscribed/unsubscribed roles for " +
log.debug("Request received in DAO Layer to get already subscribed roles for " +
"given app release id.");
}
try {
Connection conn = this.getDBConnection();
String sql = "SELECT "
+ "COUNT(RS.ROLE_NAME) AS ROLE_COUNT "
+ "FROM AP_ROLE_SUBSCRIPTION RS "
+ "WHERE AP_APP_RELEASE_ID = ? "
+ "AND TENANT_ID = ?";
if (uninstalled != null) {
sql += " AND UNSUBSCRIBED = ?";
}
if (searchName != null && !searchName.trim().isEmpty()) {
sql += " AND RS.ROLE_NAME LIKE ?";
}
+ "COUNT(RS.ROLE_NAME) AS ROLE_NAME "
+ "FROM AP_ROLE_SUBSCRIPTION RS "
+ "WHERE "
+ "AP_APP_RELEASE_ID = ? AND TENANT_ID = ?";
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
int paramIndex = 1;
stmt.setInt(paramIndex++, appReleaseId);
stmt.setInt(paramIndex++, tenantId);
if (uninstalled != null) {
stmt.setBoolean(paramIndex++, uninstalled);
}
if (searchName != null && !searchName.trim().isEmpty()) {
stmt.setString(paramIndex++, "%" + searchName + "%");
}
stmt.setInt(1, appReleaseId);
stmt.setInt(2, tenantId);
try (ResultSet rs = stmt.executeQuery()) {
if (rs.next()) {
return rs.getInt("ROLE_COUNT");
return rs.getInt("ROLE_NAME");
}
return 0;
}
return 0;
}
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to get already " +
"subscribed/unsubscribed roles count for given app release id.";
"subscribed roles count for given app release id.";
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred while getting subscribed/unsubscribed roles count for given app release id.";
String msg = "SQL Error occurred while getting subscribed roles for given app release id.";
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
@ -1320,37 +1269,25 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
@Override
public List<String> getAppSubscribedGroups(int offsetValue, int limitValue, int appReleaseId,
int tenantId, Boolean uninstalled, String searchName)
int tenantId)
throws ApplicationManagementDAOException {
if (log.isDebugEnabled()) {
log.debug("Request received in DAO Layer to get already subscribed/unsubscribed groups for " +
log.debug("Request received in DAO Layer to get already subscribed groups for " +
"given app release id.");
}
try {
Connection conn = this.getDBConnection();
List<String> subscribedGroups = new ArrayList<>();
String sql = "SELECT GS.GROUP_NAME AS APP_GROUPS " +
"FROM AP_GROUP_SUBSCRIPTION GS " +
"WHERE AP_APP_RELEASE_ID = ? AND TENANT_ID = ?";
if (uninstalled != null) {
sql += " AND UNSUBSCRIBED = ?";
}
if (searchName != null && !searchName.trim().isEmpty()) {
sql += " AND GS.GROUP_NAME LIKE ?";
}
sql += " LIMIT ? OFFSET ?";
String sql = "SELECT "
+ "GS.GROUP_NAME AS APP_GROUPS "
+ "FROM AP_GROUP_SUBSCRIPTION GS "
+ "WHERE "
+ "AP_APP_RELEASE_ID = ? AND TENANT_ID = ? LIMIT ? OFFSET ?";
try (PreparedStatement ps = conn.prepareStatement(sql)) {
int paramIndex = 1;
ps.setInt(paramIndex++, appReleaseId);
ps.setInt(paramIndex++, tenantId);
if (uninstalled != null) {
ps.setBoolean(paramIndex++, uninstalled);
}
if (searchName != null && !searchName.trim().isEmpty()) {
ps.setString(paramIndex++, "%" + searchName + "%");
}
ps.setInt(paramIndex++, limitValue);
ps.setInt(paramIndex, offsetValue);
ps.setInt(1, appReleaseId);
ps.setInt(2, tenantId);
ps.setInt(3, limitValue);
ps.setInt(4, offsetValue);
try (ResultSet rs = ps.executeQuery()) {
while (rs.next()) {
subscribedGroups.add(rs.getString("APP_GROUPS"));
@ -1360,11 +1297,11 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
}
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to get already " +
"subscribed/unsubscribed groups for given app release id.";
"subscribed groups for given app release id.";
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred while getting subscribed/unsubscribed groups for given " +
String msg = "SQL Error occurred while getting subscribed groups for given " +
"app release id.";
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
@ -1372,34 +1309,24 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
}
@Override
public int getSubscribedGroupCount(int appReleaseId, int tenantId, Boolean uninstalled, String searchName)
public int getSubscribedGroupCount(int appReleaseId, int tenantId)
throws ApplicationManagementDAOException {
if (log.isDebugEnabled()) {
log.debug("Request received in DAO Layer to get the count of subscribed/unsubscribed groups for " +
"given app release id.");
log.debug("Request received in DAO Layer to get already subscribed groups for " +
"given app release id.");
}
try {
Connection conn = this.getDBConnection();
String sql = "SELECT COUNT(GS.GROUP_NAME) AS APP_GROUPS_COUNT " +
"FROM AP_GROUP_SUBSCRIPTION GS " +
"WHERE AP_APP_RELEASE_ID = ? AND TENANT_ID = ?";
if (uninstalled != null) {
sql += " AND UNSUBSCRIBED = ?";
}
if (searchName != null && !searchName.trim().isEmpty()) {
sql += " AND GS.GROUP_NAME LIKE ?";
}
String sql = "SELECT "
+ "COUNT(GS.GROUP_NAME) AS APP_GROUPS_COUNT "
+ "FROM AP_GROUP_SUBSCRIPTION GS "
+ "WHERE "
+ "AP_APP_RELEASE_ID = ? AND TENANT_ID = ?";
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
int paramIndex = 1;
stmt.setInt(paramIndex++, appReleaseId);
stmt.setInt(paramIndex++, tenantId);
if (uninstalled != null) {
stmt.setBoolean(paramIndex++, uninstalled);
}
if (searchName != null && !searchName.trim().isEmpty()) {
stmt.setString(paramIndex++, "%" + searchName + "%");
}
stmt.setInt(1, appReleaseId);
stmt.setInt(2, tenantId);
try (ResultSet rs = stmt.executeQuery()) {
if (rs.next()) {
return rs.getInt("APP_GROUPS_COUNT");
@ -1408,13 +1335,12 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
return 0;
}
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to get the count of " +
"subscribed/unsubscribed groups for given app release id.";
String msg = "Error occurred while obtaining the DB connection to get already " +
"subscribed groups count for given app release id.";
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred while getting the count of subscribed/unsubscribed groups for given " +
"app release id.";
String msg = "SQL Error occurred while getting subscribed groups for given app release id.";
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}

@ -43,10 +43,10 @@ public class OracleSubscriptionDAOImpl extends GenericSubscriptionDAOImpl {
@Override
public List<String> getAppSubscribedUsers(int offsetValue, int limitValue, int appReleaseId,
int tenantId, Boolean uninstalled, String searchName)
int tenantId)
throws ApplicationManagementDAOException {
if (log.isDebugEnabled()) {
log.debug("Request received in DAO Layer to get already subscribed/unsubscribed users for " +
log.debug("Request received in DAO Layer to get already subscribed users for " +
"given app release id.");
}
try {
@ -55,28 +55,13 @@ public class OracleSubscriptionDAOImpl extends GenericSubscriptionDAOImpl {
String sql = "SELECT "
+ "US.USER_NAME AS USER "
+ "FROM AP_USER_SUBSCRIPTION US "
+ "WHERE AP_APP_RELEASE_ID = ? "
+ "AND TENANT_ID = ? ";
if (uninstalled != null) {
sql += "AND UNSUBSCRIBED = ? ";
}
if (searchName != null && !searchName.trim().isEmpty()) {
sql += "AND US.USER_NAME LIKE ? ";
}
sql += "ORDER BY US.ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
+ "WHERE "
+ "AP_APP_RELEASE_ID = ? AND TENANT_ID = ? ORDER BY US.ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
int index = 1;
stmt.setInt(index++, appReleaseId);
stmt.setInt(index++, tenantId);
if (uninstalled != null) {
stmt.setBoolean(index++, uninstalled);
}
if (searchName != null && !searchName.trim().isEmpty()) {
stmt.setString(index++, "%" + searchName + "%");
}
stmt.setInt(index++, offsetValue);
stmt.setInt(index, limitValue);
stmt.setInt(1, appReleaseId);
stmt.setInt(2, tenantId);
stmt.setInt(3, offsetValue);
stmt.setInt(4, limitValue);
try (ResultSet rs = stmt.executeQuery()) {
while (rs.next()) {
subscribedUsers.add(rs.getString("USER"));
@ -86,11 +71,11 @@ public class OracleSubscriptionDAOImpl extends GenericSubscriptionDAOImpl {
}
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to get already " +
"subscribed/unsubscribed users for given app release id.";
"subscribed users for given app release id.";
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred while getting subscribed/unsubscribed users for given app release id.";
String msg = "SQL Error occurred while getting subscribed users for given app release id.";
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
@ -98,10 +83,10 @@ public class OracleSubscriptionDAOImpl extends GenericSubscriptionDAOImpl {
@Override
public List<String> getAppSubscribedRoles(int offsetValue, int limitValue, int appReleaseId,
int tenantId, Boolean uninstalled, String searchName)
int tenantId)
throws ApplicationManagementDAOException {
if (log.isDebugEnabled()) {
log.debug("Request received in DAO Layer to get already subscribed/unsubscribed roles for " +
log.debug("Request received in DAO Layer to get already subscribed roles for " +
"given app release id.");
}
try {
@ -110,27 +95,13 @@ public class OracleSubscriptionDAOImpl extends GenericSubscriptionDAOImpl {
String sql = "SELECT "
+ "RS.ROLE_NAME AS ROLE "
+ "FROM AP_ROLE_SUBSCRIPTION RS "
+ "WHERE AP_APP_RELEASE_ID = ? "
+ "AND TENANT_ID = ? ";
if (uninstalled != null) {
sql += "AND UNSUBSCRIBED = ? ";
}
if (searchName != null && !searchName.trim().isEmpty()) {
sql += "AND RS.ROLE_NAME LIKE ? ";
}
sql += "ORDER BY RS.ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
+ "WHERE "
+ "AP_APP_RELEASE_ID = ? AND TENANT_ID = ? ORDER BY RS.ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
try (PreparedStatement ps = conn.prepareStatement(sql)) {
int paramIndex = 1;
ps.setInt(paramIndex++, appReleaseId);
ps.setInt(paramIndex++, tenantId);
if (uninstalled != null) {
ps.setBoolean(paramIndex++, uninstalled);
}
if (searchName != null && !searchName.trim().isEmpty()) {
ps.setString(paramIndex++, "%" + searchName + "%");
}
ps.setInt(paramIndex++, offsetValue);
ps.setInt(paramIndex, limitValue);
ps.setInt(1, appReleaseId);
ps.setInt(2, tenantId);
ps.setInt(3, offsetValue);
ps.setInt(4, limitValue);
try (ResultSet rs = ps.executeQuery()) {
while (rs.next()) {
subscribedRoles.add(rs.getString("ROLE"));
@ -140,11 +111,11 @@ public class OracleSubscriptionDAOImpl extends GenericSubscriptionDAOImpl {
}
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to get already " +
"subscribed/unsubscribed roles for given app release id.";
"subscribed roles for given app release id.";
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred while getting subscribed/unsubscribed roles for given app release id.";
String msg = "SQL Error occurred while getting subscribed roles for given app release id.";
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
@ -152,10 +123,11 @@ public class OracleSubscriptionDAOImpl extends GenericSubscriptionDAOImpl {
@Override
public List<String> getAppSubscribedGroups(int offsetValue, int limitValue, int appReleaseId,
int tenantId, Boolean uninstalled, String searchName)
int tenantId)
throws ApplicationManagementDAOException {
if (log.isDebugEnabled()) {
log.debug("Request received in DAO Layer to get subscribed/unsubscribed groups for the given app release ID.");
log.debug("Request received in DAO Layer to get already subscribed groups for " +
"given app release id.");
}
try {
Connection conn = this.getDBConnection();
@ -163,26 +135,13 @@ public class OracleSubscriptionDAOImpl extends GenericSubscriptionDAOImpl {
String sql = "SELECT "
+ "GS.GROUP_NAME AS GROUPS "
+ "FROM AP_GROUP_SUBSCRIPTION GS "
+ "WHERE AP_APP_RELEASE_ID = ? AND TENANT_ID = ?";
if (uninstalled != null) {
sql += " AND UNSUBSCRIBED = ?";
}
if (searchName != null && !searchName.trim().isEmpty()) {
sql += " AND GS.GROUP_NAME LIKE ?";
}
sql += " ORDER BY GS.ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
+ "WHERE "
+ "AP_APP_RELEASE_ID = ? AND TENANT_ID = ? ORDER BY GS.ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
try (PreparedStatement ps = conn.prepareStatement(sql)) {
int paramIndex = 1;
ps.setInt(paramIndex++, appReleaseId);
ps.setInt(paramIndex++, tenantId);
if (uninstalled != null) {
ps.setBoolean(paramIndex++, uninstalled);
}
if (searchName != null && !searchName.trim().isEmpty()) {
ps.setString(paramIndex++, "%" + searchName + "%");
}
ps.setInt(paramIndex++, offsetValue);
ps.setInt(paramIndex, limitValue);
ps.setInt(1, appReleaseId);
ps.setInt(2, tenantId);
ps.setInt(3, offsetValue);
ps.setInt(4, limitValue);
try (ResultSet rs = ps.executeQuery()) {
while (rs.next()) {
subscribedGroups.add(rs.getString("GROUPS"));
@ -191,12 +150,13 @@ public class OracleSubscriptionDAOImpl extends GenericSubscriptionDAOImpl {
return subscribedGroups;
}
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to get subscribed/unsubscribed groups" +
" for the given app release ID.";
String msg = "Error occurred while obtaining the DB connection to get already " +
"subscribed groups for given app release id.";
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred while getting subscribed/unsubscribed groups for the given app release ID.";
String msg = "SQL Error occurred while getting subscribed groups for given " +
"app release id.";
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}

@ -39,10 +39,10 @@ public class SQLServerSubscriptionDAOImpl extends GenericSubscriptionDAOImpl {
@Override
public List<String> getAppSubscribedUsers(int offsetValue, int limitValue, int appReleaseId,
int tenantId, Boolean uninstalled, String searchName)
int tenantId)
throws ApplicationManagementDAOException {
if (log.isDebugEnabled()) {
log.debug("Request received in DAO Layer to get already subscribed/unsubscribed users for " +
log.debug("Request received in DAO Layer to get already subscribed users for " +
"given app release id.");
}
try {
@ -51,28 +51,13 @@ public class SQLServerSubscriptionDAOImpl extends GenericSubscriptionDAOImpl {
String sql = "SELECT "
+ "US.USER_NAME AS USER_NAME "
+ "FROM AP_USER_SUBSCRIPTION US "
+ "WHERE AP_APP_RELEASE_ID = ? "
+ "AND TENANT_ID = ? ";
if (uninstalled != null) {
sql += "AND UNSUBSCRIBED = ? ";
}
if (searchName != null && !searchName.trim().isEmpty()) {
sql += "AND US.USER_NAME LIKE ? ";
}
sql += "ORDER BY US.ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
+ "WHERE "
+ "AP_APP_RELEASE_ID = ? AND TENANT_ID = ? ORDER BY US.ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
int index = 1;
stmt.setInt(index++, appReleaseId);
stmt.setInt(index++, tenantId);
if (uninstalled != null) {
stmt.setBoolean(index++, uninstalled);
}
if (searchName != null && !searchName.trim().isEmpty()) {
stmt.setString(index++, "%" + searchName + "%");
}
stmt.setInt(index++, offsetValue);
stmt.setInt(index, limitValue);
stmt.setInt(1, appReleaseId);
stmt.setInt(2, tenantId);
stmt.setInt(3, offsetValue);
stmt.setInt(4, limitValue);
try (ResultSet rs = stmt.executeQuery()) {
while (rs.next()) {
subscribedUsers.add(rs.getString("USER_NAME"));
@ -82,11 +67,11 @@ public class SQLServerSubscriptionDAOImpl extends GenericSubscriptionDAOImpl {
}
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to get already " +
"subscribed/unsubscribed users for given app release id.";
"subscribed users for given app release id.";
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred while getting subscribed/unsubscribed users for given app release id.";
String msg = "SQL Error occurred while getting subscribed users for given app release id.";
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
@ -94,10 +79,10 @@ public class SQLServerSubscriptionDAOImpl extends GenericSubscriptionDAOImpl {
@Override
public List<String> getAppSubscribedRoles(int offsetValue, int limitValue, int appReleaseId,
int tenantId, Boolean uninstalled, String searchName)
int tenantId)
throws ApplicationManagementDAOException {
if (log.isDebugEnabled()) {
log.debug("Request received in DAO Layer to get already subscribed/unsubscribed roles for " +
log.debug("Request received in DAO Layer to get already subscribed roles for " +
"given app release id.");
}
try {
@ -106,29 +91,13 @@ public class SQLServerSubscriptionDAOImpl extends GenericSubscriptionDAOImpl {
String sql = "SELECT "
+ "RS.ROLE_NAME AS ROLE "
+ "FROM AP_ROLE_SUBSCRIPTION RS "
+ "WHERE AP_APP_RELEASE_ID = ? "
+ "AND TENANT_ID = ? ";
if (uninstalled != null) {
sql += "AND UNSUBSCRIBED = ? ";
}
if (searchName != null && !searchName.trim().isEmpty()) {
sql += "AND RS.ROLE_NAME LIKE ? ";
}
sql += "ORDER BY RS.ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
+ "WHERE "
+ "AP_APP_RELEASE_ID = ? AND TENANT_ID = ? ORDER BY RS.ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
try (PreparedStatement ps = conn.prepareStatement(sql)) {
int paramIndex = 1;
ps.setInt(paramIndex++, appReleaseId);
ps.setInt(paramIndex++, tenantId);
if (uninstalled != null) {
ps.setBoolean(paramIndex++, uninstalled);
}
if (searchName != null && !searchName.trim().isEmpty()) {
ps.setString(paramIndex++, "%" + searchName + "%");
}
ps.setInt(paramIndex++, offsetValue);
ps.setInt(paramIndex, limitValue);
ps.setInt(1, appReleaseId);
ps.setInt(2, tenantId);
ps.setInt(3, offsetValue);
ps.setInt(4, limitValue);
try (ResultSet rs = ps.executeQuery()) {
while (rs.next()) {
subscribedRoles.add(rs.getString("ROLE"));
@ -138,11 +107,11 @@ public class SQLServerSubscriptionDAOImpl extends GenericSubscriptionDAOImpl {
}
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to get already " +
"subscribed/unsubscribed roles for given app release id.";
"subscribed roles for given app release id.";
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred while getting subscribed/unsubscribed roles for given app release id.";
String msg = "SQL Error occurred while getting subscribed roles for given app release id.";
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
@ -150,10 +119,11 @@ public class SQLServerSubscriptionDAOImpl extends GenericSubscriptionDAOImpl {
@Override
public List<String> getAppSubscribedGroups(int offsetValue, int limitValue, int appReleaseId,
int tenantId, Boolean uninstalled, String searchName)
int tenantId)
throws ApplicationManagementDAOException {
if (log.isDebugEnabled()) {
log.debug("Request received in DAO Layer to get subscribed/unsubscribed groups for the given app release ID.");
log.debug("Request received in DAO Layer to get already subscribed groups for " +
"given app release id.");
}
try {
Connection conn = this.getDBConnection();
@ -161,26 +131,13 @@ public class SQLServerSubscriptionDAOImpl extends GenericSubscriptionDAOImpl {
String sql = "SELECT "
+ "GS.GROUP_NAME AS GROUPS "
+ "FROM AP_GROUP_SUBSCRIPTION GS "
+ "WHERE AP_APP_RELEASE_ID = ? AND TENANT_ID = ?";
if (uninstalled != null) {
sql += " AND UNSUBSCRIBED = ?";
}
if (searchName != null && !searchName.trim().isEmpty()) {
sql += " AND GS.GROUP_NAME LIKE ?";
}
sql += " ORDER BY GS.ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
+ "WHERE "
+ "AP_APP_RELEASE_ID = ? AND TENANT_ID = ? ORDER BY GS.ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
try (PreparedStatement ps = conn.prepareStatement(sql)) {
int paramIndex = 1;
ps.setInt(paramIndex++, appReleaseId);
ps.setInt(paramIndex++, tenantId);
if (uninstalled != null) {
ps.setBoolean(paramIndex++, uninstalled);
}
if (searchName != null && !searchName.trim().isEmpty()) {
ps.setString(paramIndex++, "%" + searchName + "%");
}
ps.setInt(paramIndex++, offsetValue);
ps.setInt(paramIndex, limitValue);
ps.setInt(1, appReleaseId);
ps.setInt(2, tenantId);
ps.setInt(3, offsetValue);
ps.setInt(4, limitValue);
try (ResultSet rs = ps.executeQuery()) {
while (rs.next()) {
subscribedGroups.add(rs.getString("GROUPS"));
@ -189,11 +146,13 @@ public class SQLServerSubscriptionDAOImpl extends GenericSubscriptionDAOImpl {
return subscribedGroups;
}
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to get subscribed/unsubscribed groups for the given app release ID.";
String msg = "Error occurred while obtaining the DB connection to get already " +
"subscribed groups for given app release id.";
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred while getting subscribed/unsubscribed groups for the given app release ID.";
String msg = "SQL Error occurred while getting subscribed groups for given " +
"app release id.";
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}

@ -1498,8 +1498,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
}
@Override
public PaginationResult getAppInstalledSubscribers(int offsetValue, int limitValue, String appUUID, String subType,
Boolean uninstalled, String searchName)
public PaginationResult getAppInstalledSubscribers(int offsetValue, int limitValue, String appUUID, String subType)
throws ApplicationManagementException {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
@ -1514,16 +1513,20 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
if (SubscriptionType.USER.toString().equalsIgnoreCase(subType)) {
subscriptionList = subscriptionDAO
.getAppSubscribedUsers(offsetValue, limitValue, applicationReleaseId, tenantId, uninstalled, searchName);
count = subscriptionDAO.getSubscribedUserCount(applicationReleaseId, tenantId, uninstalled, searchName);
} else if (SubscriptionType.ROLE.toString().equalsIgnoreCase(subType)) {
subscriptionList = subscriptionDAO
.getAppSubscribedRoles(offsetValue, limitValue, applicationReleaseId, tenantId, uninstalled, searchName);
count = subscriptionDAO.getSubscribedRoleCount(applicationReleaseId, tenantId, uninstalled, searchName);
} else if (SubscriptionType.GROUP.toString().equalsIgnoreCase(subType)) {
subscriptionList = subscriptionDAO
.getAppSubscribedGroups(offsetValue, limitValue, applicationReleaseId, tenantId, uninstalled, searchName);
count = subscriptionDAO.getSubscribedGroupCount(applicationReleaseId, tenantId, uninstalled, searchName);
.getAppSubscribedUsers(offsetValue, limitValue, applicationReleaseId, tenantId);
count = subscriptionDAO.getSubscribedUserCount(applicationReleaseId, tenantId);
} else {
if (SubscriptionType.ROLE.toString().equalsIgnoreCase(subType)) {
subscriptionList = subscriptionDAO
.getAppSubscribedRoles(offsetValue, limitValue, applicationReleaseId, tenantId);
count = subscriptionDAO.getSubscribedRoleCount(applicationReleaseId, tenantId);
} else {
if (SubscriptionType.GROUP.toString().equalsIgnoreCase(subType)) {
subscriptionList = subscriptionDAO
.getAppSubscribedGroups(offsetValue, limitValue, applicationReleaseId, tenantId);
count = subscriptionDAO.getSubscribedGroupCount(applicationReleaseId, tenantId);
}
}
}
paginationResult.setData(subscriptionList);

@ -93,20 +93,6 @@ public class Feature implements Serializable {
)
private List<MetadataEntry> metadataEntries;
@ApiModelProperty(
name = "confirmationTexts",
value = "Disenroll delete confirmation modal texts.",
required = false
)
private ConfirmationTexts confirmationTexts;
@ApiModelProperty(
name = "dangerZoneTooltipTexts",
value = "Danger zone tooltip texts.",
required = false
)
private DangerZoneTooltipTexts dangerZoneTooltipTexts;
@XmlElement
public int getId() {
return id;
@ -187,24 +173,6 @@ public class Feature implements Serializable {
this.hidden = hidden;
}
@XmlElement
public ConfirmationTexts getConfirmationTexts() {
return confirmationTexts;
}
public void setConfirmationTexts(ConfirmationTexts confirmationTexts) {
this.confirmationTexts = confirmationTexts;
}
@XmlElement
public DangerZoneTooltipTexts getDangerZoneTooltipTexts() {
return dangerZoneTooltipTexts;
}
public void setDangerZoneTooltipTexts(DangerZoneTooltipTexts dangerZoneTooltipTexts) {
this.dangerZoneTooltipTexts = dangerZoneTooltipTexts;
}
public static class MetadataEntry implements Serializable {
private int id;
@ -235,136 +203,4 @@ public class Feature implements Serializable {
this.value = value;
}
}
public static class ConfirmationTexts implements Serializable {
private int id;
private String deleteConfirmModalTitle;
private String deleteConfirmModalText;
private String deleteConfirmationTextDescribe;
private String deleteConfirmationText;
private String cancelText;
private String confirmText;
private String inputLabel;
private String inputRequireMessage;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getCancelText() {
return cancelText;
}
public void setCancelText(String cancelText) {
this.cancelText = cancelText;
}
public String getConfirmText() {
return confirmText;
}
public void setConfirmText(String confirmText) {
this.confirmText = confirmText;
}
public String getInputLabel() {
return inputLabel;
}
public void setInputLabel(String inputLabel) {
this.inputLabel = inputLabel;
}
public String getInputRequireMessage() {
return inputRequireMessage;
}
public void setInputRequireMessage(String inputRequireMessage) {
this.inputRequireMessage = inputRequireMessage;
}
public String getDeleteConfirmModalTitle() {
return deleteConfirmModalTitle;
}
public void setDeleteConfirmModalTitle(String deleteConfirmModalTitle) {
this.deleteConfirmModalTitle = deleteConfirmModalTitle;
}
public String getDeleteConfirmModalText() {
return deleteConfirmModalText;
}
public void setDeleteConfirmModalText(String deleteConfirmModalText) {
this.deleteConfirmModalText = deleteConfirmModalText;
}
public String getDeleteConfirmationTextDescribe() {
return deleteConfirmationTextDescribe;
}
public void setDeleteConfirmationTextDescribe(String deleteConfirmationTextDescribe) {
this.deleteConfirmationTextDescribe = deleteConfirmationTextDescribe;
}
public String getDeleteConfirmationText() {
return deleteConfirmationText;
}
public void setDeleteConfirmationText(String deleteConfirmationText) {
this.deleteConfirmationText = deleteConfirmationText;
}
}
public static class DangerZoneTooltipTexts implements Serializable {
private String toolTipTitle;
private String toolTipPopConfirmText;
private String confirmText;
private String cancelText;
private String toolTipAvailable;
public String getToolTipAvailable() {
return toolTipAvailable;
}
public void setToolTipAvailable(String toolTipAvailable) {
this.toolTipAvailable = toolTipAvailable;
}
public String getToolTipTitle() {
return toolTipTitle;
}
public void setToolTipTitle(String toolTipTitle) {
this.toolTipTitle = toolTipTitle;
}
public String getToolTipPopConfirmText() {
return toolTipPopConfirmText;
}
public void setToolTipPopConfirmText(String toolTipPopConfirmText) {
this.toolTipPopConfirmText = toolTipPopConfirmText;
}
public String getConfirmText() {
return confirmText;
}
public void setConfirmText(String confirmText) {
this.confirmText = confirmText;
}
public String getCancelText() {
return cancelText;
}
public void setCancelText(String cancelText) {
this.cancelText = cancelText;
}
}
}

@ -25,7 +25,6 @@ import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.DeviceConfi
import io.entgra.device.mgt.core.device.mgt.common.general.TenantDetail;
import io.entgra.device.mgt.core.device.mgt.config.api.beans.ErrorResponse;
import io.swagger.annotations.*;
import io.entgra.device.mgt.core.device.mgt.core.operation.change.status.task.dto.OperationConfig;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
@ -78,13 +77,6 @@ import java.util.List;
key = "admin:permissions:add",
roles = {"Internal/devicemgt-user"},
permissions = {"/permissions/add"}
),
@Scope(
name = "Manage operation configuration",
description = "Add or update operation configuration",
key = "admin:operation_config:manage",
roles = {"Internal/devicemgt-user"},
permissions = {"/operation-configuration/manage"}
)
}
)
@ -327,173 +319,4 @@ public interface DeviceManagementConfigService {
})
@Produces(MediaType.APPLICATION_JSON)
Response addPermission(List<String> permissions);
@GET
@Path("/operation-configuration")
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = HttpMethod.GET,
value = "Getting operation configuration",
notes = "Retrieve the operation configuration",
tags = "Device Management Configuration",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = "scope", value = "admin:operation_config:manage")
})
}
)
@ApiResponses(value = {
@ApiResponse(
code = 200,
message = "OK. \n Successfully fetched the operation configuration.",
response = OperationConfig.class,
responseHeaders = {
@ResponseHeader(
name = "Content-Type",
description = "The content type of the body"),
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource was last modified.\n" +
"Used by caches, or in conditional requests."),
}),
@ApiResponse(
code = 400,
message = "Bad Request.",
response = ErrorResponse.class),
@ApiResponse(
code = 401,
message = "Unauthorized. \n Unauthorized operation! Only admin role can perform this operation."),
@ApiResponse(
code = 404,
message = "Not Found. \n No operation found",
response = ErrorResponse.class),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n Server error occurred while adding operation configuration.",
response = ErrorResponse.class)
})
Response getOperationConfiguration();
@POST
@Path("/operation-configuration")
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = HttpMethod.POST,
value = "Add operation configuration",
notes = "Add operation configuration.",
tags = "Device Management Configuration",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = "scope", value =
"admin:operation_config:manage")
})
}
)
@ApiResponses(value = {
@ApiResponse(code = 200, message = "OK. \n Successfully added the operation configuration.",
responseHeaders = {
@ResponseHeader(
name = "Content-Type",
description = "The content type of the body"),
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource was last modified.\n" +
"Used by caches, or in conditional requests."),
}),
@ApiResponse(
code = 400,
message = "The incoming request has wrong operation configuration.",
response = ErrorResponse.class),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n Server error occurred while adding operation configuration",
response = ErrorResponse.class)
})
@Produces(MediaType.APPLICATION_JSON)
Response addOperationConfiguration(OperationConfig config);
@PUT
@Path("/operation-configuration")
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = HttpMethod.PUT,
value = "Update operation configuration",
notes = "Update operation configuration.",
tags = "Device Management Configuration",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = "scope", value = "admin:operation_config:manage")
})
}
)
@ApiResponses(value = {
@ApiResponse(code = 200, message = "OK. \n Successfully Update the operation configuration.",
responseHeaders = {
@ResponseHeader(
name = "Content-Type",
description = "The content type of the body"),
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource was last modified.\n" +
"Used by caches, or in conditional requests."),
}),
@ApiResponse(
code = 400,
message = "The incoming request has wrong operation configuration.",
response = ErrorResponse.class),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n Server error occurred while adding operation configuration.",
response = ErrorResponse.class)
})
@Produces(MediaType.APPLICATION_JSON)
Response updateOperationConfiguration(OperationConfig config);
@DELETE
@Path("/operation-configuration")
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = HttpMethod.DELETE,
value = "Delete operation configuration",
notes = "Delete operation configuration",
tags = {"Device Management Configuration"},
extensions = {
@Extension(properties = {
@ExtensionProperty(name = "scope", value = "admin:operation_config:manage")
})
}
)
@ApiResponses(
value = {
@ApiResponse(
code = 200,
message = "OK. \n Successfully deleted the operation configuration",
response = Response.class),
@ApiResponse(
code = 400,
message = "Bad Request.",
response = Response.class),
@ApiResponse(
code = 404,
message = "Not Found. \n Operation configuration not provided",
response = Response.class),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n Server error occurred while deleting the operation configuration.",
response = Response.class)
}
)
Response deleteOperationConfiguration();
}

@ -22,12 +22,6 @@ import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.logging.Log;
import io.entgra.device.mgt.core.device.mgt.common.exceptions.OTPManagementException;
import io.entgra.device.mgt.core.device.mgt.core.operation.change.status.task.OperationConfigurationService;
import io.entgra.device.mgt.core.device.mgt.core.operation.change.status.task.dto.OperationConfig;
import io.entgra.device.mgt.core.device.mgt.core.operation.change.status.task.exceptions.OperationConfigAlreadyExistsException;
import io.entgra.device.mgt.core.device.mgt.core.operation.change.status.task.exceptions.OperationConfigException;
import io.entgra.device.mgt.core.device.mgt.core.operation.change.status.task.exceptions.OperationConfigNotFoundException;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.base.MultitenantConstants;
import org.wso2.carbon.context.PrivilegedCarbonContext;
@ -67,7 +61,6 @@ import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.DELETE;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
@ -320,89 +313,4 @@ public class DeviceManagementConfigServiceImpl implements DeviceManagementConfig
return Response.status(Response.Status.OK).build();
}
@GET
@Path("/operation-configuration")
@Produces({MediaType.APPLICATION_JSON})
public Response getOperationConfiguration() {
OperationConfig config;
try {
config = OperationConfigurationService.getOperationConfig();
} catch (OperationConfigException e) {
String msg = "Error occurred getting operation configuration";
log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
}
if (config == null) {
String msg = "Operation configuration not provided";
log.error(msg);
return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
} else {
return Response.status(Response.Status.OK).entity(config).build();
}
}
@POST
@Path("/operation-configuration")
@Produces({MediaType.APPLICATION_JSON})
public Response addOperationConfiguration(OperationConfig config) {
try {
if (config != null) {
OperationConfigurationService.addOperationConfiguration(config);
} else {
String msg = "Operation configuration not provided";
log.error(msg);
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
}
} catch (OperationConfigException e) {
String msg = "Error occurred adding operation configuration";
log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} catch (OperationConfigAlreadyExistsException e) {
String msg = "Operation configuration already exists";
log.error(msg, e);
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
}
return Response.status(Response.Status.OK).entity(config).build();
}
@PUT
@Path("/operation-configuration")
@Produces({MediaType.APPLICATION_JSON})
public Response updateOperationConfiguration(OperationConfig config) {
try {
if (config != null) {
OperationConfigurationService.updateOperationConfiguration(config);
} else {
String msg = "Operation configuration body not provided";
log.error(msg);
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
}
} catch (OperationConfigException e) {
String msg = "Error occurred adding operation configuration";
log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
}
return Response.status(Response.Status.OK).entity(config).build();
}
@DELETE
@Path("/operation-configuration")
@Produces({MediaType.APPLICATION_JSON})
public Response deleteOperationConfiguration() {
String msg;
try {
OperationConfigurationService.deleteOperationConfiguration();
} catch (OperationConfigException e) {
msg = "Error occurred while deleting operation configuration";
log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} catch (OperationConfigNotFoundException e) {
msg = "Operation configuration not provided";
log.error(msg, e);
return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
}
msg = "Operation configuration deleted successfully";
log.info(msg);
return Response.status(Response.Status.OK).entity(msg).build();
}
}

@ -1365,7 +1365,7 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl {
query += " AND i.VALUE_FIELD LIKE ?" ;
}
if (user != null && !user.isEmpty()) {
query += " AND e.OWNER LIKE ?";
query += " AND e.OWNER = ?";
isOwnerProvided = true;
}
if (status != null && !status.isEmpty()) {
@ -1395,7 +1395,7 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl {
ps.setString(index++, EnrolmentInfo.Status.REMOVED.toString());
ps.setString(index++, EnrolmentInfo.Status.DELETED.toString());
if (isDeviceNameProvided) {
ps.setString(index++, "%" + name + "%");
ps.setString(index++, name + "%");
}
if (isOwnershipProvided) {
ps.setString(index++, ownership);
@ -1404,7 +1404,7 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl {
ps.setString(index++, "%" + serial + "%");
}
if (isOwnerProvided) {
ps.setString(index++, "%" + user + "%");
ps.setString(index++, user);
}
if (isStatusProvided) {
for (String deviceStatus : status) {

@ -1105,7 +1105,7 @@ public class PostgreSQLDeviceDAOImpl extends GenericDeviceDAOImpl {
isOwnershipProvided = true;
}
if (user != null && !user.isEmpty()) {
query += " AND e.OWNER LIKE ?";
query += " AND e.OWNER = ?";
isOwnerProvided = true;
}
if (status != null && !status.isEmpty()) {
@ -1136,13 +1136,13 @@ public class PostgreSQLDeviceDAOImpl extends GenericDeviceDAOImpl {
ps.setString(index++, EnrolmentInfo.Status.REMOVED.toString());
ps.setString(index++, EnrolmentInfo.Status.DELETED.toString());
if (isDeviceNameProvided) {
ps.setString(index++, "%" + name + "%");
ps.setString(index++, name + "%");
}
if (isOwnershipProvided) {
ps.setString(index++, ownership);
}
if (isOwnerProvided) {
ps.setString(index++, "%" + user + "%");
ps.setString(index++, user);
}
if (isStatusProvided) {
for (String deviceStatus : status) {

@ -977,7 +977,7 @@ public class SQLServerDeviceDAOImpl extends GenericDeviceDAOImpl {
isOwnershipProvided = true;
}
if (user != null && !user.isEmpty()) {
query += " AND e.OWNER LIKE ?";
query += " AND e.OWNER = ?";
isOwnerProvided = true;
}
if (status != null && !status.isEmpty()) {
@ -1008,13 +1008,13 @@ public class SQLServerDeviceDAOImpl extends GenericDeviceDAOImpl {
ps.setString(index++, EnrolmentInfo.Status.REMOVED.toString());
ps.setString(index++, EnrolmentInfo.Status.DELETED.toString());
if (isDeviceNameProvided) {
ps.setString(index++, "%" + name + "%");
ps.setString(index++, name + "%");
}
if (isOwnershipProvided) {
ps.setString(index++, ownership);
}
if (isOwnerProvided) {
ps.setString(index++, "%" + user + "%");
ps.setString(index++, user);
}
if (isStatusProvided) {
for (String deviceStatus : status) {

@ -100,7 +100,6 @@ public class DeviceManagementDataHolder {
private DeviceStatusManagementService deviceStatusManagementService;
private APIApplicationServices apiApplicationServices;
private PublisherRESTAPIServices publisherRESTAPIServices;
private DeviceManagementStartupHandler deviceManagementStartupHandler;
private final Map<DeviceType, DeviceStatusTaskPluginConfig> deviceStatusTaskPluginConfigs = Collections.synchronizedMap(
new HashMap<>());
@ -458,12 +457,4 @@ public class DeviceManagementDataHolder {
public void setGroupAccessAuthorizationService(GroupAccessAuthorizationService groupAccessAuthorizationService) {
this.groupAccessAuthorizationService = groupAccessAuthorizationService;
}
public DeviceManagementStartupHandler getDeviceManagementStartupHandler() {
return deviceManagementStartupHandler;
}
public void setDeviceManagementStartupHandler(DeviceManagementStartupHandler deviceManagementStartupHandler) {
this.deviceManagementStartupHandler = deviceManagementStartupHandler;
}
}

@ -259,10 +259,8 @@ public class DeviceManagementServiceComponent {
TenantCreateObserver listener = new TenantCreateObserver();
bundleContext.registerService(Axis2ConfigurationContextObserver.class.getName(), listener, null);
/* Registering Device Management Startup Handler */
DeviceManagementStartupHandler deviceManagementStartupHandler = new DeviceManagementStartupHandler();
DeviceManagementDataHolder.getInstance().setDeviceManagementStartupHandler(deviceManagementStartupHandler);
bundleContext.registerService(ServerStartupObserver.class.getName(), deviceManagementStartupHandler, null);
UserRoleCreateObserver userRoleCreateObserver = new UserRoleCreateObserver();
bundleContext.registerService(ServerStartupObserver.class.getName(), userRoleCreateObserver, null);
/* Registering Device Management Service */
DeviceManagementProviderService deviceManagementProvider = new DeviceManagementProviderServiceImpl();

@ -1,149 +0,0 @@
/*
* Copyright (c) 2018 - 2024, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
*
* Entgra (Pvt) Ltd. 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 io.entgra.device.mgt.core.device.mgt.core.internal;
import com.google.gson.Gson;
import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException;
import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException;
import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata;
import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.MetadataManagementService;
import io.entgra.device.mgt.core.device.mgt.core.DeviceManagementConstants;
import io.entgra.device.mgt.core.device.mgt.core.operation.change.status.task.dto.OperationConfig;
import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationDAO;
import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOException;
import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.core.ServerStartupObserver;
import org.wso2.carbon.user.api.AuthorizationManager;
import org.wso2.carbon.user.api.Permission;
import org.wso2.carbon.user.api.UserStoreException;
import org.wso2.carbon.user.api.UserStoreManager;
import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
public class DeviceManagementStartupHandler implements ServerStartupObserver {
private static final Log log = LogFactory.getLog(DeviceManagementStartupHandler.class);
private static final Gson gson = new Gson();
private static final String OPERATION_CONFIG = "OPERATION_CONFIG";
private static final String tenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
@Override
public void completingServerStartup() {
}
@Override
public void completedServerStartup() {
userRoleCreateObserver();
operationStatusChangeObserver();
}
private void userRoleCreateObserver() {
try {
UserStoreManager userStoreManager =
DeviceManagementDataHolder.getInstance().getRealmService().getTenantUserRealm(
MultitenantConstants.SUPER_TENANT_ID).getUserStoreManager();
String tenantAdminName =
DeviceManagementDataHolder.getInstance().getRealmService().getTenantUserRealm(
MultitenantConstants.SUPER_TENANT_ID).getRealmConfiguration().getAdminUserName();
AuthorizationManager authorizationManager = DeviceManagementDataHolder.getInstance().getRealmService()
.getTenantUserRealm(MultitenantConstants.SUPER_TENANT_ID).getAuthorizationManager();
if (!userStoreManager.isExistingRole(DeviceManagementConstants.User.DEFAULT_DEVICE_ADMIN)) {
userStoreManager.addRole(
DeviceManagementConstants.User.DEFAULT_DEVICE_ADMIN,
null,
DeviceManagementConstants.User.PERMISSIONS_FOR_DEVICE_ADMIN);
} else {
for (Permission permission : DeviceManagementConstants.User.PERMISSIONS_FOR_DEVICE_ADMIN) {
authorizationManager.authorizeRole(DeviceManagementConstants.User.DEFAULT_DEVICE_ADMIN,
permission.getResourceId(), permission.getAction());
}
}
if (!userStoreManager.isExistingRole(DeviceManagementConstants.User.DEFAULT_DEVICE_USER)) {
userStoreManager.addRole(
DeviceManagementConstants.User.DEFAULT_DEVICE_USER,
null,
DeviceManagementConstants.User.PERMISSIONS_FOR_DEVICE_USER);
} else {
for (Permission permission : DeviceManagementConstants.User.PERMISSIONS_FOR_DEVICE_USER) {
authorizationManager.authorizeRole(DeviceManagementConstants.User.DEFAULT_DEVICE_USER,
permission.getResourceId(), permission.getAction());
}
}
userStoreManager.updateRoleListOfUser(tenantAdminName, null,
new String[]{DeviceManagementConstants.User.DEFAULT_DEVICE_ADMIN,
DeviceManagementConstants.User.DEFAULT_DEVICE_USER});
if (log.isDebugEnabled()) {
log.debug("Device management roles: " + DeviceManagementConstants.User.DEFAULT_DEVICE_USER + ", " +
DeviceManagementConstants.User.DEFAULT_DEVICE_ADMIN + " created for the tenant:" + tenantDomain + "."
);
log.debug("Tenant administrator: " + tenantAdminName + "@" + tenantDomain +
" is assigned to the role:" + DeviceManagementConstants.User.DEFAULT_DEVICE_ADMIN + "."
);
}
} catch (UserStoreException e) {
log.error("Error occurred while creating roles for the tenant: " + tenantDomain + ".");
}
}
private void operationStatusChangeObserver () {
MetadataManagementService metadataManagementService = DeviceManagementDataHolder
.getInstance().getMetadataManagementService();
OperationDAO operationDAO = OperationManagementDAOFactory.getOperationDAO();
Metadata metadata;
int numOfRecordsUpdated;
try {
metadata = metadataManagementService.retrieveMetadata(OPERATION_CONFIG);
if (metadata != null) {
OperationConfig operationConfiguration = gson.fromJson(metadata.getMetaValue(), OperationConfig.class);
String[] deviceTypes = operationConfiguration.getDeviceTypes();
String initialOperationStatus = operationConfiguration.getInitialOperationStatus();
String requiredStatusChange = operationConfiguration.getRequiredStatusChange();
for (String deviceType : deviceTypes) {
try {
OperationManagementDAOFactory.beginTransaction();
try {
numOfRecordsUpdated = operationDAO.updateOperationByDeviceTypeAndInitialStatus(deviceType,
initialOperationStatus, requiredStatusChange);
log.info(numOfRecordsUpdated + " operations updated successfully for the" + deviceType);
OperationManagementDAOFactory.commitTransaction();
} catch (OperationManagementDAOException e) {
OperationManagementDAOFactory.rollbackTransaction();
String msg = "Error occurred while updating operation status. DeviceType : " + deviceType + ", " +
"Initial operation status: " + initialOperationStatus + ", Required status:" + requiredStatusChange;
log.error(msg, e);
}
} catch (TransactionManagementException e) {
String msg = "Transactional error occurred while updating the operation status";
log.error(msg, e);
} finally {
OperationManagementDAOFactory.closeConnection();
}
}
} else {
log.info("Operation configuration not provided");
}
} catch (MetadataManagementException e) {
String msg = "Error occurred while retrieving the operation configuration";
log.error(msg, e);
}
}
}

@ -0,0 +1,89 @@
/*
* Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
*
* Entgra (Pvt) Ltd. 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 io.entgra.device.mgt.core.device.mgt.core.internal;
import io.entgra.device.mgt.core.device.mgt.core.DeviceManagementConstants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.core.ServerStartupObserver;
import org.wso2.carbon.user.api.AuthorizationManager;
import org.wso2.carbon.user.api.Permission;
import org.wso2.carbon.user.api.UserStoreException;
import org.wso2.carbon.user.api.UserStoreManager;
import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
public class UserRoleCreateObserver implements ServerStartupObserver {
private static final Log log = LogFactory.getLog(UserRoleCreateObserver.class);
@Override
public void completingServerStartup() {
}
@Override
public void completedServerStartup() {
String tenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
try {
UserStoreManager userStoreManager =
DeviceManagementDataHolder.getInstance().getRealmService().getTenantUserRealm(
MultitenantConstants.SUPER_TENANT_ID).getUserStoreManager();
String tenantAdminName =
DeviceManagementDataHolder.getInstance().getRealmService().getTenantUserRealm(
MultitenantConstants.SUPER_TENANT_ID).getRealmConfiguration().getAdminUserName();
AuthorizationManager authorizationManager = DeviceManagementDataHolder.getInstance().getRealmService()
.getTenantUserRealm(MultitenantConstants.SUPER_TENANT_ID).getAuthorizationManager();
if (!userStoreManager.isExistingRole(DeviceManagementConstants.User.DEFAULT_DEVICE_ADMIN)) {
userStoreManager.addRole(
DeviceManagementConstants.User.DEFAULT_DEVICE_ADMIN,
null,
DeviceManagementConstants.User.PERMISSIONS_FOR_DEVICE_ADMIN);
} else {
for (Permission permission : DeviceManagementConstants.User.PERMISSIONS_FOR_DEVICE_ADMIN) {
authorizationManager.authorizeRole(DeviceManagementConstants.User.DEFAULT_DEVICE_ADMIN,
permission.getResourceId(), permission.getAction());
}
}
if (!userStoreManager.isExistingRole(DeviceManagementConstants.User.DEFAULT_DEVICE_USER)) {
userStoreManager.addRole(
DeviceManagementConstants.User.DEFAULT_DEVICE_USER,
null,
DeviceManagementConstants.User.PERMISSIONS_FOR_DEVICE_USER);
} else {
for (Permission permission : DeviceManagementConstants.User.PERMISSIONS_FOR_DEVICE_USER) {
authorizationManager.authorizeRole(DeviceManagementConstants.User.DEFAULT_DEVICE_USER,
permission.getResourceId(), permission.getAction());
}
}
userStoreManager.updateRoleListOfUser(tenantAdminName, null,
new String[] {DeviceManagementConstants.User.DEFAULT_DEVICE_ADMIN,
DeviceManagementConstants.User.DEFAULT_DEVICE_USER});
if (log.isDebugEnabled()) {
log.debug("Device management roles: " + DeviceManagementConstants.User.DEFAULT_DEVICE_USER + ", " +
DeviceManagementConstants.User.DEFAULT_DEVICE_ADMIN + " created for the tenant:" + tenantDomain + "."
);
log.debug("Tenant administrator: " + tenantAdminName + "@" + tenantDomain +
" is assigned to the role:" + DeviceManagementConstants.User.DEFAULT_DEVICE_ADMIN + "."
);
}
} catch (UserStoreException e) {
log.error("Error occurred while creating roles for the tenant: " + tenantDomain + ".");
}
}
}

@ -1,113 +0,0 @@
/*
* Copyright (c) 2018 - 2024, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
*
* Entgra (Pvt) Ltd. 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 io.entgra.device.mgt.core.device.mgt.core.operation.change.status.task;
import com.google.gson.Gson;
import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataKeyAlreadyExistsException;
import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataKeyNotFoundException;
import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException;
import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata;
import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.MetadataManagementService;
import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder;
import io.entgra.device.mgt.core.device.mgt.core.operation.change.status.task.dto.OperationConfig;
import io.entgra.device.mgt.core.device.mgt.core.operation.change.status.task.exceptions.OperationConfigAlreadyExistsException;
import io.entgra.device.mgt.core.device.mgt.core.operation.change.status.task.exceptions.OperationConfigException;
import io.entgra.device.mgt.core.device.mgt.core.operation.change.status.task.exceptions.OperationConfigNotFoundException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class OperationConfigurationService {
private static final Log log = LogFactory.getLog(OperationConfigurationService.class);
private static final Gson gson = new Gson();
private static final String STRING = "STRING";
private static final String OPERATION_CONFIG = "OPERATION_CONFIG";
static MetadataManagementService metadataManagementService = DeviceManagementDataHolder.getInstance().getMetadataManagementService();
public static OperationConfig getOperationConfig() throws OperationConfigException {
Metadata metadata;
try {
metadata = metadataManagementService.retrieveMetadata(OPERATION_CONFIG);
} catch (MetadataManagementException e) {
String msg = "Error occurred while retrieving operation configuration";
log.error(msg, e);
throw new OperationConfigException(msg, e);
}
if (metadata != null) {
return gson.fromJson(metadata.getMetaValue(), OperationConfig.class);
} else {
return null;
}
}
public static void addOperationConfiguration(OperationConfig config) throws OperationConfigException,
OperationConfigAlreadyExistsException {
Metadata metadata = new Metadata();
metadata.setDataType(STRING);
metadata.setMetaKey(OPERATION_CONFIG);
metadata.setMetaValue(gson.toJson(config));
try {
metadataManagementService.createMetadata(metadata);
} catch (MetadataManagementException e) {
String msg = "Error occurred while adding operation configuration";
log.error(msg, e);
throw new OperationConfigException(msg, e);
} catch (MetadataKeyAlreadyExistsException e) {
String msg = "Operation configuration already exists";
log.error(msg, e);
throw new OperationConfigAlreadyExistsException(msg, e);
}
}
public static void updateOperationConfiguration(OperationConfig config) throws OperationConfigException {
Metadata metadata = new Metadata();
metadata.setDataType(STRING);
metadata.setMetaKey(OPERATION_CONFIG);
metadata.setMetaValue(gson.toJson(config));
try {
metadataManagementService.updateMetadata(metadata);
} catch (MetadataManagementException e) {
String msg = "Error occurred while updating operation configuration";
log.error(msg, e);
throw new OperationConfigException(msg, e);
}
}
public static void deleteOperationConfiguration() throws OperationConfigException, OperationConfigNotFoundException {
try {
metadataManagementService.deleteMetadata(OPERATION_CONFIG);
} catch (MetadataManagementException e) {
String msg = "Error occurred while deleting operation configuration";
log.error(msg, e);
throw new OperationConfigException(msg, e);
} catch (MetadataKeyNotFoundException e) {
String msg = "Operation configuration already exists";
log.error(msg, e);
throw new OperationConfigNotFoundException(msg, e);
}
}
}

@ -1,55 +0,0 @@
/*
* Copyright (c) 2018 - 2024, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
*
* Entgra (Pvt) Ltd. 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 io.entgra.device.mgt.core.device.mgt.core.operation.change.status.task.dto;
/**
* DTO for Operation configuration.
*/
public class OperationConfig {
private String[] deviceTypes;
private String initialOperationStatus;
private String requiredStatusChange;
public String[] getDeviceTypes() {
return deviceTypes;
}
public void setDeviceTypes(String[] deviceTypes) {
this.deviceTypes = deviceTypes;
}
public String getInitialOperationStatus() {
return initialOperationStatus;
}
public void setInitialOperationStatus(String initialOperationStatus) {
this.initialOperationStatus = initialOperationStatus;
}
public String getRequiredStatusChange() {
return requiredStatusChange;
}
public void setRequiredStatusChange(String requiredStatusChange) {
this.requiredStatusChange = requiredStatusChange;
}
}

@ -1,60 +0,0 @@
/*
* Copyright (c) 2018 - 2024, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
*
* Entgra (Pvt) Ltd. 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 io.entgra.device.mgt.core.device.mgt.core.operation.change.status.task.exceptions;
/**
* Custom exception class to be used in operation configuration service related functionalities.
*/
public class OperationConfigAlreadyExistsException extends Exception {
private static final long serialVersionUID = -1814347544027733436L;
private String errorMessage;
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public OperationConfigAlreadyExistsException(String msg, Exception nestedEx) {
super(msg, nestedEx);
setErrorMessage(msg);
}
public OperationConfigAlreadyExistsException(String message, Throwable cause) {
super(message, cause);
setErrorMessage(message);
}
public OperationConfigAlreadyExistsException(String msg) {
super(msg);
setErrorMessage(msg);
}
public OperationConfigAlreadyExistsException() {
super();
}
public OperationConfigAlreadyExistsException(Throwable cause) {
super(cause);
}
}

@ -1,60 +0,0 @@
/*
* Copyright (c) 2018 - 2024, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
*
* Entgra (Pvt) Ltd. 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 io.entgra.device.mgt.core.device.mgt.core.operation.change.status.task.exceptions;
/**
* Custom exception class to be used in operation configuration related functionalities.
*/
public class OperationConfigException extends Exception {
private static final long serialVersionUID = -8933146283800122661L;
private String errorMessage;
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public OperationConfigException(String msg, Exception nestedEx) {
super(msg, nestedEx);
setErrorMessage(msg);
}
public OperationConfigException(String message, Throwable cause) {
super(message, cause);
setErrorMessage(message);
}
public OperationConfigException(String msg) {
super(msg);
setErrorMessage(msg);
}
public OperationConfigException() {
super();
}
public OperationConfigException(Throwable cause) {
super(cause);
}
}

@ -1,60 +0,0 @@
/*
* Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
*
* Entgra (Pvt) Ltd. 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 io.entgra.device.mgt.core.device.mgt.core.operation.change.status.task.exceptions;
/**
* Custom exception class to be used in Operation configuration related functionalities.
*/
public class OperationConfigNotFoundException extends Exception {
private static final long serialVersionUID = 5260831982626354815L;
private String errorMessage;
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public OperationConfigNotFoundException(String msg, Exception nestedEx) {
super(msg, nestedEx);
setErrorMessage(msg);
}
public OperationConfigNotFoundException(String message, Throwable cause) {
super(message, cause);
setErrorMessage(message);
}
public OperationConfigNotFoundException(String msg) {
super(msg);
setErrorMessage(msg);
}
public OperationConfigNotFoundException() {
super();
}
public OperationConfigNotFoundException(Throwable cause) {
super(cause);
}
}

@ -61,9 +61,6 @@ public interface OperationDAO {
boolean updateOperationStatus(int enrolmentId, int operationId,Operation.Status status)
throws OperationManagementDAOException;
int updateOperationByDeviceTypeAndInitialStatus(String deiceType, String initialStatus, String requiredStatus)
throws OperationManagementDAOException;
void updateEnrollmentOperationsStatus(int enrolmentId, String operationCode, Operation.Status existingStatus,
Operation.Status newStatus) throws OperationManagementDAOException;

@ -128,38 +128,6 @@ public class GenericOperationDAOImpl implements OperationDAO {
return isUpdated;
}
public int updateOperationByDeviceTypeAndInitialStatus(String deiceType, String initialStatus, String requiredStatus)
throws OperationManagementDAOException {
int numOfRecordsUpdated;
long time = DeviceManagementDAOUtil.getCurrentUTCTime();
String sql = "UPDATE DM_ENROLMENT_OP_MAPPING SET STATUS=?, UPDATED_TIMESTAMP=? WHERE DEVICE_TYPE=?";
if (initialStatus == null) {
sql += " AND STATUS IS NULL";
} else {
sql += " AND STATUS=?";
}
try (
Connection connection = OperationManagementDAOFactory.getConnection();
PreparedStatement stmt = connection.prepareStatement(sql)
) {
stmt.setString(1, requiredStatus);
stmt.setLong(2, time);
stmt.setString(3, deiceType);
if (initialStatus != null) {
stmt.setString(4, initialStatus);
}
numOfRecordsUpdated = stmt.executeUpdate();
} catch (SQLException e) {
throw new OperationManagementDAOException("Error occurred while update device mapping operation status " +
e.getMessage(), e);
}
return numOfRecordsUpdated;
}
@Override
public void updateEnrollmentOperationsStatus(int enrolmentId, String operationCode, Operation.Status existingStatus,
Operation.Status newStatus) throws OperationManagementDAOException {

@ -672,7 +672,7 @@ CREATE TABLE IF NOT EXISTS DM_METADATA (
-- DM_TAG TABLE --
CREATE TABLE IF NOT EXISTS DM_TAG (
ID INTEGER AUTO_INCREMENT,
ID BIGINT AUTO_INCREMENT,
NAME VARCHAR(255) NOT NULL,
DESCRIPTION VARCHAR(255) NULL,
TENANT_ID INTEGER NOT NULL,
@ -683,8 +683,8 @@ CREATE TABLE IF NOT EXISTS DM_TAG (
-- DM_DEVICE_TAG_MAPPING TABLE --
CREATE TABLE IF NOT EXISTS DM_DEVICE_TAG_MAPPING (
ENROLMENT_ID INTEGER NOT NULL,
TAG_ID INTEGER NOT NULL,
ENROLMENT_ID BIGINT NOT NULL,
TAG_ID BIGINT NOT NULL,
TENANT_ID INTEGER NOT NULL,
PRIMARY KEY (ENROLMENT_ID, TAG_ID, TENANT_ID),
FOREIGN KEY (ENROLMENT_ID) REFERENCES DM_ENROLMENT(ID),

@ -79,29 +79,6 @@ public class HTTPDeviceTypeManagerService extends DeviceTypeManagerService imple
}
configFeature.setMetaData(metaValues);
}
if (feature.getConfirmationTexts() != null) {
List<String> confirmationTextValues = new ArrayList<>();
Feature.ConfirmationTexts confirmationText = feature.getConfirmationTexts();
confirmationTextValues.add(confirmationText.getDeleteConfirmModalTitle());
confirmationTextValues.add(confirmationText.getDeleteConfirmModalText());
confirmationTextValues.add(confirmationText.getDeleteConfirmationTextDescribe());
confirmationTextValues.add(confirmationText.getDeleteConfirmationText());
confirmationTextValues.add(confirmationText.getCancelText());
confirmationTextValues.add(confirmationText.getConfirmText());
confirmationTextValues.add(confirmationText.getInputLabel());
confirmationTextValues.add(confirmationText.getInputRequireMessage());
configFeature.setConfirmationTexts(confirmationTextValues);
}
if (feature.getDangerZoneTooltipTexts() != null) {
List<String> dangerZoneTextValues = new ArrayList<>();
Feature.DangerZoneTooltipTexts dangerZoneText = feature.getDangerZoneTooltipTexts();
dangerZoneTextValues.add(dangerZoneText.getToolTipTitle());
dangerZoneTextValues.add(dangerZoneText.getToolTipPopConfirmText());
dangerZoneTextValues.add(dangerZoneText.getConfirmText());
dangerZoneTextValues.add(dangerZoneText.getCancelText());
dangerZoneTextValues.add(dangerZoneText.getToolTipAvailable());
configFeature.setDangerZoneTooltipTexts(dangerZoneTextValues);
}
featureList.add(configFeature);
}
}

@ -1,127 +0,0 @@
/*
* Copyright (c) 2018 - 2024, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
*
* Entgra (Pvt) Ltd. 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 io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "confirmationTexts", propOrder = {
"deleteConfirmModalTitle",
"deleteConfirmModalText",
"deleteConfirmationTextDescribe",
"deleteConfirmationText",
"cancelText",
"confirmText",
"inputLabel",
"inputRequireMessage"
})
public class ConfirmationTexts {
@XmlElement(name = "deleteConfirmModalTitle")
private String deleteConfirmModalTitle;
@XmlElement(name = "deleteConfirmModalText")
private String deleteConfirmModalText;
@XmlElement(name = "deleteConfirmationTextDescribe")
private String deleteConfirmationTextDescribe;
@XmlElement(name = "deleteConfirmationText")
private String deleteConfirmationText;
@XmlElement(name = "cancelText")
private String cancelText;
@XmlElement(name = "confirmText")
private String confirmText;
@XmlElement(name = "inputLabel")
private String inputLabel;
@XmlElement(name = "inputRequireMessage")
private String inputRequireMessage;
public String getCancelText() {
return cancelText;
}
public void setCancelText(String cancelText) {
this.cancelText = cancelText;
}
public String getInputRequireMessage() {
return inputRequireMessage;
}
public void setInputRequireMessage(String inputRequireMessage) {
this.inputRequireMessage = inputRequireMessage;
}
public String getInputLabel() {
return inputLabel;
}
public void setInputLabel(String inputLabel) {
this.inputLabel = inputLabel;
}
public String getConfirmText() {
return confirmText;
}
public void setConfirmText(String confirmText) {
this.confirmText = confirmText;
}
public String getDeleteConfirmModalTitle() {
return deleteConfirmModalTitle;
}
public void setDeleteConfirmModalTitle(String deleteConfirmModalTitle) {
this.deleteConfirmModalTitle = deleteConfirmModalTitle;
}
public String getDeleteConfirmModalText() {
return deleteConfirmModalText;
}
public void setDeleteConfirmModalText(String deleteConfirmModalText) {
this.deleteConfirmModalText = deleteConfirmModalText;
}
public String getDeleteConfirmationTextDescribe() {
return deleteConfirmationTextDescribe;
}
public void setDeleteConfirmationTextDescribe(String deleteConfirmationTextDescribe) {
this.deleteConfirmationTextDescribe = deleteConfirmationTextDescribe;
}
public String getDeleteConfirmationText() {
return deleteConfirmationText;
}
public void setDeleteConfirmationText(String deleteConfirmationText) {
this.deleteConfirmationText = deleteConfirmationText;
}
}

@ -1,90 +0,0 @@
/*
* Copyright (c) 2018 - 2024, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
*
* Entgra (Pvt) Ltd. 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 io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "dangerZoneTooltipTexts", propOrder = {
"toolTipTitle",
"toolTipPopConfirmText",
"confirmText",
"cancelText",
"toolTipAvailable"
})
public class DangerZoneTooltipTexts {
@XmlElement(name = "toolTipTitle")
private String toolTipTitle;
@XmlElement(name = "toolTipPopConfirmText")
private String toolTipPopConfirmText;
@XmlElement(name = "confirmText")
private String confirmText;
@XmlElement(name = "cancelText")
private String cancelText;
@XmlElement(name = "toolTipAvailable")
private String toolTipAvailable;
public String getToolTipAvailable() {
return toolTipAvailable;
}
public void setToolTipAvailable(String toolTipAvailable) {
this.toolTipAvailable = toolTipAvailable;
}
public String getToolTipTitle() {
return toolTipTitle;
}
public void setToolTipTitle(String toolTipTitle) {
this.toolTipTitle = toolTipTitle;
}
public String getToolTipPopConfirmText() {
return toolTipPopConfirmText;
}
public void setToolTipPopConfirmText(String toolTipPopConfirmText) {
this.toolTipPopConfirmText = toolTipPopConfirmText;
}
public String getConfirmText() {
return confirmText;
}
public void setConfirmText(String confirmText) {
this.confirmText = confirmText;
}
public String getCancelText() {
return cancelText;
}
public void setCancelText(String cancelText) {
this.cancelText = cancelText;
}
}

@ -47,9 +47,7 @@ import java.util.List;
"description",
"tooltip",
"operation",
"metaData",
"confirmationTexts",
"dangerZoneTooltipTexts"
"metaData"
})
public class Feature {
@ -75,12 +73,6 @@ public class Feature {
@XmlElement(name = "Property", required = true)
private List<String> metaData;
@XmlElement(name = "ConfirmationTexts", required = false)
private List<String> confirmationTexts;
@XmlElement(name = "DangerZoneTooltipTexts", required = false)
private List<String> dangerZoneTooltipTexts;
/**
* Gets the value of the name property.
*
@ -217,20 +209,4 @@ public class Feature {
public void setType(String type) {
this.type = type;
}
public List<String> getConfirmationTexts() {
return confirmationTexts;
}
public void setConfirmationTexts(List<String> confirmationTexts) {
this.confirmationTexts = confirmationTexts;
}
public List<String> getDangerZoneTooltipTexts() {
return dangerZoneTooltipTexts;
}
public void setDangerZoneTooltipTexts(List<String> dangerZoneTooltipTexts) {
this.dangerZoneTooltipTexts = dangerZoneTooltipTexts;
}
}

@ -41,10 +41,8 @@ import javax.xml.bind.annotation.*;
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Operation", propOrder = {
"params",
"metadata",
"confirmationTexts",
"tooltipTexts"
"params",
"metadata"
})
public class Operation {
@ -60,28 +58,6 @@ public class Operation {
@XmlAttribute(name = "icon")
private String icon;
@XmlElement(name = "tooltipTexts", required = false)
private DangerZoneTooltipTexts tooltipTexts;
@XmlElement(name = "confirmationTexts", required = false)
private ConfirmationTexts confirmationTexts;
public DangerZoneTooltipTexts getTooltipTexts() {
return tooltipTexts;
}
public void setTooltipTexts(DangerZoneTooltipTexts tooltipTexts) {
this.tooltipTexts = tooltipTexts;
}
public ConfirmationTexts getConfirmationTexts() {
return confirmationTexts;
}
public void setConfirmationTexts(ConfirmationTexts confirmationTexts) {
this.confirmationTexts = confirmationTexts;
}
public Params getParams() {
return params;
}

@ -116,32 +116,7 @@ public class ConfigurationBasedFeatureManager implements FeatureManager {
operationMeta.put(UI_PARAMS, uiParams);
operationMeta.put(FORM_PARAMS, formParams);
}
if (operation.getConfirmationTexts() != null) {
Feature.ConfirmationTexts confirmationTexts = new Feature.ConfirmationTexts();
confirmationTexts.setDeleteConfirmModalTitle(
operation.getConfirmationTexts().getDeleteConfirmModalTitle());
confirmationTexts.setDeleteConfirmModalText(
operation.getConfirmationTexts().getDeleteConfirmModalText());
confirmationTexts.setDeleteConfirmationTextDescribe(
operation.getConfirmationTexts().getDeleteConfirmationTextDescribe());
confirmationTexts.setDeleteConfirmationText(
operation.getConfirmationTexts().getDeleteConfirmationText());
confirmationTexts.setCancelText(operation.getConfirmationTexts().getCancelText());
confirmationTexts.setConfirmText(operation.getConfirmationTexts().getConfirmText());
confirmationTexts.setInputLabel(operation.getConfirmationTexts().getInputLabel());
confirmationTexts.setInputRequireMessage(
operation.getConfirmationTexts().getInputRequireMessage());
deviceFeature.setConfirmationTexts(confirmationTexts);
}
if (operation.getTooltipTexts() != null) {
Feature.DangerZoneTooltipTexts tooltipTexts = new Feature.DangerZoneTooltipTexts();
tooltipTexts.setToolTipTitle(operation.getTooltipTexts().getToolTipTitle());
tooltipTexts.setToolTipPopConfirmText(operation.getTooltipTexts().getToolTipPopConfirmText());
tooltipTexts.setConfirmText(operation.getTooltipTexts().getConfirmText());
tooltipTexts.setCancelText(operation.getTooltipTexts().getCancelText());
tooltipTexts.setToolTipAvailable(operation.getTooltipTexts().getToolTipAvailable());
deviceFeature.setDangerZoneTooltipTexts(tooltipTexts);
}
if (metadataEntries == null) {
metadataEntries = new ArrayList<>();
}

@ -362,7 +362,6 @@
<Scope>and:ops:change-lock-code</Scope>
<Scope>and:ops:upgrade-firmware</Scope>
<Scope>and:ops:send-notif</Scope>
<Scope>and:ops:secure-folder</Scope>
<Scope>dm:geo:geo-fence:manage</Scope>
<Scope>dm:whitelable:view</Scope>
<Scope>dm:whitelable:update</Scope>

@ -878,7 +878,7 @@ CREATE TABLE IF NOT EXISTS DM_CEA_POLICIES (
-- DM_TAG TABLE --
CREATE TABLE IF NOT EXISTS DM_TAG (
ID INTEGER AUTO_INCREMENT,
ID BIGINT AUTO_INCREMENT,
NAME VARCHAR(255) NOT NULL,
DESCRIPTION VARCHAR(255) NULL,
TENANT_ID INTEGER NOT NULL,
@ -889,8 +889,8 @@ CREATE TABLE IF NOT EXISTS DM_TAG (
-- DM_DEVICE_TAG_MAPPING TABLE --
CREATE TABLE IF NOT EXISTS DM_DEVICE_TAG_MAPPING (
ENROLMENT_ID INTEGER NOT NULL,
TAG_ID INTEGER NOT NULL,
ENROLMENT_ID BIGINT NOT NULL,
TAG_ID BIGINT NOT NULL,
TENANT_ID INTEGER NOT NULL,
PRIMARY KEY (ENROLMENT_ID, TAG_ID, TENANT_ID),
FOREIGN KEY (ENROLMENT_ID) REFERENCES DM_ENROLMENT(ID),

@ -954,19 +954,19 @@ END;
-- DM_TAG TABLE --
CREATE TABLE IF NOT EXISTS DM_TAG (
ID INTEGER IDENTITY(1,1) PRIMARY KEY,
ID BIGINT IDENTITY(1,1) PRIMARY KEY,
NAME NVARCHAR(255) NOT NULL,
DESCRIPTION NVARCHAR(255) NULL,
TENANT_ID INTEGER NOT NULL,
TENANT_ID INT NOT NULL,
CONSTRAINT DM_TAG_NAME_TENANT_UNIQUE UNIQUE (NAME, TENANT_ID)
);
-- END OF DM_TAG TABLE --
-- DM_DEVICE_TAG_MAPPING TABLE --
CREATE TABLE IF NOT EXISTS DM_DEVICE_TAG_MAPPING (
ENROLMENT_ID INTEGER NOT NULL,
TAG_ID INTEGER NOT NULL,
TENANT_ID INTEGER NOT NULL,
ENROLMENT_ID BIGINT NOT NULL,
TAG_ID BIGINT NOT NULL,
TENANT_ID INT NOT NULL,
PRIMARY KEY (ENROLMENT_ID, TAG_ID, TENANT_ID),
FOREIGN KEY (ENROLMENT_ID) REFERENCES DM_ENROLMENT(ID),
FOREIGN KEY (TAG_ID) REFERENCES DM_TAG(ID) ON DELETE CASCADE

@ -953,19 +953,19 @@ CREATE TABLE IF NOT EXISTS DM_CEA_POLICIES (
-- DM_TAG TABLE --
CREATE TABLE IF NOT EXISTS DM_TAG (
ID INTEGER AUTO_INCREMENT PRIMARY KEY,
ID BIGINT AUTO_INCREMENT PRIMARY KEY,
NAME VARCHAR(255) NOT NULL,
DESCRIPTION VARCHAR(255) NULL,
TENANT_ID INTEGER NOT NULL,
TENANT_ID INT NOT NULL,
CONSTRAINT DM_TAG_NAME_TENANT_UNIQUE UNIQUE (NAME, TENANT_ID)
);
-- END OF DM_TAG TABLE --
-- DM_DEVICE_TAG_MAPPING TABLE --
CREATE TABLE IF NOT EXISTS DM_DEVICE_TAG_MAPPING (
ENROLMENT_ID INTEGER NOT NULL,
TAG_ID INTEGER NOT NULL,
TENANT_ID INTEGER NOT NULL,
ENROLMENT_ID BIGINT NOT NULL,
TAG_ID BIGINT NOT NULL,
TENANT_ID INT NOT NULL,
PRIMARY KEY (ENROLMENT_ID, TAG_ID, TENANT_ID),
FOREIGN KEY (ENROLMENT_ID) REFERENCES DM_ENROLMENT(ID),
FOREIGN KEY (TAG_ID) REFERENCES DM_TAG(ID) ON DELETE CASCADE

@ -1258,7 +1258,7 @@ END;
-- DM_TAG TABLE --
CREATE TABLE DM_TAG (
ID NUMBER(10) GENERATED BY DEFAULT ON NULL AS IDENTITY PRIMARY KEY,
ID NUMBER GENERATED BY DEFAULT ON NULL AS IDENTITY PRIMARY KEY,
NAME VARCHAR2(255) NOT NULL,
DESCRIPTION VARCHAR2(255) NULL,
TENANT_ID NUMBER(10) NOT NULL,
@ -1268,8 +1268,8 @@ CREATE TABLE DM_TAG (
-- DM_DEVICE_TAG_MAPPING TABLE --
CREATE TABLE DM_DEVICE_TAG_MAPPING (
ENROLMENT_ID NUMBER(10) NOT NULL,
TAG_ID NUMBER(10) NOT NULL,
ENROLMENT_ID NUMBER(19) NOT NULL,
TAG_ID NUMBER(19) NOT NULL,
TENANT_ID NUMBER(10) NOT NULL,
PRIMARY KEY (ENROLMENT_ID, TAG_ID, TENANT_ID),
FOREIGN KEY (ENROLMENT_ID) REFERENCES DM_ENROLMENT(ID),

@ -884,7 +884,7 @@ CREATE TABLE IF NOT EXISTS DM_CEA_POLICIES (
-- DM_TAG TABLE --
CREATE TABLE IF NOT EXISTS DM_TAG (
ID INTEGER PRIMARY KEY,
ID BIGSERIAL PRIMARY KEY,
NAME VARCHAR(255) NOT NULL,
DESCRIPTION VARCHAR(255) NULL,
TENANT_ID INTEGER NOT NULL,
@ -894,8 +894,8 @@ CREATE TABLE IF NOT EXISTS DM_TAG (
-- DM_DEVICE_TAG_MAPPING TABLE --
CREATE TABLE IF NOT EXISTS DM_DEVICE_TAG_MAPPING (
ENROLMENT_ID INTEGER NOT NULL,
TAG_ID INTEGER NOT NULL,
ENROLMENT_ID BIGINT NOT NULL,
TAG_ID BIGINT NOT NULL,
TENANT_ID INTEGER NOT NULL,
PRIMARY KEY (ENROLMENT_ID, TAG_ID, TENANT_ID),
FOREIGN KEY (ENROLMENT_ID) REFERENCES DM_ENROLMENT(ID),

Loading…
Cancel
Save