Problem Filtering Entities With "Not compatible with jpaMetamodelFiltering" - jhipster

I am new to using Jhipster, I generated a gateway application in which I am trying to create entities that allow filtering as indicated in https://www.jhipster.tech/entities-filtering/
My JDL application looks like this:
application {
config {
baseName Appcommun,
applicationType gateway,
packageName co.appcommunity.gateway,
serviceDiscoveryType eureka,
authenticationType jwt,
databaseType sql,
devDatabaseType h2Disk,
prodDatabaseType mysql,
cacheProvider hazelcast,
buildTool maven,
clientFramework angularX,
enableTranslation true,
nativeLanguage es,
languages [es, en],
testFrameworks [protractor]
}
entities *
}
entity Community {
name String required unique,
description String,
code String required unique,
location String,
address String required,
logo String
}
dto * with mapstruct
filter Community
service * with serviceClass
When I run the Jhipster jdl jdlfile.jdl
You can see the following messages:
info: The filter option is set for Community, the 'serviceClass' value for the 'service' is gonna be set for this entity if no other value has been set.
WARNING! Not compatible with jpaMetamodelFiltering, disabling
Generated Entity JSON looks like:
{
"name": "Community",
"fields": [
{
"fieldName": "name",
"fieldType": "String",
"fieldValidateRules": ["required", "unique"]
},
{
"fieldName": "description",
"fieldType": "String"
}
],
"relationships": [],
"entityTableName": "community",
"dto": "mapstruct",
"pagination": "no",
"service": "serviceClass",
"jpaMetamodelFiltering": false,
"fluentMethods": true,
"readOnly": false,
"embedded": false,
"applications": ["easycommuniy"],
"databaseType": "sql",
"changelogDate": "20210603013758"
}
No filter service was generated.
Can any body say me what I'm doing wrong?
Can someone give me some hints? What am I doing wrong?
I tried to put jpaMetamodelFiltering": true, and regenerate the entity with the same result.
Thanks.

Related

AWS CDK Api Gateway Models Ref Dependency - Model reference must be in canonical form

I am trying to add multiple models in the same time using aws CDK when one of the models is referencing the other one.
Ex:
"Gender": {
"contentType": "application/json",
"modelName": "GenderModel",
"schema": {
"type": "string",
"enum": [
"Not Specified",
"Male",
"Female",
"Non-Binary"
],
"schema": "http://json-schema.org/draft-04/schema#",
"title": "GenderModel"
}
},
and
"Requirements": {
"contentType": "application/json",
"modelName": "RequirementsModel",
"schema": {
"type": "object",
"properties": {
"gender": {
"ref": "https://apigateway.amazonaws.com/restapis/${Token[TOKEN.791]}/models/GenderModel"
}
},
"required": [
"gender",
],
"additionalProperties": false,
"schema": "http://json-schema.org/draft-04/schema#",
"title": "RequirementsModel"
}
},
When i deploy this fails with
Model reference must be in canonical form
From what i can see this fails because the GenderModel does not exists. If i first add the GenderModel in the stack and then i add the RequirementsModel and deploy again it works just fine because the GenderModel was previously created. If i want to create both of the models in the same time it will fail.
I tried to make sure the order of addModel call is correct but it seems it does not work.
Solution Found
Seems like you have to add explicitly specify the dependency.
modelB.node.addDependency(modelA)
This will avoid the error and add the models in the correct order
The problem is https://apigateway.amazonaws.com/restapis/${Token[TOKEN.791]}/models/GenderModel, specifically the ${Token[TOKEN.791]} part. When the API is not created, at CloudFormation synthetisation time, id is not known and placeholder value used - https://docs.aws.amazon.com/cdk/latest/guide/tokens.html
You can use the Ref intristic function to compose model by the reference
const getModelRef = (api: RestApi, model: Model): string =>
Fn.join(
'',
['https://apigateway.amazonaws.com/restapis/',
api.restApiId,
'/models/',
model.modelId]);

Azure Search Does Not Remove Data After Indexer RUN

