1,11 → 1,6 |
package ak.kickup.core.model; |
|
import java.util.Date; |
import java.util.Map; |
import java.util.HashMap; |
import java.util.Collections; |
import java.util.Collection; |
import java.util.Iterator; |
import ak.kickup.util.ModelException; |
import ak.kickup.util.ModelSecurityException; |
|
34,8 → 29,6 |
private Boolean payed; |
private String comment; |
private String privateComment; |
private Collection acts; // Collection(ParticipantAct) |
private Map actsMap = new HashMap(); // Map(Long id -> ParticipantAct) |
|
protected Participant() |
{ |
293,56 → 286,6 |
this.privateComment = privateComment; |
} |
|
/** |
* @return Collection(ParticipantAct) |
* |
* @hibernate.bag inverse="true" cascade="all-delete-orphan" lazy="true" |
* @hibernate.collection-key column="participant" |
* @hibernate.collection-one-to-many class="ak.kickup.core.model.ParticipantAct" |
*/ |
protected Collection getActs() |
{ |
return acts; |
} |
|
public Collection getActCollection() |
{ |
return Collections.unmodifiableCollection(acts); |
} |
|
/** |
* @param destinations Collection(ParticipantAct) |
*/ |
protected void setActs(Collection acts) |
{ |
this.acts = acts; |
|
actsMap.clear(); |
if(acts != null) { |
for(Iterator i = acts.iterator(); i.hasNext(); ) { |
ParticipantAct a = (ParticipantAct)i.next(); |
actsMap.put(a.getAct().getId(), a); |
} |
} |
} |
|
public ParticipantAct getAct(Long actId) |
{ |
return (ParticipantAct)actsMap.get(actId); |
} |
|
public void addAct(ParticipantAct act) |
{ |
acts.add(act); |
actsMap.put(act.getAct().getId(), act); |
} |
|
public void removeAct(ParticipantAct act) |
{ |
acts.remove(act); |
actsMap.remove(act.getAct().getId()); |
} |
|
public boolean equals(Object o) |
{ |
if(o == null || !(o instanceof Participant)) return false; |