Skip to content

Commit ad49fc8

Browse files
authored
Merge pull request #251 from qbicsoftware/release/2.11.0
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``
2 parents 7e61ac1 + 8964db4 commit ad49fc8

File tree

22 files changed

+505
-13
lines changed

22 files changed

+505
-13
lines changed

.qube.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ email: sven.fillinger@qbic.uni-tuebingen.de
44
project_name: data-model-lib
55
project_short_description: "Data models. A collection of QBiC's central data models\
66
\ and DTOs. "
7-
version: 2.10.0-SNAPSHOT
7+
version: 2.11.0
88
domain: lib
99
language: groovy
1010
project_slug: data-model-lib

CHANGELOG.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,27 @@ Changelog
44

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

7+
2.11.0 (2021-08-03)
8+
----------------------------
9+
10+
**Added**
11+
12+
* A new enumeration for facilities ``life.qbic.datamodel.dtos.business.facilities.Facility`` (`#244 <https://github.com/qbicsoftware/data-model-lib/pull/244>`_)
13+
* 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>`_)
14+
* New properties ``totalPrice`` and ``totalDiscountPrice`` for the ``life.qbic.datamodel.dtos.business.ProductItem`` and ``totalDiscountPrice`` for the ``life.qbic.datamodel.dtos.business.Offer``
15+
* 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>`_)
16+
17+
**Fixed**
18+
19+
* ProjectSpace names are now validated (`#249 <https://github.com/qbicsoftware/data-model-lib/pull/249>`_)
20+
21+
**Dependencies**
22+
23+
**Deprecated**
24+
25+
* The ``unitPrice`` property in ``life.qbic.datamodel.dtos.business.services.Product``
26+
27+
728
2.10.0 (2021-07-19)
829
-------------------
930

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@
5555
# the built documents.
5656
#
5757
# The short X.Y version.
58-
version = '2.10.0-SNAPSHOT'
58+
version = '2.11.0'
5959
# The full version, including alpha/beta/rc tags.
60-
release = '2.10.0-SNAPSHOT'
60+
release = '2.11.0'
6161

6262
# The language for content autogenerated by Sphinx. Refer to documentation
6363
# for a list of supported languages.

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<groupId>life.qbic</groupId>
99
<artifactId>data-model-lib</artifactId>
10-
<version>2.10.0-SNAPSHOT</version> <!-- <<QUBE_FORCE_BUMP>> -->
10+
<version>2.11.0</version> <!-- <<QUBE_FORCE_BUMP>> -->
1111
<name>data-model-lib</name>
1212
<url>http://github.com/qbicsoftware/data-model-lib</url>
1313
<description>Data models. A collection of QBiC's central data models and DTOs. </description>

qube.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 2.10.0-SNAPSHOT
2+
current_version = 2.11.0
33

44
[bumpversion_files_whitelisted]
55
dot_qube = .qube.yml

