Project

General

Profile

« Previous | Next » 

Revision 2e93b829

Added by Cherian Mathew over 8 years ago

#5225 Replace saveOrUpdate with merge for new entity wizards

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewAmplificationWizard.java
38 38
    /** {@inheritDoc} */
39 39
    @Override
40 40
    protected void saveEntity() {
41
        CdmStore.getService(IAmplificationService.class).saveOrUpdate(getEntity());
41
        CdmStore.getService(IAmplificationService.class).merge(getEntity());
42 42
    }
43 43

  
44 44
    /** {@inheritDoc} */
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewCollectionWizard.java
1 1
// $Id$
2 2
/**
3 3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy 
4
* European Distributed Institute of Taxonomy
5 5
* http://www.e-taxonomy.eu
6
* 
6
*
7 7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8 8
* See LICENSE.TXT at the top of this package for the full license terms.
9 9
*/
......
29 29
	public void addPages() {
30 30
		addPage(new CollectionWizardPage(formFactory, getConversationHolder(), getEntity()));
31 31
	}
32
	
32

  
33 33
	/* (non-Javadoc)
34 34
	 * @see eu.etaxonomy.taxeditor.editor.newWizard.AbstractNewEntityWizard#saveEntity()
35 35
	 */
36 36
	/** {@inheritDoc} */
37 37
	@Override
38 38
	protected void saveEntity() {
39
		CdmStore.getService(ICollectionService.class).saveOrUpdate(getEntity());
39
		CdmStore.getService(ICollectionService.class).merge(getEntity());
40 40
	}
41 41

  
42 42
	/* (non-Javadoc)
......
52 52
	protected String getEntityName() {
53 53
		return "Collection";
54 54
	}
55
	
55

  
56 56
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewDerivedUnitBaseWizard.java
102 102
	/** {@inheritDoc} */
103 103
	@Override
104 104
	protected void saveEntity() {
105
		CdmStore.getService(IOccurrenceService.class).saveOrUpdate(getEntity());
105
		CdmStore.getService(IOccurrenceService.class).merge(getEntity());
106 106
	}
107 107

  
108 108
	@Override
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewFieldUnitWizard.java
1 1
// $Id$
2 2
/**
3 3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy 
4
* European Distributed Institute of Taxonomy
5 5
* http://www.e-taxonomy.eu
6
* 
6
*
7 7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8 8
* See LICENSE.TXT at the top of this package for the full license terms.
9 9
*/
......
38 38
	/** {@inheritDoc} */
39 39
	@Override
40 40
	protected void saveEntity() {
41
		CdmStore.getService(IOccurrenceService.class).saveOrUpdate(getEntity());
41
		CdmStore.getService(IOccurrenceService.class).merge(getEntity());
42 42
	}
43 43

  
44 44
	@Override
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewGrantedAuthorityWizard.java
1 1
// $Id$
2 2
/**
3 3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy 
4
* European Distributed Institute of Taxonomy
5 5
* http://www.e-taxonomy.eu
6
* 
6
*
7 7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8 8
* See LICENSE.TXT at the top of this package for the full license terms.
9 9
*/
......
20 20
 * @created Sept 13 2012
21 21
 */
