Project

General

Profile

« Previous | Next » 

Revision b162c633

Added by Katja Luther over 7 years ago

changes in misapplicationDeletionOperation

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteMisapplicationOperation.java
14 14
import org.eclipse.core.runtime.IAdaptable;
15 15
import org.eclipse.core.runtime.IProgressMonitor;
16 16
import org.eclipse.core.runtime.IStatus;
17
import org.eclipse.ui.IWorkbenchPage;
17 18

  
18 19
import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
20
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
19 21
import eu.etaxonomy.cdm.api.service.ITaxonService;
20 22
import eu.etaxonomy.cdm.api.service.config.NameDeletionConfigurator;
23
import eu.etaxonomy.cdm.api.service.config.TaxonBaseDeletionConfigurator;
21 24
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
22 25
import eu.etaxonomy.cdm.model.reference.Reference;
23 26
import eu.etaxonomy.cdm.model.taxon.Taxon;
24 27
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
25
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
26 28
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
29
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
27 30
import eu.etaxonomy.taxeditor.store.CdmStore;
28 31

  
29 32
/**
......
32 35
 * @author p.ciardelli
33 36
 * @created 16.01.2009
34 37
 */
35
public class DeleteMisapplicationOperation extends AbstractPostTaxonOperation {
38
public class DeleteMisapplicationOperation extends DeleteTaxonBaseOperation {
36 39

  
37 40
	private final Taxon misapplication;
38 41

  
......
49 52
	 * @param misapplication a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
50 53
	 * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
51 54
	 */
52
	public DeleteMisapplicationOperation(String label, IUndoContext undoContext,
53
			Taxon taxon, Taxon misapplication, IPostOperationEnabled postOperationEnabled) {
54
		super(label, undoContext, taxon, postOperationEnabled);
55

  
55
	public DeleteMisapplicationOperation(String label, IUndoContext undoContext, TaxonBaseDeletionConfigurator configurator,IWorkbenchPage activePage,
56
            Taxon taxon, Taxon misapplication, IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled,ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
57
		//super(label, undoContext, taxon, postOperationEnabled);
58
	    super(label, undoContext, configurator, activePage, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);
56 59
		this.misapplication = misapplication;
60
		this.element = taxon;
57 61
	}
58 62

  
59 63
	/* (non-Javadoc)
......
86 90
		NameDeletionConfigurator nameConfig = new NameDeletionConfigurator();
87 91
		nameConfig.setRemoveAllNameRelationships(true);
88 92
		config.setNameDeletionConfig(nameConfig);
89
		service.deleteTaxon(misapplication.getUuid(), config, null);
93
		result = service.deleteTaxon(misapplication.getUuid(), config, null);
90 94
		monitor.worked(40);
91 95

  
92 96
		return postExecute(null);
......
106 110

  
107 111
		element.addMisappliedName(misapplication, citation, microcitation);
108 112

  
113

  
109 114
		return postExecute(misapplication);
110 115
	}
111 116
}
eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteMisapplicationOperationTest.java
1 1
/**
2 2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
3
* European Distributed Institute of Taxonomy
4 4
* http://www.e-taxonomy.eu
5
* 
5
*
6 6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
* See LICENSE.TXT at the top of this package for the full license terms.
8 8
*/
......
17 17

  
18 18
import eu.etaxonomy.cdm.model.common.ICdmBase;
19 19
import eu.etaxonomy.cdm.model.taxon.Taxon;
20
import eu.etaxonomy.taxeditor.editor.name.operation.DeleteMisapplicationOperation;
21 20
import eu.etaxonomy.taxeditor.store.operations.AbstractTaxeditorOperationTestBase;
22 21

  
23 22
/**
......
32 31
	private static Taxon taxon;
33 32

  
34 33
	private static Taxon misapplication;
35
	
34

  
36 35
	/**
37 36
	 * @throws java.lang.Exception
38 37
	 */
39 38
	@BeforeClass
40 39
	public static void setUpBeforeClass() throws Exception {
41
		
40

  
42 41
		taxon = Taxon.NewInstance(null, null);
43 42
		misapplication = Taxon.NewInstance(null, null);
44
		
43

  
45 44
		taxon.addMisappliedName(misapplication, null, null);
46
		
47
		operation = new DeleteMisapplicationOperation("", undoContext, taxon, misapplication, postOperation);
45

  
46
		operation = new DeleteMisapplicationOperation("", undoContext, null, null, taxon, misapplication, postOperation,  null, null);
47

  
48 48
	}
49 49

  
50 50
	/**
51 51
	 * Test method for {@link eu.etaxonomy.taxeditor.editor.name.operation.DeleteMisapplicationOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
52
	 * @throws ExecutionException 
52
	 * @throws ExecutionException
53 53
	 */
54 54
	@Test
55 55
	public void testExecuteIProgressMonitorIAdaptable() throws ExecutionException {
56 56
		operation.execute(monitor, info);
57
		
57

  
58 58
		Assert.assertTrue(taxon.getMisappliedNames().size() == 0);
59 59
	}
60 60

  
61 61
	/**
62 62
	 * Test method for {@link eu.etaxonomy.taxeditor.editor.name.operation.DeleteMisapplicationOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
63
	 * @throws ExecutionException 
63
	 * @throws ExecutionException
64 64
	 */
65 65
	@Test
66 66
	public void testUndoIProgressMonitorIAdaptable() throws ExecutionException {
67 67
		operation.undo(monitor, info);
68
		
68

  
69 69
		Assert.assertEquals(misapplication, taxon.getMisappliedNames().toArray(new Taxon[0])[0]);
70 70
	}
71 71

  
72 72
	/**
73 73
	 * Test method for {@link eu.etaxonomy.taxeditor.editor.name.operation.DeleteMisapplicationOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
74
	 * @throws ExecutionException 
74
	 * @throws ExecutionException
75 75
	 */
76 76
	@Test
77 77
	public void testRedoIProgressMonitorIAdaptable() throws ExecutionException {
78 78
		operation.redo(monitor, info);
79
		
79

  
80 80
		Assert.assertTrue(taxon.getMisappliedNames().size() == 0);
81 81
	}
82 82

  

Also available in: Unified diff