/*
 * $Id: WorkItemInfo.java,v 1.3 2004/11/10 15:02:52 koppy Exp $
 *
 * Copyright (c) Siemens AG 2008 
 *           (c) Universität Paderborn 2008 
 * Licensed under EUPL 1.1. 
 * 
 * Created on 08.07.2004
 *
 * $Log: WorkItemInfo.java,v $
 * Revision 1.3  2004/11/10 15:02:52  koppy
 * Projektweite Überarbeitung von Error-Logs, Stacktraces,..
 *
 * Revision 1.2  2004/09/20 10:26:14  koppy
 * +javadoc Dokumentation
 *
 * Revision 1.1  2004/08/30 14:49:55  koppy
 * Initiale Version der Workflow-Komponente
 *
 */
package vkc.workflow.model;

import java.util.Date;

import vkc.util.DateUtils;

/**
 * This class represents a java bean
 * to encapsulate infos about a workitem.
 * It is primary used in the presentation layer.
 * 
 * @author Andreas Koop
 */
public class WorkItemInfo extends InstanceInfo{

    private Date receivedAt = null;
    private ProcessInstanceInfo container = null;
    
    /**
     * Returns the date of retrieval of this workitem.
     * @return Returns the receivedAt time.
     */
    public Date getReceivedAt() {
        return receivedAt;
    }
    /**
     * Sets the retrieval time of this workitem
     * @param receivedAt The receivedAt to set.
     */
    public void setReceivedAt(Date receivedAt) {
        this.receivedAt = receivedAt;
    }
    /**
     * Returns the corresponding process info.
     * @return Returns the container.
     */
    public ProcessInstanceInfo getContainer() {
        return container;
    }
    /**
     * Sets the corresponding process container.
     * @param container The container to set.
     */
    public void setContainer(ProcessInstanceInfo container) {
        this.container = container;
    }
    
    /**
     * Returns the duration of this workitem
     * @return duration of this workitem.
     */
    public String getDuration(){
        
        return DateUtils.formatDuration( System.currentTimeMillis()-receivedAt.getTime());
    }
    
}
