Code Monkey home page Code Monkey logo

Comments (20)

MathieuAA avatar MathieuAA commented on July 17, 2024

Hi again, this has been implemented quite a long time ago... I'll check if this is a regression.

from jhipster-uml.

MathieuAA avatar MathieuAA commented on July 17, 2024

My bad! This isn't completely handled (the names are, so that could speed up the work).
I don't know when this could be implemented, but we'll try to make it available with the next release.

from jhipster-uml.

MathieuAA avatar MathieuAA commented on July 17, 2024

The implementation will be available in a parallel branch for a while, so that we can test it.
When everything's in order, we will merge it with the master branch.
The only remaining task is to define the syntax for the DSL. The branch could be merged tonight or tomorrow.

from jhipster-uml.

MathieuAA avatar MathieuAA commented on July 17, 2024

This is the implementation Carl and I have chosen.
Provided Toto and Titi are our two entities, doing:

relationship OneToOne {
  Toto{titi} to Titi {toto}
}

will result in creating a O2O association between the two, and the injected field in each are toto and titi.

Doing:

relationship OneToOne {
  Toto{} to Titi {}
}

will have the same result.

However, doing:

relationship OneToOne {
  Toto{titi} to Titi
}

will create a field titi in Toto, but not in Titi.
Note that this is equivalent to:

relationship OneToOne {
  Toto{} to Titi
}

from jhipster-uml.

cbornet avatar cbornet commented on July 17, 2024

Hello @MathieuAA, this seems still not supported in the UML editors (modelio, ...). Could we have support in them also ?

from jhipster-uml.

MathieuAA avatar MathieuAA commented on July 17, 2024

I tested it and it seemed done. I'll reopen it in the meantime, but did you upgrade?
I'll should be able to test it tomorrow, but didn't find any problem before.

from jhipster-uml.

cbornet avatar cbornet commented on July 17, 2024

Maybe I didn't set it up correctly in modelio.
Here is a schema I was expecting to give unidir relationship in JHipster
company_employee
company_employee2

from jhipster-uml.

cbornet avatar cbornet commented on July 17, 2024

Exported xmi (modelio)

<?xml version="1.0" encoding="UTF-8"?><uml:Model xmlns:uml="http://www.omg.org/spec/UML/20110701" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmi:version="2.1" xmi:id="_hQyM8HMjEeWOi6s9FoL8tQ" name="simplerelationship">
  <eAnnotations xmi:id="_hQyM8XMjEeWOi6s9FoL8tQ" source="Objing">
    <contents xmi:type="uml:Property" xmi:id="_hQyM8nMjEeWOi6s9FoL8tQ" name="exporterVersion">
      <defaultValue xmi:type="uml:LiteralString" xmi:id="_hQyM83MjEeWOi6s9FoL8tQ" value="3.0.0"/>
    </contents>
  </eAnnotations>
  <packagedElement xmi:type="uml:Class" xmi:id="_hQyM9HMjEeWOi6s9FoL8tQ" name="Company">
    <ownedAttribute xmi:type="uml:Property" xmi:id="_hQyM9XMjEeWOi6s9FoL8tQ" name="Name" visibility="public" isUnique="false">
      <type xmi:type="uml:PrimitiveType" href="http://www.omg.org/spec/UML/20110701/PrimitiveTypes.xmi#String"/>
    </ownedAttribute>
  </packagedElement>
  <packagedElement xmi:type="uml:Class" xmi:id="_hQyM9nMjEeWOi6s9FoL8tQ" name="Employee">
    <ownedAttribute xmi:type="uml:Property" xmi:id="_hQyM93MjEeWOi6s9FoL8tQ" name="company" visibility="public" type="_hQyM9HMjEeWOi6s9FoL8tQ" association="_hQyM-nMjEeWOi6s9FoL8tQ">
      <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_hQyM-HMjEeWOi6s9FoL8tQ"/>
    </ownedAttribute>
    <ownedAttribute xmi:type="uml:Property" xmi:id="_hQyM-XMjEeWOi6s9FoL8tQ" name="Name" visibility="public" isUnique="false">
      <type xmi:type="uml:PrimitiveType" href="http://www.omg.org/spec/UML/20110701/PrimitiveTypes.xmi#String"/>
    </ownedAttribute>
  </packagedElement>
  <packagedElement xmi:type="uml:Association" xmi:id="_hQyM-nMjEeWOi6s9FoL8tQ" memberEnd="_hQyM93MjEeWOi6s9FoL8tQ _hQyM-3MjEeWOi6s9FoL8tQ">
    <ownedEnd xmi:type="uml:Property" xmi:id="_hQyM-3MjEeWOi6s9FoL8tQ" visibility="public" type="_hQyM9nMjEeWOi6s9FoL8tQ" association="_hQyM-nMjEeWOi6s9FoL8tQ">
      <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_hQyM_HMjEeWOi6s9FoL8tQ" value="*"/>
      <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_hQyM_XMjEeWOi6s9FoL8tQ"/>
    </ownedEnd>
  </packagedElement>
