Revision c10b24e0
Added by Katja Luther about 6 years ago
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/operation/SecundumForSubtreeUpdater.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; |
|
10 |
|
|
11 |
import org.apache.log4j.Logger; |
|
12 |
import org.springframework.beans.BeansException; |
|
13 |
import org.springframework.context.ApplicationContext; |
|
14 |
import org.springframework.stereotype.Component; |
|
15 |
|
|
16 |
import eu.etaxonomy.cdm.api.service.UpdateResult; |
|
17 |
import eu.etaxonomy.cdm.io.common.CdmImportBase; |
|
18 |
import eu.etaxonomy.cdm.io.common.DefaultImportState; |
|
19 |
import eu.etaxonomy.cdm.io.operation.config.SecundumForSubtreeConfigurator; |
|
20 |
|
|
21 |
/** |
|
22 |
* @author k.luther |
|
23 |
* @date 14.03.2017 |
|
24 |
* |
|
25 |
*/ |
|
26 |
@Component |
|
27 |
public class SecundumForSubtreeUpdater extends CdmImportBase<SecundumForSubtreeConfigurator, DefaultImportState<SecundumForSubtreeConfigurator>> { |
|
28 |
|
|
29 |
private static final long serialVersionUID = 6788425152444747546L; |
|
30 |
|
|
31 |
@SuppressWarnings("unused") |
|
32 |
private static final Logger logger = Logger.getLogger(SecundumForSubtreeUpdater.class); |
|
33 |
|
|
34 |
|
|
35 |
/** |
|
36 |
* {@inheritDoc} |
|
37 |
*/ |
|
38 |
@Override |
|
39 |
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { |
|
40 |
this.applicationContext = applicationContext; |
|
41 |
|
|
42 |
} |
|
43 |
/** |
|
44 |
* {@inheritDoc} |
|
45 |
*/ |
|
46 |
@Override |
|
47 |
protected void doInvoke(DefaultImportState<SecundumForSubtreeConfigurator> state) { |
|
48 |
SecundumForSubtreeConfigurator config = state.getConfig(); |
|
49 |
state.getConfig().getProgressMonitor().beginTask("Update Secundum References ", 100); |
|
50 |
|
|
51 |
UpdateResult result = getTaxonNodeService().setSecundumForSubtree(config.getSubtreeUuid(), config.getNewSecundum(), config.isIncludeAcceptedTaxa(), config.isIncludeSynonyms(), config.isOverwriteExistingAccepted(), config.isOverwriteExistingSynonyms(), config.isIncludeSharedTaxa(), config.isEmptySecundumDetail(), config.getProgressMonitor()); |
|
52 |
|
|
53 |
return; |
|
54 |
|
|
55 |
} |
|
56 |
|
|
57 |
/** |
|
58 |
* {@inheritDoc} |
|
59 |
*/ |
|
60 |
@Override |
|
61 |
protected boolean doCheck(DefaultImportState<SecundumForSubtreeConfigurator> state) { |
|
62 |
return true; |
|
63 |
} |
|
64 |
/** |
|
65 |
* {@inheritDoc} |
|
66 |
*/ |
|
67 |
@Override |
|
68 |
protected boolean isIgnore(DefaultImportState<SecundumForSubtreeConfigurator> state) { |
|
69 |
return false; |
|
70 |
} |
|
71 |
|
|
72 |
} |
|
73 |
|
|
74 |
|
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/config/SetSecundumForSubtreeConfigurator.java | ||
---|---|---|
1 |
package eu.etaxonomy.cdm.api.service.config; |
|
2 |
|
|
3 |
import java.io.Serializable; |
|
4 |
|
|
5 |
/** |
|
6 |
* Copyright (C) 2017 EDIT |
|
7 |
* European Distributed Institute of Taxonomy |
|
8 |
* http://www.e-taxonomy.eu |
|
9 |
* |
|
10 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
11 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
12 |
*/ |
|
13 |
|
|
14 |
|
|
15 |
import java.util.UUID; |
|
16 |
|
|
17 |
import eu.etaxonomy.cdm.common.monitor.IRemotingProgressMonitor; |
|
18 |
import eu.etaxonomy.cdm.model.reference.Reference; |
|
19 |
|
|
20 |
/** |
|
21 |
* Configurator for the setSecundumForSubtree operation. |
|
22 |
* |
|
23 |
* @author a.mueller |
|
24 |
* @date 06.01.2017 |
|
25 |
* |
|
26 |
*/ |
|
27 |
public class SetSecundumForSubtreeConfigurator implements Serializable{ |
|
28 |
private UUID subtreeUuid; |
|
29 |
private Reference newSecundum; |
|
30 |
private boolean includeAcceptedTaxa = true; |
|
31 |
private boolean includeSynonyms = true; |
|
32 |
private boolean overwriteExistingAccepted = true; |
|
33 |
private boolean overwriteExistingSynonyms = true; |
|
34 |
private boolean emptySecundumDetail = true; |
|
35 |
private boolean includeSharedTaxa = true; |
|
36 |
private IRemotingProgressMonitor monitor; |
|
37 |
|
|
38 |
/** |
|
39 |
* @param monitor the monitor to set |
|
40 |
*/ |
|
41 |
public void setMonitor(IRemotingProgressMonitor monitor) { |
|
42 |
this.monitor = monitor; |
|
43 |
} |
|
44 |
|
|
45 |
/** |
|
46 |
* @param subtreeUuid |
|
47 |
* @param newSecundum |
|
48 |
*/ |
|
49 |
public SetSecundumForSubtreeConfigurator(UUID subtreeUuid, Reference newSecundum, IRemotingProgressMonitor monitor) { |
|
50 |
this.subtreeUuid = subtreeUuid; |
|
51 |
this.newSecundum = newSecundum; |
|
52 |
this.monitor = monitor; |
|
53 |
} |
|
54 |
|
|
55 |
/** |
|
56 |
* @param subtreeUuid |
|
57 |
* @param newSecundum |
|
58 |
*/ |
|
59 |
public SetSecundumForSubtreeConfigurator(UUID subtreeUuid) { |
|
60 |
this.subtreeUuid = subtreeUuid; |
|
61 |
// this.newSecundum = newSecundum; |
|
62 |
} |
|
63 |
|
|
64 |
/** |
|
65 |
* @return the subtreeUuid |
|
66 |
*/ |
|
67 |
public UUID getSubtreeUuid() { |
|
68 |
return subtreeUuid; |
|
69 |
} |
|
70 |
|
|
71 |
/** |
|
72 |
* @param subtreeUuid |
|
73 |
* the subtreeUuid to set |
|
74 |
*/ |
|
75 |
public void setSubtreeUuid(UUID subtreeUuid) { |
|
76 |
this.subtreeUuid = subtreeUuid; |
|
77 |
} |
|
78 |
|
|
79 |
/** |
|
80 |
* @return the newSecundum |
|
81 |
*/ |
|
82 |
public Reference getNewSecundum() { |
|
83 |
return newSecundum; |
|
84 |
} |
|
85 |
|
|
86 |
/** |
|
87 |
* @param newSecundum |
|
88 |
* the newSecundum to set |
|
89 |
*/ |
|
90 |
public void setNewSecundum(Reference newSecundum) { |
|
91 |
this.newSecundum = newSecundum; |
|
92 |
} |
|
93 |
|
|
94 |
/** |
|
95 |
* @return the overrideExisting |
|
96 |
*/ |
|
97 |
public boolean isOverwriteExistingAccepted() { |
|
98 |
return overwriteExistingAccepted; |
|
99 |
} |
|
100 |
|
|
101 |
/** |
|
102 |
* @param overrideExisting |
|
103 |
* the overrideExisting to set |
|
104 |
*/ |
|
105 |
public void setOverwriteExistingAccepted(boolean overwriteExistingAccepted) { |
|
106 |
this.overwriteExistingAccepted = overwriteExistingAccepted; |
|
107 |
} |
|
108 |
|
|
109 |
/** |
|
110 |
* @return the overrideExisting |
|
111 |
*/ |
|
112 |
public boolean isOverwriteExistingSynonyms() { |
|
113 |
return overwriteExistingSynonyms; |
|
114 |
} |
|
115 |
|
|
116 |
/** |
|
117 |
* @param overrideExisting |
|
118 |
* the overrideExisting to set |
|
119 |
*/ |
|
120 |
public void setOverwriteExistingSynonyms(boolean overwriteExistingSynonyms) { |
|
121 |
this.overwriteExistingSynonyms = overwriteExistingSynonyms; |
|
122 |
} |
|
123 |
|
|
124 |
/** |
|
125 |
* @return the emptySecundumDetail |
|
126 |
*/ |
|
127 |
public boolean isEmptySecundumDetail() { |
|
128 |
return emptySecundumDetail; |
|
129 |
} |
|
130 |
|
|
131 |
/** |
|
132 |
* @param emptySecundumDetail |
|
133 |
* the emptySecundumDetail to set |
|
134 |
*/ |
|
135 |
public void setEmptySecundumDetail(boolean emptySecundumDetail) { |
|
136 |
this.emptySecundumDetail = emptySecundumDetail; |
|
137 |
} |
|
138 |
|
|
139 |
/** |
|
140 |
* @return the includeSynonyms |
|
141 |
*/ |
|
142 |
public boolean isIncludeSynonyms() { |
|
143 |
return includeSynonyms; |
|
144 |
} |
|
145 |
|
|
146 |
/** |
|
147 |
* @param includeSynonyms |
|
148 |
* the includeSynonyms to set |
|
149 |
*/ |
|
150 |
public void setIncludeSynonyms(boolean includeSynonyms) { |
|
151 |
this.includeSynonyms = includeSynonyms; |
|
152 |
} |
|
153 |
|
|
154 |
/** |
|
155 |
* @return the includeAcceptedTaxa |
|
156 |
*/ |
|
157 |
public boolean isIncludeAcceptedTaxa() { |
|
158 |
return includeAcceptedTaxa; |
|
159 |
} |
|
160 |
|
|
161 |
/** |
|
162 |
* @param includeAcceptedTaxa |
|
163 |
* the includeAcceptedTaxa to set |
|
164 |
*/ |
|
165 |
public void setIncludeAcceptedTaxa(boolean includeAcceptedTaxa) { |
|
166 |
this.includeAcceptedTaxa = includeAcceptedTaxa; |
|
167 |
} |
|
168 |
|
|
169 |
/** |
|
170 |
* @return the includeSharedTaxa |
|
171 |
*/ |
|
172 |
public boolean isIncludeSharedTaxa() { |
|
173 |
return includeSharedTaxa; |
|
174 |
} |
|
175 |
|
|
176 |
/** |
|
177 |
* @param includeSharedTaxa |
|
178 |
* the includeSharedTaxa to set |
|
179 |
*/ |
|
180 |
public void setIncludeSharedTaxa(boolean includeSharedTaxa) { |
|
181 |
this.includeSharedTaxa = includeSharedTaxa; |
|
182 |
} |
|
183 |
|
|
184 |
/** |
|
185 |
* @return |
|
186 |
*/ |
|
187 |
public IRemotingProgressMonitor getMonitor() { |
|
188 |
|
|
189 |
return monitor; |
|
190 |
} |
|
191 |
|
|
192 |
} |
Also available in: Unified diff
remove setSecundum in io package