package com.atlassian.confluence.extra.workflow;

import com.atlassian.user.User;
import com.atlassian.confluence.core.ContentEntityObject;

/**
 * Created by IntelliJ IDEA.
 * User: Tomd
 * Date: 13/05/2005
 * Time: 12:35:07
 * To change this template use File | Settings | File Templates.
 */
public class TagCurrentVersionAction extends TagAction
{

    public TagCurrentVersionAction(String tag)
    {
        super(tag);
    }
    
    public TagCurrentVersionAction()
    {
        super();
    }

    public void perform(WorkflowClient client, User user)
    {
        ConfluencePageWorkflowClient cpwc = (ConfluencePageWorkflowClient) client;
        ContentEntityObject ceo = cpwc.getContentEntityObject();
        cpwc.setValue("versiontag." + getTag(), Integer.toString(ceo.getVersion()));
    }

    public String getDescription()
    {
        return "Mark the current version of the page with the tag '" + getTag() + "'";
    }

}
