9
9
import main .model .dto .project .*;
10
10
import main .model .dto .settings .UserDto ;
11
11
12
- import java .util .ArrayList ;
13
12
import java .util .List ;
14
13
import java .util .stream .Collectors ;
15
14
@@ -23,6 +22,7 @@ public class ResultController extends BaseController<TestResultDto> {
23
22
private final StepController stepController ;
24
23
private final StepResultController stepResultController ;
25
24
private final IssueController issueController ;
25
+ private final TestResultAttachmentController testResultAttachmentController ;
26
26
27
27
public ResultController (UserDto user ) {
28
28
super (user );
@@ -35,6 +35,7 @@ public ResultController(UserDto user) {
35
35
stepController = new StepController (user );
36
36
stepResultController = new StepResultController (user );
37
37
issueController = new IssueController (user );
38
+ testResultAttachmentController = new TestResultAttachmentController (user );
38
39
}
39
40
40
41
@ Override
@@ -100,30 +101,6 @@ public List<TestResultStatDto> get(TestResultStatDto template) throws AqualityEx
100
101
}
101
102
}
102
103
103
- public TestResultAttachmentDto create (TestResultAttachmentDto attachment ) throws AqualityException {
104
- if (baseUser .isManager () || baseUser .getProjectUser (attachment .getProject_id ()).isEditor ()) {
105
- return testResultAttachmentDao .create (attachment );
106
- } else {
107
- throw new AqualityPermissionsException ("Account is not allowed to add Test Result Attachment" , baseUser );
108
- }
109
- }
110
-
111
- public List <TestResultAttachmentDto > get (TestResultAttachmentDto testResultAttachment ) throws AqualityException {
112
- if (baseUser .isFromGlobalManagement () || baseUser .getProjectUser (testResultAttachment .getProject_id ()).isViewer ()) {
113
- return testResultAttachmentDao .searchAll (testResultAttachment );
114
- } else {
115
- throw new AqualityPermissionsException ("Account is not allowed to view Test Result Attachment" , baseUser );
116
- }
117
- }
118
-
119
- public boolean delete (TestResultAttachmentDto attachment ) throws AqualityException {
120
- if (baseUser .isManager () || baseUser .getProjectUser (attachment .getProject_id ()).isEditor ()) {
121
- return testResultAttachmentDao .delete (attachment );
122
- } else {
123
- throw new AqualityPermissionsException ("Account is not allowed to delete Test Result Attachment" , baseUser );
124
- }
125
- }
126
-
127
104
private void createPendingStepResults (TestResultDto template ) throws AqualityException {
128
105
Step2TestDto step2TestTemplate = new Step2TestDto ();
129
106
step2TestTemplate .setProject_id (template .getProject_id ());
@@ -156,7 +133,7 @@ private List<TestResultDto> fillResults(List<TestResultDto> results) throws Aqua
156
133
157
134
TestResultAttachmentDto testResultAttachmentTemplate = new TestResultAttachmentDto ();
158
135
testResultAttachmentTemplate .setProject_id (projectId );
159
- List <TestResultAttachmentDto > testResultAttachments = get (testResultAttachmentTemplate );
136
+ List <TestResultAttachmentDto > testResultAttachments = testResultAttachmentController . get (testResultAttachmentTemplate );
160
137
161
138
ProjectUserDto projectUserDto = new ProjectUserDto ();
162
139
projectUserDto .setProject_id (projectId );
0 commit comments