001
002/*
003 * Copyright (C) 2010 Archie L. Cobbs. All rights reserved.
004 *
005 * $Id$
006 */
007
008package org.dellroad.jibxbindings.pidf.lo.ecd;
009
010import java.net.URI;
011import java.util.ArrayList;
012import java.util.Arrays;
013import java.util.List;
014
015import org.dellroad.jibxbindings.vcard.VCardMarshaller;
016
017import ezvcard.VCard;
018
019/**
020 * The {@code <pi:EmergencyCallData.ProviderInfo>} element.
021 */
022public class ProviderInfo extends AbstractDataProviderReferencing {
023
024    private String dataProviderString;                      // mandatory
025    private String providerId;
026    private String providerIdSeries;
027    private String typeOfProvider;
028    private URI contactURI;                                 // mandatory
029    private List<String> languages = new ArrayList<>();     // mandatory (one or more)
030    private VCard dataProviderContact;
031    private String subcontratorPrincipal;
032    private SubcontractorPriority subcontratorPriority;
033
034    public ProviderInfo() {
035    }
036
037    public ProviderInfo(String dataProviderReference, URI contactURI, String... languages) {
038        super(dataProviderReference);
039        this.setContactURI(contactURI);
040        this.languages.addAll(Arrays.asList(languages));
041    }
042
043    public String getDataProviderString() {
044        return this.dataProviderString;
045    }
046    public void setDataProviderString(String dataProviderString) {
047        this.dataProviderString = dataProviderString;
048    }
049
050    public String getProviderId() {
051        return this.providerId;
052    }
053    public void setProviderId(String providerId) {
054        this.providerId = providerId;
055    }
056
057    public String getProviderIdSeries() {
058        return this.providerIdSeries;
059    }
060    public void setProviderIdSeries(String providerIdSeries) {
061        this.providerIdSeries = providerIdSeries;
062    }
063
064    public String getTypeOfProvider() {
065        return this.typeOfProvider;
066    }
067    public void setTypeOfProvider(String typeOfProvider) {
068        this.typeOfProvider = typeOfProvider;
069    }
070
071    public URI getContactURI() {
072        return this.contactURI;
073    }
074    public void setContactURI(URI contactURI) {
075        this.contactURI = contactURI;
076    }
077
078    public List<String> getLanguages() {
079        return this.languages;
080    }
081    public void setLanguages(List<String> languages) {
082        this.languages = languages;
083    }
084
085    public VCard getDataProviderContact() {
086        return this.dataProviderContact;
087    }
088    public void setDataProviderContact(VCard dataProviderContact) {
089        this.dataProviderContact = dataProviderContact;
090    }
091
092    public String getSubcontratorPrincipal() {
093        return this.subcontratorPrincipal;
094    }
095    public void setSubcontratorPrincipal(String subcontratorPrincipal) {
096        this.subcontratorPrincipal = subcontratorPrincipal;
097    }
098
099    public SubcontractorPriority getSubcontratorPriority() {
100        return this.subcontratorPriority;
101    }
102    public void setSubcontratorPriority(SubcontractorPriority subcontratorPriority) {
103        this.subcontratorPriority = subcontratorPriority;
104    }
105
106// JiBX
107
108    public boolean hasDataProviderContact() {
109        return this.getDataProviderContact() != null;
110    }
111
112// Cloneable
113
114    @Override
115    public ProviderInfo clone() {
116        final ProviderInfo clone = (ProviderInfo)super.clone();
117        clone.languages = this.languages != null ? new ArrayList<>(this.languages) : null;
118        clone.dataProviderContact = this.dataProviderContact != null ? VCardMarshaller.clone(this.dataProviderContact) : null;
119        return clone;
120    }
121}
122