Is Odata Filter functions supported in SAP Cloud SDK -Java - sap-cloud-sdk

I want to use the OData function SubstringOf in our filter expression. As of now I do not see any relevant api against GeneratedEntityName.PROPERTYNAME.
Is there a workaround to use substringOf incase the API is unavailable.
Using Java SAP Cloud SDK version 3.7.0

Unfortunately the feature you are requesting is currently not implemented. Due to dependency restrictions the SAP Cloud SDK will not be able to provide a native solution to use custom filter expressions.
new DefaultGeneratedService()
.getAllEntities()
.select(Entity.PROPERTY_NAME)
.withQueryParameter("$filter", "substringof('SAP', CompanyName)")
You will not be able to use other filter expressions by the VDM. So you have to construct the query string yourself.
We are planning to enable custom and type based filters sometime this year.

Related

How to find the alternative class/method for harmonyOS in androidOs?

I am a fresher who works on HarmonyOS where we have to map android imports to respected to HarmonyOs using an excel sheet, which consists of alternative imports but some are missing in that Excel. where can I find all the alternative methods?
There is no direct substitution or mapping between the methods of HarmonyOS and Android. You need to query the official APIs based on the site requirements to find a method that meets the requirements.
API reference documents provide you guidance in using the APIs of different programming languages, as well as standards and specifications required for app development with these APIs.
Java API References
JS API References
You can refer this example for Java Harmony OS APIs for Android developers.
https://medium.com/huawei-developers/java-harmonyos-api-for-android-developers-cheatsheet-9de077561732
For some classes direct one to one mapping might not be available for now.
In HarmonyOS developer doc there is Reference Document Outline for Java APIs, Native APIs. Please check https://developer.harmonyos.com/en/docs/documentation/doc-references/reference-document-outline-0000001115016824

how to convert azure app insights api response to C# models

so i am able to call app insight's api "https://api.applicationinsights.io/v1/apps/xx/xx/xx" from my C# code.
i can get the json response.
i have this response in json and i want to serialize it into C# objects. do i have to create matching C# classes my self or is there any built in c# models i can use and serialize them?
Not really a direct answer to your question, but instead of consuming REST API directly and doing the conversion/serialization yourself you can simply use Application Insights .Net SDK.
The SDK will do all the necessary conversions for you and give you nice C# objects. The source code for this is also open source and is available here: https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights.Query.
You can take a look here for all the models available to you for direct use here: https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights.Query/src/Generated/Models.
In my opinion, if you choose to use app insights api, that means you didn't add any other sdk into your project, that means there's no any built in models for you.
And if you choose to use sdk instead, here's a sample for it, and per my testing, it only provides QueryResults as the response, here's my testing result, and this is the introduction for preparation. Pls note, you need wait for a while to make the newly added role to take effect. If you can't find the api permission mentioned in the document, you can search for it like what I did.

Guidance Required - Approach to consume ODATA Service

We understand that these are the options available from SDK to connect to ODATA Service
Option 1 - If the ODATA Service is not supported implicitly by SDK, Use com.sap.cloud.sdk.odatav2.connectivity.1.ODataCreateRequestBuilder
Option 2 - If the ODATA Service is not supported implicitly by SDK, Use VDM generation approach.
Call the services using generated Java classes
Option 3 - If the ODATA Service is supported implicitly by SDK, Use the already available class
e.g. 2> com.sap.cloud.sdk.s4hana.datamodel.odata.services.OutboundDeliveryService
Now we have have some questions and need expert guidance here
Question 1 - We have a use case where we need to call oDATA Services from a third party system
which option we should go for Option 1 or Option 2 ?
Question 2 - What are these cases where Option 1 is preferred over Option 2?
Question 3 - We also have a use case where we need to call S4HANA ODATA service related to OutboundDelivery. Service is supported by SDK by class com.sap.cloud.sdk.s4hana.datamodel.odata.services.OutboundDeliveryService
But there is one new field is getting added to the service during current release. We need to update this field
In this case which option is suggested?
Question 4 - How frequently new fields on existing S4HANA odata services are included in SDK?
I hope I can enlighten you a little here:
Regarding 1: Personally, I'd still recommend going with option 2 and generate client code using our generator. This will give you the same convenience that you know from the S/4 services for any other OData service. If, for some reason, the generated code does not work against your third party service, you can still use option 1 as a fallback.
Generally speaking, our generator should work for any OData v2 service, not just SAP services.
Regarding 2: As already mentioned, the generic OData client always works well as a fallback, if the generated client does not work whatever reason.
The other case I can think of (and this should be rather rare), is that you yourself are exposing one service that retrieves it data from several downstream OData services. In this case, the generic client might give you some advantages over the generated one.
Apart from that, I'm not aware of any use cases where I'd personally go with the generic client over the generated one.
Regarding 3 and 4: The VDM packages that we ship as part of the SAP Cloud SDK contain the OData client code for the current release of SAP S/4HANA Cloud. So if the services in SAP S/4HANA Cloud are updated, our packages will reflect that update. If you're working with SAP S/4HANA On-Premise, there's generally a good chance that the service is compatible with the Cloud version. If not, you can still use our generator to generate client code with the metadata of the respective On-Premise service.

Azure Function with Entity Framework or Normal Sql query

Could you please help with what is better where Entity Framework or normal Sql query, I personally would like to use Entity Framework with Linq to SQL however I faced certain challenges today like there is no .ToList() or .FirstOrDefault() option available and also there are compatibilty issues using Entity Framework with .net Standard 2.0, so, anyone experienced the same and help what would be better approach.
According to your description, you need to using the namespace of System.Linq
.ToList() or .FirstOrDefault() option is available at .NET CORE 2.0 and these two method are extension methods under System.Linq. So we need to use System.Linq
namespace.
We can see below screenshot of my project.

BreezeJS with ServiceStack?

I was wondering whether or not BreezeJS is compatible when using other technologies other than Web API and/or Entity Framework? As I'm currently in development of a SPA using Service Stack to retrieve data and ORMLite?
So I am curious how BreezeJS handle's this as I know it uses it's own API Controller usually with an extension of the DbContext class which Entity Framework uses. Thanks.
There is currently a sample called NoDb in the samples zip available on the breeze website. This sample does not use EF, but it does use WebApi. So I'd start by looking there. ( additional documentation on this sample should be added within a day or two as well).
In terms of using ServiceStack instead of WebApi, breeze supports the concept of a "dataServiceAdapter" and currently ships with two, an OData adapter and a WebApi adapter. It is certainly possible to write a ServiceStack adapter that breeze could use but this is not trivial. Please add this as a feature request ( and vote for it) on the breeze User Voice. We take these requests seriously.

Resources