1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2009 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.cdm.api.service;
|
11
|
|
12
|
import java.util.ArrayList;
|
13
|
import java.util.HashSet;
|
14
|
import java.util.List;
|
15
|
import java.util.Set;
|
16
|
|
17
|
import org.apache.log4j.Logger;
|
18
|
|
19
|
import eu.etaxonomy.cdm.model.common.CdmBase;
|
20
|
|
21
|
/**
|
22
|
* This class represents the result of a delete action.
|
23
|
*
|
24
|
* @author a.mueller
|
25
|
* @date 04.01.2012
|
26
|
*
|
27
|
*/
|
28
|
public class DeleteResult extends UpdateResult{
|
29
|
|
30
|
@SuppressWarnings("unused")
|
31
|
private static final Logger logger = Logger.getLogger(DeleteResult.class);
|
32
|
|
33
|
|
34
|
|
35
|
private final List<Exception> exceptions = new ArrayList<Exception>();
|
36
|
|
37
|
private final Set<CdmBase> relatedObjects = new HashSet<CdmBase>();
|
38
|
|
39
|
// private Set<PersistPair> objectsToDelete = new HashSet<PersistPair>();
|
40
|
//
|
41
|
// private Set<PersistPair> objectsToSave = new HashSet<DeleteResult.PersistPair>();
|
42
|
|
43
|
// protected class PersistPair{
|
44
|
// protected CdmBase objectToPersist;
|
45
|
// protected ICdmEntityDao<CdmBase> dao;
|
46
|
// }
|
47
|
|
48
|
|
49
|
|
50
|
//***************************** GETTER /SETTER /ADDER *************************/
|
51
|
|
52
|
|
53
|
|
54
|
/**
|
55
|
* Related objects that prevent the delete action to take place.
|
56
|
* @return
|
57
|
*/
|
58
|
public Set<CdmBase> getRelatedObjects() {
|
59
|
return relatedObjects;
|
60
|
}
|
61
|
public void addRelatedObject(CdmBase relatedObject) {
|
62
|
this.relatedObjects.add(relatedObject);
|
63
|
}
|
64
|
public void addRelatedObjects(Set<? extends CdmBase> relatedObjects) {
|
65
|
this.relatedObjects.addAll(relatedObjects);
|
66
|
}
|
67
|
|
68
|
|
69
|
|
70
|
|
71
|
|
72
|
|
73
|
|
74
|
|
75
|
|
76
|
|
77
|
|
78
|
|
79
|
|
80
|
|
81
|
}
|