Project

General

Profile

Download (1.98 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2015 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10
package eu.etaxonomy.taxeditor.operation;
11

    
12
import org.eclipse.core.runtime.IAdaptable;
13
import org.eclipse.core.runtime.IProgressMonitor;
14

    
15
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
16
import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
17
import eu.etaxonomy.cdm.api.service.ITestService;
18
import eu.etaxonomy.cdm.api.service.UpdateResult;
19

    
20
/**
21
 * @author cmathew
22
 * @date 26 Jun 2015
23
 *
24
 */
25
public class RemotingTestUpdateOperation extends RemotingCdmUpdateOperation {
26

    
27
    private static String LABEL = "Test Operation";
28

    
29
    private UpdateResult result;
30
    private Exception exception;
31

    
32

    
33
    /**
34
     * @param label
35
     * @param action
36
     * @param source
37
     * @param async
38
     */
39
    public RemotingTestUpdateOperation(UpdateResult result,
40
            Object source,
41
            boolean async) {
42
        super(LABEL, Action.Update, source, async);
43
        this.result = result;
44
    }
45

    
46
    public RemotingTestUpdateOperation(Exception exception,
47
            Object source,
48
            boolean async) {
49
        super(LABEL, Action.Update, source, async);
50
        this.exception = exception;
51
    }
52

    
53
    /* (non-Javadoc)
54
     * @see eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation#doUpdateExecute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
55
     */
56
    @Override
57
    protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception {
58
        ITestService testService = CdmApplicationState.getTestService();
59
        if(result != null) {
60
            return CdmApplicationState.getTestService().returnResult(result);
61
        } else if(throwExceptions) {
62
            return testService.throwException(exception);
63
        }
64
        return null;
65
    }
66

    
67
}
(9-9/9)