Search in sources :

Example 1 with SubmitStandingQueryRequest

use of org.codice.alliance.nsili.common.GIAS.SubmitStandingQueryRequest 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 2 with SubmitStandingQueryRequest

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

the class StandingQueryMgrImpl method submit_standing_query.

@Override
public SubmitStandingQueryRequest submit_standing_query(Query aQuery, String[] result_attributes, SortAttribute[] sort_attributes, QueryLifeSpan lifespan, NameValue[] properties) throws InvalidInputParameter, ProcessingFault, SystemFault {
    if (aQuery == null) {
        InvalidInputParameter except = new InvalidInputParameter();
        exception_details details = new exception_details();
        details.exception_name = "No Query Specified";
        details.exception_desc = "Query must be specified for standing query request";
        except.details = details;
        throw except;
    }
    LOGGER.debug("Registering Standing Query View: {}, BQS: {}", aQuery.view, aQuery.bqs_query);
    SubmitStandingQueryRequestImpl standingQueryRequest = new SubmitStandingQueryRequestImpl(aQuery, result_attributes, sort_attributes, lifespan, properties, catalogFramework, filterBuilder, defaultUpdateFrequencyMsec, querySources, maxPendingResults, removeSourceLibrary, outgoingValidationEnabled, maxWaitToStartTimeMsecs);
    String id = UUID.randomUUID().toString();
    try {
        _poa().activate_object_with_id(id.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), standingQueryRequest);
    } catch (ServantAlreadyActive | ObjectAlreadyActive | WrongPolicy e) {
        LOGGER.debug("submit_standing_query : Unable to activate submitStandingQueryRequest object.", e);
    }
    org.omg.CORBA.Object obj = _poa().create_reference_with_id(id.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), SubmitStandingQueryRequestHelper.id());
    SubmitStandingQueryRequest submitStandingQueryRequest = SubmitStandingQueryRequestHelper.narrow(obj);
    return submitStandingQueryRequest;
}
Also used : SubmitStandingQueryRequest(org.codice.alliance.nsili.common.GIAS.SubmitStandingQueryRequest) WrongPolicy(org.omg.PortableServer.POAPackage.WrongPolicy) UCO.exception_details(org.codice.alliance.nsili.common.UCO.exception_details) ObjectAlreadyActive(org.omg.PortableServer.POAPackage.ObjectAlreadyActive) InvalidInputParameter(org.codice.alliance.nsili.common.UCO.InvalidInputParameter) SubmitStandingQueryRequestImpl(org.codice.alliance.nsili.endpoint.requests.SubmitStandingQueryRequestImpl) ServantAlreadyActive(org.omg.PortableServer.POAPackage.ServantAlreadyActive)

Aggregations

SubmitStandingQueryRequest (org.codice.alliance.nsili.common.GIAS.SubmitStandingQueryRequest)2 LifeEvent (org.codice.alliance.nsili.common.GIAS.LifeEvent)1 Query (org.codice.alliance.nsili.common.GIAS.Query)1 QueryLifeSpan (org.codice.alliance.nsili.common.GIAS.QueryLifeSpan)1 SortAttribute (org.codice.alliance.nsili.common.GIAS.SortAttribute)1 AbsTime (org.codice.alliance.nsili.common.UCO.AbsTime)1 Date (org.codice.alliance.nsili.common.UCO.Date)1 InvalidInputParameter (org.codice.alliance.nsili.common.UCO.InvalidInputParameter)1 Time (org.codice.alliance.nsili.common.UCO.Time)1 UCO.exception_details (org.codice.alliance.nsili.common.UCO.exception_details)1 SubmitStandingQueryRequestImpl (org.codice.alliance.nsili.endpoint.requests.SubmitStandingQueryRequestImpl)1 Test (org.junit.Test)1 ObjectAlreadyActive (org.omg.PortableServer.POAPackage.ObjectAlreadyActive)1 ServantAlreadyActive (org.omg.PortableServer.POAPackage.ServantAlreadyActive)1 WrongPolicy (org.omg.PortableServer.POAPackage.WrongPolicy)1