package com.atlassian.confluence.extra.workflow;

import com.atlassian.confluence.extra.workflow.model.ConditionModel;

import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;

/**
 * Created by IntelliJ IDEA.
 * User: Tomd
 * Date: 23/05/2005
 * Time: 13:39:40
 * To change this template use File | Settings | File Templates.
 */
public class StateSetConditionModel implements ConditionModel
{
    StateSetCondition condition;
    public StateSetConditionModel(Condition cond)
    {
        states = new HashMap();
        condition = (StateSetCondition) cond;
    }
    private Map states;

    public Map getStates()
    {
        return states;
    }

    public void applyChanges(WorkflowType type)
    {
        condition.getStates().clear();
        for (Iterator i = states.keySet().iterator(); i.hasNext();)
        {
            condition.getStates().add(type.getStateById((String)i.next()));
        }
    }
}
