Skip to content

Commit

Permalink
Merge pull request #251 from qbicsoftware/release/2.11.0
Browse files Browse the repository at this point in the history
2.11.0 (2021-08-03)
----------------------------

**Added**

* A new enumeration for facilities ``life.qbic.datamodel.dtos.business.facilities.Facility`` (<#244>)
* New properties ``internalUnitPrice``, ``externalUnitPrice`` and ``serviceProvider`` for the ``life.qbic.datamodel.dtos.business.services.Product`` and its derivatives (<#245>)
* New properties ``totalPrice`` and ``totalDiscountPrice`` for the ``life.qbic.datamodel.dtos.business.ProductItem`` and ``totalDiscountPrice`` for the ``life.qbic.datamodel.dtos.business.Offer``
* A ``life.qbic.datamodel.dtos.business.facilities.FacilityFactory`` to get the facility for a given string representation (<#247>)

**Fixed**

* ProjectSpace names are now validated (<#249>)

**Dependencies**

**Deprecated**

* The ``unitPrice`` property in ``life.qbic.datamodel.dtos.business.services.Product``
  • Loading branch information
KochTobi authored Aug 3, 2021
2 parents 7e61ac1 + 8964db4 commit ad49fc8
Show file tree
Hide file tree
Showing 22 changed files with 505 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .qube.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ email: [email protected]
project_name: data-model-lib
project_short_description: "Data models. A collection of QBiC's central data models\
\ and DTOs. "
version: 2.10.0-SNAPSHOT
version: 2.11.0
domain: lib
language: groovy
project_slug: data-model-lib
Expand Down
21 changes: 21 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,27 @@ Changelog

This project adheres to `Semantic Versioning <https://semver.org/>`_.

2.11.0 (2021-08-03)
----------------------------

**Added**

* A new enumeration for facilities ``life.qbic.datamodel.dtos.business.facilities.Facility`` (`#244 <https://github.com/qbicsoftware/data-model-lib/pull/244>`_)
* New properties ``internalUnitPrice``, ``externalUnitPrice`` and ``serviceProvider`` for the ``life.qbic.datamodel.dtos.business.services.Product`` and its derivatives (`#245 <https://github.com/qbicsoftware/data-model-lib/pull/245>`_)
* New properties ``totalPrice`` and ``totalDiscountPrice`` for the ``life.qbic.datamodel.dtos.business.ProductItem`` and ``totalDiscountPrice`` for the ``life.qbic.datamodel.dtos.business.Offer``
* A ``life.qbic.datamodel.dtos.business.facilities.FacilityFactory`` to get the facility for a given string representation (`#247 <https://github.com/qbicsoftware/data-model-lib/pull/247>`_)

**Fixed**

* ProjectSpace names are now validated (`#249 <https://github.com/qbicsoftware/data-model-lib/pull/249>`_)

**Dependencies**

**Deprecated**

* The ``unitPrice`` property in ``life.qbic.datamodel.dtos.business.services.Product``


2.10.0 (2021-07-19)
-------------------

Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
# the built documents.
#
# The short X.Y version.
version = '2.10.0-SNAPSHOT'
version = '2.11.0'
# The full version, including alpha/beta/rc tags.
release = '2.10.0-SNAPSHOT'
release = '2.11.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<groupId>life.qbic</groupId>
<artifactId>data-model-lib</artifactId>
<version>2.10.0-SNAPSHOT</version> <!-- <<QUBE_FORCE_BUMP>> -->
<version>2.11.0</version> <!-- <<QUBE_FORCE_BUMP>> -->
<name>data-model-lib</name>
<url>http://github.com/qbicsoftware/data-model-lib</url>
<description>Data models. A collection of QBiC's central data models and DTOs. </description>
Expand Down
2 changes: 1 addition & 1 deletion qube.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 2.10.0-SNAPSHOT
current_version = 2.11.0

[bumpversion_files_whitelisted]
dot_qube = .qube.yml
Expand Down
12 changes: 12 additions & 0 deletions src/main/groovy/life/qbic/datamodel/dtos/business/Offer.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ class Offer {
* The amount of overheads part, of the total price
*/
final double overheads
/**
* The sum of all discounts for this offer
*/
final double totalDiscountPrice
/**
* The identifier for the offer which makes it distinguishable from other offers
*/
Expand Down Expand Up @@ -132,6 +136,7 @@ class Offer {
*/
double totalPrice
double netPrice
double totalDiscountPrice
double taxes
double overheads
double itemsWithOverheadNet
Expand Down Expand Up @@ -165,6 +170,7 @@ class Offer {
this.overheads = 0
this.taxes = 0
this.totalPrice = 0
this.totalDiscountPrice = 0
this.itemsWithOverhead = []
this.itemsWithoutOverhead = []
this.itemsWithOverheadNet = 0
Expand Down Expand Up @@ -263,6 +269,11 @@ class Offer {
return this
}

Builder totalDiscountPrice(double totalDiscountPrice){
this.totalDiscountPrice = totalDiscountPrice
return this
}

Offer build() {
return new Offer(this)
}
Expand Down Expand Up @@ -306,6 +317,7 @@ class Offer {
this.itemsWithOverheadNetPrice = builder.itemsWithOverheadNet
this.itemsWithoutOverheadNetPrice = builder.itemsWithoutOverheadNet
this.overheadRatio = builder.overheadRatio
this.totalDiscountPrice = builder.totalDiscountPrice

if (builder.associatedProject.isPresent()) {
this.associatedProject = Optional.of(builder.associatedProject.get())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,38 @@ class ProductItem {
*/
final Product product

/**
* Describes the total price of an item based on the quantity and unit price of a product
*/
final double totalPrice

/**
* Describe the total discount price for a product (based on the quantity)
*/
final double quantityDiscount

/**
*
* @param quantity The quantity of a product
* @param product The product for which an item is created
*
* @deprecated 2.11.0
*/
@Deprecated
ProductItem(double quantity, Product product) {
this.quantity = quantity
this.product = product
this.totalPrice = 0
this.quantityDiscount = 0
}

}
ProductItem(double quantity, Product product, double totalPrice, double quantityDiscount) {
this.quantity = quantity
this.product = product
this.totalPrice = totalPrice
this.quantityDiscount = quantityDiscount
}



}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package life.qbic.datamodel.dtos.business.facilities

/**
* <p>Controlled vocabulary for concise core facility labels.</p>
*
* <p>The following facilities are currently defined:</p>
*
* <ul>
* <li>CFMB: Core Facility for Medical Bioanalytics</li>
* <li>IMGAG: Institute for Medical Genetics and Applied Genomics</li>
* <li>MGM: Institute for Medical Microbiology and Hygiene</li>
* <li>QBIC: Quantitative Biology Center</li>
* <li>PCT: Proteome Center Tübingen</li>
* </ul>
*
* @since 2.11.0
*/
enum Facility {

CFMB("Core Facility for Medical Bioanalytics"),
IMGAG("Institute for Medical Genetics and Applied Genomics"),
MGM("Institute for Medical Microbiology and Hygiene"),
QBIC("Quantitative Biology Center"),
PCT("Proteome Center Tübingen")

private final String fullName

/**
* Creates an instance of a facility enum
* @param fullName The full name representation of the enum
*/
Facility(String fullName) {
this.fullName = fullName
}

/**
* Returns to the full name representation of the facility
* @return
*/
String getFullName() {
return this.fullName
}

/**
* Returns a String representation of the facility enum.
*
* Is equivalent to {@link #getFullName()}.
* @return
*/
@Override
String toString() {
return this.getFullName()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package life.qbic.datamodel.dtos.business.facilities

import life.qbic.datamodel.dtos.EnumFactory

/**
* This class provides functionality for enum key retrieval
*
* This class retrieves the corresponding Facility for a given String
*
* @see Facility
* @since: 2.11.0
*/
class FacilityFactory extends EnumFactory<Facility> {
/**
* This method returns the enum with the provided String value.
*
* @throws IllegalArgumentException in case the String could not be mapped
* @param value the String corresponding to a key of the enum
* @return the enum key for the provided string value
* @since 2.11.0
*/
@Override
Facility getForString(String value) {
Facility desiredKey
desiredKey = Facility.values().find {it.fullName.equals(value.trim())}
if (!desiredKey) {
throw new IllegalArgumentException("Invalid value '$value' for ${Facility.getSimpleName()}")
}
return desiredKey
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package life.qbic.datamodel.dtos.business.services

import groovy.transform.EqualsAndHashCode
import life.qbic.datamodel.dtos.business.ProductId
import life.qbic.datamodel.dtos.business.facilities.Facility

/**
* Describes a product type that can only have positive natural unit multipliers (N={0,1...,inf+})
Expand All @@ -23,8 +24,30 @@ class AtomicProduct extends Product {
* @param unitPrice The price in € per unit
* @param unit The product unit
* @param productId The product identifier
*
* @deprecated 2.11.0
*/
@Deprecated
AtomicProduct(String name, String description, double unitPrice, ProductUnit unit, ProductId productId) {
super(name, description, unitPrice, unit, productId)
}

/**
* Basic product constructor.
*
* Checks that all passed arguments are not null.
*
* @param name The name of the product.
* @param description The description of what the product is about.
* @param internalUnitPrice The price in € per unit for internal customers
* @param externalUnitPrice The price in € per unit for external customers
* @param unit The product unit
* @param productId The product identifier
* @param serviceProvider The facility providing the service product
*
* @since 2.11.0
*/
AtomicProduct(String name, String description, double internalUnitPrice, double externalUnitPrice, ProductUnit unit, ProductId productId, Facility serviceProvider) {
super(name, description, internalUnitPrice, externalUnitPrice, unit, productId, serviceProvider)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package life.qbic.datamodel.dtos.business.services

import groovy.transform.EqualsAndHashCode
import life.qbic.datamodel.dtos.business.ProductId
import life.qbic.datamodel.dtos.business.facilities.Facility

/**
* Describes a product for data storage services.
Expand Down Expand Up @@ -37,8 +38,29 @@ class DataStorage extends PartialProduct {
* @param unitPrice The price in € per unit
* @param unit The product unit
* @param runningNumber Number used in conjunction with ProductType{@link life.qbic.datamodel.dtos.business.services.ProductType} to identify product
*
* @deprecated 2.11.0
*/
@Deprecated
DataStorage(String name, String description, double unitPrice, ProductUnit unit, long runningNumber) {
super(name, description, unitPrice, unit, new ProductId.Builder(ProductType.DATA_STORAGE.toString(), runningNumber).build())
}

/**
* Basic product constructor.
*
* Checks that all passed arguments are not null.
*
* @param name The name of the product.
* @param description The description of what the product is about.
* @param internalUnitPrice The price in € per unit for internal customers
* @param externalUnitPrice The price in € per unit for external customers
* @param unit The product unit
* @param runningNumber Number used in conjunction with ProductType{@link life.qbic.datamodel.dtos.business.services.ProductType} to identify product
*
* @since 2.11.0
*/
DataStorage(String name, String description, double internalUnitPrice, double externalUnitPrice, ProductUnit unit, long runningNumber, Facility serviceProvider) {
super(name, description, internalUnitPrice, externalUnitPrice, unit, new ProductId.Builder(ProductType.DATA_STORAGE.toString(), runningNumber).build(), serviceProvider)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package life.qbic.datamodel.dtos.business.services

import groovy.transform.EqualsAndHashCode
import life.qbic.datamodel.dtos.business.ProductId
import life.qbic.datamodel.dtos.business.facilities.Facility

/**
* Describes a product for metabolomics services.
Expand Down Expand Up @@ -37,9 +38,31 @@ class MetabolomicAnalysis extends AtomicProduct {
* @param unitPrice The price in € per unit
* @param unit The product unit
* @param runningNumber Number used in conjunction with ProductType{@link life.qbic.datamodel.dtos.business.services.ProductType} to identify product
*
* @deprecated 2.11.0
*/
@Deprecated
MetabolomicAnalysis(String name, String description, double unitPrice, ProductUnit unit, long runningNumber) {
super(name, description, unitPrice, unit, new ProductId.Builder(ProductType.METABOLOMIC.toString(), runningNumber).build())
}

/**
* Basic product constructor.
*
* Checks that all passed arguments are not null.
*
* @param name The name of the product.
* @param description The description of what the product is about.
* @param internalUnitPrice The price in € per unit for internal customers
* @param externalUnitPrice The price in € per unit for external customers
* @param unit The product unit
* @param runningNumber Number used in conjunction with ProductType{@link life.qbic.datamodel.dtos.business.services.ProductType} to identify product
* @param serviceProvider The facility providing the service product
*
* @since 2.11.0
*/
MetabolomicAnalysis(String name, String description, double internalUnitPrice, double externalUnitPrice, ProductUnit unit, long runningNumber, Facility serviceProvider) {
super(name, description, internalUnitPrice, externalUnitPrice, unit, new ProductId.Builder(ProductType.METABOLOMIC.toString(), runningNumber).build(), serviceProvider)
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package life.qbic.datamodel.dtos.business.services

import groovy.transform.EqualsAndHashCode
import life.qbic.datamodel.dtos.business.ProductId
import life.qbic.datamodel.dtos.business.facilities.Facility

/**
* Describes a product type that can only have positive natural unit multipliers (N={0,1...,inf+})
* Describes a product type that can have positive rational unit multipliers (N={0,1...,inf+})
*
* An example for an PartialProduct is a sample data storage service product. You can offer
* multiple of this product and express the quantities as i.e. 1.5 * 1 Terabyte (100€/Tb) => 1.5
Expand All @@ -24,8 +25,30 @@ class PartialProduct extends Product {
* @param unitPrice The price in € per unit
* @param unit The product unit
* @param productId The product identifier
*
* @deprecated 2.11.0
*/
@Deprecated
PartialProduct(String name, String description, double unitPrice, ProductUnit unit, ProductId productId) {
super(name, description, unitPrice, unit, productId)
}

/**
* Basic product constructor.
*
* Checks that all passed arguments are not null.
*
* @param name The name of the product.
* @param description The description of what the product is about.
* @param internalUnitPrice The price in € per unit for internal customers
* @param externalUnitPrice The price in € per unit for external customers
* @param unit The product unit
* @param productId The product identifier
* @param serviceProvider The facility providing the service product
*
* @since 2.11.0
*/
PartialProduct(String name, String description, double internalUnitPrice, double externalUnitPrice, ProductUnit unit, ProductId productId, Facility serviceProvider) {
super(name, description, internalUnitPrice, externalUnitPrice, unit, productId, serviceProvider)
}
}
Loading

0 comments on commit ad49fc8

Please sign in to comment.