blob: eeb987a57af1d1b5dcd961faaf976ea59860f7c2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
package org.fedoraproject.candlepin.model;
import java.util.HashSet;
import java.util.Set;
import com.wideplay.warp.persist.Transactional;
public class EntitlementCurator extends AbstractHibernateCurator<Entitlement> {
public EntitlementCurator() {
super(Entitlement.class);
}
// TODO: handles addition of new entitlements only atm!
@Transactional
public Set<Entitlement> bulkUpdate(Set<Entitlement> entitlements) {
Set<Entitlement> toReturn = new HashSet<Entitlement>();
for(Entitlement toUpdate: entitlements) {
Entitlement found = find(toUpdate.getId());
if(found != null) {
toReturn.add(found);
continue;
}
toReturn.add(create(toUpdate));
}
return toReturn;
}
}
|