46 lines
1.1 KiB
Java
Executable File
46 lines
1.1 KiB
Java
Executable File
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();
|
|
}
|
|
}
|