source: ccr/trunk/nhin-vista/projects/NHINC/Current/Product/Production/Adapters/General/MpiLib/src/gov/hhs/fha/nhinc/mpilib/Identifiers.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.6 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.mpilib;
6
7import java.util.ArrayList;
8import org.apache.commons.logging.Log;
9import org.apache.commons.logging.LogFactory;
10
11/**
12 *
13 * @author rayj
14 */
15public class Identifiers extends ArrayList<Identifier> implements java.io.Serializable {
16 private static Log log = LogFactory.getLog(Identifiers.class);
17 static final long serialVersionUID = -917875998116976597L;
18
19 public Identifiers() {
20 log.info("Identifiers Initiated..");
21 }
22
23 public boolean add(Identifiers identifiers) {
24 for (Identifier identifier : identifiers) {
25 add(identifier);
26 }
27 return true;
28 }
29
30 @Override
31 public boolean add(Identifier identifier) {
32 //check to see if this id already exists
33 Identifier myIdentifier = null;
34
35 if (!doesIdentifierExist(identifier) ) {
36 myIdentifier = new Identifier(identifier.getId(), identifier.getOrganizationId());
37 super.add(myIdentifier);
38 }
39 return true;
40 }
41
42 private boolean doesIdentifierExist(Identifier identifier) {
43 boolean found = false;
44 for (Identifier existingId : this) {
45 if ((existingId.getOrganizationId().contentEquals(identifier.getOrganizationId()) && (existingId.getId().contentEquals(identifier.getId())))) {
46 found = true;
47 }
48 }
49 return found;
50 }
51
52 public boolean add(String id, String organization) {
53 return add(new Identifier(id, organization));
54 }
55}
Note: See TracBrowser for help on using the repository browser.