@Override public void removeSubjectLocator(Locator slo) { if (slo == null) { throw new ModelConstraintException(this, "The subject locator must not be null"); } wrapped.removeSubjectLocator(topicMap.unwrapLocator(slo)); }
@Override public void modify(TMObjectIF object, Object v) { if (!(object instanceof TopicIF)) return; TopicIF topic = (TopicIF) object; String value = (String) v; try { topic.removeSubjectLocator(new URILocator(value)); } catch (MalformedURLException e) { throw new OntopiaRuntimeException("Invalid URI: " + value); } } }
public void setSubjectLocators(TopicIF object, Topic pojo) { if (pojo.getSubjectLocators() != null) { Collection<LocatorIF> toRemove = CollectionUtils.subtract(object.getSubjectLocators(), pojo.getSubjectLocators()); for (LocatorIF sl : pojo.getSubjectLocators()) { object.addSubjectLocator(sl); } for (LocatorIF sl : toRemove) { object.removeSubjectLocator(sl); } } }
@Override public void run() { TopicIF t = getTopic(); t.removeSubjectLocator(URILocator.create("x:subject")); this.objectId = t.getObjectId(); } });
LocatorIF oldloc = (LocatorIF)iter.next(); if (ObjectUtils.equals(oldloc, newloc)) continue; topic.removeSubjectLocator(oldloc);
/** * Removes the subject locator or a subject identifier from a topic. * * @param _value * value which is going to be removed from the topic. */ @Override public void removeValue(Topic topic, Object _value, LifeCycleListener listener) { TopicIF topicIf = topic.getTopicIF(); LocatorIF value = (_value instanceof LocatorIF ? (LocatorIF) _value : URILocator.create((String) _value)); if (value != null) { if (listener != null) listener.onBeforeRemove(topic, this, value); if (isSubjectLocator()) topicIf.removeSubjectLocator(value); else if (isItemIdentifier()) topicIf.removeItemIdentifier(value); else topicIf.removeSubjectIdentifier(value); } }
/** * Removes the subject locator or a subject identifier from a topic. * * @param _value * value which is going to be removed from the topic. */ @Override public void removeValue(Topic topic, Object _value, LifeCycleListener listener) { TopicIF topicIf = topic.getTopicIF(); LocatorIF value = (_value instanceof LocatorIF ? (LocatorIF) _value : URILocator.create((String) _value)); if (value != null) { if (listener != null) listener.onBeforeRemove(topic, this, value); if (isSubjectLocator()) topicIf.removeSubjectLocator(value); else if (isItemIdentifier()) topicIf.removeItemIdentifier(value); else topicIf.removeSubjectIdentifier(value); } }
public void testSubject() { assertTrue("subject not null initially", topic.getSubjectLocators().isEmpty()); try { URILocator loc = new URILocator("http://www.ontopia.net/"); topic.addSubjectLocator(loc); assertTrue("subject not set properly", topic.getSubjectLocators().contains(loc)); topic.removeSubjectLocator(loc); assertTrue("couldn't set subject to null", topic.getSubjectLocators().isEmpty()); } catch (MalformedURLException e) { fail("(INTERNAL) URL malformed"); } catch (ConstraintViolationException e) { fail("constraint violated for no good reason"); } }
source.removeSubjectLocator(subjectLocator);
assertTrue("topic not found by subject", found.equals(topic)); topic.removeSubjectLocator(loc); found = tm.getTopicBySubjectLocator(loc); assertTrue("topic found by subject when it shouldn't be",
topic.removeSubjectLocator(topic_subject_locator);
bart.removeSubjectLocator(URILocator.create("x:subject-locator")); afterTest();
topic1.removeSubjectLocator(subloc); topic1.removeItemIdentifier(srcloc);