Skip to content

Commit

Permalink
- fixes an issue where a lot of generated java code would be missing …
Browse files Browse the repository at this point in the history
…imports
  • Loading branch information
baywet committed Aug 25, 2020
1 parent 0b005bc commit 8dfd3b2
Show file tree
Hide file tree
Showing 34 changed files with 254 additions and 7 deletions.
4 changes: 3 additions & 1 deletion Templates/Java/models_extensions/BaseEntity.java.tt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@

import com.google.gson.JsonObject;
import com.google.gson.JsonElement;
import com.google.gson.annotations.*;
import com.google.gson.annotations.SerializedName;
import com.google.gson.annotations.Expose;
import java.util.HashMap;
import java.util.Map;
import com.microsoft.graph.serializer.AdditionalDataManager;

<#=CreateClassDef(TypeName(c), BaseClassName(c), "IJsonBackedObject")#>

Expand Down
9 changes: 8 additions & 1 deletion Templates/Java/models_extensions/BaseMethodBody.java.tt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@
<#host.TemplateName = TypeBody(c);#>
<#=writer.WriteHeader()#>
<#=CreatePackageDefinition(host)#>
import com.microsoft.graph.models.generated.*;
<#
var parameterList = MethodParametersImports(c.AsOdcmMethod());
if (parameterList != "") {
#>
<#=parameterList#>
<#
}
#>
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.google.gson.JsonObject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
<#=writer.WriteHeader()#>
<#=CreatePackageDefForBaseEntityCollectionPage(host)#>
import com.microsoft.graph.http.BaseCollectionPage;
import com.microsoft.graph.requests.extensions.<#=ITypeCollectionRequestBuilder(c)#>;
import com.microsoft.graph.requests.extensions.<#=TypeCollectionPage(c)#>;
import com.microsoft.graph.requests.extensions.<#=TypeCollectionResponse(c)#>;
import com.microsoft.graph.models.extensions.<#=TypeName(c)#>;

<#=CreateClassDef(TypeCollectionPage(c), "BaseCollectionPage" + CollectionPageGeneric(c), ITypeCollectionPage(c))#>
<#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
<#=writer.WriteHeader()#>
<#=CreatePackageDef(host)#>

import com.microsoft.graph.core.ClientException;
import com.microsoft.graph.options.QueryOption;
import com.microsoft.graph.options.Option;
import com.microsoft.graph.core.IBaseClient;
import com.microsoft.graph.http.BaseCollectionRequest;
import com.microsoft.graph.http.ReferenceRequestBody;
import com.microsoft.graph.models.extensions.<#=TypeName(c)#>;
import com.microsoft.graph.concurrency.ICallback;

<#=CreateClassDef(TypeCollectionReferenceRequest(c), "BaseCollectionRequest" + CollectionRequestGeneric(c), ITypeCollectionReferenceRequest(c))#>

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
<#=writer.WriteHeader()#>
<#=CreatePackageDef(host)#>

import com.microsoft.graph.options.Option;
import com.microsoft.graph.http.BaseRequestBuilder;
import com.microsoft.graph.core.IBaseClient;

<#=CreateClassDef(TypeCollectionReferenceRequestBuilder(c), "BaseRequestBuilder", ITypeCollectionReferenceRequestBuilder(c))#>

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@
<#=writer.WriteHeader()#>
<#=CreatePackageDef(host)#>

import com.microsoft.graph.core.ClientException;
import com.microsoft.graph.options.Option;
import com.microsoft.graph.options.QueryOption;
import com.microsoft.graph.core.IBaseClient;
import com.microsoft.graph.http.BaseCollectionRequest;
import com.microsoft.graph.concurrency.ICallback;
import com.microsoft.graph.concurrency.IExecutors;
import com.microsoft.graph.models.extensions.<#=TypeName(c)#>;
import com.microsoft.graph.requests.extensions.<#=ITypeCollectionPage(c)#>;
import com.microsoft.graph.requests.extensions.<#=TypeCollectionResponse(c)#>;
import com.microsoft.graph.requests.extensions.<#=ITypeCollectionRequestBuilder(c)#>;
import com.microsoft.graph.requests.extensions.<#=ITypeCollectionRequest(c)#>;
import com.microsoft.graph.requests.extensions.<#=TypeCollectionPage(c)#>;

