Assignee.java :  » Workflow-Engines » osbl-1_0 » org » osbl » riskmanagement » process » Java Open Source

Java Open Source » Workflow Engines » osbl 1_0 
osbl 1_0 » org » osbl » riskmanagement » process » Assignee.java
package org.osbl.riskmanagement.process;


import org.concern.controller.AbstractActor;

import org.osbl.riskmanagement.model.Risk;
import org.osbl.persistence.Persistence;
import org.osbl.persistence.LoadCommand;
import org.osbl.identity.model.Identity;
import org.osbl.identity.model.User;

import java.util.*;

public class Assignee
    extends AbstractActor<Risk>
{
    Persistence identityPersistence;

    public void setIdentityPersistence(Persistence identityPersistence) {
        this.identityPersistence = identityPersistence;
    }

    public Set<String> getAssignees(Risk subject, int level) {
      /*PROTECTED REGION ID(org.osbl.riskmanagement.process.Assignee.getAssignees) ENABLED START*/
        Identity assignee = subject.getAssignee();
        if (assignee == null)
            return Collections.EMPTY_SET;
        LoadCommand command = (LoadCommand)identityPersistence.createCommand("load");
        command.setType(User.class);
        command.setId(assignee.getId());
        User user = (User)command.execute();
        return new HashSet<String>(Arrays.asList(user.getAccount()));
        /*PROTECTED REGION END*/
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.