01: package org.osbl.riskmanagement.process;
02:
03: import org.concern.controller.AbstractActor;
04:
05: import org.osbl.riskmanagement.model.Risk;
06: import org.osbl.persistence.Persistence;
07: import org.osbl.persistence.LoadCommand;
08: import org.osbl.identity.model.Identity;
09: import org.osbl.identity.model.User;
10:
11: import java.util.*;
12:
13: public class Assignee extends AbstractActor<Risk> {
14: Persistence identityPersistence;
15:
16: public void setIdentityPersistence(Persistence identityPersistence) {
17: this .identityPersistence = identityPersistence;
18: }
19:
20: public Set<String> getAssignees(Risk subject, int level) {
21: /*PROTECTED REGION ID(org.osbl.riskmanagement.process.Assignee.getAssignees) ENABLED START*/
22: Identity assignee = subject.getAssignee();
23: if (assignee == null)
24: return Collections.EMPTY_SET;
25: LoadCommand command = (LoadCommand) identityPersistence
26: .createCommand("load");
27: command.setType(User.class);
28: command.setId(assignee.getId());
29: User user = (User) command.execute();
30: return new HashSet<String>(Arrays.asList(user.getAccount()));
31: /*PROTECTED REGION END*/
32: }
33: }
|