View Javadoc
1   /*
2    * Copyright (c) 2002-2021, City of Paris
3    * All rights reserved.
4    *
5    * Redistribution and use in source and binary forms, with or without
6    * modification, are permitted provided that the following conditions
7    * are met:
8    *
9    *  1. Redistributions of source code must retain the above copyright notice
10   *     and the following disclaimer.
11   *
12   *  2. Redistributions in binary form must reproduce the above copyright notice
13   *     and the following disclaimer in the documentation and/or other materials
14   *     provided with the distribution.
15   *
16   *  3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its
17   *     contributors may be used to endorse or promote products derived from
18   *     this software without specific prior written permission.
19   *
20   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23   * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
24   * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27   * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28   * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30   * POSSIBILITY OF SUCH DAMAGE.
31   *
32   * License 1.0
33   */
34  package fr.paris.lutece.plugins.workflowcore.service.resource;
35  
36  import fr.paris.lutece.plugins.workflowcore.business.resource.ResourceWorkflow;
37  import fr.paris.lutece.plugins.workflowcore.business.resource.ResourceWorkflowFilter;
38  import java.util.List;
39  import java.util.Map;
40  
41  /**
42   *
43   * IResourceWorkflowService
44   *
45   */
46  public interface IResourceWorkflowService
47  {
48      /**
49       * Creation of an instance of resoureceWorkflow
50       * 
51       * @param resourceWorkflow
52       *            The instance of resourceWorkflow which contains the informations to store
53       */
54      void create( ResourceWorkflow resourceWorkflow );
55  
56      /**
57       * Update of resourceWorkflow which is specified in parameter
58       * 
59       * @param resourceWorkflow
60       *            The instance of resourceWorkflow which contains the informations to update
61       */
62      void update( ResourceWorkflow resourceWorkflow );
63  
64      /**
65       * Remove resourceWorkflow which is specified in parameter
66       * 
67       * @param resourceWorkflow
68       *            The instance of resourceWorkflow which contains the informations to remove
69       */
70      void remove( ResourceWorkflow resourceWorkflow );
71  
72      /**
73       * Delete record and workflow list by list id resource
74       * 
75       * @param listIdResource
76       *            list of resource id
77       * @param strResourceType
78       *            the resource type
79       * @param nIdWorflow
80       *            the worflow id
81       */
82      void removeByListIdResource( List<Integer> listIdResource, String strResourceType, Integer nIdWorflow );
83  
84      // Finders
85  
86      /**
87       * Load the resourceWorkflow Object
88       * 
89       * @param nIdResource
90       *            the resource Id
91       * @param strResourceType
92       *            the resource type
93       * @param nIdWorkflow
94       *            the workflow id
95       * @return the resource workflow Object
96       */
97      ResourceWorkflow findByPrimaryKey( int nIdResource, String strResourceType, int nIdWorkflow );
98  
99      /**
100      * Select All resourceWorkflow Object associated to the workflow
101      * 
102      * @param nIdWorkflow
103      *            workflow id
104      * @return List of resourceWorkflow Object
105      */
106     List<ResourceWorkflow> getAllResourceWorkflowByWorkflow( int nIdWorkflow );
107 
108     /**
109      * Select All resourceWorkflow Object associated to the workflow
110      * 
111      * @param nIdWorkflow
112      *            workflow id
113      * @return List of Id resource
114      */
115     List<Integer> getAllResourceIdByWorkflow( int nIdWorkflow );
116 
117     /**
118      * Select All resourceWorkflow Object associated to the state
119      * 
120      * @param nIdState
121      *            state
122      * @return List of resourceWorkflow Object
123      */
124     List<ResourceWorkflow> getAllResourceWorkflowByState( int nIdState );
125 
126     /**
127      * Select All resourceWorkflow Object associated to the state and the external parent id
128      * 
129      * @param nIdState
130      *            state     
131      * @param nIdParent
132      *            the external parent id
133      * @return List of resourceWorkflow Object
134      */
135     List<ResourceWorkflow> getAllResourceWorkflowByState( int nIdState, int nIdParent );
136 
137     /**
138      * Select ResourceWorkflow by filter
139      * 
140      * @param resourceWorkflowFilter
141      *            the filter
142      * @return ResourceWorkflow List
143      */
144     List<ResourceWorkflow> getListResourceWorkflowByFilter( ResourceWorkflowFilter resourceWorkflowFilter );
145 
146     /**
147      * Select Resource Workflow id by filter
148      * 
149      * @param resourceWorkflowFilter
150      *            the filter
151      * @param lListIdWorkflowState
152      *            list of workflow state
153      * @return ResourceWorkflow list id
154      */
155     List<Integer> getListResourceIdWorkflowByFilter( ResourceWorkflowFilter resourceWorkflowFilter, List<Integer> lListIdWorkflowState );
156 
157     /**
158      * Select ResourceWorkflow ID by filter
159      * 
160      * @param resourceWorkflowFilter
161      *            the filter
162      * @return ResourceWorkflow ID List
163      */
164     List<Integer> getListResourceIdWorkflowByFilter( ResourceWorkflowFilter resourceWorkflowFilter );
165 
166     /**
167      * Select id state by list id resource
168      * 
169      * @param lListIdResource
170      *            the resource list id
171      * @param nIdWorflow
172      *            The worflow id
173      * @param strResourceType
174      *            the ressource type
175      * @param nIdExternalParentId
176      *            the external parent id
177      * @return a map of <id_resource, id_state>
178      */
179     Map<Integer, Integer> getListIdStateByListId( List<Integer> lListIdResource, int nIdWorflow, String strResourceType, Integer nIdExternalParentId );
180 
181     /**
182      * Select All resourceWorkflow Object associated to the list state
183      * 
184      * @param listIdStateBefore
185      *            list of id state
186      * @return List of resourceWorkflow Object
187      */
188 	List<ResourceWorkflow> getAllResourceWorkflowByListState(List<Integer> listIdStateBefore);
189 }