Connects the create project component with the use case Create Projects
.
This view provides access the the use cases Create Project Space
and
+ * Create Project
.
Both use cases are part of the same scenario, when a user wants to create a project + * in QBiC's data management platform based on the information of an existing offer.
+ * + * @since 1.0.0 + */ +class CreateProjectView extends VerticalLayout{ + + private RadioButtonGroupView model for the {@link CreateProjectView}.
+ * + * @since 1.0.0 + */ +class CreateProjectViewModel { + + /** + * Flag that indicates when a project has been created + */ + @Bindable Boolean projectCreated + + /** + * Saves the layout from which the create project component + * has been initiated. + * This view is set to visible again, if the user decides to navigate back. + */ + Optional{@link MaintainProductsViewModel} will be integrated into the qOffer 2.0 Portlet and provides an User Interface + * with the intention of enabling an {@value life.qbic.portal.offermanager.security.Role#OFFER_ADMIN} to create, archive and copy products.
+ * + * @since 1.0.0 + * + */ +class MaintainProductsView extends VerticalLayout{ + + private final MaintainProductsViewModel viewModel + + GridThis class holds all specific fields that are mutable in the view + * Whenever values change it should be reflected in the corresponding view. This class can be used + * for UI unit testing purposes.
+ * + *This class can contain JavaBean objects to enable views to listen to changes in the values.
+ * + * @since 1.0.0 + * + */ +class MaintainProductsViewModel { + + ObservableList products = new ObservableList(new ArrayListThe view contains several text input fields and combo boxes in order to fully describe the new service products
+ * + * @since 1.0.0 + * +*/ +class CreateProductView extends HorizontalLayout{ + + private final CreateProductViewModel createProductViewModel + + TextField productNameField + TextField productDescriptionField + TextField productUnitPriceField + + ComboBoxThis class allows to trigger the use cases and respectively create new products, copy or archive them.
+ * + * @since 1.0.0 + * + */ +class MaintainProductsController { + + private final CreateProductInput createProductInput + private final ArchiveProductInput archiveProductInput + private static final Logging log = Logger.getLogger(this.class) + + MaintainProductsController(CreateProductInput createProductInput, + ArchiveProductInput archiveProductInput){ + this.createProductInput = createProductInput + this.archiveProductInput = archiveProductInput + } + + /** + * Triggers the creation of a product in the database + * + * @param category The products category which determines what kind of product is created + * @param description The description of the product + * @param name The name of the product + * @param unitPrice The unit price of the product + * @param unit The unit in which the product is measured + */ + void createNewProduct(ProductCategory category, String description, String name, double unitPrice, ProductUnit unit){ + try { + Product product = ProductConverter.createProduct(category, description, name, unitPrice, unit) + createProductInput.create(product) + } catch (Exception unexpected) { + log.error("unexpected exception during create product call", unexpected) + throw new IllegalArgumentException("Could not create products from provided arguments.") + } + } + + /** + * Triggers the archiving of a product + * @param productId The ProductId of the product that should be archived + */ + void archiveProduct(ProductId productId){ + try{ + archiveProductInput.archive(productId) + }catch(Exception unexpected){ + log.error("unexpected exception at archive product call", unexpected) + throw new IllegalArgumentException("Could not create products from provided arguments.") + } + } + + private static class ProductConverter{ + + /** + * Creates a product DTO based on its products category + * + * @param category The products category which determines what kind of products is created + * @param description The description of the product + * @param name The name of the product + * @param unitPrice The unit price of the product + * @param unit The unit in which the product is measured + * @return + */ + static Product createProduct(ProductCategory category, String description, String name, double unitPrice, ProductUnit unit){ + Product product + switch (category) { + case "Data Storage": + //todo do we want to set the id manually to null or update the DTO constructor? + product = new DataStorage(name, description, unitPrice,unit, null) + break + case "Primary Bioinformatics": + product = new PrimaryAnalysis(name, description, unitPrice,unit, null) + break + case "Project Management": + product = new ProjectManagement(name, description, unitPrice,unit, null) + break + case "Secondary Bioinformatics": + product = new SecondaryAnalysis(name, description, unitPrice,unit, null) + break + case "Sequencing": + product = new Sequencing(name, description, unitPrice,unit, null) + break + } + if(!product) throw new IllegalArgumentException("Cannot parse products") + + return product + } + + } + +} diff --git a/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/components/products/MaintainProductsPresenter.groovy b/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/components/products/MaintainProductsPresenter.groovy new file mode 100644 index 000000000..3aeb11aa8 --- /dev/null +++ b/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/components/products/MaintainProductsPresenter.groovy @@ -0,0 +1,46 @@ +package life.qbic.portal.offermanager.components.products + +import life.qbic.business.products.archive.ArchiveProductOutput +import life.qbic.business.products.create.CreateProductOutput +import life.qbic.datamodel.dtos.business.services.Product +import life.qbic.portal.offermanager.components.AppViewModel + +/** + *This presenter handles the output of the {@link life.qbic.business.products.create.CreateProduct} and {@link life.qbic.business.products.archive.ArchiveProduct} use cases and prepares it for the {@link MaintainProductsView}.
+ * + * @since 1.0.0 + * + */ +class MaintainProductsPresenter implements CreateProductOutput, ArchiveProductOutput{ + + private final MaintainProductsViewModel productsViewModel + private final AppViewModel mainViewModel + + MaintainProductsPresenter(MaintainProductsViewModel productsViewModel, AppViewModel mainViewModel){ + this.productsViewModel = productsViewModel + this.mainViewModel = mainViewModel + } + + @Override + void archived(Product product) { + mainViewModel.successNotifications << "Successfully archived product $product.productId - $product.productName." + } + + @Override + void created(Product product) { + mainViewModel.successNotifications << "Successfully added new product $product.productId - $product.productName." + } + + @Override + void foundDuplicate(Product product) { + mainViewModel.failureNotifications << "Found duplicate product for $product.productId - $product.productName." + //todo triggers sth in the view-model to ask the user if he still wants to create the duplicate + } + + @Override + void failNotification(String notification) { + mainViewModel.failureNotifications << notification + } +} diff --git a/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/components/products/MaintainProductsView.groovy b/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/components/products/MaintainProductsView.groovy new file mode 100644 index 000000000..00dd3000b --- /dev/null +++ b/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/components/products/MaintainProductsView.groovy @@ -0,0 +1,24 @@ +package life.qbic.portal.offermanager.components.products + +import com.vaadin.ui.FormLayout + +/** + * + *{@link MaintainProductsViewModel} will be integrated into the qOffer 2.0 Portlet and provides an User Interface + * with the intention of enabling an {@value life.qbic.portal.offermanager.security.Role#OFFER_ADMIN} to create, archive and copy products.
+ * + * @since 1.0.0 + * + */ +class MaintainProductsView extends FormLayout{ + + private final MaintainProductsController controller + private final MaintainProductsViewModel viewModel + + MaintainProductsView(MaintainProductsController controller, MaintainProductsViewModel viewModel){ + this.controller = controller + this.viewModel = viewModel + } +} diff --git a/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/components/products/MaintainProductsViewModel.groovy b/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/components/products/MaintainProductsViewModel.groovy new file mode 100644 index 000000000..fd77fce31 --- /dev/null +++ b/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/components/products/MaintainProductsViewModel.groovy @@ -0,0 +1,41 @@ +package life.qbic.portal.offermanager.components.products + +import life.qbic.datamodel.dtos.business.services.Product +import life.qbic.portal.offermanager.dataresources.products.ProductsResourcesService + + +/** + *This class holds all specific fields that are mutable in the view + * Whenever values change it should be reflected in the corresponding view. This class can be used + * for UI unit testing purposes.
+ * + *This class can contain JavaBean objects to enable views to listen to changes in the values.
+ * + * @since 1.0.0 + * + */ +class MaintainProductsViewModel { + + ObservableList products = new ObservableList(new ArrayListThis is some outro text. It has changed!!
The invoice will be issued after completion of the project.
- +- Quality control at all steps of the data processing will guarantee that the processed data is in accordance to DFG (German research foundation) guidance for good scientific practice. All project related data will be kept securely on our local infrastructure. - Any publication that contains information based on counselling with or data generated by QBiC and the involved technology platforms requires at least the acknowledgement of the scientists at QBiC and the - involved technology platforms, e.g. by stating “the xyz part of the work was supported by the Quantitative Biology Center (QBiC) and its technology platforms of the University of Tübingen”. + Quality control at all steps of the data processing will guarantee that the processed data is in accordance to DFG (German research foundation) guidance for good scientific practice. All project related data will be kept securely on our local infrastructure. + Any publication that contains information based on counselling with or data generated by QBiC and the involved technology platforms requires at least the acknowledgement of the scientists at QBiC and the + involved technology platforms, e.g. by stating “the xyz part of the work was supported by the Quantitative Biology Center (QBiC) and its technology platforms of the University of Tübingen”.
- This is required because QBiC is subsidized by the university and other external funding, and therefore needs recognition. -
+ This is required because QBiC is subsidized by the university and other external funding, and therefore needs recognition. +Depending on the extent of involvement, either co-authorship (e.g. downstream analysis, analytical method development) or acknowledgement (e.g. direct pipeline output) will be required. Should the project deviate from the plan outlined above, the customer will be contacted by QBiC or one of the involved technology platforms again in order to discuss the continuation of the project. - -
+ +By signing the quote, you confirm that all samples were collected according to governing law and the current scientific code of conduct, all necessary documentation has been performed and the respective permissions are available upon request (i.e. approval of the local Ethical Committee, informed consent, FELASA certificate, etc.).
If you agree with this offer, please return a signed copy.
-