src/main/groovy/life/qbic/datamodel/dtos/business/Offer.groovy

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ class Offer {
7272
* The amount of overheads part, of the total price
7373
*/
7474
final double overheads
75+
/**
76+
* The sum of all discounts for this offer
77+
*/
78+
final double totalDiscountPrice
7579
/**
7680
* The identifier for the offer which makes it distinguishable from other offers
7781
*/
@@ -132,6 +136,7 @@ class Offer {
132136
*/
133137
double totalPrice
134138
double netPrice
139+
double totalDiscountPrice
135140
double taxes
136141
double overheads
137142
double itemsWithOverheadNet
@@ -165,6 +170,7 @@ class Offer {
165170
this.overheads = 0
166171
this.taxes = 0
167172
this.totalPrice = 0
173+
this.totalDiscountPrice = 0
168174
this.itemsWithOverhead = []
169175
this.itemsWithoutOverhead = []
170176
this.itemsWithOverheadNet = 0
@@ -263,6 +269,11 @@ class Offer {
263269
return this
264270
}
265271

272+
Builder totalDiscountPrice(double totalDiscountPrice){
273+
this.totalDiscountPrice = totalDiscountPrice
274+
return this
275+
}
276+
266277
Offer build() {
267278
return new Offer(this)
268279
}
@@ -306,6 +317,7 @@ class Offer {
306317
this.itemsWithOverheadNetPrice = builder.itemsWithOverheadNet
307318
this.itemsWithoutOverheadNetPrice = builder.itemsWithoutOverheadNet
308319
this.overheadRatio = builder.overheadRatio
320+
this.totalDiscountPrice = builder.totalDiscountPrice
309321

310322
if (builder.associatedProject.isPresent()) {
311323
this.associatedProject = Optional.of(builder.associatedProject.get())

src/main/groovy/life/qbic/datamodel/dtos/business/ProductItem.groovy

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,38 @@ class ProductItem {
2323
*/
2424
final Product product
2525

26+
/**
27+
* Describes the total price of an item based on the quantity and unit price of a product
28+
*/
29+
final double totalPrice
30+
31+
/**
32+
* Describe the total discount price for a product (based on the quantity)
33+
*/
34+
final double quantityDiscount
35+
36+
/**
37+
*
38+
* @param quantity The quantity of a product
39+
* @param product The product for which an item is created
40+
*
41+
* @deprecated 2.11.0
42+
*/
43+
@Deprecated
2644
ProductItem(double quantity, Product product) {
2745
this.quantity = quantity
2846
this.product = product
47+
this.totalPrice = 0
48+
this.quantityDiscount = 0
2949
}
3050

31-
}
51+
ProductItem(double quantity, Product product, double totalPrice, double quantityDiscount) {
52+
this.quantity = quantity
53+
this.product = product
54+
this.totalPrice = totalPrice
55+
this.quantityDiscount = quantityDiscount
56+
}
3257

58+
59+
60+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package life.qbic.datamodel.dtos.business.facilities
2+
3+
/**
4+
* <p>Controlled vocabulary for concise core facility labels.</p>
5+
*
6+
* <p>The following facilities are currently defined:</p>
7+
*
8+
* <ul>
9+
* <li>CFMB: Core Facility for Medical Bioanalytics</li>
10+
* <li>IMGAG: Institute for Medical Genetics and Applied Genomics</li>
11+
* <li>MGM: Institute for Medical Microbiology and Hygiene</li>
12+
* <li>QBIC: Quantitative Biology Center</li>
13+
* <li>PCT: Proteome Center Tübingen</li>
14+
* </ul>
15+
*
16+
* @since 2.11.0
17+
*/
18+
enum Facility {
19+
20+
CFMB("Core Facility for Medical Bioanalytics"),
21+
IMGAG("Institute for Medical Genetics and Applied Genomics"),
22+
MGM("Institute for Medical Microbiology and Hygiene"),
23+
QBIC("Quantitative Biology Center"),
24+
PCT("Proteome Center Tübingen")
25+
26+
private final String fullName
27+
28+
/**
29+
* Creates an instance of a facility enum
30+
* @param fullName The full name representation of the enum
31+
*/
32+
Facility(String fullName) {
33+
this.fullName = fullName
34+
}
35+
36+
/**
37+
* Returns to the full name representation of the facility
38+
* @return
39+
*/
40+
String getFullName() {
41+
return this.fullName
42+
}
43+
44+
/**
45+
* Returns a String representation of the facility enum.
46+
*
47+
* Is equivalent to {@link #getFullName()}.
48+
* @return
49+
*/
50+
@Override
51+
String toString() {
52+
return this.getFullName()
53+
}
54+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package life.qbic.datamodel.dtos.business.facilities
2+
3+
import life.qbic.datamodel.dtos.EnumFactory
4+
5+
/**
6+
* This class provides functionality for enum key retrieval
7+
*
8+
* This class retrieves the corresponding Facility for a given String
9+
*
10+
* @see Facility
11+
* @since: 2.11.0
12+
*/
13+
class FacilityFactory extends EnumFactory<Facility> {
14+
/**
15+
* This method returns the enum with the provided String value.
16+
*
17+
* @throws IllegalArgumentException in case the String could not be mapped
18+
* @param value the String corresponding to a key of the enum
19+
* @return the enum key for the provided string value
20+
* @since 2.11.0
21+
*/
22+
@Override
23+
Facility getForString(String value) {
24+
Facility desiredKey
25+
desiredKey = Facility.values().find {it.fullName.equals(value.trim())}
26+
if (!desiredKey) {
27+
throw new IllegalArgumentException("Invalid value '$value' for ${Facility.getSimpleName()}")
28+
}
29+
return desiredKey
30+
}
31+
}

src/main/groovy/life/qbic/datamodel/dtos/business/services/AtomicProduct.groovy

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package life.qbic.datamodel.dtos.business.services
22

33
import groovy.transform.EqualsAndHashCode
44
import life.qbic.datamodel.dtos.business.ProductId
5+
import life.qbic.datamodel.dtos.business.facilities.Facility
56

67
/**
78
* Describes a product type that can only have positive natural unit multipliers (N={0,1...,inf+})
@@ -23,8 +24,30 @@ class AtomicProduct extends Product {
2324
* @param unitPrice The price in € per unit
2425
* @param unit The product unit
2526
* @param productId The product identifier
27+
*
28+
* @deprecated 2.11.0
2629
*/
30+
@Deprecated
2731
AtomicProduct(String name, String description, double unitPrice, ProductUnit unit, ProductId productId) {
2832
super(name, description, unitPrice, unit, productId)
2933
}
34+
35+
/**
36+
* Basic product constructor.
37+
*
38+
* Checks that all passed arguments are not null.
39+
*
40+
* @param name The name of the product.
41+
* @param description The description of what the product is about.
42+
* @param internalUnitPrice The price in € per unit for internal customers
43+
* @param externalUnitPrice The price in € per unit for external customers
44+
* @param unit The product unit
45+
* @param productId The product identifier
46+
* @param serviceProvider The facility providing the service product
47+
*
48+
* @since 2.11.0
49+
*/
50+
AtomicProduct(String name, String description, double internalUnitPrice, double externalUnitPrice, ProductUnit unit, ProductId productId, Facility serviceProvider) {
51+
super(name, description, internalUnitPrice, externalUnitPrice, unit, productId, serviceProvider)
52+
}
3053
}

0 commit comments

Comments
 (0)