001/*
002 * file Task.java
003 *
004 * Licensed Materials - Property of IBM
005 * Restricted Materials of IBM
006 *
007 * (c) Copyright IBM Corporation 2004, 2008.  All Rights Reserved. 
008 * Note to U.S. Government Users Restricted Rights:  Use, duplication or  
009 * disclosure restricted by GSA ADP  Schedule Contract with IBM Corp. 
010 */
011
012package javax.wvcm;
013
014import javax.wvcm.PropertyNameList.PropertyName;
015import javax.wvcm.WvcmException.ReasonCode;
016
017/**
018 * A proxy for a task resource.
019 * 
020 * A task resource provides the motivation for the logical change performed by an activity.
021 * A variety of terms are used in various systems for a task, including change request,
022 * modification request, change order, and workitem.
023 * 
024 * @since 1.0
025 */
026public interface Task extends Resource {
027
028    /**
029     * Create a new persistent task, where the provider can allocate the location for the
030     * new task.
031     * The provider should use the client-specified location if it is valid,
032     * but can select a different location if the location is not valid
033     * or already identifies a task.
034     * <p>
035     * Postconditions:
036     * <li>(initialize-resource): A new task resource exists at the location of this Resource.
037     * 
038     * @param feedback Specifies optional feedback to the caller.
039     * @return A proxy for this new resource, whose properties are specified by feedback.
040     * @throws WvcmException ReasonCode:
041     * <li>{@link ReasonCode#CANNOT_CREATE_AT_THIS_LOCATION}:
042     *  If the location of this Task does not identify a repository that supports
043     *  the creation of tasks, the request MUST fail.
044     */
045    public Task doCreateGeneratedResource(Feedback feedback) throws WvcmException;
046
047    /**
048     * The activities that are performing this task.
049     * This is the inverse of the {@link Activity#TASK_LIST} property.
050     */
051    public static final PropertyName<ResourceList<Activity>> ACTIVITY_LIST =
052        new PropertyName<ResourceList<Activity>>("activity-list"); //$NON-NLS-1$
053
054    /**
055     * Get the {@link #ACTIVITY_LIST} property.
056     * 
057     * @return the {@link #ACTIVITY_LIST} property.
058     * @throws WvcmException if this Task was not created with
059     * {@link #ACTIVITY_LIST} as a wanted property.
060     */
061    public ResourceList<Activity> getActivityList() throws WvcmException;
062
063}