Project

General

Profile

« Previous | Next » 

Revision 0bb254ee

Added by Cherian Mathew about 7 years ago

#5160 Use new merge method with ids as arguments

Conflicts:
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AgentEditorInput.java

View differences:

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

  
23 23
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
24 24
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
25
import eu.etaxonomy.cdm.model.common.CdmBase;
25 26
import eu.etaxonomy.cdm.model.common.ICdmBase;
26 27
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
27 28
import eu.etaxonomy.cdm.model.common.MarkerType;
......
231 232
    public boolean merge(T entity, T mergeTarget) {
232 233
		if (entity instanceof IMergable) {
233 234
			try {
234
				CdmStore.getCommonService().merge((IMergable)mergeTarget, (IMergable)entity);
235
				CdmStore.getCommonService().merge(mergeTarget.getId(), entity.getId(), (Class<? extends CdmBase>)entity.getClass());
235 236
			} catch (MergeException e) {
236 237
				MessagingUtils.errorDialog("Bulk Editor Merge Error",
237 238
						this,
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AgentEditorInput.java
82 82
    public boolean merge(TeamOrPersonBase entity, TeamOrPersonBase mergeTarget) {
83 83
		if (entity instanceof IMergable) {
84 84
			try {
85
				IMergeStrategy strategy = DefaultMergeStrategy.NewInstance(Person.class);
86
				strategy.setMergeMode("institutionalMemberships", MergeMode.FIRST);
87
				CdmStore.getCommonService().merge((IMergable)mergeTarget, (IMergable)entity, strategy);
85
				if(entity instanceof Person) {
86
				    IMergeStrategy strategy = DefaultMergeStrategy.NewInstance(Person.class);
87
				    strategy.setMergeMode("institutionalMemberships", MergeMode.FIRST);
88
				    CdmStore.getCommonService().merge(mergeTarget.getId(), entity.getId(), Person.class);
89
				} else {
90
				    IMergeStrategy strategy = DefaultMergeStrategy.NewInstance(TeamOrPersonBase.class);
91
				    CdmStore.getCommonService().merge(mergeTarget.getId(), entity.getId(), TeamOrPersonBase.class);
92
				}
88 93
			} catch (MergeException e) {
89 94
				MessagingUtils.errorDialog("Bulk Editor Merge Error",
90 95
						this,

Also available in: Unified diff