Skip to content

Commit e9a43c6

Browse files
author
Brian Melton
committed
WIP - Added support for Odata actions bound to entitiy collections -
needs refactor
1 parent 758aef2 commit e9a43c6

File tree

4 files changed

+69
-4
lines changed

4 files changed

+69
-4
lines changed

Templates/Android/generated/BaseEntityCollectionRequestBuilder.java.tt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,37 @@
3030
public <#=ITypeRequestBuilder(c)#> byId(final String id) {
3131
return new <#=TypeRequestBuilder(c)#>(getRequestUrlWithAdditionalSegment(id), getClient(), getOptions());
3232
}
33+
<#
34+
var aa = c.AsOdcmProperty().Projection.Type.AsOdcmClass();
35+
if (aa != null) {
36+
foreach (var method in aa.MethodsAndOverloads()) {
37+
38+
if (!method.IsBoundToCollection) {
39+
continue;
40+
}
41+
42+
var parameterList = MethodParametersSignature(method);
43+
44+
if (parameterList != "") {
45+
parameterList = parameterList.Remove(0, 2);
46+
}
47+
48+
if (method.IsCollection) {
49+
#>
50+
51+
public <#=ITypeCollectionRequestBuilder(method)#> get<#=MethodName(method)#>(<#=parameterList#>) {
52+
return new <#=TypeCollectionRequestBuilder(method)#>(getRequestUrlWithAdditionalSegment("<#=MethodFullName(method)#>"), getClient(), null<#=MethodParametersValues(method)#>);
53+
}
54+
<#
55+
} else {
56+
#>
57+
58+
public <#=ITypeRequestBuilder(method)#> get<#=MethodName(method)#>(<#=parameterList#>) {
59+
return new <#=TypeRequestBuilder(method)#>(getRequestUrlWithAdditionalSegment("<#=MethodFullName(method)#>"), getClient(), null<#=MethodParametersValues(method)#>);
60+
}
61+
<#
62+
}
63+
}
64+
}
65+
#>
3366
}

Templates/Android/generated/BaseEntityRequestBuilder.java.tt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,12 @@ if (c.AsOdcmClass() != null)
100100
}
101101
#>
102102
<#
103-
foreach (var method in c.AsOdcmClass().MethodsAndOverloads())
104-
{
103+
foreach (var method in c.AsOdcmClass().MethodsAndOverloads()) {
104+
105+
if (method.IsBoundToCollection) {
106+
continue;
107+
}
108+
105109
var parameterList = MethodParametersSignature(method);
106110
if (parameterList != "") { parameterList = parameterList.Remove(0, 2); }
107111
#>

Templates/Android/generated/IBaseEntityCollectionRequestBuilder.java.tt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,28 @@
1616
<#=ITypeCollectionRequest(c)#> buildRequest(final List<Option> requestOptions);
1717

1818
<#=ITypeRequestBuilder(c)#> byId(final String id);
19+
20+
<#
21+
var aa = c.AsOdcmProperty().Projection.Type.AsOdcmClass();
22+
if (aa != null)
23+
{
24+
foreach (var method in aa.AsOdcmClass().MethodsAndOverloads()) {
25+
26+
if (!method.IsBoundToCollection) {
27+
continue;
28+
}
29+
30+
var parameterList = MethodParametersSignature(method);
31+
if (parameterList != "") { parameterList = parameterList.Remove(0, 2); }
32+
#>
33+
<# if (method.IsCollection) { #>
34+
35+
<#=ITypeCollectionRequestBuilder(method)#> get<#=MethodName(method)#>(<#=parameterList#>);
36+
<# } else { #>
37+
<#=ITypeRequestBuilder(method)#> get<#=MethodName(method)#>(<#=parameterList#>);
38+
<#
39+
}
40+
}
41+
}
42+
#>
1943
}

Templates/Android/generated/IBaseEntityRequestBuilder.java.tt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,12 @@ if (c.AsOdcmClass() != null)
7272
}
7373
#>
7474
<#
75-
foreach (var method in c.AsOdcmClass().MethodsAndOverloads())
76-
{
75+
foreach (var method in c.AsOdcmClass().MethodsAndOverloads()) {
76+
77+
if (method.IsBoundToCollection) {
78+
continue;
79+
}
80+
7781
var parameterList = MethodParametersSignature(method);
7882
if (parameterList != "") { parameterList = parameterList.Remove(0, 2); }
7983
#>

0 commit comments

Comments
 (0)