Skip to content

Commit 56a5b25

Browse files
committed
- adds support for orderby for java
1 parent 4bef649 commit 56a5b25

10 files changed

+136
-0
lines changed

Templates/Java/requests_extensions/BaseEntityCollectionReferenceRequest.java.tt

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

83+
<# } #>
84+
<# if (c.GetFeatures().CanSort) { #>
85+
/**
86+
* Sets the order by clause for the request
87+
*
88+
* @param value the sort clause
89+
* @return the updated request
90+
*/
91+
public <#=c.ITypeCollectionReferenceRequest()#> orderBy(final String value) {
92+
addQueryOption(new com.microsoft.graph.options.QueryOption("$orderby", value));
93+
return (<#=c.TypeCollectionReferenceRequest()#>)this;
94+
}
95+
8396
<# } #>
8497
<# if (c.GetFeatures().CanSelect) { #>
8598
/**

Templates/Java/requests_extensions/BaseEntityCollectionRequest.java.tt

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

92+
<# } #>
93+
<# if (c.GetFeatures().CanSort) { #>
94+
/**
95+
* Sets the order by clause for the request
96+
*
97+
* @param value the order by clause
98+
* @return the updated request
99+
*/
100+
public <#=c.ITypeCollectionRequest()#> orderBy(final String value) {
101+
addQueryOption(new com.microsoft.graph.options.QueryOption("$orderby", value));
102+
return (<#=c.TypeCollectionRequest()#>)this;
103+
}
104+
92105
<# } #>
93106
<# if (c.GetFeatures().CanSelect) { #>
94107
/**

Templates/Java/requests_extensions/BaseEntityCollectionWithReferencesRequest.java.tt

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

60+
<# } #>
61+
<# if (c.GetFeatures().CanSort) { #>
62+
public <#=c.ITypeCollectionRequest()#> orderBy(final String value) {
63+
addQueryOption(new com.microsoft.graph.options.QueryOption("$orderby", value));
64+
return (<#=c.TypeCollectionRequest()#>)this;
65+
}
66+
6067
<# } #>
6168
<# if (c.GetFeatures().CanSelect) { #>
6269
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
@@ -70,6 +70,18 @@ import <#=importNamespace#>.core.IBaseClient;
7070
return (<#=c.TypeReferenceRequest()#>)this;
7171
}
7272
<# } #>
73+
<# if (c.GetFeatures().CanSort) { #>
74+
/**
75+
* Sets the order by clause for the request
76+
*
77+
* @param value the order by clause
78+
* @return the updated request
79+
*/
80+
public <#=c.ITypeReferenceRequest()#> orderBy(final String value) {
81+
getQueryOptions().add(new com.microsoft.graph.options.QueryOption("$orderby", value));
82+
return (<#=c.TypeReferenceRequest()#>)this;
83+
}
84+
<# } #>
7385
<# if (c.GetFeatures().CanUpdate) { #>
7486
/**
7587
* 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
@@ -111,6 +111,19 @@ import <#=importNamespace#>.http.HttpMethod;
111111
return (<#=c.TypeRequest()#>)this;
112112
}
113113

114+
<# } #>
115+
<# if (c.GetFeatures().CanSort) { #>
116+
/**
117+
* Sets the order by clause for the request
118+
*
119+
* @param value the order by clause
120+
* @return the updated request
121+
*/
122+
public <#=c.ITypeRequest()#> orderBy(final String value) {
123+
getQueryOptions().add(new com.microsoft.graph.options.QueryOption("$orderby", value));
124+
return (<#=c.TypeRequest()#>)this;
125+
}
126+
114127
<# } #>
115128
<# if (c.AsOdcmProperty() != null && c.AsOdcmProperty().IsCollection && c.GetFeatures().CanUseTop) { #>
116129

