private Map<String, Object> propsFromDraft(final Draft draft) { final Map<String, Object> props = Maps.newLinkedHashMap(); props.put("id", draft.entityId()); final ValueMap data = valueMapOf(draft.data()); final boolean isBusiness = "2".equals(data.get("customer_type").asString()); if (isBusiness) { props.put("name", data.getRaw("supplementary_name")); props.put("nameExtra", data.getRaw("representative")); } else { props.put( "name", Joiner.on(" ") .skipNulls() .join(data.get("surname").asStringOr(null), data.get("name").asStringOr(null))); props.put("nameExtra", ""); } props.put( "addressStreet", streetAddress( data.getRaw("street"), data.getRaw("descriptive_number"), data.getRaw("orientation_number"))); props.put("addressTown", data.getRaw("town")); props.put("addressPostalCode", data.getRaw("postal_code")); props.put("addressCountryId", data.get("country").asLong()); props.put("contactName", data.getRaw("contact_name")); props.put("contactEmail", data.getRaw("email")); props.put("contactPhone", data.getRaw("phone")); props.put("publicId", data.getRaw("public_id")); if (isBusiness) { props.put( "taxId", data.get("dic") .asStringValueOr( data.get("public_id").asStringValueOr("" + System.currentTimeMillis()))); } else { props.put("taxId", ""); } props.put("otherInfo", data.getRaw("info")); return Collections.unmodifiableMap(props); }