Search in sources :

Example 1 with DayEventTime

use of org.codice.alliance.nsili.common.GIAS.DayEventTime in project alliance by codice.

the class SubmitStandingQueryRequestImplTest method testGetDate.

@Test
public void testGetDate() {
    Time time = new Time((short) 15, (short) 30, 25);
    DayEventTime dayEventTime = new DayEventTime();
    dayEventTime.time = time;
    dayEventTime.day_event = DayEvent.END_OF_MONTH;
    LifeEvent lifeEvent = new LifeEvent();
    lifeEvent.day_event(dayEventTime);
    Date date = SubmitStandingQueryRequestImpl.getDate(lifeEvent);
    assertThat(date, notNullValue());
    lifeEvent = new LifeEvent();
    lifeEvent.rt(time);
    date = SubmitStandingQueryRequestImpl.getDate(lifeEvent);
    assertThat(date, notNullValue());
    org.codice.alliance.nsili.common.UCO.Date ucoDate = new org.codice.alliance.nsili.common.UCO.Date((short) 2016, (short) 5, (short) 15);
    AbsTime absTime = new AbsTime();
    absTime.aDate = ucoDate;
    absTime.aTime = time;
    lifeEvent = new LifeEvent();
    lifeEvent.at(absTime);
    date = SubmitStandingQueryRequestImpl.getDate(lifeEvent);
    assertThat(date, notNullValue());
    lifeEvent = new LifeEvent();
    lifeEvent.ev("test");
    date = SubmitStandingQueryRequestImpl.getDate(lifeEvent);
    assertThat(date, nullValue());
}
Also used : AbsTime(org.codice.alliance.nsili.common.UCO.AbsTime) DayEventTime(org.codice.alliance.nsili.common.GIAS.DayEventTime) Time(org.codice.alliance.nsili.common.UCO.Time) AbsTime(org.codice.alliance.nsili.common.UCO.AbsTime) DayEventTime(org.codice.alliance.nsili.common.GIAS.DayEventTime) LifeEvent(org.codice.alliance.nsili.common.GIAS.LifeEvent) Date(java.util.Date) Test(org.junit.Test)

Example 2 with DayEventTime

use of org.codice.alliance.nsili.common.GIAS.DayEventTime in project alliance by codice.

the class SubmitStandingQueryRequestImpl method printLifeEvent.

private void printLifeEvent(LifeEvent lifeEvent) {
    String discriminatorText = getLifeEventDiscriminator(lifeEvent.discriminator());
    Date atDate = null;
    String relTimeStr = null;
    String dayEventTimeStr = null;
    String dayEventStr = null;
    String event = null;
    if (lifeEvent.discriminator() == LifeEventType.ABSOLUTE_TIME) {
        AbsTime atTime = lifeEvent.at();
        atDate = convertAbsTime(atTime);
    } else if (lifeEvent.discriminator() == LifeEventType.RELATIVE_TIME) {
        Time relTime = lifeEvent.rt();
        relTimeStr = relTime.hour + ":" + relTime.minute + ":" + relTime.second;
    } else if (lifeEvent.discriminator() == LifeEventType.NAMED_EVENT) {
        event = lifeEvent.ev();
    } else if (lifeEvent.discriminator() == LifeEventType.DAY_EVENT_TIME) {
        DayEventTime dayEventTime = lifeEvent.day_event();
        dayEventStr = getDayEvent(dayEventTime.day_event);
        dayEventTimeStr = dayEventTime.time.hour + ":" + dayEventTime.time.minute + ":" + dayEventTime.time.second;
    }
    LOGGER.trace("\t\tDiscriminator: {}", discriminatorText);
    if (atDate != null) {
        LOGGER.trace("\t\tAt Time: {}", atDate);
    }
    LOGGER.trace("\t\tRel Time: {}", relTimeStr);
    LOGGER.trace("\t\tEvent: {}", event);
    LOGGER.trace("\t\tDayEvent: {}, time: {}", dayEventStr, dayEventTimeStr);
}
Also used : AbsTime(org.codice.alliance.nsili.common.UCO.AbsTime) DayEventTime(org.codice.alliance.nsili.common.GIAS.DayEventTime) Time(org.codice.alliance.nsili.common.UCO.Time) AbsTime(org.codice.alliance.nsili.common.UCO.AbsTime) LocalDateTime(java.time.LocalDateTime) DayEventTime(org.codice.alliance.nsili.common.GIAS.DayEventTime) DateTime(org.joda.time.DateTime) Date(java.util.Date)

Example 3 with DayEventTime

use of org.codice.alliance.nsili.common.GIAS.DayEventTime in project alliance by codice.

the class SubmitStandingQueryRequestImplTest method convertDayEventTime.

@Test
public void convertDayEventTime() {
    Time time = new Time((short) 15, (short) 30, 25);
    DayEventTime dayEventTime = new DayEventTime();
    dayEventTime.time = time;
    dayEventTime.day_event = DayEvent.END_OF_MONTH;
    Date testDate = SubmitStandingQueryRequestImpl.convertDayEventTime(dayEventTime);
    assertThat(testDate, notNullValue());
    dayEventTime.day_event = DayEvent.FIRST_OF_MONTH;
    testDate = SubmitStandingQueryRequestImpl.convertDayEventTime(dayEventTime);
    assertThat(testDate, notNullValue());
    dayEventTime.day_event = DayEvent.MON;
    testDate = SubmitStandingQueryRequestImpl.convertDayEventTime(dayEventTime);
    assertThat(testDate, notNullValue());
    dayEventTime.day_event = DayEvent.TUE;
    testDate = SubmitStandingQueryRequestImpl.convertDayEventTime(dayEventTime);
    assertThat(testDate, notNullValue());
    dayEventTime.day_event = DayEvent.WED;
    testDate = SubmitStandingQueryRequestImpl.convertDayEventTime(dayEventTime);
    assertThat(testDate, notNullValue());
    dayEventTime.day_event = DayEvent.THU;
    testDate = SubmitStandingQueryRequestImpl.convertDayEventTime(dayEventTime);
    assertThat(testDate, notNullValue());
    dayEventTime.day_event = DayEvent.FRI;
    testDate = SubmitStandingQueryRequestImpl.convertDayEventTime(dayEventTime);
    assertThat(testDate, notNullValue());
    dayEventTime.day_event = DayEvent.SAT;
    testDate = SubmitStandingQueryRequestImpl.convertDayEventTime(dayEventTime);
    assertThat(testDate, notNullValue());
    dayEventTime.day_event = DayEvent.SUN;
    testDate = SubmitStandingQueryRequestImpl.convertDayEventTime(dayEventTime);
    assertThat(testDate, notNullValue());
}
Also used : DayEventTime(org.codice.alliance.nsili.common.GIAS.DayEventTime) Time(org.codice.alliance.nsili.common.UCO.Time) AbsTime(org.codice.alliance.nsili.common.UCO.AbsTime) DayEventTime(org.codice.alliance.nsili.common.GIAS.DayEventTime) Date(java.util.Date) Test(org.junit.Test)

Aggregations

Date (java.util.Date)3 DayEventTime (org.codice.alliance.nsili.common.GIAS.DayEventTime)3 AbsTime (org.codice.alliance.nsili.common.UCO.AbsTime)3 Time (org.codice.alliance.nsili.common.UCO.Time)3 Test (org.junit.Test)2 LocalDateTime (java.time.LocalDateTime)1 LifeEvent (org.codice.alliance.nsili.common.GIAS.LifeEvent)1 DateTime (org.joda.time.DateTime)1