Commit 6905b4f3 authored by Martin Lowe's avatar Martin Lowe 🇨🇦 Committed by Martin Lowe
Browse files

Add a field to record the type of organization. #256

Contains changes for Java API, DDL schema, and openapi spec.
parent dc18856d
......@@ -585,6 +585,10 @@ components:
legal_name:
type: string
description: Legal Name of the Organization
organization_type:
type: string
description: The category of organization used for fee determination for current entity
enum: [NON_PROFIT_OPEN_SOURCE, ACADEMIC, STANDARDS, GOVERNMENT_ORGANIZATION_AGENCY_NGO, MEDIA_ORGANIZATION, RESEARCH, OTHER]
twitter:
type: string
description: The Twitter handle of the organization
......@@ -618,6 +622,10 @@ components:
legal_name:
type: string
description: Legal Name of the Organization
organization_type:
type: string
description: The category of organization used for fee determination for current entity
enum: [NON_PROFIT_OPEN_SOURCE, ACADEMIC, STANDARDS, GOVERNMENT_ORGANIZATION_AGENCY_NGO, MEDIA_ORGANIZATION, RESEARCH, OTHER]
twitter:
type: string
description: The Twitter handle of the organization
......
......@@ -36,6 +36,7 @@ import org.eclipsefoundation.react.dto.FormWorkingGroup;
import org.eclipsefoundation.react.dto.MembershipForm;
import org.eclipsefoundation.react.namespace.ContactTypes;
import org.eclipsefoundation.react.namespace.FormState;
import org.eclipsefoundation.react.namespace.OrganizationTypes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -107,8 +108,9 @@ public class DataLoader {
o.setLegalName(RandomStringUtils.randomAlphabetic(4, 10));
o.setTwitterHandle(RandomStringUtils.randomAlphabetic(4, 10));
o.setAggregateRevenue(RandomStringUtils.randomNumeric(5, 10));
o.setEmployeeCount(RandomStringUtils.randomNumeric(5, 10));
Address a = new Address();
o.setEmployeeCount(RandomStringUtils.randomNumeric(5, 10));
o.setOrganizationType(OrganizationTypes.OTHER);
Address a = new Address();
a.setCity(RandomStringUtils.randomAlphabetic(4, 10));
a.setCountry(RandomStringUtils.randomAlphabetic(4, 10));
a.setPostalCode(RandomStringUtils.randomAlphabetic(4, 10));
......
......@@ -19,6 +19,8 @@ import javax.json.bind.annotation.JsonbProperty;
import javax.json.bind.annotation.JsonbTransient;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
......@@ -35,6 +37,7 @@ import org.eclipsefoundation.persistence.model.DtoTable;
import org.eclipsefoundation.persistence.model.ParameterizedSQLStatement;
import org.eclipsefoundation.persistence.model.ParameterizedSQLStatementBuilder;
import org.eclipsefoundation.react.namespace.MembershipFormAPIParameterNames;
import org.eclipsefoundation.react.namespace.OrganizationTypes;
import org.hibernate.annotations.GenericGenerator;
@Table
......@@ -52,6 +55,9 @@ public class FormOrganization extends BareNode implements TargetedClone<FormOrga
private String twitterHandle;
private String employeeCount;
private String aggregateRevenue;
@Enumerated(EnumType.STRING)
@NotNull(message = "An organization requires a defined type")
private OrganizationTypes organizationType;
// form entity
@OneToOne(targetEntity = MembershipForm.class)
......@@ -136,6 +142,20 @@ public class FormOrganization extends BareNode implements TargetedClone<FormOrga
this.aggregateRevenue = aggregateRevenue;
}
/**
* @return the organizationType
*/
public OrganizationTypes getOrganizationType() {
return organizationType;
}
/**
* @param organizationType the organizationType to set
*/
public void setOrganizationType(OrganizationTypes organizationType) {
this.organizationType = organizationType;
}
/** @return the address */
public Address getAddress() {
return address;
......@@ -152,6 +172,7 @@ public class FormOrganization extends BareNode implements TargetedClone<FormOrga
target.setTwitterHandle(getTwitterHandle());
target.setAggregateRevenue(getAggregateRevenue());
target.setEmployeeCount(getEmployeeCount());
target.setOrganizationType(getOrganizationType());
return target;
}
......@@ -176,7 +197,8 @@ public class FormOrganization extends BareNode implements TargetedClone<FormOrga
&& Objects.equals(id, other.id) && Objects.equals(legalName, other.legalName)
&& Objects.equals(twitterHandle, other.twitterHandle)
&& Objects.equals(aggregateRevenue, other.aggregateRevenue)
&& Objects.equals(employeeCount, other.employeeCount);
&& Objects.equals(employeeCount, other.employeeCount)
&& Objects.equals(organizationType, other.organizationType);
}
@Override
......@@ -192,6 +214,8 @@ public class FormOrganization extends BareNode implements TargetedClone<FormOrga
builder.append(aggregateRevenue);
builder.append(", employeeCount=");
builder.append(employeeCount);
builder.append(", organizationType=");
builder.append(organizationType);
builder.append(", form=");
builder.append(form);
builder.append(", address=");
......
package org.eclipsefoundation.react.namespace;
/**
* Represents the different types of organizations that may be part of the memebership application process.
*
* @author Martin Lowe
*
*/
public enum OrganizationTypes {
NON_PROFIT_OPEN_SOURCE, ACADEMIC, STANDARDS, GOVERNMENT_ORGANIZATION_AGENCY_NGO, MEDIA_ORGANIZATION, RESEARCH,
OTHER;
}
......@@ -31,6 +31,7 @@ CREATE TABLE `FormOrganization` (
`legalName` varchar(255) DEFAULT NULL,
`twitterHandle` varchar(255) DEFAULT NULL,
`aggregateRevenue` varchar(255) DEFAULT NULL,
`organizationType` varchar(255) DEFAULT NULL,
`employeeCount` varchar(255) DEFAULT NULL,
`form_id` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
......@@ -63,4 +64,4 @@ CREATE TABLE `Address` (
PRIMARY KEY (`id`),
UNIQUE KEY `UK_i4vgutrsl3ve37hc8xx7vvslf` (`organization_id`),
CONSTRAINT `FKok1ylu26qjwvmfwgxlllbkj8l` FOREIGN KEY (`organization_id`) REFERENCES `FormOrganization` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
\ No newline at end of file
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
......@@ -19,6 +19,7 @@ VAT number: {data.form.vatNumber}
VAT Registration country: {data.form.registrationCountry}
Aggregate Revenue: {data.org.aggregateRevenue}
Employee count: {data.org.employeeCount}
Organization Type: {data.org.organizationType}
Address
{data.org.address.street}
......
......@@ -14,6 +14,7 @@
<p style="margin-bottom: 0px">Name: {data.org.legalName}</p>
<p style="margin-bottom: 0px; margin-top: 5px">Aggregate Revenue: {data.org.aggregateRevenue}</p>
<p style="margin-bottom: 0px; margin-top: 5px">Employee count: {data.org.employeeCount}</p>
<p style="margin: 0px;">Organization Type: {data.org.organizationType}</p>
<p style="margin-bottom: 0px; margin-top: 5px">Twitter: {data.org.twitterHandle}</p>
<p style="margin-bottom: 0px; margin-top: 5px"></p>Requires purchase order: {data.form.purchaseOrderRequired}</p>
<p style="margin-bottom: 0px; margin-top: 5px"></p>VAT number: {data.form.vatNumber}</p>
......
......@@ -16,6 +16,7 @@ import org.eclipsefoundation.react.dto.FormWorkingGroup;
import org.eclipsefoundation.react.dto.MembershipForm;
import org.eclipsefoundation.react.namespace.ContactTypes;
import org.eclipsefoundation.react.namespace.FormState;
import org.eclipsefoundation.react.namespace.OrganizationTypes;
/**
* Helper for creating valid random DTO objects for use in testing.
......@@ -52,6 +53,7 @@ public class DtoHelper {
FormOrganization o = new FormOrganization();
o.setForm(mf);
o.setLegalName(RandomStringUtils.randomAlphabetic(4, 10));
o.setOrganizationType(OrganizationTypes.OTHER);
o.setTwitterHandle("@" + RandomStringUtils.randomAlphabetic(4, 10));
o.setAggregateRevenue(RandomStringUtils.randomNumeric(5, 10));
o.setEmployeeCount(RandomStringUtils.randomNumeric(5, 10));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment