Added emial to exchanges
This commit is contained in:
45
buisnesslogic/src/main/java/com/plannaplan/models/EmailExchangesData.java
Executable file
45
buisnesslogic/src/main/java/com/plannaplan/models/EmailExchangesData.java
Executable file
@ -0,0 +1,45 @@
|
||||
package com.plannaplan.models;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.plannaplan.entities.Exchange;
|
||||
import com.plannaplan.entities.User;
|
||||
|
||||
/**
|
||||
* Class to keepm data to be send after exchanges being accept
|
||||
*/
|
||||
public class EmailExchangesData {
|
||||
private Map<Long, List<Exchange>> data;
|
||||
|
||||
public EmailExchangesData() {
|
||||
this.data = new HashMap<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* method to add user and his event to data to be send
|
||||
*
|
||||
* @param user owner of exchange being performed
|
||||
* @param data exchange that was executed
|
||||
*/
|
||||
public void addExchange(User user, Exchange data) {
|
||||
final Long id = user.getId();
|
||||
if (this.data.get(id) == null) {
|
||||
this.data.put(id, new ArrayList<>());
|
||||
}
|
||||
this.data.get(id).add(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* get datas entry set
|
||||
*
|
||||
* @return set with entries that contains Long that is user id and list of hiss
|
||||
* performed Exchanges
|
||||
*/
|
||||
public Set<Map.Entry<Long, List<Exchange>>> getDataEntry() {
|
||||
return this.data.entrySet();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user