File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ public TestDto create(TestDto template) throws AqualityException {
46
46
}
47
47
48
48
public List <TestDto > get (TestDto template , boolean withChildren ) throws AqualityException {
49
- if (baseUser .isFromGlobalManagement () || baseUser .getProjectUserByTestId (template . getId () ).isViewer ()){
49
+ if (baseUser .isFromGlobalManagement () || baseUser .getProjectUserByTest (template ).isViewer ()){
50
50
return fillTests (testDao .searchAll (template ), withChildren );
51
51
}else {
52
52
throw new AqualityPermissionsException ("Account is not allowed to view Tests" , baseUser );
Original file line number Diff line number Diff line change @@ -109,12 +109,17 @@ public ProjectUserDto getProjectUserBySuiteId(Integer suite_id) throws AqualityE
109
109
return getProjectUser (template .getProject_id ());
110
110
}
111
111
112
- public ProjectUserDto getProjectUserByTestId (Integer test_id ) throws AqualityException {
113
- TestDao testDao = new TestDao ();
114
- TestDto template = new TestDto ();
115
- template .setId (test_id );
116
- template = testDao .searchAll (template ).get (0 );
117
- return getProjectUser (template .getProject_id ());
112
+ public ProjectUserDto getProjectUserByTest (TestDto testDto ) throws AqualityException {
113
+ if (testDto .getProject_id () != null ){
114
+ return getProjectUser (testDto .getProject_id ());
115
+ }
116
+
117
+ try {
118
+ TestDao testDao = new TestDao ();
119
+ return getProjectUser (testDao .searchAll (testDto ).get (0 ).getProject_id ());
120
+ }catch (IndexOutOfBoundsException e ){
121
+ throw new AqualityException ("Cannot define project id" );
122
+ }
118
123
}
119
124
120
125
public ProjectUserDto getProjectUserByMilestoneId (Integer milestone_id ) throws AqualityException {
You can’t perform that action at this time.
0 commit comments