|
From: Dicheva, D. <dic...@ws...> - 2008-05-12 02:12:32
|
Hello all,
I have a problem in using the removeSubjectLocator(l) method - it just
doesn't work for me ...
I am copying a method to replace a subject locator of a topic with a new
one - have no idea what I am doing wrong...
Any help is highly appreciated.
Thanks,
Darina
---------------
public static void replaceOldSubjectLocator(Topic t,
String oldSubjectLocator, String newSubjectLocator, TopicMap tm)
throws Exception {
Collection sic = t.getSubjectLocators();
if (!sic.isEmpty()) {
Iterator it = sic.iterator();
while (it.hasNext()) {
Locator l = (Locator) it.next();
if (oldSubjectLocator.equals(l.getReference()))
{
t.removeSubjectLocator(l);
}
}
}
if (!newSubjectLocator.equals("")) {
Locator siLoc = tm.createLocator(newSubjectLocator,
"URI");
t.addSubjectLocator(siLoc);
}
}
|