|
|
@ -249,7 +249,7 @@ public class GenericPlatformDAOImpl extends AbstractDAOImpl implements PlatformD
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
ConnectionManagerUtil.beginTransaction();
|
|
|
|
ConnectionManagerUtil.beginTransaction();
|
|
|
|
for (String platformIdentifier : platformIdentifiers) {
|
|
|
|
for (String platformIdentifier : platformIdentifiers) {
|
|
|
|
if (getTenantPlatformMapping(tenantId, platformIdentifier) != -1) {
|
|
|
|
if (getTenantPlatformMapping(tenantId, platformIdentifier) == -1) {
|
|
|
|
int platformId = getPlatformId(tenantId, platformIdentifier);
|
|
|
|
int platformId = getPlatformId(tenantId, platformIdentifier);
|
|
|
|
Connection connection = ConnectionManagerUtil.getConnection();
|
|
|
|
Connection connection = ConnectionManagerUtil.getConnection();
|
|
|
|
PreparedStatement preparedStatement = connection.prepareStatement(insertMapping);
|
|
|
|
PreparedStatement preparedStatement = connection.prepareStatement(insertMapping);
|
|
|
@ -285,8 +285,8 @@ public class GenericPlatformDAOImpl extends AbstractDAOImpl implements PlatformD
|
|
|
|
|
|
|
|
|
|
|
|
private int getTenantPlatformMapping(int tenantId, String platformIdentifier) throws
|
|
|
|
private int getTenantPlatformMapping(int tenantId, String platformIdentifier) throws
|
|
|
|
PlatformManagementDAOException {
|
|
|
|
PlatformManagementDAOException {
|
|
|
|
String getMapping = "SELECT MAPPING.ID as ID FROM (SELECT ID FROM APPM_PLATFORM_TENANT_MAPPING WHERE "
|
|
|
|
String getMapping = "SELECT MAPPING.ID as ID FROM (SELECT ID, PLATFORM_ID FROM APPM_PLATFORM_TENANT_MAPPING "
|
|
|
|
+ "TENANT_ID=?) MAPPING JOIN (SELECT ID FROM APPM_PLATFORM WHERE APPM_PLATFORM.IDENTIFIER=?) "
|
|
|
|
+ "WHERE TENANT_ID=?) MAPPING JOIN (SELECT ID FROM APPM_PLATFORM WHERE APPM_PLATFORM.IDENTIFIER=?) "
|
|
|
|
+ "PLATFORM ON MAPPING.PLATFORM_ID=PLATFORM.ID";
|
|
|
|
+ "PLATFORM ON MAPPING.PLATFORM_ID=PLATFORM.ID";
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
Connection connection = ConnectionManagerUtil.getConnection();
|
|
|
|
Connection connection = ConnectionManagerUtil.getConnection();
|
|
|
@ -300,7 +300,7 @@ public class GenericPlatformDAOImpl extends AbstractDAOImpl implements PlatformD
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
} catch (DBConnectionException e) {
|
|
|
|
} catch (DBConnectionException e) {
|
|
|
|
throw new PlatformManagementDAOException(
|
|
|
|
throw new PlatformManagementDAOException(
|
|
|
|
"Error occured while obtaining the connection to get the existing " + "Tenant - Platform Mapping.",
|
|
|
|
"Error occurred while obtaining the connection to get the existing " + "Tenant - Platform Mapping.",
|
|
|
|
e);
|
|
|
|
e);
|
|
|
|
} catch (SQLException e) {
|
|
|
|
} catch (SQLException e) {
|
|
|
|
throw new PlatformManagementDAOException("Error occured while executing the SQL query - " + getMapping, e);
|
|
|
|
throw new PlatformManagementDAOException("Error occured while executing the SQL query - " + getMapping, e);
|
|
|
@ -462,21 +462,27 @@ public class GenericPlatformDAOImpl extends AbstractDAOImpl implements PlatformD
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
conn = this.getConnection();
|
|
|
|
conn = this.getConnection();
|
|
|
|
sql += "SELECT * ";
|
|
|
|
sql += "SELECT * FROM APPM_PLATFORM WHERE IDENTIFIER = ? AND TENANT_ID = ?";
|
|
|
|
sql += "FROM APPM_PLATFORM ";
|
|
|
|
|
|
|
|
sql += "WHERE IDENTIFIER = ? ";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
stmt.setString(1, identifier);
|
|
|
|
stmt.setString(1, identifier);
|
|
|
|
|
|
|
|
stmt.setInt(2, tenantId);
|
|
|
|
rs = stmt.executeQuery();
|
|
|
|
rs = stmt.executeQuery();
|
|
|
|
|
|
|
|
|
|
|
|
Platform platform = null;
|
|
|
|
Platform platform = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (rs.next()) {
|
|
|
|
if (rs.next()) {
|
|
|
|
platform = new Platform();
|
|
|
|
platform = new Platform();
|
|
|
|
|
|
|
|
platform.setFileBased(rs.getBoolean("FILE_BASED"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
platform.setIdentifier(rs.getString("IDENTIFIER"));
|
|
|
|
|
|
|
|
if (!platform.isFileBased()) {
|
|
|
|
platform.setId(rs.getInt("ID"));
|
|
|
|
platform.setId(rs.getInt("ID"));
|
|
|
|
platform.setName(rs.getString("NAME"));
|
|
|
|
platform.setName(rs.getString("NAME"));
|
|
|
|
platform.setIdentifier(rs.getString("IDENTIFIER"));
|
|
|
|
platform.setDescription(rs.getString("DESCRIPTION"));
|
|
|
|
|
|
|
|
platform.setIconName(rs.getString("ICON_NAME"));
|
|
|
|
|
|
|
|
platform.setShared(rs.getBoolean("IS_SHARED"));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return platform;
|
|
|
|
return platform;
|
|
|
|