Skip to content

Commit 47ae091

Browse files
Merge pull request #10 from aquality-automation/feature/Rebranding
Feature/rebranding
2 parents 8fbb81b + 07f652c commit 47ae091

File tree

19 files changed

+174
-32
lines changed

19 files changed

+174
-32
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Reporting portal API
1+
# Aquality Tracking API
22

33
## Getting started
44

src/main/filters/local.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
db.name= union_reporting
1+
db.name=union_reporting

src/main/java/main/model/db/dao/project/UserDao.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
public class UserDao extends DAO<UserDto> {
1616
public UserDao() {
1717
super(UserDto.class);
18-
select = "{call SELECT_USERS(?,?,?,?,?,?)}";
18+
select = "{call SELECT_USERS(?,?,?,?,?,?,?)}";
1919
insert = "{call INSERT_USER(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}";
2020
remove = "{call REMOVE_USER(?)}";
2121
}

src/main/java/main/model/dto/AuditorDto.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class AuditorDto extends UserDto {
1414
@DataBaseName(name="request_user_id")
1515
@DataBaseInsert
1616
@DataBaseSearchable
17-
private Integer assignee_user_id;
17+
private Integer id;
1818
@DataBaseName(name="request_auditor_id")
1919
@DataBaseID
2020
private Integer auditor_id;

src/main/java/main/model/dto/UserDto.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public class UserDto extends BaseDto {
4343
private Integer manager;
4444
@DataBaseName(name="request_auditor")
4545
@DataBaseInsert
46+
@DataBaseSearchable
4647
private Integer auditor;
4748
@DataBaseName(name="request_unit_coordinator")
4849
@DataBaseInsert

src/main/java/main/model/email/AuditEmails.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import main.model.db.dao.audit.AuditStatisticDao;
66
import main.model.db.dao.project.UserDao;
77
import main.model.dto.*;
8+
import main.utils.AppProperties;
89
import org.json.JSONException;
910

1011
import javax.naming.NamingException;
@@ -19,12 +20,13 @@
1920
public class AuditEmails extends Emails {
2021

2122
private AuditStatisticDao auditStatisticController;
23+
private AppProperties appProperties = new AppProperties();
2224

2325
public AuditEmails() {
2426
auditStatisticController = new AuditStatisticDao();
2527
}
2628

27-
public List<EmailDto> GetUpcomingEmails() throws SQLException, IOException, JSONException, NamingException, IllegalAccessException, InstantiationException, RPException {
29+
public List<EmailDto> GetUpcomingEmails() throws RPException {
2830
List<AuditStatisticDto> audits = auditStatisticController.getAll();
2931
List<String> recipients = getRecipients();
3032

@@ -36,7 +38,7 @@ public List<EmailDto> GetUpcomingEmails() throws SQLException, IOException, JSON
3638
return emails;
3739
}
3840

39-
public List<EmailDto> GetOverdueEmails() throws SQLException, IOException, JSONException, NamingException, IllegalAccessException, InstantiationException, RPException {
41+
public List<EmailDto> GetOverdueEmails() throws RPException {
4042
List<AuditStatisticDto> audits = auditStatisticController.getAll();
4143
List<String> recipients = getRecipients();
4244
List<AuditStatisticDto> overdueAudits = audits.stream()
@@ -47,16 +49,16 @@ public List<EmailDto> GetOverdueEmails() throws SQLException, IOException, JSONE
4749

4850
for(AuditStatisticDto overdueAudit: overdueAudits){
4951
EmailDto email = new EmailDto();
50-
email.setSubject("[REPORTING PORTAL] Overdue Project Audit - " + overdueAudit.getName());
52+
email.setSubject(String.format("[%s] Overdue Project Audit - %s", appProperties.getName(), overdueAudit.getName()));
5153
email.setContent("<p style=\"font-family: Calibri, sans-serif; font-size: 11pt; line-height: 4px;\">Next Audit Date for the <strong><a style=\"color: #6b6b6b;\" href=\""
5254
+ hostUri() +"#/project/" + overdueAudit.getId()+"\">" + overdueAudit.getName() +"</a>&nbsp; </strong>project is overdue and requires your attention.</p>\n" +
5355
"<p style=\"font-family: Calibri, sans-serif; font-size: 11pt; line-height: 4px;\">Please follow this <a style=\"color: #6b6b6b;\" href=\""
5456
+ hostUri() + "#/audit\">link</a> to access Audits Dashboard.</p>\n" +
5557
"<p>&nbsp;</p>" +
5658
"<p style=\"font-family: Calibri, sans-serif; font-size: 10pt; line-height: 2px;\">Best Regards,</p>\n" +
57-
"<p style=\"font-family: Calibri, sans-serif; font-size: 10pt; line-height: 2px;\">Reporting Portal Administration</p>\n" +
59+
"<p style=\"font-family: Calibri, sans-serif; font-size: 10pt; line-height: 2px;\">" + appProperties.getName() + " Administration</p>\n" +
5860
"<p><img src=\"cid:logo\"></p>\n" +
59-
"<p><span style=\"font-family: Calibri; font-size: 7.5pt; color: #7f7f7f;\">This message is automatically generated by Notification Assistant for Reporting Portal.<br /> If you think it was sent incorrectly, please contact your Reporting Portal administrators.</span></p>");
61+
"<p><span style=\"font-family: Calibri; font-size: 7.5pt; color: #7f7f7f;\">This message is automatically generated by Notification Assistant for " + appProperties.getName() + ".<br /> If you think it was sent incorrectly, please contact your " + appProperties.getName() + " administrators.</span></p>");
6062
List<String> customRecipients = new ArrayList<>(recipients);
6163

6264
if(!Objects.equals(overdueAudit.getLast_created_id(), overdueAudit.getLast_submitted_id())){
@@ -80,17 +82,17 @@ private List<EmailDto> getUpcomingAudits(int daysFromToday, List<AuditStatisticD
8082

8183
for(AuditStatisticDto upcAudit: upcomingAudits){
8284
EmailDto email = new EmailDto();
83-
email.setSubject("[REPORTING PORTAL] Upcoming Project Audit - " + upcAudit.getName());
85+
email.setSubject(String.format("[%s] Upcoming Project Audit - %s", appProperties.getName(), upcAudit.getName()));
8486
email.setContent("<p style=\"font-family: Calibri, sans-serif; font-size: 11pt; line-height: 4px;\">Next Audit for the <strong><a style=\"color: #6b6b6b;\" href=\""
8587
+ hostUri() +"#/project/" + upcAudit.getId()+"\">" + upcAudit.getName() + "</a> </strong>project should be submitted within<strong> "
8688
+ days + " days.</strong></p>\n" +
8789
"<p style=\"font-family: Calibri, sans-serif; font-size: 11pt; line-height: 4px;\">Please follow this <a style=\"color: #6b6b6b;\" href=\""
8890
+ hostUri() + "#/audit\">link</a> to access Audits Dashboard and create a new Audit.</p>\n" +
8991
"<p>&nbsp;</p>\n" +
9092
"<p style=\"font-family: Calibri, sans-serif; font-size: 10pt; line-height: 2px;\">Best Regards,</p>\n" +
91-
"<p style=\"font-family: Calibri, sans-serif; font-size: 10pt; line-height: 2px;\">Reporting Portal Administration</p>\n" +
93+
"<p style=\"font-family: Calibri, sans-serif; font-size: 10pt; line-height: 2px;\">" + appProperties.getName() + " Administration</p>\n" +
9294
"<p><img src=\"cid:logo\"></p>\n" +
93-
"<p><span style=\"font-family: Calibri; font-size: 7.5pt; color: #7f7f7f;\">This message is automatically generated by Notification Assistant for Reporting Portal.<br /> If you think it was sent incorrectly, please contact your Reporting Portal administrators.</span></p>");
95+
"<p><span style=\"font-family: Calibri; font-size: 7.5pt; color: #7f7f7f;\">This message is automatically generated by Notification Assistant for " + appProperties.getName() + ".<br /> If you think it was sent incorrectly, please contact your " + appProperties.getName() + " administrators.</span></p>");
9496
email.setRecipients(recipients);
9597
emails.add(email);
9698
}
@@ -111,7 +113,7 @@ private List<String> getCustomRecipients(Integer id) throws RPException {
111113
auditTemplate.setId(id);
112114
List<AuditorDto> users = auditDao.searchAll(auditTemplate).get(0).getAuditors();
113115
users = users.stream().filter(userX -> userX.getAudit_notifications() == 1).collect(Collectors.toList());
114-
return users.stream().map(auditor -> auditor.getEmail()).collect(Collectors.toList());
116+
return users.stream().map(UserDto::getEmail).collect(Collectors.toList());
115117
}
116118

117119
private Date getDueDate(AuditStatisticDto auditStat){

src/main/java/main/model/email/TestRunEmails.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import main.model.db.dao.project.ProjectDao;
55
import main.model.db.dao.settings.EmailSettingsDao;
66
import main.model.dto.*;
7+
import main.utils.AppProperties;
78
import main.utils.EmailUtil;
89
import org.json.JSONException;
910

@@ -17,6 +18,7 @@
1718
import java.util.stream.Collectors;
1819

1920
public class TestRunEmails extends Emails{
21+
private AppProperties appProperties = new AppProperties();
2022

2123
public void sendTestRunResultsToTeam(TestRunDto testRun, List<UserDto> users) throws IOException, JSONException, SQLException, NamingException, IllegalAccessException, InstantiationException, MessagingException, URISyntaxException, RPException {
2224
ProjectDao projectDao = new ProjectDao();
@@ -25,17 +27,17 @@ public void sendTestRunResultsToTeam(TestRunDto testRun, List<UserDto> users) th
2527
projectDto = projectDao.searchAll(projectDto).get(0);
2628
List<TestResultDto> testResults = testRun.getTestResults();
2729
double totalResultsNum = testResults.size();
28-
double passedResultsNum = testResults.stream().filter(x -> x.getFinal_result().getColor() == 5).collect(Collectors.toList()).size();
29-
double failedResultsNum = testResults.stream().filter(x -> x.getFinal_result().getColor() == 1).collect(Collectors.toList()).size();
30-
double notExecutedResultsNum = testResults.stream().filter(x -> x.getFinal_result().getColor() == 3 || x.getFinal_result().getColor() == 2 || x.getFinal_result().getColor() == 4).collect(Collectors.toList()).size();
30+
double passedResultsNum = (int) testResults.stream().filter(x -> x.getFinal_result().getColor() == 5).count();
31+
double failedResultsNum = (int) testResults.stream().filter(x -> x.getFinal_result().getColor() == 1).count();
32+
double notExecutedResultsNum = (int) testResults.stream().filter(x -> x.getFinal_result().getColor() == 3 || x.getFinal_result().getColor() == 2 || x.getFinal_result().getColor() == 4).count();
3133
List<TestResultDto> failedResults = testResults.stream().filter(x -> x.getFinal_result().getColor() != 5).collect(Collectors.toList());
3234
List<TestResultDto> appIssues = failedResults.stream().filter(x -> x.getTest_resolution().getColor() == 1).collect(Collectors.toList());
3335
List<TestResultDto> otherIssues = failedResults.stream().filter(x -> x.getTest_resolution().getColor() != 1 && x.getTest_resolution().getColor() != 2 && x.getTest_resolution().getColor() != 3).collect(Collectors.toList());
3436
double successRate = passedResultsNum/totalResultsNum*100;
3537
String rateColor = successRate > 85 ? "#009900" : successRate > 65 ? "#ff6601" : "#cc2100";
36-
String overview = appIssues.size() > 0 ? " <p style=\"font-family: Calibri, sans-serif;margin:0;color: #4c4c4c;font-weight: bold;\">Application Issues Overview:</p>\n" : "";
38+
StringBuilder overview = new StringBuilder(appIssues.size() > 0 ? " <p style=\"font-family: Calibri, sans-serif;margin:0;color: #4c4c4c;font-weight: bold;\">Application Issues Overview:</p>\n" : "");
3739
for (TestResultDto testResult : appIssues) {
38-
overview += " <p style=\"font-family: Calibri, sans-serif;margin:0;color: #4c4c4c;\">" + testResult.getTest().getName() + ": " + (testResult.getComment() != null ? testResult.getComment() : "No comment for This Failure.") + "</p>\n";
40+
overview.append(" <p style=\"font-family: Calibri, sans-serif;margin:0;color: #4c4c4c;\">").append(testResult.getTest().getName()).append(": ").append(testResult.getComment() != null ? testResult.getComment() : "No comment for This Failure.").append("</p>\n");
3941
}
4042

4143
EmailDto email = new EmailDto();
@@ -58,7 +60,7 @@ public void sendTestRunResultsToTeam(TestRunDto testRun, List<UserDto> users) th
5860
" font-weight: bold;\n" +
5961
" font-family: Calibri, sans-serif;\n" +
6062
" font-size: 15px;\n" +
61-
" line-height: 10px;\" href=\"" + hostUri() + "#/project/" + projectDto.getId() + "/testrun/" + testRun.getId() + "\">View on Reporting Portal</a>\n" +
63+
" line-height: 10px;\" href=\"" + hostUri() + "#/project/" + projectDto.getId() + "/testrun/" + testRun.getId() + "\">View on " + appProperties.getName() + "</a>\n" +
6264
" </div>\n" +
6365
" <hr>\n" +
6466
" <div style=\"margin: 0;font-family: Calibri, sans-serif;height:50px; padding-top:20px; color:" + rateColor + ";font-size: 30px;\">\n" +
@@ -77,9 +79,9 @@ public void sendTestRunResultsToTeam(TestRunDto testRun, List<UserDto> users) th
7779
" <p style=\"margin: 0;color:#e27070;text-transform: uppercase;font-family: Calibri, sans-serif;\">\n" +
7880
" Application Issues | " + appIssues.size() + " </p>\n" +
7981
" <p style=\"margin: 0;color:#676767;text-transform: uppercase;font-family: Calibri, sans-serif;\">\n" +
80-
" Test Issues | " + failedResults.stream().filter(x -> x.getTest_resolution().getColor() == 2 ).collect(Collectors.toList()).size() + " </p>\n" +
82+
" Test Issues | " + (int) failedResults.stream().filter(x -> x.getTest_resolution().getColor() == 2).count() + " </p>\n" +
8183
" <p style=\"margin: 0;color:#676767;text-transform: uppercase;font-family: Calibri, sans-serif;\">\n" +
82-
" Not Assigned | " + failedResults.stream().filter(x -> x.getTest_resolution().getColor() == 3).collect(Collectors.toList()).size() + " </p>\n" +
84+
" Not Assigned | " + (int) failedResults.stream().filter(x -> x.getTest_resolution().getColor() == 3).count() + " </p>\n" +
8385
" <p style=\"margin: 0;color:#676767;text-transform: uppercase;font-family: Calibri, sans-serif;\">\n" +
8486
" Other Issues | " + otherIssues.size() + " </p>\n" +
8587
" <br/>\n" +
@@ -88,13 +90,13 @@ public void sendTestRunResultsToTeam(TestRunDto testRun, List<UserDto> users) th
8890
" <hr>\n" +
8991
" <br/>\n" +
9092
" <p style=\"font-family: Calibri, sans-serif; font-size: 10pt; line-height: 2px;\">Best Regards,</p>\n" +
91-
" <p style=\"font-family: Calibri, sans-serif; font-size: 10pt; line-height: 2px;\">Reporting Portal Administration</p>\n" +
93+
" <p style=\"font-family: Calibri, sans-serif; font-size: 10pt; line-height: 2px;\">" + appProperties.getName() + " Administration</p>\n" +
9294
" <p>\n" +
9395
" <img src=\"cid:logo\">\n" +
9496
" </p>\n" +
9597
" <p>\n" +
96-
" <span style=\"font-family: Calibri; font-size: 7.5pt; color: #7f7f7f;\">This message is automatically generated by Notification Assistant for Reporting Portal.\n" +
97-
" <br/> If you think it was sent incorrectly, please contact your Reporting Portal administrators.</span>\n" +
98+
" <span style=\"font-family: Calibri; font-size: 7.5pt; color: #7f7f7f;\">This message is automatically generated by Notification Assistant for " + appProperties.getName() + ".\n" +
99+
" <br/> If you think it was sent incorrectly, please contact your " + appProperties.getName() + " administrators.</span>\n" +
98100
" </p>\n" +
99101
"</div>");
100102
email.setRecipients(getProjectMemberRecipients(users));
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package main.utils;
2+
3+
public class AppProperties extends PropertyUtils{
4+
public AppProperties() {
5+
super(AvailableProperties.APPLICATION);
6+
}
7+
8+
public String getName(){
9+
return prop.getProperty("name");
10+
}
11+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package main.utils;
2+
3+
public enum AvailableProperties {
4+
APPLICATION("appinfo.properties");
5+
6+
private String name;
7+
AvailableProperties(String name) {
8+
this.name = name;
9+
}
10+
11+
public String getName() {
12+
return name;
13+
}
14+
}

src/main/java/main/utils/EmailUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public void SendHtmlEmail(List<String> to, String subject, String content) throw
6262

6363
imageBodyPart.setHeader("Content-ID", "<logo>");
6464
imageBodyPart.setDisposition(Part.INLINE);
65-
imageBodyPart.attachFile(new File(classloader.getResource("rp-logo.png").toURI()));
65+
imageBodyPart.attachFile(new File(classloader.getResource("logo.png").toURI()));
6666

6767
multipart.addBodyPart(imageBodyPart);
6868

0 commit comments

Comments
 (0)