001/*
002 *  Copyright 2016 Anyware Services
003 *
004 *  Licensed under the Apache License, Version 2.0 (the "License");
005 *  you may not use this file except in compliance with the License.
006 *  You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 *  Unless required by applicable law or agreed to in writing, software
011 *  distributed under the License is distributed on an "AS IS" BASIS,
012 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *  See the License for the specific language governing permissions and
014 *  limitations under the License.
015 */
016package org.ametys.plugins.workflow.repository;
017
018import org.ametys.plugins.repository.AmetysObject;
019import org.ametys.plugins.repository.AmetysRepositoryException;
020import org.ametys.plugins.repository.jcr.JCRAmetysObject;
021
022/**
023 * {@link AmetysObject} abstraction defined by the following additional property:
024 * <dl>
025 *   <dt>workflowId
026 *   <dd>the id of the workflow instance associated with the ametys object
027 *   <dt>currentStepId
028 *   <dd>the id of the current step associated with the ametys object
029 * </dl>
030 */
031public interface WorkflowAwareAmetysObject extends JCRAmetysObject
032{
033    /**
034     * Retrieves the workflow id associated with the Ametys object.
035     * @return the workflow id.
036     * @throws AmetysRepositoryException if an error occurs.
037     */
038    long getWorkflowId() throws AmetysRepositoryException;
039    
040    /**
041     * Set the workflow id of this Ametys object.<br>
042     * This method will throw Exception if the workflow id was already set on this Ametys object.
043     * @param workflowId the workflow id of the object.
044     * @throws AmetysRepositoryException if an error occurs.
045     */
046    void setWorkflowId(long workflowId) throws AmetysRepositoryException;
047    
048    /**
049     * Retrieves the current step id of the Ametys object
050     * @return the current step id
051     * @throws AmetysRepositoryException if an error occurs.
052     */
053    long getCurrentStepId () throws AmetysRepositoryException;
054    
055    /**
056     * Set the current step id of the Ametys object
057     * @param stepId the step id to set
058     * @throws AmetysRepositoryException if an error occurs.
059     */
060    void setCurrentStepId (long stepId) throws AmetysRepositoryException;
061}
062