/** * @param phoneEl * context {@link OMElement} * @return an {@link Telephone} instance, never <code>null</code> */ protected Telephone parsePhone( OMElement phoneEl ) { Telephone phone = new Telephone(); XPath xpath = new XPath( "ows:Voice", nsContext ); String[] voices = getNodesAsStrings( phoneEl, xpath ); for ( int i = 0; i < voices.length; i++ ) { phone.getVoice().add( voices[i] ); } xpath = new XPath( "ows:Facsimile", nsContext ); String[] faxes = getNodesAsStrings( phoneEl, xpath ); for ( int i = 0; i < faxes.length; i++ ) { phone.getFacsimile().add( faxes[i] ); } return 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 ) );
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; }
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",
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 ) );