Search in sources :

Example 1 with TimeAttribute

use of org.openforis.idm.model.TimeAttribute in project collect by openforis.

the class ComparisonCheckTest method testTimeGtFailOnEq.

@Test
public void testTimeGtFailOnEq() {
    Entity timeStudy = EntityBuilder.addEntity(cluster, "time_study");
    EntityBuilder.addValue(timeStudy, "start_time", new Time(10, 00));
    TimeAttribute endTime = EntityBuilder.addValue(timeStudy, "end_time", new Time(10, 00));
    ValidationResults results = validate(endTime);
    assertTrue(containsComparisonCheck(results.getErrors()));
}
Also used : Entity(org.openforis.idm.model.Entity) TimeAttribute(org.openforis.idm.model.TimeAttribute) Time(org.openforis.idm.model.Time) Test(org.junit.Test)

Example 2 with TimeAttribute

use of org.openforis.idm.model.TimeAttribute in project collect by openforis.

the class ComparisonCheckTest method testTimeGtPassOnGt.

@Test
public void testTimeGtPassOnGt() {
    Entity timeStudy = EntityBuilder.addEntity(cluster, "time_study");
    EntityBuilder.addValue(timeStudy, "start_time", new Time(10, 00));
    TimeAttribute endTime = EntityBuilder.addValue(timeStudy, "end_time", new Time(10, 01));
    ValidationResults results = validate(endTime);
    assertFalse(containsComparisonCheck(results.getErrors()));
}
Also used : Entity(org.openforis.idm.model.Entity) TimeAttribute(org.openforis.idm.model.TimeAttribute) Time(org.openforis.idm.model.Time) Test(org.junit.Test)

Example 3 with TimeAttribute

use of org.openforis.idm.model.TimeAttribute in project collect by openforis.

the class TimeAttributeMapper method setFields.

@Override
void setFields(Node<?> node, InsertSetStep<?> insert) {
    Time value = ((TimeAttribute) node).getValue();
    if (value != null) {
        insert.set(DATA.NUMBER1, toNumeric(value.getHour()));
        insert.set(DATA.NUMBER2, toNumeric(value.getMinute()));
    }
}
Also used : TimeAttribute(org.openforis.idm.model.TimeAttribute) Time(org.openforis.idm.model.Time)

Example 4 with TimeAttribute

use of org.openforis.idm.model.TimeAttribute in project collect by openforis.

the class ComparisonCheckTest method testTimeGtFailOnLt.

@Test
public void testTimeGtFailOnLt() {
    Entity timeStudy = EntityBuilder.addEntity(cluster, "time_study");
    EntityBuilder.addValue(timeStudy, "start_time", new Time(10, 00));
    TimeAttribute endTime = EntityBuilder.addValue(timeStudy, "end_time", new Time(8, 00));
    ValidationResults results = validate(endTime);
    assertTrue(containsComparisonCheck(results.getErrors()));
}
Also used : Entity(org.openforis.idm.model.Entity) TimeAttribute(org.openforis.idm.model.TimeAttribute) Time(org.openforis.idm.model.Time) Test(org.junit.Test)

Aggregations

Time (org.openforis.idm.model.Time)4 TimeAttribute (org.openforis.idm.model.TimeAttribute)4 Test (org.junit.Test)3 Entity (org.openforis.idm.model.Entity)3