Project

General

Profile

« Previous | Next » 

Revision 48bc1f9f

Added by Andreas Müller over 12 years ago

getMarkerType with voc and generics for getVocabulary

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/io/cyprus/CyprusDistributionImport.java
70 70
	protected static final String REFERENCE_COLUMN = "source";
71 71
	
72 72

  
73
	private Reference refMeikle1977 = ReferenceFactory.newGeneric();
74
	private Reference refMeikle1985 = ReferenceFactory.newGeneric();
73
	private Reference<?> refMeikle1977 = ReferenceFactory.newGeneric();
74
	private Reference<?> refMeikle1985 = ReferenceFactory.newGeneric();
75 75
	
76 76
	private Map<String, Taxon> taxonWithAuthorStore = new HashMap<String, Taxon>(); 
77 77
	private Map<String, Taxon> taxonNameOnlyStore = new HashMap<String, Taxon>();
......
117 117
			return;
118 118
		}
119 119
		Taxon taxon = getTaxon(state, taxonStr);
120
		Reference ref = getReference(taxonLight.getReference());
120
		Reference<?> ref = getReference(taxonLight.getReference());
121 121
		if (taxon != null){
122 122
			makeDistribution(state, taxon, taxonLight.getDistribution(), ref);
123 123
			getTaxonService().save(taxon);
......
132 132
	protected static final boolean NO_IMAGE_GALLERY = false;
133 133
	protected static final boolean IMAGE_GALLERY = false;
134 134
	
135
	private void makeDistribution(CyprusImportState state, Taxon taxon, String distributionStr, Reference ref) {
135
	private void makeDistribution(CyprusImportState state, Taxon taxon, String distributionStr, Reference<?> ref) {
136 136
		
137 137
//		TaxonDescription description = getTaxonDescription(taxon, NO_IMAGE_GALLERY, CREATE);
138 138
		TaxonDescription description = getNewDescription(state, taxon);
......
151 151
	}
152 152
	
153 153
	private TaxonDescription getNewDescription(CyprusImportState state, Taxon taxon) {
154
		Reference excelRef = state.getConfig().getSourceReference();
154
		Reference<?> excelRef = state.getConfig().getSourceReference();
155 155
		TaxonDescription desc = TaxonDescription.NewInstance(taxon, false);
156 156
		desc.setTitleCache(excelRef.getTitleCache() + " for " + taxon.getTitleCache(), true);
157 157
		desc.addSource(null, null, excelRef, null);
......
226 226
			}
227 227
		}
228 228
		for (Distribution distribution : toRemove){
229
			DescriptionBase desc = distribution.getInDescription();
229
			DescriptionBase<?> desc = distribution.getInDescription();
230 230
			desc.removeElement(distribution);
231 231
			getDescriptionService().saveOrUpdate(desc);
232 232
		}
......
252 252
		return result;
253 253
	}
254 254
	
255
	private Reference getReference(String referenceStr) {
256
		Reference result;
255
	private Reference<?> getReference(String referenceStr) {
256
		Reference<?> result;
257 257
		if ("Meikle 1977".equals(referenceStr)){
258 258
			result = refMeikle1977;
259 259
		}else if("Meikle 1985".equals(referenceStr)){
......
294 294
	 * 
295 295
	 */
296 296
	private void loadTaxa() {
297
		List<String> propertyPaths = new ArrayList();
297
		List<String> propertyPaths = new ArrayList<String>();
298 298
		propertyPaths.add("*.name");
299 299
		List<Taxon> taxonList = (List)getTaxonService().list(Taxon.class, null, null, null, propertyPaths);
300 300
		for (Taxon taxon: taxonList){
......
360 360
			getTermService().save(areaLevel);
361 361
		}
362 362
		
363
		TermVocabulary areaVocabulary = getVocabulary(CyprusTransformer.uuidCyprusDivisionsVocabulary, "Cyprus devisions", "Cyprus divisions", null, null, true);
363
		TermVocabulary<NamedArea> areaVocabulary = getVocabulary(CyprusTransformer.uuidCyprusDivisionsVocabulary, "Cyprus devisions", "Cyprus divisions", null, null, true, NamedArea.NewInstance());
364 364
		TdwgArea tdwg4Cyprus = (TdwgArea)getTermService().find(UUID.fromString("9d447b51-e363-4dde-ae40-84c55679983c"));
365 365
		WaterbodyOrCountry isoCountryCyprus = (WaterbodyOrCountry)getTermService().find(UUID.fromString("4b13d6b8-7eca-4d42-8172-f2018051ca19"));
366 366
		
app-import/src/main/java/eu/etaxonomy/cdm/io/wp6/CommonNameExcelImport.java
299 299
					}else if (result.getId() == 0){
300 300
//						UUID uuidLanguageVoc = UUID.fromString("45ac7043-7f5e-4f37-92f2-3874aaaef2de"); 
301 301
						UUID uuidLanguageVoc = UUID.fromString("434cea89-9052-4567-b2db-ff77f42e9084"); 
302
						TermVocabulary<Language> voc = getVocabulary(uuidLanguageVoc, "User Defined Languages", "User Defined Languages", null, null, false);
302
						TermVocabulary<Language> voc = getVocabulary(uuidLanguageVoc, "User Defined Languages", "User Defined Languages", null, null, false, result);
303 303
//						TermVocabulary<Language> voc = getVocabularyService().find(uuidLanguageVoc);
304 304
						voc.addTerm(result);
305 305
						getTermService().saveOrUpdate(result);

Also available in: Unified diff