/* * #%L * Service Activity Monitoring :: Agent * %% * 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% */ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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. */ package org.talend.esb.sam.agent.eventproducer; 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) { String name = customer.getName(); try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } return; } }