2 * Copyright (C) 2015 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
9 package eu
.etaxonomy
.taxeditor
.store
.operations
;
11 import org
.eclipse
.core
.runtime
.IAdaptable
;
12 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
14 import eu
.etaxonomy
.cdm
.api
.application
.CdmApplicationState
;
15 import eu
.etaxonomy
.cdm
.api
.application
.CdmChangeEvent
.Action
;
16 import eu
.etaxonomy
.cdm
.api
.service
.ITestService
;
17 import eu
.etaxonomy
.cdm
.api
.service
.UpdateResult
;
18 import eu
.etaxonomy
.cdm
.api
.service
.dto
.CdmEntityIdentifier
;
19 import eu
.etaxonomy
.taxeditor
.operation
.RemotingCdmUpdateOperation
;
26 public class RemotingTestUpdateOperation
extends RemotingCdmUpdateOperation
{
28 private static String LABEL
= "Test Operation";
30 private UpdateResult result
;
31 private Exception exception
;
32 private CdmEntityIdentifier cei
;
41 public RemotingTestUpdateOperation(UpdateResult result
,
44 super(LABEL
, Action
.Update
, source
, async
);
48 public RemotingTestUpdateOperation(Exception exception
,
51 super(LABEL
, Action
.Update
, source
, async
);
52 this.exception
= exception
;
55 public RemotingTestUpdateOperation(CdmEntityIdentifier cei
,
58 super(LABEL
, Action
.Update
, source
, async
);
63 * @see eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation#doUpdateExecute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
66 protected UpdateResult
doUpdateExecute(IProgressMonitor monitor
, IAdaptable info
) throws Exception
{
67 ITestService testService
= CdmApplicationState
.getTestService();
69 return testService
.returnResult(result
);
70 } else if(exception
!= null) {
71 return testService
.throwException(exception
);
72 } else if(cei
!= null) {
73 return testService
.addChild(cei
);