Skip to content

Commit

Permalink
Merge pull request #996 from qbicsoftware/development
Browse files Browse the repository at this point in the history
Release PR
  • Loading branch information
KochTobi authored Dec 19, 2023
2 parents 69502c4 + 14887ac commit 937dcd1
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private static List<Column> setColumns() {
offerV2 -> offerV2.getSelectedCustomerAffiliation().getOrganization()));
columns.add(new Column("affiliationAddressAddition",
offerV2 -> offerV2.getSelectedCustomerAffiliation().getAddressAddition()));
columns.add(new Column("affiliationCategory",
columns.add(new Column("affiliation",
offerV2 -> offerV2.getSelectedCustomerAffiliation().getCategory().getLabel()));
columns.add(new Column("projectmanagerName",
offerV2 -> offerV2.getProjectManager().getFirstName() + " " + offerV2.getProjectManager()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,12 @@ class OfferOverviewView extends VerticalLayout implements Observer {
.setCaption("Project Title").setId("ProjectTitle")
grid.addColumn({ overview -> overview.getCustomer() })
.setCaption("Customer").setId("Customer")
grid.addColumn({ overview -> overview.getAffiliation().getCategory().getLabel() })
.setCaption("Affiliation Category").setId("AffiliationCategory")
grid.addColumn({ overview -> overview.getAffiliation().getOrganization() })
.setCaption("Organisation").setId("Organisation")
grid.addColumn({ overview -> overview.getAffiliation().getAddressAddition() })
.setCaption("Address Addition").setId("AddressAddition")
grid.addColumn({ overview -> overview.getProjectManager() })
.setCaption("ProjectManager").setId("ProjectManager")
grid.addColumn({ overview -> overview.getAssociatedProject() })
Expand Down Expand Up @@ -254,6 +260,15 @@ class OfferOverviewView extends VerticalLayout implements Observer {
GridUtils.setupColumnFilter(offerOverviewDataProvider,
grid.getColumn("Customer"),
headerFilterRow)
GridUtils.setupColumnFilter(offerOverviewDataProvider,
grid.getColumn("AffiliationCategory"),
headerFilterRow)
GridUtils.setupColumnFilter(offerOverviewDataProvider,
grid.getColumn("Organisation"),
headerFilterRow)
GridUtils.setupColumnFilter(offerOverviewDataProvider,
grid.getColumn("AddressAddition"),
headerFilterRow)
GridUtils.setupColumnFilter(offerOverviewDataProvider,
grid.getColumn("ProjectManager"),
headerFilterRow)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class CreatePersonController {

private final CreatePersonInput useCaseInput
private final RefactorConverter refactorConverter = new RefactorConverter()
private static final AcademicTitleFactory ACADEMIC_TITLE_FACTORY = new AcademicTitleFactory()

CreatePersonController(CreatePersonInput useCaseInput) {
this.useCaseInput = useCaseInput
Expand All @@ -39,12 +40,16 @@ class CreatePersonController {
* @since 1.0.0
*/
void createNewPerson(String firstName, String lastName, String title, String email, List<? extends Affiliation> affiliations) {
AcademicTitleFactory academicTitleFactory = new AcademicTitleFactory()

firstName = sanitized(firstName)
lastName = sanitized(lastName)
email = sanitized(email)

AcademicTitle academicTitle
if (!title || title?.isEmpty()) {
academicTitle = AcademicTitle.NONE
} else {
academicTitle = academicTitleFactory.getForString(title)
academicTitle = ACADEMIC_TITLE_FACTORY.getForString(title)
}

try {
Expand Down Expand Up @@ -74,12 +79,15 @@ class CreatePersonController {
*
*/
void updatePerson(Person oldEntry, String firstName, String lastName, String title, String email, List<? extends Affiliation> affiliations){
AcademicTitleFactory academicTitleFactory = new AcademicTitleFactory()

firstName = sanitized(firstName)
lastName = sanitized(lastName)
email = sanitized(email)
AcademicTitle academicTitle
if (!title || title?.isEmpty()) {
academicTitle = AcademicTitle.NONE
} else {
academicTitle = academicTitleFactory.getForString(title)
academicTitle = ACADEMIC_TITLE_FACTORY.getForString(title)
}

try{
Expand All @@ -90,4 +98,8 @@ class CreatePersonController {
throw new IllegalArgumentException("Could not update customer from provided arguments.")
}
}

private static String sanitized(final String input) {
return input.replaceAll("\t", " ").trim()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package life.qbic.portal.offermanager.dataresources.offers

import groovy.transform.EqualsAndHashCode
import life.qbic.business.offers.OfferV2
import life.qbic.business.persons.affiliation.Affiliation
import life.qbic.datamodel.dtos.business.OfferId
import life.qbic.datamodel.dtos.projectmanagement.ProjectIdentifier

Expand All @@ -27,6 +28,8 @@ class OfferOverview {

final String customer

final Affiliation affiliation

final String projectManager

final Date modificationDate
Expand All @@ -39,13 +42,14 @@ class OfferOverview {

static OfferOverview from(OfferV2 offer) {
return new OfferOverview(
new OfferId(offer.identifier.getProjectPart(),offer.identifier.getRandomPart(), offer.identifier.getVersion() as String),
new OfferId(offer.identifier.getProjectPart(), offer.identifier.getRandomPart(), offer.identifier.getVersion() as String),
offer.getCreationDate().toDate(),
offer.getProjectTitle(),
String.format("%s %s", offer.getCustomer().firstName, offer.getCustomer().lastName),
String.format("%s %s", offer.getProjectManager().firstName, offer.getProjectManager().lastName),
offer.getPriceAfterTax().doubleValue(),
offer.getAssociatedProject().orElse(null)
offer.getAssociatedProject().orElse(null),
offer.selectedCustomerAffiliation
)
}

Expand All @@ -56,7 +60,7 @@ class OfferOverview {
String projectId,
String customer,
String projectManager,
double totalPrice) {
double totalPrice, Affiliation affiliation) {
this.offerId = offerId
this.modificationDate = modificationDate
this.projectId = projectId
Expand All @@ -65,6 +69,7 @@ class OfferOverview {
this.projectManager = projectManager
this.totalPrice = totalPrice
this.associatedProject = Optional.empty()
this.affiliation = affiliation
}

OfferOverview(
Expand All @@ -74,7 +79,7 @@ class OfferOverview {
String customer,
String projectManager,
double totalPrice,
ProjectIdentifier associatedProject) {
ProjectIdentifier associatedProject, Affiliation affiliation) {
this.offerId = offerId
this.modificationDate = modificationDate
this.projectId = ""
Expand All @@ -83,5 +88,6 @@ class OfferOverview {
this.projectManager = projectManager
this.totalPrice = totalPrice
this.associatedProject = Optional.ofNullable(associatedProject)
this.affiliation = affiliation
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package life.qbic.portal.offermanager.dataresources.offers

import life.qbic.business.RefactorConverter
import life.qbic.datamodel.dtos.business.Offer
import life.qbic.datamodel.dtos.projectmanagement.Project
import life.qbic.portal.offermanager.communication.EventEmitter
Expand Down Expand Up @@ -57,7 +58,7 @@ class OverviewService implements ResourcesService<OfferOverview> {
affectedOffer.customer.toString(),
affectedOffer.projectManager.toString(),
affectedOffer.totalPrice,
project.projectId)
project.projectId, affectedOffer.affiliation)
this.addToResource(updatedOverview)
}
})
Expand All @@ -82,7 +83,8 @@ class OverviewService implements ResourcesService<OfferOverview> {
"",
"${offer.customer.firstName} ${offer.customer.lastName}",
"${offer.projectManager.firstName} ${offer.projectManager.lastName}",
offer.totalPrice
offer.totalPrice as double,
RefactorConverter.toAffiliation(offer.selectedCustomerAffiliation)
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ static life.qbic.datamodel.dtos.business.AffiliationCategory toAffiliationCatego
return life.qbic.datamodel.dtos.business.AffiliationCategory.EXTERNAL;
}

static private AffiliationCategory toAffiliationCategory(
public static AffiliationCategory toAffiliationCategory(
life.qbic.datamodel.dtos.business.AffiliationCategory affiliationCategoryDto) {
switch (affiliationCategoryDto) {
case INTERNAL:
Expand Down

0 comments on commit 937dcd1

Please sign in to comment.