14 package cz.vutbr.fit.knot.annotations.comet.protocolV2_0.P2Trix;
23 import java.util.ArrayList;
24 import java.util.logging.Level;
25 import java.util.logging.Logger;
39 super(destinationUri);
111 values =
new ArrayList<String>();
138 this.latitudes =
new ArrayList<String>();
141 latitudes.add(latitude);
166 this.longitudes =
new ArrayList<String>();
169 longitudes.add(longitude);
174 ArrayList<BaseAttribute> atList =
new ArrayList<BaseAttribute>();
178 int langNum = requestInfo.getSession().getLanguageNum();
179 int lod = requestInfo.getSession().getProtocolLOD();
181 String info =
"<attribute annotationUri=\"" + annot.getURIV2();
186 info +=
"\" name=\"" +
name;
188 info +=
"\" invalidProperty=\"name\"/>";
192 Logger.getLogger(P2SimpleTrix.class.getName()).log(Level.SEVERE, null);
198 String simpleType =
"";
199 int typeIndex = Constants.SIMPLE_TYPES_URI_V2.indexOf(
typeUri);
202 simpleType =
"entity";
204 int langNum = requestInfo.getSession().getLanguageNum();
205 int lod = requestInfo.getSession().getProtocolLOD();
207 String info =
"<attribute annotationUri=\"" + annot.getURIV2();
212 info +=
"\" name=\"" +
name;
214 info +=
"\" invalidProperty=\"type\"/>";
218 Logger.getLogger(P2SimpleTrix.class.getName()).log(Level.SEVERE, null);
223 simpleType = Constants.SIMPLE_TYPES_NAMES_V2.get(typeIndex);
229 for(
int i = 0; i < objNum; i++){
232 newAtt = AttributeManager.createAttribute(
name, simpleType, annot);
234 }
catch (ClassNotFoundException ex) {
235 int langNum = requestInfo.getSession().getLanguageNum();
236 int lod = requestInfo.getSession().getProtocolLOD();
238 String info =
"<attribute annotationUri=\"" + annot.getURIV2();
243 info +=
"\" name=\"" +
name;
245 info +=
"\" invalidProperty=\"type\"/>";
249 Logger.getLogger(P2SimpleTrix.class.getName()).log(Level.SEVERE, null, ex);
258 Integer newPriority = null;
261 newPriority = Integer.parseInt(
priority);
262 }
catch(NumberFormatException ex){
263 int langNum = requestInfo.getSession().getLanguageNum();
264 int lod = requestInfo.getSession().getProtocolLOD();
266 String info =
"<attribute annotationUri=\"" + annot.getURIV2();
271 info +=
"\" name=\"" +
name;
273 info +=
"\" invalidProperty=\"priority\"/>";
277 Logger.getLogger(P2SimpleTrix.class.getName()).log(Level.SEVERE, null, ex);
284 newAtt.setPriority(newPriority);
286 newAtt.setPriority(sparePriority);
290 if(simpleType.equals(
"anyAnnotation") || simpleType.equals(
"anyEntity")){
294 else if(simpleType.equals(
"GeoPoint")){
300 }
catch (IllegalArgumentException ex) {
301 int langNum = requestInfo.getSession().getLanguageNum();
302 int lod = requestInfo.getSession().getProtocolLOD();
304 String info =
"<attribute annotationUri=\"" + annot.getURIV2();
309 info +=
"\" name=\"" +
name;
311 info +=
"\" valueType=\"" + simpleType +
"\" type=\"" +
typeUri +
"\"/>";
315 Logger.getLogger(P2SimpleTrix.class.getName()).log(Level.SEVERE, null, ex);
323 newAtt.setRawValue(values.get(i));
327 catch (IllegalArgumentException ex) {
328 int langNum = requestInfo.getSession().getLanguageNum();
329 int lod = requestInfo.getSession().getProtocolLOD();
331 String info =
"<attribute annotationUri=\"" + annot.getURIV2();
336 info +=
"\" name=\"" +
name;
338 info +=
"\" valueType=\"" + simpleType +
"\" type=\"" +
typeUri +
"\"/>";
342 String loggerInfo =
"Attribute name = " +
name +
" value = " + values.get(i);
344 Logger.getLogger(P2SimpleTrix.class.getName()).log(Level.SEVERE, loggerInfo, ex);
360 return values.size();
363 return latitudes.size();
ArrayList< String > longitudes
static final int LOG_LEVEL_ALL_ERRORS
static final String EMPTY_ENTITY
ArrayList< String > getValues()
ArrayList< String > values
void addValue(String value)
ArrayList< String > latitudes
static final int ERROR_26_ATTRIBUTE_MALFORMED
ArrayList< BaseAttribute > trixToAnnotAtt(Annotation annot, RequestInfo requestInfo, Integer sparePriority)
void setLongitudes(ArrayList< String > longitudes)
void setTypeUri(String typeUri)
void setLatitudes(ArrayList< String > latitudes)
P2SimpleTrix(String destinationUri)
void addLatitude(String latitude)
int getNumberOfAttributes()
Base class representing attribute of annotation.
Class that represents simple trix triple.
static final int LOG_LEVEL
void setGeoPoint(boolean geoPoint)
void addLongitude(String longitude)
Class attribute manager provides a way how to create new attributes.
Processed informations about client request.
Class that represents base trix triple.
static final int ERROR_7_ATTRIBUTE_VALUE
Class responsible for localised strings.
Class representing attribute of type GeoPoint.
ArrayList< String > getLatitudes()
void setValue(ArrayList< String > values)
Class representing annotation.
ArrayList< String > getLongitudes()