<#=CreateClassDef(TypeCollectionRequest(c), "BaseCollectionRequest" + CollectionRequestGeneric(c), ITypeCollectionRequest(c))#>

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,42 @@
<#=writer.WriteHeader()#>
<#=CreatePackageDef(host)#>

import com.microsoft.graph.requests.extensions.<#=ITypeCollectionRequestBuilder(c)#>;
import com.microsoft.graph.requests.extensions.<#=ITypeRequestBuilder(c)#>;
import com.microsoft.graph.requests.extensions.<#=ITypeCollectionRequest(c)#>;
<#
var currentTypeProjection = c.AsOdcmProperty().Projection.Type.AsOdcmClass();
if (currentTypeProjection != null) {
foreach (var method in currentTypeProjection.MethodsAndOverloads()) {
if (!method.IsBoundToCollection) {
continue;
}

var parameterList = MethodParametersImports(method);
if (parameterList != "") {
#>
<#=parameterList#>
<#
}
if (method.IsCollection) {
#>
import com.microsoft.graph.requests.extensions.<#=ITypeCollectionRequestBuilder(method)#>;
<#
} else {
#>
import com.microsoft.graph.requests.extensions.<#=ITypeRequestBuilder(method)#>;
<#
}
}
}
#>
<# if (ShouldIncludeCollectionTypeReference(c)) { #>
import com.microsoft.graph.models.extensions.<#=TargetCollectionType(c)#>;
<# } #>
import com.microsoft.graph.options.Option;
import com.microsoft.graph.http.BaseRequestBuilder;
import com.microsoft.graph.core.IBaseClient;

<#=CreateClassDef(TypeCollectionRequestBuilder(c), "BaseRequestBuilder", ITypeCollectionRequestBuilder(c))#>

