Skip to content

Commit cc47a1f

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

Some content is hidden

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

46 files changed

+4043
-3632
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,
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
/*
2+
* Copyright (C) 2025 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+
18+
package org.exoplatform.processes.service;
19+
20+
import java.util.List;
21+
22+
import org.exoplatform.services.attachments.model.Attachment;
23+
24+
public interface ProcessAttachmentService {
25+
26+
/**
27+
* Links a list of attachments to entity
28+
*
29+
* @param attachments list of attachments
30+
* @param userName user name
31+
* @param entityId entity id
32+
* @param entityType entity type
33+
* @param projectId task project id
34+
*/
35+
void linkAttachmentsToEntity(Attachment[] attachments, String userName, Long entityId, String entityType, Long projectId);
36+
37+
/**
38+
* Move attachments from source entity to a dest entity
39+
*
40+
* @param userName user name
41+
* @param sourceEntityId source entity of attachments
42+
* @param sourceEntityType target entity type to attach files from source entity
43+
* @param destEntityId target entity id
44+
* @param destEntityType target entity type
45+
* @param projectId task project id
46+
*/
47+
void moveAttachmentsToEntity(String userName,
48+
Long sourceEntityId,
49+
String sourceEntityType,
50+
Long destEntityId,
51+
String destEntityType,
52+
Long projectId);
53+
54+
/**
55+
* Move attachments from source entity to a dest entity
56+
*
57+
* @param attachments list of attachment
58+
* @param userName user name
59+
* @param sourceEntityId source entity of attachments
60+
* @param sourceEntityType target entity type to attach files from source entity
61+
* @param destEntityId target entity id
62+
* @param destEntityType target entity type
63+
* @param projectId task project id
64+
*/
65+
void moveAttachmentsToEntity(List<Attachment> attachments,
66+
String userName,
67+
Long sourceEntityId,
68+
String sourceEntityType,
69+
Long destEntityId,
70+
String destEntityType,
71+
Long projectId);
72+
73+
/**
74+
* Copy attachments from source entity to a dest entity
75+
*
76+
* @param userName user name
77+
* @param sourceEntityId source entity of attachments
78+
* @param sourceEntityType target entity type to attach files from source entity
79+
* @param destEntityId target entity id
80+
* @param destEntityType target entity type
81+
* @param projectId task project id
82+
*/
83+
void copyAttachmentsToEntity(String userName,
84+
Long sourceEntityId,
85+
String sourceEntityType,
86+
Long destEntityId,
87+
String destEntityType,
88+
Long projectId);
89+
90+
/**
91+
* Creates a new onlyoffice document form
92+
*
93+
* @param userName user name
94+
* @param title document title
95+
* @param path document path
96+
* @param pathDrive drive path
97+
* @param templateName document template name
98+
* @param entityType entity type to attach created document
99+
* @param entityId entity id
100+
* @return {@link Attachment}
101+
* @throws Exception if an error occurs while creating the document
102+
*/
103+
Attachment createNewFormDocument(String userName,
104+
String title,
105+
String path,
106+
String pathDrive,
107+
String templateName,
108+
String entityType,
109+
Long entityId) throws Exception;
110+
}
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
/*
2+
* Copyright (C) 2025 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.util.List;
20+
21+
import org.exoplatform.commons.exception.ObjectNotFoundException;
22+
import org.exoplatform.processes.model.IllustrativeAttachment;
23+
import org.exoplatform.processes.model.ProcessesFilter;
24+
import org.exoplatform.processes.model.WorkFlow;
25+
import org.exoplatform.processes.model.WorkStatus;
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 {@link WorkFlow}
32+
* only. The ownerId of filter object will be used to select the list of
33+
* 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 userName name of the user accessing files
39+
* @return {@link List} of {@link WorkFlow}
40+
*/
41+
List<WorkFlow> getWorkFlows(ProcessesFilter filter, int offset, int limit, String userName);
42+
43+
/**
44+
* Return the number of proceses after applying a given filter
45+
*
46+
* @param filter: process filter to apply
47+
* @return Filtered processes count
48+
*/
49+
int countWorkFlows(ProcessesFilter filter, String userName);
50+
51+
/**
52+
* get a process by its given id
53+
*
54+
* @param id process id
55+
* @param userName user name
56+
* @return {@link WorkFlow} object
57+
* @throws IllegalAccessException if the user does not have access to the
58+
* process
59+
* @throws ObjectNotFoundException if the process with the given id does not
60+
* exist
61+
*/
62+
WorkFlow getWorkFlow(long id, String userName) throws IllegalAccessException, ObjectNotFoundException;
63+
64+
/**
65+
* get a process by its given id
66+
*
67+
* @param id process id
68+
* @return {@link WorkFlow} object
69+
* @throws ObjectNotFoundException if the process with the given id does not
70+
* exist
71+
*/
72+
WorkFlow getWorkFlow(long id) throws ObjectNotFoundException;
73+
74+
/**
75+
* Create a process
76+
*
77+
* @param workFlow process object
78+
* @param userName user name
79+
* @return {@link WorkFlow} object
80+
* @throws IllegalAccessException if the user does not have the rights to create
81+
* a process
82+
*/
83+
WorkFlow createWorkFlow(WorkFlow workFlow, String userName) throws IllegalAccessException;
84+
85+
/**
86+
* Update a process
87+
*
88+
* @param workFlow process object
89+
* @param userName user name
90+
* @return {@link WorkFlow} object
91+
* @throws IllegalAccessException if the user does not have the rights to update
92+
* the process
93+
* @throws IllegalArgumentException if the process is null or its id is 0
94+
* @throws ObjectNotFoundException if the process does not exist
95+
*/
96+
WorkFlow updateWorkFlow(WorkFlow workFlow,
97+
String userName) throws IllegalArgumentException, ObjectNotFoundException, IllegalAccessException;
98+
99+
/**
100+
* get process by its project id
101+
*
102+
* @param projectId process(s project id
103+
* @param userName user name
104+
* @return {@link WorkFlow} object
105+
* @throws IllegalAccessException if the user does not have access to the
106+
* process
107+
* @throws ObjectNotFoundException if the project with the given id does not
108+
* exist
109+
*/
110+
WorkFlow getWorkFlowByProjectId(long projectId, String userName) throws IllegalAccessException, ObjectNotFoundException;
111+
112+
/**
113+
* get process by its project id
114+
*
115+
* @param projectId process(s project id
116+
* @return {@link WorkFlow} object
117+
* @throws ObjectNotFoundException if the project with the given id does not
118+
* exist
119+
*/
120+
WorkFlow getWorkFlowByProjectId(long projectId) throws ObjectNotFoundException;
121+
122+
/**
123+
* Delete a workflow by its given id.
124+
*
125+
* @param workflowId : workflow id
126+
* @param userName user name
127+
* @throws ObjectNotFoundException if the project with the given id does not
128+
* exist
129+
* @throws IllegalAccessException if the user does not have access to the
130+
* process
131+
*/
132+
void deleteWorkflowById(Long workflowId, String userName) throws IllegalAccessException, ObjectNotFoundException;
133+
134+
/**
135+
* @param projectId: Tasks project id
136+
* @param isCompleted: filter by completed and uncompleted tasks
137+
* @param userName user name
138+
* @return Filtered tasks count
139+
* @throws ObjectNotFoundException if the project with the given id does not
140+
* exist
141+
* @throws IllegalAccessException if the user does not have access to the
142+
* process
143+
*/
144+
int countWorksByWorkflow(Long projectId, String userName, Boolean isCompleted) throws ObjectNotFoundException,
145+
IllegalAccessException;
146+
147+
/**
148+
* Retrieves the list of available statuses in all workflows
149+
*
150+
* @return {@link List} of {@link WorkStatus}
151+
*/
152+
List<WorkStatus> getAvailableWorkStatuses();
153+
154+
/**
155+
* Retrieves an illustration image by its given id
156+
*
157+
* @param illustrationId illustration file id
158+
* @param userName user name
159+
* @return {@link IllustrativeAttachment}
160+
*/
161+
IllustrativeAttachment getIllustrationImageById(Long illustrationId, String userName);
162+
163+
boolean canAccessProcess(WorkFlow workFlow, org.exoplatform.services.security.Identity identity);
164+
165+
boolean canAddProcess(org.exoplatform.services.security.Identity identity);
166+
167+
boolean canEditProcess(WorkFlow workFlow, org.exoplatform.services.security.Identity identity);
168+
169+
boolean canDeleteProcess(WorkFlow workFlow, org.exoplatform.services.security.Identity identity);
170+
}

0 commit comments

Comments
 (0)