Skip to content

Conversation

@KochTobi
Copy link
Member

This PR adds a facility factory

@Override
Facility getForString(String value) {
Facility desiredKey
desiredKey = Facility.values().find {it.fullName.equals(value.trim())}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is Facility.values() returning?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all the enum values e.g. Facility.QBIC

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

> import life.qbic.datamodel.dtos.business.facilities.Facility
> 
> Facility.values()

Result: [Core Facility for Medical Bioanalytics, Institute for Medical Genetics and Applied Genomics, Institute for Medical Microbiology and Hygiene, Quantitative Biology Center, Proteome Center Tübingen]

NOTE: toString() is called because of the print done by groovy

Facility desiredKey
desiredKey = Facility.values().find {it.fullName.equals(value.trim())}
if (!desiredKey) {
throw new IllegalArgumentException("Invalid value '$value' for ${Facility.getSimpleName()}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is Facility.getSimpleName() returning?

Copy link
Member Author

@KochTobi KochTobi Jul 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Facility

> import life.qbic.datamodel.dtos.business.facilities.Facility
> 
> Facility.simpleName

Result: Facility

@KochTobi KochTobi requested a review from sven1103 July 27, 2021 11:11
Copy link
Contributor

@sven1103 sven1103 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, i was irritated by the values call, but it is correct.

@KochTobi KochTobi merged commit 920a36f into development Jul 27, 2021
@KochTobi KochTobi deleted the feature/facilityFactory branch July 27, 2021 11:12
@KochTobi KochTobi mentioned this pull request Aug 3, 2021
KochTobi added a commit that referenced this pull request Aug 3, 2021
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``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants