/** * @param contactInfoEl * context {@link OMElement} * @return an {@link ContactInfo} instance, never <code>null</code> */ protected ContactInfo parseContactInfo( OMElement contactInfoEl ) { ContactInfo contactInfo = new ContactInfo(); XPath xpath = new XPath( "ows:Phone", nsContext ); Telephone phone = parsePhone( getElement( contactInfoEl, xpath ) ); contactInfo.setPhone( phone ); xpath = new XPath( "ows:Address", nsContext ); OMElement addressEl = getElement( contactInfoEl, xpath ); contactInfo.setAddress( parseAddress( addressEl ) ); xpath = new XPath( "ows:OnlineResource/@xlink:href", nsContext ); contactInfo.setOnlineResource( getNodeAsURL( contactInfoEl, xpath, null ) ); xpath = new XPath( "ows:HoursOfService", nsContext ); contactInfo.setHoursOfService( getNodeAsString( contactInfoEl, xpath, null ) ); xpath = new XPath( "ows:ContactInstructions", nsContext ); contactInfo.setContactInstructions( getNodeAsString( contactInfoEl, xpath, null ) ); return contactInfo; }
if ( serviceContact.getPhone() != null ) { writer.writeStartElement( owsNS, "Phone" ); if ( !serviceContact.getPhone().getVoice().isEmpty() ) { writeOptionalElement( writer, owsNS, "Voice", serviceContact.getPhone().getVoice().get( 0 ) ); if ( !serviceContact.getPhone().getFacsimile().isEmpty() ) { writeOptionalElement( writer, owsNS, "Facsimile", serviceContact.getPhone().getFacsimile().get( 0 ) ); Address address = serviceContact.getAddress(); if ( address != null ) { writer.writeStartElement( owsNS, "Address" ); if ( serviceContact.getOnlineResource() != null && !"".equals( serviceContact.getOnlineResource().toString().trim() ) ) { writer.writeAttribute( XLN_NS, "href", serviceContact.getOnlineResource().toString().trim() ); writer.writeEndElement(); writeOptionalElement( writer, owsNS, "HoursOfService", serviceContact.getHoursOfService() ); writeOptionalElement( writer, owsNS, "ContactInstructions", serviceContact.getContactInstruction() );
final Address addr = contact.getContactInfo().getAddress(); if ( addr != null && addr.isPhysicalInfoAvailable() ) { writer.writeStartElement( WMSNS, "ContactAddress" ); contact.getContactInfo().getPhone().getVoice().get( 0 ) ); maybeWriteElementNS( writer, WMSNS, "ContactFacsimileTelephone", contact.getContactInfo().getPhone().getFacsimile().get( 0 ) ); if ( addr != null && !addr.getElectronicMailAddress().isEmpty() ) { maybeWriteElementNS( writer, WMSNS, "ContactElectronicMailAddress",
private String getServiceUrl() { String url = getUrl; if ( provider != null && provider.getServiceContact() != null && provider.getServiceContact().getContactInfo() != null && provider.getServiceContact().getContactInfo().getOnlineResource() != null ) { url = provider.getServiceContact().getContactInfo().getOnlineResource().toExternalForm(); } return url; }
final Address addr = contact.getContactInfo().getAddress(); if ( addr != null && addr.isPhysicalInfoAvailable() ) { writer.writeStartElement( "ContactAddress" ); contact.getContactInfo().getPhone().getVoice().get( 0 ) ); maybeWriteElement( writer, "ContactFacsimileTelephone", contact.getContactInfo().getPhone().getFacsimile().get( 0 ) ); if ( addr != null && !addr.getElectronicMailAddress().isEmpty() ) { maybeWriteElement( writer, "ContactElectronicMailAddress", addr.getElectronicMailAddress().get( 0 ) );
private String getServiceUrl() { String url = getUrl; if ( provider != null && provider.getServiceContact() != null && provider.getServiceContact().getContactInfo() != null && provider.getServiceContact().getContactInfo().getOnlineResource() != null ) { url = provider.getServiceContact().getContactInfo().getOnlineResource().toExternalForm(); } return url; }
public static ResponsibleParty convertFromJAXB( ServiceContactType sc ) { if ( sc == null ) { return null; } ResponsibleParty res = new ResponsibleParty(); res.setIndividualName( sc.getIndividualName() ); res.setPositionName( sc.getPositionName() ); res.setRole( new CodeType( sc.getRole() ) ); ContactInfo info = new ContactInfo(); info.setContactInstructions( sc.getContactInstructions() ); info.setHoursOfService( sc.getHoursOfService() ); try { info.setOnlineResource( new URL( sc.getOnlineResource() ) ); } catch ( MalformedURLException e ) { // ignore this, schemas should be fixed so it already is an URL } Telephone phone = new Telephone(); phone.setFacsimile( Collections.singletonList( sc.getFacsimile() ) ); phone.setVoice( Collections.singletonList( sc.getPhone() ) ); info.setPhone( phone ); Address ad = convertFromJAXB( sc.getAddress() ); if ( ad != null ) { ad.setElectronicMailAddress( sc.getElectronicMailAddress() ); info.setAddress( ad ); } res.setContactInfo( info ); return res; }