I have a file in blob storage folder/new/data1.json.
data1 contains json array.
[
{
"name": "na",
"data": {
"1":"something1",
"2":"something2"
}
},
{
"name": "ha",
"data": {
"1":"something1",
"2":"something2"
}
}
]
my datasource body :
{
"name" : "datasource",
"type" : "azureblob",
"credentials" : { "connectionString" : "MyStorageConnStrning" },
"container" : { "name" : "mycontaner", "query" : "folder/new" }
}
my index body:
{
"name" : "index",
"fields": [
{ "name": "id", "type": "Edm.String", "key": true, "searchable": false },
{ "name": "name", "type": "Edm.String", "searchable": true, "filterable": false, "sortable": true, "facetable": true},
{ "name": "data", "type": "Edm.String", "searchable": false}
]
}
indexer body:
{
"name" : "indexer",
"dataSourceName" : "datasource",
"targetIndexName" : "index",
"parameters" : { "configuration" : { "parsingMode" : "jsonArray" } }
}
when created i can search for na and ha and get result.
but if i delete folder/new/data1.json from the blob storage and run the indexer and try to search na and ha i still get results.
I found that if i Delete the indexer and recreate it na and ha goes away from search.
Is there any way to remove previous data with out deleting the indexer?
Deleting documents using indexers is a bit tricky, especially when your blob contains multiple documents; if you delete the blob directly then the indexer won't see the blob and wouldn't try to delete anything from the index.
To make the indexer delete documents you need to use a soft delete deletion detection policy, for example:
{
"#odata.type": "#Microsoft.Azure.Search.SoftDeleteColumnDeletionDetectionPolicy",
"softDeleteColumnName": "IsDeleted",
"softDeleteMarkerValue": "true"
}
When you want to delete a document, add "IsDeleted": true to the JSON object. After all documents in a blob has been soft deleted and the deletes have been picked up by the indexer, only then you can do a hard delete and remove the blob.
One subtlety here is that you must not add/remove/rearrange elements of the array because you're using the default document id, which depends on the blob path and array index. If you use the name field as the key then you'll have the flexibility to do partial hard deletes inside the blob.
I'm afraid you'll need to delete the entries from the index on your own.
Take a look at Add, Update or Delete Documents (Azure Search Service REST API) on how it can be done using HTTP requests using a tool like Postman.
Hope it helps!

Can not deploy Entries in Entities to DialogFlow

