View Javadoc

1   /**
2    * Copyright 2004-2012 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.hr.time.person.dao;
17  
18  import java.util.LinkedList;
19  import java.util.List;
20  
21  import org.apache.log4j.Logger;
22  import org.kuali.hr.time.person.TKPerson;
23  import org.kuali.rice.core.framework.persistence.ojb.dao.PlatformAwareDaoBaseOjb;
24  import org.kuali.rice.kim.api.identity.Person;
25  import org.kuali.rice.kim.api.services.KimApiServiceLocator;
26  
27  public class PersonDaoSpringOjbImpl extends PlatformAwareDaoBaseOjb implements PersonDao {
28  
29      private static final Logger LOG = Logger.getLogger(PersonDaoSpringOjbImpl.class);
30  
31      public List<TKPerson> getPersonCollection(List<String> principalIds) {
32  
33          List<TKPerson> persons = new LinkedList<TKPerson>();
34  
35          for (String principalId : principalIds) {
36              Person p = KimApiServiceLocator.getPersonService().getPerson(principalId);
37              if (p != null) {
38                  TKPerson person = new TKPerson();
39                  person.setPrincipalId(p.getPrincipalId());
40                  person.setFirstName(p.getFirstName());
41                  person.setLastName(p.getLastName());
42                  person.setPrincipalName(p.getName());
43                  persons.add(person);
44              }
45          }
46          return persons;
47      }
48  
49  }