Revision aceb7b1d
Added by Cherian Mathew about 9 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/presenter/StatusPresenter.java | ||
---|---|---|
10 | 10 |
package eu.etaxonomy.cdm.vaadin.presenter; |
11 | 11 |
|
12 | 12 |
import java.sql.SQLException; |
13 |
import java.util.UUID; |
|
13 | 14 |
|
14 | 15 |
import com.vaadin.data.util.sqlcontainer.query.generator.filter.QueryBuilder; |
15 | 16 |
|
17 |
import eu.etaxonomy.cdm.api.service.ITaxonService; |
|
18 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
|
19 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
|
16 | 20 |
import eu.etaxonomy.cdm.vaadin.container.CdmSQLContainer; |
17 | 21 |
import eu.etaxonomy.cdm.vaadin.container.LeafNodeTaxonContainer; |
18 | 22 |
import eu.etaxonomy.cdm.vaadin.util.CdmSQLStringDecorator; |
23 |
import eu.etaxonomy.cdm.vaadin.util.CdmSpringContextHelper; |
|
19 | 24 |
import eu.etaxonomy.cdm.vaadin.view.IStatusComposite; |
20 | 25 |
import eu.etaxonomy.cdm.vaadin.view.IStatusComposite.StatusComponentListener; |
21 | 26 |
|
... | ... | |
30 | 35 |
|
31 | 36 |
private LeafNodeTaxonContainer container; |
32 | 37 |
|
33 |
|
|
38 |
private ITaxonService taxonService; |
|
34 | 39 |
|
35 | 40 |
private int totalNoOfTaxa = 0; |
36 | 41 |
|
... | ... | |
40 | 45 |
// TODO: Need to evaluate the various sql dialects and make sure that these |
41 | 46 |
// queries are compatible with all |
42 | 47 |
QueryBuilder.setStringDecorator(new CdmSQLStringDecorator()); |
48 |
|
|
49 |
initServices(); |
|
43 | 50 |
} |
44 | 51 |
|
52 |
private void initServices() { |
|
53 |
taxonService = CdmSpringContextHelper.getTaxonService(); |
|
54 |
} |
|
45 | 55 |
|
46 | 56 |
@Override |
47 | 57 |
public void removeFilters() { |
... | ... | |
119 | 129 |
} |
120 | 130 |
|
121 | 131 |
|
132 |
@Override |
|
133 |
public void updatePublished(boolean pb, Object itemId) { |
|
134 |
UUID uuid = UUID.fromString((String)container.getItem(itemId).getItemProperty(LeafNodeTaxonContainer.UUID_ID).getValue()); |
|
135 |
Taxon taxon = CdmBase.deproxy(taxonService.load(uuid), Taxon.class); |
|
136 |
boolean currentPb = taxon.isPublish(); |
|
137 |
if(currentPb != pb) { |
|
138 |
taxon.setPublish(pb); |
|
139 |
taxonService.merge(taxon); |
|
140 |
} |
|
141 |
} |
|
142 |
|
|
143 |
|
|
122 | 144 |
} |
Also available in: Unified diff
StatusPresenter : added method to update taxon published flag
CdmSpringContextHelper : added method to get taxon service
CdmQueryFactory, LeafNodeTaxonContainer : added uuid to taxon query select
StatusComposite, IStatusComposite : using new taxon published flag update method
styles.css : reverting back custom changes, will use the new edit theme instead