/**
   * Returns the corresponded DMDL model definition.
   *
   * @param model the thundergate model
   * @param extra extra attributes
   * @return the converted model
   * @throws IllegalArgumentException if some parameters were {@code null}
   * @since 0.2.3
   */
  public static AstModelDefinition<AstRecord> generate(
      TableModelDescription model, AstAttribute... extra) {
    if (model == null) {
      throw new IllegalArgumentException("model must not be null"); // $NON-NLS-1$
    }
    if (extra == null) {
      throw new IllegalArgumentException("extra must not be null"); // $NON-NLS-1$
    }
    List<AstAttribute> attrs = Lists.create();
    attrs.add(AstBuilder.getAutoProjection());
    attrs.add(AstBuilder.getNamespace(AstBuilder.toDmdlName(Constants.SOURCE_TABLE)));
    attrs.add(AstBuilder.getOriginalName(model.getReference().getSimpleName()));
    attrs.add(AstBuilder.getPrimaryKey(model));
    Collections.addAll(attrs, extra);

    return new AstModelDefinition<>(
        null,
        ModelDefinitionKind.RECORD,
        AstBuilder.getDesciption("テーブル{0}", model.getReference().getSimpleName()),
        attrs,
        AstBuilder.toName(model.getReference()),
        new RecordModelGenerator(model).generateExpression());
  }
 private AstRecord generateTerm() {
   List<AstPropertyDefinition> properties = Lists.create();
   for (ModelProperty property : model.getProperties()) {
     properties.add(
         new AstPropertyDefinition(
             null,
             AstBuilder.getDesciption("{0}", property.getName()),
             Arrays.asList(
                 new AstAttribute[] {
                   AstBuilder.getOriginalName(property.getName()),
                 }),
             AstBuilder.toName(property),
             AstBuilder.toType(property.getType())));
   }
   return new AstRecordDefinition(null, properties);
 }