Project

General

Profile

« Previous | Next » 

Revision bbeda5af

Added by Katja Luther about 7 years ago

changes in pesi im and exports

View differences:

cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/out/PesiRelTaxonExport.java
560 560
	private boolean neededValuesNotNull(Synonym synonym, PesiExportState state) {
561 561
	    boolean result = true;
562 562
        if (getTaxonFk1(synonym, state) == null) {
563
            logger.warn("TaxonFk1 is NULL, but is not allowed to be. Therefore no record was written to export database for this relationship: " + relationship.getUuid());
563
            logger.warn("TaxonFk1 is NULL, but is not allowed to be. Therefore no record was written to export database for this relationship: " + synonym.getUuid());
564 564
            result = false;
565 565
        }
566 566
        return result;
......
621 621
		return getObjectFk(relationship, state, true);
622 622
	}
623 623

  
624
	/**
625
     * Returns the <code>TaxonFk1</code> attribute. It corresponds to a CDM <code>TaxonRelationship</code>.
626
     * @param relationship The {@link RelationshipBase Relationship}.
627
     * @param state The {@link PesiExportState PesiExportState}.
628
     * @return The <code>TaxonFk1</code> attribute.
629
     * @see MethodMapper
630
     */
631
    private static Integer getTaxonFk1(Synonym synonym, PesiExportState state) {
632
        return synonym.getAcceptedTaxon().getId();
633
    }
634

  
635

  
624 636
	/**
625 637
	 * Returns the <code>TaxonFk2</code> attribute. It corresponds to a CDM <code>SynonymRelationship</code>.
626 638
	 * @param relationship The {@link RelationshipBase Relationship}.
......
662 674
			code = name.getNomenclaturalCode();
663 675
			rel = null;
664 676

  
665
		}else if (relationship.isInstanceOf(SynonymRelationship.class)){
666
			SynonymRelationship rel = CdmBase.deproxy(relationship, SynonymRelationship.class);
667
			taxon = rel.getAcceptedTaxon();
668
			name = taxon.getName();
669
			code = name.getNomenclaturalCode();
670
			rel = null;
677
//		}else if (relationship.isInstanceOf(SynonymRelationship.class)){
678
//			SynonymRelationship rel = CdmBase.deproxy(relationship, SynonymRelationship.class);
679
//			taxon = rel.getAcceptedTaxon();
680
//			name = taxon.getName();
681
//			code = name.getNomenclaturalCode();
682
//			rel = null;
671 683

  
672 684
		}else if (relationship.isInstanceOf(NameRelationship.class)){
673 685
			NameRelationship rel = CdmBase.deproxy(relationship,  NameRelationship.class);
......
715 727
		if (relationship.isInstanceOf(TaxonRelationship.class)) {
716 728
			TaxonRelationship tr = (TaxonRelationship)relationship;
717 729
			taxonBase = (isFrom) ? tr.getFromTaxon():  tr.getToTaxon();
718
		} else if (relationship.isInstanceOf(SynonymRelationship.class)) {
719
			SynonymRelationship sr = (SynonymRelationship)relationship;
720
			taxonBase = (isFrom) ? sr.getSynonym() : sr.getAcceptedTaxon();
730

  
731
//		} else if (relationship.isInstanceOf(SynonymRelationship.class)) {
732
//			SynonymRelationship sr = (SynonymRelationship)relationship;
733
//			taxonBase = (isFrom) ? sr.getSynonym() : sr.getAcceptedTaxon();
721 734
		} else if (relationship.isInstanceOf(NameRelationship.class) ||  relationship.isInstanceOf(HybridRelationship.class)) {
722 735
			if (isFrom){
723 736
				return state.getDbId(state.getCurrentFromObject());

Also available in: Unified diff