source: ccr/trunk/nhin-vista/projects/NHINC/Current/Product/Production/Gateway/PatientCorrelationFacadeDteEjb/src/java/gov/hhs/fha/nhinc/common/patientcorrelationfacade/dte/helpers/AssigningAuthorityHomeCommunityMappingHelper.java@ 507

Last change on this file since 507 was 507, checked in by George Lilly, 15 years ago

NHIN gateway and adaptor for use on linux with VistA EHR and RPMS

File size: 2.4 KB
Line 
1/*
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
4 */
5package gov.hhs.fha.nhinc.common.patientcorrelationfacade.dte.helpers;
6
7import gov.hhs.fha.nhinc.common.connectionmanager.dao.AssigningAuthorityHomeCommunityMappingDAO;
8import java.util.ArrayList;
9import java.util.List;
10import org.apache.commons.logging.Log;
11import org.apache.commons.logging.LogFactory;
12import gov.hhs.fha.nhinc.nhinclib.NullChecker;
13
14/**
15 *
16 * @author rayj
17 */
18public class AssigningAuthorityHomeCommunityMappingHelper {
19
20 private static Log log = LogFactory.getLog(AssigningAuthorityHomeCommunityMappingDAO.class);
21
22 public static List<String> lookupAssigningAuthorities(String homeCommunityId) {
23 log.info("converting homeCommunityId [" + homeCommunityId + "] to assigning authority");
24 AssigningAuthorityHomeCommunityMappingDAO mappingDao = new AssigningAuthorityHomeCommunityMappingDAO();
25 //this really should be a list returned, not a single value
26 String assigningAuthorityId = mappingDao.getAssigningAuthority(homeCommunityId);
27 log.info("found assigning authority? [" + assigningAuthorityId + "]");
28
29 List<String> assigningAuthorityIds = new ArrayList<String>();
30 assigningAuthorityIds.add(assigningAuthorityId);
31 return assigningAuthorityIds;
32 }
33
34 public static List<String> lookupAssigningAuthorities(List<String> homeCommunityIds) {
35 List<String> fullListOfAssigningAuthorities=null;
36 if (NullChecker.isNotNullish(homeCommunityIds)) {
37 log.info("converting homeCommunityIds [count=" + homeCommunityIds.size() + "] to assigning authorities");
38 fullListOfAssigningAuthorities = new ArrayList<String>();
39
40 List<String> partialListOfAssigningAuthorities;
41
42 for (String homeCommunity : homeCommunityIds) {
43 partialListOfAssigningAuthorities = lookupAssigningAuthorities(homeCommunity);
44 combineLists(fullListOfAssigningAuthorities, partialListOfAssigningAuthorities);
45 }
46 log.info("converted homeCommunityIds [count=" + homeCommunityIds.size() + "] to assigning authorities [count=" + fullListOfAssigningAuthorities.size() + "]");
47 }
48 return fullListOfAssigningAuthorities;
49 }
50
51 private static List<String> combineLists(List<String> a, List<String> b) {
52 if (a == null) {
53 a = new ArrayList<String>();
54 }
55 a.addAll(b);
56 return a;
57 }
58}
Note: See TracBrowser for help on using the repository browser.