diff --git a/spec/openapi.yaml b/spec/openapi.yaml index 58b1746662d6f235e27adbeecf0cd110d8cda468..56cbd1549c9dc2c72dd4d16f450c118a49c945cd 100644 --- a/spec/openapi.yaml +++ b/spec/openapi.yaml @@ -601,15 +601,18 @@ components: address: type: object properties: - street: + address_line_1: type: string description: Street address of the organization - city: + address_line_2: type: string - description: The ciy in which the organization is based - province_state: + description: Additional information about the street address of the organization + locality: type: string - description: The province/state in which the organization is based + description: The city/township in which the organization is based + administrative_area: + type: string + description: The province/state/area in which the organization is based country: type: string description: The country in which the organization is based @@ -638,15 +641,18 @@ components: address: type: object properties: - street: + address_line_1: type: string description: Street address of the organization - city: + address_line_2: + type: string + description: Additional information about the street address of the organization + locality: type: string - description: The ciy in which the organization is based - province_state: + description: The city/township in which the organization is based + administrative_area: type: string - description: The province/state in which the organization is based + description: The province/state/area in which the organization is based country: type: string description: The country in which the organization is based diff --git a/src/main/java/org/eclipsefoundation/react/bootstrap/DataLoader.java b/src/main/java/org/eclipsefoundation/react/bootstrap/DataLoader.java index 53b842fb1655a9a064b79b62d16a4e20463fe5d0..d9ccfe503ed9e4e5a88a6d1fb7c2491573a72d2f 100644 --- a/src/main/java/org/eclipsefoundation/react/bootstrap/DataLoader.java +++ b/src/main/java/org/eclipsefoundation/react/bootstrap/DataLoader.java @@ -114,11 +114,11 @@ public class DataLoader { o.setEmployeeCount(RandomStringUtils.randomNumeric(5, 10)); o.setOrganizationType(OrganizationTypes.OTHER); Address a = new Address(); - a.setCity(RandomStringUtils.randomAlphabetic(4, 10)); + a.setLocality(RandomStringUtils.randomAlphabetic(4, 10)); a.setCountry(RandomStringUtils.randomAlphabetic(4, 10)); a.setPostalCode(RandomStringUtils.randomAlphabetic(4, 10)); - a.setProvinceState(RandomStringUtils.randomAlphabetic(2)); - a.setStreet(RandomStringUtils.randomAlphabetic(4, 10)); + a.setAdministrativeArea(RandomStringUtils.randomAlphabetic(2)); + a.setAddressLine1(RandomStringUtils.randomAlphabetic(4, 10)); a.setOrganization(o); o.setAddress(a); organizations.add(o); diff --git a/src/main/java/org/eclipsefoundation/react/dto/Address.java b/src/main/java/org/eclipsefoundation/react/dto/Address.java index b7d76097b818164133387b2f7517cff6c36a67fd..f05084275ded404b5e17ad55615df4b59b020634 100644 --- a/src/main/java/org/eclipsefoundation/react/dto/Address.java +++ b/src/main/java/org/eclipsefoundation/react/dto/Address.java @@ -16,6 +16,7 @@ import java.util.Objects; import javax.inject.Inject; import javax.inject.Singleton; +import javax.json.bind.annotation.JsonbProperty; import javax.json.bind.annotation.JsonbTransient; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -56,11 +57,14 @@ public class Address extends BareNode implements TargetedClone
{ @JoinColumn(name = "organization_id", unique = true) private FormOrganization organization; - @NotBlank(message = "Street cannot be blank") - private String street; - @NotBlank(message = "City cannot be blank") - private String city; - private String provinceState; + @NotBlank(message = "First address line cannot be blank") + @JsonbProperty("address_line_1") + private String addressLine1; + @JsonbProperty("address_line_2") + private String addressLine2; + @NotBlank(message = "Locality cannot be blank") + private String locality; + private String administrativeArea; @NotBlank(message = "Country cannot be blank") private String country; private String postalCode; @@ -77,6 +81,7 @@ public class Address extends BareNode implements TargetedClone { } /** @return the organization */ + @JsonbTransient public FormOrganization getOrganization() { return this.organization; } @@ -86,83 +91,123 @@ public class Address extends BareNode implements TargetedClone { this.organization = org; } - /** @return the steet */ - public String getStreet() { - return street; + /** + * @return the addressLine1 + */ + public String getAddressLine1() { + return addressLine1; + } + + /** + * @param addressLine1 the addressLine1 to set + */ + public void setAddressLine1(String addressLine1) { + this.addressLine1 = addressLine1; + } + + /** + * @return the addressLine2 + */ + public String getAddressLine2() { + return addressLine2; } - /** @param street the street to set */ - public void setStreet(String street) { - this.street = street; + /** + * @param addressLine2 the addressLine2 to set + */ + public void setAddressLine2(String addressLine2) { + this.addressLine2 = addressLine2; } - /** @return the city */ - public String getCity() { - return city; + /** + * @return the locality + */ + public String getLocality() { + return locality; } - /** @param city the city to set */ - public void setCity(String city) { - this.city = city; + /** + * @param locality the locality to set + */ + public void setLocality(String locality) { + this.locality = locality; } - /** @return the provinceState */ - public String getProvinceState() { - return provinceState; + /** + * @return the administrativeArea + */ + public String getAdministrativeArea() { + return administrativeArea; } - /** @param provinceState the provinceState to set */ - public void setProvinceState(String provinceState) { - this.provinceState = provinceState; + /** + * @param administrativeArea the administrativeArea to set + */ + public void setAdministrativeArea(String administrativeArea) { + this.administrativeArea = administrativeArea; } - /** @return the country */ + /** + * @return the country + */ public String getCountry() { return country; } - /** @param country the country to set */ + /** + * @param country the country to set + */ public void setCountry(String country) { this.country = country; } - /** @return the postalCode */ + /** + * @return the postalCode + */ public String getPostalCode() { return postalCode; } - /** @param postalCode the postalCode to set */ + /** + * @param postalCode the postalCode to set + */ public void setPostalCode(String postalCode) { this.postalCode = postalCode; } - @Override - public Address cloneTo(Address target) { - target.setCity(getCity()); - target.setCountry(getCountry()); - target.setPostalCode(getPostalCode()); - target.setProvinceState(getProvinceState()); - target.setStreet(getStreet()); - return target; - } - @Override public int hashCode() { - return Objects.hash(city, country, id, postalCode, provinceState, street); + final int prime = 31; + int result = super.hashCode(); + result = prime * result + + Objects.hash(addressLine1, addressLine2, administrativeArea, country, id, locality, postalCode); + return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; - if (obj == null) + if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; Address other = (Address) obj; - return Objects.equals(city, other.city) && Objects.equals(country, other.country) - && Objects.equals(id, other.id) && Objects.equals(postalCode, other.postalCode) - && Objects.equals(provinceState, other.provinceState) && Objects.equals(street, other.street); + return Objects.equals(addressLine1, other.addressLine1) && Objects.equals(addressLine2, other.addressLine2) + && Objects.equals(administrativeArea, other.administrativeArea) + && Objects.equals(country, other.country) && Objects.equals(id, other.id) + && Objects.equals(locality, other.locality) && Objects.equals(postalCode, other.postalCode); + } + + @Override + public Address cloneTo(Address target) { + target.setAddressLine1(getAddressLine1()); + target.setAddressLine2(getAddressLine2()); + target.setLocality(getLocality()); + target.setAdministrativeArea(getAdministrativeArea()); + target.setCountry(getCountry()); + target.setPostalCode(getPostalCode()); + return target; } /** @@ -200,4 +245,5 @@ public class Address extends BareNode implements TargetedClone { return Address.class; } } + } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 158a74bcf0cae57b9acbe4f86ee4604a08fdcdc1..3c911a4cad5b3737b5f1a6637b1bd0780b196b15 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -45,6 +45,7 @@ quarkus.oidc.logout.post-logout-path=/ quarkus.oidc.logout.path=/api/logout security.csrf.enabled=true quarkus.oidc.authentication.java-script-auto-redirect=false +quarkus.oidc.authentication.cookie-force-secure=true ## Recreate DB profile (easy to trigger in remote envs) %dbfresh.quarkus.hibernate-orm.database.generation=drop-and-create diff --git a/src/main/resources/sql/ddl.sql b/src/main/resources/sql/ddl.sql index 1fc10f4278994602c15abeaa2c8bd6a5d2957479..d39950f9c0baf8ad5296c9f42e281f4f87cad75e 100644 --- a/src/main/resources/sql/ddl.sql +++ b/src/main/resources/sql/ddl.sql @@ -56,11 +56,12 @@ CREATE TABLE `FormWorkingGroup` ( CREATE TABLE `Address` ( `id` varchar(255) NOT NULL, - `city` varchar(255) DEFAULT NULL, + `locality` varchar(255) DEFAULT NULL, `country` varchar(255) DEFAULT NULL, `postalCode` varchar(255) DEFAULT NULL, - `provinceState` varchar(255) DEFAULT NULL, - `street` varchar(255) DEFAULT NULL, + `administrativeArea` varchar(255) DEFAULT NULL, + `addressLine1` varchar(255) DEFAULT NULL, + `addressLine2` varchar(255) DEFAULT NULL, `organization_id` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `UK_i4vgutrsl3ve37hc8xx7vvslf` (`organization_id`), diff --git a/src/main/resources/templates/emails/form_membership_email_template.txt b/src/main/resources/templates/emails/form_membership_email_template.txt index 14bee32016c2eb05b32f073612263715254fa9f3..73bdf35d32e3ae80bd8f57118721f821a081b0eb 100644 --- a/src/main/resources/templates/emails/form_membership_email_template.txt +++ b/src/main/resources/templates/emails/form_membership_email_template.txt @@ -1,4 +1,5 @@ Eclipse Foundation AISBL Membership Application date submitted: {now} + {#if includePreamble} Dear {name}, @@ -7,6 +8,8 @@ Meanwhile, if you have any questions, please reach out to us at membership.coord Best regards, Eclipse Foundation Membership Coordination + + {/if} New form submission by: {name} ({data.form.userID}) @@ -22,8 +25,9 @@ Employee count: {data.org.employeeCount} Organization Type: {data.org.organizationType} Address -{data.org.address.street} -{data.org.address.city}, {org.address.provinceState} +{data.org.address.addressLine1} +{data.org.address.addressLine2} +{data.org.address.locality}, {data.org.address.administrativeArea} {data.org.address.country} {data.org.address.postalCode} diff --git a/src/main/resources/templates/emails/form_membership_email_web_template.html b/src/main/resources/templates/emails/form_membership_email_web_template.html index 2f98f7259762453c2c57b5e6883f490ea58102b9..118dc6e2f1b8119f018f274512729c8605967790 100644 --- a/src/main/resources/templates/emails/form_membership_email_web_template.html +++ b/src/main/resources/templates/emails/form_membership_email_web_template.html @@ -24,7 +24,7 @@
- {data.org.address.street}
{data.org.address.city}
{data.org.address.provinceState}
{data.org.address.country}
{data.org.address.postalCode}
+ {data.org.address.addressLine1}
{data.org.address.addressLine2}
{data.org.address.locality}
{data.org.address.administrativeArea}
{data.org.address.country}
{data.org.address.postalCode}