source: ccr/trunk/nhin-vista/projects/NHINC/Current/Product/Production/Common/NhincLib/src/gov/hhs/fha/nhinc/util/HomeCommunityMap.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: 1.7 KB
Line 
1package gov.hhs.fha.nhinc.util;
2
3
4
5import org.apache.commons.logging.Log;
6import org.apache.commons.logging.LogFactory;
7import gov.hhs.fha.nhinc.connectmgr.ConnectionManagerCache;
8import gov.hhs.fha.nhinc.connectmgr.data.CMBusinessEntity;
9
10/**
11 * This class is used to map a home community ID to the
12 * textual name of the home community. The information
13 * is stored in a properties file so that it can be tweaked
14 * and changed without having to recompile...
15 *
16 * @author Les Westberg
17 */
18public class HomeCommunityMap
19{
20 private static Log log = LogFactory.getLog(HomeCommunityMap.class);
21
22 /**
23 * This method retrieves the name of the home community baased on the
24 * home community Id.
25 *
26 * @param sHomeCommunityId The home community ID to be looked up.
27 * @return The textual name of the home community.
28 */
29 public String getHomeCommunityName(String sHomeCommunityId)
30 {
31 String sHomeCommunityName = "";
32
33 try
34 {
35 CMBusinessEntity oEntity = ConnectionManagerCache.getBusinessEntity(sHomeCommunityId);
36 if ((oEntity != null) &&
37 (oEntity.getNames() != null) &&
38 (oEntity.getNames().getBusinessName() != null) &&
39 (oEntity.getNames().getBusinessName().size() > 0) &&
40 (oEntity.getNames().getBusinessName().get(0) != null) &&
41 (oEntity.getNames().getBusinessName().get(0).length() > 0))
42 {
43 sHomeCommunityName = oEntity.getNames().getBusinessName().get(0);
44 }
45 }
46 catch (Exception e)
47 {
48 log.warn("Failed to retrieve textual name for home community ID: " + sHomeCommunityId, e);
49 }
50
51 return sHomeCommunityName;
52 }
53}
Note: See TracBrowser for help on using the repository browser.