use of com.google.gdata.data.extensions.FormattedAddress in project janrufmonitor by tbrandt77.
the class GoogleContactsProxy method createPostalAddress.
private StructuredPostalAddress createPostalAddress(IAttributeMap m) {
StructuredPostalAddress pa = new StructuredPostalAddress();
StringBuffer tmp = new StringBuffer(256);
if (m.contains(IJAMConst.ATTRIBUTE_NAME_STREET)) {
tmp.append(m.get(IJAMConst.ATTRIBUTE_NAME_STREET).getValue());
if (m.contains(IJAMConst.ATTRIBUTE_NAME_STREET_NO)) {
tmp.append(" ");
tmp.append(m.get(IJAMConst.ATTRIBUTE_NAME_STREET_NO).getValue());
}
tmp.append("\n");
}
if (m.contains(IJAMConst.ATTRIBUTE_NAME_CITY)) {
if (m.contains(IJAMConst.ATTRIBUTE_NAME_POSTAL_CODE)) {
tmp.append(m.get(IJAMConst.ATTRIBUTE_NAME_POSTAL_CODE).getValue());
tmp.append(" ");
}
tmp.append(m.get(IJAMConst.ATTRIBUTE_NAME_CITY).getValue());
}
if (m.contains(IJAMConst.ATTRIBUTE_NAME_COUNTRY)) {
tmp.append("\n");
tmp.append(m.get(IJAMConst.ATTRIBUTE_NAME_COUNTRY).getValue());
}
if (tmp.length() == 0)
tmp.append(" ");
pa.setFormattedAddress(new FormattedAddress(tmp.toString()));
pa.setRel(PostalAddress.Rel.HOME);
pa.setPrimary(Boolean.TRUE);
return pa;
}
Aggregations