/*
* #%L
* Service Activity Monitoring :: Example Service2
* %%
* Copyright (C) 2011 - 2012 Talend Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package com.example.customerservice.server;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import com.example.customerservice.Customer;
import com.example.customerservice.CustomerService;
import com.example.customerservice.CustomerType;
import com.example.customerservice.NoSuchCustomer;
import com.example.customerservice.NoSuchCustomerException;
public class CustomerServiceImpl implements CustomerService {
public List<Customer> getCustomersByName(String name) throws NoSuchCustomerException {
if ("None".equals(name)) {
NoSuchCustomer noSuchCustomer = new NoSuchCustomer();
noSuchCustomer.setCustomerName(name);
throw new NoSuchCustomerException("Did not find any matching customer for name=" + name,
noSuchCustomer);
}
List<Customer> customers = new ArrayList<Customer>();
for (int c = 0; c < 2; c++) {
Customer cust = new Customer();
cust.setName(name);
cust.getAddress().add("Pine Street 200");
Date bDate = new GregorianCalendar(2009, 01, 01).getTime();
cust.setBirthDate(bDate);
cust.setNumOrders(1);
cust.setRevenue(1000);
cust.setTest(new BigDecimal(1.5));
cust.setType(CustomerType.BUSINESS);
customers.add(cust);
}
return customers;
}
public void updateCustomer(Customer customer) {
}
}