return;
}
}
- }else if (event instanceof CellVisualChangeEvent){
+ }
+ else if (event instanceof CellVisualChangeEvent){
CellVisualChangeEvent cellSelectionEvent = (CellVisualChangeEvent)event;
int columnPosition = cellSelectionEvent.getColumnPosition();
int rowPosition = cellSelectionEvent.getRowPosition();
*/
@Override
public void setDataValue(TaxonDistributionDTO taxonWrapper, int columnIndex, Object newValue) {
+ System.err.println("DistributionColumnAccessor: " + taxonWrapper.getNameCache());
if (newValue instanceof PresenceAbsenceTerm){
NamedArea area =editor.getAreaToColumnIndexMap().get(columnIndex);
Map<NamedArea, Set<DescriptionElementBase>> distributionMap = editor.taxonDistributionMap.get(taxonWrapper.getTaxonUuid());
dist.addSource(DescriptionElementSource.NewPrimarySourceInstance(editor.getDefaultSource(), null));
}
desc.addElement(dist);
- editor.part.getCdmEntitySession().load(desc, true);
+ if(desc.isPersited()){
+ editor.part.getCdmEntitySession().load(desc, true);
+ }
distributions.add(dist);
protected void saveDistributions() {
Set<TaxonDistributionDTO> coll = new HashSet();
editor.getDescriptionsToSave().forEach(dto->coll.add(dto));
+ Set<TaxonDistributionDTO> removeList = new HashSet();
for (TaxonDistributionDTO dto: coll){
Taxon taxon = null;
for(TaxonDescription desc: dto.getDescriptionsWrapper().getDescriptions()){
taxon.addDescription(desc);
}
if (taxon != null){
- CdmStore.getService(ITaxonService.class).merge(taxon, true);
+ MergeResult result = CdmStore.getService(ITaxonService.class).merge(taxon, true);
+ boolean removed = dto.getDescriptionsWrapper().getDescriptions().remove(desc);
+ System.err.println("removed:" + removed);
}
}
}
-
+ coll.removeAll(removeList);
List<MergeResult<DescriptionBase>> result = CdmStore.getService(IDescriptionService.class).mergeDescriptionElements(coll, true);
for (MergeResult<DescriptionBase> mergeRes: result ){
cdmEntitySession.load(mergeRes, true);
Object rowWrapper = editor.getBodyDataProvider().getRowObject(this.getRowIndex());
if(rowWrapper instanceof TaxonDistributionDTO){
NamedArea area = editor.getAreaToColumnIndexMap().get(getColumnIndex());
+ System.err.println("StatusDataCellEditor: " + ((TaxonDistributionDTO)rowWrapper).getNameCache());
Map<NamedArea, Set<DescriptionElementBase>> distributionMap = editor.taxonDistributionMap.get(((TaxonDistributionDTO) rowWrapper).getTaxonUuid());
if (distributionMap == null){
distributionMap = new HashMap();
}else if (elements.size() == 1){
DescriptionElementBase base = elements.iterator().next();
Distribution distr = (Distribution) base;
- editor.descriptionsToSave.add( (TaxonDistributionDTO) rowWrapper);
+ //editor.descriptionsToSave.add( (TaxonDistributionDTO) rowWrapper);
//TODO set value corresponding to preference
if (distr.getStatus() != null){
if (distr.getStatus().getLabel() == ""){