Revision 8081ee07
Added by Katja Luther about 6 years ago
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/operation/config/SecundumForSubtreeConfigurator.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2017 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
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. |
|
8 |
*/ |
|
9 |
package eu.etaxonomy.cdm.io.operation.config; |
|
10 |
|
|
11 |
import java.util.UUID; |
|
12 |
|
|
13 |
import eu.etaxonomy.cdm.common.monitor.IProgressMonitor; |
|
14 |
import eu.etaxonomy.cdm.io.common.IImportConfigurator; |
|
15 |
import eu.etaxonomy.cdm.io.operation.SecundumForSubtreeUpdater; |
|
16 |
import eu.etaxonomy.cdm.model.reference.Reference; |
|
17 |
|
|
18 |
/** |
|
19 |
* Configurator for the setSecundumForSubtree operation. |
|
20 |
* |
|
21 |
* @author a.mueller |
|
22 |
* @date 06.01.2017 |
|
23 |
* |
|
24 |
*/ |
|
25 |
public class SecundumForSubtreeConfigurator |
|
26 |
extends ForSubtreeConfiguratorBase<SecundumForSubtreeConfigurator> |
|
27 |
implements IImportConfigurator{ |
|
28 |
|
|
29 |
private static final long serialVersionUID = 1202667588493272030L; |
|
30 |
|
|
31 |
private Reference newSecundum; |
|
32 |
private boolean emptySecundumDetail = true; |
|
33 |
private boolean overwriteExistingAccepted = true; |
|
34 |
private boolean overwriteExistingSynonyms = true; |
|
35 |
|
|
36 |
|
|
37 |
/** |
|
38 |
* @param subtreeUuid |
|
39 |
* @param newSecundum |
|
40 |
*/ |
|
41 |
public SecundumForSubtreeConfigurator(UUID subtreeUuid, Reference newSecundum, IProgressMonitor monitor) { |
|
42 |
super(subtreeUuid, monitor); |
|
43 |
this.newSecundum = newSecundum; |
|
44 |
} |
|
45 |
|
|
46 |
/** |
|
47 |
* @param subtreeUuid |
|
48 |
* @param newSecundum |
|
49 |
*/ |
|
50 |
public SecundumForSubtreeConfigurator(UUID subtreeUuid) { |
|
51 |
super(subtreeUuid); |
|
52 |
// this.newSecundum = newSecundum; |
|
53 |
} |
|
54 |
|
|
55 |
public Reference getNewSecundum() { |
|
56 |
return newSecundum; |
|
57 |
} |
|
58 |
public void setNewSecundum(Reference newSecundum) { |
|
59 |
this.newSecundum = newSecundum; |
|
60 |
} |
|
61 |
|
|
62 |
public boolean isEmptySecundumDetail() { |
|
63 |
return emptySecundumDetail; |
|
64 |
} |
|
65 |
public void setEmptySecundumDetail(boolean emptySecundumDetail) { |
|
66 |
this.emptySecundumDetail = emptySecundumDetail; |
|
67 |
} |
|
68 |
|
|
69 |
|
|
70 |
public boolean isOverwriteExistingAccepted() { |
|
71 |
return overwriteExistingAccepted; |
|
72 |
} |
|
73 |
public void setOverwriteExistingAccepted(boolean overwriteExistingAccepted) { |
|
74 |
this.overwriteExistingAccepted = overwriteExistingAccepted; |
|
75 |
} |
|
76 |
|
|
77 |
public boolean isOverwriteExistingSynonyms() { |
|
78 |
return overwriteExistingSynonyms; |
|
79 |
} |
|
80 |
public void setOverwriteExistingSynonyms(boolean overwriteExistingSynonyms) { |
|
81 |
this.overwriteExistingSynonyms = overwriteExistingSynonyms; |
|
82 |
} |
|
83 |
|
|
84 |
/** |
|
85 |
* {@inheritDoc} |
|
86 |
*/ |
|
87 |
@Override |
|
88 |
protected void makeIoClassList() { |
|
89 |
ioClassList = new Class[]{ |
|
90 |
SecundumForSubtreeUpdater.class |
|
91 |
}; |
|
92 |
|
|
93 |
} |
|
94 |
|
|
95 |
} |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/operation/config/SecundumForSubtreeConfigurator_.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2017 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
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. |
|
8 |
*/ |
|
9 |
package eu.etaxonomy.cdm.io.operation.config; |
|
10 |
|
|
11 |
import java.util.UUID; |
|
12 |
|
|
13 |
import eu.etaxonomy.cdm.common.monitor.IProgressMonitor; |
|
14 |
import eu.etaxonomy.cdm.io.common.IImportConfigurator; |
|
15 |
import eu.etaxonomy.cdm.io.operation.SecundumForSubtreeUpdater; |
|
16 |
import eu.etaxonomy.cdm.model.reference.Reference; |
|
17 |
|
|
18 |
/** |
|
19 |
* Configurator for the setSecundumForSubtree operation. |
|
20 |
* |
|
21 |
* @author a.mueller |
|
22 |
* @date 06.01.2017 |
|
23 |
* |
|
24 |
*/ |
|
25 |
public class SecundumForSubtreeConfigurator |
|
26 |
extends ForSubtreeConfiguratorBase<SecundumForSubtreeConfigurator> |
|
27 |
implements IImportConfigurator{ |
|
28 |
|
|
29 |
private static final long serialVersionUID = 1202667588493272030L; |
|
30 |
|
|
31 |
private Reference newSecundum; |
|
32 |
private boolean emptySecundumDetail = true; |
|
33 |
private boolean overwriteExistingAccepted = true; |
|
34 |
private boolean overwriteExistingSynonyms = true; |
|
35 |
|
|
36 |
|
|
37 |
/** |
|
38 |
* @param subtreeUuid |
|
39 |
* @param newSecundum |
|
40 |
*/ |
|
41 |
public SecundumForSubtreeConfigurator(UUID subtreeUuid, Reference newSecundum, IProgressMonitor monitor) { |
|
42 |
super(subtreeUuid, monitor); |
|
43 |
this.newSecundum = newSecundum; |
|
44 |
} |
|
45 |
|
|
46 |
/** |
|
47 |
* @param subtreeUuid |
|
48 |
* @param newSecundum |
|
49 |
*/ |
|
50 |
public SecundumForSubtreeConfigurator(UUID subtreeUuid) { |
|
51 |
super(subtreeUuid); |
|
52 |
// this.newSecundum = newSecundum; |
|
53 |
} |
|
54 |
|
|
55 |
public Reference getNewSecundum() { |
|
56 |
return newSecundum; |
|
57 |
} |
|
58 |
public void setNewSecundum(Reference newSecundum) { |
|
59 |
this.newSecundum = newSecundum; |
|
60 |
} |
|
61 |
|
|
62 |
public boolean isEmptySecundumDetail() { |
|
63 |
return emptySecundumDetail; |
|
64 |
} |
|
65 |
public void setEmptySecundumDetail(boolean emptySecundumDetail) { |
|
66 |
this.emptySecundumDetail = emptySecundumDetail; |
|
67 |
} |
|
68 |
|
|
69 |
|
|
70 |
public boolean isOverwriteExistingAccepted() { |
|
71 |
return overwriteExistingAccepted; |
|
72 |
} |
|
73 |
public void setOverwriteExistingAccepted(boolean overwriteExistingAccepted) { |
|
74 |
this.overwriteExistingAccepted = overwriteExistingAccepted; |
|
75 |
} |
|
76 |
|
|
77 |
public boolean isOverwriteExistingSynonyms() { |
|
78 |
return overwriteExistingSynonyms; |
|
79 |
} |
|
80 |
public void setOverwriteExistingSynonyms(boolean overwriteExistingSynonyms) { |
|
81 |
this.overwriteExistingSynonyms = overwriteExistingSynonyms; |
|
82 |
} |
|
83 |
|
|
84 |
/** |
|
85 |
* {@inheritDoc} |
|
86 |
*/ |
|
87 |
@Override |
|
88 |
protected void makeIoClassList() { |
|
89 |
ioClassList = new Class[]{ |
|
90 |
SecundumForSubtreeUpdater.class |
|
91 |
}; |
|
92 |
|
|
93 |
} |
|
94 |
|
|
95 |
} |
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/MediaServiceImpl.java | ||
---|---|---|
250 | 250 |
continue; |
251 | 251 |
} else{ |
252 | 252 |
message = "The media can't be deleted from the database because it is referenced by another taxon. ("+desc.getTaxon().getTitleCache()+")"; |
253 |
result.setAbort(); |
|
253 | 254 |
} |
254 | 255 |
|
255 | 256 |
} else if (description instanceof SpecimenDescription){ |
... | ... | |
258 | 259 |
continue; |
259 | 260 |
} else{ |
260 | 261 |
message = "The media can't be deleted from the database because it is referenced by another specimen or observation. ("+desc.getDescribedSpecimenOrObservation().getTitleCache()+")"; |
262 |
result.setAbort(); |
|
261 | 263 |
} |
262 | 264 |
} else if (description instanceof TaxonNameDescription){ |
263 | 265 |
TaxonNameDescription desc = HibernateProxyHelper.deproxy(description, TaxonNameDescription.class); |
... | ... | |
265 | 267 |
continue; |
266 | 268 |
} else{ |
267 | 269 |
message = "The media can't be deleted from the database because it is referenced by another specimen or observation. ("+desc.getDescribedSpecimenOrObservation().getTitleCache()+")"; |
270 |
result.setAbort(); |
|
268 | 271 |
} |
269 | 272 |
} |
270 | 273 |
} |
Also available in: Unified diff
ref #6730: set result to Abort if media is used elsewhere