File size: 8,709 Bytes
9373c61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5cfe5c4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
package com.dalab.policyengine.service;

import java.util.List;
import java.util.UUID;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import com.dalab.policyengine.dto.PolicyDraftActionDTO;
import com.dalab.policyengine.dto.PolicyDraftInputDTO;
import com.dalab.policyengine.dto.PolicyDraftOutputDTO;
import com.dalab.policyengine.dto.PolicyImpactRequestDTO;
import com.dalab.policyengine.dto.PolicyImpactResponseDTO;
import com.dalab.policyengine.dto.PolicyInputDTO;
import com.dalab.policyengine.dto.PolicyOutputDTO;
import com.dalab.policyengine.dto.PolicySummaryDTO;
import com.dalab.policyengine.model.PolicyDraftStatus;

public interface IPolicyService {
    Page<PolicySummaryDTO> getAllPolicies(Pageable pageable, String status, String nameContains);
    PolicyOutputDTO getPolicyById(UUID policyId);
    PolicyOutputDTO createPolicy(PolicyInputDTO policyInputDTO, UUID creatorUserId);
    PolicyOutputDTO updatePolicy(UUID policyId, PolicyInputDTO policyInputDTO, UUID updaterUserId);
    void deletePolicy(UUID policyId);
    
    /**

     * Analyze the potential impact of a policy before implementation.

     * Provides comprehensive assessment of affected assets, performance impact,

     * cost implications, and compliance analysis.

     * 

     * @param request the policy impact analysis request containing rules and analysis parameters

     * @return comprehensive impact analysis response with affected assets and risk assessment

     */
    PolicyImpactResponseDTO analyzePolicy(PolicyImpactRequestDTO request);

    /**

     * Create a new policy draft.

     * 

     * @param draftInput the draft input data

     * @param creatorUserId the ID of the user creating the draft

     * @return the created draft output DTO

     */
    PolicyDraftOutputDTO createDraft(PolicyDraftInputDTO draftInput, UUID creatorUserId);

    /**

     * Update an existing policy draft (only allowed in CREATED or REQUIRES_CHANGES status).

     * 

     * @param draftId the ID of the draft to update

     * @param draftInput the updated draft data

     * @param updaterUserId the ID of the user updating the draft

     * @return the updated draft output DTO

     */
    PolicyDraftOutputDTO updateDraft(UUID draftId, PolicyDraftInputDTO draftInput, UUID updaterUserId);

    /**

     * Get a policy draft by ID with full details including workflow information.

     * 

     * @param draftId the ID of the draft

     * @return the draft output DTO with complete information

     */
    PolicyDraftOutputDTO getDraftById(UUID draftId);

    /**

     * Get all policy drafts with filtering and pagination.

     * 

     * @param pageable pagination information

     * @param status optional status filter

     * @param category optional category filter

     * @param priority optional priority filter

     * @param createdBy optional creator filter

     * @param nameContains optional name search filter

     * @return paginated list of draft summaries

     */
    Page<PolicyDraftOutputDTO> getAllDrafts(

        Pageable pageable, 

        PolicyDraftStatus status, 

        String category, 

        String priority, 

        UUID createdBy, 

        String nameContains

    );

    /**

     * Get drafts requiring attention from a specific user (created by them or they are stakeholder).

     * 

     * @param userId the user ID

     * @param pageable pagination information

     * @return paginated list of drafts requiring attention

     */
    Page<PolicyDraftOutputDTO> getDraftsRequiringAttention(UUID userId, Pageable pageable);

    /**

     * Get drafts pending review (submitted or under review status).

     * 

     * @param pageable pagination information

     * @return paginated list of drafts pending review

     */
    Page<PolicyDraftOutputDTO> getDraftsPendingReview(Pageable pageable);

    /**

     * Submit a draft for review (transition from CREATED to SUBMITTED).

     * 

     * @param draftId the ID of the draft to submit

     * @param action the submit action DTO with optional comment

     * @param submittedByUserId the ID of the user submitting the draft

     * @return the updated draft output DTO

     */
    PolicyDraftOutputDTO submitDraft(UUID draftId, PolicyDraftActionDTO action, UUID submittedByUserId);

