View Javadoc

1   /*
2    * #%L
3    * ToPIA :: Persistence
4    * 
5    * $Id: Contact2DAOImpl.java 2245 2011-04-14 12:47:09Z tchemit $
6    * $HeadURL: http://svn.nuiton.org/svn/topia/tags/topia-2.8/topia-persistence/src/test/java/org/nuiton/topiatest/deletetest/Contact2DAOImpl.java $
7    * %%
8    * Copyright (C) 2004 - 2010 CodeLutin
9    * %%
10   * This program is free software: you can redistribute it and/or modify
11   * it under the terms of the GNU Lesser General Public License as 
12   * published by the Free Software Foundation, either version 3 of the 
13   * License, or (at your option) any later version.
14   * 
15   * This program is distributed in the hope that it will be useful,
16   * but WITHOUT ANY WARRANTY; without even the implied warranty of
17   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18   * GNU General Lesser Public License for more details.
19   * 
20   * You should have received a copy of the GNU General Lesser Public 
21   * License along with this program.  If not, see
22   * <http://www.gnu.org/licenses/lgpl-3.0.html>.
23   * #L%
24   */
25  
26  package org.nuiton.topiatest.deletetest;
27  
28  
29  import java.util.Set;
30  import java.util.TreeSet;
31  import org.nuiton.topia.TopiaException;
32  import org.nuiton.topiatest.Company;
33  import org.nuiton.topiatest.Employe;
34  
35  /**
36   *
37   * @author desbois
38   */
39  public class Contact2DAOImpl<E extends Contact2> extends Contact2DAOAbstract<E> {
40  
41      @Override
42      public Set<Contact2> findAllByCompany(Company company) throws TopiaException {
43          Set<Contact2> contacts = new TreeSet<Contact2>();
44          for (Employe e : company.getEmploye()) {
45              contacts.addAll(e.getContacts());
46          }
47          return contacts;
48      }
49    
50  }