Skip to content

Commit 3c78e39

Browse files
sven1103wow-such-codeKochTobi
authored
Add internal, external unit price and service provider in products (#245)
Co-authored-by: wow-such-code <andreas.friedrich@uni-tuebingen.de> Co-authored-by: Tobias Koch <KochTobi@users.noreply.github.com>
1 parent 59dc9ef commit 3c78e39

File tree

12 files changed

+285
-7
lines changed

12 files changed

+285
-7
lines changed

CHANGELOG.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,16 @@ This project adheres to `Semantic Versioning <https://semver.org/>`_.
1010
**Added**
1111

1212
* 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>`_)
1314

1415
**Fixed**
1516

1617
**Dependencies**
1718

1819
**Deprecated**
1920

21+
* The ``unitPrice`` property in ``life.qbic.datamodel.dtos.business.services.Product``
22+
2023

2124
2.10.0 (2021-07-19)
2225
-------------------

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
}

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

Lines changed: 22 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 for data storage services.
@@ -37,8 +38,29 @@ class DataStorage extends PartialProduct {
3738
* @param unitPrice The price in € per unit
3839
* @param unit The product unit
3940
* @param runningNumber Number used in conjunction with ProductType{@link life.qbic.datamodel.dtos.business.services.ProductType} to identify product
41+
*
42+
* @deprecated 2.11.0
4043
*/
44+
@Deprecated
4145
DataStorage(String name, String description, double unitPrice, ProductUnit unit, long runningNumber) {
4246
super(name, description, unitPrice, unit, new ProductId.Builder(ProductType.DATA_STORAGE.toString(), runningNumber).build())
4347
}
48+
49+
/**
50+
* Basic product constructor.
51+
*
52+
* Checks that all passed arguments are not null.
53+
*
54+
* @param name The name of the product.
55+
* @param description The description of what the product is about.
56+
* @param internalUnitPrice The price in € per unit for internal customers
57+
* @param externalUnitPrice The price in € per unit for external customers
58+
* @param unit The product unit
59+
* @param runningNumber Number used in conjunction with ProductType{@link life.qbic.datamodel.dtos.business.services.ProductType} to identify product
60+
*
61+
* @since 2.11.0
62+
*/
63+
DataStorage(String name, String description, double internalUnitPrice, double externalUnitPrice, ProductUnit unit, long runningNumber, Facility serviceProvider) {
64+
super(name, description, internalUnitPrice, externalUnitPrice, unit, new ProductId.Builder(ProductType.DATA_STORAGE.toString(), runningNumber).build(), serviceProvider)
65+
}
4466
}

src/main/groovy/life/qbic/datamodel/dtos/business/services/MetabolomicAnalysis.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 for metabolomics services.
@@ -37,9 +38,31 @@ class MetabolomicAnalysis extends AtomicProduct {
3738
* @param unitPrice The price in € per unit
3839
* @param unit The product unit
3940
* @param runningNumber Number used in conjunction with ProductType{@link life.qbic.datamodel.dtos.business.services.ProductType} to identify product
41+
*
42+
* @deprecated 2.11.0
4043
*/
44+
@Deprecated
4145
MetabolomicAnalysis(String name, String description, double unitPrice, ProductUnit unit, long runningNumber) {
4246
super(name, description, unitPrice, unit, new ProductId.Builder(ProductType.METABOLOMIC.toString(), runningNumber).build())
4347
}
48+
49+
/**
50+
* Basic product constructor.
51+
*
52+
* Checks that all passed arguments are not null.
53+
*
54+
* @param name The name of the product.
55+
* @param description The description of what the product is about.
56+
* @param internalUnitPrice The price in € per unit for internal customers
57+
* @param externalUnitPrice The price in € per unit for external customers
58+
* @param unit The product unit
59+
* @param runningNumber Number used in conjunction with ProductType{@link life.qbic.datamodel.dtos.business.services.ProductType} to identify product
60+
* @param serviceProvider The facility providing the service product
61+
*
62+
* @since 2.11.0
63+
*/
64+
MetabolomicAnalysis(String name, String description, double internalUnitPrice, double externalUnitPrice, ProductUnit unit, long runningNumber, Facility serviceProvider) {
65+
super(name, description, internalUnitPrice, externalUnitPrice, unit, new ProductId.Builder(ProductType.METABOLOMIC.toString(), runningNumber).build(), serviceProvider)
66+
}
4467
}
4568

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

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ 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
/**
7-
* Describes a product type that can only have positive natural unit multipliers (N={0,1...,inf+})
8+
* Describes a product type that can have positive rational unit multipliers (N={0,1...,inf+})
89
*
910
* An example for an PartialProduct is a sample data storage service product. You can offer
1011
* multiple of this product and express the quantities as i.e. 1.5 * 1 Terabyte (100€/Tb) => 1.5
@@ -24,8 +25,30 @@ class PartialProduct extends Product {
2425
* @param unitPrice The price in € per unit
2526
* @param unit The product unit
2627
* @param productId The product identifier
28+
*
29+
* @deprecated 2.11.0
2730
*/
31+
@Deprecated
2832
PartialProduct(String name, String description, double unitPrice, ProductUnit unit, ProductId productId) {
2933
super(name, description, unitPrice, unit, productId)
3034
}
35+
36+
/**
37+
* Basic product constructor.
38+
*
39+
* Checks that all passed arguments are not null.
40+
*
41+
* @param name The name of the product.
42+
* @param description The description of what the product is about.
43+
* @param internalUnitPrice The price in € per unit for internal customers
44+
* @param externalUnitPrice The price in € per unit for external customers
45+
* @param unit The product unit
46+
* @param productId The product identifier
47+
* @param serviceProvider The facility providing the service product
48+
*
49+
* @since 2.11.0
50+
*/
51+
PartialProduct(String name, String description, double internalUnitPrice, double externalUnitPrice, ProductUnit unit, ProductId productId, Facility serviceProvider) {
52+
super(name, description, internalUnitPrice, externalUnitPrice, unit, productId, serviceProvider)
53+
}
3154
}

src/main/groovy/life/qbic/datamodel/dtos/business/services/PrimaryAnalysis.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 for primary bioinformatic analysis services.
@@ -37,8 +38,30 @@ class PrimaryAnalysis extends AtomicProduct {
3738
* @param unitPrice The price in € per unit
3839
* @param unit The product unit
3940
* @param runningNumber Number used in conjunction with ProductType{@link life.qbic.datamodel.dtos.business.services.ProductType} to identify product
41+
*
42+
* @deprecated 2.11.0
4043
*/
44+
@Deprecated
4145
PrimaryAnalysis(String name, String description, double unitPrice, ProductUnit unit, long runningNumber) {
4246
super(name, description, unitPrice, unit, new ProductId.Builder(ProductType.PRIMARY_BIOINFO.toString(), runningNumber).build())
4347
}
48+
49+
/**
50+
* Basic product constructor.
51+
*
52+
* Checks that all passed arguments are not null.
53+
*
54+
* @param name The name of the product.
55+
* @param description The description of what the product is about.
56+
* @param internalUnitPrice The price in € per unit for internal customers
57+
* @param externalUnitPrice The price in € per unit for external customers
58+
* @param unit The product unit
59+
* @param runningNumber Number used in conjunction with ProductType{@link life.qbic.datamodel.dtos.business.services.ProductType} to identify product
60+
* @param serviceProvider The facility providing the service product
61+
*
62+
* @since 2.11.0
63+
*/
64+
PrimaryAnalysis(String name, String description, double internalUnitPrice, double externalUnitPrice, ProductUnit unit, long runningNumber, Facility serviceProvider) {
65+
super(name, description, internalUnitPrice, externalUnitPrice, unit, new ProductId.Builder(ProductType.PRIMARY_BIOINFO.toString(), runningNumber).build(), serviceProvider)
66+
}
4467
}

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

Lines changed: 64 additions & 1 deletion
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
* Holds information about a simple QBiC service product.
@@ -25,10 +26,33 @@ abstract class Product {
2526
final String productName
2627

2728
/**
28-
* The unit price in €/unit.
29+
* The unit price in €/unit for customers. Can be 0 in case the deprecated constructor was used to create the product.
30+
*
31+
* @deprecated 2.11.0, please call the {@link #internalUnitPrice} or {@link #externalUnitPrice}
2932
*/
3033
final double unitPrice
3134

35+
/**
36+
* The The unit price in €/unit for internal customers.
37+
*
38+
* @since 2.11.0
39+
*/
40+
final double internalUnitPrice
41+
42+
/**
43+
* The unit price in €/unit for external customers.
44+
*
45+
* @since 2.11.0
46+
*/
47+
final double externalUnitPrice
48+
49+
/**
50+
* The facility that provides the service product.
51+
*
52+
* @since 2.11.0
53+
*/
54+
final Facility serviceProvider
55+
3256
/**
3357
* The currency of the price
3458
*/
@@ -54,7 +78,10 @@ abstract class Product {
5478
* @param unitPrice The price in € per unit
5579
* @param unit The product unit
5680
* @param productId The Id of the product
81+
*
82+
* @deprecated 2.11.0
5783
*/
84+
@Deprecated
5885
Product(String name, String description, double unitPrice, ProductUnit unit, ProductId productId) {
5986
this.productName = Objects.requireNonNull(name, "Name must not be null")
6087
this.description = Objects.requireNonNull(description, "Description must not be null")
@@ -63,6 +90,42 @@ abstract class Product {
6390
this.productId = Objects.requireNonNull(productId, "ProductId must not be null")
6491
//currency is on default in euro
6592
this.currency = Currency.getInstance(Locale.GERMANY)
93+
this.externalUnitPrice = 0.00
94+
this.internalUnitPrice = 0.00
95+
this.serviceProvider = Facility.QBIC
96+
}
6697

98+
/**
99+
* Basic product constructor.
100+
*
101+
* Checks that all passed arguments except productId are not null.
102+
*
103+
* @param name The name of the product.
104+
* @param description The description of what the product is about.
105+
* @param internalUnitPrice The price in € per unit for internal customers
106+
* @param externalUnitPrice The price in € per unit for external customers
107+
* @param unit The product unit
108+
* @param productId The Id of the product
109+
*
110+
* @since 2.11.0
111+
*/
112+
Product(String name,
113+
String description,
114+
double internalUnitPrice,
115+
double externalUnitPrice,
116+
ProductUnit unit,
117+
ProductId productId,
118+
Facility serviceProvider) {
119+
this.productName = Objects.requireNonNull(name, "Name must not be null")
120+
this.description = Objects.requireNonNull(description, "Description must not be null")
121+
this.internalUnitPrice = Objects.requireNonNull(internalUnitPrice, "Internal unit price must not be null")
122+
this.externalUnitPrice = Objects.requireNonNull(externalUnitPrice, "External unit price must not be null")
123+
this.unitPrice = 0.00
124+
this.unit = Objects.requireNonNull(unit, "Unit must not be null")
125+
this.productId = Objects.requireNonNull(productId, "ProductId must not be null")
126+
//currency is on default in euro
127+
this.currency = Currency.getInstance(Locale.GERMANY)
128+
this.serviceProvider = Objects.requireNonNull(serviceProvider, "Service provider must not be null")
67129
}
130+
68131
}

src/main/groovy/life/qbic/datamodel/dtos/business/services/ProjectManagement.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 for project management services.
@@ -37,8 +38,30 @@ class ProjectManagement extends PartialProduct {
3738
* @param unitPrice The price in € per unit
3839
* @param unit The product unit
3940
* @param runningNumber Number used in conjunction with ProductType{@link life.qbic.datamodel.dtos.business.services.ProductType} to identify product
41+
*
42+
* @deprecated 2.11.0
4043
*/
44+
@Deprecated
4145
ProjectManagement(String name, String description, double unitPrice, ProductUnit unit, long runningNumber) {
4246
super(name, description, unitPrice, unit, new ProductId.Builder(ProductType.PROJECT_MANAGEMENT.toString(), runningNumber).build())
4347
}
48+
49+
/**
50+
* Basic product constructor.
51+
*
52+
* Checks that all passed arguments are not null.
53+
*
54+
* @param name The name of the product.
55+
* @param description The description of what the product is about.
56+
* @param internalUnitPrice The price in € per unit for internal customers
57+
* @param externalUnitPrice The price in € per unit for external customers
58+
* @param unit The product unit
59+
* @param runningNumber Number used in conjunction with ProductType{@link life.qbic.datamodel.dtos.business.services.ProductType} to identify product
60+
* @param serviceProvider The facility providing the service product
61+
*
62+
* @since 2.11.0
63+
*/
64+
ProjectManagement(String name, String description, double internalUnitPrice, double externalUnitPrice, ProductUnit unit, long runningNumber, Facility serviceProvider) {
65+
super(name, description, internalUnitPrice, externalUnitPrice, unit, new ProductId.Builder(ProductType.PROJECT_MANAGEMENT.toString(), runningNumber).build(), serviceProvider)
66+
}
4467
}

src/main/groovy/life/qbic/datamodel/dtos/business/services/ProteomicAnalysis.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 for proteomics services.
@@ -38,8 +39,30 @@ class ProteomicAnalysis extends AtomicProduct {
3839
* @param unitPrice The price in € per unit
3940
* @param unit The product unit
4041
* @param runningNumber Number used in conjunction with ProductType{@link life.qbic.datamodel.dtos.business.services.ProductType} to identify product
42+
*
43+
* @deprecated 2.11.0
4144
*/
45+
@Deprecated
4246
ProteomicAnalysis(String name, String description, double unitPrice, ProductUnit unit, long runningNumber) {
4347
super(name, description, unitPrice, unit, new ProductId.Builder(ProductType.PROTEOMIC.toString(), runningNumber).build())
4448
}
49+
50+
/**
51+
* Basic product constructor.
52+
*
53+
* Checks that all passed arguments are not null.
54+
*
55+
* @param name The name of the product.
56+
* @param description The description of what the product is about.
57+
* @param internalUnitPrice The price in € per unit for internal customers
58+
* @param externalUnitPrice The price in € per unit for external customers
59+
* @param unit The product unit
60+
* @param runningNumber Number used in conjunction with ProductType{@link life.qbic.datamodel.dtos.business.services.ProductType} to identify product
61+
* @param serviceProvider The facility providing the service product
62+
*
63+
* @since 2.11.0
64+
*/
65+
ProteomicAnalysis(String name, String description, double internalUnitPrice, double externalUnitPrice, ProductUnit unit, long runningNumber, Facility serviceProvider) {
66+
super(name, description, internalUnitPrice, externalUnitPrice, unit, new ProductId.Builder(ProductType.PROTEOMIC.toString(), runningNumber).build(), serviceProvider)
67+
}
4568
}

0 commit comments

Comments
 (0)