</uml:Model>

from jhipster-uml.

cbornet avatar cbornet commented on July 17, 2024

I verified that I am up-to-date : setBidirectionalRelationship() gets called

from jhipster-uml.

MathieuAA avatar MathieuAA commented on July 17, 2024

I've just fixed the problem with the parser (Modelio's). I'm going to commit the fix so that you can test it. In the meantime, I'll kill the bug in the other parsers.

from jhipster-uml.

MathieuAA avatar MathieuAA commented on July 17, 2024

Oh and by the way, using associations (not composition and not aggregation in this case) isn't officially supported by JHipster-UML as this kind of generic association hasn't been tested. If it works, good for you, but I strongly recommend that you don't use it. It's purely a logical debate, so I won't write a novel here, but it's better to specify which association you want to have.

from jhipster-uml.

MathieuAA avatar MathieuAA commented on July 17, 2024

I tested every editor and each one of them, except UML Designer, supports some kind of unidirectionality (I'll update the doc very soon). JHipser-UML generates unidirectionals for three editors (4 if you count the DSL, but it's not an editor).
I noticed an issue with Visual Paradigm's XMI file, and I'll try to determine what's causing it. The editor is still usable, but doesn't properly handles bidirectionality (jobs <-> tasks in our Oracle's HR model).

I'm closing this one and opening a new one about this last point.

from jhipster-uml.

cbornet avatar cbornet commented on July 17, 2024

@MathieuAA I now have an issue with the following Modelio diagram (sorry last time for the missing composition, it was not intentionnal)
company_employee3

Some fields are missing:

Found the .jhipster/Company.json configuration file, automatically generating the entity
The entity Company is being created.
ERROR relationshipType is missing in .jhipster/Company.json for relationship with id 1


Found the .jhipster/Employee.json configuration file, automatically generating the entity
The entity Employee is being created.
WARNING otherEntityField is missing in .jhipster/Employee.json for relationship with id 1, using id as fallback

from jhipster-uml.

MathieuAA avatar MathieuAA commented on July 17, 2024

Can you pass your JSONs please?

from jhipster-uml.

cbornet avatar cbornet commented on July 17, 2024

Company.json

{
  "relationships": [
    {
      "relationshipId": 1,
      "relationshipName": "employee",
      "relationshipFieldName": "employee",
      "otherEntityName": "Employee"
    }
  ],
  "fields": [
    {
      "fieldId": 1,
      "fieldName": "Name",
      "fieldType": "String"
    }
  ],
  "changelogDate": "20151015082954",
  "dto": "no",
  "pagination": "no"
}

Employee.json

{
  "relationships": [
    {
      "relationshipId": 1,
      "relationshipName": "company",
      "relationshipFieldName": "company",
      "otherEntityName": "Company",
      "relationshipType": "many-to-one"
    }
  ],
  "fields": [
    {
      "fieldId": 1,
      "fieldName": "Name",
      "fieldType": "String"
    }
  ],
  "changelogDate": "20151015082954",
  "dto": "no",
  "pagination": "no"
}

XMI

<?xml version="1.0" encoding="UTF-8"?><uml:Model xmlns:uml="http://www.omg.org/spec/UML/20110701" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmi:version="2.1" xmi:id="_gC8sQHcSEeWR56i1TSqTpQ" name="simplerelationship">
  <eAnnotations xmi:id="_gC8sQXcSEeWR56i1TSqTpQ" source="Objing">
    <contents xmi:type="uml:Property" xmi:id="_gC8sQncSEeWR56i1TSqTpQ" name="exporterVersion">
      <defaultValue xmi:type="uml:LiteralString" xmi:id="_gC8sQ3cSEeWR56i1TSqTpQ" value="3.0.0"/>
    </contents>
  </eAnnotations>
  <packagedElement xmi:type="uml:Class" xmi:id="_gC8sRHcSEeWR56i1TSqTpQ" name="Company">
    <ownedAttribute xmi:type="uml:Property" xmi:id="_gC8sRXcSEeWR56i1TSqTpQ" name="Name" visibility="public" isUnique="false">
      <type xmi:type="uml:PrimitiveType" href="http://www.omg.org/spec/UML/20110701/PrimitiveTypes.xmi#String"/>
    </ownedAttribute>
  </packagedElement>
  <packagedElement xmi:type="uml:Class" xmi:id="_gC8sRncSEeWR56i1TSqTpQ" name="Employee">
    <ownedAttribute xmi:type="uml:Property" xmi:id="_gC8sR3cSEeWR56i1TSqTpQ" name="company" visibility="public" type="_gC8sRHcSEeWR56i1TSqTpQ" aggregation="composite" association="_gC8sSncSEeWR56i1TSqTpQ">
      <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_gC8sSHcSEeWR56i1TSqTpQ"/>
    </ownedAttribute>
    <ownedAttribute xmi:type="uml:Property" xmi:id="_gC8sSXcSEeWR56i1TSqTpQ" name="Name" visibility="public" isUnique="false">
      <type xmi:type="uml:PrimitiveType" href="http://www.omg.org/spec/UML/20110701/PrimitiveTypes.xmi#String"/>
    </ownedAttribute>
  </packagedElement>
  <packagedElement xmi:type="uml:Association" xmi:id="_gC8sSncSEeWR56i1TSqTpQ" memberEnd="_gC8sR3cSEeWR56i1TSqTpQ _gC8sS3cSEeWR56i1TSqTpQ">
    <ownedEnd xmi:type="uml:Property" xmi:id="_gC8sS3cSEeWR56i1TSqTpQ" name="employee" visibility="public" type="_gC8sRncSEeWR56i1TSqTpQ" association="_gC8sSncSEeWR56i1TSqTpQ">
      <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_gC8sTHcSEeWR56i1TSqTpQ" value="*"/>
      <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_gC8sTXcSEeWR56i1TSqTpQ"/>
    </ownedEnd>
  </packagedElement>
</uml:Model>

from jhipster-uml.

MathieuAA avatar MathieuAA commented on July 17, 2024

I'll fix it tonight if I have time. Thanks!

from jhipster-uml.

MathieuAA avatar MathieuAA commented on July 17, 2024

I knew this case reminded me of something! This can't be done. JHipster detects that you want to do a Many-to-One with an entity that doesn't exist (in the Q&A), and warns you (rightly so if I might add).
I suggest you read this fantastic doc here. That's what I'm going to do anyway =)

from jhipster-uml.

cbornet avatar cbornet commented on July 17, 2024

Oh, you're right ! Thanks for pointing that out. I reversed the relationship and now it works perfectly.
This is awesome : I now generate the exact same json files that I had produced with the yeoman gen. Great work !

from jhipster-uml.

cbornet avatar cbornet commented on July 17, 2024

Do you think you could update the UML file chapter of the doc with example schemas for unidir one-to-many and unidir many-to-one (the one-to-many already in the doc is the bidir) ?

from jhipster-uml.

MathieuAA avatar MathieuAA commented on July 17, 2024

Yes, but not today! I'll do it friday or during the week-end. Good idea =)

from jhipster-uml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.