Skip to content

Commit b15350b

Browse files
committed
fix: Refactor process addon - EXO-79327
This change will do some refactoring on the process addon, renaming, intoducing spring...
1 parent d7d4d05 commit b15350b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+3418
-3008
lines changed

processes-api/src/main/java/org/exoplatform/processes/model/Work.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,21 +66,21 @@ public class Work {
6666
private List<Attachment> attachments;
6767

6868
/**
69-
* constructor for Work task object
69+
* constructor for request task object
7070
*
71-
* @param id Work id
72-
* @param title Work title
73-
* @param description Work description
74-
* @param status Work task status
75-
* @param completed Work task completed property
76-
* @param createdBy Work task creator
77-
* @param createdDate Work task creation date
78-
* @param startDate Work task start date
79-
* @param endDate Work task end date
80-
* @param dueDate Work task due date
81-
* @param isDraft When the object is a draft object, which will be used to create the work
82-
* @param draftId The already saved draft id, which will be deleted once the work created from the draft
83-
* @param projectId Work task project
71+
* @param id request id
72+
* @param title request title
73+
* @param description request description
74+
* @param status request task status
75+
* @param completed request task completed property
76+
* @param createdBy request task creator
77+
* @param createdDate request task creation date
78+
* @param startDate request task start date
79+
* @param endDate request task end date
80+
* @param dueDate request task due date
81+
* @param isDraft When the object is a draft object, which will be used to create the request
82+
* @param draftId The already saved draft id, which will be deleted once the request created from the draft
83+
* @param projectId request task project
8484
*/
8585
public Work(long id,
8686
String title,

processes-api/src/main/java/org/exoplatform/processes/service/ProcessesAttachmentService.java renamed to processes-api/src/main/java/org/exoplatform/processes/service/ProcessAttachmentService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package org.exoplatform.processes.service;
22

3-
import org.exoplatform.services.attachments.model.Attachment;
4-
53
import java.util.List;
64

7-
public interface ProcessesAttachmentService {
5+
import org.exoplatform.services.attachments.model.Attachment;
6+
7+
public interface ProcessAttachmentService {
88

99
/**
1010
* Links a list of attachments to entity
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
/*
2+
* Copyright (C) 2021 eXo Platform SAS
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Affero General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Affero General Public License
15+
* along with this program. If not, see <gnu.org/licenses>.
16+
*/
17+
package org.exoplatform.processes.service;
18+
19+
import java.io.IOException;
20+
import java.util.List;
21+
22+
import org.exoplatform.commons.exception.ObjectNotFoundException;
23+
import org.exoplatform.commons.file.services.FileStorageException;
24+
import org.exoplatform.processes.model.*;
25+
import org.exoplatform.social.core.identity.model.Identity;
26+
27+
public interface ProcessService {
28+
29+
/**
30+
* Retrieves a list of accessible Processes, for a selected user, by applying
31+
* the designated filter. The returned results will be of type
32+
* {@link WorkFlow} only. The ownerId of filter object will be used to select
33+
* the list of accessible processes to retrieve.
34+
*
35+
* @param filter {@link ProcessesFilter} that contains filtering criteria
36+
* @param offset Offset of the result list
37+
* @param limit Limit of the result list
38+
* @param userIdentityId {@link Identity} technical identifier of the user
39+
* acessing files
40+
* @return {@link List} of {@link WorkFlow}
41+
* @throws IllegalAccessException when the user isn't allowed to access
42+
* documents of the designated ownerId
43+
*/
44+
List<WorkFlow> getWorkFlows(ProcessesFilter filter,
45+
int offset,
46+
int limit,
47+
long userIdentityId) throws IllegalAccessException;
48+
49+
50+
int countWorkFlows(ProcessesFilter filter,
51+
long userIdentityId) throws IllegalAccessException;
52+
53+
WorkFlow getWorkFlow(long id,
54+
long userIdentityId) throws IllegalAccessException, ObjectNotFoundException;
55+
56+
WorkFlow getWorkFlow(long id) throws IllegalAccessException, ObjectNotFoundException;
57+
58+
WorkFlow createWorkFlow(WorkFlow workFlow, long userId) throws IllegalAccessException;
59+
60+
WorkFlow updateWorkFlow(WorkFlow workFlow,
61+
long userId) throws IllegalArgumentException, ObjectNotFoundException, IllegalAccessException;
62+
63+
64+
WorkFlow getWorkFlowByProjectId(long projectId, long userId) throws IllegalAccessException, ObjectNotFoundException;
65+
66+
WorkFlow getWorkFlowByProjectId(long projectId) throws ObjectNotFoundException;
67+
68+
/**
69+
* Delete a workflow by its given Id.
70+
*
71+
* @param workflowId : workflow id
72+
* @param userId user id
73+
*/
74+
void deleteWorkflowById(Long workflowId, long userId) throws IllegalAccessException, ObjectNotFoundException;
75+
76+
/**
77+
* @param projectId: Tasks project id
78+
* @param isCompleted: filter by completed and uncompleted tasks
79+
* @param userId user id
80+
* @return Filtered tasks count
81+
* @throws Exception
82+
*/
83+
int countWorksByWorkflow(Long projectId, long userId, Boolean isCompleted) throws Exception;
84+
85+
/**
86+
* Retrieves the list of available statuses in all workflows
87+
*
88+
* @return {@link List} of {@link WorkStatus}
89+
*/
90+
List<WorkStatus> getAvailableWorkStatuses();
91+
92+
93+
/**
94+
* Retrieves an illustration image by its given id
95+
*
96+
* @param illustrationId illustration file id
97+
* @param userId user id
98+
* @return {@link IllustrativeAttachment}
99+
* @throws FileStorageException
100+
* @throws ObjectNotFoundException
101+
*/
102+
IllustrativeAttachment getIllustrationImageById(Long illustrationId,
103+
long userId) throws FileStorageException,
104+
ObjectNotFoundException,
105+
IOException;
106+
107+
boolean canAccessProcess(WorkFlow workFlow, org.exoplatform.services.security.Identity identity);
108+
109+
boolean canAddProcess(org.exoplatform.services.security.Identity identity);
110+
111+
boolean canEditProcess(WorkFlow workFlow, org.exoplatform.services.security.Identity identity);
112+
113+
boolean canDeleteProcess(WorkFlow workFlow, org.exoplatform.services.security.Identity identity);
114+
}

processes-api/src/main/java/org/exoplatform/processes/service/ProcessesService.java renamed to processes-api/src/main/java/org/exoplatform/processes/service/RequestService.java

Lines changed: 5 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -16,49 +16,13 @@
1616
*/
1717
package org.exoplatform.processes.service;
1818

19-
import java.io.IOException;
2019
import java.util.List;
2120

2221
import org.exoplatform.commons.exception.ObjectNotFoundException;
23-
import org.exoplatform.commons.file.services.FileStorageException;
2422
import org.exoplatform.processes.model.*;
25-
import org.exoplatform.social.core.identity.model.Identity;
2623

27-
public interface ProcessesService {
24+
public interface RequestService {
2825

29-
/**
30-
* Retrieves a list of accessible WorkFlows, for a selected user, by applying
31-
* the designated filter. The returned results will be of type
32-
* {@link WorkFlow} only. The ownerId of filter object will be used to select
33-
* the list of accessible WorkFlows to retrieve.
34-
*
35-
* @param filter {@link ProcessesFilter} that contains filtering criteria
36-
* @param offset Offset of the result list
37-
* @param limit Limit of the result list
38-
* @param userIdentityId {@link Identity} technical identifier of the user
39-
* acessing files
40-
* @return {@link List} of {@link WorkFlow}
41-
* @throws IllegalAccessException when the user isn't allowed to access
42-
* documents of the designated ownerId
43-
*/
44-
List<WorkFlow> getWorkFlows(ProcessesFilter filter,
45-
int offset,
46-
int limit,
47-
long userIdentityId) throws IllegalAccessException;
48-
49-
50-
int countWorkFlows(ProcessesFilter filter,
51-
long userIdentityId) throws IllegalAccessException;
52-
53-
WorkFlow getWorkFlow(long id,
54-
long userIdentityId) throws IllegalAccessException;
55-
56-
WorkFlow getWorkFlow(long id) throws IllegalAccessException;
57-
58-
WorkFlow createWorkFlow(WorkFlow workFlow, long userId) throws IllegalAccessException;
59-
60-
WorkFlow updateWorkFlow(WorkFlow workFlow,
61-
long userId) throws IllegalArgumentException, ObjectNotFoundException, IllegalAccessException;
6226

6327
/**
6428
* Retrieves list of filtered works
@@ -72,9 +36,6 @@ WorkFlow updateWorkFlow(WorkFlow workFlow,
7236
*/
7337
List<Work> getWorks(long userIdentityId, WorkFilter workFilter, int offset, int limit) throws Exception;
7438

75-
WorkFlow getWorkFlowByProjectId(long projectId, long userId) throws IllegalAccessException;
76-
77-
WorkFlow getWorkFlowByProjectId(long projectId);
7839

7940
/**
8041
* Creates a work from new work object or from exiting work draft
@@ -84,27 +45,11 @@ WorkFlow updateWorkFlow(WorkFlow workFlow,
8445
* @return {@link Work}
8546
* @throws IllegalAccessException
8647
*/
87-
Work createWork(Work work, long userId) throws IllegalAccessException;
48+
Work createWork(Work work, long userId) throws IllegalAccessException, ObjectNotFoundException;
8849

8950
Work updateWork(Work work, long userId) throws IllegalArgumentException,
9051
ObjectNotFoundException,
9152
IllegalAccessException;
92-
/**
93-
* Delete a workflow by its given Id.
94-
*
95-
* @param workflowId : workflow id
96-
* @param userId user id
97-
*/
98-
void deleteWorkflowById(Long workflowId, long userId) throws IllegalAccessException, ObjectNotFoundException;
99-
100-
/**
101-
* @param projectId: Tasks project id
102-
* @param isCompleted: filter by completed and uncompleted tasks
103-
* @param userId user id
104-
* @return Filtered tasks count
105-
* @throws Exception
106-
*/
107-
int countWorksByWorkflow(Long projectId, long userId, Boolean isCompleted) throws Exception;
10853

10954
/**
11055
* Delete a work by its given id.
@@ -167,47 +112,21 @@ Work updateWork(Work work, long userId) throws IllegalArgumentException,
167112
*/
168113
void deleteWorkDraftById(Long draftId, long userId) throws IllegalAccessException, ObjectNotFoundException;
169114

170-
/**
171-
* Retrieves the list of available statuses in all workflows
172-
*
173-
* @return {@link List} of {@link WorkStatus}
174-
*/
175-
List<WorkStatus> getAvailableWorkStatuses();
176-
177115
/**
178116
* Retrieves a Work by its given id
179117
*
180118
* @param userId user identity id
181119
* @param workId Work id
182120
* @return {@link Work}
183121
*/
184-
Work getWorkById(long userId, Long workId) throws IllegalAccessException;
122+
Work getWorkById(long userId, Long workId) throws IllegalAccessException, ObjectNotFoundException;
185123

186-
/**
187-
* Retrieves an illustration image by its given id
188-
*
189-
* @param illustrationId illustration file id
190-
* @param userId user id
191-
* @return {@link IllustrativeAttachment}
192-
* @throws FileStorageException
193-
* @throws ObjectNotFoundException
194-
*/
195-
IllustrativeAttachment getIllustrationImageById(Long illustrationId,
196-
long userId) throws FileStorageException,
197-
ObjectNotFoundException,
198-
IOException;
199-
200-
boolean canAccess(WorkFlow workFlow, org.exoplatform.services.security.Identity identity);
201-
202-
boolean canAdd(org.exoplatform.services.security.Identity identity);
203-
204-
boolean canEdit(WorkFlow workFlow, org.exoplatform.services.security.Identity identity);
205-
206-
boolean canDelete(WorkFlow workFlow, org.exoplatform.services.security.Identity identity);
207124

208125
boolean canAddRequest(WorkFlow workFlow, org.exoplatform.services.security.Identity identity);
209126

210127
boolean canEditRequest(WorkFlow workFlow, org.exoplatform.services.security.Identity identity);
211128

212129
boolean canDeleteRequest(WorkFlow workFlow, org.exoplatform.services.security.Identity identity);
130+
131+
boolean canCompleteRequest(Work work, org.exoplatform.services.security.Identity identity) throws ObjectNotFoundException;
213132
}

0 commit comments

Comments
 (0)