2 * Copyright (C) 2017 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.cdm
.io
.cdmLight
;
12 import java
.util
.HashMap
;
15 import eu
.etaxonomy
.cdm
.io
.common
.ExportResult
;
16 import eu
.etaxonomy
.cdm
.io
.common
.ExportResult
.ExportResultState
;
17 import eu
.etaxonomy
.cdm
.io
.common
.ExportStateBase
;
18 import eu
.etaxonomy
.cdm
.io
.common
.mapping
.out
.IExportTransformer
;
19 import eu
.etaxonomy
.cdm
.model
.agent
.TeamOrPersonBase
;
20 import eu
.etaxonomy
.cdm
.model
.name
.HomotypicalGroup
;
21 import eu
.etaxonomy
.cdm
.model
.occurrence
.SpecimenOrObservationBase
;
22 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
23 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
30 public class CdmLightExportState
31 extends ExportStateBase
<CdmLightExportConfigurator
, IExportTransformer
, File
>{
33 private ExportResult result
;
35 private CdmLightExportResultProcessor processor
= new CdmLightExportResultProcessor(this);
37 private TaxonBase
<?
> actualTaxonBase
;
39 private Map
<Integer
, HomotypicalGroup
> homotypicalGroupStore
= new HashMap
<>();
40 private Map
<Integer
, TeamOrPersonBase
<?
>> authorStore
= new HashMap
<>();
41 private Map
<Integer
, SpecimenOrObservationBase
> specimenStore
= new HashMap
<>();
42 private Map
<Integer
, Reference
> referenceStore
= new HashMap
<>();
47 protected CdmLightExportState(CdmLightExportConfigurator config
) {
49 result
= ExportResult
.NewInstance(config
.getResultType());
56 public ExportResult
getResult() {
61 * @param result the result to set
64 public void setResult(ExportResult result
) {
71 public void setEmptyData() {
72 this.result
.setState(ExportResultState
.SUCCESS_BUT_NO_DATA
);
76 * @return the processor
78 public CdmLightExportResultProcessor
getProcessor() {
82 public void setActualTaxonBase(TaxonBase
<?
> actualTaxonBase
){
83 this.actualTaxonBase
= actualTaxonBase
;
86 public TaxonBase
<?
> getActualTaxonBase() {
87 return actualTaxonBase
;
91 * @return the homotypicalGroupStore
93 public Map
<Integer
, HomotypicalGroup
> getHomotypicalGroupStore() {
94 return homotypicalGroupStore
;
98 * @param homotypicalGroupStore the homotypicalGroupStore to set
100 public void addHomotypicalGroupToStore(HomotypicalGroup homotypicalGroup
) {
101 this.homotypicalGroupStore
.put(homotypicalGroup
.getId(), homotypicalGroup
);
104 public HomotypicalGroup
getHomotypicalGroupFromStore(Integer id
){
105 return homotypicalGroupStore
.get(id
);
109 * @return the homotypicalGroupStore
111 public Map
<Integer
, TeamOrPersonBase
<?
>> getAuthorStore() {
116 * @param homotypicalGroupStore the homotypicalGroupStore to set
118 public void addAuthorToStore(TeamOrPersonBase
<?
> author
) {
119 this.authorStore
.put(author
.getId(), author
);
122 public TeamOrPersonBase
<?
> getAuthorFromStore(Integer id
){
123 return authorStore
.get(id
);
127 public void addSpecimenToStore(SpecimenOrObservationBase specimen
) {
128 this.specimenStore
.put(specimen
.getId(), specimen
);
133 public SpecimenOrObservationBase
getSpecimenFromStore(Integer id
){
134 return specimenStore
.get(id
);
137 public Reference
getReferenceFromStore(Integer id
){
138 return referenceStore
.get(id
);
140 public void addReferenceToStore(Reference ref
) {
141 this.referenceStore
.put(ref
.getId(), ref
);