diff --git a/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/ExportAllOffers.java b/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/ExportAllOffers.java index 925aa2eaa..28544470a 100644 --- a/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/ExportAllOffers.java +++ b/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/ExportAllOffers.java @@ -43,7 +43,7 @@ private static List 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() diff --git a/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/components/offer/overview/OfferOverviewView.groovy b/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/components/offer/overview/OfferOverviewView.groovy index 908add9e1..2121fcf29 100644 --- a/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/components/offer/overview/OfferOverviewView.groovy +++ b/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/components/offer/overview/OfferOverviewView.groovy @@ -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() }) @@ -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) diff --git a/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/components/person/create/CreatePersonController.groovy b/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/components/person/create/CreatePersonController.groovy index 5ddfd3264..4bb6d0865 100644 --- a/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/components/person/create/CreatePersonController.groovy +++ b/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/components/person/create/CreatePersonController.groovy @@ -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 @@ -39,12 +40,16 @@ class CreatePersonController { * @since 1.0.0 */ void createNewPerson(String firstName, String lastName, String title, String email, List 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 { @@ -74,12 +79,15 @@ class CreatePersonController { * */ void updatePerson(Person oldEntry, String firstName, String lastName, String title, String email, List 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{ @@ -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() + } } diff --git a/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/dataresources/offers/OfferOverview.groovy b/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/dataresources/offers/OfferOverview.groovy index b4bfc8a73..cf584fc5d 100644 --- a/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/dataresources/offers/OfferOverview.groovy +++ b/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/dataresources/offers/OfferOverview.groovy @@ -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 @@ -27,6 +28,8 @@ class OfferOverview { final String customer + final Affiliation affiliation + final String projectManager final Date modificationDate @@ -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 ) } @@ -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 @@ -65,6 +69,7 @@ class OfferOverview { this.projectManager = projectManager this.totalPrice = totalPrice this.associatedProject = Optional.empty() + this.affiliation = affiliation } OfferOverview( @@ -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 = "" @@ -83,5 +88,6 @@ class OfferOverview { this.projectManager = projectManager this.totalPrice = totalPrice this.associatedProject = Optional.ofNullable(associatedProject) + this.affiliation = affiliation } } diff --git a/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/dataresources/offers/OverviewService.groovy b/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/dataresources/offers/OverviewService.groovy index 0c69b35ad..c8a441b01 100644 --- a/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/dataresources/offers/OverviewService.groovy +++ b/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/dataresources/offers/OverviewService.groovy @@ -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 @@ -57,7 +58,7 @@ class OverviewService implements ResourcesService { affectedOffer.customer.toString(), affectedOffer.projectManager.toString(), affectedOffer.totalPrice, - project.projectId) + project.projectId, affectedOffer.affiliation) this.addToResource(updatedOverview) } }) @@ -82,7 +83,8 @@ class OverviewService implements ResourcesService { "", "${offer.customer.firstName} ${offer.customer.lastName}", "${offer.projectManager.firstName} ${offer.projectManager.lastName}", - offer.totalPrice + offer.totalPrice as double, + RefactorConverter.toAffiliation(offer.selectedCustomerAffiliation) ) } diff --git a/offer-manager-domain/src/main/groovy/life/qbic/business/RefactorConverter.java b/offer-manager-domain/src/main/groovy/life/qbic/business/RefactorConverter.java index 9a32eed3a..6f195a93e 100644 --- a/offer-manager-domain/src/main/groovy/life/qbic/business/RefactorConverter.java +++ b/offer-manager-domain/src/main/groovy/life/qbic/business/RefactorConverter.java @@ -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: