diff --git a/src/main/java/org/dataone/bookkeeper/api/Address.java b/src/main/java/org/dataone/bookkeeper/api/Address.java
deleted file mode 100644
index 90d8385..0000000
--- a/src/main/java/org/dataone/bookkeeper/api/Address.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * This work was created by participants in the DataONE project, and is
- * jointly copyrighted by participating institutions in DataONE. For
- * more information on DataONE, see our web site at http://dataone.org.
- *
- * Copyright 2019. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.dataone.bookkeeper.api;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import io.dropwizard.jackson.Jackson;
-
-import java.io.IOException;
-import java.util.Objects;
-
-/**
- * Addresses are a part of Customers, storing their mailing address information.
- */
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class Address {
-
- /* The address line 1*/
- private String line1;
-
- /* The address line 2*/
- private String line2;
-
- /* The address city */
- private String city;
-
- /* The address state */
- private String state;
-
- /* The address postal code */
- private String postalCode;
-
- /* The address country */
- private String country;
-
- /**
- * Construct an empty address
- */
- public Address() {
- super();
- }
-
- /**
- * Construct an Address from a JSON string
- * @param json
- */
- public Address(String json) throws IOException {
- super();
-
- // Return an empty Address instance when the JSON object is empty
- if ( ! json.equals("{}") ) {
-
- // Otherwise try to build the Address
- Address address = Jackson.newObjectMapper().readValue(json, Address.class);
- this.line1 = address.line1;
- this.line2 = address.line2;
- this.city = address.city;
- this.state = address.state;
- this.postalCode = address.postalCode;
- this.country = address.country;
- }
- }
-
- /**
- * Construct an address
- * @param line1
- * @param line2
- * @param city
- * @param state
- * @param postalCode
- * @param country
- */
- public Address(String line1, String line2, String city,
- String state, String postalCode, String country) {
- super();
- this.line1 = line1;
- this.line2 = line2;
- this.city = city;
- this.state = state;
- this.postalCode = postalCode;
- this.country = country;
- }
-
- /**
- * Get the address line 1
- * @return line1
- */
- public String getLine1() {
- return line1;
- }
-
- /**
- * Set the address line 1
- * @param line1
- */
- public void setLine1(String line1) {
- this.line1 = line1;
- }
-
- /**
- * Get the address line 2
- * @return line2
- */
- public String getLine2() {
- return line2;
- }
-
- /**
- * Set the address line 2
- * @param line2
- */
- public void setLine2(String line2) {
- this.line2 = line2;
- }
-
- /**
- * Get the address city
- * @return city
- */
- public String getCity() {
- return city;
- }
-
- /**
- * Set the address city
- * @param city
- */
- public void setCity(String city) {
- this.city = city;
- }
-
- /**
- * Get the address state
- * @return state
- */
- public String getState() {
- return state;
- }
-
- /**
- * Set the address state
- * @param state
- */
- public void setState(String state) {
- this.state = state;
- }
-
- /**
- * Get the address postal code
- * @return postalCode
- */
- public String getPostalCode() {
- return postalCode;
- }
-
- /**
- * Set the address postal code
- * @param postalCode
- */
- public void setPostalCode(String postalCode) {
- this.postalCode = postalCode;
- }
-
- /**
- * Get the address country
- * @return country
- */
- public String getCountry() {
- return country;
- }
-
- /**
- * Set the address country
- * @param country
- */
- public void setCountry(String country) {
- this.country = country;
- }
-
- /**
- * Determine object equality based on the equality of all fields
- * @param o
- * @return true if the objects are equal
- */
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- Address address = (Address) o;
- return Objects.equals(getLine1(), address.getLine1()) &&
- Objects.equals(getLine2(), address.getLine2()) &&
- Objects.equals(getCity(), address.getCity()) &&
- Objects.equals(getState(), address.getState()) &&
- Objects.equals(getPostalCode(), address.getPostalCode()) &&
- Objects.equals(getCountry(), address.getCountry());
- }
-
- /**
- * Calculate a hash based on all fields
- * @return hash
- */
- @Override
- public int hashCode() {
-
- return Objects.hash(getLine1(), getLine2(), getCity(), getState(), getPostalCode(), getCountry());
- }
-}
diff --git a/src/main/java/org/dataone/bookkeeper/api/BaseList.java b/src/main/java/org/dataone/bookkeeper/api/BaseList.java
deleted file mode 100644
index f59cad6..0000000
--- a/src/main/java/org/dataone/bookkeeper/api/BaseList.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * This work was created by participants in the DataONE project, and is
- * jointly copyrighted by participating institutions in DataONE. For
- * more information on DataONE, see our web site at http://dataone.org.
- *
- * Copyright 2019
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.dataone.bookkeeper.api;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonInclude;
-
-/**
- * A base list type with start, count, and total properties
- */
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class BaseList {
-
- /* The start index in the list */
- private Integer start;
-
- /* The subset count of the list */
- private Integer count;
-
- /* The total elements in the list */
- private Integer total;
-
- /**
- * Construct a base list
- */
- public BaseList() {
-
- }
-
- /**
- * Get the start index
- * @return start the start paging index
- */
- @JsonProperty
- public Integer getStart() {
- return start;
- }
-
- /**
- * Set the start index
- * @param start the start paging index
- */
- @JsonProperty
- public void setStart(Integer start) {
- this.start = start;
- }
-
- /**
- * Get the return count
- * @return count the count of items to be returned
- */
- @JsonProperty
- public Integer getCount() {
- return count;
- }
-
- /**
- * Set the return count
- * @param count the count of items to be returned
- */
- @JsonProperty
- public void setCount(Integer count) {
- this.count = count;
- }
-
- /**
- * Get the total
- * @return total the total items in the list
- */
- @JsonProperty
- public Integer getTotal() {
- return total;
- }
-
- /**
- * Set the total
- * @param total the total items in the list
- */
- @JsonProperty
- public void setTotal(Integer total) {
- this.total = total;
- }
-}
diff --git a/src/main/java/org/dataone/bookkeeper/api/Customer.java b/src/main/java/org/dataone/bookkeeper/api/Customer.java
deleted file mode 100644
index e1f0057..0000000
--- a/src/main/java/org/dataone/bookkeeper/api/Customer.java
+++ /dev/null
@@ -1,591 +0,0 @@
-/*
- * This work was created by participants in the DataONE project, and is
- * jointly copyrighted by participating institutions in DataONE. For
- * more information on DataONE, see our web site at http://dataone.org.
- *
- * Copyright 2019. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.dataone.bookkeeper.api;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import io.dropwizard.jackson.Jackson;
-import org.dataone.service.types.v1.SubjectInfo;
-
-import javax.security.auth.Subject;
-import javax.validation.constraints.Email;
-import javax.validation.constraints.NotEmpty;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Pattern;
-import java.security.Principal;
-import java.util.Objects;
-
-/**
- * Customers represent individuals that order products.
- */
-@JsonIgnoreProperties({"discountJSON", "addressJSON", "metadataJSON", "invoiceSettingsJSON"})
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class Customer implements Principal {
- /* The customer unique id */
- private Integer id;
-
- /* The customer object type (must be "customer" */
- @NotEmpty
- @NotNull
- @Pattern(regexp = "customer")
- private String object;
-
- /* The customer unique subject id as the full http or https URL */
- @NotEmpty
- @NotNull
- private String subject;
-
- /* The DataONE SubjectInfo for the subject (i.e. roles) */
- private SubjectInfo subjectInfo;
-
- /* The customer account balance */
- private Integer balance;
-
- /* The customer address */
- private Address address;
-
- /* The customer creation date, in seconds from the unix epoch */
- private Integer created;
-
- /* The customer default currency code */
- @Pattern(regexp = "[A-Z]{3}")
- private String currency;
-
- /* The customer invoice delinquency status */
- private boolean delinquent;
-
- /* The customer description, can be null */
- private String description;
-
- /* The customer discount settings as a JSON object */
- private ObjectNode discount;
-
- /* The customer email address */
- @NotEmpty
- @NotNull
- @Email
- private String email;
-
- /* The customer invoice prefix to generate unique invoice numbers */
- private String invoicePrefix;
-
- /* The customer invoice settings */
- private ObjectNode invoiceSettings;
-
- /* The customer metadata (extended information as needed) */
- private ObjectNode metadata;
-
- /* The customer given name */
- @NotEmpty
- @NotNull
- private String givenName;
-
- /* The customer surname */
- @NotEmpty
- @NotNull
- private String surName;
-
- /* The customer phone number */
- private String phone;
-
- /**
- * Construct an empty Customer
- */
- public Customer() {
- super();
- }
-
- /**
- * Construct a Customer
- * @param id
- * @param object
- * @param subject
- * @param balance
- * @param address
- * @param created
- * @param currency
- * @param delinquent
- * @param description
- * @param discount
- * @param email
- * @param invoicePrefix
- * @param invoiceSettings
- * @param metadata
- * @param givenName
- * @param surName
- * @param phone
- */
- public Customer(Integer id,
- @NotEmpty @NotNull @Pattern(regexp = "customer") String object,
- @NotEmpty @NotNull String subject,
- Integer balance,
- Address address,
- Integer created,
- @Pattern(regexp = "[A-Z]{3}") String currency,
- @NotNull boolean delinquent,
- @NotEmpty String description,
- ObjectNode discount,
- @NotEmpty @NotNull String email,
- String invoicePrefix,
- ObjectNode invoiceSettings,
- ObjectNode metadata,
- @NotEmpty @NotNull String givenName,
- @NotEmpty @NotNull String surName,
- String phone) {
- super();
- this.id = id;
- this.object = object;
- this.subject = subject;
- this.balance = balance;
- this.address = address;
- this.created = created;
- this.currency = currency;
- this.delinquent = delinquent;
- this.description = description;
- this.discount = discount;
- this.email = email;
- this.invoicePrefix = invoicePrefix;
- this.invoiceSettings = invoiceSettings;
- this.metadata = metadata;
- this.givenName = givenName;
- this.surName = surName;
- this.phone = phone;
- }
-
- /**
- * Get the customer identifier
- * @return id
- */
- public Integer getId() {
- return id;
- }
-
- /**
- * Set the customer identifier
- * @param id
- */
- public void setId(Integer id) {
- this.id = id;
- }
-
- /**
- * Get the customer object type
- * @return object
- */
- public String getObject() {
- return object;
- }
-
- /**
- * G=Set the customer object type
- * @param object
- */
- public void setObject(String object) {
- this.object = object;
- }
-
- /**
- * Get the customer subject identifier
- * @return subject
- */
- public String getSubject() {
- return subject;
- }
-
- /**
- * Set the customer subject identifier
- * @param subject
- */
- public void setSubject(String subject) {
- this.subject = subject;
- }
-
- /**
- * Get the customer subject info
- * @return subjectInfo the customer subject info
- */
- public SubjectInfo getSubjectInfo() {
- return this.subjectInfo;
- }
-
- /**
- * Set the customer subject info
- * @param subjectInfo the customer subject info
- */
- public void setSubjectInfo(SubjectInfo subjectInfo) {
- this.subjectInfo = subjectInfo;
- }
-
- /**
- * Get the customer identifier
- * @return balance
- */
- public Integer getBalance() {
- return balance;
- }
-
- /**
- * Set the customer balance
- * @param balance
- */
- public void setBalance(Integer balance) {
- this.balance = balance;
- }
-
- /**
- * Get the customer address
- * @return address
- */
- public Address getAddress() {
- return address;
- }
-
- /**
- * Set the customer address
- * @param address
- */
- public void setAddress(Address address) {
- this.address = address;
- }
-
- /**
- * Get the customer creation date
- * @return created
- */
- public Integer getCreated() {
- return created;
- }
-
- /**
- * Set the customer creation date
- * @param created
- */
- public void setCreated(Integer created) {
- this.created = created;
- }
-
- /**
- * Get the customer currency
- * @return currency
- */
- public String getCurrency() {
- return currency;
- }
-
- /**
- * Set the customer currency
- * @param currency
- */
- public void setCurrency(String currency) {
- this.currency = currency;
- }
-
- /**
- * Get the customer delinquency status
- * @return delinquent
- */
- public boolean isDelinquent() {
- return delinquent;
- }
-
- /**
- * Set the customer delinquency status
- * @param delinquent
- */
- public void setDelinquent(boolean delinquent) {
- this.delinquent = delinquent;
- }
-
- /**
- * Get the customer description
- * @return description
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Set the customer description
- * @param description
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Get the customer discount
- * @return discount
- */
- public ObjectNode getDiscount() {
- return discount;
- }
-
- /**
- * Set the customer discount
- * @param discount
- */
- public void setDiscount(ObjectNode discount) {
- this.discount = discount;
- }
-
- /**
- * Get the customer email
- * @return email
- */
- public String getEmail() {
- return email;
- }
-
- /**
- * Set the customer email
- * @param email
- */
- public void setEmail(String email) {
- this.email = email;
- }
-
- /**
- * Get the customer invoice prefix
- * @return invoicePrefix
- */
- public String getInvoicePrefix() {
- return invoicePrefix;
- }
-
- /**
- * Set the customer invoicePrefix
- * @param invoicePrefix
- */
- public void setInvoicePrefix(String invoicePrefix) {
- this.invoicePrefix = invoicePrefix;
- }
-
- /**
- * Get the customer invoice settings
- * @return invoiceSettings
- */
- public ObjectNode getInvoiceSettings() {
- return invoiceSettings;
- }
-
- /**
- * Set the customer invoice settings
- * @param invoiceSettings
- */
- public void setInvoiceSettings(ObjectNode invoiceSettings) {
- this.invoiceSettings = invoiceSettings;
- }
-
- /**
- * Get the customer metadata
- * @return metadata
- */
- public ObjectNode getMetadata() {
- return metadata;
- }
-
- /**
- * Set the customer metadata
- * @param metadata
- */
- public void setMetadata(ObjectNode metadata) {
- this.metadata = metadata;
- }
-
- /**
- * Get the customer given name
- * @return givenName
- */
- public String getGivenName() {
- return givenName;
- }
-
- /**
- * Set the customer given name
- * @param givenName
- */
- public void setGivenName(String givenName) {
- this.givenName = givenName;
- }
-
- /**
- * Get the customer surname
- * @return surName
- */
- public String getSurName() {
- return surName;
- }
-
- /**
- * Set the customer surname
- * @param surName
- */
- public void setSurName(String surName) {
- this.surName = surName;
- }
-
- /**
- * Get the customer phone number
- * @return phone
- */
- public String getPhone() {
- return phone;
- }
-
- /**
- * Set the customer phone number
- * @param phone
- */
- public void setPhone(String phone) {
- this.phone = phone;
- }
-
- /**
- * Return the discount hash as a JSON string
- * @return discount the discount JSON string
- * @throws JsonProcessingException
- */
- public String getDiscountJSON() throws JsonProcessingException {
- if ( discount != null ) {
- return Jackson.newObjectMapper().writeValueAsString(getDiscount());
- } else {
- return "{}";
- }
- }
-
- /**
- * Return the address hash as a JSON string
- * @return address the address JSON string
- * @throws JsonProcessingException
- */
- public String getAddressJSON() throws JsonProcessingException {
- if ( address != null ) {
- return Jackson.newObjectMapper().writeValueAsString(getAddress());
- } else {
- return "{}";
- }
- }
-
- /**
- * Return the invoice settings hash as a JSON string
- * @return invoiceSettings the invoice settings JSON string
- * @throws JsonProcessingException
- */
- public String getInvoiceSettingsJSON() throws JsonProcessingException {
- if ( invoiceSettings != null ) {
- return Jackson.newObjectMapper().writeValueAsString(getInvoiceSettings());
- } else {
- return "{}";
- }
- }
-
- /**
- * Return the metadata hash as a JSON string
- * @return metadata the metadata JSON string
- * @throws JsonProcessingException
- */
- public String getMetadataJSON() throws JsonProcessingException {
- if ( metadata != null ) {
- return Jackson.newObjectMapper().writeValueAsString(getMetadata());
- } else {
- return "{}";
- }
- }
-
- /**
- * Determine object equality based on the equality of all fields
- * @param o the object to be compared
- * @return
- */
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- Customer customer = (Customer) o;
-
- return isDelinquent() == customer.isDelinquent() &&
- Objects.equals(getId(), customer.getId()) &&
- Objects.equals(getBalance(), customer.getBalance()) &&
- Objects.equals(getCreated(), customer.getCreated()) &&
- Objects.equals(getObject(), customer.getObject()) &&
- Objects.equals(getSubject(), customer.getSubject()) &&
- Objects.equals(getAddress(), customer.getAddress()) &&
- Objects.equals(getCurrency(), customer.getCurrency()) &&
- Objects.equals(getDescription(), customer.getDescription()) &&
- Objects.equals(getDiscount(), customer.getDiscount()) &&
- Objects.equals(getEmail(), customer.getEmail()) &&
- Objects.equals(getInvoicePrefix(), customer.getInvoicePrefix()) &&
- Objects.equals(getInvoiceSettings(), customer.getInvoiceSettings()) &&
- Objects.equals(getMetadata(), customer.getMetadata()) &&
- Objects.equals(getGivenName(), customer.getGivenName()) &&
- Objects.equals(getSurName(), customer.getSurName()) &&
- Objects.equals(getPhone(), customer.getPhone());
- }
-
- /**
- * Calculate a hash based on all fields
- * @return
- */
- @Override
- public int hashCode() {
-
- return Objects.hash(getId(), getObject(), getSubject(), getBalance(), getAddress(),
- getCreated(), getCurrency(), isDelinquent(), getDescription(), getDiscount(),
- getEmail(), getInvoicePrefix(), getInvoiceSettings(), getMetadata(),
- getGivenName(), getSurName(), getPhone());
- }
-
- /**
- * Returns the name of this principal.
- *
- * @return the name of this principal.
- */
- @Override
- public String getName() {
- return getSubject();
- }
-
- /**
- * Returns true if the specified subject is implied by this principal.
- *
- *
The default implementation of this method returns true if
- * {@code subject} is non-null and contains at least one principal that
- * is equal to this principal.
- *
- *
Subclasses may override this with a different implementation, if
- * necessary.
- *
- * @param subject the {@code Subject}
- * @return true if {@code subject} is non-null and is
- * implied by this principal, or false otherwise.
- * @since 1.8
- */
- @Override
- public boolean implies(Subject subject) {
-
- // TODO: Iterate through subjectInfo groups that this subject is a member of?
- return false;
- }
-
-}
diff --git a/src/main/java/org/dataone/bookkeeper/api/CustomerList.java b/src/main/java/org/dataone/bookkeeper/api/CustomerList.java
deleted file mode 100644
index 03477eb..0000000
--- a/src/main/java/org/dataone/bookkeeper/api/CustomerList.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * This work was created by participants in the DataONE project, and is
- * jointly copyrighted by participating institutions in DataONE. For
- * more information on DataONE, see our web site at http://dataone.org.
- *
- * Copyright 2019
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.dataone.bookkeeper.api;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonInclude;
-
-import java.util.List;
-
-/**
- * A list of customers used as a representation response
- */
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class CustomerList extends BaseList {
-
- private List customers;
-
- /**
- * Construct an empty customer list
- */
- public CustomerList() {
-
- }
-
- /**
- * Construct a customer list
- */
- public CustomerList(List customers) {
- this.customers = customers;
- }
-
- /**
- * Get the customers list
- * @return customers the customers list
- */
- @JsonProperty
- public List getCustomers() {
- return customers;
- }
-
- /**
- * Set the customers list
- * @param customers the customers list
- */
- @JsonProperty
- public void setCustomers(List customers) {
- this.customers = customers;
- }
-}
diff --git a/src/main/java/org/dataone/bookkeeper/api/Feature.java b/src/main/java/org/dataone/bookkeeper/api/Feature.java
deleted file mode 100644
index 698842b..0000000
--- a/src/main/java/org/dataone/bookkeeper/api/Feature.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * This work was created by participants in the DataONE project, and is
- * jointly copyrighted by participating institutions in DataONE. For
- * more information on DataONE, see our web site at http://dataone.org.
- *
- * Copyright 2019. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.dataone.bookkeeper.api;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import io.dropwizard.jackson.Jackson;
-
-import javax.validation.constraints.NotEmpty;
-import javax.validation.constraints.NotNull;
-import java.io.IOException;
-import java.util.Objects;
-
-/**
- * A Feature describes an aspect of a Product, with optional limits.
- */
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class Feature {
-
- /* The feature name */
- @NotNull
- @NotEmpty
- private String name;
-
- /* The feature label */
- @NotNull
- @NotEmpty
- private String label;
-
- /* The feature description */
- @NotNull
- @NotEmpty
- private String description;
-
- /* The optional feature quota */
- private Quota quota;
-
- /**
- * Construct an empty Feature
- */
- public Feature() {
- super();
- }
-
- /**
- * Create a Feature from a JSON string
- * @param json
- */
- public Feature(String json) throws IOException {
- super();
-
- // Return an empty Feature instance when the JSON object is empty
- if ( ! json.equals("{}") ) {
-
- // Otherwise try to build the Feature
- Feature feature = Jackson.newObjectMapper().readValue(json, Feature.class);
- this.name = feature.name;
- this.label = feature.label;
- this.description = feature.description;
- this.quota = feature.quota;
- }
- }
-
- /**
- * Construct a Feature
- * @param name
- * @param label
- * @param description
- * @param quota
- */
- public Feature(@NotNull @NotEmpty String name,
- @NotNull @NotEmpty String label,
- @NotNull @NotEmpty String description,
- @NotEmpty Quota quota) {
- this.name = name;
- this.label = label;
- this.description = description;
- this.quota = quota;
- }
-
- /**
- * Get the feature name
- * @return name
- */
- public String getName() {
- return name;
- }
-
- /**
- * Set the feature name
- * @param name
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Get the feature label
- * @return label
- */
- public String getLabel() {
- return label;
- }
-
- /**
- * Set the feature label
- * @param label
- */
- public void setLabel(String label) {
- this.label = label;
- }
-
- /**
- * Get the feature description
- * @return description
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Set the feature description
- * @param description
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Get the feature quota
- * @return quota
- */
- public Quota getQuota() {
- return quota;
- }
-
- /**
- * Set the feature quota
- * @param quota
- */
- public void setQuota(Quota quota) {
- this.quota = quota;
- }
-
- /**
- * Determine object equality based on the equality of all fields
- * @param o the object to be compared
- * @return
- */
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- Feature feature = (Feature) o;
- return Objects.equals(getName(), feature.getName()) &&
- Objects.equals(getLabel(), feature.getLabel()) &&
- Objects.equals(getDescription(), feature.getDescription()) &&
- Objects.equals(getQuota(), feature.getQuota());
- }
-
- /**
- * Calculate a hash based on all fields
- * @return hashcode
- */
- @Override
- public int hashCode() {
-
- return Objects.hash(getName(), getLabel(), getDescription(), getQuota());
- }
-}
diff --git a/src/main/java/org/dataone/bookkeeper/api/Order.java b/src/main/java/org/dataone/bookkeeper/api/Order.java
deleted file mode 100644
index de22dd3..0000000
--- a/src/main/java/org/dataone/bookkeeper/api/Order.java
+++ /dev/null
@@ -1,664 +0,0 @@
-/*
- * This work was created by participants in the DataONE project, and is
- * jointly copyrighted by participating institutions in DataONE. For
- * more information on DataONE, see our web site at http://dataone.org.
- *
- * Copyright 2019. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.dataone.bookkeeper.api;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import io.dropwizard.jackson.Jackson;
-
-import javax.validation.Valid;
-import javax.validation.constraints.NotEmpty;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Pattern;
-import java.io.IOException;
-import java.util.List;
-import java.util.Objects;
-
-/**
- * Orders represent a list of purchased products by customers
- */
-@JsonIgnoreProperties({"chargeJSON", "metadataJSON", "itemsJSON", "statusTransitionsJSON"})
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class Order {
-
- /* The order unique id */
- private Integer id;
-
- /* The order object type */
- @NotEmpty
- @NotNull
- @Pattern(regexp = "order")
- private String object;
-
- /* The order amount (in the smallest unit of the currency) */
- private Integer amount;
-
- /* The order amount returned */
- private Integer amountReturned;
-
- /* The order payment charge details */
- private ObjectNode charge;
-
- /* The order creation date (seconds since the epoch) */
- private Integer created;
-
- /* The order currency id */
- private String currency;
-
- /* The order subject identifier, likely an ORCID or DataONE group DN */
- private String subject;
-
- /* The order customer id */
- @NotNull
- private Integer customer;
-
- /* The order customer's email */
- private String email;
-
- /* The order item list of products */
- @NotEmpty
- @NotNull
- @Valid
- private List items;
-
- /* The order metadata */
- private ObjectNode metadata;
-
- /* The name of the order, set by the customer */
- private String name;
-
- /* The order status */
- @Pattern(regexp = "active|created|paid|past_due|refunded|trialing|unpaid")
- private String status;
-
- /* The order status transitions (history of status/timestamp key/value pairs*/
- private ObjectNode statusTransitions;
-
- /* The order update date (seconds since the epoch) */
- private Integer updated;
-
- /*The order series identifier used to track renewals */
- private String seriesId;
-
- /* The start date for the order used to determine service expiry */
- private Integer startDate;
-
- /* The end date for the order used to determine service expiry */
- private Integer endDate;
-
- /* The quotas associated with the product, if any */
- private List quotas;
-
- /**
- * Construct an empty order
- */
- public Order() {
- super();
- }
-
- /**
- * Construct an order
- * @param id the order identifier
- * @param object the order object type
- * @param amount the order amount
- * @param amountReturned the order amount returned
- * @param charge the charge associated with the order
- * @param created the order create timestamp (seconds since the epoch)
- * @param currency the order currency identifier
- * @param customer the order customer identifier
- * @param email the order customer email
- * @param items the order items list
- * @param metadata the metadata object associated with an order
- * @param name the name of the order, set by the customer
- * @param status the order status, one of active|created|paid|past_due|refunded|trialing|unpaid
- * @param statusTransitions the object showing status transitions
- * @param updated the order update timestamp (seconds since the epoch)
- * @param seriesId the order series identifier
- * @param startDate the ordered services start timestamp (seconds since the epoch)
- * @param endDate the ordered services end timestamp (seconds since the epoch)
- * @param quotas the quotas associated with the order
- */
- public Order(
- Integer id,
- @NotEmpty @NotNull @Pattern(regexp = "order") String object,
- @NotNull Integer amount,
- Integer amountReturned,
- ObjectNode charge,
- Integer created,
- String currency,
- String subject,
- @NotNull Integer customer,
- String email,
- @NotEmpty @NotNull @Valid List items,
- ObjectNode metadata,
- String name,
- @NotEmpty @NotNull @Pattern(regexp = "active|created|paid|past_due|refunded|trialing|unpaid") String status,
- ObjectNode statusTransitions,
- Integer updated,
- String seriesId,
- Integer startDate,
- Integer endDate,
- List quotas) {
- super();
- this.id = id;
- this.object = object;
- this.amount = amount;
- this.amountReturned = amountReturned;
- this.charge = charge;
- this.created = created;
- this.currency = currency;
- this.subject = subject;
- this.customer = customer;
- this.email = email;
- this.items = items;
- this.metadata = metadata;
- this.name = name;
- this.status = status;
- this.statusTransitions = statusTransitions;
- this.updated = updated;
- this.seriesId = seriesId;
- this.startDate = startDate;
- this.endDate = endDate;
- this.quotas = quotas;
- }
-
- /**
- * Get the order id
- * @return id the order identifier
- */
- @JsonProperty
- public Integer getId() {
- return id;
- }
-
- /**
- * Set the order id
- * @param id the order identifier
- */
- @JsonProperty
- public void setId(Integer id) {
- this.id = id;
- }
-
- /**
- * Get the order object type
- * @return object the order object type
- */
- @JsonProperty
- public String getObject() {
- return object;
- }
-
- /**
- * Set the order object type
- * @param object the order object type ("order")
- */
- @JsonProperty
- public void setObject(String object) {
- this.object = object;
- }
-
- /**
- * Get the order amount
- * @return amount the order amount in the smallest unit of the currency
- */
- @JsonProperty
- public Integer getAmount() {
- return amount;
- }
-
- /**
- * Set the order amount
- * @param amount the order amount in the smallest unit of the currency
- */
- @JsonProperty
- public void setAmount(Integer amount) {
- this.amount = amount;
- }
-
-
- @JsonProperty
- public Integer getTotalAmount() {
- Integer total = 0;
-
- // If we have an item list, total the items
- if ( ! getItems().isEmpty() ) {
- for (OrderItem item : getItems() ) {
- total = total + item.getAmount();
- }
- }
- return total;
- }
- /**
- * Get the order amount returned
- * @return the order amount returned
- */
- @JsonProperty
- public Integer getAmountReturned() {
- return amountReturned;
- }
-
- /**
- * Set the order amount returned
- * @param amountReturned the order amount returned
- */
- @JsonProperty
- public void setAmountReturned(Integer amountReturned) {
- this.amountReturned = amountReturned;
- }
-
- /**
- * Get the order payment charge details
- * @return charge the order charge details
- */
- @JsonProperty
- public ObjectNode getCharge() {
- return charge;
- }
-
- /**
- * Set the order payment charge details
- * @param charge the order payment charge details
- */
- @JsonProperty
- public void setCharge(ObjectNode charge) {
- this.charge = charge;
- }
-
- /**
- * Get the order creation date
- * @return created the order creation date in seconds since the epoch
- */
- @JsonProperty
- public Integer getCreated() {
- return created;
- }
-
- /**
- * Set the order creation date
- * @param created the order creation date in seconds since the epoch
- */
- @JsonProperty
- public void setCreated(Integer created) {
- this.created = created;
- }
-
- /**
- * Get the order currency code
- * @return currency the order currency code
- */
- @JsonProperty
- public String getCurrency() {
- return currency;
- }
-
- /**
- * Set the order currency code
- * @param currency the order currency code
- */
- @JsonProperty
- public void setCurrency(String currency) {
- this.currency = currency;
- }
-
- /**
- * Get the order customer
- * @return customer the order customer
- */
- @JsonProperty
- public Integer getCustomer() {
- return customer;
- }
-
- /**
- * Set the order customer id
- * @param customer the order customer id
- */
- @JsonProperty
- public void setCustomer(Integer customer) {
- this.customer = customer;
- }
-
- /**
- * Get the order subject
- * @return the order subject
- */
- @JsonProperty
- public String getSubject() {
- return subject;
- }
-
- /**
- * Set the order subject
- * @param subject the order subject
- */
- @JsonProperty
- public void setSubject(String subject) {
- this.subject = subject;
- }
-
- /**
- * Get the order email
- * @return email the order email
- */
- @JsonProperty
- public String getEmail() {
- return email;
- }
-
- /**
- * Set the order email
- * @param email the order email
- */
- @JsonProperty
- public void setEmail(String email) {
- this.email = email;
- }
-
- /**
- * Get the order items
- * @return the list of order items
- */
- @JsonProperty
- public List getItems() {
- return items;
- }
-
- /**
- * Set the order items
- * @param items the list of order items
- */
- @JsonProperty
- public void setItems(List items) {
- this.items = items;
- }
-
- /**
- * Get the order metadata
- * @return metadata the JSON metadata associated with the order
- */
- @JsonProperty
- public ObjectNode getMetadata() {
- return metadata;
- }
-
- /**
- * Set the order metadata
- * @param metadata the JSON metadata associated with the order
- */
- @JsonProperty
- public void setMetadata(ObjectNode metadata) {
- this.metadata = metadata;
- }
-
- /**
- * Get the name of the order
- * @return the order name set by the customer
- */
- @JsonProperty
- public String getName() {
- return name;
- }
-
- /**
- * Set the name of the order
- * @param name the order name set by the customer
- */
- @JsonProperty
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Get the order status
- * @return status the status of the order
- */
- @JsonProperty
- public String getStatus() {
- return status;
- }
-
- /**
- * Set the order status
- * @param status the status of the order
- */
- @JsonProperty
- public void setStatus(String status) {
- this.status = status;
- }
-
- /**
- * Get the order status transitions
- * @return statusTransitions the JSON object of status transitions
- */
- @JsonProperty
- public ObjectNode getStatusTransitions() {
- return statusTransitions;
- }
-
- /**
- * Set the order status transitions
- * @param statusTransitions the JSON object of status transitions
- */
- @JsonProperty
- public void setStatusTransitions(ObjectNode statusTransitions) {
- this.statusTransitions = statusTransitions;
- }
-
- /**
- * Get the order updated date
- * @return updated the order updated date
- */
- @JsonProperty
- public Integer getUpdated() {
- return updated;
- }
-
- /**
- * Set the order updated date
- * @param updated the order updated date in seconds since the epoch
- */
- @JsonProperty
- public void setUpdated(Integer updated) {
- this.updated = updated;
- }
-
- /**
- * Get the order series identifier
- * @return the order series identifier
- */
- @JsonProperty
- public String getSeriesId() {
- return seriesId;
- }
-
- /**
- * Set the order series identifier
- * @param seriesId the order series identifier
- */
- @JsonProperty
- public void setSeriesId(String seriesId) {
- this.seriesId = seriesId;
- }
-
- /**
- * Get the order start date
- * @return the order start date
- */
- @JsonProperty
- public Integer getStartDate() {
- return startDate;
- }
-
- /**
- * Set the order start date
- * @param startDate the order start date
- */
- @JsonProperty
- public void setStartDate(Integer startDate) {
- this.startDate = startDate;
- }
-
- /**
- * Get the order end date
- * @return the order end date
- */
- @JsonProperty
- public Integer getEndDate() {
- return endDate;
- }
-
- /**
- * Set the order end date
- * @param endDate the order end date
- */
- @JsonProperty
- public void setEndDate(Integer endDate) {
- this.endDate = endDate;
- }
-
- /**
- * Get the order quotas
- * @return quotas the order quotas
- */
- @JsonProperty
- public List getQuotas() {
- return quotas;
- }
-
- /**
- * Set the order quotas
- * @param quotas the order quotas
- */
- @JsonProperty
- public void setQuotas(List quotas) {
- this.quotas = quotas;
- }
-
- /**
- * Return the charge hash as a JSON string
- * @return charge the charge hash as a JSON string
- * @throws JsonProcessingException a JSON processing exception
- */
- public String getChargeJSON() throws JsonProcessingException {
- if ( charge != null ) {
- return Jackson.newObjectMapper().writeValueAsString(getCharge());
- } else {
- return "{}";
- }
- }
-
-
- /**
- * Return the items list as a JSON array
- * @return items the order items list
- * @throws IOException an I/O exception
- */
- public String getItemsJSON() throws IOException {
- if ( items != null ) {
- ObjectMapper mapper = Jackson.newObjectMapper();
- ArrayNode itemsArray = mapper.createArrayNode();
-
- for (OrderItem item : items) {
- itemsArray.add(mapper.readTree(mapper.writeValueAsString(item)));
- }
- return itemsArray.toString();
- } else {
- return "[]";
- }
- }
-
- /**
- * Return the metadata hash as a JSON string
- * @return metadata the metadata hash as a JSON string
- * @throws JsonProcessingException a JSON processing exception
- */
- public String getMetadataJSON() throws JsonProcessingException {
- if ( metadata != null ) {
- return Jackson.newObjectMapper().writeValueAsString(getMetadata());
- } else {
- return "{}";
- }
- }
-
- /**
- * Return the charge hash as a JSON string
- * @return charge the charge hash as a JSON string
- * @throws JsonProcessingException a JSON processing exception
- */
- public String getStatusTransitionsJSON() throws JsonProcessingException {
- if ( statusTransitions != null ) {
- return Jackson.newObjectMapper().writeValueAsString(getStatusTransitions());
- } else {
- return "{}";
- }
- }
-
- /**
- * Determine equality of another order
- * @param o the object to compare
- * @return true if they are equal
- */
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- Order order = (Order) o;
- return Objects.equals(getId(), order.getId()) &&
- getObject().equals(order.getObject()) &&
- getAmount().equals(order.getAmount()) &&
- Objects.equals(getAmountReturned(), order.getAmountReturned()) &&
- Objects.equals(getCharge(), order.getCharge()) &&
- Objects.equals(getCreated(), order.getCreated()) &&
- Objects.equals(getCurrency(), order.getCurrency()) &&
- Objects.equals(getSubject(), order.getSubject()) &&
- getCustomer().equals(order.getCustomer()) &&
- Objects.equals(getEmail(), order.getEmail()) &&
- getItems().equals(order.getItems()) &&
- Objects.equals(getMetadata(), order.getMetadata()) &&
- Objects.equals(getName(), order.getName()) &&
- getStatus().equals(order.getStatus()) &&
- Objects.equals(getStatusTransitions(), order.getStatusTransitions()) &&
- Objects.equals(getUpdated(), order.getUpdated()) &&
- getSeriesId().equals(order.getSeriesId()) &&
- Objects.equals(getStartDate(), order.getStartDate()) &&
- Objects.equals(getEndDate(), order.getEndDate()) &&
- Objects.equals(getQuotas(), order.getQuotas());
- }
-
- /**
- * Generate an order hash code
- * @return hash the order hash
- */
- @Override
- public int hashCode() {
- return Objects.hash(getId(), getObject(), getAmount(), getAmountReturned(),
- getCharge(), getCreated(), getCurrency(), getSubject(), getCustomer(),
- getEmail(), getItems(), getMetadata(), getName(), getStatus(), getStatusTransitions(),
- getUpdated(), getSeriesId(), getStartDate(), getEndDate(), getQuotas());
- }
-}
diff --git a/src/main/java/org/dataone/bookkeeper/api/OrderItem.java b/src/main/java/org/dataone/bookkeeper/api/OrderItem.java
deleted file mode 100644
index 35312b8..0000000
--- a/src/main/java/org/dataone/bookkeeper/api/OrderItem.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * This work was created by participants in the DataONE project, and is
- * jointly copyrighted by participating institutions in DataONE. For
- * more information on DataONE, see our web site at http://dataone.org.
- *
- * Copyright 2019. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.dataone.bookkeeper.api;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import io.dropwizard.jackson.Jackson;
-
-import javax.validation.constraints.NotEmpty;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Pattern;
-import java.io.IOException;
-import java.util.Objects;
-
-/**
- * OrderItem represents a single line item of an order
- */
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class OrderItem {
-
- /* The order item object type */
- @NotNull
- @NotEmpty
- private String object;
-
- /* The order item amount */
- @NotNull
- private Integer amount;
-
- /* The order item currency */
- private String currency;
-
- /* The order item description */
- private String description;
-
- /* The order item parent product id */
- @NotNull
- private Integer parent;
-
- /* The order item quantity */
- @NotNull
- private Integer quantity;
-
- /* The order item type */
- @NotNull
- @NotEmpty
- @Pattern(regexp = "sku|tax|shipping|discount")
- private String type;
-
- /**
- * Construct an empty order item
- */
- public OrderItem() {
- super();
- }
-
- /**
- * Construct an order item from a JSON string
- */
- public OrderItem(String json) throws IOException {
- super();
- // Return an empty Feature instance when the JSON object is empty
- if ( ! json.equals("{}") ) {
-
- // Otherwise try to build the Feature
- OrderItem orderItem = Jackson.newObjectMapper().readValue(json, OrderItem.class);
- this.object = orderItem.getObject();
- this.amount = orderItem.getAmount();
- this.currency = orderItem.getCurrency();
- this.description = orderItem.getDescription();
- this.parent = orderItem.getParent();
- this.quantity = orderItem.getQuantity();
- this.type = orderItem.getType();
- }
- }
-
- /**
- * Construct an order item
- * @param object
- * @param amount
- * @param currency
- * @param description
- * @param parent
- * @param quantity
- * @param type
- */
- public OrderItem(
- @NotNull @NotEmpty String object,
- @NotNull Integer amount,
- @NotNull @NotEmpty String currency,
- @NotNull @NotEmpty String description,
- Integer parent,
- @NotNull Integer quantity,
- @NotNull @NotEmpty @Pattern(regexp = "sku|tax|shipping|discount") String type) {
- super();
- this.object = object;
- this.amount = amount;
- this.currency = currency;
- this.description = description;
- this.parent = parent;
- this.quantity = quantity;
- this.type = type;
- }
-
- /**
- * Get the order item object type
- * @return
- */
- public String getObject() {
- return object;
- }
-
- /**
- * Set the order item object type
- * @param object
- */
- public void setObject(String object) {
- this.object = object;
- }
-
- /**
- * Get the order item amount
- * @return
- */
- public Integer getAmount() {
- return amount;
- }
-
- /**
- * Set the order item amount
- * @param amount
- */
- public void setAmount(Integer amount) {
- this.amount = amount;
- }
-
- /**
- * Get the order item currency
- * @return
- */
- public String getCurrency() {
- return currency;
- }
-
- /**
- * Set the order item currency
- * @param currency
- */
- public void setCurrency(String currency) {
- this.currency = currency;
- }
-
- /**
- * Get the order item description
- * @return
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Set the order item description
- * @param description
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Get the order item parent identifier
- * @return
- */
- public Integer getParent() {
- return parent;
- }
-
- /**
- * Set the order item parent identifier
- * @param parent
- */
- public void setParent(Integer parent) {
- this.parent = parent;
- }
-
- /**
- * Get the order item quantity
- * @return
- */
- public Integer getQuantity() {
- return quantity;
- }
-
- /**
- * Set the order item quantity
- * @param quantity
- */
- public void setQuantity(Integer quantity) {
- this.quantity = quantity;
- }
-
- /**
- * Get the order item type
- * @return
- */
- public String getType() {
- return type;
- }
-
- /**
- * Set the order item type
- * @param type
- */
- public void setType(String type) {
- this.type = type;
- }
-
- /**
- * Determine order item equality
- * @param o
- * @return
- */
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- OrderItem orderItem = (OrderItem) o;
- return Objects.equals(getObject(), orderItem.getObject()) &&
- Objects.equals(getAmount(), orderItem.getAmount()) &&
- Objects.equals(getCurrency(), orderItem.getCurrency()) &&
- Objects.equals(getDescription(), orderItem.getDescription()) &&
- Objects.equals(getParent(), orderItem.getParent()) &&
- Objects.equals(getQuantity(), orderItem.getQuantity()) &&
- Objects.equals(getType(), orderItem.getType());
- }
-
- /**
- * Generate an order item hash code
- * @return
- */
- @Override
- public int hashCode() {
-
- return Objects.hash(getObject(), getAmount(), getCurrency(),
- getDescription(), getParent(), getQuantity(), getType());
- }
-}
diff --git a/src/main/java/org/dataone/bookkeeper/api/OrderList.java b/src/main/java/org/dataone/bookkeeper/api/OrderList.java
deleted file mode 100644
index b01144b..0000000
--- a/src/main/java/org/dataone/bookkeeper/api/OrderList.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * This work was created by participants in the DataONE project, and is
- * jointly copyrighted by participating institutions in DataONE. For
- * more information on DataONE, see our web site at http://dataone.org.
- *
- * Copyright 2019
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.dataone.bookkeeper.api;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonInclude;
-
-import java.util.List;
-
-/**
- * A list of orders used as a representation response
- */
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class OrderList extends BaseList {
-
- private List orders;
-
- /**
- * Construct an empty order list
- */
- public OrderList() {
-
- }
-
- /**
- * Construct an order list
- */
- public OrderList(List orders) {
- this.orders = orders;
- }
-
- /**
- * Get the orders list
- * @return orders the orders list
- */
- @JsonProperty
- public List getOrders() {
- return orders;
- }
-
- /**
- * Set the orders list
- * @param orders the orders list
- */
- @JsonProperty
- public void setOrders(List orders) {
- this.orders = orders;
- }
-}
diff --git a/src/main/java/org/dataone/bookkeeper/api/Product.java b/src/main/java/org/dataone/bookkeeper/api/Product.java
deleted file mode 100644
index 988cc33..0000000
--- a/src/main/java/org/dataone/bookkeeper/api/Product.java
+++ /dev/null
@@ -1,493 +0,0 @@
-/*
- * This work was created by participants in the DataONE project, and is
- * jointly copyrighted by participating institutions in DataONE. For
- * more information on DataONE, see our web site at http://dataone.org.
- *
- * Copyright 2019. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.dataone.bookkeeper.api;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import io.dropwizard.jackson.Jackson;
-import org.hibernate.validator.constraints.Length;
-
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotEmpty;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Pattern;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Objects;
-
-/**
- * Products represent a given offering to be purchased
- */
-@JsonIgnoreProperties({"metadataJSON", "idAsInt", "createdTimestamp"})
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class Product {
-
- /* The product id */
- private Integer id;
-
- /* The product object type */
- @NotEmpty
- @NotNull
- @Pattern(regexp = "product")
- private String object;
-
- /* The product visibility status (true or false) */
- @NotNull
- private boolean active;
-
- /* The product cost (in pence of the currency) */
- @NotNull
- @Min(0)
- private Integer amount;
-
- /* The product caption */
- @NotEmpty
- @NotNull
- @Length(max = 500)
- private String caption;
-
- /* The product currency code */
- @NotEmpty
- @NotNull
- @Length(max = 3)
- private String currency;
-
- /* The product creation timestamp (from the unix epoch in seconds)*/
- private Integer created;
-
- /* The product description */
- @NotEmpty
- @NotNull
- @Length(max = 1000)
- private String description;
-
- /* The product payment interval */
- @NotEmpty
- @NotNull
- @Pattern(regexp = "day|week|month|year")
- private String interval;
-
- /* The product name */
- @NotEmpty
- @NotNull
- @Length(max = 250)
- private String name;
-
- /* The product statement descriptor shown on charge receipts */
- @Length(max = 100)
- private String statementDescriptor;
-
- /* The product type, either a good or service */
- @NotEmpty
- @NotNull
- @Pattern(regexp = "good|service")
- private String type;
-
- /* The product unit label used on invoices and charge receipts for type=service*/
- private String unitLabel;
-
- /* The product URL that provides a product description */
- @Pattern(regexp = "http.*")
- private String url;
-
- /* The product metadata hash of product features and other metadata */
- private ObjectNode metadata;
-
-
- /**
- * Construct an empty product
- */
- public Product() {
- super();
- }
-
- public Product(
- Integer id,
- @NotEmpty @NotNull @Pattern(regexp = "product") String object,
- @NotNull boolean active,
- @NotNull @Min(0) Integer amount,
- @NotEmpty @NotNull @Length(max = 500) String caption,
- @NotEmpty @NotNull @Length(max = 3) String currency,
- Integer created,
- @NotEmpty @NotNull @Length(max = 1000) String description,
- @NotEmpty @NotNull @Pattern(regexp = "day|week|month|year") String interval,
- @NotEmpty @NotNull @Length(max = 250) String name,
- @Length(max = 100) String statementDescriptor,
- @NotEmpty @NotNull @Pattern(regexp = "good|service") String type,
- String unitLabel,
- @Pattern(regexp = "http.*") String url,
- ObjectNode metadata) {
- this.id = id;
- this.object = object;
- this.active = active;
- this.amount = amount;
- this.caption = caption;
- this.currency = currency;
- this.created = created;
- this.description = description;
- this.interval = interval;
- this.name = name;
- this.statementDescriptor = statementDescriptor;
- this.type = type;
- this.unitLabel = unitLabel;
- this.url = url;
- this.metadata = metadata;
- }
-
- /**
- * Get the product id
- * @return id
- */
- @JsonProperty
- public Integer getId() {
- return id;
- }
-
- /**
- * Get the id as a primitive int
- * @return
- */
- public int getIdAsInt() {
- return getId().intValue();
- }
-
- /**
- * Set the product id
- * @param id
- */
- @JsonProperty
- public void setId(Integer id) {
- this.id = id;
- }
-
- /**
- * Get the product object type string
- * @return object
- */
- @JsonProperty
- public String getObject() {
- return object;
- }
-
- /**
- * Set the product object type string
- * @param object
- */
- @JsonProperty
- public void setObject(String object) {
- this.object = object;
- }
-
- /**
- * Get the product active status
- * @return active
- */
- @JsonProperty
- public boolean isActive() {
- return active;
- }
-
- /**
- * Set the product active status
- * @param active
- */
- @JsonProperty
- public void setActive(boolean active) {
- this.active = active;
- }
-
- /**
- * Get the product name
- * @return name
- */
- @JsonProperty
- public String getName() {
- return name;
- }
-
- /**
- * Set the product name
- * @param name
- */
- @JsonProperty
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Get the product caption
- * @return
- */
- @JsonProperty
- public String getCaption() {
- return caption;
- }
-
- /**
- * Set the product caption
- * @param caption
- */
- @JsonProperty
- public void setCaption(String caption) {
- this.caption = caption;
- }
-
- /**
- * Get the product description
- * @return
- */
- @JsonProperty
- public String getDescription() {
- return description;
- }
-
- /**
- * Set the product description
- * @param description
- */
- @JsonProperty
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Get the product creation timestamp
- * @return
- */
- @JsonProperty
- public Integer getCreated() {
- return created;
- }
-
- /**
- * Set the product creation timestamp
- * @param created
- */
- @JsonProperty
- public void setCreated(Integer created) {
- this.created = created;
- }
-
- /**
- * Get the creation date as an ISO 8601 timestamp string
- * @return
- */
- public String getCreatedTimestamp() {
-
- SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
- return formatter.format(new Date((long) getCreated().intValue() * 1000));
- }
-
- /**
- * Get the product statement descriptor
- * @return
- */
- @JsonProperty
- public String getStatementDescriptor() {
- return statementDescriptor;
- }
-
- /**
- * Set the product statement descriptor
- * @param statementDescriptor
- */
- @JsonProperty
- public void setStatementDescriptor(String statementDescriptor) {
- this.statementDescriptor = statementDescriptor;
- }
-
- /**
- * Get the product type
- * @return
- */
- @JsonProperty
- public String getType() {
- return type;
- }
-
- /**
- * Set the product type
- * @param type
- */
- @JsonProperty
- public void setType(String type) {
- this.type = type;
- }
-
- /**
- * Get the product unit label
- * @return
- */
- @JsonProperty
- public String getUnitLabel() {
- return unitLabel;
- }
-
- /**
- * Set the product unit label
- * @param unitLabel
- */
- @JsonProperty
- public void setUnitLabel(String unitLabel) {
- this.unitLabel = unitLabel;
- }
-
- /**
- * Get the product URL
- * @return
- */
- @JsonProperty
- public String getUrl() {
- return url;
- }
-
- /**
- * Set the product URL
- * @param url
- */
- @JsonProperty
- public void setUrl(String url) {
- this.url = url;
- }
-
- /**
- * Get the product metadata
- * @return
- */
- @JsonProperty
- public ObjectNode getMetadata() {
- return metadata;
- }
-
- /**
- * Set the product metadata
- * @param metadata
- */
- @JsonProperty
- public void setMetadata(ObjectNode metadata) {
- this.metadata = metadata;
- }
-
- /**
- * Return the metadata hash as a JSON string
- * @return
- * @throws JsonProcessingException
- */
- public String getMetadataJSON() throws JsonProcessingException {
- if ( metadata != null ) {
- return Jackson.newObjectMapper().writeValueAsString(getMetadata());
- } else {
- return "{}";
- }
- }
-
- /**
- * Get the product cost amount
- * @return
- */
- public Integer getAmount() {
- return amount;
- }
-
- /**
- * Set the product cost amount
- * @param amount
- */
- public void setAmount(Integer amount) {
- this.amount = amount;
- }
-
- /**
- * Get the product currency code
- * @return
- */
- public String getCurrency() {
- return currency;
- }
-
- /**
- * Set the product currency code
- * @param currency
- */
- public void setCurrency(String currency) {
- this.currency = currency;
- }
-
- /**
- * Get the product payment interval
- * @return
- */
- public String getInterval() {
- return interval;
- }
-
- /**
- * Set the product payment
- * @param interval
- */
- public void setInterval(String interval) {
- this.interval = interval;
- }
-
- /**
- * Determine object equality based on the equality of all fields
- * @param o the object to be compared
- * @return
- */
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- Product product = (Product) o;
- return isActive() == product.isActive() &&
- Objects.equals(getId(), product.getId()) &&
- Objects.equals(getObject(), product.getObject()) &&
- Objects.equals(getAmount(), product.getAmount()) &&
- Objects.equals(getCaption(), product.getCaption()) &&
- Objects.equals(getCurrency(), product.getCurrency()) &&
- Objects.equals(getCreated(), product.getCreated()) &&
- Objects.equals(getDescription(), product.getDescription()) &&
- Objects.equals(getInterval(), product.getInterval()) &&
- Objects.equals(getName(), product.getName()) &&
- Objects.equals(getStatementDescriptor(), product.getStatementDescriptor()) &&
- Objects.equals(getType(), product.getType()) &&
- Objects.equals(getUnitLabel(), product.getUnitLabel()) &&
- Objects.equals(getUrl(), product.getUrl()) &&
- Objects.equals(getMetadata(), product.getMetadata());
- }
-
-
- /**
- * Calculate a hash based on all fields
- * @return hashcode
- */
- @Override
- public int hashCode() {
-
- return Objects.hash(getId(), getObject(), isActive(), getAmount(), getCaption(),
- getCurrency(), getCreated(), getDescription(), getInterval(), getName(),
- getStatementDescriptor(), getType(), getUnitLabel(), getUrl(), getMetadata());
- }
-}
diff --git a/src/main/java/org/dataone/bookkeeper/api/ProductList.java b/src/main/java/org/dataone/bookkeeper/api/ProductList.java
deleted file mode 100644
index 0fd0dc9..0000000
--- a/src/main/java/org/dataone/bookkeeper/api/ProductList.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * This work was created by participants in the DataONE project, and is
- * jointly copyrighted by participating institutions in DataONE. For
- * more information on DataONE, see our web site at http://dataone.org.
- *
- * Copyright 2019
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.dataone.bookkeeper.api;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonInclude;
-
-import java.util.List;
-
-/**
- * A list of products used as a representation response
- */
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class ProductList extends BaseList {
-
- private List products;
-
- /**
- * Construct an empty product list
- */
- public ProductList() {
-
- }
-
- /**
- * Construct a product list
- */
- public ProductList(List products) {
- this.products = products;
- }
-
- /**
- * Get the products list
- * @return products the products list
- */
- @JsonProperty
- public List getProducts() {
- return products;
- }
-
- /**
- * Set the products list
- * @param products the products list
- */
- @JsonProperty
- public void setProducts(List products) {
- this.products = products;
- }
-}
diff --git a/src/main/java/org/dataone/bookkeeper/api/Quota.java b/src/main/java/org/dataone/bookkeeper/api/Quota.java
deleted file mode 100644
index 9579cda..0000000
--- a/src/main/java/org/dataone/bookkeeper/api/Quota.java
+++ /dev/null
@@ -1,364 +0,0 @@
-/*
- * This work was created by participants in the DataONE project, and is
- * jointly copyrighted by participating institutions in DataONE. For
- * more information on DataONE, see our web site at http://dataone.org.
- *
- * Copyright 2019. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.dataone.bookkeeper.api;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import io.dropwizard.jackson.Jackson;
-
-import javax.validation.constraints.NotEmpty;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Pattern;
-import java.io.IOException;
-import java.util.Objects;
-
-/**
- * Quotas represent limits placed on services resources (storage, etc.)
- */
-@JsonIgnoreProperties(ignoreUnknown=true)
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class Quota {
- /* The quota id (assigned by db layer) */
- private Integer id;
-
- /* The quota object type */
- @NotEmpty
- @NotNull
- @Pattern(regexp = "quota")
- private String object;
-
- /* The quota type */
- @NotEmpty
- @Pattern(regexp = "portal|storage|repository_storage")
- @NotNull
- private String quotaType;
-
- /* The quota soft limit */
- private @NotNull Double softLimit;
-
- /* The quota hard limit */
- private @NotNull Double hardLimit;
-
- /* The total usage of the quota */
- private @NotNull Double totalUsage;
-
- /* The quota unit */
- @NotEmpty
- @NotNull
- private String unit;
-
- /* The quota order id */
- private Integer orderId;
-
- /* The quota subject id */
- private String subject;
-
- /* A name that helps associate a quota with an order */
- private String name;
-
- /**
- * Construct an empty Quota
- */
- public Quota() {
- super();
- }
-
- /**
- * Construct a Quota from a JSON string
- * @param json the JSON quota object
- * @throws IOException when an I/O exception occurs
- */
- public Quota(String json) throws IOException {
- super();
-
- // Return an empty Quota instance when the JSON object is empty
- if ( ! json.equals("{}") ) {
-
- // Otherwise try to build the Quota
- Quota quota = Jackson.newObjectMapper().readValue(json, Quota.class);
- this.id = quota.id;
- this.object = quota.object;
- this.quotaType = quota.quotaType;
- this.softLimit = quota.softLimit;
- this.hardLimit = quota.hardLimit;
- this.totalUsage = quota.totalUsage;
- this.unit = quota.unit;
- this.orderId = quota.orderId;
- this.subject = quota.subject;
- this.name = quota.name;
- }
- }
-
- /**
- * Construct a quota
- * @param id the quota identifier
- * @param object the quota object type
- * @param quotaType the quota type
- * @param softLimit the quota soft limit
- * @param hardLimit the quota hard limit
- * @param unit the quota unit
- * @param totalUsage the quota total usage
- * @param orderId the quota order identifier
- * @param subject the quota subject
- * @param name the quota name from the associated order
- */
- public Quota(Integer id,
- @NotNull @NotEmpty String object,
- @NotNull @NotEmpty String quotaType,
- @NotNull Double softLimit,
- @NotNull Double hardLimit,
- @NotNull Double totalUsage,
- @NotNull @NotEmpty String unit,
- Integer orderId,
- String subject,
- String name) {
- if ( id != null ) {
- if ( ! id.toString().equals("") ) {
- this.id = id;
- }
- }
- this.object = object;
- this.quotaType = quotaType;
- this.softLimit = softLimit;
- this.hardLimit = hardLimit;
- this.unit = unit;
- this.totalUsage = totalUsage;
- this.orderId = orderId;
- this.subject = subject;
- this.name = name;
- }
-
- /**
- * Get the quota id
- * @return id the quota identifier
- */
- @JsonProperty
- public Integer getId() {
- return id;
- }
-
- /**
- * Set the quota id
- * @param id the quota identifier
- */
- @JsonProperty
- public void setId(Integer id) {
- this.id = id;
- }
-
- /**
- * Get the quota object type
- * @return object the quota object type
- */
- @JsonProperty
- public String getObject() {
- return object;
- }
-
- /**
- * Set the quota object type
- * @param object the quota object type
- */
- @JsonProperty
- public void setObject(String object) {
- this.object = object;
- }
-
- /**
- * Get the quota type
- * @return quotaType the quota type
- */
- @JsonProperty
- public String getQuotaType() {
- return quotaType;
- }
-
- /**
- * Set the quota type
- * @param quotaType the quota type
- */
- @JsonProperty
- public void setQuotaType(String quotaType) {
- this.quotaType = quotaType;
- }
-
- /**
- * Get the quota soft limit
- * @return softLimit the quota soft limit
- */
- @JsonProperty
- public @NotNull Double getSoftLimit() {
- return softLimit;
- }
-
- /**
- * Set the quota soft limit
- * @param softLimit the quota soft limit
- */
- @JsonProperty
- public void setSoftLimit(@NotNull Double softLimit) {
- this.softLimit = softLimit;
- }
-
- /**
- * Get the quota hard limit
- * @return hardLimit the quota hard limit
- */
- @JsonProperty
- public @NotNull Double getHardLimit() {
- return hardLimit;
- }
-
- /**
- * Set the quota hard limit
- * @param hardLimit the quota hard limit
- */
- @JsonProperty
- public void setHardLimit(@NotNull Double hardLimit) {
- this.hardLimit = hardLimit;
- }
-
- /**
- * Get the quota total usage
- * @return totalUsage the quota total usage
- */
- @JsonProperty
- public Double getTotalUsage() {
- if (totalUsage == null) {
- totalUsage = 0.0;
- }
- return totalUsage;
- }
-
- /**
- * Set the quota total usage
- * @param totalUsage the quota total usage
- */
- @JsonProperty
- public void setTotalUsage(Double totalUsage) {
- this.totalUsage = totalUsage;
- }
-
- /**
- * Get the quota unit
- * @return unit the quota unit
- */
- @JsonProperty
- public String getUnit() {
- return unit;
- }
-
- /**
- * Set the quota unit
- * @param unit the quota unit
- */
- @JsonProperty
- public void setUnit(String unit) {
- this.unit = unit;
- }
-
- /**
- * Get the order id
- * @return orderId the quota order identifier
- */
- @JsonProperty
- public Integer getOrderId() {
- return orderId;
- }
-
- /**
- * Set the order id
- * @param orderId the quota order identifier
- */
- @JsonProperty
- public void setOrderId(Integer orderId) {
- this.orderId = orderId;
- }
-
- /**
- * Get the subject
- * @return subject the quota subject
- */
- @JsonProperty
- public String getSubject() {
- return subject;
- }
-
- /**
- * Set the subject
- * @param subject the quota subject
- */
- @JsonProperty
- public void setSubject(String subject) {
- this.subject = subject;
- }
-
- /**
- * Get the quota name
- * @return the quota name
- */
- public String getName() {
- return name;
- }
-
- /**
- * Get the quota name
- * @param name the quota name
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Determine object equality based on the equality of all fields
- * @param o the object to be compared
- * @return true if the given object is equal
- */
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- Quota quota = (Quota) o;
- return Objects.equals(getId(), quota.getId()) &&
- getObject().equals(quota.getObject()) &&
- getQuotaType().equals(quota.getQuotaType()) &&
- getSoftLimit().equals(quota.getSoftLimit()) &&
- getHardLimit().equals(quota.getHardLimit()) &&
- Objects.equals(getTotalUsage(), quota.getTotalUsage()) &&
- getUnit().equals(quota.getUnit()) &&
- Objects.equals(getOrderId(), quota.getOrderId()) &&
- Objects.equals(getSubject(), quota.getSubject()) &&
- Objects.equals(getName(), quota.getName());
- }
-
- /**
- * Calculate a hash based on all fields
- * @return hashcode the hashcode of the object
- */
-
- @Override
- public int hashCode() {
- return Objects.hash(getId(), getObject(), getQuotaType(), getSoftLimit(),
- getHardLimit(), getTotalUsage(), getUnit(), getOrderId(), getSubject(), getName());
- }
-}
diff --git a/src/main/java/org/dataone/bookkeeper/api/QuotaList.java b/src/main/java/org/dataone/bookkeeper/api/QuotaList.java
deleted file mode 100644
index 2515e3d..0000000
--- a/src/main/java/org/dataone/bookkeeper/api/QuotaList.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * This work was created by participants in the DataONE project, and is
- * jointly copyrighted by participating institutions in DataONE. For
- * more information on DataONE, see our web site at http://dataone.org.
- *
- * Copyright 2019
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.dataone.bookkeeper.api;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonInclude;
-
-import java.util.List;
-
-/**
- * A list of quotas used as a representation response
- */
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class QuotaList extends BaseList {
-
- private List quotas;
-
- /**
- * Construct an empty quota list
- */
- public QuotaList() {
-
- }
-
- /**
- * Construct a quota list
- */
- public QuotaList(List quotas) {
- this.quotas = quotas;
- }
-
- /**
- * Get the quotas list
- * @return quotas the quotas list
- */
- @JsonProperty
- public List getQuotas() {
- return quotas;
- }
-
- /**
- * Set the quotas list
- * @param quotas the quotas list
- */
- @JsonProperty
- public void setQuotas(List quotas) {
- this.quotas = quotas;
- }
-}
diff --git a/src/main/java/org/dataone/bookkeeper/api/Usage.java b/src/main/java/org/dataone/bookkeeper/api/Usage.java
deleted file mode 100644
index fa1c4cd..0000000
--- a/src/main/java/org/dataone/bookkeeper/api/Usage.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * This work was created by participants in the DataONE project, and is
- * jointly copyrighted by participating institutions in DataONE. For
- * more information on DataONE, see our web site at http://dataone.org.
- *
- * Copyright 2020. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.dataone.bookkeeper.api;
-
-import javax.validation.constraints.NotEmpty;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Pattern;
-import java.util.Objects;
-
-public class Usage {
-
- /* The identifier of the quota usage */
- private Integer id;
-
- /* The quota usage object type */
- @NotEmpty
- @NotNull
- @Pattern(regexp = "usage")
- private String object;
-
- /* The identifier of the associated quota */
- @NotNull
- private Integer quotaId;
-
- /* The unique identifier of quota usage instance */
- @NotNull
- private String instanceId;
-
- /* The quota usage quantity */
- @NotNull
- private Double quantity;
-
- /* The status of the quota usage, either active or inactive */
- @Pattern(regexp = "active|inactive")
- private String status;
-
- /* The identifier of the node the quota usage occurred on. */
- private String nodeId;
- /**
- * Construct an empty usage instance
- */
- public Usage() {
- }
-
- /**
- * Construct a Usage instance
- * @param id the identifier of the quota usage instance
- * @param object the object type of the quota usage instance ("usage")
- * @param quotaId the identifier of the associated quota
- * @param instanceId the identifier of the instance object using a portion of the quota
- * @param quantity the quantity of the quota used
- * @param status the usage status, either active or inactive
- * @param nodeId the member node identifier
- */
- public Usage(Integer id,
- @NotEmpty @NotNull @Pattern(regexp = "usage") String object,
- @NotNull Integer quotaId,
- @NotNull String instanceId,
- @NotNull Double quantity,
- String status,
- @NotNull String nodeId) {
- this.id = id;
- this.object = object;
- this.quotaId = quotaId;
- this.instanceId = instanceId;
- this.quantity = quantity;
- this.status = status;
- this.nodeId = nodeId;
- }
-
- /**
- * Get the quota usage identifier
- * @return id the quota usage identifier
- */
- public Integer getId() {
- return id;
- }
-
- /**
- * Set the quota usage identifier
- * @param id the quota usage identifier
- */
- public void setId(Integer id) {
- this.id = id;
- }
-
- /**
- * Get the quota usage object type
- * @return object the quota usage object type
- */
- public String getObject() {
- return object;
- }
-
- /**
- * Set the quota usage object type
- * @param object the quota usage object type
- */
- public void setObject(String object) {
- this.object = object;
- }
-
- /**
- * Get the quota identifier
- * @return quotaId the quota identifier
- */
- public Integer getQuotaId() {
- return quotaId;
- }
-
- /**
- * Set the quota identifier
- * @param quotaId the quota identifier
- */
- public void setQuotaId(Integer quotaId) {
- this.quotaId = quotaId;
- }
-
- /**
- * Get the quota usage instance identifier
- * @return instanceId the quota usage instance identifier
- */
- public String getInstanceId() {
- return instanceId;
- }
-
- /**
- * Set the quota usage instance identifier
- * @param instanceId the quota usage instance identifier
- */
- public void setInstanceId(String instanceId) {
- this.instanceId = instanceId;
- }
-
- /**
- * Get the quota usage quantity
- * @return quantity the quota usage quantity
- */
- public @NotNull Double getQuantity() {
- return quantity;
- }
-
- /**
- * Set the quota usage quantity
- * @param quantity the quota usage quantity
- */
- public void setQuantity(@NotNull Double quantity) {
- this.quantity = quantity;
- }
-
- /**
- * Get the usage status
- * @return status the usage status, either active or inactive
- */
- public String getStatus() {
- return status;
- }
-
- /**
- * Set the usage status
- * @param status the usage status, either active or inactive
- */
- public void setStatus(String status) {
- this.status = status;
- }
-
- /**
- * Get the quota usage node identifier
- * @return nodeId the quota usage node identifier
- */
- public String getNodeId() { return nodeId; }
-
- /**
- * Set the quota usage node identifier
- * @param nodeId the quota usage node identifier
- */
- public void setNodeId(String nodeId) { this.nodeId = nodeId; }
-
- /**
- * Determine equality with the given object
- * @param o the object to compare
- * @return true if the objects are equal
- */
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- Usage usage = (Usage) o;
- return Objects.equals(getId(), usage.getId()) &&
- getObject().equals(usage.getObject()) &&
- getQuotaId().equals(usage.getQuotaId()) &&
- getInstanceId().equals(usage.getInstanceId()) &&
- getQuantity().equals(usage.getQuantity()) &&
- Objects.equals(getStatus(), usage.getStatus()) &&
- getNodeId().equals(usage.getNodeId());
- }
-
- /**
- * Generate a hashcode for the object based on its members
- * @return the object hashcode
- */
- @Override
- public int hashCode() {
- return Objects.hash(getId(), getObject(), getQuotaId(), getInstanceId(), getQuantity(), getStatus(), getNodeId());
- }
-}
-
diff --git a/src/main/java/org/dataone/bookkeeper/api/UsageList.java b/src/main/java/org/dataone/bookkeeper/api/UsageList.java
deleted file mode 100644
index 2476632..0000000
--- a/src/main/java/org/dataone/bookkeeper/api/UsageList.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * This work was created by participants in the DataONE project, and is
- * jointly copyrighted by participating institutions in DataONE. For
- * more information on DataONE, see our web site at http://dataone.org.
- *
- * Copyright 2019
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.dataone.bookkeeper.api;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import java.util.List;
-
-/**
- * A list of quota usage instances as a representation response
- */
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class UsageList extends BaseList {
-
- private List usages;
-
- /**
- * Construct an empty usage list
- */
- public UsageList() {
-
- }
-
- /**
- * Construct a usage list
- */
- public UsageList(List usages) {
- this.usages = usages;
- }
-
- /**
- * Get the usages list
- * @return usages the usages list
- */
- @JsonProperty
- public List getUsages() {
- return usages;
- }
-
- /**
- * Set the usages list
- * @param usages the usages list
- */
- @JsonProperty
- public void setUsages(List usages) {
- this.usages = usages;
- }
-}
diff --git a/src/main/java/org/dataone/bookkeeper/api/UsageStatus.java b/src/main/java/org/dataone/bookkeeper/api/UsageStatus.java
deleted file mode 100644
index 030927d..0000000
--- a/src/main/java/org/dataone/bookkeeper/api/UsageStatus.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * This work was created by participants in the DataONE project, and is
- * jointly copyrighted by participating institutions in DataONE. For
- * more information on DataONE, see our web site at http://dataone.org.
- *
- * Copyright 2020. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.dataone.bookkeeper.api;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import io.dropwizard.jackson.Jackson;
-
-import javax.validation.constraints.NotEmpty;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Pattern;
-import java.io.IOException;
-import java.util.Objects;
-
-
-/**
- * UsageStatus represent the current state of a usage ("active" | "inactive")
- */
-@JsonIgnoreProperties(ignoreUnknown=true)
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class UsageStatus {
-
- /* The usagestatus object type */
- @NotEmpty
- @NotNull
- @Pattern(regexp = "usagestatus")
- private String object;
-
- /* The status of the quota usage, either active or inactive */
- @NotEmpty
- @NotNull
- @Pattern(regexp = "active|inactive")
- private String status;
-
- /**
- * A UsageStatus represents the active or inactive status of a Usage object as a light weight response
- */
- public UsageStatus() {}
-
- /**
- * Construct a UsageStatus from a JSON string
- * @param json the JSON usagestatus object
- * @throws IOException when an I/O exception occurs
- */
- public UsageStatus(String json) throws IOException {
-
- // Return an empty Quota instance when the JSON object is empty
- if ( ! json.equals("{}") ) {
-
- // Otherwise try to build the UsageStatus
- UsageStatus usagestatus = Jackson.newObjectMapper().readValue(json, UsageStatus.class);
- this.object = usagestatus.object;
- this.status = usagestatus.status;
- }
- }
-
- /**
- * Construct a Usage instance
- * @param status the usage status, either active or inactive
- */
- public UsageStatus(@NotNull @NotEmpty @Pattern(regexp = "usagestatus") String object,
- @NotNull @NotEmpty String status ) {
- this.object = object;
- this.status = status;
- }
-
- /**
- * Get the usage object type
- * @return object the usage object type, always 'usagestatus'
- */
- public String getObject() { return object; }
-
- /**
- * Set the usage object type
- * @param object the usage object type, always 'usagestatus'
- */
- public void setObject(String object) { this.object = object; }
-
- /**
- * Get the usage status
- * @return status the usage status, either active or inactive
- */
- public String getStatus() {
- return status;
- }
-
- /**
- * Set the usage status
- * @param status the usage status, either active or inactive
- */
- public void setStatus(String status) {
- this.status = status;
- }
-
- /**
- * Determine object equality based on the equality of all fields
- * @param o the object to be compared
- * @return true if the given object is equal
- */
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- UsageStatus usagestatus = (UsageStatus) o;
- return Objects.equals(getObject(), usagestatus.getObject()) &&
- Objects.equals(getStatus(), usagestatus.getStatus());
- }
-
- /**
- * Calculate a hash based on all fields
- * @return hashcode the hashcode of the object
- */
- @Override
- public int hashCode() {
- return Objects.hash(getObject(), getStatus());
- }
-}
diff --git a/src/test/java/org/dataone/bookkeeper/api/AddressTest.java b/src/test/java/org/dataone/bookkeeper/api/AddressTest.java
deleted file mode 100644
index 1743905..0000000
--- a/src/test/java/org/dataone/bookkeeper/api/AddressTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * This work was created by participants in the DataONE project, and is
- * jointly copyrighted by participating institutions in DataONE. For
- * more information on DataONE, see our web site at http://dataone.org.
- *
- * Copyright 2019
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.dataone.bookkeeper.api;
-
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import io.dropwizard.jackson.Jackson;
-import org.junit.jupiter.api.DisplayName;
-import org.junit.jupiter.api.Test;
-
-import static io.dropwizard.testing.FixtureHelpers.fixture;
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * Test the Address model
- */
-class AddressTest {
- private final static ObjectMapper MAPPER = Jackson.newObjectMapper();
- static {
- MAPPER.setSerializationInclusion(Include.NON_NULL);
- MAPPER.setSerializationInclusion(Include.NON_EMPTY);
- }
- private final static String ADDRESS_JSON = "fixtures/address.json";
- private static final String LINE1 = "735 State Street";
- private static final String LINE2 = "Suite 300";
- private static final String CITY = "Santa Barbara";
- private static final String STATE = "CA";
- private static final String POSTALCODE = "93106";
- private static final String COUNTRY = "USA";
-
- /**
- * Test serialization to JSON
- */
- @Test
- @DisplayName("Test Address model serialization")
- public void serializesToJSON() throws Exception {
- // Build the Address instance
- final Address address = new Address(LINE1, LINE2, CITY, STATE, POSTALCODE, COUNTRY);
-
- // Test the Address instance
- final String expected = MAPPER.writeValueAsString(
- MAPPER.readValue(fixture("fixtures/address.json"), Address.class));
- assertThat(MAPPER.writeValueAsString(address)).isEqualTo(expected);
-
- }
-
- /**
- * Test deserialization from JSON
- */
- @Test
- @DisplayName("Test Address model deserialization")
- public void deserializesFromJSON() throws Exception {
- // Build the Address instance
- final Address address = new Address(LINE1, LINE2, CITY, STATE, POSTALCODE, COUNTRY);
-
- // Test the Address instance
- final Address deserializedAddress =
- MAPPER.readValue(fixture("fixtures/address.json"), Address.class);
- assertThat(deserializedAddress).isEqualTo(address);
- }
-
-}
\ No newline at end of file
diff --git a/src/test/java/org/dataone/bookkeeper/api/CustomerTest.java b/src/test/java/org/dataone/bookkeeper/api/CustomerTest.java
deleted file mode 100644
index bad61ce..0000000
--- a/src/test/java/org/dataone/bookkeeper/api/CustomerTest.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * This work was created by participants in the DataONE project, and is
- * jointly copyrighted by participating institutions in DataONE. For
- * more information on DataONE, see our web site at http://dataone.org.
- *
- * Copyright 2019
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.dataone.bookkeeper.api;
-
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import io.dropwizard.jackson.Jackson;
-import org.junit.jupiter.api.DisplayName;
-import org.junit.jupiter.api.Test;
-
-import java.util.List;
-
-import static io.dropwizard.testing.FixtureHelpers.fixture;
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * Test the Customer model
- */
-@DisplayName("Customer model test")
-class CustomerTest {
- private final static ObjectMapper MAPPER = Jackson.newObjectMapper();
- static {
- MAPPER.setSerializationInclusion(Include.NON_NULL);
- MAPPER.setSerializationInclusion(Include.NON_EMPTY);
- }
- private final static String PRODUCT_JSON = "fixtures/customer.json";
- private final static Integer ID = 1;
- private final static String OBJECT = "customer";
- private final String SUBJECT = "http://orcid.org/0000-0002-8121-2341";
- private final Integer BALANCE = 0;
- private final Address ADDRESS = new Address(
- "735 State Street",
- "Suite 300",
- "Santa Barbara",
- "CA",
- "93106",
- "USA"
- );
- private final Integer CREATED = 1562866734;
- private final String CURRENCY = "USD";
- private final boolean DELINQUENT = false;
- private final String DESCRIPTION = "";
- private final ObjectNode DISCOUNT = MAPPER.createObjectNode();
- private final String EMAIL = "cjones@nceas.ucsb.edu";
- private final String INVOICEPREFIX = "";
- private final ObjectNode INVOICESETTINGS = MAPPER.createObjectNode();
- private final ObjectNode METADATA = MAPPER.createObjectNode();
- private final String GIVENNAME = "Christopher";
- private final String SURNAME = "Jones";
- private final String PHONE = "805-893-2500";
-
- /**
- * Test serialization to JSON
- */
- @Test
- @DisplayName("Test Customer model serialization")
- public void serializesToJSON() throws Exception {
- // Build the Customer instance
- final Customer customer = new Customer(ID, OBJECT, SUBJECT, BALANCE, ADDRESS, CREATED,
- CURRENCY, DELINQUENT, DESCRIPTION, DISCOUNT, EMAIL, INVOICEPREFIX, INVOICESETTINGS,
- METADATA, GIVENNAME, SURNAME, PHONE);
-
- // Test the Customer instance
- final String expected = MAPPER.writeValueAsString(
- MAPPER.readValue(fixture("fixtures/customer.json"), Customer.class));
- assertThat(MAPPER.writeValueAsString(customer)).isEqualTo(expected);
-
- }
-
- /**
- * Test deserialization from JSON
- */
- @Test
- @DisplayName("Test Customer model deserialization")
- public void deserializesFromJSON() throws Exception {
- // Build the Customer instance
- final Customer customer = new Customer(ID, OBJECT, SUBJECT, BALANCE, ADDRESS, CREATED,
- CURRENCY, DELINQUENT, DESCRIPTION, DISCOUNT, EMAIL, INVOICEPREFIX, INVOICESETTINGS,
- METADATA, GIVENNAME, SURNAME, PHONE);
-
- // Test the Customer instance
- final Customer deserializedCustomer =
- MAPPER.readValue(fixture("fixtures/customer.json"), Customer.class);
- assertThat(deserializedCustomer).isEqualTo(customer);
- }
-}
\ No newline at end of file
diff --git a/src/test/java/org/dataone/bookkeeper/api/FeatureTest.java b/src/test/java/org/dataone/bookkeeper/api/FeatureTest.java
deleted file mode 100644
index e92bc96..0000000
--- a/src/test/java/org/dataone/bookkeeper/api/FeatureTest.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * This work was created by participants in the DataONE project, and is
- * jointly copyrighted by participating institutions in DataONE. For
- * more information on DataONE, see our web site at http://dataone.org.
- *
- * Copyright 2019
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.dataone.bookkeeper.api;
-
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import io.dropwizard.jackson.Jackson;
-import org.junit.jupiter.api.DisplayName;
-import org.junit.jupiter.api.Test;
-
-import static io.dropwizard.testing.FixtureHelpers.fixture;
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * Test the Feature model
- */
-@DisplayName("Feature model test")
-class FeatureTest {
- private final static ObjectMapper MAPPER = Jackson.newObjectMapper();
- static {
- MAPPER.setSerializationInclusion(Include.NON_NULL);
- MAPPER.setSerializationInclusion(Include.NON_EMPTY);
- }
- private final static String FEATURE_JSON = "fixtures/feature.json";
- private final static String NAME = "custom_portal";
- private final static String LABEL = "Branded Portals";
- private final static String DESCRIPTION = "Showcase your research, data, results, " +
- "and usage metrics by building a custom web portal.";
- private final static Quota QUOTA = new Quota(
- null,
- "quota",
- "portal",
- 3.0,
- 3.0,
- null,
- "portal",
- null,
- null,
- null
- );
-
- /**
- * Test serialization to JSON
- */
- @Test
- @DisplayName("test Customer model serialization")
- public void serializesToJSON() throws Exception {
- // Build the Customer instance
- final Feature feature = new Feature(NAME, LABEL, DESCRIPTION, QUOTA);
-
- // Test the Feature instance
- final String expected = MAPPER.writeValueAsString(
- MAPPER.readValue(fixture(FEATURE_JSON), Feature.class));
- assertThat(MAPPER.writeValueAsString(feature)).isEqualTo(expected);
- }
-
- /**
- * Test deserialization from JSON
- */
- @Test
- @DisplayName("Test Feature model deserialization")
- public void deserializesFromJSON() throws Exception {
- // Build the Feature instance
- final Feature feature = new Feature(NAME, LABEL, DESCRIPTION, QUOTA);
-
- // Test the Feature instance
- final Feature deserializedFeature =
- MAPPER.readValue(fixture("fixtures/feature.json"), Feature.class);
- assertThat(deserializedFeature).isEqualTo(feature);
- }
-}
\ No newline at end of file
diff --git a/src/test/java/org/dataone/bookkeeper/api/OrderItemTest.java b/src/test/java/org/dataone/bookkeeper/api/OrderItemTest.java
deleted file mode 100644
index 7d02587..0000000
--- a/src/test/java/org/dataone/bookkeeper/api/OrderItemTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * This work was created by participants in the DataONE project, and is
- * jointly copyrighted by participating institutions in DataONE. For
- * more information on DataONE, see our web site at http://dataone.org.
- *
- * Copyright 2019
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.dataone.bookkeeper.api;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import io.dropwizard.jackson.Jackson;
-import org.junit.jupiter.api.DisplayName;
-import org.junit.jupiter.api.Test;
-
-import static io.dropwizard.testing.FixtureHelpers.fixture;
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * Test the OrderItem model
- */
-public class OrderItemTest {
- private final static ObjectMapper MAPPER = Jackson.newObjectMapper();
- static {
- MAPPER.setSerializationInclusion(JsonInclude.Include.NON_NULL);
- MAPPER.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
- }
- private static final String OBJECT = "order_item";
- private static final Integer AMOUNT = 500;
- private static final String CURRENCY = "USD";
- private static final String DESCRIPTION = "DataONE Individual Membership";
- private static final Integer PARENT = 12345;
- private static final Integer QUANTITY = 1;
- private static final String TYPE = "sku";
-
- @Test
- @DisplayName("Test OrderItem model serialization")
- public void serializesToJSON() throws Exception {
- // Build the OrderItem instance
- final OrderItem orderItem =
- new OrderItem(OBJECT, AMOUNT, CURRENCY, DESCRIPTION, PARENT, QUANTITY, TYPE);
-
- // Test the OrderItem instance
- final String expected = MAPPER.writeValueAsString(
- MAPPER.readValue(fixture("fixtures/orderItem.json"), OrderItem.class));
- assertThat(MAPPER.writeValueAsString(orderItem)).isEqualTo(expected);
- }
-
- /**
- * Test deserialization from JSON
- */
- @Test
- @DisplayName("Test OrderItem model deserialization")
- public void deserializesFromJSON() throws Exception {
- // Build the OrderItem instance
- final OrderItem orderItem =
- new OrderItem(OBJECT, AMOUNT, CURRENCY, DESCRIPTION, PARENT, QUANTITY, TYPE);
-
- // Test the OrderItem instance
- final OrderItem deserializedOrderItem =
- MAPPER.readValue(fixture("fixtures/orderItem.json"), OrderItem.class);
- assertThat(deserializedOrderItem).isEqualTo(orderItem);
- }
-
-}
diff --git a/src/test/java/org/dataone/bookkeeper/api/OrderTest.java b/src/test/java/org/dataone/bookkeeper/api/OrderTest.java
deleted file mode 100644
index fc99039..0000000
--- a/src/test/java/org/dataone/bookkeeper/api/OrderTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * This work was created by participants in the DataONE project, and is
- * jointly copyrighted by participating institutions in DataONE. For
- * more information on DataONE, see our web site at http://dataone.org.
- *
- * Copyright 2019
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.dataone.bookkeeper.api;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import io.dropwizard.jackson.Jackson;
-import org.dataone.bookkeeper.helpers.OrderHelper;
-import org.junit.jupiter.api.DisplayName;
-import org.junit.jupiter.api.Test;
-
-import static io.dropwizard.testing.FixtureHelpers.fixture;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.dataone.bookkeeper.helpers.OrderHelper.*;
-
-/**
- * Test the Order model
- */
-public class OrderTest {
- private final static ObjectMapper MAPPER = Jackson.newObjectMapper();
- static {
- MAPPER.setSerializationInclusion(JsonInclude.Include.NON_NULL);
- MAPPER.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
- }
- private final static String ORDER_JSON = "fixtures/order.json";
-
- /**
- * Test serialization to JSON
- * @throws Exception
- */
- @Test
- @DisplayName("Test Order model serialization")
- public void serializesToJSON() throws Exception {
- // Build a Order instance
- final Order order = createTestOrder(1, 2, 3, 4);
- final String actual = MAPPER.writeValueAsString(order);
-
- // Test the Order instance
- final String expected = MAPPER.writeValueAsString(
- MAPPER.readValue(fixture(ORDER_JSON), Order.class));
- assertThat(actual).isEqualTo(expected);
- }
-
- /**
- * Test deserialization from JSON
- */
- @Test
- @DisplayName("Test Order model deserialization")
- public void deserializesFromJSON() throws Exception {
- // Build the Order instance
- final Order order = OrderHelper.createTestOrder(1,2,3,4);
-
- // Test the Order instance
- final Order deserializedOrder =
- MAPPER.readValue(fixture(ORDER_JSON), Order.class);
- assertThat(deserializedOrder).isEqualTo(order);
-
- }
-
-}
diff --git a/src/test/java/org/dataone/bookkeeper/api/ProductTest.java b/src/test/java/org/dataone/bookkeeper/api/ProductTest.java
deleted file mode 100644
index 9d00451..0000000
--- a/src/test/java/org/dataone/bookkeeper/api/ProductTest.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * This work was created by participants in the DataONE project, and is
- * jointly copyrighted by participating institutions in DataONE. For
- * more information on DataONE, see our web site at http://dataone.org.
- *
- * Copyright 2019
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.dataone.bookkeeper.api;
-
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import io.dropwizard.jackson.Jackson;
-import org.dataone.bookkeeper.helpers.ProductHelper;
-import org.junit.jupiter.api.DisplayName;
-import org.junit.jupiter.api.Test;
-import static org.assertj.core.api.Assertions.assertThat;
-import static io.dropwizard.testing.FixtureHelpers.fixture;
-
-/**
- * Test the Product model
- */
-@DisplayName("Product model test")
-public class ProductTest {
- private final static ObjectMapper MAPPER = Jackson.newObjectMapper();
- static {
- MAPPER.setSerializationInclusion(Include.NON_NULL);
- MAPPER.setSerializationInclusion(Include.NON_EMPTY);
- }
- private final static String PRODUCT_JSON = "fixtures/product.json";
-
- /**
- * Test serialization to JSON
- * @throws Exception
- */
- @Test
- @DisplayName("Test Product model serialization")
- public void serializesToJSON() throws Exception {
- // Build a Product instance
- final Product product = ProductHelper.createTestProduct(1);
- final String actual = MAPPER.writeValueAsString(product);
-
- // Test the Product instance
- final String expected = MAPPER.writeValueAsString(
- MAPPER.readValue(fixture(PRODUCT_JSON), Product.class));
- assertThat(actual).isEqualTo(expected);
- }
-
- /**
- * Test deserialization from JSON
- */
- @Test
- @DisplayName("Test Product model deserialization")
- public void deserializesFromJSON() throws Exception {
- // Build the Product instance
- final Product product = ProductHelper.createTestProduct(1);
-
- // Test the Product instance
- final Product deserializedProduct =
- MAPPER.readValue(fixture(PRODUCT_JSON), Product.class);
- assertThat(deserializedProduct).isEqualTo(product);
-
- }
-
-}
diff --git a/src/test/java/org/dataone/bookkeeper/api/QuotaTest.java b/src/test/java/org/dataone/bookkeeper/api/QuotaTest.java
deleted file mode 100644
index cac153d..0000000
--- a/src/test/java/org/dataone/bookkeeper/api/QuotaTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * This work was created by participants in the DataONE project, and is
- * jointly copyrighted by participating institutions in DataONE. For
- * more information on DataONE, see our web site at http://dataone.org.
- *
- * Copyright 2019
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.dataone.bookkeeper.api;
-
-
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import io.dropwizard.jackson.Jackson;
-import org.junit.jupiter.api.DisplayName;
-import org.junit.jupiter.api.Test;
-
-import javax.validation.constraints.NotNull;
-
-import static io.dropwizard.testing.FixtureHelpers.fixture;
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * Test the quota model
- */
-class QuotaTest {
- private final static ObjectMapper MAPPER = Jackson.newObjectMapper();
- static {
- MAPPER.setSerializationInclusion(Include.NON_NULL);
- MAPPER.setSerializationInclusion(Include.NON_EMPTY);
- }
- private final static String QUOTA_JSON = "fixtures/quota.json";
- private static final Integer ID = 1;
- private static final String OBJECT = "quota";
- private static final String TYPE = "portal";
- private static final @NotNull Double SOFTLIMIT = 3.0;
- private static final @NotNull Double HARDLIMIT = 3.0;
- private static final Double USAGE = null;
- private static final String UNIT = "portal";
- private static final Integer MEMBERSHIP_ID = null;
- private static final String SUBJECT = null;
- private static final String NAME = null;
-
- /**
- * Test serialization to JSON
- */
- @Test
- @DisplayName("Test Quota model serialization")
- public void serializesToJSON() throws Exception {
- // Build the Quota instance
- final Quota quota = new Quota(ID, OBJECT, TYPE, SOFTLIMIT, HARDLIMIT,
- USAGE, UNIT, MEMBERSHIP_ID, SUBJECT, NAME);
- // Test the Quota instance
- final String expected = MAPPER.writeValueAsString(
- MAPPER.readValue(fixture("fixtures/quota.json"), Quota.class));
- assertThat(MAPPER.writeValueAsString(quota)).isEqualTo(expected);
-
- }
-
- /**
- * Test deserialization from JSON
- */
- @Test
- @DisplayName("Test Quota model deserialization")
- public void deserializesFromJSON() throws Exception {
- // Build the Quota instance
- final Quota quota = new Quota(ID, OBJECT, TYPE, SOFTLIMIT, HARDLIMIT,
- USAGE, UNIT, MEMBERSHIP_ID, SUBJECT, NAME);
-
- // Test the Quota instance
- final Quota deserializedQuota =
- MAPPER.readValue(fixture("fixtures/quota.json"), Quota.class);
- assertThat(deserializedQuota).isEqualTo(quota);
- }
-}
\ No newline at end of file
diff --git a/src/test/java/org/dataone/bookkeeper/api/UsageStatusTest.java b/src/test/java/org/dataone/bookkeeper/api/UsageStatusTest.java
deleted file mode 100644
index 5f88bda..0000000
--- a/src/test/java/org/dataone/bookkeeper/api/UsageStatusTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * This work was created by participants in the DataONE project, and is
- * jointly copyrighted by participating institutions in DataONE. For
- * more information on DataONE, see our web site at http://dataone.org.
- *
- * Copyright 2029
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.dataone.bookkeeper.api;
-
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import io.dropwizard.jackson.Jackson;
-import org.junit.Ignore;
-import org.junit.jupiter.api.DisplayName;
-import org.junit.jupiter.api.Test;
-
-import static io.dropwizard.testing.FixtureHelpers.fixture;
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * Test the usagestatus model
- */
-class UsageStatusTest {
- private final static ObjectMapper MAPPER = Jackson.newObjectMapper();
- static {
- MAPPER.setSerializationInclusion(Include.NON_NULL);
- MAPPER.setSerializationInclusion(Include.NON_EMPTY);
- }
- private final static String USAGESTATUS_JSON = "fixtures/usagestatus.json";
- private final static String OBJECT = "usagestatus";
- private static final String STATUS = "active";
-
-
- /**
- * Test serialization to JSON
- */
- @Test
- @Ignore
- @DisplayName("Test UsageStatus model serialization")
- public void serializesToJSON() throws Exception {
- // Build the UsageStatus instance
- final UsageStatus usagestatus = new UsageStatus(OBJECT, STATUS);
- // Test the UsageStatus instance
- final String expected = MAPPER.writeValueAsString(
- MAPPER.readValue(fixture(USAGESTATUS_JSON), UsageStatus.class));
- assertThat(MAPPER.writeValueAsString(usagestatus)).isEqualTo(expected);
- }
-
- /**
- * Test deserialization from JSON
- */
- @Test
- @Ignore
- @DisplayName("Test UsageStatus model deserialization")
- public void deserializesFromJSON() throws Exception {
- // Build the UsageStatus instance
- final UsageStatus usagestatus = new UsageStatus(OBJECT, STATUS);
- // Test the UsageStatus instance
- final UsageStatus deserializedUsageStatus =
- MAPPER.readValue(fixture(USAGESTATUS_JSON), UsageStatus.class);
- assertThat(deserializedUsageStatus).isEqualTo(usagestatus);
- }
-}
diff --git a/src/test/java/org/dataone/bookkeeper/api/UsageTest.java b/src/test/java/org/dataone/bookkeeper/api/UsageTest.java
deleted file mode 100644
index 7dac8ed..0000000
--- a/src/test/java/org/dataone/bookkeeper/api/UsageTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * This work was created by participants in the DataONE project, and is
- * jointly copyrighted by participating institutions in DataONE. For
- * more information on DataONE, see our web site at http://dataone.org.
- *
- * Copyright 2019
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.dataone.bookkeeper.api;
-
-
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import io.dropwizard.jackson.Jackson;
-import org.junit.jupiter.api.DisplayName;
-import org.junit.jupiter.api.Test;
-
-import javax.validation.constraints.NotNull;
-
-import static io.dropwizard.testing.FixtureHelpers.fixture;
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * Test the usage model
- */
-class UsageTest {
- private final static ObjectMapper MAPPER = Jackson.newObjectMapper();
- static {
- MAPPER.setSerializationInclusion(Include.NON_NULL);
- MAPPER.setSerializationInclusion(Include.NON_EMPTY);
- }
- private final static String USAGE_JSON = "fixtures/usage.json";
- private static final Integer ID = 54321;
- private static final String OBJECT = "usage";
- private static final Integer QUOTA_ID = 1;
- private static final String INSTANCE_ID = "urn:uuid:56925d4b-9e46-49ec-96ea-38dc9ed0a64c";
- private static final @NotNull Double QUANTITY = 1.0;
- private static final String STATUS = "active";
- private static final String NODE_ID = "urn:node:testNode";
-
-
- /**
- * Test serialization to JSON
- */
- @Test
- @DisplayName("Test Usage model serialization")
- public void serializesToJSON() throws Exception {
- // Build the Usage instance
- final Usage usage = new Usage(ID, OBJECT, QUOTA_ID, INSTANCE_ID, QUANTITY, STATUS, NODE_ID);
- // Test the Usage instance
- final String expected = MAPPER.writeValueAsString(
- MAPPER.readValue(fixture("fixtures/usage.json"), Usage.class));
- assertThat(MAPPER.writeValueAsString(usage)).isEqualTo(expected);
-
- }
-
- /**
- * Test deserialization from JSON
- */
- @Test
- @DisplayName("Test Usage model deserialization")
- public void deserializesFromJSON() throws Exception {
- // Build the Usage instance
- final Usage usage = new Usage(ID, OBJECT, QUOTA_ID, INSTANCE_ID, QUANTITY, STATUS, NODE_ID);
- // Test the Usage instance
- final Usage deserializedUsage =
- MAPPER.readValue(fixture("fixtures/usage.json"), Usage.class);
- assertThat(deserializedUsage).isEqualTo(usage);
- }
-}
\ No newline at end of file