use of org.opengis.metadata.citation.Telephone in project sis by apache.
the class DefaultContact method getPhone.
/**
* Returns telephone numbers at which the organization or individual may be contacted.
* This method returns the first telephone number associated to {@code TelephoneType.VOICE}
* or {@code TelephoneType.FACSIMILE FACSIMILE}.
*
* @return telephone numbers at which the organization or individual may be contacted, or {@code null}.
*
* @deprecated As of ISO 19115:2014, replaced by {@link #getPhones()}.
*/
@Override
@Deprecated
@Dependencies("getPhones")
@XmlElement(name = "phone", namespace = LegacyNamespaces.GMD)
public Telephone getPhone() {
Telephone phone = null;
if (FilterByVersion.LEGACY_METADATA.accept()) {
final Collection<Telephone> phones = getPhones();
if (phones != null) {
// May be null on marshalling.
CodeList<?> ignored = null;
for (final Telephone c : phones) {
if (c instanceof DefaultTelephone) {
String name;
final CodeList<?> type = ((DefaultTelephone) c).numberType;
if (type != null && ("VOICE".equals(name = type.name()) || "FACSIMILE".equals(name))) {
if (phone == null) {
phone = c;
}
} else if (ignored == null) {
ignored = type;
}
}
}
if (ignored != null) {
Context.warningOccured(Context.current(), DefaultContact.class, "getPhone", Messages.class, Messages.Keys.IgnoredPropertyAssociatedTo_1, ignored);
}
}
}
return phone;
}
Aggregations