Search in sources :

Example 1 with ValidationFault_Exception

use of org.jboss.test.ws.jaxws.benchmark.test.complex.types.ValidationFault_Exception in project jbossws-cxf by jbossws.

the class RegistrationServiceImpl method bulkRegister.

public List<Long> bulkRegister(List<Customer> customers, Object when) throws AlreadyRegisteredFault_Exception, ValidationFault_Exception {
    List<Long> registered = new ArrayList<Long>(customers.size());
    List<Long> failed = new ArrayList<Long>(customers.size());
    for (Customer c : customers) {
        try {
            registered.add(register(c, when));
        } catch (ValidationFault_Exception e) {
            failed.add(e.getFaultInfo().getFailedCustomers().get(0));
        }
    }
    if (failed.size() > 0) {
        ValidationFault fault = new ValidationFault();
        fault.getFailedCustomers().addAll(failed);
        throw new ValidationFault_Exception("Validation errors on bulk registering customers", fault);
    }
    return registered;
}
Also used : ValidationFault_Exception(org.jboss.test.ws.jaxws.benchmark.test.complex.types.ValidationFault_Exception) ValidationFault(org.jboss.test.ws.jaxws.benchmark.test.complex.types.ValidationFault) InvoiceCustomer(org.jboss.test.ws.jaxws.benchmark.test.complex.types.InvoiceCustomer) Customer(org.jboss.test.ws.jaxws.benchmark.test.complex.types.Customer) ArrayList(java.util.ArrayList)

Example 2 with ValidationFault_Exception

use of org.jboss.test.ws.jaxws.benchmark.test.complex.types.ValidationFault_Exception in project jbossws-cxf by jbossws.

the class RegistrationServiceImpl method register.

public long register(Customer customer, Object when) throws AlreadyRegisteredFault_Exception, ValidationFault_Exception {
    Name name = customer.getName();
    if (name == null) {
        ValidationFault fault = new ValidationFault();
        fault.getFailedCustomers().add(customer.getId());
        throw new ValidationFault_Exception("No name!", fault);
    }
    for (Customer c : customer.getReferredCustomers()) {
        log.trace("Refered customer: " + c.getName());
    }
    log.trace("registering customer: " + customer);
    return customer.getId();
}
Also used : ValidationFault_Exception(org.jboss.test.ws.jaxws.benchmark.test.complex.types.ValidationFault_Exception) ValidationFault(org.jboss.test.ws.jaxws.benchmark.test.complex.types.ValidationFault) InvoiceCustomer(org.jboss.test.ws.jaxws.benchmark.test.complex.types.InvoiceCustomer) Customer(org.jboss.test.ws.jaxws.benchmark.test.complex.types.Customer) Name(org.jboss.test.ws.jaxws.benchmark.test.complex.types.Name)

Aggregations

Customer (org.jboss.test.ws.jaxws.benchmark.test.complex.types.Customer)2 InvoiceCustomer (org.jboss.test.ws.jaxws.benchmark.test.complex.types.InvoiceCustomer)2 ValidationFault (org.jboss.test.ws.jaxws.benchmark.test.complex.types.ValidationFault)2 ValidationFault_Exception (org.jboss.test.ws.jaxws.benchmark.test.complex.types.ValidationFault_Exception)2 ArrayList (java.util.ArrayList)1 Name (org.jboss.test.ws.jaxws.benchmark.test.complex.types.Name)1