303 |
|
|
304 |
|
|
305 |
public void deleteText(String noteURI, int begin, int end) |
public void deleteText(String noteURI, int begin, int end) |
306 |
throws RemoteException { synchronized(model) { |
throws RemoteException |
307 |
|
{ synchronized(model) { try { |
308 |
/* |
/* |
309 |
Cell note = space.getCell(noteId); |
Cell note = space.getCell(noteId); |
310 |
note.deleteText(begin, end); |
note.deleteText(begin, end); |
311 |
*/ |
*/ |
312 |
|
|
313 |
// not implemented |
Resource note = model.getResource(noteURI); |
314 |
// =============== |
|
315 |
|
// find actual data |
316 |
|
Selector s = |
317 |
|
new SelectorImpl(note, PP.LinkToContentRef, (RDFNode) null); |
318 |
|
StmtIterator iter = model.listStatements(s); |
319 |
|
Statement stmt = null; |
320 |
|
while (iter.hasNext()) { |
321 |
|
if (stmt != null) throw new Error("Too many data!!"); |
322 |
|
stmt = iter.next(); |
323 |
|
} |
324 |
|
|
325 |
|
Resource data = (Resource) stmt.getObject(); |
326 |
|
|
327 |
}} |
// find literal |
328 |
|
s = new SelectorImpl(data, PP.Data, (RDFNode) null); |
329 |
|
iter = model.listStatements(s); |
330 |
|
stmt = null; |
331 |
|
while (iter.hasNext()) { |
332 |
|
if (stmt != null) throw new Error("Too many data!!"); |
333 |
|
stmt = iter.next(); |
334 |
|
} |
335 |
|
|
336 |
|
StringBuffer str = new StringBuffer(stmt.getObject().toString()); |
337 |
|
model.remove(stmt); |
338 |
|
str.delete(begin, end); |
339 |
|
data.addProperty(PP.Data, str.toString()); |
340 |
|
|
341 |
|
} catch (RDFException e) { |
342 |
|
pa("Fault inserting text to note: "+e); |
343 |
|
}}} |
344 |
} |
} |