mshima / generator-jhipster-tenantview

Customization for tenancy and multi-tenancy
9 stars 3 forks source link

Testing this out but failed to get it to work #46

Closed ernsyn closed 7 months ago

ernsyn commented 4 years ago

Hi,

I'm trying to test this blueprint out but regardless of whichever method I try, it still fail to generate properly. What I've tried so far.

Method 1.

  1. Generate a new jhipster project with 'jhipster --blueprints tenantview" (mono, angular)
  2. Generate a new entity with 'jhipster entity Book'. Made the entity tenant aware and somehow the generation failed.

Method 2.

  1. I tried to use the sample app.jdl that you've suggested in 1 or 2 other issues but still can't get it to generate properly.

At this point, I'm stuck. Appreciate if you can advise the steps required to generate a functioning multi tenant application with this blueprint.

Note: I'm using JHipster v6.9.0

ernsyn commented 4 years ago

Update:

I added another step to Method 1 by running the following command.

"jhipster --tenant-name Company"

After that, I proceeded to add a Book entity that is Tenant Aware. There was a bug in the generation where an extra comma is added in the entity.module.ts and once that extra comma is removed, it builds fine.

However, I noticed 2 things.

  1. No BookAspect was generated.
  2. In the Book entity, no @Filter and @FilterDef is added. It only added a @ManyToOne to the tenant entity.

Is this expected?

Looking forward to your reply

Please find below output of jhipster info for your reference.

Welcome to the JHipster Information Sub-Generator

JHipster Version(s)
tenantview@0.0.1-SNAPSHOT /Users/john/workspace/oss/jhipster-based/tenantview
└── generator-jhipster@6.9.0
JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "com.tviewtest"
    },
    "jhipsterVersion": "6.9.0",
    "applicationType": "monolith",
    "baseName": "tenantview",
    "packageName": "com.tviewtest",
    "packageFolder": "com/tviewtest",
    "serverPort": "8080",
    "authenticationType": "jwt",
    "cacheProvider": "ehcache",
    "enableHibernateCache": true,
    "websocket": false,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "prodDatabaseType": "mysql",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": false,
    "buildTool": "maven",
    "enableSwaggerCodegen": false,
    "jwtSecretKey": "YourJWTSecretKeyWasReplacedByThisMeaninglessTextByTheJHipsterInfoCommandForObviousSecurityReasons",
    "embeddableLaunchScript": false,
    "useSass": true,
    "clientPackageManager": "npm",
    "clientFramework": "angularX",
    "clientTheme": "none",
    "clientThemeVariant": "",
    "creationTimestamp": 1594716691827,
    "testFrameworks": [],
    "jhiPrefix": "jhi",
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "otherModules": [
      {
        "name": "generator-jhipster-tenantview",
        "version": "1.0.0"
      }
    ],
    "enableTranslation": false,
    "blueprints": [
      {
        "name": "generator-jhipster-tenantview",
        "version": "1.0.0"
      }
    ],
    "lastLiquibaseTimestamp": 1594717132000
  },
  "generator-jhipster-tenantview": {
    "tenantName": "Company",
    "tenantModule": "admin",
    "tenantModelPath": "shared/admin"
  }
}

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions
entity Company {
  name String required minlength(3),
  idName String minlength(3)
}
entity Book {
  title String
}
relationship ManyToOne {
  Book{company(name) required} to Company
}

service Company, Book with serviceClass
clientRootFolder Company with ../admin
paginate Book with pagination

Environment and Tools

java version "1.8.0_201" Java(TM) SE Runtime Environment (build 1.8.0_201-b09) Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)

git version 2.21.0 (Apple Git-120)

node: v12.18.2

npm: 6.14.5

yeoman: 3.1.0

yarn: 1.13.0

Docker version 19.03.8, build afacb8b

docker-compose version 1.25.4, build 8d51620a

identical .jhipster/Book.json identical .jhipster/Company.json INFO! Congratulations, JHipster execution is complete!

ernsyn commented 4 years ago

@mshima

Any advise regarding my issue above?

mshima commented 4 years ago

I recommend to use required branch. And use jdl some samples at https://github.com/mshima/generator-jhipster-tenantview/tree/required/test-integration/samples. Due to jhipster6 workflow kind of broken, I decided to focus at jdl.

ernsyn commented 4 years ago

Can you share which required branch? I used the last release version but didn't work.

Also, my steps above is correct right?

mshima commented 4 years ago
npm install -g mshima/generator-jhipster-tenantview#required

Use jdl eg:

jhipster jdl https://github.com/mshima/generator-jhipster-tenantview/blob/required/test-integration/samples/jdl-owner/app.jdl
ernsyn commented 4 years ago

I tried your suggestion but the AOP classes weren't generated. Does it require specific version of JHipster?

mshima commented 4 years ago

Forgot —blueprints tenantview

JHipster latest version

ernsyn commented 4 years ago

I tried as per your suggestion above. The project now generates with the tenant (Owner entity & Owner Aspect). However it did not generate any AOP class for BankAccount. Based on the jdl snippet below, I assume the BankAccount entity is supposed to have the filter definitions and also a corresponding AOP class generated for it?

@tenantAware entity BankAccount { name String required bankNumber Integer agencyNumber Long lastOperationDuration Float meanOperationDuration Double balance BigDecimal required openingDay LocalDate lastOperationDate Instant active Boolean accountType BankAccountType attachment AnyBlob description TextBlob }

In my generated project, I did not see any filters or AOP class for the BankAccount entity.