diff --git a/QBiCMainPortlet/src/de/uni_tuebingen/qbic/qbicmainportlet/DataHandler.java b/QBiCMainPortlet/src/de/uni_tuebingen/qbic/qbicmainportlet/DataHandler.java index 470ca42..ce8784f 100644 --- a/QBiCMainPortlet/src/de/uni_tuebingen/qbic/qbicmainportlet/DataHandler.java +++ b/QBiCMainPortlet/src/de/uni_tuebingen/qbic/qbicmainportlet/DataHandler.java @@ -15,10 +15,6 @@ *******************************************************************************/ package de.uni_tuebingen.qbic.qbicmainportlet; -import helpers.AlternativeSecondaryNameCreator; -import helpers.Utils; -import life.qbic.openbis.openbisclient.OpenBisClient; - import java.io.Serializable; import java.sql.Timestamp; import java.text.ParseException; @@ -39,30 +35,6 @@ import javax.xml.bind.JAXBException; -import logging.Log4j2Logger; -import model.DBManager; -import model.DatasetBean; -import model.ExperimentBean; -import model.ExperimentStatusBean; -import model.ExperimentType; -import model.NewIvacSampleBean; -import model.ProjectBean; -import model.SampleBean; -import parser.PersonParser; -import persons.Qperson; -import ch.systemsx.cisd.openbis.dss.client.api.v1.DataSet; -import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.FileInfoDssDTO; -import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.ControlledVocabularyPropertyType; -import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Experiment; -import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Material; -import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.MaterialIdentifier; -import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.MaterialTypeIdentifier; -import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Project; -import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.PropertyType; -import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Sample; -import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SpaceWithProjectsAndRoleAssignments; -import ch.systemsx.cisd.openbis.plugin.query.shared.api.v1.dto.QueryTableModel; - import com.vaadin.data.util.BeanItemContainer; import com.vaadin.data.util.HierarchicalContainer; import com.vaadin.data.util.IndexedContainer; @@ -75,8 +47,34 @@ import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.themes.ValoTheme; +import ch.systemsx.cisd.openbis.dss.client.api.v1.DataSet; +import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.FileInfoDssDTO; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.ControlledVocabularyPropertyType; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Experiment; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Material; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.MaterialIdentifier; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.MaterialTypeIdentifier; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Project; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.PropertyType; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Sample; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SpaceWithProjectsAndRoleAssignments; +import ch.systemsx.cisd.openbis.plugin.query.shared.api.v1.dto.QueryTableModel; import de.uni_tuebingen.qbic.main.LiferayAndVaadinUtils; import de.uni_tuebingen.qbic.util.DashboardUtil; +import helpers.AlternativeSecondaryNameCreator; +import helpers.Utils; +import life.qbic.openbis.openbisclient.OpenBisClient; +import logging.Log4j2Logger; +import model.DBManager; +import model.DatasetBean; +import model.ExperimentBean; +import model.ExperimentStatusBean; +import model.ExperimentType; +import model.NewIvacSampleBean; +import model.ProjectBean; +import model.SampleBean; +import parser.PersonParser; +import persons.Qperson; public class DataHandler implements Serializable { @@ -544,8 +542,32 @@ else if (assignedProperties.keySet().contains("Q_WF_STATUS")) { newProjectBean.setLongDescription(longDesc); - newProjectBean.setContainsData(this.getOpenBisClient() - .getDataSetsOfProjectByIdentifierWithSearchCriteria(projectIdentifier).size() != 0); + List projectData = this + .getOpenBisClient().getDataSetsOfProjectByIdentifierWithSearchCriteria(projectIdentifier); + + Boolean containsData = false; + Boolean containsResults = false; + Boolean attachmentResult = false; + // Boolean containsAttachments = false; + + for (ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.DataSet ds : projectData) { + attachmentResult = false; + if (ds.getDataSetTypeCode().equals("Q_PROJECT_DATA")) { + attachmentResult = ds.getProperties().get("Q_ATTACHMENT_TYPE").equals("RESULT"); + } + + if (!(ds.getDataSetTypeCode().equals("Q_PROJECT_DATA")) + && !(ds.getDataSetTypeCode().contains("RESULTS"))) { + containsData = true; + } else if (ds.getDataSetTypeCode().contains("RESULTS") || attachmentResult) { + containsResults = true; + } // else if (ds.getDataSetTypeCode() == "Q_PROJECT_DATA") { + // containsAttachments = true; + // } + } + + newProjectBean.setContainsData(containsData); + newProjectBean.setContainsResults(containsResults); newProjectBean.setExperiments(experimentBeans); newProjectBean.setMembers(new HashSet()); @@ -676,8 +698,33 @@ else if (assignedProperties.keySet().contains("Q_WF_STATUS")) { experimentBeans.addBean(newExperimentBean); } - newProjectBean.setContainsData(this.getOpenBisClient() - .getDataSetsOfProjectByIdentifierWithSearchCriteria(projectIdentifier).size() != 0); + List projectData = this + .getOpenBisClient().getDataSetsOfProjectByIdentifierWithSearchCriteria(projectIdentifier); + + Boolean containsData = false; + Boolean containsResults = false; + Boolean attachmentResult = false; + // Boolean containsAttachments = false; + + for (ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.DataSet ds : projectData) { + attachmentResult = false; + if (ds.getDataSetTypeCode().equals("Q_PROJECT_DATA")) { + attachmentResult = ds.getProperties().get("Q_ATTACHMENT_TYPE").equals("RESULT"); + } + + if (!(ds.getDataSetTypeCode().equals("Q_PROJECT_DATA")) + && !(ds.getDataSetTypeCode().contains("RESULTS"))) { + containsData = true; + } else if (ds.getDataSetTypeCode().contains("RESULTS") || attachmentResult) { + containsResults = true; + } // else if (ds.getDataSetTypeCode() == "Q_PROJECT_DATA") { + // containsAttachments = true; + // } + } + + newProjectBean.setContainsData(containsData); + newProjectBean.setContainsResults(containsResults); + // newProjectBean.setContainsAttachments(containsAttachments); newProjectBean.setExperiments(experimentBeans); newProjectBean.setMembers(new HashSet()); @@ -1827,7 +1874,7 @@ public Map computeProjectStatuses(ProjectBean projectBean) { BeanItemContainer cont = projectBean.getExperiments(); // project was planned (otherwise it would hopefully not exist :) ) - res.put("Project Planned", 1); + res.put("Project planned", 1); // design is pre-registered to the test sample level int prereg = 0; @@ -1839,14 +1886,20 @@ public Map computeProjectStatuses(ProjectBean projectBean) { break; } } - res.put("Experimental Design registered", prereg); + res.put("Experimental design registered", prereg); // data is uploaded // TODO fix that // if (datasetMap.get(p.getIdentifier()) != null) // res.put("Data Registered", 1); // else int dataregistered = projectBean.getContainsData() ? 1 : 0; - res.put("Data Registered", dataregistered); + int resultsregistered = projectBean.getContainsResults() ? 1 : 0; + // int attachmentsregistered = projectBean.getContainsAttachments() ? 1 : 0; + + // res.put("Attachments registered", attachmentsregistered); + res.put("Raw data registered", dataregistered); + res.put("Results registered", resultsregistered); + return res; } @@ -2330,6 +2383,7 @@ public void registerNewPatients(int numberPatients, List secondaryNames, * * @param statusValues * @return + * @deprecated */ public VerticalLayout createProjectStatusComponent(Map statusValues) { VerticalLayout projectStatusContent = new VerticalLayout(); @@ -2379,6 +2433,11 @@ public VerticalLayout createProjectStatusComponentNew(Map statu projectStatusContent.setMargin(true); projectStatusContent.setSpacing(true); + Label planned = new Label(); + Label design = new Label(); + Label raw = new Label(); + Label results = new Label(); + Iterator> it = statusValues.entrySet().iterator(); while (it.hasNext()) { @@ -2389,7 +2448,15 @@ public VerticalLayout createProjectStatusComponentNew(Map statu statusLabel.setStyleName(ValoTheme.LABEL_FAILURE); statusLabel.setResponsive(true); // statusLabel.addStyleName("redicon"); - projectStatusContent.addComponent(statusLabel); + if (pairs.getKey().equals("Project planned")) { + planned = statusLabel; + } else if (pairs.getKey().equals("Experimental design registered")) { + design = statusLabel; + } else if (pairs.getKey().equals("Raw data registered")) { + raw = statusLabel; + } else if (pairs.getKey().equals("Results registered")) { + results = statusLabel; + } } else { @@ -2399,14 +2466,23 @@ public VerticalLayout createProjectStatusComponentNew(Map statu // statusLabel.addStyleName("greenicon"); - if (pairs.getKey().equals("Project Planned")) { - projectStatusContent.addComponentAsFirst(statusLabel); - } else { - projectStatusContent.addComponent(statusLabel); - + if (pairs.getKey().equals("Project planned")) { + planned = statusLabel; + } else if (pairs.getKey().equals("Experimental design registered")) { + design = statusLabel; + } else if (pairs.getKey().equals("Raw data registered")) { + raw = statusLabel; + } else if (pairs.getKey().equals("Results registered")) { + results = statusLabel; } } } + + projectStatusContent.addComponent(planned); + projectStatusContent.addComponent(design); + projectStatusContent.addComponent(raw); + projectStatusContent.addComponent(results); + // ProgressBar progressBar = new ProgressBar(); // progressBar.setValue((float) finishedExperiments / statusValues.keySet().size()); // projectStatusContent.addComponent(progressBar); diff --git a/QBiCMainPortlet/src/de/uni_tuebingen/qbic/qbicmainportlet/DatasetComponent.java b/QBiCMainPortlet/src/de/uni_tuebingen/qbic/qbicmainportlet/DatasetComponent.java index 8e92c91..0f7a0f3 100644 --- a/QBiCMainPortlet/src/de/uni_tuebingen/qbic/qbicmainportlet/DatasetComponent.java +++ b/QBiCMainPortlet/src/de/uni_tuebingen/qbic/qbicmainportlet/DatasetComponent.java @@ -1,6 +1,6 @@ /******************************************************************************* - * QBiC Project qNavigator enables users to manage their projects. Copyright (C) "2016” - * Christopher Mohr, David Wojnar, Andreas Friedrich + * QBiC Project qNavigator enables users to manage their projects. Copyright (C) "2016” Christopher + * Mohr, David Wojnar, Andreas Friedrich * * This program is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation, either version 3 of the @@ -15,8 +15,6 @@ *******************************************************************************/ package de.uni_tuebingen.qbic.qbicmainportlet; -import helpers.UglyToPrettyNameMapper; - import java.net.MalformedURLException; import java.net.URL; import java.nio.file.Paths; @@ -33,14 +31,8 @@ import javax.portlet.PortletSession; -import logging.Log4j2Logger; -import logging.Logger; -import model.DatasetBean; - import org.tepi.filtertable.FilterTreeTable; -import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Sample; - import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; import com.vaadin.data.util.HierarchicalContainer; @@ -67,7 +59,12 @@ import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.Window; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Sample; import de.uni_tuebingen.qbic.util.DashboardUtil; +import helpers.UglyToPrettyNameMapper; +import logging.Log4j2Logger; +import logging.Logger; +import model.DatasetBean; public class DatasetComponent extends CustomComponent { @@ -87,11 +84,11 @@ public class DatasetComponent extends CustomComponent { private ToolBar toolbar; private State state; private String resourceUrl; - private final ButtonLink download = new ButtonLink(DOWNLOAD_BUTTON_CAPTION, new ExternalResource( - "")); + private final ButtonLink download = + new ButtonLink(DOWNLOAD_BUTTON_CAPTION, new ExternalResource("")); - private final String[] FILTER_TABLE_COLUMNS = new String[] {"Select", "File Name", - "Dataset Type", "Registration Date", "File Size"}; + private final String[] FILTER_TABLE_COLUMNS = + new String[] {"Select", "File Name", "Dataset Type", "Registration Date", "File Size"}; private int numberOfDatasets; @@ -143,19 +140,23 @@ public void updateUI(String type, String id) { List retrievedDatasets = null; + // clear download queue for new view + PortletSession portletSession = ((QbicmainportletUI) UI.getCurrent()).getPortletSession(); + portletSession.setAttribute("qbic_download", + new HashMap>(), + PortletSession.APPLICATION_SCOPE); + switch (type) { case "project": String projectIdentifier = id; - retrievedDatasets = - datahandler.getOpenBisClient().getDataSetsOfProjectByIdentifierWithSearchCriteria( - projectIdentifier); + retrievedDatasets = datahandler.getOpenBisClient() + .getDataSetsOfProjectByIdentifierWithSearchCriteria(projectIdentifier); break; case "experiment": String experimentIdentifier = id; - retrievedDatasets = - datahandler.getOpenBisClient().getDataSetsOfExperimentByCodeWithSearchCriteria( - experimentIdentifier); + retrievedDatasets = datahandler.getOpenBisClient() + .getDataSetsOfExperimentByCodeWithSearchCriteria(experimentIdentifier); break; case "sample": @@ -169,15 +170,15 @@ public void updateUI(String type, String id) { Sample start = datahandler.getOpenBisClient().getSamplesWithParentsAndChildren(code).get(0); - retrievedDatasets.addAll(datahandler.getOpenBisClient().getDataSetsOfSample( - start.getCode())); + retrievedDatasets + .addAll(datahandler.getOpenBisClient().getDataSetsOfSample(start.getCode())); Set startList = new HashSet(); Set allChildren = getAllChildren(startList, start); for (Sample samp : allChildren) { - retrievedDatasets.addAll(datahandler.getOpenBisClient().getDataSetsOfSample( - samp.getCode())); + retrievedDatasets + .addAll(datahandler.getOpenBisClient().getDataSetsOfSample(samp.getCode())); } break; @@ -191,29 +192,21 @@ public void updateUI(String type, String id) { if (numberOfDatasets == 0) { if (type.equals("project")) { - headerLabel - .setValue(String - .format( - "This view shows all datasets associated with this project. There are %s registered datasets.", - numberOfDatasets)); - - helpers.Utils - .Notification( - "No datasets available.", - "No data is available for this project. Please contact the project manager if this is not expected.", - "warning"); + headerLabel.setValue(String.format( + "This view shows all datasets associated with this project. There are %s registered datasets.", + numberOfDatasets)); + + helpers.Utils.Notification("No datasets available.", + "No data is available for this project. Please contact the project manager if this is not expected.", + "warning"); } else { - headerLabel - .setValue(String - .format( - "This view shows all datasets associated with this sample (including samples which have been derived from this sample). There are %s registered datasets.", - numberOfDatasets)); - - helpers.Utils - .Notification( - "No datasets available.", - "No data is connected to this sample. Please contact the project manager if this is not expected.", - "warning"); + headerLabel.setValue(String.format( + "This view shows all datasets associated with this sample (including samples which have been derived from this sample). There are %s registered datasets.", + numberOfDatasets)); + + helpers.Utils.Notification("No datasets available.", + "No data is connected to this sample. Please contact the project manager if this is not expected.", + "warning"); } } @@ -232,17 +225,13 @@ public void updateUI(String type, String id) { numberOfDatasets = dsBeans.size(); if (type.equals("project")) { - headerLabel - .setValue(String - .format( - "This view shows all datasets associated with this project. There are %s registered datasets.", - numberOfDatasets)); + headerLabel.setValue(String.format( + "This view shows all datasets associated with this project. There are %s registered datasets.", + numberOfDatasets)); } else if (type.equals("sample")) { - headerLabel - .setValue(String - .format( - "This view shows all datasets associated with this sample (including samples which have been derived from this sample). There are %s registered datasets.", - numberOfDatasets)); + headerLabel.setValue(String.format( + "This view shows all datasets associated with this sample (including samples which have been derived from this sample). There are %s registered datasets.", + numberOfDatasets)); } for (DatasetBean d : dsBeans) { @@ -358,19 +347,11 @@ public void buttonClick(ClickEvent event) { "

In case of multiple file selections, Project Browser will create a tar archive.

" + "
" + "

If you need help on extracting a tar archive file, follow the tips below:

" - + "

" - + FontAwesome.WINDOWS.getHtml() - + " Windows

" + + "

" + FontAwesome.WINDOWS.getHtml() + " Windows

" + "

To open/extract TAR file on Windows, you can use 7-Zip, Easy 7-Zip, PeaZip.

" - + "
" - + "

" - + FontAwesome.APPLE.getHtml() - + " MacOS

" + + "
" + "

" + FontAwesome.APPLE.getHtml() + " MacOS

" + "

To open/extract TAR file on Mac, you can use Mac OS built-in utility Archive Utility,
or third-party freeware.

" - + "
" - + "

" - + FontAwesome.LINUX.getHtml() - + " Linux

" + + "
" + "

" + FontAwesome.LINUX.getHtml() + " Linux

" + "

You need to use command tar. The tar is the GNU version of tar archiving utility.
" + "To extract/unpack a tar file, type: $ tar -xvf file.tar

"; @@ -411,9 +392,8 @@ public void buttonClick(ClickEvent event) { this.table.addItemClickListener(new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { - if (!event.isDoubleClick() - & !((boolean) table.getItem(event.getItemId()).getItemProperty("isDirectory") - .getValue())) { + if (!event.isDoubleClick() & !((boolean) table.getItem(event.getItemId()) + .getItemProperty("isDirectory").getValue())) { String datasetCode = (String) table.getItem(event.getItemId()).getItemProperty("CODE").getValue(); String datasetFileName = @@ -425,9 +405,8 @@ public void itemClick(ItemClickEvent event) { if (parent != null) { String parentDatasetFileName = (String) table.getItem(parent).getItemProperty("File Name").getValue(); - url = - datahandler.getOpenBisClient().getUrlForDataset(datasetCode, - parentDatasetFileName + "/" + datasetFileName); + url = datahandler.getOpenBisClient().getUrlForDataset(datasetCode, + parentDatasetFileName + "/" + datasetFileName); } else { url = datahandler.getOpenBisClient().getUrlForDataset(datasetCode, datasetFileName); } @@ -529,10 +508,9 @@ public void itemClick(ItemClickEvent event) { } catch (MalformedURLException e) { LOGGER.error(String.format( "Visualization failed because of malformedURL for dataset: %s", datasetCode)); - Notification - .show( - "Given dataset has no file attached to it!! Please Contact your project manager. Or check whether it already has some data", - Notification.Type.ERROR_MESSAGE); + Notification.show( + "Given dataset has no file attached to it!! Please Contact your project manager. Or check whether it already has some data", + Notification.Type.ERROR_MESSAGE); } } } @@ -550,10 +528,10 @@ private void setCheckedBox(Object itemId, String parentFolder) { if (table.hasChildren(itemId)) { for (Object childId : table.getChildren(itemId)) { - String newParentFolder = - Paths.get(parentFolder, + String newParentFolder = Paths + .get(parentFolder, (String) this.table.getItem(itemId).getItemProperty("File Name").getValue()) - .toString(); + .toString(); setCheckedBox(childId, newParentFolder); } } @@ -607,8 +585,8 @@ public void registerDatasetInTable(DatasetBean d, HierarchicalContainer dataset_ // d.getSample().getType()); dataset_container.getContainerProperty(new_ds, "File Name").setValue(d.getName()); dataset_container.getContainerProperty(new_ds, "File Type").setValue("Folder"); - dataset_container.getContainerProperty(new_ds, "Dataset Type").setValue( - prettyNameMapper.getPrettyName(d.getType()) + " Folder"); + dataset_container.getContainerProperty(new_ds, "Dataset Type") + .setValue(prettyNameMapper.getPrettyName(d.getType()) + " Folder"); dataset_container.getContainerProperty(new_ds, "Registration Date").setValue(ts); dataset_container.getContainerProperty(new_ds, "Validated").setValue(true); dataset_container.getContainerProperty(new_ds, "dl_link").setValue(d.getDssPath()); @@ -620,14 +598,14 @@ public void registerDatasetInTable(DatasetBean d, HierarchicalContainer dataset_ dataset_container.setParent(new_ds, parent); } -// LOGGER.debug(d+" has files/folders:"); + // LOGGER.debug(d+" has files/folders:"); for (DatasetBean file : subList) { -// LOGGER.debug(file.getFileName()); + // LOGGER.debug(file.getFileName()); registerDatasetInTable(file, dataset_container, project, sample, ts, new_ds); } } else { -// LOGGER.debug("(no more subfolders)"); + // LOGGER.debug("(no more subfolders)"); // sut.println("Now it should be a file: " + filelist[0].getPathInDataSet()); Object new_file = dataset_container.addItem(); @@ -638,12 +616,12 @@ public void registerDatasetInTable(DatasetBean d, HierarchicalContainer dataset_ // dataset_container.getContainerProperty(new_file, "Sample Type").setValue(sampleType); dataset_container.getContainerProperty(new_file, "File Name").setValue(d.getFileName()); dataset_container.getContainerProperty(new_file, "File Type").setValue(d.getFileType()); - dataset_container.getContainerProperty(new_file, "Dataset Type").setValue( - prettyNameMapper.getPrettyName(d.getType())); + dataset_container.getContainerProperty(new_file, "Dataset Type") + .setValue(prettyNameMapper.getPrettyName(d.getType())); dataset_container.getContainerProperty(new_file, "Registration Date").setValue(ts); dataset_container.getContainerProperty(new_file, "Validated").setValue(true); - dataset_container.getContainerProperty(new_file, "File Size").setValue( - DashboardUtil.humanReadableByteCount(d.getFileSize(), true)); + dataset_container.getContainerProperty(new_file, "File Size") + .setValue(DashboardUtil.humanReadableByteCount(d.getFileSize(), true)); dataset_container.getContainerProperty(new_file, "dl_link").setValue(d.getDssPath()); dataset_container.getContainerProperty(new_file, "CODE").setValue(d.getCode()); dataset_container.getContainerProperty(new_file, "file_size_bytes").setValue(d.getFileSize()); @@ -676,8 +654,8 @@ public void valueChange(ValueChangeEvent event) { PortletSession portletSession = ((QbicmainportletUI) UI.getCurrent()).getPortletSession(); Map> entries = - (Map>) portletSession.getAttribute( - "qbic_download", PortletSession.APPLICATION_SCOPE); + (Map>) portletSession + .getAttribute("qbic_download", PortletSession.APPLICATION_SCOPE); boolean itemSelected = (Boolean) event.getProperty().getValue(); /* @@ -717,9 +695,9 @@ private void valueChange(Object itemId, boolean itemSelected, ((CheckBox) table.getItem(itemId).getItemProperty("Select").getValue()) .setValue(itemSelected); - fileName = - Paths.get(fileName, - (String) table.getItem(itemId).getItemProperty("File Name").getValue()).toString(); + fileName = Paths + .get(fileName, (String) table.getItem(itemId).getItemProperty("File Name").getValue()) + .toString(); // System.out.println(fileName); if (table.hasChildren(itemId)) { @@ -732,8 +710,8 @@ private void valueChange(Object itemId, boolean itemSelected, Long datasetFileSize = (Long) table.getItem(itemId).getItemProperty("file_size_bytes").getValue(); - entries.put(fileName, new AbstractMap.SimpleEntry(datasetCode, - datasetFileSize)); + entries.put(fileName, + new AbstractMap.SimpleEntry(datasetCode, datasetFileSize)); } else { entries.remove(fileName); } diff --git a/QBiCMainPortlet/src/de/uni_tuebingen/qbic/qbicmainportlet/HomeView.java b/QBiCMainPortlet/src/de/uni_tuebingen/qbic/qbicmainportlet/HomeView.java index f1e541a..099bbbb 100644 --- a/QBiCMainPortlet/src/de/uni_tuebingen/qbic/qbicmainportlet/HomeView.java +++ b/QBiCMainPortlet/src/de/uni_tuebingen/qbic/qbicmainportlet/HomeView.java @@ -1,6 +1,6 @@ /******************************************************************************* - * QBiC Project qNavigator enables users to manage their projects. Copyright (C) "2016” - * Christopher Mohr, David Wojnar, Andreas Friedrich + * QBiC Project qNavigator enables users to manage their projects. Copyright (C) "2016” Christopher + * Mohr, David Wojnar, Andreas Friedrich * * This program is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation, either version 3 of the @@ -15,24 +15,13 @@ *******************************************************************************/ package de.uni_tuebingen.qbic.qbicmainportlet; -import helpers.ProjectSummaryReadyRunnable; -import helpers.SummaryFetcher; -import helpers.Utils; - import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Set; -import logging.Log4j2Logger; -import model.ExperimentBean; -import model.ProjectBean; -import model.SpaceBean; - import org.tepi.filtertable.FilterTable; -import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Project; - import com.vaadin.data.Item; import com.vaadin.data.util.BeanItemContainer; import com.vaadin.data.util.GeneratedPropertyContainer; @@ -62,6 +51,15 @@ import com.vaadin.ui.renderers.ClickableRenderer.RendererClickListener; import com.vaadin.ui.themes.ValoTheme; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Project; +import helpers.ProjectSummaryReadyRunnable; +import helpers.SummaryFetcher; +import helpers.Utils; +import logging.Log4j2Logger; +import model.ExperimentBean; +import model.ProjectBean; +import model.SpaceBean; + public class HomeView extends VerticalLayout implements View { /** @@ -155,6 +153,8 @@ public void setContainerDataSource(SpaceBean spaceBean, String newCaption) { gpcProjects.removeContainerProperty("contactPerson"); gpcProjects.removeContainerProperty("projectManager"); gpcProjects.removeContainerProperty("containsData"); + gpcProjects.removeContainerProperty("containsResults"); + gpcProjects.removeContainerProperty("containsAttachments"); gpcProjects.removeContainerProperty("description"); gpcProjects.removeContainerProperty("progress"); gpcProjects.removeContainerProperty("registrationDate"); @@ -226,8 +226,8 @@ public void click(RendererClickEvent event) { // fetch summary and create docx in tmp folder ProjectBean proj = (ProjectBean) event.getItemId(); - summaryFetcher.fetchSummaryComponent(proj.getCode(), proj.getSecondaryName(), proj - .getDescription(), + summaryFetcher.fetchSummaryComponent(proj.getCode(), proj.getSecondaryName(), + proj.getDescription(), new ProjectSummaryReadyRunnable(summaryFetcher, loadingWindow, proj.getCode())); } })); @@ -404,9 +404,8 @@ public void loadProjects() { new BeanItemContainer(ProjectBean.class); LOGGER.info("Loading projects..."); - List projects = - datahandler.getOpenBisClient().getOpenbisInfoService() - .listProjectsOnBehalfOfUser(datahandler.getOpenBisClient().getSessionToken(), user); + List projects = datahandler.getOpenBisClient().getOpenbisInfoService() + .listProjectsOnBehalfOfUser(datahandler.getOpenBisClient().getSessionToken(), user); LOGGER.info("Loading projects...done."); for (Project project : projects) { @@ -427,10 +426,9 @@ public void loadProjects() { if (secondaryName.isEmpty() || secondaryName == null) secondaryName = "n/a"; - ProjectBean newProjectBean = - new ProjectBean(projectIdentifier, projectCode, secondaryName, desc, - project.getSpaceCode(), new BeanItemContainer(ExperimentBean.class), - new ProgressBar(), new Date(), "", "", null, false, ""); + ProjectBean newProjectBean = new ProjectBean(projectIdentifier, projectCode, secondaryName, + desc, project.getSpaceCode(), new BeanItemContainer(ExperimentBean.class), + new ProgressBar(), new Date(), "", "", null, false, false, false, ""); // TODO isn't this slow in this fashion? what about SELECT * and creating a map? String pi = datahandler.getDatabaseManager().getInvestigatorForProject(projectIdentifier); diff --git a/QBiCMainPortlet/src/de/uni_tuebingen/qbic/qbicmainportlet/LevelComponent.java b/QBiCMainPortlet/src/de/uni_tuebingen/qbic/qbicmainportlet/LevelComponent.java index 211f7ca..7fe018d 100644 --- a/QBiCMainPortlet/src/de/uni_tuebingen/qbic/qbicmainportlet/LevelComponent.java +++ b/QBiCMainPortlet/src/de/uni_tuebingen/qbic/qbicmainportlet/LevelComponent.java @@ -1,6 +1,6 @@ /******************************************************************************* - * QBiC Project qNavigator enables users to manage their projects. Copyright (C) "2016” - * Christopher Mohr, David Wojnar, Andreas Friedrich + * QBiC Project qNavigator enables users to manage their projects. Copyright (C) "2016” Christopher + * Mohr, David Wojnar, Andreas Friedrich * * This program is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation, either version 3 of the @@ -15,8 +15,6 @@ *******************************************************************************/ package de.uni_tuebingen.qbic.qbicmainportlet; -import helpers.UglyToPrettyNameMapper; - import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; import java.net.URL; @@ -33,15 +31,8 @@ import javax.portlet.PortletSession; -import logging.Log4j2Logger; -import logging.Logger; -import model.DatasetBean; -import model.TestSampleBean; - import org.tepi.filtertable.FilterTreeTable; -import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Sample; - import com.vaadin.data.Item; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; @@ -78,7 +69,13 @@ import com.vaadin.ui.renderers.ClickableRenderer.RendererClickEvent; import com.vaadin.ui.renderers.ClickableRenderer.RendererClickListener; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Sample; import de.uni_tuebingen.qbic.util.DashboardUtil; +import helpers.UglyToPrettyNameMapper; +import logging.Log4j2Logger; +import logging.Logger; +import model.DatasetBean; +import model.TestSampleBean; public class LevelComponent extends CustomComponent { @@ -101,8 +98,8 @@ public class LevelComponent extends CustomComponent { private State state; private String resourceUrl; private ChangeSampleMetadataComponent changeMetadata; - private final ButtonLink download = new ButtonLink(DOWNLOAD_BUTTON_CAPTION, new ExternalResource( - "")); + private final ButtonLink download = + new ButtonLink(DOWNLOAD_BUTTON_CAPTION, new ExternalResource("")); private final String[] FILTER_TABLE_COLUMNS = new String[] {"Select", "Sample", "File Name", "Description", "Dataset Type", "Registration Date", "File Size"}; private int numberOfDatasets; @@ -174,13 +171,17 @@ public void updateUI(String type, String id, String filterFor) { Map> datasetFilter = new HashMap>(); + // clear download queue for new view + PortletSession portletSession = ((QbicmainportletUI) UI.getCurrent()).getPortletSession(); + portletSession.setAttribute("qbic_download", + new HashMap>(), + PortletSession.APPLICATION_SCOPE); switch (type) { case "project": String projectIdentifier = id; - retrievedDatasetsAll = - datahandler.getOpenBisClient().getDataSetsOfProjectByIdentifierWithSearchCriteria( - projectIdentifier); + retrievedDatasetsAll = datahandler.getOpenBisClient() + .getDataSetsOfProjectByIdentifierWithSearchCriteria(projectIdentifier); for (ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.DataSet ds : retrievedDatasetsAll) { @@ -202,9 +203,8 @@ public void updateUI(String type, String id, String filterFor) { // datahandler.getOpenBisClient() // .getSamplesOfProjectBySearchService(projectIdentifier); - List allSamples = - datahandler.getOpenBisClient() - .getSamplesWithParentsAndChildrenOfProjectBySearchService(id); + List allSamples = datahandler.getOpenBisClient() + .getSamplesWithParentsAndChildrenOfProjectBySearchService(id); for (Sample sample : allSamples) { if (sample.getSampleTypeCode().equals("Q_TEST_SAMPLE")) { @@ -310,8 +310,8 @@ public void itemClick(ItemClickEvent event) { } }); - sampleGrid.getColumn("edit").setRenderer( - new ButtonRenderer(new RendererClickListener() { + sampleGrid.getColumn("edit") + .setRenderer(new ButtonRenderer(new RendererClickListener() { @Override public void click(RendererClickEvent event) { @@ -368,9 +368,8 @@ else if (filterFor.equals("results")) { BeanItemContainer samplesContainer = new BeanItemContainer(TestSampleBean.class); - List allSamples = - datahandler.getOpenBisClient() - .getSamplesWithParentsAndChildrenOfProjectBySearchService(projectIdentifier); + List allSamples = datahandler.getOpenBisClient() + .getSamplesWithParentsAndChildrenOfProjectBySearchService(projectIdentifier); for (Sample sample : allSamples) { @@ -456,9 +455,8 @@ public void itemClick(ItemClickEvent event) { case "experiment": String experimentIdentifier = id; - retrievedDatasets = - datahandler.getOpenBisClient().getDataSetsOfExperimentByCodeWithSearchCriteria( - experimentIdentifier); + retrievedDatasets = datahandler.getOpenBisClient() + .getDataSetsOfExperimentByCodeWithSearchCriteria(experimentIdentifier); break; case "sample": @@ -476,27 +474,20 @@ public void itemClick(ItemClickEvent event) { numberOfDatasets = retrievedDatasets.size(); if (numberOfDatasets == 0 & filterFor.equals("measured")) { - descriptionLabel = - new Label( - String.format( - "This project contains %s measured samples for which %s raw data dataset(s) have been registered.", - numberOfSamples, 0), ContentMode.HTML); - - helpers.Utils - .Notification( - "No raw data available.", - "No raw data is available for this project. Please contact the project manager if this is not expected.", - "warning"); + descriptionLabel = new Label(String.format( + "This project contains %s measured samples for which %s raw data dataset(s) have been registered.", + numberOfSamples, 0), ContentMode.HTML); + + helpers.Utils.Notification("No raw data available.", + "No raw data is available for this project. Please contact the project manager if this is not expected.", + "warning"); } else if (numberOfDatasets == 0 & filterFor.equals("results")) { - descriptionLabel = - new Label(String.format("This project contains %s result datasets.", 0), - ContentMode.HTML); - - helpers.Utils - .Notification( - "No results available.", - "No result data is available for this project. Please contact the project manager if this is not expected.", - "warning"); + descriptionLabel = new Label(String.format("This project contains %s result datasets.", 0), + ContentMode.HTML); + + helpers.Utils.Notification("No results available.", + "No result data is available for this project. Please contact the project manager if this is not expected.", + "warning"); } else { Map samples = new HashMap(); @@ -521,11 +512,9 @@ public void itemClick(ItemClickEvent event) { } if (filterFor.equals("measured")) { - descriptionLabel = - new Label( - String.format( - "This project contains %s measured samples for which %s raw data dataset(s) have been registered.", - numberOfSamples, dsBeans.size()), ContentMode.HTML); + descriptionLabel = new Label(String.format( + "This project contains %s measured samples for which %s raw data dataset(s) have been registered.", + numberOfSamples, dsBeans.size()), ContentMode.HTML); } else if (filterFor.equals("results")) { descriptionLabel = new Label(String.format("This project contains %s result datasets.", dsBeans.size()), @@ -652,19 +641,11 @@ public void buttonClick(ClickEvent event) { "

In case of multiple file selections, Project Browser will create a tar archive.

" + "
" + "

If you need help on extracting a tar archive file, follow the tips below:

" - + "

" - + FontAwesome.WINDOWS.getHtml() - + " Windows

" + + "

" + FontAwesome.WINDOWS.getHtml() + " Windows

" + "

To open/extract TAR file on Windows, you can use 7-Zip, Easy 7-Zip, PeaZip.

" - + "
" - + "

" - + FontAwesome.APPLE.getHtml() - + " MacOS

" + + "
" + "

" + FontAwesome.APPLE.getHtml() + " MacOS

" + "

To open/extract TAR file on Mac, you can use Mac OS built-in utility Archive Utility,
or third-part freeware.

" - + "
" - + "

" - + FontAwesome.LINUX.getHtml() - + " Linux

" + + "
" + "

" + FontAwesome.LINUX.getHtml() + " Linux

" + "

You need to use command tar. The tar is the GNU version of tar archiving utility.
" + "To extract/unpack a tar file, type: $ tar -xvf file.tar

"; @@ -694,21 +675,19 @@ public void buttonClick(ClickEvent event) { for (final Object itemId : this.datasetTable.getItemIds()) { - setCheckedBox(itemId, (String) this.datasetTable.getItem(itemId).getItemProperty("CODE") - .getValue()); + setCheckedBox(itemId, + (String) this.datasetTable.getItem(itemId).getItemProperty("CODE").getValue()); } this.datasetTable.addItemClickListener(new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { - if (!event.isDoubleClick() - & !((boolean) datasetTable.getItem(event.getItemId()).getItemProperty("isDirectory") - .getValue())) { + if (!event.isDoubleClick() & !((boolean) datasetTable.getItem(event.getItemId()) + .getItemProperty("isDirectory").getValue())) { String datasetCode = (String) datasetTable.getItem(event.getItemId()).getItemProperty("CODE").getValue(); - String datasetFileName = - (String) datasetTable.getItem(event.getItemId()).getItemProperty("File Name") - .getValue(); + String datasetFileName = (String) datasetTable.getItem(event.getItemId()) + .getItemProperty("File Name").getValue(); URL url = null; try { Resource res = null; @@ -718,18 +697,16 @@ public void itemClick(ItemClickEvent event) { String parentDatasetFileName = (String) datasetTable.getItem(parent).getItemProperty("File Name").getValue(); try { - url = - datahandler.getOpenBisClient().getUrlForDataset(datasetCode, - parentDatasetFileName + "/" + URLEncoder.encode(datasetFileName, "UTF-8")); + url = datahandler.getOpenBisClient().getUrlForDataset(datasetCode, + parentDatasetFileName + "/" + URLEncoder.encode(datasetFileName, "UTF-8")); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { try { - url = - datahandler.getOpenBisClient().getUrlForDataset(datasetCode, - URLEncoder.encode(datasetFileName, "UTF-8")); + url = datahandler.getOpenBisClient().getUrlForDataset(datasetCode, + URLEncoder.encode(datasetFileName, "UTF-8")); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -834,15 +811,14 @@ public void itemClick(ItemClickEvent event) { } catch (MalformedURLException e) { LOGGER.error(String.format( "Visualization failed because of malformedURL for dataset: %s", datasetCode)); - helpers.Utils - .Notification( - "No file attached.", - "Given dataset has no file attached to it!! Please Contact your project manager. Or check whether it already has some data", - "error"); + helpers.Utils.Notification("No file attached.", + "Given dataset has no file attached to it!! Please Contact your project manager. Or check whether it already has some data", + "error"); // Notification // .show( - // "Given dataset has no file attached to it!! Please Contact your project manager. Or check whether it already has some data", + // "Given dataset has no file attached to it!! Please Contact your project manager. Or + // check whether it already has some data", // Notification.Type.ERROR_MESSAGE); } } @@ -862,10 +838,10 @@ private void setCheckedBox(Object itemId, String parentFolder) { if (datasetTable.hasChildren(itemId)) { for (Object childId : datasetTable.getChildren(itemId)) { - String newParentFolder = - Paths.get(parentFolder, + String newParentFolder = Paths + .get(parentFolder, (String) this.datasetTable.getItem(itemId).getItemProperty("File Name").getValue()) - .toString(); + .toString(); setCheckedBox(childId, newParentFolder); } } @@ -923,8 +899,8 @@ public void registerDatasetInTable(DatasetBean d, HierarchicalContainer dataset_ // d.getSample().getType()); dataset_container.getContainerProperty(new_ds, "File Name").setValue(d.getName()); dataset_container.getContainerProperty(new_ds, "File Type").setValue("Folder"); - dataset_container.getContainerProperty(new_ds, "Dataset Type").setValue( - prettyNameMapper.getPrettyName(d.getType()) + " Folder"); + dataset_container.getContainerProperty(new_ds, "Dataset Type") + .setValue(prettyNameMapper.getPrettyName(d.getType()) + " Folder"); dataset_container.getContainerProperty(new_ds, "Registration Date").setValue(ts); dataset_container.getContainerProperty(new_ds, "Validated").setValue(true); dataset_container.getContainerProperty(new_ds, "dl_link").setValue(d.getDssPath()); @@ -959,12 +935,12 @@ public void registerDatasetInTable(DatasetBean d, HierarchicalContainer dataset_ // dataset_container.getContainerProperty(new_file, "Sample Type").setValue(sampleType); dataset_container.getContainerProperty(new_file, "File Name").setValue(d.getFileName()); dataset_container.getContainerProperty(new_file, "File Type").setValue(d.getFileType()); - dataset_container.getContainerProperty(new_file, "Dataset Type").setValue( - prettyNameMapper.getPrettyName(d.getType())); + dataset_container.getContainerProperty(new_file, "Dataset Type") + .setValue(prettyNameMapper.getPrettyName(d.getType())); dataset_container.getContainerProperty(new_file, "Registration Date").setValue(ts); dataset_container.getContainerProperty(new_file, "Validated").setValue(true); - dataset_container.getContainerProperty(new_file, "File Size").setValue( - DashboardUtil.humanReadableByteCount(d.getFileSize(), true)); + dataset_container.getContainerProperty(new_file, "File Size") + .setValue(DashboardUtil.humanReadableByteCount(d.getFileSize(), true)); dataset_container.getContainerProperty(new_file, "dl_link").setValue(d.getDssPath()); dataset_container.getContainerProperty(new_file, "CODE").setValue(d.getCode()); dataset_container.getContainerProperty(new_file, "file_size_bytes").setValue(d.getFileSize()); @@ -997,8 +973,8 @@ public void valueChange(ValueChangeEvent event) { PortletSession portletSession = ((QbicmainportletUI) UI.getCurrent()).getPortletSession(); Map> entries = - (Map>) portletSession.getAttribute( - "qbic_download", PortletSession.APPLICATION_SCOPE); + (Map>) portletSession + .getAttribute("qbic_download", PortletSession.APPLICATION_SCOPE); boolean itemSelected = (Boolean) event.getProperty().getValue(); /* @@ -1038,10 +1014,10 @@ private void valueChange(Object itemId, boolean itemSelected, ((CheckBox) datasetTable.getItem(itemId).getItemProperty("Select").getValue()) .setValue(itemSelected); - fileName = - Paths.get(fileName, + fileName = Paths + .get(fileName, (String) datasetTable.getItem(itemId).getItemProperty("File Name").getValue()) - .toString(); + .toString(); // System.out.println(fileName); if (datasetTable.hasChildren(itemId)) { @@ -1053,8 +1029,8 @@ private void valueChange(Object itemId, boolean itemSelected, (String) datasetTable.getItem(itemId).getItemProperty("CODE").getValue(); Long datasetFileSize = (Long) datasetTable.getItem(itemId).getItemProperty("file_size_bytes").getValue(); - entries.put(fileName, new AbstractMap.SimpleEntry(datasetCode, - datasetFileSize)); + entries.put(fileName, + new AbstractMap.SimpleEntry(datasetCode, datasetFileSize)); } else { entries.remove(fileName); } diff --git a/QBiCMainPortlet/src/de/uni_tuebingen/qbic/qbicmainportlet/ProjInformationComponent.java b/QBiCMainPortlet/src/de/uni_tuebingen/qbic/qbicmainportlet/ProjInformationComponent.java index 4d44c06..88f4140 100644 --- a/QBiCMainPortlet/src/de/uni_tuebingen/qbic/qbicmainportlet/ProjInformationComponent.java +++ b/QBiCMainPortlet/src/de/uni_tuebingen/qbic/qbicmainportlet/ProjInformationComponent.java @@ -1,6 +1,6 @@ /******************************************************************************* - * QBiC Project qNavigator enables users to manage their projects. Copyright (C) "2016” - * Christopher Mohr, David Wojnar, Andreas Friedrich + * QBiC Project qNavigator enables users to manage their projects. Copyright (C) "2016” Christopher + * Mohr, David Wojnar, Andreas Friedrich * * This program is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation, either version 3 of the @@ -32,22 +32,8 @@ import javax.portlet.PortletSession; -import logging.Log4j2Logger; -import logging.Logger; -import model.DatasetBean; -import model.ProjectBean; -import model.TestSampleBean; - import org.tepi.filtertable.FilterTreeTable; -import qbic.vaadincomponents.TSVDownloadComponent; -import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Experiment; -import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Sample; -import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria; -import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria.MatchClause; -import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria.MatchClauseAttribute; -import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchSubCriteria; - import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; import com.vaadin.data.util.BeanItemContainer; @@ -81,7 +67,19 @@ import com.vaadin.ui.Window.CloseListener; import com.vaadin.ui.themes.ValoTheme; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Experiment; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Sample; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria.MatchClause; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria.MatchClauseAttribute; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchSubCriteria; import de.uni_tuebingen.qbic.util.DashboardUtil; +import logging.Log4j2Logger; +import logging.Logger; +import model.DatasetBean; +import model.ProjectBean; +import model.TestSampleBean; +import qbic.vaadincomponents.TSVDownloadComponent; public class ProjInformationComponent extends CustomComponent { @@ -103,11 +101,11 @@ public class ProjInformationComponent extends CustomComponent { private DataHandler datahandler; private State state; private String resourceUrl; - private final ButtonLink download = new ButtonLink(DOWNLOAD_BUTTON_CAPTION, new ExternalResource( - "")); + private final ButtonLink download = + new ButtonLink(DOWNLOAD_BUTTON_CAPTION, new ExternalResource("")); - private final String[] FILTER_TABLE_COLUMNS = new String[] {"Select", "Description", "File Name", - "Registration Date"}; + private final String[] FILTER_TABLE_COLUMNS = + new String[] {"Select", "Description", "File Name", "Registration Date"}; private int numberOfDatasets; @@ -259,12 +257,11 @@ public void windowClose(CloseEvent e) { private void initTSVDownloads(String space, String project) { tsvDownloadContent = new TSVDownloadComponent(); tsvDownloadContent.setVisible(false); - List types = - new ArrayList(Arrays.asList("Q_BIOLOGICAL_ENTITY", "Q_BIOLOGICAL_SAMPLE", - "Q_TEST_SAMPLE")); + List types = new ArrayList( + Arrays.asList("Q_BIOLOGICAL_ENTITY", "Q_BIOLOGICAL_SAMPLE", "Q_TEST_SAMPLE")); boolean tsvable = false; - for (Sample s : datahandler.getOpenBisClient().getSamplesOfProjectBySearchService( - "/" + space + "/" + project)) + for (Sample s : datahandler.getOpenBisClient() + .getSamplesOfProjectBySearchService("/" + space + "/" + project)) if (types.contains(s.getSampleTypeCode())) { tsvable = true; break; @@ -300,8 +297,8 @@ public void updateUI(final ProjectBean currentBean, String projectType) { String pm = projectBean.getProjectManager(); projectManager.setValue(pm); - contact - .setValue("Send question regarding project " + currentBean.getCode() + " (" + space + ")" + ""); @@ -337,12 +334,11 @@ public void blur(BlurEvent event) { // experimentLabel.setValue((String.format("This project includes %s experimental step(s)", // currentBean.getExperiments().size()))); - statusPanel.setCaption((String.format("Project includes %s experimental step(s)", currentBean - .getExperiments().size()))); + statusPanel.setCaption((String.format("Project includes %s experimental step(s)", + currentBean.getExperiments().size()))); - statusContent = - datahandler.createProjectStatusComponentNew(datahandler - .computeProjectStatuses(currentBean)); + statusContent = datahandler + .createProjectStatusComponentNew(datahandler.computeProjectStatuses(currentBean)); statusPanel.setContent(statusContent); statusPanel.setResponsive(true); statusPanel.setResponsive(true); @@ -378,9 +374,8 @@ public void blur(BlurEvent event) { final String projectIdentifier = currentBean.getId(); - retrievedDatasetsAll = - datahandler.getOpenBisClient().getDataSetsOfProjectByIdentifierWithSearchCriteria( - projectIdentifier); + retrievedDatasetsAll = datahandler.getOpenBisClient() + .getDataSetsOfProjectByIdentifierWithSearchCriteria(projectIdentifier); for (ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.DataSet ds : retrievedDatasetsAll) { @@ -438,7 +433,7 @@ public void blur(BlurEvent event) { // numberOfDatasets), Label.CONTENT_PREFORMATTED); numberOfDatasets = retrievedDatasets.size(); - this.datasetTable.setPageLength(Math.min(numberOfDatasets, 10)); + this.datasetTable.setPageLength(Math.max(3, Math.min(numberOfDatasets, 10))); Boolean dataAvailable = true; @@ -535,11 +530,11 @@ private void buildLayout(Boolean dataAvailable, String projectType) { Boolean available = false; SearchCriteria sampleSc = new SearchCriteria(); - sampleSc.addMatchClause(MatchClause.createAttributeMatch(MatchClauseAttribute.TYPE, - "Q_BIOLOGICAL_ENTITY")); + sampleSc.addMatchClause( + MatchClause.createAttributeMatch(MatchClauseAttribute.TYPE, "Q_BIOLOGICAL_ENTITY")); SearchCriteria projectSc = new SearchCriteria(); - projectSc.addMatchClause(MatchClause.createAttributeMatch(MatchClauseAttribute.PROJECT, - projectBean.getCode())); + projectSc.addMatchClause( + MatchClause.createAttributeMatch(MatchClauseAttribute.PROJECT, projectBean.getCode())); sampleSc.addSubCriteria(SearchSubCriteria.createExperimentCriteria(projectSc)); SearchCriteria experimentSc = new SearchCriteria(); @@ -672,8 +667,8 @@ public void buttonClick(ClickEvent event) { for (final Object itemId : this.datasetTable.getItemIds()) { - setCheckedBox(itemId, (String) this.datasetTable.getItem(itemId).getItemProperty("CODE") - .getValue()); + setCheckedBox(itemId, + (String) this.datasetTable.getItem(itemId).getItemProperty("CODE").getValue()); } @@ -725,9 +720,8 @@ public void itemClick(ItemClickEvent event) { if (!event.isDoubleClick()) { String datasetCode = (String) datasetTable.getItem(event.getItemId()).getItemProperty("CODE").getValue(); - String datasetFileName = - (String) datasetTable.getItem(event.getItemId()).getItemProperty("File Name") - .getValue(); + String datasetFileName = (String) datasetTable.getItem(event.getItemId()) + .getItemProperty("File Name").getValue(); URL url; try { Resource res = null; @@ -735,9 +729,8 @@ public void itemClick(ItemClickEvent event) { if (parent != null) { String parentDatasetFileName = (String) datasetTable.getItem(parent).getItemProperty("File Name").getValue(); - url = - datahandler.getOpenBisClient().getUrlForDataset(datasetCode, - parentDatasetFileName + "/" + datasetFileName); + url = datahandler.getOpenBisClient().getUrlForDataset(datasetCode, + parentDatasetFileName + "/" + datasetFileName); } else { url = datahandler.getOpenBisClient().getUrlForDataset(datasetCode, datasetFileName); } @@ -778,10 +771,9 @@ public void itemClick(ItemClickEvent event) { } catch (MalformedURLException e) { LOGGER.error(String.format( "Visualization failed because of malformedURL for dataset: %s", datasetCode)); - Notification - .show( - "Given dataset has no file attached to it!! Please Contact your project manager. Or check whether it already has some data", - Notification.Type.ERROR_MESSAGE); + Notification.show( + "Given dataset has no file attached to it!! Please Contact your project manager. Or check whether it already has some data", + Notification.Type.ERROR_MESSAGE); } } } @@ -803,10 +795,10 @@ private void setCheckedBox(Object itemId, String parentFolder) { if (datasetTable.hasChildren(itemId)) { for (Object childId : datasetTable.getChildren(itemId)) { - String newParentFolder = - Paths.get(parentFolder, + String newParentFolder = Paths + .get(parentFolder, (String) this.datasetTable.getItem(itemId).getItemProperty("File Name").getValue()) - .toString(); + .toString(); setCheckedBox(childId, newParentFolder); } } @@ -858,8 +850,8 @@ public void registerDatasetInTable(DatasetBean d, HierarchicalContainer dataset_ String secName = d.getProperties().get("Q_SECONDARY_NAME"); // TODO add User here if (secName != null) { - dataset_container.getContainerProperty(new_ds, "Description").setValue( - d.getProperties().get("Q_SECONDARY_NAME")); + dataset_container.getContainerProperty(new_ds, "Description") + .setValue(d.getProperties().get("Q_SECONDARY_NAME")); } // dataset_container.getContainerProperty(new_ds, "Sample Type").setValue( // d.getSample().getType()); @@ -892,8 +884,8 @@ public void registerDatasetInTable(DatasetBean d, HierarchicalContainer dataset_ String secName = d.getProperties().get("Q_SECONDARY_NAME"); // TODO add User here too if (secName != null) { - dataset_container.getContainerProperty(new_file, "Description").setValue( - d.getProperties().get("Q_SECONDARY_NAME")); + dataset_container.getContainerProperty(new_file, "Description") + .setValue(d.getProperties().get("Q_SECONDARY_NAME")); } // dataset_container.getContainerProperty(new_file, "Sample Type").setValue(sampleType); dataset_container.getContainerProperty(new_file, "File Name").setValue(d.getFileName()); @@ -901,8 +893,8 @@ public void registerDatasetInTable(DatasetBean d, HierarchicalContainer dataset_ dataset_container.getContainerProperty(new_file, "Dataset Type").setValue(d.getType()); dataset_container.getContainerProperty(new_file, "Registration Date").setValue(ts); dataset_container.getContainerProperty(new_file, "Validated").setValue(true); - dataset_container.getContainerProperty(new_file, "File Size").setValue( - DashboardUtil.humanReadableByteCount(d.getFileSize(), true)); + dataset_container.getContainerProperty(new_file, "File Size") + .setValue(DashboardUtil.humanReadableByteCount(d.getFileSize(), true)); dataset_container.getContainerProperty(new_file, "dl_link").setValue(d.getDssPath()); dataset_container.getContainerProperty(new_file, "CODE").setValue(d.getCode()); dataset_container.getContainerProperty(new_file, "file_size_bytes").setValue(d.getFileSize()); @@ -933,8 +925,8 @@ public void valueChange(ValueChangeEvent event) { PortletSession portletSession = ((QbicmainportletUI) UI.getCurrent()).getPortletSession(); Map> entries = - (Map>) portletSession.getAttribute( - "qbic_download", PortletSession.APPLICATION_SCOPE); + (Map>) portletSession + .getAttribute("qbic_download", PortletSession.APPLICATION_SCOPE); boolean itemSelected = (Boolean) event.getProperty().getValue(); /* @@ -974,10 +966,10 @@ private void valueChange(Object itemId, boolean itemSelected, ((CheckBox) datasetTable.getItem(itemId).getItemProperty("Select").getValue()) .setValue(itemSelected); - fileName = - Paths.get(fileName, + fileName = Paths + .get(fileName, (String) datasetTable.getItem(itemId).getItemProperty("File Name").getValue()) - .toString(); + .toString(); // System.out.println(fileName); if (datasetTable.hasChildren(itemId)) { @@ -989,8 +981,8 @@ private void valueChange(Object itemId, boolean itemSelected, (String) datasetTable.getItem(itemId).getItemProperty("CODE").getValue(); Long datasetFileSize = (Long) datasetTable.getItem(itemId).getItemProperty("file_size_bytes").getValue(); - entries.put(fileName, new AbstractMap.SimpleEntry(datasetCode, - datasetFileSize)); + entries.put(fileName, + new AbstractMap.SimpleEntry(datasetCode, datasetFileSize)); } else { entries.remove(fileName); } @@ -1035,8 +1027,8 @@ void updateHLALayout() { sc.addMatchClause(MatchClause.createAttributeMatch(MatchClauseAttribute.TYPE, model.ExperimentType.Q_NGS_HLATYPING.name())); SearchCriteria projectSc = new SearchCriteria(); - projectSc.addMatchClause(MatchClause.createAttributeMatch(MatchClauseAttribute.PROJECT, - projectBean.getCode())); + projectSc.addMatchClause( + MatchClause.createAttributeMatch(MatchClauseAttribute.PROJECT, projectBean.getCode())); sc.addSubCriteria(SearchSubCriteria.createExperimentCriteria(projectSc)); SearchCriteria experimentSc = new SearchCriteria(); @@ -1052,8 +1044,8 @@ void updateHLALayout() { sc2.addMatchClause(MatchClause.createAttributeMatch(MatchClauseAttribute.TYPE, model.ExperimentType.Q_WF_NGS_HLATYPING.name())); SearchCriteria projectSc2 = new SearchCriteria(); - projectSc2.addMatchClause(MatchClause.createAttributeMatch(MatchClauseAttribute.PROJECT, - projectBean.getCode())); + projectSc2.addMatchClause( + MatchClause.createAttributeMatch(MatchClauseAttribute.PROJECT, projectBean.getCode())); sc2.addSubCriteria(SearchSubCriteria.createExperimentCriteria(projectSc2)); SearchCriteria experimentSc2 = new SearchCriteria(); @@ -1092,9 +1084,8 @@ void updateHLALayout() { addInformation = sample.getProperties().get("Q_ADDITIONAL_INFO"); } - labelContent += - String.format("MHC Class %s " + "

Patient: %s

" + "

%s

", lastOne, - sample.getProperties().get("Q_HLA_TYPING"), addInformation); + labelContent += String.format("MHC Class %s " + "

Patient: %s

" + "

%s

", + lastOne, sample.getProperties().get("Q_HLA_TYPING"), addInformation); } for (ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Sample sample : wfSamples) { @@ -1102,9 +1093,8 @@ void updateHLALayout() { if (!(sample.getProperties().get("Q_HLA_TYPING") == null)) { - labelContent += - String.format("Computational Typing (OptiType)" + "

%s

", sample - .getProperties().get("Q_HLA_TYPING")); + labelContent += String.format("Computational Typing (OptiType)" + "

%s

", + sample.getProperties().get("Q_HLA_TYPING")); } } diff --git a/QBiCMainPortlet/src/model/ProjectBean.java b/QBiCMainPortlet/src/model/ProjectBean.java index 2d7f5f7..707b2ef 100644 --- a/QBiCMainPortlet/src/model/ProjectBean.java +++ b/QBiCMainPortlet/src/model/ProjectBean.java @@ -1,6 +1,6 @@ /******************************************************************************* - * QBiC Project qNavigator enables users to manage their projects. Copyright (C) "2016” - * Christopher Mohr, David Wojnar, Andreas Friedrich + * QBiC Project qNavigator enables users to manage their projects. Copyright (C) "2016” Christopher + * Mohr, David Wojnar, Andreas Friedrich * * This program is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation, either version 3 of the @@ -44,11 +44,13 @@ public class ProjectBean implements Serializable { private String projectManager; private Set members; private Boolean containsData; + private Boolean containsResults; + private Boolean containsAttachments; - public ProjectBean(String id, String code, String secondaryName, String description, - String space, BeanItemContainer experiments, ProgressBar progress, - Date registrationDate, String registrator, String contact, Set members, - Boolean containsData, String projectManager) { + public ProjectBean(String id, String code, String secondaryName, String description, String space, + BeanItemContainer experiments, ProgressBar progress, Date registrationDate, + String registrator, String contact, Set members, Boolean containsData, + Boolean containsResults, Boolean containsAttachments, String projectManager) { super(); this.id = id; this.code = code; @@ -62,6 +64,8 @@ public ProjectBean(String id, String code, String secondaryName, String descript this.contact = contact; this.members = members; this.setContainsData(containsData); + this.setContainsResults(containsResults); + this.setContainsAttachments(containsAttachments); } public ProjectBean() { @@ -190,6 +194,14 @@ public Boolean getContainsData() { return containsData; } + public Boolean getContainsResults() { + return containsResults; + } + + public Boolean getContainsAttachments() { + return containsAttachments; + } + public void setContainsData(Boolean containsData) { this.containsData = containsData; } @@ -225,4 +237,12 @@ public void setLongDescription(String longDesc) { public String getLongDescription() { return longDescription; } + + public void setContainsResults(Boolean containsResults) { + this.containsResults = containsResults; + } + + public void setContainsAttachments(Boolean containsAttachment) { + this.containsAttachments = containsAttachment; + } }