Search in sources :

Example 1 with AbsTime

use of org.codice.alliance.nsili.common.UCO.AbsTime in project alliance by codice.

the class CorbaUtils method convertDate.

public static Date convertDate(Any any) {
    AbsTime absTime = AbsTimeHelper.extract(any);
    org.codice.alliance.nsili.common.UCO.Date ucoDate = absTime.aDate;
    org.codice.alliance.nsili.common.UCO.Time ucoTime = absTime.aTime;
    DateTime dateTime = new DateTime((int) ucoDate.year, (int) ucoDate.month, (int) ucoDate.day, (int) ucoTime.hour, (int) ucoTime.minute, (int) ucoTime.second, 0);
    return dateTime.toDate();
}
Also used : AbsTime(org.codice.alliance.nsili.common.UCO.AbsTime) DateTime(org.joda.time.DateTime)

Example 2 with AbsTime

use of org.codice.alliance.nsili.common.UCO.AbsTime in project alliance by codice.

the class SampleNsiliClient method createFileOrder.

private OrderContents createFileOrder(Product product, String[] supportedPackagingSpecs, String filename) throws Exception {
    NameName[] nameName = { new NameName("", "") };
    String orderPackageId = UUID.randomUUID().toString();
    TailoringSpec tailoringSpec = new TailoringSpec(nameName);
    PackagingSpec pSpec = new PackagingSpec(orderPackageId, supportedPackagingSpecs[0]);
    Calendar cal = Calendar.getInstance();
    cal.setTime(new java.util.Date());
    int year = cal.get(Calendar.YEAR);
    year++;
    AbsTime needByDate = new AbsTime(new Date((short) year, (short) 2, (short) 10), new Time((short) 10, (short) 0, (short) 0));
    MediaType[] mTypes = { new MediaType("", (short) 1) };
    String[] benums = new String[0];
    Rectangle region = new Rectangle(new Coordinate2d(1.1, 1.1), new Coordinate2d(2.2, 2.2));
    ImageSpec imageSpec = new ImageSpec();
    imageSpec.encoding = SupportDataEncoding.ASCII;
    imageSpec.rrds = new short[] { 1 };
    imageSpec.algo = "";
    imageSpec.bpp = 0;
    imageSpec.comp = "A";
    imageSpec.imgform = "A";
    imageSpec.imageid = "1234abc";
    imageSpec.geo_region_type = GeoRegionType.LAT_LON;
    Rectangle subSection = new Rectangle();
    subSection.lower_right = new Coordinate2d(0, 0);
    subSection.upper_left = new Coordinate2d(1, 1);
    imageSpec.sub_section = subSection;
    Any imageSpecAny = orb.create_any();
    ImageSpecHelper.insert(imageSpecAny, imageSpec);
    AlterationSpec aSpec = new AlterationSpec("JPEG", imageSpecAny, region, GeoRegionType.NULL_REGION);
    FileLocation fileLocation = new FileLocation("user", "pass", "localhost", "/nsili/file", filename);
    Destination destination = new Destination();
    destination.f_dest(fileLocation);
    ProductDetails[] productDetails = { new ProductDetails(mTypes, benums, aSpec, product, ALLIANCE) };
    DeliveryDetails[] deliveryDetails = { new DeliveryDetails(destination, "", "") };
    return new OrderContents(ALLIANCE, tailoringSpec, pSpec, needByDate, "Give me an order!", (short) 1, productDetails, deliveryDetails);
}
Also used : Destination(org.codice.alliance.nsili.common.GIAS.Destination) DeliveryDetails(org.codice.alliance.nsili.common.GIAS.DeliveryDetails) Rectangle(org.codice.alliance.nsili.common.UCO.Rectangle) Time(org.codice.alliance.nsili.common.UCO.Time) AbsTime(org.codice.alliance.nsili.common.UCO.AbsTime) ImageSpec(org.codice.alliance.nsili.common.GIAS.ImageSpec) Any(org.omg.CORBA.Any) AlterationSpec(org.codice.alliance.nsili.common.GIAS.AlterationSpec) AbsTime(org.codice.alliance.nsili.common.UCO.AbsTime) Coordinate2d(org.codice.alliance.nsili.common.UCO.Coordinate2d) ProductDetails(org.codice.alliance.nsili.common.GIAS.ProductDetails) MediaType(org.codice.alliance.nsili.common.GIAS.MediaType) NameName(org.codice.alliance.nsili.common.UCO.NameName) PackagingSpec(org.codice.alliance.nsili.common.GIAS.PackagingSpec) Calendar(java.util.Calendar) Date(org.codice.alliance.nsili.common.UCO.Date) TailoringSpec(org.codice.alliance.nsili.common.GIAS.TailoringSpec) OrderContents(org.codice.alliance.nsili.common.GIAS.OrderContents) FileLocation(org.codice.alliance.nsili.common.UCO.FileLocation)

Example 3 with AbsTime

use of org.codice.alliance.nsili.common.UCO.AbsTime in project alliance by codice.

