Revision f96dae91
Added by Andreas Müller over 11 years ago
app-import/src/main/java/eu/etaxonomy/cdm/io/algaterra/AlgaTerraImageImportBase.java | ||
---|---|---|
17 | 17 |
import java.util.Set; |
18 | 18 |
import java.util.UUID; |
19 | 19 |
|
20 |
import javassist.runtime.Desc; |
|
21 |
|
|
20 | 22 |
import org.apache.commons.lang.StringUtils; |
21 | 23 |
import org.apache.log4j.Logger; |
22 | 24 |
import org.springframework.transaction.TransactionStatus; |
... | ... | |
28 | 30 |
import eu.etaxonomy.cdm.io.common.ResultSetPartitioner; |
29 | 31 |
import eu.etaxonomy.cdm.io.common.Source; |
30 | 32 |
import eu.etaxonomy.cdm.model.agent.Team; |
33 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
|
31 | 34 |
import eu.etaxonomy.cdm.model.common.Language; |
32 | 35 |
import eu.etaxonomy.cdm.model.common.OrderedTermVocabulary; |
33 | 36 |
import eu.etaxonomy.cdm.model.common.TimePeriod; |
34 | 37 |
import eu.etaxonomy.cdm.model.description.DescriptionBase; |
38 |
import eu.etaxonomy.cdm.model.description.DescriptionElementBase; |
|
35 | 39 |
import eu.etaxonomy.cdm.model.description.Feature; |
36 | 40 |
import eu.etaxonomy.cdm.model.description.SpecimenDescription; |
37 | 41 |
import eu.etaxonomy.cdm.model.description.State; |
42 |
import eu.etaxonomy.cdm.model.description.TextData; |
|
38 | 43 |
import eu.etaxonomy.cdm.model.location.NamedArea; |
39 | 44 |
import eu.etaxonomy.cdm.model.location.Point; |
40 | 45 |
import eu.etaxonomy.cdm.model.location.ReferenceSystem; |
... | ... | |
60 | 65 |
|
61 | 66 |
|
62 | 67 |
|
68 |
/** |
|
69 |
* Creates a media object and |
|
70 |
* @param rs |
|
71 |
* @param derivedUnit |
|
72 |
* @param state |
|
73 |
* @param partitioner |
|
74 |
* @return |
|
75 |
* @throws SQLException |
|
76 |
*/ |
|
63 | 77 |
protected Media handleSingleImage(ResultSet rs, SpecimenOrObservationBase derivedUnit, AlgaTerraImportState state, ResultSetPartitioner partitioner) throws SQLException { |
64 | 78 |
try { |
65 | 79 |
String fileName = rs.getString("fileName"); |
66 | 80 |
String figurePhrase = rs.getString("FigurePhrase"); |
81 |
//TODO refFk, refDetailFk, publishFlag |
|
67 | 82 |
Integer refFk = nullSafeInt(rs, "refFk"); |
68 | 83 |
Integer refDetailFk = nullSafeInt(rs, "refDetailFk"); |
69 | 84 |
Boolean publishFlag = rs.getBoolean("RestrictedFlag"); |
... | ... | |
87 | 102 |
//TODO ref |
88 | 103 |
Reference<?> ref = null; |
89 | 104 |
if (derivedUnit != null){ |
90 |
getSpecimenDescription(derivedUnit, ref, IMAGE_GALLERY, CREATE); |
|
105 |
SpecimenDescription desc = getSpecimenDescription(derivedUnit, ref, IMAGE_GALLERY, CREATE); |
|
106 |
TextData textData = null; |
|
107 |
for (DescriptionElementBase descEl : desc.getElements()){ |
|
108 |
if (descEl.isInstanceOf(TextData.class)){ |
|
109 |
textData = CdmBase.deproxy(descEl, TextData.class); |
|
110 |
} |
|
111 |
} |
|
112 |
if (textData == null){ |
|
113 |
textData = TextData.NewInstance(Feature.IMAGE()); |
|
114 |
} |
|
115 |
desc.addElement(textData); |
|
116 |
textData.addMedia(media); |
|
91 | 117 |
}else{ |
92 | 118 |
logger.warn("Derived unit is null. Can't add media "); |
93 | 119 |
} |
Also available in: Unified diff
bugfix for ImageImport AlgaTerra