Project

General

Profile

« Previous | Next » 

Revision 3978bc49

Added by Andreas Müller over 12 years ago

getAnnotationType with user defined vocabulary

View differences:

cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/CdmImportBase.java
75 75
	public static final UUID uuidUserDefinedExtensionTypeVocabulary = UUID.fromString("e28c1394-1be8-4847-8b81-ab44eb6d5bc8");
76 76
	public static final UUID uuidUserDefinedReferenceSystemVocabulary = UUID.fromString("467591a3-10b4-4bf1-9239-f06ece33e90a");
77 77
	public static final UUID uuidUserDefinedFeatureVocabulary = UUID.fromString("fe5fccb3-a2f2-4b97-b199-6e2743cf1627");
78
	public static final UUID uuidUserDefinedAnnotationTypeVocabulary = UUID.fromString("cd9ecdd2-9cae-4890-9032-ad83293ae883");
78 79
	
79 80
	
80 81
	private static final String UuidOnly = "UUIDOnly";
......
232 233
		return markerType;
233 234
	}
234 235
	
235
	protected AnnotationType getAnnotationType(STATE state, UUID uuid, String label, String text, String labelAbbrev){
236
	protected AnnotationType getAnnotationType(STATE state, UUID uuid, String label, String text, String labelAbbrev, TermVocabulary<AnnotationType> voc){
236 237
		if (uuid == null){
237 238
			uuid = UUID.randomUUID();
238 239
		}
......
242 243
			if (annotationType == null){
243 244
				annotationType = AnnotationType.NewInstance(label, text, labelAbbrev);
244 245
				annotationType.setUuid(uuid);
245
				UUID uuidAnnotationTypeVoc = UUID.fromString("ca04609b-1ba0-4d31-9c2e-aa8eb2f4e62d");
246
				TermVocabulary voc = getVocabularyService().find(uuidAnnotationTypeVoc);
246
				if (voc == null){
247
					boolean isOrdered = false;
248
					voc = getVocabulary(uuidUserDefinedAnnotationTypeVocabulary, "User defined vocabulary for annotation types", "User Defined Annotation Types", null, null, isOrdered);
249
				}
250
				
247 251
				voc.addTerm(annotationType);
248 252
				getTermService().save(annotationType);
249 253
			}

Also available in: Unified diff