/**
Expand Down Expand Up @@ -40,7 +76,6 @@
<# } #>

<#
var currentTypeProjection = c.AsOdcmProperty().Projection.Type.AsOdcmClass();
if (currentTypeProjection != null) {
foreach (var method in currentTypeProjection.MethodsAndOverloads()) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import com.google.gson.annotations.SerializedName;
import com.microsoft.graph.serializer.AdditionalDataManager;
import com.microsoft.graph.serializer.IJsonBackedObject;
import com.microsoft.graph.serializer.ISerializer;
import com.microsoft.graph.models.extensions.<#=TypeName(c)#>;

<#=CreateClassDef(TypeCollectionResponse(c), null, "IJsonBackedObject")#>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@
<#=writer.WriteHeader()#>
<#=CreatePackageDef(host)#>

import com.microsoft.graph.requests.extensions.<#=ITypeCollectionRequestBuilder(c)#>;
import com.microsoft.graph.requests.extensions.<#=ITypeCollectionWithReferencesPage(c)#>;
import com.microsoft.graph.requests.extensions.<#=TypeCollectionResponse(c)#>;
import com.microsoft.graph.models.extensions.<#=TypeName(c)#>;
import com.google.gson.JsonObject;
import com.google.gson.annotations.*;
import com.google.gson.annotations.SerializedName;
import com.google.gson.annotations.Expose;
import com.microsoft.graph.http.BaseCollectionPage;

<#=CreateClassDef(TypeCollectionWithReferencesPage(c), "BaseCollectionPage" + CollectionPageWithReferencesGeneric(c), ITypeCollectionWithReferencesPage(c))#>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
<#=writer.WriteHeader()#>
<#=CreatePackageDef(host)#>

import com.microsoft.graph.core.ClientException;
import com.microsoft.graph.options.QueryOption;
import com.microsoft.graph.options.Option;
import com.microsoft.graph.core.IBaseClient;
import com.microsoft.graph.http.BaseCollectionRequest;
import com.microsoft.graph.concurrency.ICallback;
import com.microsoft.graph.concurrency.IExecutors;

<#=CreateClassDef(TypeCollectionWithReferencesRequest(c), "BaseCollectionRequest" + CollectionRequestGeneric(c), ITypeCollectionWithReferencesRequest(c))#>

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
<#=writer.WriteHeader()#>
<#=CreatePackageDef(host)#>

import com.microsoft.graph.options.Option;
import com.microsoft.graph.http.BaseRequestBuilder;
import com.microsoft.graph.core.IBaseClient;

<#=CreateClassDef(TypeCollectionWithReferencesRequestBuilder(c), "BaseRequestBuilder", ITypeCollectionWithReferencesRequestBuilder(c))#>

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
<#=writer.WriteHeader()#>
<#=CreatePackageDef(host)#>

import com.microsoft.graph.core.ClientException;
import com.microsoft.graph.options.QueryOption;
import com.microsoft.graph.options.Option;
import com.microsoft.graph.http.BaseRequest;
import com.microsoft.graph.http.HttpMethod;
import com.microsoft.graph.core.IBaseClient;
import com.microsoft.graph.models.extensions.<#=TypeName(c)#>;
import com.microsoft.graph.concurrency.ICallback;

<#=CreateClassDef(TypeReferenceRequest(c), "BaseRequest", ITypeReferenceRequest(c))#>

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
<#=writer.WriteHeader()#>
<#=CreatePackageDef(host)#>

import com.microsoft.graph.options.Option;
import com.microsoft.graph.http.BaseRequestBuilder;
import com.microsoft.graph.core.IBaseClient;

<#=CreateClassDef(TypeReferenceRequestBuilder(c), "BaseRequestBuilder", ITypeReferenceRequestBuilder(c))#>

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
<#=writer.WriteHeader()#>
<#=CreatePackageDef(host)#>

import com.microsoft.graph.concurrency.ICallback;
import com.microsoft.graph.core.ClientException;
import com.microsoft.graph.options.QueryOption;
import com.microsoft.graph.options.Option;
import com.microsoft.graph.http.BaseRequest;
import com.microsoft.graph.http.HttpMethod;
import com.microsoft.graph.core.IBaseClient;
import com.microsoft.graph.serializer.IJsonBackedObject;
import com.microsoft.graph.models.extensions.<#=TypeName(c)#>;

<#=CreateClassDef(TypeWithReferencesRequest(c), "BaseRequest", ITypeWithReferencesRequest(c))#>

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
<#=writer.WriteHeader()#>
<#=CreatePackageDef(host)#>

import com.microsoft.graph.options.Option;
import com.microsoft.graph.http.BaseRequestBuilder;
import com.microsoft.graph.core.IBaseClient;

<#=CreateClassDef(TypeWithReferencesRequestBuilder(c), "BaseRequestBuilder", ITypeWithReferencesRequestBuilder(c))#>

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
<#host.TemplateName = baseTypeRequest;#>
<#=writer.WriteHeader()#>
<#=CreatePackageDefForBaseMethodBodyRequest(host)#>
import com.microsoft.graph.http.BaseCollectionRequest;
import com.microsoft.graph.http.BaseRequest;
import com.microsoft.graph.http.HttpMethod;
import com.microsoft.graph.concurrency.ICallback;
import com.microsoft.graph.core.ClientException;
import com.microsoft.graph.core.IBaseClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,27 @@
<#host.TemplateName = TypeCollectionRequestBuilder(c);#>
<#=writer.WriteHeader()#>
<#=CreatePackageDef(host)#>

import com.microsoft.graph.requests.extensions.<#=ITypeCollectionRequestBuilder(c)#>;
import com.microsoft.graph.requests.extensions.<#=ITypeCollectionRequest(c)#>;
import com.microsoft.graph.requests.extensions.<#=TypeCollectionRequest(c)#>;
<# if (ShouldIncludeCollectionTypeReference(c)) { #>
import com.microsoft.graph.models.<#=OdcmMethodReturnNamespaceSection(c as OdcmMethod)#>.<#=OdcmMethodReturnType(c as OdcmMethod)#>;
<# } #>
<# foreach (var method in c.AsOdcmMethod().WithOverloads()) {
var parameterList = MethodParametersImports(method);
if (parameterList != "") {
#>
<#=parameterList#>
<#
}
}
#>
import com.microsoft.graph.options.Option;
import com.microsoft.graph.options.FunctionOption;
import com.microsoft.graph.core.IBaseClient;
import com.microsoft.graph.core.<#=RequestBuilderSuperClass(c) #>;

<# bool isAction = !c.AsOdcmMethod().IsFunction; #>
<#=CreateClassDef(TypeCollectionRequestBuilder(c), RequestBuilderSuperClass(c), ITypeCollectionRequestBuilder(c))#>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@

import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.annotations.*;
import com.google.gson.annotations.SerializedName;
import com.google.gson.annotations.Expose;
import com.microsoft.graph.serializer.IJsonBackedObject;
import com.microsoft.graph.serializer.ISerializer;
import com.microsoft.graph.serializer.AdditionalDataManager;
<# if (ShouldIncludeCollectionTypeReference(c)) { #>
import com.microsoft.graph.models.<#=OdcmMethodReturnNamespaceSection(c as OdcmMethod)#>.<#=OdcmMethodReturnType(c as OdcmMethod)#>;
<# } #>

<#=CreateClassDef(TypeCollectionResponse(c), null, "IJsonBackedObject")#>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
<#=CreatePackageDef(host)#>

import com.google.gson.JsonObject;
import com.microsoft.graph.requests.extensions.<#=ITypeCollectionRequestBuilder(c)#>;
<# if (ShouldIncludeCollectionTypeReference(c)) { #>
import com.microsoft.graph.models.extensions.<#=TargetCollectionType(c)#>;
<# } #>
import com.microsoft.graph.http.IBaseCollectionPage;

<#=CreateInterfaceDef(ITypeCollectionPage(c), "IBaseCollectionPage" + CollectionPageGeneric(c))#>
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
<#=writer.WriteHeader()#>
<#=CreatePackageDef(host)#>

import com.microsoft.graph.options.Option;
import com.microsoft.graph.http.IHttpRequest;
import com.microsoft.graph.models.extensions.<#=TypeName(c)#>;

import com.microsoft.graph.core.ClientException;
import com.microsoft.graph.concurrency.ICallback;

<#=CreateInterfaceDef(ITypeCollectionReferenceRequest(c))#>

void post(final <#=TypeName(c)#> new<#=TypeName(c)#>, final ICallback<<#=TypeName(c)#>> callback);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
<#=writer.WriteHeader()#>
<#=CreatePackageDef(host)#>

import com.microsoft.graph.options.Option;

<#=CreateInterfaceDef(ITypeCollectionReferenceRequestBuilder(c), "IRequestBuilder")#>

<#=ITypeCollectionReferenceRequest(c)#> buildRequest();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
<#=writer.WriteHeader()#>
<#=CreatePackageDef(host)#>

import com.microsoft.graph.models.extensions.<#=TypeName(c)#>;
import com.microsoft.graph.core.ClientException;
import com.microsoft.graph.concurrency.ICallback;
import com.microsoft.graph.http.IBaseCollectionPage;

<#=CreateInterfaceDef(ITypeCollectionRequest(c))#>

void get(final ICallback<<#=ITypeCollectionPage(c)#>> callback);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,41 @@
<#=writer.WriteHeader()#>
<#=CreatePackageDef(host)#>

import com.microsoft.graph.requests.extensions.<#=ITypeRequestBuilder(c)#>;
import com.microsoft.graph.requests.extensions.<#=ITypeCollectionRequest(c)#>;
<#
var currentTypeProjection = c.AsOdcmProperty().Projection.Type.AsOdcmClass();
if (currentTypeProjection != null) {
foreach (var method in currentTypeProjection.MethodsAndOverloads()) {
if (!method.IsBoundToCollection) {
continue;
}

var parameterList = MethodParametersImports(method);
if (parameterList != "") {
#>
<#=parameterList#>
<#
}
if (method.IsCollection) {
#>
import com.microsoft.graph.requests.extensions.<#=ITypeCollectionRequestBuilder(method)#>;
<#
} else {
#>
import com.microsoft.graph.requests.extensions.<#=ITypeRequestBuilder(method)#>;
<#
}
}
}
#>
<# if (ShouldIncludeCollectionTypeReference(c)) { #>
import com.microsoft.graph.models.extensions.<#=TargetCollectionType(c)#>;
<# } #>
import com.microsoft.graph.options.Option;
import com.microsoft.graph.http.IBaseCollectionPage;
import com.microsoft.graph.concurrency.ICallback;

<#=CreateInterfaceDef(ITypeCollectionRequestBuilder(c), "IRequestBuilder")#>

<#=ITypeCollectionRequest(c)#> buildRequest();
Expand All @@ -18,7 +53,6 @@
<#=ITypeRequestBuilder(c)#> byId(final String id);

<#
var currentTypeProjection = c.AsOdcmProperty().Projection.Type.AsOdcmClass();
if (currentTypeProjection != null)
{
foreach (var method in currentTypeProjection.AsOdcmClass().MethodsAndOverloads()) {
Expand Down
Loading

0 comments on commit 8dfd3b2

Please sign in to comment.