Problem with JHipster app generation - conflict between two created app on the server port - jhipster

I generated two apps using jhipster command. One for a Jhipster demo called Blog and the other one called MyFarm.
In blog, there were three entities: Blog, Entry and Tag
In MyFarm there are two entities: Farm and Product.
The first app Blog works properly. Then I stop it. I open and run the new App myFarm and it keeps trying to reach the Blog entities... that it doesn't find obviously and then I get an error.
To generate the entities I used the import of a jh file containing the following:
entity Farm {
name String required minlength(3),
details TextBlob required
}
entity Product {
type String required,
quality Quality required,
quantity Integer required,
date Instant required
}
relationship ManyToOne {
Farm {user(login)} to User,
Product{farm(name)} to Farm
}
paginate Product with infinite-scroll
enum Quality {
MAUVAISE, BONNE, EXCELLENTE
}
The entities have been generated properly then. But they are in red in my IDE and the App doesn't try to reachc those entities upon running.
Does somebody have a clue, please?

The port is configured in the .yo-rc.json file in each project, edit one and change value of serverPort property, then re-generate your app by executing jhipster.

Related

JHipster: How turn prompt optional in my blueprint when executing the "jdl" command

I've observed the following behavior when I generate a new application using JHipster:
When I just call jhipster, it shows a set of prompts to make my choices.
When I call jhipster jdl <myjslfile.jdl>:
2.1. If the JDL has just entities, not declaring a config application section, I've got an error: Database type is required to validate entities.
2.2. If the JDL has the minimum config application like the following, it assumes some defaults and does not show any prompt.
I'm trying to write my own blueprint and I'd like to know how could I tell to Jhipster some default values should be considered when loading a JDL.
I thought that if I just set the prompt attribute default would be the solution, but I did this and have no effect, the prompts are always shown. When there are more than one application declared in the JDL file it's worst because it's not possible to distinguish what is being answered to each application since this processes happen in parallel.
Regards,
application {
config {
baseName microserviceExample,
applicationType microservice,
prodDatabaseType postgresql
}
entities X
}
entity X {
name String required minlength(3)
}
Personally, I don't like depending on default values that could be changed by a new major version (e.g. default for service registry will change in JHipster 8 from Eureka to Consul).
Why is this a problem to explicit these values in your JDL? For me the JDL should be self contained as much as possible.
Alternatively, you could define a .yo-rc.json file in your project directory or in its parent directory if you want to apply to several apps below.
And finally, you could open a feature request on github for the dev team to comment.

Jhipster using custom entity-client sub-generator

I am trying to create a blueprint for entity-client sub-generator by following the official guide. Tried several times. But when I try to use the generated blueprint, while importing jdl, it always says
Trying to use blueprint generator-jhipster-helloworld
WARNING! No blueprint found for entity-client falling back to default generator
then it generates the entity clients in the default way.
I can see the blueprint is linked into the node-modules folder of the generated app.
If anybody has created a simple working "entity-client sub-generator" blueprint, Please share the code with me. For example, "that adds <h1>lorem ipsum<h1> on the top of component.html file for the generated client of entity (on importing a simple jdl with just one entity)" would be sufficient.
Sample JDL
entity Item{
code String required,
description String required,
quantity Integer required
}
Best Regards.

How to merge 2 LUIS models?

I have 2 LUIS models. One I use for non-production Bot & another I use for production Bot. I have made many changes on LUIS non-prod app as part of day to day development and new skills. Now, we are planning to deploy these skills to prod bot so we would need same LUIS changes on prod LUIS.
I can certainly, update prod LUIS model with non prod by copying Intents and entities, utterances but of course this time consuming & error pron.
I would like to know the best way to merge 2 LUIS models and/or any other best practices I could use.
Use the dispatcher tool if these two models are in separate LUIS apps. It will combine them into a single app. If these are two models (as versions) in a single app, it is easier to export both versions then use Node.js to combine the JSON objects.
As Nicols mentioned, LUIS has an option of importing a LUIS app as a new version to the existing application. You can get details about importing/exporting versions from their doc.
You can import your development LUIS app json file as a new version to your production LUIS app and set the new version as the active one.
Just a workaround, if you are in Hurry
You can simply add two luis model in the LuisDialog and it will pick the highest scoring intent automatically.
[LuisModel("Model", "secret")]
[LuisModel("Model", "secret")]
public class RootDialog : LuisDialog<object>
{
[LuisIntent("None")]
public async Task NoneRes(IDialogContext context, LuisResult result)
{
}
}
The best scenario in your case would be to clone your non-production, give it a new version name, set the newly cloned version as active, and continue working on your non-production.
The full documentation to that can be found here

JHipster first application

I’m a complete JHipster beginner and I want to create my first own JHipster application, but I got a problem that I’m not able to solve.
Firstly, I generated my app with following settings:
-Monolithic application
then I chose a base name and a default Java package of my app and HTTP Session Authentication.
Later, I chose following:
-SQL, MYSQL, MYSQL, Yes, with ehcache, Gradle, CSS preprocessor : Yes, Internationalization: Yes, Testing framework: Gatling
And to that moment everything looked fine , then I wanted to create my entity as follows:
Yo jhipster:entity activitylist
and I added three fields:
-activityname (String), acitivitydate (LocalDate) and rating (Integer) and then I added relationship with entity user, type: many to one.
Afterwards
I used yo jhipster:entity user and I added following fields: login(String), name(String), surname(String) and added relationship one to many with field user.
However, everytime when I tried to run it with docker I got compile Java Failure and following warnings:
warning: Unmapped target property: "authorities".
UserDTO userToUserDTO(User user);
error: Unknown property "password" in return type.
User userDTOToUser(UserDTO userDTO);
I would appreciate any help.
The problem with your app is the name of your entity: user.
You need to change the name of this entity because when You name it as following You create a new Java class : User, however JHipster has its own built-in User Java class which is located in src/main/java/domain folder.
This class has its own getter, setter methods and mapper which operation is affected when your entity „user" is created.
You can notice this fact in Your warnings when compiler informs You that it encountered unknown properties in Your return type in User userDTOToUser. I would strongly recommend You changing name of the user entity and everything else should work fine.

How to access the "foo" controller in the jhipster-sample-app?

I'm starting to learn AngularJS and as Java/Maven/Spring developer, the jhipster yeoman generator looks great.
I've cloned the jhipster-sample-app, imported it into my IDE and started it via Maven command mvn spring-boot:run. (I know that when I want to generate my own app, i can use yo jhipster)
I am able to browse the app at http://localhost:8080/ and also login as 'user' and 'admin'
How do I navigate to the Foo entity in the sample app?
I've tried http://localhost:8080/#/foo which redirects back to the homepage.
On the server side, I see the sample app has a Foo entity, repository, and resource. On the AngularJS side, I also there is a Foo controller, router, service, and view.
What am i missing?
The sample is just an example of the "default" application, the "foo" entity is not complete.
If you use the generator, here are the steps to make the "foo" entity working:
http://jhipster.github.io/creating_an_entity.html
There are basically the same steps to do on the sample application: you need to set up the database tables (in Liquibase, they are just commented), and import the JS files in your main app.
But you are right, we should generate a complete entity in the sample application (or no entity at all!), but not provide this half complete result.

Resources