Project

General

Profile

Revision 8cf6f634

ID8cf6f6341590664eef0f18993d4403021e10c311
Parent ae79d763
Child f2e74d5a

Added by Andreas Müller over 1 year ago

ref #7894 import source numbers for E+M

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/io/berlinModel/in/BerlinModelImportConfigurator.java
71 71

  
72 72
	private boolean warnForDifferingSynonymReference = true;   //do not warn for E+M as it uses last scrutiny
73 73

  
74
	//references
75
	private boolean doSourceNumber = false;
76

  
74 77
	//occurrences
75 78
	private boolean isSplitTdwgCodes = true;
76 79

  
......
723 726
        this.logMatchingNotExportedOldNames = logMatchingNotExportedOldNames;
724 727
    }
725 728

  
729
    public boolean isDoSourceNumber() {
730
        return doSourceNumber;
731
    }
732
    public void setDoSourceNumber(boolean doSourceNumber) {
733
        this.doSourceNumber = doSourceNumber;
734
    }
735

  
726 736
}
app-import/src/main/java/eu/etaxonomy/cdm/io/berlinModel/in/BerlinModelReferenceImport.java
44 44

  
45 45
import eu.etaxonomy.cdm.common.CdmUtils;
46 46
import eu.etaxonomy.cdm.common.DOI;
47
import eu.etaxonomy.cdm.io.berlinModel.BerlinModelTransformer;
47 48
import eu.etaxonomy.cdm.io.berlinModel.in.validation.BerlinModelReferenceImportValidator;
48 49
import eu.etaxonomy.cdm.io.common.ICdmImport;
49 50
import eu.etaxonomy.cdm.io.common.IImportConfigurator;
......
64 65
import eu.etaxonomy.cdm.model.agent.Team;
65 66
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
66 67
import eu.etaxonomy.cdm.model.common.CdmBase;
68
import eu.etaxonomy.cdm.model.common.DefinedTerm;
67 69
import eu.etaxonomy.cdm.model.common.ExtensionType;
68 70
import eu.etaxonomy.cdm.model.common.IdentifiableSource;
71
import eu.etaxonomy.cdm.model.common.Identifier;
69 72
import eu.etaxonomy.cdm.model.common.Marker;
70 73
import eu.etaxonomy.cdm.model.common.MarkerType;
74
import eu.etaxonomy.cdm.model.common.TermVocabulary;
71 75
import eu.etaxonomy.cdm.model.reference.IArticle;
72 76
import eu.etaxonomy.cdm.model.reference.IBookSection;
73 77
import eu.etaxonomy.cdm.model.reference.IPrintSeries;
74 78
import eu.etaxonomy.cdm.model.reference.Reference;
75 79
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
80
import eu.etaxonomy.cdm.model.reference.ReferenceType;
76 81
import eu.etaxonomy.cdm.strategy.cache.agent.PersonDefaultCacheStrategy;
77 82
import eu.etaxonomy.cdm.strategy.cache.agent.TeamDefaultCacheStrategy;
78 83

  
......
263 268
		return;
264 269
	}
265 270

  
266
	@Override
271
//	 not needed, data also in Reference.idInSource
272
//    private void fillSourceNumberMap(BerlinModelImportState state) throws SQLException {
273
//        String query = " SELECT * FROM SourceNumber2Ref ";
274
//        ResultSet rs = state.getConfig().getSource().getResultSet(query);
275
//        while (rs.next()){
276
//            String sourceNumber = rs.getString("SourceNumber");
277
//            int refId = rs.getInt("RefId");
278
//            if (isNotBlank(sourceNumber)){
279
//                String oldValue = sourceNumberMap.put(refId, sourceNumber.trim());
280
//                if (oldValue != null){
281
//                    logger.warn(">1 source number exists for refId: " + refId);
282
//                }
283
//            }
284
//        }
285
//    }
286

  
287
    @Override
267 288
	public boolean doPartition(@SuppressWarnings("rawtypes") ResultSetPartitioner partitioner, BerlinModelImportState state) {
268 289
        deduplicationHelper.restartSession();
269 290

  
......
512 533
			//TODO do we want this being imported? Maybe as alternatvie identifier?
513 534
			String idInSource = (String)valueMap.get("IdInSource".toLowerCase());
514 535
			if (isNotBlank(idInSource)){
515
				IdentifiableSource source = IdentifiableSource.NewDataImportInstance(idInSource);
516
				source.setIdNamespace("import to Berlin Model");
517
				reference.addSource(source);
536
				if(!state.getConfig().isDoSourceNumber()){
537
				    IdentifiableSource source = IdentifiableSource.NewDataImportInstance(idInSource);
538
				    source.setIdNamespace("import to Berlin Model");
539
				    reference.addSource(source);
540
				}else{
541
				    makeSourceNumbers(state, idInSource, reference, refId);
542
				}
518 543
			}
519 544

  
520 545
			//nom&BiblioReference  - must be last because a clone is created
......
531 556

  
532 557

  
533 558
	/**
559
     * @param state
560
     * @param idInSource
561
     * @param reference
562
     * @param refId
563
     */
564
    private void makeSourceNumbers(BerlinModelImportState state, String idInSource, Reference reference,
565
            Integer refId) {
566
        String[] splits = idInSource.split("\\|");
567
        for (String split : splits){
568
            split = split.trim();
569
            UUID uuid = BerlinModelTransformer.uuidEMReferenceSourceNumber;
570
            TermVocabulary<DefinedTerm> voc = null;  //user defined voc
571
            DefinedTerm type = getIdentiferType(state, uuid, "E+M Reference Source Number", "Euro+Med Reference Source Number", "E+M Source Number", voc);
572
            Identifier.NewInstance(reference, split, type);
573
        }
574
    }
575

  
576
    /**
577
     * @param reference
578
     */
579
    private void handleEdition(Reference reference) {
580
        if (reference.getEdition()!= null && reference.getEdition().startsWith("ed. ")){
581
            reference.setEdition(reference.getEdition().substring(4));
582
        }
583

  
584
    }
585

  
586
    /**
534 587
	 * Creates and saves a nom. reference and a biblio. reference after checking necessity
535 588
	 * @param rs
536 589
	 * @param refId

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)