|
|
|
@ -57,9 +57,9 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
|
ResultSet rs = null;
|
|
|
|
|
int commentId = -1;
|
|
|
|
|
String sql = "INSERT INTO AP_APP_COMMENT (TENANT_ID, COMMENT_TEXT, CREATED_BY, PARENT_ID,AP_APP_RELEASE_ID," +
|
|
|
|
|
"AP_APP_ID) VALUES (?,?,?,?,(SELECT ID FROM AP_APP_RELEASE WHERE UUID= ?)," +
|
|
|
|
|
"(SELECT AP_APP_ID FROM AP_APP_RELEASE WHERE UUID=?));";
|
|
|
|
|
String sql = "INSERT INTO AP_APP_COMMENT (TENANT_ID, COMMENT_TEXT, CREATED_BY, PARENT_ID,AP_APP_RELEASE_ID,"
|
|
|
|
|
+ "AP_APP_ID) VALUES (?,?,?,?,(SELECT ID FROM AP_APP_RELEASE WHERE UUID= ?),"
|
|
|
|
|
+ "(SELECT AP_APP_ID FROM AP_APP_RELEASE WHERE UUID=?));";
|
|
|
|
|
try {
|
|
|
|
|
stmt = conn.prepareStatement(sql, new String[] { "id" });
|
|
|
|
|
stmt.setInt(1, tenantId);
|
|
|
|
@ -69,7 +69,6 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
stmt.setString(5, uuid);
|
|
|
|
|
stmt.setString(6, uuid);
|
|
|
|
|
stmt.executeUpdate();
|
|
|
|
|
|
|
|
|
|
rs = stmt.getGeneratedKeys();
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
commentId = rs.getInt(1);
|
|
|
|
@ -85,16 +84,16 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
String version) throws CommentManagementException, DBConnectionException, SQLException {
|
|
|
|
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
log.debug("Request received in DAO Layer to add to application ("+appName+") and version ("+version+")");
|
|
|
|
|
log.debug("Request received in DAO Layer to add to application (" + appName + ") and version (" + version
|
|
|
|
|
+ ")");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Connection conn = this.getDBConnection();
|
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
|
ResultSet rs;
|
|
|
|
|
int commentId = -1;
|
|
|
|
|
String sql = "INSERT INTO AP_APP_COMMENT ( TENANT_ID,COMMENT_TEXT, CREATED_BY,AP_APP_RELEASE_ID,AP_APP_ID) " +
|
|
|
|
|
"VALUES (?,?,?,(SELECT ID FROM AP_APP_RELEASE WHERE VERSION =? AND (SELECT ID FROM AP_APP WHERE " +
|
|
|
|
|
"TYPE=? AND NAME=?)),(SELECT ID FROM AP_APP WHERE TYPE=? AND NAME=?));";
|
|
|
|
|
String sql = "INSERT INTO AP_APP_COMMENT ( TENANT_ID,COMMENT_TEXT, CREATED_BY,AP_APP_RELEASE_ID,AP_APP_ID) "
|
|
|
|
|
+ "VALUES (?,?,?,(SELECT ID FROM AP_APP_RELEASE WHERE VERSION =? AND (SELECT ID FROM AP_APP WHERE "
|
|
|
|
|
+ "TYPE=? AND NAME=?)),(SELECT ID FROM AP_APP WHERE TYPE=? AND NAME=?));";
|
|
|
|
|
try {
|
|
|
|
|
stmt = conn.prepareStatement(sql, new String[] { "id" });
|
|
|
|
|
stmt.setInt(1, tenantId);
|
|
|
|
@ -105,13 +104,11 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
stmt.setString(6, appName);
|
|
|
|
|
stmt.setString(7, appType);
|
|
|
|
|
stmt.setString(8, appName);
|
|
|
|
|
|
|
|
|
|
stmt.executeUpdate();
|
|
|
|
|
rs = stmt.getGeneratedKeys();
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
commentId = rs.getInt(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
Util.cleanupResources(stmt, null);
|
|
|
|
|
}
|
|
|
|
@ -119,17 +116,15 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Comment updateComment(int CommentId, String updatedComment, String modifiedBy, Timestamp modifiedAt)
|
|
|
|
|
throws CommentManagementException, DBConnectionException, SQLException {
|
|
|
|
|
public Comment updateComment(int CommentId, String updatedComment, String modifiedBy,
|
|
|
|
|
Timestamp modifiedAt) throws CommentManagementException, DBConnectionException, SQLException {
|
|
|
|
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
log.debug("Request received in DAO Layer to update the comment with ID (" + CommentId + ")");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Connection connection;
|
|
|
|
|
PreparedStatement statement = null;
|
|
|
|
|
ResultSet rs = null;
|
|
|
|
|
|
|
|
|
|
String sql = "UPDATE AP_APP_COMMENT SET COMMENT_TEXT=?, MODEFIED_BY=? WHERE ID=?;";
|
|
|
|
|
try {
|
|
|
|
|
connection = this.getDBConnection();
|
|
|
|
@ -137,28 +132,25 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
statement.setString(1, updatedComment);
|
|
|
|
|
statement.setString(2, modifiedBy);
|
|
|
|
|
statement.setInt(3, CommentId);
|
|
|
|
|
|
|
|
|
|
statement.executeUpdate();
|
|
|
|
|
rs = statement.executeQuery();
|
|
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
Util.cleanupResources(statement, rs);
|
|
|
|
|
}
|
|
|
|
|
return getComment(CommentId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Comment updateComment(String uuid, int CommentId,String updatedComment, String modifiedBy, Timestamp
|
|
|
|
|
modifiedAt) throws CommentManagementException, DBConnectionException, SQLException {
|
|
|
|
|
@Override
|
|
|
|
|
public Comment updateComment(String uuid, int CommentId, String updatedComment, String modifiedBy,
|
|
|
|
|
Timestamp modifiedAt) throws CommentManagementException, DBConnectionException, SQLException {
|
|
|
|
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
log.debug("Request received in DAO Layer to update the comment with application ("+uuid+") and " +
|
|
|
|
|
"comment id ( "+ CommentId +")");
|
|
|
|
|
log.debug("Request received in DAO Layer to update the comment with application (" + uuid + ") and "
|
|
|
|
|
+ "comment id ( " + CommentId + ")");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Connection connection;
|
|
|
|
|
PreparedStatement statement = null;
|
|
|
|
|
ResultSet rs = null;
|
|
|
|
|
|
|
|
|
|
String sql = "UPDATE AP_APP_COMMENT SET COMMENT_TEXT=?,MODEFIED_BY=? WHERE ID=?; ";
|
|
|
|
|
try {
|
|
|
|
|
connection = this.getDBConnection();
|
|
|
|
@ -168,7 +160,6 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
statement.setInt(3, CommentId);
|
|
|
|
|
statement.executeUpdate();
|
|
|
|
|
rs = statement.getResultSet();
|
|
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
Util.cleanupResources(statement, rs);
|
|
|
|
|
}
|
|
|
|
@ -177,6 +168,7 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Comment getComment(int CommentId) throws CommentManagementException {
|
|
|
|
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
log.debug("Getting comment with the comment id(" + CommentId + ") from the database");
|
|
|
|
|
}
|
|
|
|
@ -185,16 +177,13 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
ResultSet rs;
|
|
|
|
|
String sql = "";
|
|
|
|
|
Comment comment = new Comment();
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
conn = this.getDBConnection();
|
|
|
|
|
sql += "SELECT COMMENT_TEXT FROM AP_APP_COMMENT WHERE ID=?;";
|
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
|
stmt.setInt(1, CommentId);
|
|
|
|
|
rs = stmt.executeQuery();
|
|
|
|
|
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
|
|
|
|
|
comment.setId(rs.getInt("ID"));
|
|
|
|
|
comment.setTenantId(rs.getInt("TENANT_ID"));
|
|
|
|
|
comment.setComment(rs.getString("COMMENT_TEXT"));
|
|
|
|
@ -203,15 +192,14 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
comment.setModifiedAt(rs.getTimestamp("MODEFIED_AT"));
|
|
|
|
|
comment.setModifiedBy(rs.getString("MODEFIED_AT"));
|
|
|
|
|
comment.setParent(rs.getInt("PARENT_ID"));
|
|
|
|
|
|
|
|
|
|
Util.cleanupResources(stmt, rs);
|
|
|
|
|
return comment;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
throw new CommentManagementException("Error occurred while retrieving information of the comment "+ CommentId, e);
|
|
|
|
|
throw new CommentManagementException(
|
|
|
|
|
"SQL Error occurred while retrieving information of the comment " + CommentId, e);
|
|
|
|
|
} catch (DBConnectionException e) {
|
|
|
|
|
log.error("DB Connection Exception occurs.", e);
|
|
|
|
|
log.error("DB Connection Exception occurred while retrieving information of the comment " + CommentId, e);
|
|
|
|
|
} finally {
|
|
|
|
|
Util.cleanupResources(stmt, null);
|
|
|
|
|
}
|
|
|
|
@ -229,17 +217,14 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
ResultSet rs;
|
|
|
|
|
String sql = "";
|
|
|
|
|
List<Comment> comments = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
conn = this.getDBConnection();
|
|
|
|
|
sql += "SELECT COMMENT_TEXT FROM AP_APP_COMMENT WHERE (SELECT ID FROM AP_APP_RELEASE where UUID=?)AND " +
|
|
|
|
|
"(SELECT AP_APP_ID FROM AP_APP_RELEASE where UUID=?);";
|
|
|
|
|
|
|
|
|
|
sql += "SELECT COMMENT_TEXT FROM AP_APP_COMMENT WHERE (SELECT ID FROM AP_APP_RELEASE where UUID=?)AND "
|
|
|
|
|
+ "(SELECT AP_APP_ID FROM AP_APP_RELEASE where UUID=?);";
|
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
|
stmt.setString(1, uuid);
|
|
|
|
|
stmt.setString(2, uuid);
|
|
|
|
|
rs = stmt.executeQuery();
|
|
|
|
|
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
Comment comment = new Comment();
|
|
|
|
|
comment.setId(rs.getInt("ID"));
|
|
|
|
@ -250,7 +235,6 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
comment.setModifiedAt(rs.getTimestamp("MODEFIED_AT"));
|
|
|
|
|
comment.setModifiedBy(rs.getString("MODEFIED_AT"));
|
|
|
|
|
comment.setParent(rs.getInt("PARENT_ID"));
|
|
|
|
|
|
|
|
|
|
comments.add(comment);
|
|
|
|
|
}
|
|
|
|
|
} catch (DBConnectionException e) {
|
|
|
|
@ -264,8 +248,9 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<Comment> getAllComments(String uuid,PaginationRequest request) throws CommentManagementException, SQLException,
|
|
|
|
|
DBConnectionException {
|
|
|
|
|
public List<Comment> getAllComments(String uuid, PaginationRequest request)
|
|
|
|
|
throws CommentManagementException, SQLException, DBConnectionException {
|
|
|
|
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
log.debug("Getting comment of the application release (" + uuid + ") from the database");
|
|
|
|
|
}
|
|
|
|
@ -274,18 +259,15 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
ResultSet rs = null;
|
|
|
|
|
List<Comment> comments = new ArrayList<>();
|
|
|
|
|
String sql = "";
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
conn = this.getDBConnection();
|
|
|
|
|
sql += "\n" +
|
|
|
|
|
"SELECT COMMENT_TEXT FROM AP_APP_COMMENT, AP_APP_RELEASE WHERE AP_APP_COMMENT.AP_APP_RELEASE_ID=AP_APP_RELEASE.ID " +
|
|
|
|
|
"AND AP_APP_RELEASE.UUID =? LIMIT ? OFFSET ?;";
|
|
|
|
|
sql += "SELECT COMMENT_TEXT FROM AP_APP_COMMENT, AP_APP_RELEASE WHERE AP_APP_COMMENT.AP_APP_RELEASE_ID=AP_APP_RELEASE.ID "
|
|
|
|
|
+ "AND AP_APP_RELEASE.UUID =? LIMIT ? OFFSET ?;";
|
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
|
stmt.setString(1, uuid);
|
|
|
|
|
stmt.setInt(2, request.getLimit());
|
|
|
|
|
stmt.setInt(3, request.getOffSet());
|
|
|
|
|
rs = stmt.executeQuery();
|
|
|
|
|
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
Comment comment = new Comment();
|
|
|
|
|
comment.setId(rs.getInt("ID"));
|
|
|
|
@ -296,7 +278,6 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
comment.setModifiedAt(rs.getTimestamp("MODEFIED_AT"));
|
|
|
|
|
comment.setModifiedBy(rs.getString("MODEFIED_BY"));
|
|
|
|
|
comment.setParent(rs.getInt("PARENT_ID"));
|
|
|
|
|
|
|
|
|
|
comments.add(comment);
|
|
|
|
|
}
|
|
|
|
|
} finally {
|
|
|
|
@ -313,21 +294,18 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
|
ResultSet rs = null;
|
|
|
|
|
boolean isUuidProvided = false;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
conn = this.getDBConnection();
|
|
|
|
|
if (uuid != null) {
|
|
|
|
|
isUuidProvided = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isUuidProvided) {
|
|
|
|
|
String sql = "SELECT COUNT(AP_APP_COMMENT.ID) FROM AP_APP_COMMENT,AP_APP_RELEASE " +
|
|
|
|
|
"WHERE AP_APP_COMMENT.AP_APP_RELEASE_ID= AP_APP_RELEASE.ID AND " +
|
|
|
|
|
"AP_APP_COMMENT.AP_APP_ID= AP_APP_RELEASE.AP_APP_ID AND AP_APP_RELEASE.UUID=?;";
|
|
|
|
|
String sql = "SELECT COUNT(AP_APP_COMMENT.ID) FROM AP_APP_COMMENT,AP_APP_RELEASE "
|
|
|
|
|
+ "WHERE AP_APP_COMMENT.AP_APP_RELEASE_ID= AP_APP_RELEASE.ID AND "
|
|
|
|
|
+ "AP_APP_COMMENT.AP_APP_ID= AP_APP_RELEASE.AP_APP_ID AND AP_APP_RELEASE.UUID=?;";
|
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
|
stmt.setString(1, uuid);
|
|
|
|
|
rs = stmt.executeQuery();
|
|
|
|
|
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
commentCount = rs.getInt("COMMENTS_COUNT");
|
|
|
|
|
}
|
|
|
|
@ -346,24 +324,21 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
public List<Comment> getComments(int appReleasedId, int appId) throws CommentManagementException {
|
|
|
|
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
log.debug("Getting comments with the application release id(" + appReleasedId + ") and " +
|
|
|
|
|
"application id("+appId+") from the database");
|
|
|
|
|
log.debug("Getting comments with the application release id(" + appReleasedId + ") and " + "application id("
|
|
|
|
|
+ appId + ") from the database");
|
|
|
|
|
}
|
|
|
|
|
Connection conn;
|
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
|
ResultSet rs;
|
|
|
|
|
String sql = "";
|
|
|
|
|
List<Comment> comments = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
conn = this.getDBConnection();
|
|
|
|
|
sql += "SELECT COMMENT_TEXT FROM AP_APP_COMMENT WHERE AP_APP_RELEASE_ID=? AND AP_APP_ID=?;";
|
|
|
|
|
|
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
|
stmt.setInt(1, appReleasedId);
|
|
|
|
|
stmt.setInt(2, appId);
|
|
|
|
|
rs = stmt.executeQuery();
|
|
|
|
|
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
Comment comment = new Comment();
|
|
|
|
|
comment.setId(rs.getInt("ID"));
|
|
|
|
@ -374,15 +349,12 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
comment.setModifiedAt(rs.getTimestamp("MODEFIED_AT"));
|
|
|
|
|
comment.setModifiedBy(rs.getString("modifiedBy"));
|
|
|
|
|
comment.setParent(rs.getInt("PARENT_ID"));
|
|
|
|
|
|
|
|
|
|
comments.add(comment);
|
|
|
|
|
}
|
|
|
|
|
} catch (DBConnectionException e) {
|
|
|
|
|
log.error("DB Connection Exception occurs.", e);
|
|
|
|
|
|
|
|
|
|
log.error("DB Connection Exception occurred while retrieving information of comments", e);
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
throw new CommentManagementException("Error occurred while retrieving information of comments", e);
|
|
|
|
|
|
|
|
|
|
throw new CommentManagementException("SQL Error occurred while retrieving information of comments", e);
|
|
|
|
|
} finally {
|
|
|
|
|
Util.cleanupResources(stmt, null);
|
|
|
|
|
}
|
|
|
|
@ -392,30 +364,28 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
@Override
|
|
|
|
|
public List<Comment> getComments(String appType, String appName, String version) throws CommentManagementException,
|
|
|
|
|
DBConnectionException, SQLException {
|
|
|
|
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
log.debug("Getting comments with the application name(" + appName + "),application type("+appType+") " +
|
|
|
|
|
"and application version ("+version+") from the database");
|
|
|
|
|
log.debug("Getting comments with the application name(" + appName + "),application type(" + appType + ") "
|
|
|
|
|
+ "and application version (" + version + ") from the database");
|
|
|
|
|
}
|
|
|
|
|
Connection conn;
|
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
|
ResultSet rs;
|
|
|
|
|
String sql = "";
|
|
|
|
|
List<Comment> comments = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
conn = this.getDBConnection();
|
|
|
|
|
sql += "SELECT COMMENT_TEXT,PARENT_ID,TENANT_ID FROM AP_APP_COMMENT C ,"+
|
|
|
|
|
"(SELECT ID AS RELEASE_ID, AP_APP_ID AS RELEASE_AP_APP_ID FROM AP_APP_RELEASE R WHERE VERSION=?) R,"+
|
|
|
|
|
"(SELECT ID AS APP_ID FROM AP_APP P WHERE NAME=? AND TYPE=?)P"+
|
|
|
|
|
" WHERE AP_APP_RELEASE_ID=RELEASE_ID AND RELEASE_AP_APP_ID=APP_ID AND AP_APP_ID=RELEASE_AP_APP_ID"+
|
|
|
|
|
"ORDER BY CREATED_AT DESC;";
|
|
|
|
|
|
|
|
|
|
sql += "SELECT COMMENT_TEXT,PARENT_ID,TENANT_ID FROM AP_APP_COMMENT C ,"
|
|
|
|
|
+ "(SELECT ID AS RELEASE_ID, AP_APP_ID AS RELEASE_AP_APP_ID FROM AP_APP_RELEASE R WHERE VERSION=?) R,"
|
|
|
|
|
+ "(SELECT ID AS APP_ID FROM AP_APP P WHERE NAME=? AND TYPE=?)P"
|
|
|
|
|
+ " WHERE AP_APP_RELEASE_ID=RELEASE_ID AND RELEASE_AP_APP_ID=APP_ID AND AP_APP_ID=RELEASE_AP_APP_ID"
|
|
|
|
|
+ "ORDER BY CREATED_AT DESC;";
|
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
|
stmt.setString(1, version);
|
|
|
|
|
stmt.setString(2, appName);
|
|
|
|
|
stmt.setString(3, appType);
|
|
|
|
|
rs = stmt.executeQuery();
|
|
|
|
|
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
Comment comment = new Comment();
|
|
|
|
|
comment.setId(rs.getInt("ID"));
|
|
|
|
@ -426,7 +396,6 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
comment.setModifiedAt(rs.getTimestamp("MODEFIED_AT"));
|
|
|
|
|
comment.setModifiedBy(rs.getString("modifiedBy"));
|
|
|
|
|
comment.setParent(rs.getInt("PARENT_ID"));
|
|
|
|
|
|
|
|
|
|
comments.add(comment);
|
|
|
|
|
}
|
|
|
|
|
} finally {
|
|
|
|
@ -442,21 +411,17 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
log.debug("Getting comments with the tenant_id(" + tenantId + ") from the database");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Connection conn;
|
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
|
ResultSet rs;
|
|
|
|
|
String sql = "";
|
|
|
|
|
List<Comment> comments = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
conn = this.getDBConnection();
|
|
|
|
|
sql += "SELECT COMMENT_TEXT FROM AP_APP_COMMENT WHERE TENANT_ID='?';";
|
|
|
|
|
|
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
|
stmt.setInt(1, tenantId);
|
|
|
|
|
rs = stmt.executeQuery();
|
|
|
|
|
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
Comment comment = new Comment();
|
|
|
|
|
comment.setId(rs.getInt("ID"));
|
|
|
|
@ -467,7 +432,6 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
comment.setModifiedAt(rs.getTimestamp("MODEFIED_AT"));
|
|
|
|
|
comment.setModifiedBy(rs.getString("modifiedBy"));
|
|
|
|
|
comment.setParent(rs.getInt("PARENT_ID"));
|
|
|
|
|
|
|
|
|
|
comments.add(comment);
|
|
|
|
|
}
|
|
|
|
|
} finally {
|
|
|
|
@ -483,22 +447,18 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
log.debug("Getting comments with the created by(" + createdBy + ") from the database");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Connection conn;
|
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
|
ResultSet rs;
|
|
|
|
|
String sql = "";
|
|
|
|
|
List<Comment> comments = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
conn = this.getDBConnection();
|
|
|
|
|
sql += "SELECT COMMENT_TEXT ,PARENT_ID,TENANT_ID,CREATED_AT FROM AP_APP_COMMENT WHERE CREATED_BY= ?" +
|
|
|
|
|
" ORDER BY CREATED_AT DESC;";
|
|
|
|
|
|
|
|
|
|
sql += "SELECT COMMENT_TEXT ,PARENT_ID,TENANT_ID,CREATED_AT FROM AP_APP_COMMENT WHERE CREATED_BY= ?"
|
|
|
|
|
+ " ORDER BY CREATED_AT DESC;";
|
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
|
stmt.setString(1, createdBy);
|
|
|
|
|
rs = stmt.executeQuery();
|
|
|
|
|
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
Comment comment = new Comment();
|
|
|
|
|
comment.setId(rs.getInt("ID"));
|
|
|
|
@ -509,7 +469,6 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
comment.setModifiedAt(rs.getTimestamp("MODEFIED_AT"));
|
|
|
|
|
comment.setModifiedBy(rs.getString("modifiedBy"));
|
|
|
|
|
comment.setParent(rs.getInt("PARENT_ID"));
|
|
|
|
|
|
|
|
|
|
comments.add(comment);
|
|
|
|
|
}
|
|
|
|
|
} finally {
|
|
|
|
@ -523,25 +482,22 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
DBConnectionException, SQLException {
|
|
|
|
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
log.debug("Getting comments with the created by(" + createdBy + ") at ("+createdAt+") from the database");
|
|
|
|
|
log.debug(
|
|
|
|
|
"Getting comments with the created by(" + createdBy + ") at (" + createdAt + ") from the database");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Connection conn;
|
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
|
ResultSet rs;
|
|
|
|
|
String sql = "";
|
|
|
|
|
List<Comment> comments = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
conn = this.getDBConnection();
|
|
|
|
|
sql += "SELECT COMMENT_TEXT,PARENT_ID,TENANT_ID FROM AP_APP_COMMENT WHERE CREATED_BY=?" +
|
|
|
|
|
"AND CREATED_AT= ? ORDER BY CREATED_AT DESC;";
|
|
|
|
|
|
|
|
|
|
sql += "SELECT COMMENT_TEXT,PARENT_ID,TENANT_ID FROM AP_APP_COMMENT WHERE CREATED_BY=?"
|
|
|
|
|
+ "AND CREATED_AT= ? ORDER BY CREATED_AT DESC;";
|
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
|
stmt.setString(1, createdBy);
|
|
|
|
|
stmt.setTimestamp(2, createdAt);
|
|
|
|
|
rs = stmt.executeQuery();
|
|
|
|
|
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
Comment comment = new Comment();
|
|
|
|
|
comment.setId(rs.getInt("ID"));
|
|
|
|
@ -552,7 +508,6 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
comment.setModifiedAt(rs.getTimestamp("MODEFIED_AT"));
|
|
|
|
|
comment.setModifiedBy(rs.getString("modifiedBy"));
|
|
|
|
|
comment.setParent(rs.getInt("PARENT_ID"));
|
|
|
|
|
|
|
|
|
|
comments.add(comment);
|
|
|
|
|
}
|
|
|
|
|
} finally {
|
|
|
|
@ -568,22 +523,18 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
log.debug("Getting comments with the modified by(" + modifiedBy + ") from the database");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Connection conn;
|
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
|
ResultSet rs;
|
|
|
|
|
String sql = "";
|
|
|
|
|
List<Comment> comments = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
conn = this.getDBConnection();
|
|
|
|
|
sql += "SELECT COMMENT_TEXT,PARENT_ID,TENANT_ID,CREATED_AT,MODEFIED_AT FROM AP_APP_COMMENT " +
|
|
|
|
|
"WHERE MODEFIED_BY= ? ORDER BY CREATED_AT DESC;";
|
|
|
|
|
|
|
|
|
|
sql += "SELECT COMMENT_TEXT,PARENT_ID,TENANT_ID,CREATED_AT,MODEFIED_AT FROM AP_APP_COMMENT "
|
|
|
|
|
+ "WHERE MODEFIED_BY= ? ORDER BY CREATED_AT DESC;";
|
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
|
stmt.setString(1, modifiedBy);
|
|
|
|
|
rs = stmt.executeQuery();
|
|
|
|
|
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
Comment comment = new Comment();
|
|
|
|
|
comment.setId(rs.getInt("ID"));
|
|
|
|
@ -594,7 +545,6 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
comment.setModifiedAt(rs.getTimestamp("MODEFIED_AT"));
|
|
|
|
|
comment.setModifiedBy(rs.getString("modifiedBy"));
|
|
|
|
|
comment.setParent(rs.getInt("PARENT_ID"));
|
|
|
|
|
|
|
|
|
|
comments.add(comment);
|
|
|
|
|
}
|
|
|
|
|
} finally {
|
|
|
|
@ -608,26 +558,22 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
throws CommentManagementException, DBConnectionException, SQLException {
|
|
|
|
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
log.debug("Getting comments with the modified by(" +modifiedBy + ") at ("+modifiedAt+") from the " +
|
|
|
|
|
"database");
|
|
|
|
|
log.debug("Getting comments with the modified by(" + modifiedBy + ") at (" + modifiedAt + ") from the "
|
|
|
|
|
+ "database");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Connection conn;
|
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
|
ResultSet rs;
|
|
|
|
|
String sql = "";
|
|
|
|
|
List<Comment> comments = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
conn = this.getDBConnection();
|
|
|
|
|
sql += "SELECT COMMENT_TEXT,PARENT_ID,TENANT_ID,CREATED_AT FROM AP_APP_COMMENT WHERE MODEFIED_BY= ?," +
|
|
|
|
|
"MODEFIED_AT=? ORDER BY CREATED_AT DESC;";
|
|
|
|
|
|
|
|
|
|
sql += "SELECT COMMENT_TEXT,PARENT_ID,TENANT_ID,CREATED_AT FROM AP_APP_COMMENT WHERE MODEFIED_BY= ?,"
|
|
|
|
|
+ "MODEFIED_AT=? ORDER BY CREATED_AT DESC;";
|
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
|
stmt.setString(1, modifiedBy);
|
|
|
|
|
stmt.setTimestamp(2, modifiedAt);
|
|
|
|
|
rs = stmt.executeQuery();
|
|
|
|
|
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
Comment comment = new Comment();
|
|
|
|
|
comment.setId(rs.getInt("ID"));
|
|
|
|
@ -638,7 +584,6 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
comment.setModifiedAt(rs.getTimestamp("MODEFIED_AT"));
|
|
|
|
|
comment.setModifiedBy(rs.getString("modifiedBy"));
|
|
|
|
|
comment.setParent(rs.getInt("PARENT_ID"));
|
|
|
|
|
|
|
|
|
|
comments.add(comment);
|
|
|
|
|
}
|
|
|
|
|
} finally {
|
|
|
|
@ -652,31 +597,28 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
throws CommentManagementException, DBConnectionException, SQLException {
|
|
|
|
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
log.debug("Getting comments with the application name(" + appName + "),application type("+appType+") and" +
|
|
|
|
|
"application version ("+version+") from the database");
|
|
|
|
|
log.debug(
|
|
|
|
|
"Getting comments with the application name(" + appName + "),application type(" + appType + ") and"
|
|
|
|
|
+ "application version (" + version + ") from the database");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Connection conn;
|
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
|
ResultSet rs;
|
|
|
|
|
String sql = "";
|
|
|
|
|
List<Comment> comments = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
conn = this.getDBConnection();
|
|
|
|
|
sql += "SELECT COMMENT_TEXT,TENANT_ID FROM AP_APP_COMMENT C ," +
|
|
|
|
|
"(SELECT ID AS RELEASE_ID, AP_APP_ID AS RELEASE_AP_APP_ID FROM AP_APP_RELEASE R WHERE VERSION=? ) " +
|
|
|
|
|
"R,(SELECT ID AS APP_ID FROM AP_APP P WHERE NAME=? AND TYPE=?)P " +
|
|
|
|
|
"WHERE PARENT_ID=? AND AP_APP_RELEASE_ID=RELEASE_ID AND RELEASE_AP_APP_ID=APP_ID AND " +
|
|
|
|
|
"AP_APP_ID=RELEASE_AP_APP_ID ORDER BY CREATED_AT DESC;";
|
|
|
|
|
|
|
|
|
|
sql += "SELECT COMMENT_TEXT,TENANT_ID FROM AP_APP_COMMENT C ,"
|
|
|
|
|
+ "(SELECT ID AS RELEASE_ID, AP_APP_ID AS RELEASE_AP_APP_ID FROM AP_APP_RELEASE R WHERE VERSION=? ) "
|
|
|
|
|
+ "R,(SELECT ID AS APP_ID FROM AP_APP P WHERE NAME=? AND TYPE=?)P "
|
|
|
|
|
+ "WHERE PARENT_ID=? AND AP_APP_RELEASE_ID=RELEASE_ID AND RELEASE_AP_APP_ID=APP_ID AND "
|
|
|
|
|
+ "AP_APP_ID=RELEASE_AP_APP_ID ORDER BY CREATED_AT DESC;";
|
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
|
stmt.setString(1, version);
|
|
|
|
|
stmt.setString(2, appName);
|
|
|
|
|
stmt.setString(3, appType);
|
|
|
|
|
stmt.setInt(4, parentId);
|
|
|
|
|
rs = stmt.executeQuery();
|
|
|
|
|
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
Comment comment = new Comment();
|
|
|
|
|
comment.setId(rs.getInt("ID"));
|
|
|
|
@ -687,7 +629,6 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
comment.setModifiedAt(rs.getTimestamp("MODEFIED_AT"));
|
|
|
|
|
comment.setModifiedBy(rs.getString("modifiedBy"));
|
|
|
|
|
comment.setParent(rs.getInt("PARENT_ID"));
|
|
|
|
|
|
|
|
|
|
comments.add(comment);
|
|
|
|
|
}
|
|
|
|
|
} finally {
|
|
|
|
@ -699,17 +640,15 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
@Override
|
|
|
|
|
public int getCommentCount(String uuid) throws CommentManagementException, DBConnectionException,
|
|
|
|
|
SQLException {
|
|
|
|
|
|
|
|
|
|
Connection conn;
|
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
|
int commentCount = 0;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
conn = this.getDBConnection();
|
|
|
|
|
String sql = "\n" +
|
|
|
|
|
"SELECT COUNT(AP_APP_COMMENT.ID) FROM AP_APP_COMMENT,AP_APP_RELEASE WHERE " +
|
|
|
|
|
"AP_APP_COMMENT.AP_APP_RELEASE_ID=AP_APP_RELEASE.ID AND AP_APP_COMMENT.AP_APP_ID=" +
|
|
|
|
|
"AP_APP_RELEASE.AP_APP_ID AND AP_APP_RELEASE.UUID=?;";
|
|
|
|
|
|
|
|
|
|
String sql = "\n" + "SELECT COUNT(AP_APP_COMMENT.ID) FROM AP_APP_COMMENT,AP_APP_RELEASE WHERE "
|
|
|
|
|
+ "AP_APP_COMMENT.AP_APP_RELEASE_ID=AP_APP_RELEASE.ID AND AP_APP_COMMENT.AP_APP_ID="
|
|
|
|
|
+ "AP_APP_RELEASE.AP_APP_ID AND AP_APP_RELEASE.UUID=?;";
|
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
|
stmt.setString(1, uuid);
|
|
|
|
|
ResultSet rs = stmt.executeQuery();
|
|
|
|
@ -729,15 +668,12 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
Connection conn;
|
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
|
int commentCount = 0;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
conn = this.getDBConnection();
|
|
|
|
|
String sql = "SELECT COUNT(ID) FROM AP_APP_COMMENT WHERE CREATED_BY= ?;";
|
|
|
|
|
|
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
|
stmt.setString(1, createdBy);
|
|
|
|
|
ResultSet rs = stmt.executeQuery();
|
|
|
|
|
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
commentCount = rs.getInt("COMMENT_COUNT");
|
|
|
|
|
}
|
|
|
|
@ -745,7 +681,6 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
Util.cleanupResources(stmt, null);
|
|
|
|
|
}
|
|
|
|
|
return commentCount;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -755,7 +690,6 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
Connection conn;
|
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
|
int commentCount = 0;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
conn = this.getDBConnection();
|
|
|
|
|
String sql = "SELECT COUNT(ID) FROM AP_APP_COMMENT WHERE MODEFIED_BY= ? AND MODEFIED_AT=?;";
|
|
|
|
@ -763,7 +697,6 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
stmt.setString(1, modifiedBy);
|
|
|
|
|
stmt.setTimestamp(2, modifedAt);
|
|
|
|
|
ResultSet rs = stmt.executeQuery();
|
|
|
|
|
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
commentCount = rs.getInt("COMMENT_COUNT");
|
|
|
|
|
}
|
|
|
|
@ -780,16 +713,13 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
Connection conn;
|
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
|
int commentCount = 0;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
conn = this.getDBConnection();
|
|
|
|
|
String sql = "SELECT COUNT(ID) FROM AP_APP_COMMENT WHERE AP_APP_RELEASE_ID=? AND AP_APP_ID=?;";
|
|
|
|
|
|
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
|
stmt.setInt(1, appReleaseId);
|
|
|
|
|
stmt.setInt(2, appId);
|
|
|
|
|
ResultSet rs = stmt.executeQuery();
|
|
|
|
|
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
commentCount = rs.getInt("COMMENT_COUNT");
|
|
|
|
|
}
|
|
|
|
@ -806,20 +736,17 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
Connection conn;
|
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
|
int commentCount = 0;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
conn = this.getDBConnection();
|
|
|
|
|
String sql = "SELECT COUNT(ID) AS COMMENT_COUNT FROM AP_APP_COMMENT C, " +
|
|
|
|
|
"(SELECT ID AS RELEASE_ID, AP_APP_ID AS RELEASE_AP_APP_ID FROM AP_APP_RELEASE R WHERE VERSION=? )R," +
|
|
|
|
|
"(SELECT ID AS APP_ID FROM AP_APP P WHERE NAME=? and TYPE=?)P " +
|
|
|
|
|
"WHERE AP_APP_RELEASE_ID=RELEASE_ID AND RELEASE_AP_APP_ID=APP_ID AND AP_APP_ID=RELEASE_AP_APP_ID;";
|
|
|
|
|
|
|
|
|
|
String sql = "SELECT COUNT(ID) AS COMMENT_COUNT FROM AP_APP_COMMENT C, "
|
|
|
|
|
+ "(SELECT ID AS RELEASE_ID, AP_APP_ID AS RELEASE_AP_APP_ID FROM AP_APP_RELEASE R WHERE VERSION=? )R,"
|
|
|
|
|
+ "(SELECT ID AS APP_ID FROM AP_APP P WHERE NAME=? and TYPE=?)P "
|
|
|
|
|
+ "WHERE AP_APP_RELEASE_ID=RELEASE_ID AND RELEASE_AP_APP_ID=APP_ID AND AP_APP_ID=RELEASE_AP_APP_ID;";
|
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
|
stmt.setString(1, version);
|
|
|
|
|
stmt.setString(2, appName);
|
|
|
|
|
stmt.setString(3, appType);
|
|
|
|
|
ResultSet rs = stmt.executeQuery();
|
|
|
|
|
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
commentCount = rs.getInt("COMMENT_COUNT");
|
|
|
|
|
}
|
|
|
|
@ -834,12 +761,11 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
Connection conn;
|
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
|
int commentCount = 0;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
conn = this.getDBConnection();
|
|
|
|
|
String sql = "SELECT COUNT(AP_APP_COMMENT.ID) FROM AP_APP_COMMENT,AP_APP_RELEASE WHERE " +
|
|
|
|
|
"AP_APP_COMMENT.AP_APP_RELEASE_ID=AP_APP_RELEASE.ID AND " +
|
|
|
|
|
"AP_APP_COMMENT.AP_APP_ID=AP_APP_RELEASE.AP_APP_ID and AP_APP_RELEASE.UUID=? and PARENT_ID=?;";
|
|
|
|
|
String sql = "SELECT COUNT(AP_APP_COMMENT.ID) FROM AP_APP_COMMENT,AP_APP_RELEASE WHERE "
|
|
|
|
|
+ "AP_APP_COMMENT.AP_APP_RELEASE_ID=AP_APP_RELEASE.ID AND "
|
|
|
|
|
+ "AP_APP_COMMENT.AP_APP_ID=AP_APP_RELEASE.AP_APP_ID and AP_APP_RELEASE.UUID=? and PARENT_ID=?;";
|
|
|
|
|
|
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
|
stmt.setString(1, uuid);
|
|
|
|
@ -875,13 +801,11 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
|
|
|
|
|
Connection conn;
|
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
conn = this.getDBConnection();
|
|
|
|
|
String sql = "DELETE FROM AP_APP_COMMENT WHERE " +
|
|
|
|
|
"(SELECT ID FROM AP_APP_RELEASE WHERE UUID=?)AND (SELECT AP_APP_ID FROM AP_APP_RELEASE " +
|
|
|
|
|
"WHERE UUID=?);";
|
|
|
|
|
|
|
|
|
|
String sql = "DELETE FROM AP_APP_COMMENT WHERE "
|
|
|
|
|
+ "(SELECT ID FROM AP_APP_RELEASE WHERE UUID=?)AND (SELECT AP_APP_ID FROM AP_APP_RELEASE "
|
|
|
|
|
+ "WHERE UUID=?);";
|
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
|
stmt.setString(1, uuid);
|
|
|
|
|
stmt.setString(2, uuid);
|
|
|
|
@ -897,11 +821,9 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
|
|
|
|
|
Connection conn;
|
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
conn = this.getDBConnection();
|
|
|
|
|
String sql = "DELETE FROM AP_APP_COMMENT WHERE AP_APP_RELEASE_ID=? and AP_APP_ID=?;";
|
|
|
|
|
|
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
|
stmt.setInt(1, appReleaseID);
|
|
|
|
|
stmt.setInt(2, appId);
|
|
|
|
@ -916,14 +838,12 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
|
|
|
|
|
Connection conn;
|
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
conn = this.getDBConnection();
|
|
|
|
|
String sql = "DELETE FROM AP_APP_COMMENT WHERE " +
|
|
|
|
|
"(SELECT AP_APP_RELEASE_ID FROM AP_APP_RELEASE WHERE VERSION=? AND " +
|
|
|
|
|
"(SELECT AP_APP_ID FROM AP_APP WHERE NAME=? AND TYPE=?)) AND " +
|
|
|
|
|
"(SELECT AP_APP_ID FROM AP_APP AND NAME=? AND TYPE=?);";
|
|
|
|
|
|
|
|
|
|
String sql = "DELETE FROM AP_APP_COMMENT WHERE "
|
|
|
|
|
+ "(SELECT AP_APP_RELEASE_ID FROM AP_APP_RELEASE WHERE VERSION=? AND "
|
|
|
|
|
+ "(SELECT AP_APP_ID FROM AP_APP WHERE NAME=? AND TYPE=?)) AND "
|
|
|
|
|
+ "(SELECT AP_APP_ID FROM AP_APP AND NAME=? AND TYPE=?);";
|
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
|
stmt.setString(1, version);
|
|
|
|
|
stmt.setString(2, appName);
|
|
|
|
@ -932,9 +852,9 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
stmt.setString(5, appType);
|
|
|
|
|
stmt.executeUpdate();
|
|
|
|
|
} catch (DBConnectionException e) {
|
|
|
|
|
log.error("DB Connection Exception occurs.", e);
|
|
|
|
|
log.error("DB Connection Exception occurred while deleting comments", e);
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
throw new CommentManagementException("Error occurred while deleting comments", e);
|
|
|
|
|
throw new CommentManagementException("SQL Error occurred while deleting comments", e);
|
|
|
|
|
} finally {
|
|
|
|
|
Util.cleanupResources(stmt, null);
|
|
|
|
|
}
|
|
|
|
@ -946,14 +866,12 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
|
|
|
|
|
Connection conn;
|
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
conn = this.getDBConnection();
|
|
|
|
|
String sql = "DELETE FROM AP_APP_COMMENT WHERE " +
|
|
|
|
|
"(SELECT AP_APP_RELEASE_ID FROM AP_APP_RELEASE WHERE VERSION=? AND " +
|
|
|
|
|
"(SELECT AP_APP_ID FROM AP_APP WHERE NAME=? AND TYPE=?)) AND " +
|
|
|
|
|
"(SELECT AP_APP_ID FROM AP_APP WHERE NAME=? and TYPE=?) AND CREATED_BY=?;";
|
|
|
|
|
|
|
|
|
|
String sql = "DELETE FROM AP_APP_COMMENT WHERE "
|
|
|
|
|
+ "(SELECT AP_APP_RELEASE_ID FROM AP_APP_RELEASE WHERE VERSION=? AND "
|
|
|
|
|
+ "(SELECT AP_APP_ID FROM AP_APP WHERE NAME=? AND TYPE=?)) AND "
|
|
|
|
|
+ "(SELECT AP_APP_ID FROM AP_APP WHERE NAME=? and TYPE=?) AND CREATED_BY=?;";
|
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
|
stmt.setString(1, version);
|
|
|
|
|
stmt.setString(2, appName);
|
|
|
|
@ -963,7 +881,7 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
stmt.setString(6, createdBy);
|
|
|
|
|
stmt.executeUpdate();
|
|
|
|
|
} catch (DBConnectionException e) {
|
|
|
|
|
log.error("DB Connection Exception occurs.", e);
|
|
|
|
|
log.error("DB Connection Exception occurred while deleting comments ", e);
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
throw new CommentManagementException("Error occurred while deleting comments", e);
|
|
|
|
|
} finally {
|
|
|
|
@ -977,19 +895,18 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
|
|
|
|
|
Connection conn;
|
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
conn = this.getDBConnection();
|
|
|
|
|
String sql = "DELETE FROM AP_APP_COMMENT WHERE AP_APP_RELEASE_ID=(SELECT ID FROM AP_APP_RELEASE WHERE UUID=?) " +
|
|
|
|
|
"AND AP_APP_ID=(SELECT AP_APP_ID FROM AP_APP_RELEASE where UUID=?)AND PARENT_ID=?;";
|
|
|
|
|
|
|
|
|
|
String sql =
|
|
|
|
|
"DELETE FROM AP_APP_COMMENT WHERE AP_APP_RELEASE_ID=(SELECT ID FROM AP_APP_RELEASE WHERE UUID=?) "
|
|
|
|
|
+ "AND AP_APP_ID=(SELECT AP_APP_ID FROM AP_APP_RELEASE where UUID=?)AND PARENT_ID=?;";
|
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
|
stmt.setString(1, uuid);
|
|
|
|
|
stmt.setString(2, uuid);
|
|
|
|
|
stmt.setInt(3, parentId);
|
|
|
|
|
stmt.executeUpdate();
|
|
|
|
|
} catch (DBConnectionException e) {
|
|
|
|
|
log.error("DB Connection Exception occurs.", e);
|
|
|
|
|
log.error("DB Connection Exception occurred while deleting comments.", e);
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
throw new CommentManagementException("Error occurred while deleting comments", e);
|
|
|
|
|
} finally {
|
|
|
|
@ -1006,7 +923,6 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
try {
|
|
|
|
|
connection = this.getDBConnection();
|
|
|
|
|
String sql = "UPDATE AP_APP_RELEASE SET STARS=?, NO_OF_RATED_USERS=(NO_OF_RATED_USERS+1) WHERE UUID=?;";
|
|
|
|
|
|
|
|
|
|
stmt = connection.prepareStatement(sql);
|
|
|
|
|
stmt.setInt(1, stars);
|
|
|
|
|
stmt.setString(2, uuid);
|
|
|
|
@ -1015,25 +931,22 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
resultSet.getInt("STARS");
|
|
|
|
|
}
|
|
|
|
|
int numORows = resultSet.getRow();
|
|
|
|
|
|
|
|
|
|
if (resultSet.next()) {
|
|
|
|
|
ApplicationRelease applicationRelease = new ApplicationRelease();
|
|
|
|
|
applicationRelease.setStars(resultSet.getInt("STARS"));
|
|
|
|
|
|
|
|
|
|
Util.cleanupResources(stmt, resultSet);
|
|
|
|
|
}
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
throw new ApplicationManagementDAOException(
|
|
|
|
|
"SQL Exception while trying to add stars to an application (UUID : " + uuid + "), by executing " +
|
|
|
|
|
"the query " + e);
|
|
|
|
|
"SQL Exception while trying to add stars to an application (UUID : " + uuid + "), by executing "
|
|
|
|
|
+ "the query " + e);
|
|
|
|
|
} catch (DBConnectionException e) {
|
|
|
|
|
log.error("DB Connection Exception occurs.", e);
|
|
|
|
|
log.error("DB Connection Exception while trying to add stars to an application (UUID : " + uuid + "), ",
|
|
|
|
|
e);
|
|
|
|
|
} finally {
|
|
|
|
|
Util.cleanupResources(stmt, null);
|
|
|
|
|
return getStars(uuid);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -1048,23 +961,21 @@ public class CommentDAOImpl extends AbstractDAOImpl implements CommentDAO {
|
|
|
|
|
try {
|
|
|
|
|
connection = this.getDBConnection();
|
|
|
|
|
sql = "SELECT STARS FROM AP_APP_RELEASE WHERE UUID=?;";
|
|
|
|
|
|
|
|
|
|
statement = connection.prepareStatement(sql);
|
|
|
|
|
statement.setString(1, uuid);
|
|
|
|
|
resultSet = statement.executeQuery();
|
|
|
|
|
|
|
|
|
|
if (resultSet.next()) {
|
|
|
|
|
ApplicationRelease applicationRelease = new ApplicationRelease();
|
|
|
|
|
Stars = resultSet.getInt("STARS");
|
|
|
|
|
|
|
|
|
|
return Stars;
|
|
|
|
|
}
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
throw new ApplicationManagementDAOException(
|
|
|
|
|
"SQL Exception while trying to get stars from an application (UUID : " + uuid + "), by executing " +
|
|
|
|
|
"the query " + e);
|
|
|
|
|
"SQL Exception while trying to get stars from an application (UUID : " + uuid + "), by executing "
|
|
|
|
|
+ "the query " + e);
|
|
|
|
|
} catch (DBConnectionException e) {
|
|
|
|
|
log.error("DB Connection Exception occurs.", e);
|
|
|
|
|
log.error(
|
|
|
|
|
"DB Connection Exception while trying to get stars from an application (UUID : " + uuid + ")," + e);
|
|
|
|
|
} finally {
|
|
|
|
|
Util.cleanupResources(statement, resultSet);
|
|
|
|
|
}
|
|
|
|
|