3 * Copyright (C) 2015 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.cdm
.api
.service
;
12 import org
.springframework
.beans
.factory
.annotation
.Autowired
;
13 import org
.springframework
.stereotype
.Service
;
14 import org
.springframework
.transaction
.annotation
.Transactional
;
16 import eu
.etaxonomy
.cdm
.api
.service
.UpdateResult
.Status
;
17 import eu
.etaxonomy
.cdm
.api
.service
.dto
.CdmEntityIdentifier
;
18 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
19 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
27 public class TestServiceImpl
implements ITestService
{
30 ITaxonNodeService taxonNodeService
;
33 * @see eu.etaxonomy.cdm.api.service.ITestService#wait(int)
36 public void waitFor(long timeToWaitInMs
) throws InterruptedException
{
37 Thread
.sleep(timeToWaitInMs
);
41 * @see eu.etaxonomy.cdm.api.service.ITestService#returnResult(eu.etaxonomy.cdm.api.service.UpdateResult)
44 public UpdateResult
returnResult(UpdateResult result
) {
49 * @see eu.etaxonomy.cdm.api.service.ITestService#throwException(java.lang.Exception)
52 public UpdateResult
throwException(Exception ex
) {
53 throw new RuntimeException(ex
);
57 * @see eu.etaxonomy.cdm.api.service.ITestService#addChild(eu.etaxonomy.cdm.api.service.dto.CdmEntityIdentifier)
60 @Transactional(readOnly
= false)
61 public UpdateResult
addChild(CdmEntityIdentifier taxonNodeCei
) {
62 TaxonNode taxonNode
= taxonNodeService
.find(taxonNodeCei
.getId());
63 taxonNode
.addChildTaxon(Taxon
.NewInstance(null, null), null, null);
64 taxonNodeService
.merge(taxonNode
);
65 UpdateResult result
= new UpdateResult();
66 result
.addUpdatedCdmId(taxonNodeCei
);
67 result
.setStatus(Status
.OK
);