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