Project

General

Profile

« Previous | Next » 

Revision 8422c0cd

Added by Andreas Müller almost 8 years ago

Remove generics from Reference in cdmlib-app #5830

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/app/proibiosphere/TaxonXImportLauncher.java
53 53
  static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql_test();
54 54
//    static final ICdmDataSource cdmDestination = CdmDestinations.cdm_production_piB("piB_nephrolepis");
55 55
//    static final ICdmDataSource cdmDestination = CdmDestinations.cdm_local_piB("guianas");
56
    
56

  
57 57
    static final CHECK check = CHECK.IMPORT_WITHOUT_CHECK;
58
    
58

  
59 59
    private enum FilterType{MODS, TAXON};
60 60

  
61 61

  
......
66 66

  
67 67
    public static void main(String[] args) {
68 68
    	String[] spiderModsList = new String[] {"zt03768p138","zt03750p196","zt03666p193","zt03664p068","zt03646p592","zt03507p056","zt03415p057","zt03383p038","zt03305p052","zt03228p068","zt03131p034","zt02963p068","zt02883p068","zt02814p018","zt02739p050","zt02730p043","zt02637p054","zt02593p127","zt02551p068","zt02534p036","zt02526p053","zt02427p035","zt02361p012","zt02267p068","zt02223p047","zt01826p058","zt01775p024","zt01744p040","zt01529p060","zt01004p028","zt00904","zt00872","zt00619","zt00109","DippenaarSchoeman1989Penestominae","Simon1902Cribellates","Simon1903Penestominae","Lehtinen1967CribellatePenestominae"};
69
    	
69

  
70 70
    	String[] taxonList = new String[]  {"Campylopus"}; //{"Eupolybothrus","Polybothrus"}, Chenopodium, Lactarius, Campylopus, Nephrolepis, Comaroma (spiders)
71 71
//       /*ants Anochetus*/ String[] modsList = new String[] {"3924" /*, "3743", "4375", "6757", "6752", "3481", "21401_fisher_smith_plos_2008", "2592", "4096", "6877", "6192", "8071"  */};
72 72
//        String[] modsList = new String[] {"21367", "21365", "8171", "6877", "21820", "3641", "6757"};
......
74 74
//        suite: , };//,"3540555099"};
75 75
//        modsList = new String[] {"Zapparoli-1986-Eupolybothrus-fasciatus"};
76 76
//    	taxonList = spiderModsList;
77
    	
77

  
78 78
    	FilterType filterType = FilterType.TAXON;
79
        
79

  
80 80
    	NomenclaturalCode tnomenclature = NomenclaturalCode.ICNAFP;
81 81

  
82 82
        String defaultClassification= null;// "Nephrolepis";
83 83
        boolean alwaysUseDefaultClassification = false;
84
        
84

  
85 85
        boolean useOldUnparsedSynonymExtraction = false;
86 86

  
87
        
88
        
89
        
87

  
88

  
89

  
90 90
        Map<String,List<URI>>documentMap = new HashMap<String, List<URI>>();
91 91

  
92 92
        /*HOW TO HANDLE SECUNDUM REFERENCE*/
93 93
        boolean reuseSecundum = askIfReuseSecundum();
94
        Reference<?> secundum = null;
94
        Reference secundum = null;
95 95
        if (!reuseSecundum) {
96 96
            secundum = askForSecundum();
97 97
        }
......
104 104
        ICdmDataSource destination = cdmDestination;
105 105
        TaxonXImportConfigurator config = prepareTaxonXImport(destination,reuseSecundum, secundum, tnomenclature, alwaysUseDefaultClassification);
106 106
        config.setUseOldUnparsedSynonymExtraction(useOldUnparsedSynonymExtraction);
107
        
107

  
108 108
        config.setImportClassificationName(defaultClassification);
109 109
        log.info("Start import from  TaxonX Data");
110 110

  
......
151 151
     *
152 152
     */
153 153
    private static void prepareReferenceAndSource(TaxonXImportConfigurator taxonxImportConfigurator, URI source) {
154
        Reference<?> reference = ReferenceFactory.newGeneric();
154
        Reference reference = ReferenceFactory.newGeneric();
155 155
        //            String tref = askQuestion("Import source? (ie Plazi document ID)");
156 156
        String tref="PLAZI - "+source.getPath().split("/")[source.getPath().split("/").length-1];
157 157
        reference.setTitleCache(tref,true);
158 158
        reference.setTitle(tref);
159
        
159

  
160 160
        taxonxImportConfigurator.setSourceReference(reference);
161 161
        TaxonXImportConfigurator.setSourceRef(reference);
162 162

  
163
        Reference<?> referenceUrl = ReferenceFactory.newWebPage();
163
        Reference referenceUrl = ReferenceFactory.newWebPage();
164 164
        referenceUrl.setTitleCache(source.toString(), true);
165 165
        referenceUrl.setTitle(source.toString());
166 166
        reference.setUri(source);
......
174 174
     * @param destination
175 175
     * @param reuseSecundum
176 176
     * @param secundum
177
     * @param tnomenclature 
178
     * @param alwaysUseDefaultClassification 
177
     * @param tnomenclature
178
     * @param alwaysUseDefaultClassification
179 179
     * @return
180 180
     */
181
    private static TaxonXImportConfigurator prepareTaxonXImport(ICdmDataSource destination, boolean reuseSecundum, Reference<?> secundum, NomenclaturalCode tnomenclature, boolean alwaysUseDefaultClassification) {
181
    private static TaxonXImportConfigurator prepareTaxonXImport(ICdmDataSource destination, boolean reuseSecundum, Reference secundum, NomenclaturalCode tnomenclature, boolean alwaysUseDefaultClassification) {
182 182
        TaxonXImportConfigurator taxonxImportConfigurator = TaxonXImportConfigurator.NewInstance(destination);
183 183

  
184 184
        //taxonxImportConfigurator.setClassificationName(taxonxImportConfigurator.getSourceReferenceTitle());
......
300 300
	}
301 301

  
302 302
	private static Map<String, List<String>> fillDocumentMap(FilterType filterType,
303
			String[] filterList, String urlstr) 
303
			String[] filterList, String urlstr)
304 304
					throws MalformedURLException, IOException {
305
		
305

  
306 306
		Map<String, List<String>> documents = new HashMap<String, List<String>>();
307 307
		List<String> docList;
308 308
		String inputLine;
......
327 327
		            String taxon = inputLine.split("taxon=\"")[1].split("\"")[0];
328 328
		            String docID=inputLine.split("docId=\"")[1].split("\"")[0];
329 329
		            System.out.println("docID: "+docID);
330
		            
330

  
331 331
		            String link=inputLine.split("link=\"")[1].split("\"")[0];
332 332
		            String pageStart = inputLine.split("startPage=\"")[1].split("\"")[0];
333 333
		            String pageEnd = inputLine.split("endPage=\"")[1].split("\"")[0];
......
341 341
		    }
342 342
		}
343 343
		System.out.println("documents created");
344
		
344

  
345 345
		return documents;
346 346
	}
347 347

  
......
415 415
    /**
416 416
     * @return
417 417
     */
418
    private static Reference<?> askForSecundum() {
418
    private static Reference askForSecundum() {
419 419
        //        logger.info("getFullReference for "+ name);
420 420
        JTextArea textArea = new JTextArea("Enter the secundum name");
421 421
        JScrollPane scrollPane = new JScrollPane(textArea);
......
433 433
                null,
434 434
                null,
435 435
                null);
436
        Reference<?> ref = ReferenceFactory.newGeneric();
436
        Reference ref = ReferenceFactory.newGeneric();
437 437
        ref.setTitle(s);
438 438
        return ref;
439 439
    }

Also available in: Unified diff