2021-01-03 17:10:36 +01:00
|
|
|
package com.plannaplan.models;
|
|
|
|
|
|
|
|
import java.util.Iterator;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import com.plannaplan.entities.Groups;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Instance to keep data to send in mail about accepted courses results
|
|
|
|
*/
|
|
|
|
public class EmailAcceptedData {
|
|
|
|
private List<Groups> accepted;
|
|
|
|
private List<Groups> removed;
|
|
|
|
|
|
|
|
public EmailAcceptedData() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* creates instance of class
|
|
|
|
*
|
|
|
|
* @param accepted list of groups that user joined to
|
|
|
|
* @param removed lsit of groups that user failed to join
|
|
|
|
*/
|
|
|
|
public EmailAcceptedData(List<Groups> accepted, List<Groups> removed) {
|
|
|
|
this.accepted = accepted;
|
|
|
|
this.removed = removed;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get list of removed assignments
|
|
|
|
*
|
|
|
|
* @return removed assingments
|
|
|
|
*/
|
|
|
|
public List<Groups> getRemoved() {
|
|
|
|
return removed;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* set list of removed assignments
|
|
|
|
*
|
|
|
|
* @param removed list of removed assignments
|
|
|
|
*/
|
|
|
|
public void setRemoved(List<Groups> removed) {
|
|
|
|
this.removed = removed;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get list of accepted assignments
|
|
|
|
*
|
|
|
|
* @return accepted assingments
|
|
|
|
*/
|
|
|
|
public List<Groups> getAccepted() {
|
|
|
|
return accepted;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* set list of accepted assignments
|
|
|
|
*
|
2021-01-05 11:50:25 +01:00
|
|
|
* @param accepted list of accepted assignments
|
2021-01-03 17:10:36 +01:00
|
|
|
*/
|
|
|
|
public void setAccepted(List<Groups> accepted) {
|
|
|
|
this.accepted = accepted;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* it creates and return email message body
|
|
|
|
*
|
|
|
|
* @return string with emiale massage
|
|
|
|
*/
|
|
|
|
public String getEmailMessage() {
|
|
|
|
String response = "Akceptacja Twoich przedmiotów właśnie dobiegła końca.\n\n";
|
|
|
|
if (this.accepted != null && this.accepted.size() > 0) {
|
|
|
|
response += "Zatwierdzone grupy: \n";
|
|
|
|
Iterator<Groups> iterator = accepted.iterator();
|
|
|
|
while (iterator.hasNext()) {
|
|
|
|
final Groups gorup = iterator.next();
|
|
|
|
final String courseName = gorup.getCourseId() != null ? gorup.getCourseId().getName()
|
|
|
|
: "Nieznana grupa";
|
|
|
|
response += (" - " + courseName + " - " + gorup.getType() + "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
if (this.removed != null && this.removed.size() > 0) {
|
|
|
|
response += "Usunięte grupy: \n";
|
|
|
|
Iterator<Groups> iterator = removed.iterator();
|
|
|
|
while (iterator.hasNext()) {
|
|
|
|
final Groups gorup = iterator.next();
|
|
|
|
final String courseName = gorup.getCourseId() != null ? gorup.getCourseId().getName()
|
|
|
|
: "Nieznana grupa";
|
|
|
|
response += (" - " + courseName + " - " + gorup.getType() + "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return response;
|
|
|
|
}
|
|
|
|
}
|