15 package cz.vutbr.fit.knot.annotations.entity.attribute;
19 import java.util.HashMap;
36 private static final HashMap<String,Class>
mapping =
new HashMap<String,Class>();
38 mapping.put(
"AnyAnnotation", AnyAnnotationAttribute.class);
39 mapping.put(
"AnnotationLink", LinkedAnnotationAttribute.class);
40 mapping.put(
"annotationLink", LinkedAnnotationAttribute.class);
41 mapping.put(
"Boolean", BooleanAttribute.class);
42 mapping.put(
"Date", DateAttribute.class);
43 mapping.put(
"DateTime", DateTimeAttribute.class);
44 mapping.put(
"Decimal", DecimalAttribute.class);
45 mapping.put(
"GeoPoint", GeoPointAttribute.class);
46 mapping.put(
"geoPoint", GeoPointAttribute.class);
47 mapping.put(
"Image", ImageAttribute.class);
48 mapping.put(
"Integer", IntegerAttribute.class);
49 mapping.put(
"NestedAnnotation", NestedAnnotationAttribute.class);
50 mapping.put(
"nestedAnnotation", NestedAnnotationAttribute.class);
51 mapping.put(
"Person", PersonAttribute.class);
52 mapping.put(
"person", PersonAttribute.class);
53 mapping.put(
"String", StringAttribute.class);
54 mapping.put(
"Time", TimeAttribute.class);
55 mapping.put(
"URI", UriAttribute.class);
56 mapping.put(
"Duration", DurationAttribute.class);
57 mapping.put(
"Binary", BinaryAttribute.class);
58 mapping.put(
"Text", TextAttribute.class);
59 mapping.put(
"Entity", EntityAttribute.class);
60 mapping.put(
"entity", EntityAttribute.class);
61 mapping.put(
"http://www.w3.org/2001/XMLSchema#string", StringAttribute.class);
62 mapping.put(
"http://knot.fit.vutbr.cz/annotations/knotOAExtension#entity", EntityAttribute.class);
63 mapping.put(
"http://knot.fit.vutbr.cz/annotations/knotOAExtension#text", TextAttribute.class);
64 mapping.put(
"http://www.w3.org/2001/XMLSchema#base64binary", BinaryAttribute.class);
65 mapping.put(
"http://www.w3.org/2001/XMLSchema#duration", DurationAttribute.class);
66 mapping.put(
"http://www.w3.org/2001/XMLSchema#time", TimeAttribute.class);
67 mapping.put(
"http://www.w3.org/2001/XMLSchema#anyUri", UriAttribute.class);
68 mapping.put(
"http://www.w3.org/2003/01/geo/wgs84_pos#Point", GeoPointAttribute.class);
69 mapping.put(
"http://knot.fit.vutbr.cz/annotations/knotOAExtension#imageUri", ImageAttribute.class);
70 mapping.put(
"http://www.w3.org/2001/XMLSchema#integer", IntegerAttribute.class);
71 mapping.put(
"http://knot.fit.vutbr.cz/annotations/knotOAExtension#anyAnnotation", AnyAnnotationAttribute.class);
72 mapping.put(
"http://www.w3.org/2001/XMLSchema#boolean", BooleanAttribute.class);
73 mapping.put(
"http://www.w3.org/2001/XMLSchema#date", DateAttribute.class);
74 mapping.put(
"http://www.w3.org/2001/XMLSchema#dateTime", DateTimeAttribute.class);
75 mapping.put(
"http://www.w3.org/2001/XMLSchema#decimal", DecimalAttribute.class);
87 type = type.substring(0, 1).toUpperCase() + type.substring(1);
90 ret.setSimpleType(type);
92 }
catch (Exception e) {
93 throw new ClassNotFoundException(
"Class representing attribute " + type +
" not found");
108 ret.setRefAnnotation(refAnnotation);
125 ret.setRefAnnotation(refAnnotation);
142 BaseAttribute ret = AttributeManager.createAttribute(name, simpleType, value, refAnnotation);
143 ret.setAttributeType(attributeType);
154 return mapping.containsKey(type);
183 ret.updateFromBaseAttributeAll(attr);
186 catch(ClassNotFoundException ex){
static boolean containsType(String type)
static BaseAttribute createAttribute(String name, String simpleType, Object value, Annotation refAnnotation)
static boolean hasAttributeRightInstance(BaseAttribute attr)
static final HashMap< String, Class > mapping
static BaseAttribute createAttribute(String name, String simpleType, Annotation refAnnotation)
Base class representing attribute of annotation.
Class representing type of annotation.
static BaseAttribute createObject(String type)
static BaseAttribute changeAttributeInstance(BaseAttribute attr)
static BaseAttribute createAttribute()
Class attribute manager provides a way how to create new attributes.
static BaseAttribute createAttribute(String name, String simpleType, AnnotType attributeType, Object value, Annotation refAnnotation)
Class representing annotation.