    /**

     * Approve a draft (transition to APPROVED status).

     * 

     * @param draftId the ID of the draft to approve

     * @param action the approval action DTO with optional comment

     * @param approverUserId the ID of the user approving the draft

     * @return the updated draft output DTO

     */
    PolicyDraftOutputDTO approveDraft(UUID draftId, PolicyDraftActionDTO action, UUID approverUserId);

    /**

     * Reject a draft (transition to REJECTED status).

     * 

     * @param draftId the ID of the draft to reject

     * @param action the rejection action DTO with required comment

     * @param rejectorUserId the ID of the user rejecting the draft

     * @return the updated draft output DTO

     */
    PolicyDraftOutputDTO rejectDraft(UUID draftId, PolicyDraftActionDTO action, UUID rejectorUserId);

    /**

     * Request changes to a draft (transition to REQUIRES_CHANGES status).

     * 

     * @param draftId the ID of the draft requiring changes

     * @param action the action DTO with required comment explaining needed changes

     * @param reviewerUserId the ID of the user requesting changes

     * @return the updated draft output DTO

     */
    PolicyDraftOutputDTO requestChanges(UUID draftId, PolicyDraftActionDTO action, UUID reviewerUserId);

    /**

     * Publish an approved draft as an active policy.

     * 

     * @param draftId the ID of the draft to publish

     * @param action the publish action DTO with optional metadata

     * @param publisherUserId the ID of the user publishing the draft

     * @return the published policy output DTO

     */
    PolicyOutputDTO publishDraft(UUID draftId, PolicyDraftActionDTO action, UUID publisherUserId);

    /**

     * Archive a draft (transition to ARCHIVED status).

     * 

     * @param draftId the ID of the draft to archive

     * @param action the archive action DTO with optional comment

     * @param archiverUserId the ID of the user archiving the draft

     * @return the updated draft output DTO

     */
    PolicyDraftOutputDTO archiveDraft(UUID draftId, PolicyDraftActionDTO action, UUID archiverUserId);

    /**

     * Add a review comment to a draft.

     * 

     * @param draftId the ID of the draft

     * @param comment the review comment

     * @param reviewerUserId the ID of the reviewer

     * @param reviewerRole the role of the reviewer

     * @return the updated draft output DTO

     */
    PolicyDraftOutputDTO addReviewComment(UUID draftId, String comment, UUID reviewerUserId, String reviewerRole);

    /**

     * Delete a draft (only allowed in CREATED status).

     * 

     * @param draftId the ID of the draft to delete

     * @param deleterUserId the ID of the user deleting the draft

     */
    void deleteDraft(UUID draftId, UUID deleterUserId);

    /**

     * Get available categories for drafts.

     * 

     * @return list of available categories

     */
    List<String> getDraftCategories();

    /**

     * Get available tags used in drafts.

     * 

     * @return list of available tags

     */
    List<String> getDraftTags();

    /**

     * Get draft statistics for dashboard displays.

     * 

     * @return draft statistics grouped by status

     */
    List<Object[]> getDraftStatistics();

    /**

     * Get overdue drafts (target implementation date passed and not published).

     * 

     * @return list of overdue drafts

     */
    List<PolicyDraftOutputDTO> getOverdueDrafts();

    /**

     * Clone an existing policy as a new draft for modification.

     * 

     * @param policyId the ID of the policy to clone

     * @param creatorUserId the ID of the user creating the draft

     * @return the created draft output DTO

     */
    PolicyDraftOutputDTO clonePolicyAsDraft(UUID policyId, UUID creatorUserId);

    /**

     * Create a new version of an existing draft.

     * 

     * @param draftId the ID of the draft to create new version from

     * @param draftInput the updated draft data

     * @param creatorUserId the ID of the user creating the new version

     * @return the new version draft output DTO

     */
    PolicyDraftOutputDTO createDraftVersion(UUID draftId, PolicyDraftInputDTO draftInput, UUID creatorUserId);
}