import eu.etaxonomy.cdm.api.service.IDescriptiveDataSetService;
import eu.etaxonomy.cdm.api.service.UpdateResult;
import eu.etaxonomy.cdm.api.service.dto.RowWrapperDTO;
+import eu.etaxonomy.cdm.api.service.dto.SpecimenRowWrapperDTO;
import eu.etaxonomy.cdm.common.monitor.IRemotingProgressMonitor;
import eu.etaxonomy.cdm.model.description.DescriptionBase;
import eu.etaxonomy.cdm.model.description.DescriptiveDataSet;
private LinkedMap<String, String> propertyToLabelMap = new LinkedMap<>();
- //FIXME use more concrete generic
- private EventList<Object> descriptions;
+ private EventList<RowWrapperDTO> descriptions;
private Collection<SpecimenNodeWrapper> specimenCache = null;
private Map<Feature, QuantitativeDataStatistics> featureToQuantDataStatisticsMap = new HashMap<>();
- private ListDataProvider<Object> bodyDataProvider;
+ private ListDataProvider<RowWrapperDTO> bodyDataProvider;
private FreezeLayer freezeLayer;
private void createLayers(boolean treeView) {
// use the SortedList constructor with 'null' for the Comparator
// because the Comparator will be set by configuration
- SortedList<Object> sortedList = new SortedList<>(descriptions, new MatrixRowComparator());
+ SortedList<RowWrapperDTO> sortedList = new SortedList<>(descriptions, new MatrixRowComparator());
// wrap the SortedList with the TreeList
- TreeList<Object> treeList = new TreeList(sortedList, new DescriptionTreeFormat(descriptiveDataSet), TreeList.NODES_START_EXPANDED);
+ TreeList<RowWrapperDTO> treeList = new TreeList(sortedList, new DescriptionTreeFormat(descriptiveDataSet), TreeList.NODES_START_EXPANDED);
/**
* data provider
*/
return natTable;
}
- public EventList<Object> getDescriptions() {
+ public EventList<RowWrapperDTO> getDescriptions() {
return descriptions;
}
.filter(wrapper ->
//map descriptions on a list of uuids of the described specimen
!this.descriptions.stream()
- .map(o->((RowWrapperDTO)o).getSpecimen().getUuid())
+ .filter(rowWrapper->rowWrapper instanceof SpecimenRowWrapperDTO)
+ .map(specimenRowWrapper->((SpecimenRowWrapperDTO) specimenRowWrapper).getSpecimen().getUuid())
.collect(Collectors.toList())
//an check if the specimen to add is already contained
.contains(wrapper.getUuidAndTitleCache().getUuid())
return toolbar.getNatTableState();
}
- public ListDataProvider<Object> getBodyDataProvider() {
+ public ListDataProvider<RowWrapperDTO> getBodyDataProvider() {
return bodyDataProvider;
}
Feature feature = descriptionElementBase.getFeature();
featureToElementMap.put(feature, descriptionElementBase);
}
- RowWrapperDTO rowWrapper = CdmStore.getService(IDescriptiveDataSetService.class).createRowWrapper(wrapper.getTaxonNode(), description, matrix.getDescriptiveDataSet());
+ RowWrapperDTO rowWrapper = CdmStore.getService(IDescriptiveDataSetService.class).createSpecimenRowWrapper(description, matrix.getDescriptiveDataSet());
if(rowWrapper==null){
error += description;
continue;
}
List<UUID> descriptionUuids = new ArrayList<>();
matrix.getDescriptiveDataSet().getDescriptions().forEach(desc->descriptionUuids.add(desc.getUuid()));
- UpdateResult result = CdmStore.getService(IDescriptionService.class).aggregateDescription(taxonUuid, descriptionUuids, matrix.getDescriptiveDataSet().getLabel());
+ UpdateResult result = CdmStore.getService(IDescriptionService.class).aggregateDescription(taxonUuid, descriptionUuids, matrix.getDescriptiveDataSet().getLabel(), matrix.getDescriptiveDataSet().getUuid());
matrix.addUpdateResult(result);
matrix.setDirty();
private void aggregateCategorcialHistogram(Map<Feature, CategoricalDataHistogram> featureToHistogramMap) {
featureToHistogramMap.clear();
matrix.getDescriptions()
- .forEach(o -> ((RowWrapperDTO) o).getSpecimenDescription().getElements().stream()
+ .forEach(o -> o.getSpecimenDescription().getElements().stream()
.filter(descriptionElement -> descriptionElement instanceof CategoricalData)
.forEach(categoricalData -> {
Feature feature = ((CategoricalData) categoricalData).getFeature();
private void aggregateQuantitativeSummary(Map<Feature, QuantitativeDataStatistics> featureToQuantDataStatisticsMap) {
featureToQuantDataStatisticsMap.clear();
matrix.getDescriptions()
- .forEach(o -> ((RowWrapperDTO) o).getSpecimenDescription().getElements().stream()
+ .forEach(o -> o.getSpecimenDescription().getElements().stream()
.filter(descriptionElement -> descriptionElement instanceof QuantitativeData)
.forEach(quantData -> {
Feature feature = ((QuantitativeData) quantData).getFeature();
import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor;
import eu.etaxonomy.cdm.api.service.dto.RowWrapperDTO;
+import eu.etaxonomy.cdm.api.service.dto.SpecimenRowWrapperDTO;
import eu.etaxonomy.cdm.model.description.Feature;
/**
* @since Nov 26, 2017
*
*/
-public class SpecimenColumnPropertyAccessor implements IColumnPropertyAccessor<Object>{
+public class SpecimenColumnPropertyAccessor implements IColumnPropertyAccessor<RowWrapperDTO>{
private CharacterMatrix matrix;
* {@inheritDoc}
*/
@Override
- public Object getDataValue(Object rowObject, int columnIndex) {
- if(rowObject instanceof RowWrapperDTO){
- RowWrapperDTO rowWrapper = (RowWrapperDTO)rowObject;
+ public Object getDataValue(RowWrapperDTO rowObject, int columnIndex) {
+ if(rowObject instanceof SpecimenRowWrapperDTO){
+ SpecimenRowWrapperDTO rowWrapper = (SpecimenRowWrapperDTO) rowObject;
switch (columnIndex) {
case 0:
if(matrix.isTreeView()){
* {@inheritDoc}
*/
@Override
- public void setDataValue(Object rowObject, int columnIndex, Object newValue) {
- if(rowObject instanceof RowWrapperDTO){
- RowWrapperDTO rowWrapper = (RowWrapperDTO)rowObject;
- Feature feature = matrix.getIndexToFeatureMap().get(columnIndex);
- rowWrapper.setDataValueForFeature(feature, newValue);
- }
+ public void setDataValue(RowWrapperDTO rowObject, int columnIndex, Object newValue) {
+ RowWrapperDTO rowWrapper = rowObject;
+ Feature feature = matrix.getIndexToFeatureMap().get(columnIndex);
+ rowWrapper.setDataValueForFeature(feature, newValue);
}
/**
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.navigation.navigator.e4.TaxonNavigatorE4;
-import eu.etaxonomy.taxeditor.navigation.navigator.operation.AggregateTaxonDescriptionsOperation;
import eu.etaxonomy.taxeditor.operation.e4.RemotingCdmHandlerE4;
public class AggregateTaxonDescriptionsHandler extends RemotingCdmHandlerE4 {
MPart activePart,
MHandledMenuItem menuItem) {
- return new AggregateTaxonDescriptionsOperation(getTrigger(),
- false,
- ((TaxonNodeDto) selection.getFirstElement()).getUuid()
- );
+ //FIXME: this handler will probably be removed and secondary aggregation will be handled in the matrix editor
+ return null;
+// new AggregateTaxonDescriptionsOperation(getTrigger(),
+// false,
+// ((TaxonNodeDto) selection.getFirstElement()).getUuid()
+// );
}
@CanExecute
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
-import eu.etaxonomy.cdm.api.service.IProgressMonitorService;
import eu.etaxonomy.cdm.api.service.UpdateResult;
import eu.etaxonomy.cdm.common.monitor.IRemotingProgressMonitor;
import eu.etaxonomy.taxeditor.event.EventUtility;
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.navigation.navigator.e4.TaxonNavigatorE4;
import eu.etaxonomy.taxeditor.operation.IPostMoniteredOperationEnabled;
import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation;
public class AggregateTaxonDescriptionsOperation extends RemotingCdmUpdateOperation implements IPostMoniteredOperationEnabled {
private UUID nodeUuid;
+ private UUID descriptiveDataSetUuid;
private UUID monitorUuid;
public AggregateTaxonDescriptionsOperation(Object source,
boolean async,
- UUID nodeUuid) {
+ UUID nodeUuid,
+ UUID descriptiveDataSetUuid
+ ) {
super("Aggregate taxon descriptions", Action.Update, source,async);
this.nodeUuid = nodeUuid;
+ this.descriptiveDataSetUuid = descriptiveDataSetUuid;
}
}
public void runMoniteredOperation() {
- monitorUuid = CdmApplicationState.getLongRunningTasksService().aggregateComputedTaxonDescriptions(nodeUuid);
+ monitorUuid = CdmApplicationState.getLongRunningTasksService().aggregateComputedTaxonDescriptions(nodeUuid, descriptiveDataSetUuid);
Display.getDefault().asyncExec(new Runnable() {
@Override