Search in sources :

Example 1 with OrderRequestImpl

use of org.codice.alliance.nsili.endpoint.requests.OrderRequestImpl in project alliance by codice.

the class OrderMgrImpl method order.

@Override
public OrderRequest order(OrderContents order, NameValue[] properties) throws ProcessingFault, InvalidInputParameter, SystemFault {
    String protocol = "http";
    int port = 80;
    for (NameValue prop : properties) {
        if (prop.aname.equals(NsiliConstants.PROP_PROTOCOL)) {
            protocol = DAGConverter.getString(prop.value);
        } else if (prop.aname.equals(NsiliConstants.PROP_PORT)) {
            Integer portInteger = DAGConverter.getInteger(prop.value);
            if (portInteger != null) {
                port = portInteger;
            }
        }
    }
    OrderRequestImpl orderRequestImpl = new OrderRequestImpl(order, protocol, port, getAccessManager(), catalogFramework, emailConfiguration);
    String id = UUID.randomUUID().toString();
    try {
        _poa().activate_object_with_id(id.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), orderRequestImpl);
    } catch (ServantAlreadyActive | ObjectAlreadyActive | WrongPolicy e) {
        LOGGER.debug("order : Unable to activate orderRequest object.", e);
    }
    org.omg.CORBA.Object obj = _poa().create_reference_with_id(id.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), OrderRequestHelper.id());
    OrderRequest orderRequest = OrderRequestHelper.narrow(obj);
    return orderRequest;
}
Also used : ObjectAlreadyActive(org.omg.PortableServer.POAPackage.ObjectAlreadyActive) OrderRequest(org.codice.alliance.nsili.common.GIAS.OrderRequest) NsiliEndpoint(org.codice.alliance.nsili.endpoint.NsiliEndpoint) NameValue(org.codice.alliance.nsili.common.UCO.NameValue) WrongPolicy(org.omg.PortableServer.POAPackage.WrongPolicy) OrderRequestImpl(org.codice.alliance.nsili.endpoint.requests.OrderRequestImpl) ServantAlreadyActive(org.omg.PortableServer.POAPackage.ServantAlreadyActive)

Aggregations

OrderRequest (org.codice.alliance.nsili.common.GIAS.OrderRequest)1 NameValue (org.codice.alliance.nsili.common.UCO.NameValue)1 NsiliEndpoint (org.codice.alliance.nsili.endpoint.NsiliEndpoint)1 OrderRequestImpl (org.codice.alliance.nsili.endpoint.requests.OrderRequestImpl)1 ObjectAlreadyActive (org.omg.PortableServer.POAPackage.ObjectAlreadyActive)1 ServantAlreadyActive (org.omg.PortableServer.POAPackage.ServantAlreadyActive)1 WrongPolicy (org.omg.PortableServer.POAPackage.WrongPolicy)1