the class StandingQueryMgrImplTest method testSubmitStandingQuery.

@Test
public void testSubmitStandingQuery() throws InvalidInputParameter, SystemFault, ProcessingFault {
    String[] resultAttributes = new String[0];
    SortAttribute[] sortAttributes = new SortAttribute[0];
    LifeEvent start = new LifeEvent();
    start.at(LifeEventType.ABSOLUTE_TIME, new AbsTime(new Date((short) 2016, (short) 05, (short) 01), new Time((short) 00, (short) 00, (short) 00)));
    LifeEvent stop = new LifeEvent();
    stop.at(LifeEventType.ABSOLUTE_TIME, new AbsTime(new Date((short) 2050, (short) 05, (short) 01), new Time((short) 00, (short) 00, (short) 00)));
    LifeEvent frequency1 = new LifeEvent();
    frequency1.rt(LifeEventType.RELATIVE_TIME, new Time((short) 00, (short) 01, (short) 00));
    LifeEvent[] frequency = new LifeEvent[] { frequency1 };
    QueryLifeSpan lifeSpan = new QueryLifeSpan(start, stop, frequency);
    Query query = new Query(NsiliConstants.NSIL_ALL_VIEW, bqsQuery);
    SubmitStandingQueryRequest request = standingQueryMgr.submit_standing_query(query, resultAttributes, sortAttributes, lifeSpan, new NameValue[0]);
    assertThat(request, notNullValue());
}
Also used : SubmitStandingQueryRequest(org.codice.alliance.nsili.common.GIAS.SubmitStandingQueryRequest) AbsTime(org.codice.alliance.nsili.common.UCO.AbsTime) SortAttribute(org.codice.alliance.nsili.common.GIAS.SortAttribute) Query(org.codice.alliance.nsili.common.GIAS.Query) QueryLifeSpan(org.codice.alliance.nsili.common.GIAS.QueryLifeSpan) LifeEvent(org.codice.alliance.nsili.common.GIAS.LifeEvent) Time(org.codice.alliance.nsili.common.UCO.Time) AbsTime(org.codice.alliance.nsili.common.UCO.AbsTime) Date(org.codice.alliance.nsili.common.UCO.Date) Test(org.junit.Test)

Example 4 with AbsTime

use of org.codice.alliance.nsili.common.UCO.AbsTime 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 5 with AbsTime

use of org.codice.alliance.nsili.common.UCO.AbsTime in project alliance by codice.

the class ResultDAGConverter method getAbsTime.

public static AbsTime getAbsTime(Date date) {
    Calendar cal = new GregorianCalendar();
    cal.setTime(date);
    return new AbsTime(new org.codice.alliance.nsili.common.UCO.Date((short) cal.get(Calendar.YEAR), (short) (cal.get(Calendar.MONTH) + 1), (short) cal.get(Calendar.DAY_OF_MONTH)), new Time((short) cal.get(Calendar.HOUR_OF_DAY), (short) cal.get(Calendar.MINUTE), (short) cal.get(Calendar.SECOND)));
}
Also used : AbsTime(org.codice.alliance.nsili.common.UCO.AbsTime) GregorianCalendar(java.util.GregorianCalendar) Calendar(java.util.Calendar) GregorianCalendar(java.util.GregorianCalendar) Time(org.codice.alliance.nsili.common.UCO.Time) DateTime(ddf.catalog.data.types.DateTime) AbsTime(org.codice.alliance.nsili.common.UCO.AbsTime)

Aggregations

AbsTime (org.codice.alliance.nsili.common.UCO.AbsTime)10 Time (org.codice.alliance.nsili.common.UCO.Time)6 Test (org.junit.Test)4 Calendar (java.util.Calendar)3 Date (org.codice.alliance.nsili.common.UCO.Date)3 Any (org.omg.CORBA.Any)3 Date (java.util.Date)2 AlterationSpec (org.codice.alliance.nsili.common.GIAS.AlterationSpec)2 DayEventTime (org.codice.alliance.nsili.common.GIAS.DayEventTime)2 DeliveryDetails (org.codice.alliance.nsili.common.GIAS.DeliveryDetails)2 Destination (org.codice.alliance.nsili.common.GIAS.Destination)2 ImageSpec (org.codice.alliance.nsili.common.GIAS.ImageSpec)2 LifeEvent (org.codice.alliance.nsili.common.GIAS.LifeEvent)2 MediaType (org.codice.alliance.nsili.common.GIAS.MediaType)2 OrderContents (org.codice.alliance.nsili.common.GIAS.OrderContents)2 PackagingSpec (org.codice.alliance.nsili.common.GIAS.PackagingSpec)2 ProductDetails (org.codice.alliance.nsili.common.GIAS.ProductDetails)2 TailoringSpec (org.codice.alliance.nsili.common.GIAS.TailoringSpec)2 Coordinate2d (org.codice.alliance.nsili.common.UCO.Coordinate2d)2 NameName (org.codice.alliance.nsili.common.UCO.NameName)2