Improve review management DAO

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

@ -32,12 +32,6 @@ public class Review {
@ApiModelProperty(name = "content", value = "Review message.")
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")
private String username;
@ -50,6 +44,12 @@ public class Review {
@ApiModelProperty(name = "rating", value = "Rating value of the application release")
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")
private List<Review> replies;
@ -69,22 +69,6 @@ public class Review {
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() {
return username;
}
@ -120,4 +104,12 @@ public class Review {
public List<Review> getReplies() { return 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 {
conn = this.getDBConnection();
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 = ?");
appReleaseIds.stream().map(ignored -> "?").forEach(joiner::add);
String query = joiner.toString();
@ -118,7 +118,7 @@ public class ReviewDAOImpl extends AbstractDAOImpl implements ReviewDAO {
for (Integer deviceId : appReleaseIds) {
ps.setObject(index++, deviceId);
}
ps.setInt(index++, tenantId);
ps.setString(index++, username);
ps.setInt(index, tenantId);
try (ResultSet rs = ps.executeQuery()) {
return rs.next();

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

Loading…
Cancel
Save