Project

General

Profile

« Previous | Next » 

Revision 3a8e076a

Added by Cherian Mathew about 7 years ago

#5160 Use new merge method with ids as arguments

View differences:

eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AbstractBulkEditorInput.java
23 23

  
24 24
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
25 25
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
26
import eu.etaxonomy.cdm.model.common.CdmBase;
26 27
import eu.etaxonomy.cdm.model.common.ICdmBase;
27 28
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
28 29
import eu.etaxonomy.cdm.model.common.MarkerType;
......
238 239
    public boolean merge(T entity, T mergeTarget) {
239 240
		if (entity instanceof IMergable) {
240 241
			try {
241
				CdmStore.getCommonService().merge((IMergable)mergeTarget, (IMergable)entity);
242
				CdmStore.getCommonService().merge(mergeTarget.getId(), entity.getId(), (Class<? extends CdmBase>)entity.getClass());
242 243
			} catch (MergeException e) {
243 244
				MessagingUtils.errorDialog("Bulk Editor Merge Error",
244 245
						this,
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AgentEditorInput.java
120 120
    public boolean merge(TeamOrPersonBase entity, TeamOrPersonBase mergeTarget) {
121 121
		if (entity instanceof IMergable) {
122 122
			try {
123
				IMergeStrategy strategy = DefaultMergeStrategy.NewInstance(Person.class);
124
				strategy.setMergeMode("institutionalMemberships", MergeMode.FIRST);
125
				CdmStore.getCommonService().merge((IMergable)mergeTarget, (IMergable)entity, Person.class);
123
				if(entity instanceof Person) {
124
				    IMergeStrategy strategy = DefaultMergeStrategy.NewInstance(Person.class);
125
				    strategy.setMergeMode("institutionalMemberships", MergeMode.FIRST);
126
				    CdmStore.getCommonService().merge(mergeTarget.getId(), entity.getId(), Person.class);
127
				} else {
128
				    IMergeStrategy strategy = DefaultMergeStrategy.NewInstance(TeamOrPersonBase.class);
129
				    CdmStore.getCommonService().merge(mergeTarget.getId(), entity.getId(), TeamOrPersonBase.class);
130
				}
131

  
126 132
			} catch (MergeException e) {
127 133
				MessagingUtils.errorDialog("Bulk Editor Merge Error",
128 134
						this,

Also available in: Unified diff