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.vaadin.util;
|
10
|
|
11
|
import java.util.List;
|
12
|
import java.util.UUID;
|
13
|
|
14
|
import org.vaadin.addons.lazyquerycontainer.Query;
|
15
|
import org.vaadin.addons.lazyquerycontainer.QueryDefinition;
|
16
|
import org.vaadin.addons.lazyquerycontainer.QueryFactory;
|
17
|
|
18
|
import eu.etaxonomy.cdm.api.application.CdmRepository;
|
19
|
import eu.etaxonomy.cdm.model.location.NamedArea;
|
20
|
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
|
21
|
|
22
|
/**
|
23
|
* The {@link QueryFactory} to generate {@link DistributionStatusQuery}.
|
24
|
* @author freimeier
|
25
|
* @since 16.11.2017
|
26
|
*/
|
27
|
public class DistributionStatusQueryFactory implements QueryFactory{
|
28
|
CdmRepository repo;
|
29
|
List<UUID> nodeUuids;
|
30
|
List<NamedArea> namedAreas;
|
31
|
|
32
|
/**
|
33
|
* Creates a new DistributionStatusQueryFactory which generates {@link DistributionStatusQuery}
|
34
|
* which return distribution status information found in the specified {@link CdmRepository}
|
35
|
* for the {@link TaxonNode}s given by {@code nodeUuids} and the specified {@link NamedArea}s.
|
36
|
* @param repo The repo to search for information.
|
37
|
* @param nodeUuids The {@link UUID}s of {@link TaxonNode}s to search information for.
|
38
|
* @param namedAreas The list of {@link NamedArea}s the distribution information should be related to.
|
39
|
*/
|
40
|
public DistributionStatusQueryFactory(CdmRepository repo, List<UUID> nodeUuids, List<NamedArea> namedAreas) {
|
41
|
this.repo = repo;
|
42
|
this.nodeUuids = nodeUuids;
|
43
|
this.namedAreas = namedAreas;
|
44
|
}
|
45
|
|
46
|
/**
|
47
|
*
|
48
|
* {@inheritDoc}
|
49
|
*/
|
50
|
@Override
|
51
|
public Query constructQuery(QueryDefinition definition) {
|
52
|
return new DistributionStatusQuery(this.repo, this.nodeUuids, this.namedAreas, definition);
|
53
|
}
|
54
|
}
|