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();
}
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);
}
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());
}
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());
}
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)));
}
Aggregations