Skip to content

Commit e47cc7c

Browse files
authored
Merge pull request #287 from microsoftgraph/feature/java-filter-fluent
- adds missing fluent method for odata filter
2 parents 70d6cbf + f320610 commit e47cc7c

File tree

64 files changed

+690
-0
lines changed

Some content is hidden

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

64 files changed

+690
-0
lines changed

Templates/Java/requests_extensions/BaseEntityCollectionReferenceRequest.java.tt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,19 @@ import <#=mainNamespace#>.<#=c.GetPackagePrefix()#>.<#=c.TypeName()#>;
6767
return (<#=c.TypeCollectionReferenceRequest()#>)this;
6868
}
6969

70+
<# } #>
71+
<# if (c.GetFeatures().CanFilter) { #>
72+
/**
73+
* Sets the filter clause for the request
74+
*
75+
* @param value the filter clause
76+
* @return the updated request
77+
*/
78+
public <#=c.ITypeCollectionReferenceRequest()#> filter(final String value) {
79+
addQueryOption(new com.microsoft.graph.options.QueryOption("$filter", value));
80+
return (<#=c.TypeCollectionReferenceRequest()#>)this;
81+
}
82+
7083
<# } #>
7184
<# if (c.GetFeatures().CanSelect) { #>
7285
/**

Templates/Java/requests_extensions/BaseEntityCollectionRequest.java.tt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,19 @@ import <#=mainNamespace#>.<#=TypeHelperJava.GetPrefixForRequests()#>.<#=c.TypeCo
7676
return (<#=c.TypeCollectionRequest()#>)this;
7777
}
7878

79+
<# } #>
80+
<# if (c.GetFeatures().CanFilter) { #>
81+
/**
82+
* Sets the filter clause for the request
83+
*
84+
* @param value the filter clause
85+
* @return the updated request
86+
*/
87+
public <#=c.ITypeCollectionRequest()#> filter(final String value) {
88+
addQueryOption(new com.microsoft.graph.options.QueryOption("$filter", value));
89+
return (<#=c.TypeCollectionRequest()#>)this;
90+
}
91+
7992
<# } #>
8093
<# if (c.GetFeatures().CanSelect) { #>
8194
/**

Templates/Java/requests_extensions/BaseEntityCollectionWithReferencesRequest.java.tt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ import <#=importNamespace#>.concurrency.IExecutors;
5050
return (<#=c.TypeCollectionRequest()#>)this;
5151
}
5252

53+
<# } #>
54+
<# if (c.GetFeatures().CanFilter) { #>
55+
public <#=c.ITypeCollectionRequest()#> filter(final String value) {
56+
addQueryOption(new com.microsoft.graph.options.QueryOption("$filter", value));
57+
return (<#=c.TypeCollectionRequest()#>)this;
58+
}
59+
5360
<# } #>
5461
<# if (c.GetFeatures().CanSelect) { #>
5562
public <#=c.ITypeCollectionRequest()#> select(final String value) {

Templates/Java/requests_extensions/BaseEntityReferenceRequest.java.tt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,18 @@ import <#=importNamespace#>.core.IBaseClient;
5858
return (<#=c.TypeReferenceRequest()#>)this;
5959
}
6060
<# } #>
61+
<# if (c.GetFeatures().CanFilter) { #>
62+
/**
63+
* Sets the filter clause for the request
64+
*
65+
* @param value the filter clause
66+
* @return the updated request
67+
*/
68+
public <#=c.ITypeReferenceRequest()#> filter(final String value) {
69+
getQueryOptions().add(new com.microsoft.graph.options.QueryOption("$filter", value));
70+
return (<#=c.TypeReferenceRequest()#>)this;
71+
}
72+
<# } #>
6173
<# if (c.GetFeatures().CanUpdate) { #>
6274
/**
6375
* Puts the <#=c.TypeName()#>

Templates/Java/requests_extensions/BaseEntityRequest.java.tt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,19 @@ import <#=importNamespace#>.http.HttpMethod;
9898
return (<#=c.TypeRequest()#>)this;
9999
}
100100

101+
<# } #>
102+
<# if (c.GetFeatures().CanFilter) { #>
103+
/**
104+
* Sets the filter clause for the request
105+
*
106+
* @param value the filter clause
107+
* @return the updated request
108+
*/
109+
public <#=c.ITypeRequest()#> filter(final String value) {
110+
getQueryOptions().add(new com.microsoft.graph.options.QueryOption("$filter", value));
111+
return (<#=c.TypeRequest()#>)this;
112+
}
113+
101114
<# } #>
102115
<# if (c.AsOdcmProperty() != null && c.AsOdcmProperty().IsCollection && c.GetFeatures().CanUseTop) { #>
103116