I'm currently working with Custom Entities (Developer Entities) via modifying Entities JSON Docs
I know how to create & link manually my Custom Entities with my Intents.
I had
en-US.json with customized entities (Valid json)
{
"invocation": "Test",
"intents": [
...
],
"dialogflow": {
"intents": [
{
"name": "Default Fallback Intent",
"auto": true,
"webhookUsed": true,
"fallbackIntent": true
},
{
"name": "Default Welcome Intent",
"auto": true,
"webhookUsed": true,
"events": [
{
"name": "WELCOME"
}
]
}
],
"entities": [
{
"id": "f060b6f7-7a17-4355-9fa6-3ce02f0ce33a",
"name": "additionalTopic",
"isOverridable": true,
"entries": [
{
"synonyms": [
"usuk",
"us",
"uk",
"us music",
"uk music",
"play usuk",
"play us",
"play uk",
"play us music",
"play uk music"
],
"value": "usuk"
},
{
"synonyms": [
"vn",
"vietnamese"
],
"value": "vn"
}
],
"isEnum": false,
"automatedExpansion": false
}
]
}
It looks like correct as Entities JSON Docs
I build with jovo command line : jovo build
It generated additionalTopic.json & additionalTopic_usersays_en.json in folder platforms/googleAction/dialogflow/entities, as image
These steps in above looks like OK, right?
Then I deploy to DialogFlow via jovo command line : jovo deploy --project-id PROJECT_ID
It deployed success as usually.
Last steps I going to DialogFlow Console to check Custom Entities I created,
And here it is.
Entities name appeared, but where is synonyms?
What I want is after deployed, it expects as first image in above.
Please take a look and help me find the way,
Really thanks.
p/s : I'm using DialogFlow Console version 2.
It looks like this is the bug in jovo-framework.
In this time, jovo-framework only support for DialogFlow version 1.
jovo releases note : https://github.com/jovotech/jovo-framework-nodejs/releases

Generating entity in Jhipster Module

Im writing a Jhipster generator module and I need to scaffold a new entity. Just like running jhipster:entity but inside the generator javascript
How should I do this? I see in the base generator methods "addEntityToCache(...)", "addEntityToMenu(...)". But I don't see: "addEntity(definition)" where definition is the configuration json that it's stored in .jhipster
It's this feature possible? can I extend the entity sub-generator to reuse the code?
Create entity.json file inside project/.jhipster
{
"fluentMethods": true,
"relationships": [],
"fields": [
{
"fieldName": "field_name_in_pojo_class",
"fieldType": "data_type_of_that_field"
}
],
"changelogDate": "20180523121144",
"dto": "no",
"service": "serviceClass",
"entityTableName": "entity_name_here",
"jpaMetamodelFiltering": false,
"pagination": "pagination",
"microserviceName": "project_name_here",
"searchEngine": false
}

Remove properties related to Sharepoint from raw odata response

I am using Sharepoint REST API to get/modify data in Sharepoint from NodeJS.
I am getting odata response from Sharepoint REST API and everything is working as expected.
Except one thing.
Currently I am getting response from Sharepoint REST API as below
{
"odata.metadata": "https://test.sharepoint.com/_api/$metadata#SP.ApiData.Lists",
"value": [
{
"odata.type": "SP.List",
"odata.id": "https://test.sharepoint.com/_api/Web/Lists(guid'sample-guid')",
"odata.etag": "\"6\"",
"odata.editLink": "Web/Lists(guid'sample-guid')",
"AllowContentTypes": true,
"BaseTemplate": 160,
"BaseType": 0,
"ContentTypesEnabled": true,
"CrawlNonDefaultViews": false,
"Created": "2015-05-19T11:13:46Z",
"DefaultContentApprovalWorkflowId": "00000000-0000-0000-0000-000000000000",
"Description": "Use this list to track access requests to a site or uniquely permissioned items in the site.",
"Direction": "none",
"DocumentTemplateUrl": null,
"DraftVersionVisibility": 0,
"EnableAttachments": false,
"EnableFolderCreation": false,
"EnableMinorVersions": false,
"EnableModeration": false,
"EnableVersioning": true,
"EntityTypeName": "AccessRequests",
"FileSavePostProcessingEnabled": false,
"ForceCheckout": false,
"HasExternalDataSource": false,
"Hidden": true,
"Id": "sample-id",
"IrmEnabled": false,
"IrmExpire": false,
"IrmReject": false,
"IsApplicationList": false,
"IsCatalog": false,
"IsPrivate": false,
"ItemCount": 1,
"LastItemDeletedDate": "2015-05-19T11:13:46Z",
"LastItemModifiedDate": "2015-08-04T06:57:22Z",
"ListItemEntityTypeFullName": "SP.Data.AccessRequestsItem",
"MajorVersionLimit": 0,
"MajorWithMinorVersionsLimit": 0,
"MultipleDataList": false,
"NoCrawl": true,
"ParentWebUrl": "/",
"ParserDisabled": false,
"ServerTemplateCanCreateFolders": true,
"TemplateFeatureId: "sample-id",
"Title": "Test Title"
}, {
........
}]
}
In the above response I am getting fields which are related to Sharepoint System along with fields I want.
for ex: odata.type, odata.id, AllowContentTypes, BaseTemplate etc.
How do I get the fields which I required but not the other Sharepoint related fields.
Can anybody help ?
Thanks
For that purpose you could utilize $select query option (follow OData Version 2.0 for a more details).
Regarding odata.type and odata.id properties, since they are part
of metadata properties, you just need to specify the proper Accept
header in order to request them (eg: accept:
application/json;odata=minimalmetadata). For a more details follow JSON
Light support
in REST SharePoint API released article.
The following example returns a specific set of List resource properties such as AllowContentTypes and BaseTemplate:
Endpoint URI: https://contoso.sharepoint.com/_api/web/lists?$select=AllowContentTypes,BaseTemplate
Accept: application/json; odata=minimalmetadata
Method: GET
Result
{
"d": {
"results": [
{
"__metadata": {
"id": "https://contoso.sharepoint.com/_api/Web/Lists(guid'82dcfcc5-e58c-4610-b4c3-589a7228e912')",
"uri": "https://contoso.sharepoint.com/_api/Web/Lists(guid'82dcfcc5-e58c-4610-b4c3-589a7228e912')",
"etag": "\"0\"",
"type": "SP.List"
},
"AllowContentTypes": true,
"BaseTemplate": 125
},
//...
]
}
}

Resources