001/*
002 *  Copyright 2017 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.bpm;
017
018import org.ametys.core.group.GroupIdentity;
019import org.ametys.core.user.UserIdentity;
020import org.ametys.plugins.explorer.resources.ResourceCollection;
021import org.ametys.plugins.repository.AmetysRepositoryException;
022
023/**
024 * Common interface for a Workflow in the Business Process Management
025 */
026public interface Workflow
027{
028    /**
029     * Get the workflow title
030     * @return The workflow title
031     * @throws AmetysRepositoryException If a repository error occurred
032     */
033    public String getTitle() throws AmetysRepositoryException;
034    
035    /**
036     * Set the workflow title
037     * @param title The title
038     * @throws AmetysRepositoryException If a repository error occurred
039     */
040    public void setTitle(String title) throws AmetysRepositoryException;
041    
042    /**
043     * Get the workflow definition linked to this workflow
044     * @return The workflow definition id
045     * @throws AmetysRepositoryException If a repository error occurred
046     */
047    public String getWorkflowDefinition() throws AmetysRepositoryException;
048    
049    /**
050     * Set the workflow definition linked to this workflow
051     * @param workflowDefId The workflow definition id
052     * @throws AmetysRepositoryException If a repository error occurred
053     */
054    public void setWorkflowDefinition(String workflowDefId) throws AmetysRepositoryException;
055    
056    /**
057     * Get the workflow description
058     * @return The description
059     * @throws AmetysRepositoryException If a repository error occurred
060     */
061    public String getDescription() throws AmetysRepositoryException;
062    
063    /**
064     * Set the workflow description
065     * @param description The description
066     * @throws AmetysRepositoryException If a repository error occurred
067     */
068    public void setDescription(String description) throws AmetysRepositoryException;
069    
070    /**
071     * Get the value of a variable of the workflow 
072     * @param variableName The name of the variable to retrieve
073     * @return The value of the variable
074     * @throws AmetysRepositoryException If a repository error occurred
075     */
076    public Object getVariable(String variableName) throws AmetysRepositoryException;
077    
078    /**
079     * Set the value of a variable of the workflow
080     * @param variableName The name of the variable to set
081     * @param value The value to set
082     * @throws AmetysRepositoryException If a repository error occurred
083     */
084    public void setVariable(String variableName, Object value) throws AmetysRepositoryException;
085    
086    /**
087     * Get the owner of the workflow
088     * @return The owner
089     * @throws AmetysRepositoryException If a repository error occurred
090     */
091    public UserIdentity getOwner() throws AmetysRepositoryException;
092    
093    /**
094     * Set the owner of the workflow
095     * @param owner The owner
096     * @throws AmetysRepositoryException If a repository error occurred
097     */
098    public void setOwner(UserIdentity owner) throws AmetysRepositoryException;
099    
100    /**
101     * Get the list of users allowed to create a process from this workflow
102     * @return The list of allowed users
103     * @throws AmetysRepositoryException If a repository error occurred
104     */
105    public UserIdentity[] getAllowedUsers() throws AmetysRepositoryException;
106    
107    /**
108     * Set the list of users allowed to create a process from this workflow
109     * @param allowedUsers The list of allowed users
110     * @throws AmetysRepositoryException If a repository error occurred
111     */
112    public void setAllowedUsers(UserIdentity[] allowedUsers) throws AmetysRepositoryException;
113    
114    /**
115     * Get the list of groups allowed to create a process from this workflow
116     * @return The list of allowed groups
117     * @throws AmetysRepositoryException If a repository error occurred
118     */
119    public GroupIdentity[] getAllowedGroups() throws AmetysRepositoryException;
120    
121    /**
122     * Set the list of groups allowed to create a process from this workflow
123     * @param allowedGroups The list of allowed groups
124     * @throws AmetysRepositoryException If a repository error occurred
125     */
126    public void setAllowedGroups(GroupIdentity[] allowedGroups) throws AmetysRepositoryException;
127
128    /**
129     * Retrieves the attachments root node
130     * @return The the attachments root node
131     * @throws AmetysRepositoryException if an error occurs.
132     */
133    ResourceCollection getRootAttachments() throws AmetysRepositoryException;
134}