Templates/Java/requests_extensions/BaseEntityWithReferenceRequest.java.tt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,16 @@ import <#=importNamespace#>.serializer.IJsonBackedObject;
100100
return (<#=c.TypeWithReferencesRequest()#>)this;
101101
}
102102
<# } #>
103+
<# if (c.GetFeatures().CanSort) { #>
104+
/**
105+
* Sets the order by clause for the request
106+
*
107+
* @param value the order by clause
108+
* @return the updated request
109+
*/
110+
public <#=c.ITypeWithReferencesRequest()#> orderBy(final String value) {
111+
getQueryOptions().add(new com.microsoft.graph.options.QueryOption("$orderby", value));
112+
return (<#=c.TypeWithReferencesRequest()#>)this;
113+
}
114+
<# } #>
103115
}

Templates/Java/requests_extensions/BaseMethodBodyRequest.java.tt

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

121+
<# } #>
122+
<# if (c.GetFeatures().CanSort) { #>
123+
/**
124+
* Sets the order by clause for the request
125+
*
126+
* @param value the order by clause
127+
* @return the updated request
128+
*/
129+
public <#=iTypeRequest#> orderBy(final String value) {
130+
getQueryOptions().add(new com.microsoft.graph.options.QueryOption("$orderby", value));
131+
return (<#=typeRequest#>)this;
132+
}
133+
121134
<# } #>
122135
}

Templates/Java/requests_extensions/BaseMethodCollectionRequest.java.tt

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

159+
<# } #>
160+
<# if (c.GetFeatures().CanSort) { #>
161+
/**
162+
* Sets the order by clause for the request
163+
*
164+
* @param value the order by clause
165+
* @return the updated request
166+
*/
167+
public <#=c.ITypeCollectionRequest()#> orderBy(final String value) {
168+
addQueryOption(new com.microsoft.graph.options.QueryOption("$orderby", value));
169+
return (<#=c.ITypeCollectionRequest()#>)this;
170+
}
171+
159172
<# } #>
160173
}

Templates/Java/requests_extensions/BaseMethodRequest.java.tt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,21 @@ if (c.AsOdcmMethod().IsAction()) {
9595
return (<#=c.TypeRequest()#>)this;
9696
}
9797

98+
<#
99+
}
100+
if (c.GetFeatures().CanSort) {
101+
#>
102+
/**
103+
* Sets the order by clause for the request
104+
*
105+
* @param value the order by clause
106+
* @return the updated request
107+
*/
108+
public <#=c.ITypeRequest()#> orderBy(final String value) {
109+
getQueryOptions().add(new com.microsoft.graph.options.QueryOption("$orderby", value));
110+
return (<#=c.TypeRequest()#>)this;
111+
}
112+
98113
<#
99114
}
100115

@@ -256,6 +271,21 @@ if (c.AsOdcmMethod().IsAction()) {
256271
return (<#=c.TypeRequest()#>)this;
257272
}
258273

274+
<#
275+
}
276+
if (c.GetFeatures().CanSort) {
277+
#>
278+
/**
279+
* Sets the order by clause for the request
280+
*
281+
* @param value the order by clause
282+
* @return the updated request
283+
*/
284+
public <#=c.ITypeRequest()#> orderBy(final String value) {
285+
getQueryOptions().add(new com.microsoft.graph.options.QueryOption("$orderby", value));
286+
return (<#=c.TypeRequest()#>)this;
287+
}
288+
259289
<#
260290
}
261291
if (c.AsOdcmProperty() != null && c.AsOdcmProperty().IsCollection && c.GetFeatures().CanUseTop) {

Templates/Java/requests_extensions/IBaseEntityCollectionRequest.java.tt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ import <#=importNamespace#>.http.IHttpRequest;
3939
*/
4040
<#=c.ITypeCollectionRequest()#> filter(final String value);
4141

42+
<# } #>
43+
<# if (c.GetFeatures().CanSort) { #>
44+
/**
45+
* Sets the order by clause for the request
46+
*
47+
* @param value the order by clause
48+
* @return the updated request
49+
*/
50+
<#=c.ITypeCollectionRequest()#> orderBy(final String value);
51+
4252
<# } #>
4353
<# if (c.GetFeatures().CanSelect) { #>
4454
/**

0 commit comments

Comments
 (0)