1
|
/**
|
2
|
* Copyright (C) 2009 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.cdm.remote.editor;
|
11
|
|
12
|
import java.beans.PropertyEditorSupport;
|
13
|
|
14
|
import org.apache.log4j.Logger;
|
15
|
|
16
|
/**
|
17
|
* @author a.kohlbecker
|
18
|
* @since 30.06.2009
|
19
|
*/
|
20
|
public class CdmTypePropertyEditor extends PropertyEditorSupport {
|
21
|
|
22
|
public static final Logger logger = Logger.getLogger(CdmTypePropertyEditor.class);
|
23
|
|
24
|
@Override
|
25
|
public void setAsText(String text) {
|
26
|
|
27
|
Class<?> clazz = null;
|
28
|
try {
|
29
|
clazz = Class.forName(text);
|
30
|
} catch (ClassNotFoundException e) { /* IGNORE */ }
|
31
|
try {
|
32
|
clazz = Class.forName("eu.etaxonomy.cdm.model.agent."+text);
|
33
|
} catch (ClassNotFoundException e) { /* IGNORE */ }
|
34
|
try {
|
35
|
clazz = Class.forName("eu.etaxonomy.cdm.model.common."+text);
|
36
|
} catch (ClassNotFoundException e) { /* IGNORE */ }
|
37
|
try {
|
38
|
clazz = Class.forName("eu.etaxonomy.cdm.model.description."+text);
|
39
|
} catch (ClassNotFoundException e) { /* IGNORE */ }
|
40
|
try {
|
41
|
clazz = Class.forName("eu.etaxonomy.cdm.model.location."+text);
|
42
|
} catch (ClassNotFoundException e) { /* IGNORE */ }
|
43
|
try {
|
44
|
clazz = Class.forName("eu.etaxonomy.cdm.model.media."+text);
|
45
|
} catch (ClassNotFoundException e) { /* IGNORE */ }
|
46
|
try {
|
47
|
clazz = Class.forName("eu.etaxonomy.cdm.model.molecular."+text);
|
48
|
} catch (ClassNotFoundException e) { /* IGNORE */ }
|
49
|
try {
|
50
|
clazz = Class.forName("eu.etaxonomy.cdm.model.name."+text);
|
51
|
} catch (ClassNotFoundException e) { /* IGNORE */ }
|
52
|
try {
|
53
|
clazz = Class.forName("eu.etaxonomy.cdm.model.occurrence."+text);
|
54
|
} catch (ClassNotFoundException e) { /* IGNORE */ }
|
55
|
try {
|
56
|
clazz = Class.forName("eu.etaxonomy.cdm.model.reference."+text);
|
57
|
} catch (ClassNotFoundException e) { /* IGNORE */ }
|
58
|
try {
|
59
|
clazz = Class.forName("eu.etaxonomy.cdm.model.taxon."+text);
|
60
|
} catch (ClassNotFoundException e) { /* IGNORE */ }
|
61
|
|
62
|
if(clazz != null){
|
63
|
setValue(clazz);
|
64
|
} else {
|
65
|
logger.error("Cannot find class for " + text);
|
66
|
}
|
67
|
}
|
68
|
}
|