private static final String DETERMINATION_AUTHOR_COLUMN = "(?i)(Author)";
private static final String DETERMINATION_MODIFIER_COLUMN = "(?i)(DeterminationModifier)";
private static final String DETERMINED_BY_COLUMN = "(?i)(DeterminationBy)";
- private static final String DETERMINED_WHEN_COLUMN = "(?i)(DeterminationWhen)";
+ private static final String DETERMINED_WHEN_COLUMN = "(?i)(Det(ermination)?When)";
private static final String DETERMINATION_NOTES_COLUMN = "(?i)(DeterminationNote)";
private static final String EXTENSION_COLUMN = "(?i)(Ext(ension)?)";
}else{
logger.warn("Not yet implemented");
}
-
+ } else if(keyValue.key.matches(LANGUAGE)) {
+ row.setLanguage(value);
} else if(keyValue.key.matches(ACCESSION_NUMBER_COLUMN)) {
- row.setLocality(value);
+ row.setAccessionNumber(value);
} else if(keyValue.key.matches(BARCODE_COLUMN)) {
row.setBarcode(value);
} else if(keyValue.key.matches(UNIT_NOTES_COLUMN)) {
}
DerivedUnitFacade facade = DerivedUnitFacade.NewInstance(type);
+
+ Language lang = Language.DEFAULT();
+ if (StringUtils.isNotBlank(row.getLanguage())){
+ Language langIso = getTermService().getLanguageByIso(row.getLanguage());
+ if (langIso == null){
+ String message = "Language could not be recognized: %s. Use default language instead. Line %d.";
+ message = String.format(message, langIso, state.getCurrentLine());
+ }else{
+ lang = langIso;
+ }
+ }
+
//country
handleCountry(facade, row, state);
handleAreas(facade,row, state);
facade.setLocality(row.getLocality());
facade.setFieldNotes(row.getFieldNotes());
facade.setFieldNumber(row.getCollectorsNumber());
- facade.setEcology(row.getEcology());
- facade.setPlantDescription(row.getPlantDescription());
+ facade.setEcology(row.getEcology(), lang);
+ facade.setPlantDescription(row.getPlantDescription(), lang);
// facade.setSex(row.get)
handleExactLocation(facade, row, state);
facade.setCollector(getOrMakeAgent(state, row.getCollectors()));
facade.setPrimaryCollector(getOrMakePrimaryCollector(facade, row.getPrimaryCollector(), state));
handleAbsoluteElevation(facade, row, state);
-
//derivedUnit
facade.setBarcode(row.getBarcode());
facade.setAccessionNumber(row.getAccessionNumber());
facade.addSource(source);
}
for (SpecimenTypeDesignation designation : row.getTypeDesignations()){
- //FIXME
+ logger.warn("FIXME"); //FIXME
// facade.innerDerivedUnit().addSpecimenTypeDesignation(designation);
}
handleDeterminations(state, row, facade);
Taxon commonTaxon = null;
TaxonNameBase<?,?> commonName = null;
- boolean hasCommonTaxonInfo = commonDetermination == null ? false : commonDetermination.hasTaxonInformation();
+ boolean hasCommonTaxonInfo = (commonDetermination == null) ? false : commonDetermination.hasTaxonInformation();
if (hasCommonTaxonInfo && commonDetermination != null){
TaxonBase<?> taxonBase = null;
if (StringUtils.isNotBlank(commonDetermination.taxonUuid)){
Reference<?> sec = null;
if (StringUtils.isNotBlank(commonDetermination.determinedBy)){
sec = ReferenceFactory.newGeneric();
- TeamOrPersonBase determinedBy;
+ TeamOrPersonBase<?> determinedBy;
BotanicalName dummyName = BotanicalName.NewInstance(Rank.SPECIES());
try {
parser.parseAuthors(dummyName, commonDetermination.determinedBy);
- determinedBy = (TeamOrPersonBase)dummyName.getCombinationAuthorTeam();
+ determinedBy = (TeamOrPersonBase<?>)dummyName.getCombinationAuthorTeam();
} catch (StringNotParsableException e) {
determinedBy = Team.NewTitledInstance(commonDetermination.determinedBy, commonDetermination.determinedBy);
}
- private void setAuthorship(NonViralName name, String author, INonViralNameParser<NonViralName> parser) {
+ private void setAuthorship(NonViralName<?> name, String author, INonViralNameParser<NonViralName> parser) {
if (name.isInstanceOf(BotanicalName.class) || name.isInstanceOf(ZoologicalName.class)){
try {
parser.parseAuthors(name, author);
* @return
*/
private String makeSearchNameTitleCache(SpecimenCdmExcelImportState state, DeterminationLight determinationLight,
- NonViralName name) {
+ NonViralName<?> name) {
String titleCache = determinationLight.fullName;
if (! state.getConfig().isPreferNameCache() || StringUtils.isBlank(titleCache) ){
String computedTitleCache = name.getTitleCache();
* @param determinationLight
* @return
*/
- private NonViralName makeTaxonName(SpecimenCdmExcelImportState state, DeterminationLight determinationLight) {
- //TODO correct type by config.nc
- NonViralName name =NonViralName.NewInstance(null);
+ private NonViralName<?> makeTaxonName(SpecimenCdmExcelImportState state, DeterminationLight determinationLight) {
+ NonViralName<?> name = NonViralName.NewInstance(null);
+ NomenclaturalCode nc = state.getConfig().getNomenclaturalCode();
+ if (nc != null){
+ name = (NonViralName<?>)nc.getNewTaxonNameInstance(null);
+ }
name.setGenusOrUninomial(determinationLight.genus);
name.setSpecificEpithet(determinationLight.speciesEpi);
name.setInfraSpecificEpithet(determinationLight.infraSpeciesEpi);
if (StringUtils.isNotBlank(determinationLight.author)){
authors.add(determinationLight.author);
}
- TeamOrPersonBase agent = (TeamOrPersonBase)getOrMakeAgent(state, authors);
+ TeamOrPersonBase<?> agent = (TeamOrPersonBase)getOrMakeAgent(state, authors);
name.setCombinationAuthorTeam(agent);
- NomenclaturalCode nc = state.getConfig().getNomenclaturalCode();
try {
if (StringUtils.isNotBlank(determinationLight.rank) ){
name.setRank(Rank.getRankByNameOrIdInVoc(determinationLight.rank, nc, true));
private TaxonNameBase findBestMatchingName(SpecimenCdmExcelImportState state, DeterminationLight determinationLight) {
- NonViralName name = makeTaxonName(state, determinationLight);
+ NonViralName<?> name = makeTaxonName(state, determinationLight);
String titleCache = makeSearchNameTitleCache(state, determinationLight, name);
//TODO
}
TeamOrPersonBase<?> actor = getOrMakeAgent(state, authors);
TeamOrPersonBase<?> secAuthor = taxon.getSec() == null ? null : taxon.getSec().getAuthorTeam();
- if (actor != null && secAuthor != null & secAuthor.getTitleCache().equals(actor.getTitleCache()) && secAuthor.getNomenclaturalTitle().equals(actor.getNomenclaturalTitle())) {
+ if (actor != null && secAuthor != null && secAuthor.getTitleCache().equals(actor.getTitleCache()) && secAuthor.getNomenclaturalTitle().equals(actor.getNomenclaturalTitle())) {
actor = secAuthor;
}
try {
refSys = state.getTransformer().getReferenceSystemByKey(strRefSys);
if (refSys == null){
+ //TODO we still need user defined Reference Systems here
refUuid = state.getTransformer().getReferenceSystemUuid(strRefSys);
if (refUuid == null){
String message = "Unknown reference system %s in line %d";