private TopicIF getLastModifiedTopic(TopicMapIF topicmap) { TopicIF lastmod = topicmap.getTopicBySubjectIdentifier(psi); if (lastmod == null) { lastmod = topicmap.getBuilder().makeTopic(); lastmod.addSubjectIdentifier(psi); } return lastmod; }
public static AssociationIF makeAssociation( TopicIF aType, TopicIF[] rTypes, TopicIF[] players, Collection<TopicIF> scope) { TopicMapBuilderIF builder = aType.getTopicMap().getBuilder(); AssociationIF assoc = builder.makeAssociation(aType); for (int i=0; i < rTypes.length; i++) { builder.makeAssociationRole(assoc, rTypes[i], players[i]); } return assoc; }
public static String toString(TMObjectIF tmobject) { if (tmobject == null) return "null"; else if (tmobject instanceof TopicNameIF) return ((TopicNameIF)tmobject).getTopic().getObjectId(); else if (tmobject instanceof VariantNameIF) return ((VariantNameIF)tmobject).getTopic().getObjectId(); else if (tmobject instanceof OccurrenceIF) return ((OccurrenceIF)tmobject).getTopic().getObjectId(); else if (tmobject instanceof TopicIF) return ((TopicIF)tmobject).getObjectId(); else return "null"; }
public void testTopicRemovalPolicyRole() { TopicIF topic = builder.makeTopic(); TopicIF other = builder.makeTopic(); AssociationIF assoc = builder.makeAssociation(builder.makeTopic()); AssociationRoleIF role1 = builder.makeAssociationRole(assoc, builder.makeTopic(), topic); AssociationRoleIF role2 = builder.makeAssociationRole(assoc, builder.makeTopic(), other); topic.remove(); assertTrue("association not deleted", assoc.getTopicMap() == null); assertTrue("role1 not deleted", role1.getTopicMap() == null); assertTrue("role2 not deleted", role2.getTopicMap() == null); assertTrue("remaining topic has roles left", other.getRoles().size() == 0); }
private TopicIF getTopic(LocatorIF indicator) { TopicIF topic = topicmap.getTopicBySubjectIdentifier(indicator); if (topic == null) { topic = builder.makeTopic(); topic.addSubjectIdentifier(indicator); } return topic; } }
public void testDeleteInstanceOfSelf() { TopicIF topic = builder.makeTopic(); topic.addType(topic); topic.remove(); assertTrue("topic was not deleted", topic.getTopicMap() == null); }
protected TopicIF resolveResourceRef(LocatorIF locator) { // Look up in the topic map to see if a topic with the identity already exist TopicIF topic = topicmap.getTopicBySubjectLocator(locator); if (topic != null) return topic; // If there is no such topic create a new one with the given subject indicator. topic = builder.makeTopic(); // log.debug("New topic (resourceRef): " + locator); // Set addressable subject topic.addSubjectLocator(locator); return topic; }
@Override public TopicIF makeTopicByItemIdentifier(LocatorIF itemid) { TopicIF topic = (TopicIF) topicmap.getObjectByItemIdentifier(itemid); if (topic == null) { topic = builder.makeTopic(); topic.addItemIdentifier(itemid); } return topic; }
@Override protected void tearDown() { if (topicmapRef != null) { // Inform the factory that the topic map is not needed anymore. topicmap.getStore().close(); factory.releaseTopicMapReference(topicmapRef); // Reset the member variables. topicmapRef = null; topicmap = null; builder = null; } }
@Override public void setUp() throws Exception { super.setUp(); TopicIF topic = builder.makeTopic(); parent = topic; basename = builder.makeTopicName(topic, ""); scoped = basename; typed = basename; object = basename; }
public static TopicIF getTopic(TMObjectIF tmobject) { if (tmobject == null) return null; else if (tmobject instanceof TopicNameIF) return ((TopicNameIF)tmobject).getTopic(); else if (tmobject instanceof VariantNameIF) return ((VariantNameIF)tmobject).getTopic(); else if (tmobject instanceof OccurrenceIF) return ((OccurrenceIF)tmobject).getTopic(); else if (tmobject instanceof TopicIF) return ((TopicIF)tmobject); else return null; }
private TopicIF getPasswordTopic(TopicMapIF topicmap) { TopicIF passwd = topicmap.getTopicBySubjectIdentifier(psi); if (passwd == null) { passwd = topicmap.getBuilder().makeTopic(); passwd.addSubjectIdentifier(psi); } return passwd; }
public static AssociationIF makeAssociation( TopicIF aType, TopicIF[] rTypes, TopicIF[] players, Collection<TopicIF> scope) { TopicMapBuilderIF builder = aType.getTopicMap().getBuilder(); AssociationIF assoc = builder.makeAssociation(aType); for (int i=0; i < rTypes.length; i++) { builder.makeAssociationRole(assoc, rTypes[i], players[i]); } return assoc; }
private TopicIF getTopic(LocatorIF loc) { TopicIF topic = topicmap.getTopicBySubjectIdentifier(loc); if (topic == null) { topic = builder.makeTopic(); topic.addSubjectIdentifier(loc); } return topic; }
@Override public TopicIF makeTopicBySubjectLocator(LocatorIF subjloc) { TopicIF topic = topicmap.getTopicBySubjectLocator(subjloc); if (topic == null) { topic = builder.makeTopic(); topic.addSubjectLocator(subjloc); } return topic; }
@Override public void tearDown() { // Inform the factory that the topic map is not needed anymore. topicmap.getStore().close(); factory.releaseTopicMapReference(topicmapRef); // Reset the member variables. topicmap = null; builder = null; }
public static TopicIF getNullTopic(TopicMapIF topicmap) { TopicIF topic = topicmap.getTopicBySubjectIdentifier(nullPSI); if (topic == null) { topic = topicmap.getBuilder().makeTopic(); topic.addSubjectIdentifier(nullPSI); } return topic; }
@Override public TopicIF makeTopicBySubjectIdentifier(LocatorIF subjid) { TopicIF topic = topicmap.getTopicBySubjectIdentifier(subjid); if (topic == null) { topic = builder.makeTopic(); topic.addSubjectIdentifier(subjid); } return topic; }