22 22
public class NewGrantedAuthorityWizard extends AbstractNewEntityWizard<GrantedAuthorityImpl> {
23
	
23

  
24 24
	private GrantedAuthorityDetailWizardPage authorityPage;
25
	
25

  
26 26
	/* (non-Javadoc)
27 27
	 * @see org.eclipse.jface.wizard.Wizard#addPages()
28 28
	 */
......
38 38
	 */
39 39
	@Override
40 40
	protected void saveEntity() {
41
		CdmStore.getService(IGrantedAuthorityService.class).saveOrUpdate(getEntity());
41
		CdmStore.getService(IGrantedAuthorityService.class).merge(getEntity());
42 42
	}
43 43

  
44 44
	/* (non-Javadoc)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewGroupWizard.java
1 1
// $Id$
2 2
/**
3 3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy 
4
* European Distributed Institute of Taxonomy
5 5
* http://www.e-taxonomy.eu
6
* 
6
*
7 7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8 8
* See LICENSE.TXT at the top of this package for the full license terms.
9 9
*/
......
23 23
public class NewGroupWizard extends AbstractNewEntityWizard<Group> {
24 24

  
25 25
	private GroupDetailWizardPage groupPage;
26
	
26

  
27 27
	/* (non-Javadoc)
28 28
	 * @see org.eclipse.jface.wizard.Wizard#addPages()
29 29
	 */
......
32 32
		groupPage = new GroupDetailWizardPage(formFactory, getConversationHolder(), getEntity());
33 33
		super.addPage(groupPage);
34 34
	}
35
	
35

  
36 36
	/* (non-Javadoc)
37 37
	 * @see eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard#saveEntity()
38 38
	 */
39 39
	@Override
40 40
	protected void saveEntity() {
41
		CdmStore.getService(IGroupService.class).saveOrUpdate(getEntity());
41
		CdmStore.getService(IGroupService.class).merge(getEntity());
42 42
	}
43 43

  
44 44
	/* (non-Javadoc)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewInstitutionWizard.java
1 1
// $Id$
2 2
/**
3 3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy 
4
* European Distributed Institute of Taxonomy
5 5
* http://www.e-taxonomy.eu
6
* 
6
*
7 7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8 8
* See LICENSE.TXT at the top of this package for the full license terms.
9 9
*/
......
29 29
	public void addPages() {
30 30
		addPage(new InstitutionWizardPage(formFactory, getConversationHolder(), getEntity()));
31 31
	}
32
	
32

  
33 33
	/* (non-Javadoc)
34 34
	 * @see eu.etaxonomy.taxeditor.editor.newWizard.AbstractNewEntityWizard#saveEntity()
35 35
	 */
36 36
	@Override
37 37
	protected void saveEntity() {
38
		CdmStore.getService(IAgentService.class).saveOrUpdate(getEntity());
38
		CdmStore.getService(IAgentService.class).merge(getEntity());
39 39
	}
40 40

  
41 41
	/* (non-Javadoc)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewNonViralNameWizard.java
1 1
// $Id$
2 2
/**
3 3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy 
4
* European Distributed Institute of Taxonomy
5 5
* http://www.e-taxonomy.eu
6
* 
6
*
7 7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8 8
* See LICENSE.TXT at the top of this package for the full license terms.
9 9
*/
......
33 33
	public void addPages() {
34 34
		addPage(new NonViralNameWizardPage(formFactory, getConversationHolder(), getEntity()));
35 35
	}
36
	
36

  
37 37
	/** {@inheritDoc} */
38 38
	@Override
39 39
	protected NonViralName createNewEntity() {
......
49 49
	/** {@inheritDoc} */
50 50
	@Override
51 51
	protected void saveEntity() {
52
		CdmStore.getService(INameService.class).saveOrUpdate(getEntity());
52
		CdmStore.getService(INameService.class).merge(getEntity());
53 53
	}
54 54

  
55 55
	@Override
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewPersonWizard.java
1 1
// $Id$
2 2
/**
3 3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy 
4
* European Distributed Institute of Taxonomy
5 5
* http://www.e-taxonomy.eu
6
* 
6
*
7 7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8 8
* See LICENSE.TXT at the top of this package for the full license terms.
9 9
*/
......
29 29
	public void addPages() {
30 30
		addPage(new PersonWizardPage(formFactory, getConversationHolder(), getEntity()));
31 31
	}
32
	
32

  
33 33
	/** {@inheritDoc} */
34 34
	@Override
35 35
	protected Person createNewEntity() {
......
39 39
	/** {@inheritDoc} */
40 40
	@Override
41 41
	protected void saveEntity() {
42
		CdmStore.getService(IAgentService.class).saveOrUpdate(getEntity());
42
		CdmStore.getService(IAgentService.class).merge(getEntity());
43 43
	}
44 44

  
45 45
	@Override
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewPolytomousKeyWizard.java
1 1
/**
2
 * 
2
 *
3 3
 */
4 4
package eu.etaxonomy.taxeditor.newWizard;
5 5

  
......
14 14
public class NewPolytomousKeyWizard extends AbstractNewEntityWizard<PolytomousKey> {
15 15

  
16 16
    private PolytomousKeyWizardPage polytomousKeyPage;
17
    
17

  
18 18
	@Override
19 19
	public void addPages() {
20 20
		polytomousKeyPage = new PolytomousKeyWizardPage(formFactory, getConversationHolder(), getEntity());
21 21
		super.addPage(polytomousKeyPage);
22 22
	}
23
	
23

  
24 24
	public String getPolytomousKeyName() {
25 25
	    return polytomousKeyPage.getPolytomousKeyName();
26 26
	}
27
	
27

  
28 28
	/* (non-Javadoc)
29 29
	 * @see eu.etaxonomy.taxeditor.editor.newWizard.AbstractNewEntityWizard#saveEntity()
30 30
	 */
31 31
	@Override
32 32
	protected void saveEntity() {
33 33
	    if(!polytomousKeyPage.getPolytomousKeyName().equals("")) {
34
	        CdmStore.getService(IPolytomousKeyService.class).saveOrUpdate(getEntity());
34
	        CdmStore.getService(IPolytomousKeyService.class).merge(getEntity());
35 35
	    }
36 36
	}
37 37

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewPrimerWizard.java
38 38
    /** {@inheritDoc} */
39 39
    @Override
40 40
    protected void saveEntity() {
41
        CdmStore.getService(IPrimerService.class).saveOrUpdate(getEntity());
41
        CdmStore.getService(IPrimerService.class).merge(getEntity());
42 42
    }
43 43

  
44 44
    /** {@inheritDoc} */
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewReferenceWizard.java
1 1
// $Id$
2 2
/**
3 3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy 
4
* European Distributed Institute of Taxonomy
5 5
* http://www.e-taxonomy.eu
6
* 
6
*
7 7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8 8
* See LICENSE.TXT at the top of this package for the full license terms.
9 9
*/
......
24 24
 * @version 1.0
25 25
 */
26 26
public class NewReferenceWizard extends AbstractNewEntityWizard<Reference> {
27
	
27

  
28 28
	private ReferenceWizardPage referencePage;
29
	
29

  
30 30
	/** {@inheritDoc} */
31 31
	@Override
32 32
	public void addPages() {
......
45 45
	/** {@inheritDoc} */
46 46
	@Override
47 47
	protected void saveEntity() {
48
		CdmStore.getService(IReferenceService.class).saveOrUpdate(getEntity());
48
	    CdmStore.getService(IReferenceService.class).save(getEntity());
49 49
	}
50 50

  
51 51
	/** {@inheritDoc} */
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewTeamWizard.java
1 1
// $Id$
2 2
/**
3 3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy 
4
* European Distributed Institute of Taxonomy
5 5
* http://www.e-taxonomy.eu
6
* 
6
*
7 7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8 8
* See LICENSE.TXT at the top of this package for the full license terms.
9 9
*/
......
29 29
	public void addPages() {
30 30
		addPage(new TeamWizardPage(formFactory, getConversationHolder(), getEntity()));
31 31
	}
32
	
32

  
33 33
	/* (non-Javadoc)
34 34
	 * @see eu.etaxonomy.taxeditor.editor.newWizard.AbstractNewEntityWizard#createNewEntity()
35 35
	 */
......
42 42
	/** {@inheritDoc} */
43 43
	@Override
44 44
	protected void saveEntity() {
45
		CdmStore.getService(IAgentService.class).saveOrUpdate(getEntity());
45
		CdmStore.getService(IAgentService.class).merge(getEntity());
46 46
	}
47 47

  
48 48
	@Override
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewUserWizard.java
1 1
/**
2
 * 
2
 *
3 3
 */
4 4
package eu.etaxonomy.taxeditor.newWizard;
5 5

  
......
15 15
public class NewUserWizard extends AbstractNewEntityWizard<User> {
16 16

  
17 17
	private UserDetailWizardPage userPage;
18
	
18

  
19 19
	@Override
20 20
	public void addPages() {
21 21
		userPage = new UserDetailWizardPage(formFactory, getConversationHolder(), getEntity());
22 22
		addPage(userPage);
23 23
	}
24
	
24

  
25 25
	@Override
26 26
	protected void saveEntity() {
27
		CdmStore.getService(IUserService.class).saveOrUpdate(getEntity());
27
		CdmStore.getService(IUserService.class).merge(getEntity());
28 28
	}
29 29

  
30 30
	@Override
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/AbstractFilteredCdmResourceSelectionDialog.java
71 71

  
72 72
	protected T cdmBaseToBeFiltered;
73 73

  
74

  
74 75
	/**
75 76
	 * <p>Constructor for AbstractFilteredCdmResourceSelectionDialog.</p>
76 77
	 *
......
484 485
					if (status == IStatus.OK) {
485 486

  
486 487
						T entity = (T) wizard.getEntity();
488
						model.add(new UuidAndTitleCache<T>(entity.getUuid(),
489
						        entity.getId(),
490
						        getTitle(entity)));
487 491
						refresh();
488 492
						setPattern(entity);
489 493
						getConversationHolder().bind();

Also available in: Unified diff