0

Modelio を使用してエンティティ ダイアグラムを作成し、それを XMI ファイルとしてエクスポートします。

XMI を取得したら、jhipster UML ツールを使用してソースを生成できます。

一部のエンティティで日付フィールドが必要なため、Modelio に DateTime というデータ型を追加しました。意図は、org.joda.time.DateTime を Java クラスで生成することです。

jhipster url.jhipster-uml test.xmi の実行中に以下のエラーが発生する

Parser detected: MODELIO.

    The type 'DateTime' isn't supported by JHipster, exiting now.
    Error
        at Object.<anonymous> (/usr/local/lib/node_modules/jhipster-uml/lib/exceptions/invalid_type_exception.js:7:34)
        at Module._compile (module.js:435:26)
        at Object.Module._extensions..js (module.js:442:10)

ここで何が欠けていますか?DateTime 型を joda クラスにマップする場所/方法を Modelio に伝える必要があると思います。

以下は、Modelio 3.4.1 を介してエクスポートされた完全な XMI ファイルです。

<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:JavaExtensions="http:///schemas/JavaExtensions/_UVePsJdXEeWrwNWyJ1cDng/0" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/3.0.0/UML" xsi:schemaLocation="http:///schemas/JavaExtensions/_UVePsJdXEeWrwNWyJ1cDng/0 JavaExtensions.profile.xmi#_UVnZp5dXEeWrwNWyJ1cDng">
  <uml:Model xmi:id="_UVGcQJdXEeWrwNWyJ1cDng" name="test">
    <eAnnotations xmi:id="_UVGcQZdXEeWrwNWyJ1cDng" source="Objing">
      <contents xmi:type="uml:Property" xmi:id="_UVGcQpdXEeWrwNWyJ1cDng" name="exporterVersion">
        <defaultValue xmi:type="uml:LiteralString" xmi:id="_UVGcQ5dXEeWrwNWyJ1cDng" value="3.0.0"/>
      </contents>
    </eAnnotations>
    <packagedElement xmi:type="uml:Class" xmi:id="_UVGcRJdXEeWrwNWyJ1cDng" name="TestClass">
      <ownedComment xmi:id="_UVGcRZdXEeWrwNWyJ1cDng">
        <body>&lt;Enter note text here></body>
      </ownedComment>
      <ownedAttribute xmi:id="_UVGcRpdXEeWrwNWyJ1cDng" name="testAtt" visibility="public" type="_UVGcR5dXEeWrwNWyJ1cDng" isUnique="false"/>
    </packagedElement>
    <packagedElement xmi:type="uml:PrimitiveType" xmi:id="_UVGcR5dXEeWrwNWyJ1cDng" name="DateTime"/>
    <profileApplication xmi:id="_UWtl0JdXEeWrwNWyJ1cDng">
      <eAnnotations xmi:id="_UWvbAJdXEeWrwNWyJ1cDng" source="http://www.eclipse.org/uml2/2.0.0/UML">
        <references xmi:type="ecore:EPackage" href="JavaExtensions.profile.xmi#_UVnZp5dXEeWrwNWyJ1cDng"/>
      </eAnnotations>
      <appliedProfile href="JavaExtensions.profile.xmi#_UVnZoJdXEeWrwNWyJ1cDng"/>
    </profileApplication>
  </uml:Model>
  <JavaExtensions:JavaDataType xmi:id="_UW1hoJdXEeWrwNWyJ1cDng" base_DataType="_UVGcR5dXEeWrwNWyJ1cDng" base_PrimitiveType="_UVGcR5dXEeWrwNWyJ1cDng"/>
</xmi:XMI>
4

1 に答える 1

0

jhipster は、joda ライブラリを使用して日付をエンティティに書き込みます。joda の LocalDate を使用する必要があると思います

  @Type(type = "org.jadira.usertype.dateandtime.joda.PersistentLocalDate")
    @JsonSerialize(using = CustomLocalDateSerializer.class)
    @JsonDeserialize(using = ISO8601LocalDateDeserializer.class)
    @Column(name = "fecha")
    private LocalDate fecha;
于 2015-12-03T12:45:59.550 に答える