Package org.drools.workbench.models.guided.dtree.shared.model.values.impl

Examples of org.drools.workbench.models.guided.dtree.shared.model.values.impl.DateValue


                String _value = value;
                if ( _value.startsWith( "\"" ) && _value.endsWith( "\"" ) ) {
                    _value = value.substring( 1,
                                              _value.length() - 1 );
                }
                return new DateValue( DateUtils.parseDate( _value ) );

            } catch ( IllegalArgumentException e ) {
                messages.add( new DataTypeConversionErrorParserMessage( value,
                                                                        Date.class.getName() ) );
                return null;
View Full Code Here


        return DataType.TYPE_STRING;
    }

    private String getStringValue( final Value value ) {
        if ( value instanceof DateValue ) {
            final DateValue dv = (DateValue) value;
            return DATE_FORMAT.format( dv.getValue() );
        } else if ( value.getValue() != null ) {
            return value.getValue().toString();
        } else {
            return "";
        }
View Full Code Here

    }

    @Test
    public void testDateValue() {
        final Date tv = Calendar.getInstance().getTime();
        final DateValue v = new DateValue( tv );
        assertEquals( tv,
                      v.getValue() );

        try {
            v.setValue( "any string will do" );
            fail( "We should not be able to use DateValue.setValue(String)" );
        } catch ( UnsupportedOperationException e ) {
            //Swallow this is expected
        } catch ( Exception e ) {
            fail( "Unexpected exception thrown by DateValue.setValue(String)" );
View Full Code Here

        final TypeNode type = new TypeNodeImpl( "Person" );
        final ConstraintNode c1 = new ConstraintNodeImpl( "Person",
                                                          "dateField",
                                                          "==",
                                                          new DateValue( new Date( 84, 6, 15 ) ) );
        model.setRoot( type );
        type.addChild( c1 );

        final String drl = GuidedDecisionTreeDRLPersistence.getInstance().marshal( model );
        assertEqualsIgnoreWhitespace( expected,
View Full Code Here

        dob.set( Calendar.MONTH,
                 6 );
        dob.set( Calendar.DATE,
                 15 );
        action.getFieldValues().add( new ActionFieldValueImpl( "dateOfBirth",
                                                               new DateValue( dob.getTime() ) ) );
        type.addChild( action );

        final String drl = GuidedDecisionTreeDRLPersistence.getInstance().marshal( model );
        assertEqualsIgnoreWhitespace( expected,
                                      drl );
View Full Code Here

        dob.set( Calendar.MONTH,
                 6 );
        dob.set( Calendar.DATE,
                 15 );
        action.getFieldValues().add( new ActionFieldValueImpl( "dateOfBirth",
                                                               new DateValue( dob.getTime() ) ) );
        type.addChild( action );

        final String drl = GuidedDecisionTreeDRLPersistence.getInstance().marshal( model );
        assertEqualsIgnoreWhitespace( expected,
                                      drl );
View Full Code Here

        dob.set( Calendar.MONTH,
                 6 );
        dob.set( Calendar.DATE,
                 15 );
        action.getFieldValues().add( new ActionFieldValueImpl( "dateOfBirth",
                                                               new DateValue( dob.getTime() ) ) );
        type.addChild( action );

        final String drl = GuidedDecisionTreeDRLPersistence.getInstance().marshal( model );
        assertEqualsIgnoreWhitespace( expected,
                                      drl );
View Full Code Here

        dob.set( Calendar.MONTH,
                 6 );
        dob.set( Calendar.DATE,
                 15 );
        action.getFieldValues().add( new ActionFieldValueImpl( "dateOfBirth",
                                                               new DateValue( dob.getTime() ) ) );
        type.addChild( action );

        final String drl = GuidedDecisionTreeDRLPersistence.getInstance().marshal( model );
        assertEqualsIgnoreWhitespace( expected,
                                      drl );
View Full Code Here

        final TypeNode type = new TypeNodeImpl( "Person" );
        final ConstraintNode c1 = new ConstraintNodeImpl( "Person",
                                                          "dateField",
                                                          "==",
                                                          new DateValue( new Date( 84, 6, 15 ) ) );
        expected.setRoot( type );
        type.addChild( c1 );

        addModelField( "Person",
                       "this",
View Full Code Here

        dob.set( Calendar.MINUTE,
                 0 );
        dob.set( Calendar.SECOND,
                 0 );
        action.getFieldValues().add( new ActionFieldValueImpl( "dateOfBirth",
                                                               new DateValue( dob.getTime() ) ) );
        type.addChild( action );

        addModelField( "Person",
                       "this",
                       "Person",
View Full Code Here

TOP

Related Classes of org.drools.workbench.models.guided.dtree.shared.model.values.impl.DateValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.