application WebDSLtest

section  model

  entity Foo {
    datetime1 : DateTime
    datetime2 : DateTime := datetime1
  }

section ui

  page root ( )
  {
    main()
    define body() {
      "Hello world!"
    }
  }

  derive CRUD Foo

Gives the following Java compilation problems

       [javac] 1. ERROR in C:\Users\Daco\workspace-webdsl\WebDSLtest\.servletapp\src-generated\webdsl\generated\templates\RefArg_outputDateTime_1_fooFoo_body0$l$Foo_ta1Foopc0.java (at line 9)
       [javac] 	arg_.setDatetime2((java.util.Date)org.webdsl.tools.Utils.cast(obj,java.util.Date.class));
       [javac] 	     ^^^^^^^^^^^^
       [javac] The method setDatetime2(Date) is undefined for the type Foo
       [javac] ----------
       [javac] 2. ERROR in C:\Users\Daco\workspace-webdsl\WebDSLtest\.servletapp\src-generated\webdsl\generated\templates\RefArg_outputDateTime_1_fooFoo_body0$l$Foo_ta1Foopc0.java (at line 45)
       [javac] 	arg_.validateDatetime2_internalValidationExceptionMultiple_(vem);
       [javac] 	     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       [javac] The method validateDatetime2_internalValidationExceptionMultiple_(ValidationExceptionMultiple) is undefined for the type Foo
       [javac] ----------
       [javac] 3. ERROR in C:\Users\Daco\workspace-webdsl\WebDSLtest\.servletapp\src-generated\webdsl\generated\templates\RefArg_outputDateTime_1_fooFoo_body0$l$Foo_ta1Foopc0.java (at line 53)
       [javac] 	arg_.validateDatetime2_internalValidationExceptionMultiple_(vem);
       [javac] 	     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       [javac] The method validateDatetime2_internalValidationExceptionMultiple_(ValidationExceptionMultiple) is undefined for the type Foo

These issues do not occur if Int is used instead of Datetime.

Submitted by Daco Harkes on 2 January 2016 at 00:46

On 29 August 2016 at 13:21 Daco Harkes commented:

This is not a crud-specific issue, it is an output() issue:

application icedustWebDSL

section  model

  entity Student {
    d3 : DateTime := DateTime("12:12 05-1994-06", "mm:H MM-yyyy-dd")
  }

section  ui

  page root(){"Root"}

  page student ( temp : Student )
  {
    output ( temp.d3 )
  }
run-eclipse-build:
       [javac] /Applications/WebDSL20160817.app/Contents/Eclipse/plugins/webdsl.editor_1.2.9.201608170954/webdsl-template/webdsl-build-eclipse.xml:293: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
       [javac] Since compiler setting isn't classic or modern, ignoring fork setting.
       [javac] Since compiler setting isn't classic or modern, ignoring fork setting.
       [javac] Since compiler setting isn't classic or modern, ignoring fork setting.
       [javac] Since compiler setting isn't classic or modern, ignoring fork setting.
       [javac] Compiling 35 source files to /Users/daco/IceDust/icedust.examples.webdsl/WebContent/WEB-INF/classes
       [javac] Since compiler setting isn't classic or modern, ignoring fork setting.
       [javac] invalid Class-Path header in manifest of jar file: /Users/daco/IceDust/icedust.examples.webdsl/WebContent/WEB-INF/lib/uncommons-maths-1.2.jar
       [javac] ----------
       [javac] 1. ERROR in /Users/daco/IceDust/icedust.examples.webdsl/.servletapp/src-generated/webdsl/generated/templates/RefArg_outputDateTime_1_studentpc0.java (at line 9)
       [javac] 	temp_.setD3((java.util.Date)org.webdsl.tools.Utils.cast(obj,java.util.Date.class));
       [javac] 	      ^^^^^
       [javac] The method setD3(Date) is undefined for the type Student
       [javac] ----------
       [javac] 2. ERROR in /Users/daco/IceDust/icedust.examples.webdsl/.servletapp/src-generated/webdsl/generated/templates/RefArg_outputDateTime_1_studentpc0.java (at line 45)
       [javac] 	temp_.validateD3_internalValidationExceptionMultiple_(vem);
       [javac] 	      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       [javac] The method validateD3_internalValidationExceptionMultiple_(ValidationExceptionMultiple) is undefined for the type Student
       [javac] ----------
       [javac] 3. ERROR in /Users/daco/IceDust/icedust.examples.webdsl/.servletapp/src-generated/webdsl/generated/templates/RefArg_outputDateTime_1_studentpc0.java (at line 53)
       [javac] 	temp_.validateD3_internalValidationExceptionMultiple_(vem);
       [javac] 	      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       [javac] The method validateD3_internalValidationExceptionMultiple_(ValidationExceptionMultiple) is undefined for the type Student
       [javac] ----------
       [javac] 3 problems (3 errors)

BUILD FAILED
/Users/daco/IceDust/icedust.examples.webdsl/build.xml:12: The following error occurred while executing this line:
/Applications/WebDSL20160817.app/Contents/Eclipse/plugins/webdsl.editor_1.2.9.201608170954/webdsl-template/webdsl-build-eclipse.xml:122: The following error occurred while executing this line:
/Applications/WebDSL20160817.app/Contents/Eclipse/plugins/webdsl.editor_1.2.9.201608170954/webdsl-template/webdsl-build-eclipse.xml:293: Compile failed; see the compiler error output for details.

On 29 August 2016 at 14:40 Daco Harkes commented:

Workaround, copy templates from built-in and remove refs.

application icedustWebDSL

section  model

  entity Student {
    d3 : DateTime := DateTime("12:12 05-1994-06", "mm:H MM-yyyy-dd")
  }

section  ui

  page root(){"Root"}

  page student ( temp : Student )
  {
    outputNonRef ( temp.d3 )
  }

template outputNonRef( d: DateTime ){
  var default := DateType.getDefaultDateTimeFormat()
  if( d != null ){
    dateoutputgenericNonRef( d as Date, default )[ all attributes ]
  }
}

template dateoutputgenericNonRef( d: Date, defaultformat: String ){
  var dateformat := defaultformat
  init{
    var attr := attribute( "format" );
    if(    attr != null
        && attr != ""
    ){
      dateformat := attr;
    }
    else{
      // if( d.getReflectionProperty() != null ){
      //   var formatanno := d.getReflectionProperty().getFormatAnnotation();
      //   if( formatanno != null ){
      //     dateformat := formatanno;
      //   }
      // }
    }
  }
  output( d.format( dateformat ) )
}

Log in to post comments