Improve review management DAO

feature/appm-store/pbac
lasanthaDLPDS 6 years ago
parent 6cc9d816c3
commit 34a14aa9e0

@ -32,12 +32,6 @@ public class Review {
@ApiModelProperty(name = "content", value = "Review message.") @ApiModelProperty(name = "content", value = "Review message.")
private String content; private String content;
@ApiModelProperty(name = "rootParentId", value = "Root Parent id of the review")
private int rootParentId;
@ApiModelProperty(name = "immediateParentId", value = "Immediate Parent id of the review")
private int immediateParentId;
@ApiModelProperty(name = "username", value = "Username odf the Review creator") @ApiModelProperty(name = "username", value = "Username odf the Review creator")
private String username; private String username;
@ -50,6 +44,12 @@ public class Review {
@ApiModelProperty(name = "rating", value = "Rating value of the application release") @ApiModelProperty(name = "rating", value = "Rating value of the application release")
private int rating; private int rating;
@ApiModelProperty(name = "releaseUuid", value = "UUID of the review associated application")
private String releaseUuid;
@ApiModelProperty(name = "releaseVersion", value = "Version of the review associated application")
private String releaseVersion;
@ApiModelProperty(name = "replies", value = "Replying reviews") @ApiModelProperty(name = "replies", value = "Replying reviews")
private List<Review> replies; private List<Review> replies;
@ -69,22 +69,6 @@ public class Review {
this.content = content; this.content = content;
} }
public int getRootParentId() {
return rootParentId;
}
public void setRootParentId(int rootParentId) {
this.rootParentId = rootParentId;
}
public int getImmediateParentId() {
return immediateParentId;
}
public void setImmediateParentId(int immediateParentId) {
this.immediateParentId = immediateParentId;
}
public String getUsername() { public String getUsername() {
return username; return username;
} }
@ -120,4 +104,12 @@ public class Review {
public List<Review> getReplies() { return replies; } public List<Review> getReplies() { return replies; }
public void setReplies(List<Review> replies) { this.replies = replies; } public void setReplies(List<Review> replies) { this.replies = replies; }
public String getReleaseUuid() { return releaseUuid; }
public void setReleaseUuid(String releaseUuid) { this.releaseUuid = releaseUuid; }
public String getReleaseVersion() { return releaseVersion; }
public void setReleaseVersion(String releaseVersion) { this.releaseVersion = releaseVersion; }
} }

@ -110,7 +110,7 @@ public class ReviewDAOImpl extends AbstractDAOImpl implements ReviewDAO {
try { try {
conn = this.getDBConnection(); conn = this.getDBConnection();
StringJoiner joiner = new StringJoiner(",", StringJoiner joiner = new StringJoiner(",",
"SELECT rv.ID FROM AP_APP_REVIEW rv " + "WHERE rv.AP_APP_RELEASE_ID IN (", "SELECT rv.ID FROM AP_APP_REVIEW rv WHERE rv.AP_APP_RELEASE_ID IN (",
") AND rv.USERNAME = ? AND rv.TENANT_ID = ?"); ") AND rv.USERNAME = ? AND rv.TENANT_ID = ?");
appReleaseIds.stream().map(ignored -> "?").forEach(joiner::add); appReleaseIds.stream().map(ignored -> "?").forEach(joiner::add);
String query = joiner.toString(); String query = joiner.toString();
@ -118,7 +118,7 @@ public class ReviewDAOImpl extends AbstractDAOImpl implements ReviewDAO {
for (Integer deviceId : appReleaseIds) { for (Integer deviceId : appReleaseIds) {
ps.setObject(index++, deviceId); ps.setObject(index++, deviceId);
} }
ps.setInt(index++, tenantId); ps.setString(index++, username);
ps.setInt(index, tenantId); ps.setInt(index, tenantId);
try (ResultSet rs = ps.executeQuery()) { try (ResultSet rs = ps.executeQuery()) {
return rs.next(); return rs.next();

@ -238,8 +238,8 @@ public class ReviewManagerImpl implements ReviewManager {
Review review = new Review(); Review review = new Review();
review.setId(reviewDTO.getId()); review.setId(reviewDTO.getId());
review.setContent(reviewDTO.getContent()); review.setContent(reviewDTO.getContent());
review.setRootParentId(reviewDTO.getRootParentId()); review.setReleaseUuid(reviewDTO.getReleaseUuid());
review.setImmediateParentId(reviewDTO.getImmediateParentId()); review.setReleaseVersion(reviewDTO.getReleaseVersion());
review.setCreatedAt(reviewDTO.getCreatedAt()); review.setCreatedAt(reviewDTO.getCreatedAt());
review.setModifiedAt(reviewDTO.getModifiedAt()); review.setModifiedAt(reviewDTO.getModifiedAt());
review.setRating(reviewDTO.getRating()); review.setRating(reviewDTO.getRating());

Loading…
Cancel
Save