15 package cz.vutbr.fit.knot.annotations.modules.suggestionManager.attributes;
19 import java.util.HashMap;
37 private static final HashMap<String,Class>
mapping =
new HashMap<String,Class>();
39 mapping.put(
"AnyAnnotation", SugAnyAttribute.class);
40 mapping.put(
"SuggestionLink", SugLinkedAttribute.class);
41 mapping.put(
"suggestionLink", SugLinkedAttribute.class);
42 mapping.put(
"AnnotationLink", SugLinkedAttribute.class);
43 mapping.put(
"annotationLink", SugLinkedAttribute.class);
44 mapping.put(
"LinkedAnnotation", SugLinkedAttribute.class);
45 mapping.put(
"linkedAnnotation", SugLinkedAttribute.class);
46 mapping.put(
"Boolean", SugBooleanAttribute.class);
47 mapping.put(
"Date", SugDateAttribute.class);
48 mapping.put(
"DateTime", SugDateTimeAttribute.class);
49 mapping.put(
"Decimal", SugDecimalAttribute.class);
50 mapping.put(
"GeoPoint", SugGeoPointAttribute.class);
51 mapping.put(
"geoPoint", SugGeoPointAttribute.class);
52 mapping.put(
"Image", SugImageAttribute.class);
53 mapping.put(
"Integer", SugIntegerAttribute.class);
54 mapping.put(
"NestedAnnotation", SugNestedAttribute.class);
55 mapping.put(
"nestedAnnotation", SugNestedAttribute.class);
56 mapping.put(
"NestedSuggestion", SugNestedAttribute.class);
57 mapping.put(
"nestedSuggestion", SugNestedAttribute.class);
58 mapping.put(
"Person", SugPersonAttribute.class);
59 mapping.put(
"person", SugPersonAttribute.class);
60 mapping.put(
"String", SugStringAttribute.class);
61 mapping.put(
"Time", SugTimeAttribute.class);
62 mapping.put(
"URI", SugUriAttribute.class);
63 mapping.put(
"Duration", SugDurationAttribute.class);
64 mapping.put(
"Binary", SugBinaryAttribute.class);
65 mapping.put(
"Text", SugTextAttribute.class);
66 mapping.put(
"Entity", SugEntityAttribute.class);
67 mapping.put(
"entity", SugEntityAttribute.class);
78 if(type.equalsIgnoreCase(
"NestedAnnotation")){
79 type =
"NestedSuggestion";
81 if(type.equalsIgnoreCase(
"AnnotationLink")){
82 type =
"SuggestionLink";
84 type = type.substring(0, 1).toUpperCase() + type.substring(1);
87 ret.setSimpleType(type);
89 }
catch (Exception e) {
90 throw new ClassNotFoundException(
"Class representing attribute " + type +
" not found");
105 ret.setRefSuggestion(refSuggestion);
122 ret.setRefSuggestion(refSuggestion);
139 SugBaseAttribute ret = SugAttributeManager.createAttribute(name, simpleType, value, refSuggestion);
140 ret.setAttributeType(attributeType);
151 return mapping.containsKey(type);
180 ret.updateFromBaseAttributeAll(attr);
183 catch(ClassNotFoundException ex){
Attribute manager provides a way how to create new attributes for prupose of suggestion.
static final HashMap< String, Class > mapping
static SugBaseAttribute createAttribute(String name, String simpleType, Suggestion refSuggestion)
static boolean containsType(String type)
static SugBaseAttribute createAttribute(String name, String simpleType, Object value, Suggestion refSuggestion)
static SugBaseAttribute createAttribute(String name, String simpleType, AnnotType attributeType, Object value, Suggestion refSuggestion)
Class representing attribute of suggestion.
static boolean hasAttributeRightInstance(SugBaseAttribute attr)
static SugBaseAttribute createAttribute()
Class representing type of annotation.
static SugBaseAttribute createObject(String type)
Class representing suggestion of annotation.
static SugBaseAttribute changeAttributeInstance(SugBaseAttribute attr)