import eu.etaxonomy.cdm.model.description.TextData;
import eu.etaxonomy.cdm.model.name.BacterialName;
import eu.etaxonomy.cdm.model.name.BotanicalName;
+import eu.etaxonomy.cdm.model.name.INonViralName;
+import eu.etaxonomy.cdm.model.name.ITaxonNameBase;
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;
boolean parseNameManually=false;
INonViralNameParser<?> parser = NonViralNameParserImpl.NewInstance();
- TaxonNameBase<?,?> nameToBeFilledTest ;
+ ITaxonNameBase nameToBeFilledTest ;
//if selected the atomised version
if(newName==atomisedNameStr){
nameToBeFilledTest = parseWithExtension(parser, atomisedNameStr, rank, followingText, atomisedMap);
if (nameToBeFilledTest.hasProblem()){
addProblemNameToFile("ato",atomisedNameStr,nomenclaturalCode,rank, nameToBeFilledTest.getParsingProblems().toString());
- nameToBeFilledTest = parser.parseFullName(fullName, nomenclaturalCode,rank);
+ nameToBeFilledTest = parser.parseFullName(fullName, nomenclaturalCode, rank);
if (nameToBeFilledTest.hasProblem()){
addProblemNameToFile("full",fullName,nomenclaturalCode,rank, nameToBeFilledTest.getParsingProblems().toString());
parseNameManually=true;
}else{
nameToBeFilledTest = parseWithExtension(parser, atomisedNameStr, rank, followingText, atomisedMap);
if (nameToBeFilledTest.hasProblem()){
- addProblemNameToFile("fullversion",fullName,nomenclaturalCode,rank, nameToBeFilledTest.getParsingProblems().toString());
+ addProblemNameToFile("fullversion",fullName, nomenclaturalCode,rank, nameToBeFilledTest.getParsingProblems().toString());
nameToBeFilledTest = parser.parseFullName(fullName, nomenclaturalCode,rank);
parseNameManually=true;
if(!originalName.equalsIgnoreCase(atomisedNameStr)) {
boolean parseNameManually=false;
INonViralNameParser parser = NonViralNameParserImpl.NewInstance();
- TaxonNameBase nameToBeFilledTest = null;
+ ITaxonNameBase nameToBeFilledTest = null;
//if selected the atomised version
if(newName==atomisedNameStr){
}
- private TaxonNameBase<?,?> parseWithExtension(INonViralNameParser parser, String atomisedNameStr, Rank rank, String followingText, HashMap<String, String> atomisedMap) {
+ private ITaxonNameBase parseWithExtension(INonViralNameParser parser, String atomisedNameStr, Rank rank, String followingText, HashMap<String, String> atomisedMap) {
Object[] nameExtensionResult = getPossibleExtension(followingText, atomisedMap, nomenclaturalCode);
- TaxonNameBase<?,?> name = parser.parseFullName(atomisedNameStr, nomenclaturalCode, rank);
+ ITaxonNameBase name = parser.parseFullName(atomisedNameStr, nomenclaturalCode, rank);
if (nameExtensionResult != null && nameExtensionResult[0] != null){
String ext = (String)nameExtensionResult[0];
- TaxonNameBase<?,?> extName =parser.parseFullName(atomisedNameStr + " " + ext, nomenclaturalCode, rank);
+ ITaxonNameBase extName =parser.parseFullName(atomisedNameStr + " " + ext, nomenclaturalCode, rank);
if (! extName.hasProblem()){
name = extName;
this.usedFollowingTextPrefix = ext;
logger.warn("Problem with status");
}
}
- List<TaxonBase> tmpList = new ArrayList<TaxonBase>();
+ List<TaxonBase> tmpList = new ArrayList<>();
Pager<TaxonBase> taxontest = importer.getTaxonService().findByTitle(TaxonBase.class, newName2, MatchMode.BEGINNING, null, null, null, null, null);
tmpList.addAll(taxontest.getRecords());
//logger.info("tmpList returned: "+tmpList.size());
- NonViralName<?> identicName = null;
+ INonViralName identicName = null;
boolean foundIdentic=false;
TaxonBase<?> tmpTaxonBase=null;
// Taxon tmpPartial=null;
crank =tnb.getRank();
if (crank !=null && rank !=null){
if (crank.equals(rank)){
- identicName = CdmBase.deproxy(tnb, NonViralName.class);
+ identicName = tnb;
if (isSynonym && tmpb.isInstanceOf(Synonym.class) || !isSynonym && tmpb.isInstanceOf(Taxon.class)){
foundIdentic=true;
tmpTaxonBase=tmpb;
}
if ((tmpTaxonBase == null || !foundIdentic) || (tmpTaxonBase != null && !statusMatch) || (tmpTaxonBase != null && !appendedMatch && !statusMatch)){
- NonViralName<?> tnb;
+ INonViralName tnb;
if (identicName == null){
tnb = getNonViralNameAccNomenclature();
tnb.setRank(rank);
* @param nameToBeFilledTest
*/
@SuppressWarnings("rawtypes")
- public void setParsedName(TaxonNameBase nameToBeFilledTest) {
+ public void setParsedName(ITaxonNameBase nameToBeFilledTest) {
this.taxonNameBase = (NonViralName<?>) nameToBeFilledTest;
}
* @param tnb
* @return
*/
- private Taxon findMatchingTaxon(NonViralName<?> tnb, Reference refMods) {
+ private Taxon findMatchingTaxon(INonViralName tnb, Reference refMods) {
logger.info("findMatchingTaxon");
Taxon tmp=null;
* @param similarityAuthor
* @return
*/
- private boolean compareAndCheckTaxon(NonViralName<?> tnb, Reference refMods, double similarityScore,
+ private boolean compareAndCheckTaxon(INonViralName tnb, Reference refMods, double similarityScore,
Taxon bestMatchingTaxon, double similarityAuthor) {
//logger.info("compareAndCheckTaxon");
boolean insertAsExisting;
}
// }
- logDecision(tnb,bestMatchingTaxon,insertAsExisting, refMods);
+ logDecision(tnb, bestMatchingTaxon, insertAsExisting, refMods);
return insertAsExisting;
}
* @return
*/
@SuppressWarnings("rawtypes")
- private List<Taxon> getMatchingTaxa(TaxonNameBase tnb) {
+ private List<Taxon> getMatchingTaxa(ITaxonNameBase tnb) {
//logger.info("getMatchingTaxon");
if (tnb.getTitleCache() == null){
tnb.setTitleCache(tnb.toString(), tnb.isProtectedTitleCache());
* @param insertAsExisting
* @param refMods
*/
- private void logDecision(NonViralName<?> tnb, Taxon bestMatchingTaxon, boolean insertAsExisting, Reference refMods) {
+ private void logDecision(INonViralName tnb, Taxon bestMatchingTaxon, boolean insertAsExisting, Reference refMods) {
try{
- FileWriter fstream = new FileWriter(TaxonXImport.LOG_FOLDER + "Decisions_"+classification.toString()+".txt",true);
+ FileWriter fstream = new FileWriter(TaxonXImport.LOG_FOLDER + "Decisions_"+classification.toString()+".txt", true);
BufferedWriter out = new BufferedWriter(fstream);
- out.write(tnb.getTitleCache()+" sec. "+refMods+"\t"+bestMatchingTaxon.getTitleCache()+"\t"+insertAsExisting+"\n");
+ out.write(tnb.getTitleCache() + " sec. " + refMods + "\t" + bestMatchingTaxon.getTitleCache() + "\t" + insertAsExisting + "\n");
//Close the output stream
out.close();
}catch (Exception e){//Catch exception if any