|
|
@ -43,7 +43,6 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
|
|
|
|
|
|
|
|
|
|
|
|
private static final Log log = LogFactory.getLog(GenericApplicationReleaseDAOImpl.class);
|
|
|
|
private static final Log log = LogFactory.getLog(GenericApplicationReleaseDAOImpl.class);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* To insert the Application Release Details.
|
|
|
|
* To insert the Application Release Details.
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -52,17 +51,15 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
|
|
|
|
* @param tenantId Tenant Id
|
|
|
|
* @param tenantId Tenant Id
|
|
|
|
* @throws ApplicationManagementDAOException Application Management DAO Exception.
|
|
|
|
* @throws ApplicationManagementDAOException Application Management DAO Exception.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override public ApplicationRelease createRelease(ApplicationRelease applicationRelease, int appId, int tenantId)
|
|
|
|
public ApplicationRelease createRelease(ApplicationRelease applicationRelease, int appId, int tenantId) throws
|
|
|
|
throws ApplicationManagementDAOException {
|
|
|
|
ApplicationManagementDAOException {
|
|
|
|
|
|
|
|
Connection connection;
|
|
|
|
Connection connection;
|
|
|
|
PreparedStatement statement = null;
|
|
|
|
PreparedStatement statement = null;
|
|
|
|
ResultSet resultSet = null;
|
|
|
|
ResultSet resultSet = null;
|
|
|
|
|
|
|
|
|
|
|
|
String sql = "INSERT INTO AP_APP_RELEASE (VERSION,TENANT_ID,UUID,RELEASE_TYPE, PACKAGE_NAME, APP_PRICE,"
|
|
|
|
String sql = "INSERT INTO AP_APP_RELEASE (VERSION,TENANT_ID,UUID,RELEASE_TYPE, PACKAGE_NAME, APP_PRICE,"
|
|
|
|
+ "STORED_LOCATION, BANNER_LOCATION, SC_1_LOCATION,SC_2_LOCATION,SC_3_LOCATION, APP_HASH_VALUE,"
|
|
|
|
+ "STORED_LOCATION, BANNER_LOCATION, SC_1_LOCATION,SC_2_LOCATION,SC_3_LOCATION, APP_HASH_VALUE,"
|
|
|
|
+ "SHARED_WITH_ALL_TENANTS, APP_META_INFO,AP_APP_ID) "
|
|
|
|
+ "SHARED_WITH_ALL_TENANTS, APP_META_INFO,AP_APP_ID) " + "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);";
|
|
|
|
+ "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int index = 0;
|
|
|
|
int index = 0;
|
|
|
|
String generatedColumns[] = { "ID" };
|
|
|
|
String generatedColumns[] = { "ID" };
|
|
|
@ -111,8 +108,7 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
|
|
|
|
* @param tenantId Tenant Id
|
|
|
|
* @param tenantId Tenant Id
|
|
|
|
* @throws ApplicationManagementDAOException Application Management DAO Exception.
|
|
|
|
* @throws ApplicationManagementDAOException Application Management DAO Exception.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override public ApplicationRelease getRelease(String applicationName, String applicationType, String versionName,
|
|
|
|
public ApplicationRelease getRelease(String applicationName, String applicationType, String versionName,
|
|
|
|
|
|
|
|
String releaseType, int tenantId) throws ApplicationManagementDAOException {
|
|
|
|
String releaseType, int tenantId) throws ApplicationManagementDAOException {
|
|
|
|
|
|
|
|
|
|
|
|
Connection connection;
|
|
|
|
Connection connection;
|
|
|
@ -144,11 +140,10 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
} catch (DBConnectionException e) {
|
|
|
|
} catch (DBConnectionException e) {
|
|
|
|
throw new ApplicationManagementDAOException("Database connection exception while trying to get the "
|
|
|
|
throw new ApplicationManagementDAOException("Database connection exception while trying to get the "
|
|
|
|
+ "release details of the application with " + applicationName + " and version " +
|
|
|
|
+ "release details of the application with " + applicationName + " and version " + versionName, e);
|
|
|
|
versionName, e);
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
} catch (SQLException e) {
|
|
|
|
throw new ApplicationManagementDAOException("Error while getting release details of the application " +
|
|
|
|
throw new ApplicationManagementDAOException(
|
|
|
|
applicationName + " and version " + versionName + " , while executing the query " + sql, e);
|
|
|
|
"Error while getting release details of the application " + applicationName + " and version " + versionName + " , while executing the query " + sql, e);
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
Util.cleanupResources(statement, resultSet);
|
|
|
|
Util.cleanupResources(statement, resultSet);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -162,21 +157,21 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
|
|
|
|
* @param tenantId Tenant Id
|
|
|
|
* @param tenantId Tenant Id
|
|
|
|
* @throws ApplicationManagementDAOException Application Management DAO Exception.
|
|
|
|
* @throws ApplicationManagementDAOException Application Management DAO Exception.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override public ApplicationRelease getReleaseByIds(int applicationId, String releaseUuid, int tenantId)
|
|
|
|
public ApplicationRelease getReleaseByIds(int applicationId, String releaseUuid, int tenantId) throws
|
|
|
|
throws ApplicationManagementDAOException {
|
|
|
|
ApplicationManagementDAOException {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Connection connection;
|
|
|
|
Connection connection;
|
|
|
|
PreparedStatement statement = null;
|
|
|
|
PreparedStatement statement = null;
|
|
|
|
ResultSet resultSet = null;
|
|
|
|
ResultSet resultSet = null;
|
|
|
|
String sql = "SELECT AR.ID AS RELEASE_ID, AR.VERSION AS RELEASE_VERSION, AR.UUID, AR.RELEASE_TYPE, AR.APP_PRICE,"
|
|
|
|
String sql =
|
|
|
|
|
|
|
|
"SELECT AR.ID AS RELEASE_ID, AR.VERSION AS RELEASE_VERSION, AR.UUID, AR.RELEASE_TYPE, AR.APP_PRICE, "
|
|
|
|
+ "AR.STORED_LOCATION, AR.BANNER_LOCATION, AR.SC_1_LOCATION AS SCREEN_SHOT_1, "
|
|
|
|
+ "AR.STORED_LOCATION, AR.BANNER_LOCATION, AR.SC_1_LOCATION AS SCREEN_SHOT_1, "
|
|
|
|
+ "AR.SC_2_LOCATION AS SCREEN_SHOT_2, AR.SC_3_LOCATION AS SCREEN_SHOT_3, AR.APP_HASH_VALUE AS " +
|
|
|
|
+ "AR.SC_2_LOCATION AS SCREEN_SHOT_2, AR.SC_3_LOCATION AS SCREEN_SHOT_3, AR.PACKAGE_NAME AS "
|
|
|
|
"HASH_VALUE, AR.SHARED_WITH_ALL_TENANTS AS SHARED, AR.APP_META_INFO, AR.CREATED_BY, AR.CREATED_AT, AR" +
|
|
|
|
+ "PACKAGE_NAME, AR.APP_HASH_VALUE AS HASH_VALUE, AR.SHARED_WITH_ALL_TENANTS AS SHARED, "
|
|
|
|
".PUBLISHED_BY, AR.PUBLISHED_AT, AR.STARS, AL.CURRENT_STATE, AL.PREVIOUS_STATE, AL.UPDATED_BY, " +
|
|
|
|
+ "AR.APP_META_INFO AS APP_META_INFO, AR.RATING AS RATING, AL.CURRENT_STATE, AL.PREVIOUS_STATE, "
|
|
|
|
"AL.UPDATED_AT FROM AP_APP_RELEASE AS AR, AP_APP_LIFECYCLE_STATE AS AL WHERE " +
|
|
|
|
+ "AL.UPDATED_BY, AL.UPDATED_AT FROM AP_APP_RELEASE AS AR, AP_APP_LIFECYCLE_STATE AS AL "
|
|
|
|
"AR.AP_APP_ID = ? AND AR.UUID = ? AND AR.TENANT_ID = ? AND AL.AP_APP_RELEASE_ID=AR.ID AND " +
|
|
|
|
+ "WHERE AR.AP_APP_ID = ? AND AR.UUID = ? AND AR.TENANT_ID = ? AND AL.AP_APP_RELEASE_ID=AR.ID "
|
|
|
|
"AL.TENANT_ID = AR.TENANT_ID ORDER BY AL.UPDATED_AT DESC;";
|
|
|
|
+ "AND AL.TENANT_ID = AR.TENANT_ID ORDER BY AL.UPDATED_AT DESC;";
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
connection = this.getDBConnection();
|
|
|
|
connection = this.getDBConnection();
|
|
|
@ -192,14 +187,12 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
} catch (DBConnectionException e) {
|
|
|
|
} catch (DBConnectionException e) {
|
|
|
|
throw new ApplicationManagementDAOException(
|
|
|
|
throw new ApplicationManagementDAOException(
|
|
|
|
"Database connection exception while trying to get the release details of the " +
|
|
|
|
"Database connection exception while trying to get the release details of the " + "application id: "
|
|
|
|
"application id: " + applicationId + "and UUID of the application release: " +
|
|
|
|
+ applicationId + "and UUID of the application release: " + releaseUuid, e);
|
|
|
|
releaseUuid, e);
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
} catch (SQLException e) {
|
|
|
|
throw new ApplicationManagementDAOException(
|
|
|
|
throw new ApplicationManagementDAOException(
|
|
|
|
"Error while getting release details of the application id: " + applicationId +
|
|
|
|
"Error while getting release details of the application id: " + applicationId
|
|
|
|
" and theUUID of the application " +
|
|
|
|
+ " and theUUID of the application " + "release: " + releaseUuid + " , while executing the query " + sql, e);
|
|
|
|
"release: " + releaseUuid + " , while executing the query " + sql, e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
Util.cleanupResources(statement, resultSet);
|
|
|
|
Util.cleanupResources(statement, resultSet);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -212,8 +205,7 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
|
|
|
|
* @param tenantId Tenant Id
|
|
|
|
* @param tenantId Tenant Id
|
|
|
|
* @throws ApplicationManagementDAOException Application Management DAO Exception.
|
|
|
|
* @throws ApplicationManagementDAOException Application Management DAO Exception.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override public List<ApplicationRelease> getReleases(int applicationId, int tenantId)
|
|
|
|
public List<ApplicationRelease> getReleases(int applicationId, int tenantId)
|
|
|
|
|
|
|
|
throws ApplicationManagementDAOException {
|
|
|
|
throws ApplicationManagementDAOException {
|
|
|
|
Connection connection;
|
|
|
|
Connection connection;
|
|
|
|
PreparedStatement statement = null;
|
|
|
|
PreparedStatement statement = null;
|
|
|
@ -258,8 +250,8 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
|
|
|
|
* @param rating given stars for the application release.
|
|
|
|
* @param rating given stars for the application release.
|
|
|
|
* @throws ApplicationManagementDAOException Application Management DAO Exception.
|
|
|
|
* @throws ApplicationManagementDAOException Application Management DAO Exception.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override public void updateRatingValue(String uuid, double rating, int ratedUsers)
|
|
|
|
public void updateRatingValue(String uuid, double rating, int ratedUsers) throws ApplicationManagementDAOException {
|
|
|
|
throws ApplicationManagementDAOException {
|
|
|
|
Connection connection;
|
|
|
|
Connection connection;
|
|
|
|
PreparedStatement statement = null;
|
|
|
|
PreparedStatement statement = null;
|
|
|
|
String sql = "UPDATE AP_APP_RELEASE SET RATING = ?,RATED_USERS = ? WHERE UUID = ?;";
|
|
|
|
String sql = "UPDATE AP_APP_RELEASE SET RATING = ?,RATED_USERS = ? WHERE UUID = ?;";
|
|
|
@ -287,8 +279,7 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
|
|
|
|
* @param uuid UUID of the application Release.
|
|
|
|
* @param uuid UUID of the application Release.
|
|
|
|
* @throws ApplicationManagementDAOException Application Management DAO Exception.
|
|
|
|
* @throws ApplicationManagementDAOException Application Management DAO Exception.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override public Rating getRating(String uuid, int tenantId) throws ApplicationManagementDAOException {
|
|
|
|
public Rating getRating(String uuid, int tenantId) throws ApplicationManagementDAOException {
|
|
|
|
|
|
|
|
Connection connection;
|
|
|
|
Connection connection;
|
|
|
|
PreparedStatement statement = null;
|
|
|
|
PreparedStatement statement = null;
|
|
|
|
ResultSet resultSet = null;
|
|
|
|
ResultSet resultSet = null;
|
|
|
@ -324,8 +315,7 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
|
|
|
|
* @param applicationRelease Application Release the properties of which that need to be inserted.
|
|
|
|
* @param applicationRelease Application Release the properties of which that need to be inserted.
|
|
|
|
* @throws ApplicationManagementDAOException Application Management DAO Exception.
|
|
|
|
* @throws ApplicationManagementDAOException Application Management DAO Exception.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override public ApplicationRelease updateRelease(int applicationId, ApplicationRelease applicationRelease, int tenantId)
|
|
|
|
public ApplicationRelease updateRelease(int applicationId, ApplicationRelease applicationRelease, int tenantId)
|
|
|
|
|
|
|
|
throws ApplicationManagementDAOException {
|
|
|
|
throws ApplicationManagementDAOException {
|
|
|
|
Connection connection;
|
|
|
|
Connection connection;
|
|
|
|
PreparedStatement statement = null;
|
|
|
|
PreparedStatement statement = null;
|
|
|
@ -373,8 +363,7 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
|
|
|
|
* @param version version name of the application release.
|
|
|
|
* @param version version name of the application release.
|
|
|
|
* @throws ApplicationManagementDAOException Application Management DAO Exception.
|
|
|
|
* @throws ApplicationManagementDAOException Application Management DAO Exception.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override public void deleteRelease(int id, String version) throws ApplicationManagementDAOException {
|
|
|
|
public void deleteRelease(int id, String version) throws ApplicationManagementDAOException {
|
|
|
|
|
|
|
|
Connection connection;
|
|
|
|
Connection connection;
|
|
|
|
PreparedStatement statement = null;
|
|
|
|
PreparedStatement statement = null;
|
|
|
|
String sql = "DELETE FROM AP_APP_RELEASE WHERE ID = ? AND VERSION = ?";
|
|
|
|
String sql = "DELETE FROM AP_APP_RELEASE WHERE ID = ? AND VERSION = ?";
|
|
|
@ -396,8 +385,46 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean verifyReleaseExistence(int appId, String uuid, int tenantId) throws ApplicationManagementDAOException {
|
|
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
|
|
|
log.debug("Verifying application release existence by application id:" + appId
|
|
|
|
|
|
|
|
+ " and application release uuid: " + uuid);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Connection conn;
|
|
|
|
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
|
|
|
|
ResultSet rs = null;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
conn = this.getDBConnection();
|
|
|
|
|
|
|
|
String sql =
|
|
|
|
|
|
|
|
"SELECT AR.ID AS RELEASE_ID FROM AP_APP_RELEASE AS AR WHERE AR.AP_APP_ID = ? AND AR.UUID = ? AND "
|
|
|
|
|
|
|
|
+ "AR.TENANT_ID = ?;";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
|
|
|
|
stmt.setInt(1, appId);
|
|
|
|
|
|
|
|
stmt.setString(2, uuid);
|
|
|
|
|
|
|
|
stmt.setInt(3, tenantId);
|
|
|
|
|
|
|
|
rs = stmt.executeQuery();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
|
|
|
log.debug("Successfully retrieved basic details of the application release with the application ID "
|
|
|
|
|
|
|
|
+ appId + " Application release uuid: " + uuid);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return rs.next();
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
|
|
|
throw new ApplicationManagementDAOException(
|
|
|
|
|
|
|
|
"Error occurred while getting application release details with app ID: " + appId
|
|
|
|
|
|
|
|
+ " App release uuid: " + uuid + " While executing query ", e);
|
|
|
|
|
|
|
|
} catch (DBConnectionException e) {
|
|
|
|
|
|
|
|
throw new ApplicationManagementDAOException("Error occurred while obtaining the DB connection.", e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
Util.cleanupResources(stmt, rs);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* This method is capable to construct {@link ApplicationRelease} and return the object
|
|
|
|
* This method is capable to construct {@link ApplicationRelease} and return the object
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param resultSet result set obtained from the query executing.
|
|
|
|
* @param resultSet result set obtained from the query executing.
|
|
|
|
* @throws SQLException SQL exception while accessing result set data.
|
|
|
|
* @throws SQLException SQL exception while accessing result set data.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -418,8 +445,6 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
|
|
|
|
applicationRelease.setIsSharedWithAllTenants(resultSet.getInt("SHARED"));
|
|
|
|
applicationRelease.setIsSharedWithAllTenants(resultSet.getInt("SHARED"));
|
|
|
|
applicationRelease.setMetaData(resultSet.getString("APP_META_INFO"));
|
|
|
|
applicationRelease.setMetaData(resultSet.getString("APP_META_INFO"));
|
|
|
|
applicationRelease.setRating(resultSet.getDouble("RATING"));
|
|
|
|
applicationRelease.setRating(resultSet.getDouble("RATING"));
|
|
|
|
|
|
|
|
|
|
|
|
return applicationRelease;
|
|
|
|
return applicationRelease;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|