Templates/Java/requests_extensions/BaseEntityWithReferenceRequest.java.tt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,16 @@ import <#=importNamespace#>.serializer.IJsonBackedObject;
8888
return (<#=c.TypeWithReferencesRequest()#>)this;
8989
}
9090
<# } #>
91+
<# if (c.GetFeatures().CanFilter) { #>
92+
/**
93+
* Sets the filter clause for the request
94+
*
95+
* @param value the filter clause
96+
* @return the updated request
97+
*/
98+
public <#=c.ITypeWithReferencesRequest()#> filter(final String value) {
99+
getQueryOptions().add(new com.microsoft.graph.options.QueryOption("$filter", value));
100+
return (<#=c.TypeWithReferencesRequest()#>)this;
101+
}
102+
<# } #>
91103
}

Templates/Java/requests_extensions/BaseMethodBodyRequest.java.tt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,18 @@ import <#=importNamespace#>.http.HttpMethod;
105105
return (<#=typeRequest#>)this;
106106
}
107107

108+
<# } #>
109+
<# if (c.GetFeatures().CanFilter) { #>
110+
/**
111+
* Sets the filter clause for the request
112+
*
113+
* @param value the filter clause
114+
* @return the updated request
115+
*/
116+
public <#=iTypeRequest#> filter(final String value) {
117+
getQueryOptions().add(new com.microsoft.graph.options.QueryOption("$filter", value));
118+
return (<#=typeRequest#>)this;
119+
}
120+
108121
<# } #>
109122
}

Templates/Java/requests_extensions/BaseMethodCollectionRequest.java.tt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,5 +143,18 @@ import <#=importNamespace#>.concurrency.IExecutors;
143143
return (<#=c.ITypeCollectionRequest()#>)this;
144144
}
145145

146+
<# } #>
147+
<# if (c.GetFeatures().CanFilter) { #>
148+
/**
149+
* Sets the filter clause for the request
150+
*
151+
* @param value the filter clause
152+
* @return the updated request
153+
*/
154+
public <#=c.ITypeCollectionRequest()#> filter(final String value) {
155+
addQueryOption(new com.microsoft.graph.options.QueryOption("$filter", value));
156+
return (<#=c.ITypeCollectionRequest()#>)this;
157+
}
158+
146159
<# } #>
147160
}

Templates/Java/requests_extensions/BaseMethodRequest.java.tt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,22 @@ if (c.AsOdcmMethod().IsAction()) {
7979
return (<#=c.TypeRequest()#>)this;
8080
}
8181

82+
<#
83+
}
84+
85+
if (c.GetFeatures().CanFilter) {
86+
#>
87+
/**
88+
* Sets the filter clause for the request
89+
*
90+
* @param value the filter clause
91+
* @return the updated request
92+
*/
93+
public <#=c.ITypeRequest()#> filter(final String value) {
94+
getQueryOptions().add(new com.microsoft.graph.options.QueryOption("$filter", value));
95+
return (<#=c.TypeRequest()#>)this;
96+
}
97+
8298
<#
8399
}
84100

@@ -227,7 +243,21 @@ if (c.AsOdcmMethod().IsAction()) {
227243

228244
<#
229245
}
246+
if (c.GetFeatures().CanFilter) {
247+
#>
248+
/**
249+
* Sets the filter clause for the request
250+
*
251+
* @param value the filter clause
252+
* @return the updated request
253+
*/
254+
public <#=c.ITypeRequest()#> filter(final String value) {
255+
getQueryOptions().add(new com.microsoft.graph.options.QueryOption("$filter", value));
256+
return (<#=c.TypeRequest()#>)this;
257+
}
230258

259+
<#
260+
}
231261
if (c.AsOdcmProperty() != null && c.AsOdcmProperty().IsCollection && c.GetFeatures().CanUseTop) {
232262
#>
233263

Templates/Java/requests_extensions/IBaseEntityCollectionRequest.java.tt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ import <#=importNamespace#>.http.IBaseCollectionPage;
2828
*/
2929
<#=c.ITypeCollectionRequest()#> expand(final String value);
3030

31+
<# } #>
32+
<# if (c.GetFeatures().CanFilter) { #>
33+
/**
34+
* Sets the filter clause for the request
35+
*
36+
* @param value the filter clause
37+
* @return the updated request
38+
*/
39+
<#=c.ITypeCollectionRequest()#> filter(final String value);
40+
3141
<# } #>
3242
<# if (c.GetFeatures().CanSelect) { #>
3343
/**

0 commit comments

Comments
 (0)