Skip to content

Commit 3451bbf

Browse files
wog48GitHub Enterprise
authored andcommitted
Defect/issue 455 (#370)
* IN operator at navigation properties * Update dependency * Fix sonar issue
1 parent ef82051 commit 3451bbf

File tree

4 files changed

+156
-112
lines changed

4 files changed

+156
-112
lines changed

jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/filter/JPAAbstractNavigationOperation.java

Lines changed: 2 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,6 @@
1616
import org.apache.olingo.server.api.uri.UriResource;
1717
import org.apache.olingo.server.api.uri.UriResourceKind;
1818
import org.apache.olingo.server.api.uri.UriResourceProperty;
19-
import org.apache.olingo.server.api.uri.queryoption.ApplyOption;
20-
import org.apache.olingo.server.api.uri.queryoption.CountOption;
21-
import org.apache.olingo.server.api.uri.queryoption.CustomQueryOption;
22-
import org.apache.olingo.server.api.uri.queryoption.DeltaTokenOption;
23-
import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
24-
import org.apache.olingo.server.api.uri.queryoption.FilterOption;
25-
import org.apache.olingo.server.api.uri.queryoption.FormatOption;
26-
import org.apache.olingo.server.api.uri.queryoption.IdOption;
27-
import org.apache.olingo.server.api.uri.queryoption.OrderByOption;
28-
import org.apache.olingo.server.api.uri.queryoption.SearchOption;
29-
import org.apache.olingo.server.api.uri.queryoption.SelectOption;
30-
import org.apache.olingo.server.api.uri.queryoption.SkipOption;
31-
import org.apache.olingo.server.api.uri.queryoption.SkipTokenOption;
32-
import org.apache.olingo.server.api.uri.queryoption.TopOption;
3319
import org.apache.olingo.server.api.uri.queryoption.expression.BinaryOperatorKind;
3420
import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitor;
3521
import org.apache.olingo.server.api.uri.queryoption.expression.Member;
@@ -41,6 +27,7 @@
4127
import com.sap.olingo.jpa.processor.core.query.ExpressionUtility;
4228
import com.sap.olingo.jpa.processor.core.query.JPAAbstractQuery;
4329
import com.sap.olingo.jpa.processor.core.query.JPAAbstractSubQuery;
30+
import com.sap.olingo.jpa.processor.core.query.JPAExpandItem;
4431
import com.sap.olingo.jpa.processor.core.query.JPANavigationFilterQueryBuilder;
4532
import com.sap.olingo.jpa.processor.core.query.JPANavigationPropertyInfo;
4633
import com.sap.olingo.jpa.processor.core.query.JPANavigationPropertyInfoAccess;
@@ -179,84 +166,14 @@ public boolean isCollection() {
179166

180167
}
181168

182-
private static class SubResource implements UriInfoResource {
169+
private static class SubResource implements JPAExpandItem {
183170
private final JPAMemberOperator parentMember;
184171

185172
public SubResource(final JPAMemberOperator member) {
186173
super();
187174
this.parentMember = member;
188175
}
189176

190-
@Override
191-
public ApplyOption getApplyOption() {
192-
return null;
193-
}
194-
195-
@Override
196-
public CountOption getCountOption() {
197-
return null;
198-
}
199-
200-
@Override
201-
public List<CustomQueryOption> getCustomQueryOptions() {
202-
return new ArrayList<>(0);
203-
}
204-
205-
@Override
206-
public DeltaTokenOption getDeltaTokenOption() {
207-
return null;
208-
}
209-
210-
@Override
211-
public ExpandOption getExpandOption() {
212-
return null;
213-
}
214-
215-
@Override
216-
public FilterOption getFilterOption() {
217-
return null;
218-
}
219-
220-
@Override
221-
public FormatOption getFormatOption() {
222-
return null;
223-
}
224-
225-
@Override
226-
public IdOption getIdOption() {
227-
return null;
228-
}
229-
230-
@Override
231-
public OrderByOption getOrderByOption() {
232-
return null;
233-
}
234-
235-
@Override
236-
public SearchOption getSearchOption() {
237-
return null;
238-
}
239-
240-
@Override
241-
public SelectOption getSelectOption() {
242-
return null;
243-
}
244-
245-
@Override
246-
public SkipOption getSkipOption() {
247-
return null;
248-
}
249-
250-
@Override
251-
public SkipTokenOption getSkipTokenOption() {
252-
return null;
253-
}
254-
255-
@Override
256-
public TopOption getTopOption() {
257-
return null;
258-
}
259-
260177
@Override
261178
public List<UriResource> getUriResourceParts() {
262179
final List<UriResource> result = new ArrayList<>();
@@ -277,7 +194,6 @@ public List<UriResource> getUriResourceParts() {
277194
public String getValueForAlias(final String alias) {
278195
return null;
279196
}
280-
281197
}
282198

283199
}

jpa/odata-jpa-processor/src/main/java/com/sap/olingo/jpa/processor/core/query/JPACollectionExpandWrapper.java

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import org.apache.olingo.server.api.uri.UriInfoResource;
88
import org.apache.olingo.server.api.uri.UriResource;
9-
import org.apache.olingo.server.api.uri.queryoption.ApplyOption;
109
import org.apache.olingo.server.api.uri.queryoption.CountOption;
1110
import org.apache.olingo.server.api.uri.queryoption.CustomQueryOption;
1211
import org.apache.olingo.server.api.uri.queryoption.DeltaTokenOption;
@@ -18,10 +17,7 @@
1817
import org.apache.olingo.server.api.uri.queryoption.SearchOption;
1918
import org.apache.olingo.server.api.uri.queryoption.SelectItem;
2019
import org.apache.olingo.server.api.uri.queryoption.SelectOption;
21-
import org.apache.olingo.server.api.uri.queryoption.SkipOption;
22-
import org.apache.olingo.server.api.uri.queryoption.SkipTokenOption;
2320
import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind;
24-
import org.apache.olingo.server.api.uri.queryoption.TopOption;
2521

2622
import com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAAssociationPath;
2723
import com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPACollectionAttribute;
@@ -97,26 +93,6 @@ public SelectOption getSelectOption() {
9793
return selectOption;
9894
}
9995

100-
@Override
101-
public SkipOption getSkipOption() {
102-
return null;
103-
}
104-
105-
@Override
106-
public SkipTokenOption getSkipTokenOption() {
107-
return null;
108-
}
109-
110-
@Override
111-
public TopOption getTopOption() {
112-
return null;
113-
}
114-
115-
@Override
116-
public ApplyOption getApplyOption() {
117-
return null;
118-
}
119-
12096
@Override
12197
public List<UriResource> getUriResourceParts() {
12298
return uriInfo.getUriResourceParts();
Lines changed: 92 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,106 @@
11
package com.sap.olingo.jpa.processor.core.query;
22

3+
import java.util.ArrayList;
4+
import java.util.List;
35
import java.util.Optional;
46

57
import org.apache.olingo.server.api.uri.UriInfoResource;
8+
import org.apache.olingo.server.api.uri.queryoption.ApplyOption;
9+
import org.apache.olingo.server.api.uri.queryoption.CountOption;
10+
import org.apache.olingo.server.api.uri.queryoption.CustomQueryOption;
11+
import org.apache.olingo.server.api.uri.queryoption.DeltaTokenOption;
12+
import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
13+
import org.apache.olingo.server.api.uri.queryoption.FilterOption;
14+
import org.apache.olingo.server.api.uri.queryoption.FormatOption;
15+
import org.apache.olingo.server.api.uri.queryoption.IdOption;
16+
import org.apache.olingo.server.api.uri.queryoption.OrderByOption;
17+
import org.apache.olingo.server.api.uri.queryoption.SearchOption;
18+
import org.apache.olingo.server.api.uri.queryoption.SelectOption;
19+
import org.apache.olingo.server.api.uri.queryoption.SkipOption;
20+
import org.apache.olingo.server.api.uri.queryoption.SkipTokenOption;
21+
import org.apache.olingo.server.api.uri.queryoption.TopOption;
622

723
import com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAEntityType;
824
import com.sap.olingo.jpa.processor.core.api.JPAODataSkipTokenProvider;
925

1026
public interface JPAExpandItem extends UriInfoResource {
1127

12-
JPAEntityType getEntityType();
28+
@Override
29+
default ApplyOption getApplyOption() {
30+
return null;
31+
}
1332

14-
Optional<JPAODataSkipTokenProvider> getSkipTokenProvider();
33+
@Override
34+
default CountOption getCountOption() {
35+
return null;
36+
}
37+
38+
@Override
39+
default List<CustomQueryOption> getCustomQueryOptions() {
40+
return new ArrayList<>(0);
41+
}
42+
43+
@Override
44+
default DeltaTokenOption getDeltaTokenOption() {
45+
return null;
46+
}
47+
48+
@Override
49+
default ExpandOption getExpandOption() {
50+
return null;
51+
}
52+
53+
@Override
54+
default FilterOption getFilterOption() {
55+
return null;
56+
}
57+
58+
@Override
59+
default FormatOption getFormatOption() {
60+
return null;
61+
}
62+
63+
@Override
64+
default IdOption getIdOption() {
65+
return null;
66+
}
67+
68+
@Override
69+
default OrderByOption getOrderByOption() {
70+
return null;
71+
}
72+
73+
@Override
74+
default SearchOption getSearchOption() {
75+
return null;
76+
}
77+
78+
@Override
79+
default SelectOption getSelectOption() {
80+
return null;
81+
}
82+
83+
@Override
84+
default SkipOption getSkipOption() {
85+
return null;
86+
}
87+
88+
@Override
89+
default SkipTokenOption getSkipTokenOption() {
90+
return null;
91+
}
92+
93+
@Override
94+
default TopOption getTopOption() {
95+
return null;
96+
}
97+
98+
default JPAEntityType getEntityType() {
99+
return null;
100+
}
101+
102+
default Optional<JPAODataSkipTokenProvider> getSkipTokenProvider() {
103+
return Optional.empty();
104+
}
15105

16106
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
package com.sap.olingo.jpa.processor.core.query;
2+
3+
import static org.junit.jupiter.api.Assertions.assertNull;
4+
import static org.junit.jupiter.api.Assertions.assertTrue;
5+
6+
import java.util.List;
7+
8+
import org.apache.olingo.server.api.uri.UriResource;
9+
import org.junit.jupiter.api.BeforeEach;
10+
import org.junit.jupiter.api.Test;
11+
12+
class JPAExpandItemTest {
13+
14+
private JPAExpandItem cut;
15+
16+
@BeforeEach
17+
void setup() {
18+
cut = new JPAExpandItemImpl();
19+
}
20+
21+
@Test
22+
void testDefaultReturnsNull() {
23+
assertNull(cut.getApplyOption());
24+
assertNull(cut.getCountOption());
25+
assertNull(cut.getDeltaTokenOption());
26+
assertNull(cut.getExpandOption());
27+
assertNull(cut.getFilterOption());
28+
assertNull(cut.getFormatOption());
29+
assertNull(cut.getIdOption());
30+
assertNull(cut.getOrderByOption());
31+
assertNull(cut.getSearchOption());
32+
assertNull(cut.getSkipOption());
33+
assertNull(cut.getSkipTokenOption());
34+
assertNull(cut.getTopOption());
35+
assertNull(cut.getEntityType());
36+
}
37+
38+
@Test
39+
void testDefaultReturnsEmptyList() {
40+
assertTrue(cut.getCustomQueryOptions().isEmpty());
41+
}
42+
43+
@Test
44+
void testDefaultReturnsEmptyOption() {
45+
assertTrue(cut.getSkipTokenProvider().isEmpty());
46+
}
47+
48+
private static class JPAExpandItemImpl implements JPAExpandItem {
49+
50+
@Override
51+
public List<UriResource> getUriResourceParts() {
52+
return List.of();
53+
}
54+
55+
@Override
56+
public String getValueForAlias(final String alias) {
57+
return null;
58+
}
59+
60+
}
61+
62+
}

0 commit comments

Comments
 (0)