Commit 1f46730b authored by Jörg Richter's avatar Jörg Richter

ChildTopics API: remove addRef() method (4x) (#341)

BREAKING CHANGE

systems.dmx.core.ChildTopics

remove the 4 addRef() methods:

ChildTopics addRef(String compDefUri, long refTopicId);
ChildTopics addRef(String compDefUri, long refTopicId, ChildTopicsModel relatingAssocChildTopics);
ChildTopics addRef(String compDefUri, String refTopicUri);
ChildTopics addRef(String compDefUri, String refTopicUri, ChildTopicsModel relatingAssocChildTopics);

CODE TRANSFORMATION

Instead of

    topic.getChildTopics().addRef(compDefUri, ...);

write

    topic.update(mf.newChildTopicsModel().addRef(compDefUri, ...));
parent b472773a
Pipeline #9910 passed with stages
in 7 minutes and 56 seconds
......@@ -121,16 +121,6 @@ public interface ChildTopics extends Iterable<String> {
// --- Multiple-valued Children ---
ChildTopics addRef(String compDefUri, long refTopicId);
ChildTopics addRef(String compDefUri, long refTopicId, ChildTopicsModel relatingAssocChildTopics);
ChildTopics addRef(String compDefUri, String refTopicUri);
ChildTopics addRef(String compDefUri, String refTopicUri, ChildTopicsModel relatingAssocChildTopics);
// ---
ChildTopics addDeletionRef(String compDefUri, long refTopicId);
ChildTopics addDeletionRef(String compDefUri, String refTopicUri);
......
......@@ -208,28 +208,6 @@ class ChildTopicsImpl implements ChildTopics {
// --- Multiple-valued Children ---
@Override
public ChildTopics addRef(String compDefUri, long refTopicId) {
return _updateMany(compDefUri, mf.newTopicReferenceModel(refTopicId));
}
@Override
public ChildTopics addRef(String compDefUri, long refTopicId, ChildTopicsModel relatingAssocChildTopics) {
return _updateMany(compDefUri, mf.newTopicReferenceModel(refTopicId, relatingAssocChildTopics));
}
@Override
public ChildTopics addRef(String compDefUri, String refTopicUri) {
return _updateMany(compDefUri, mf.newTopicReferenceModel(refTopicUri));
}
@Override
public ChildTopics addRef(String compDefUri, String refTopicUri, ChildTopicsModel relatingAssocChildTopics) {
return _updateMany(compDefUri, mf.newTopicReferenceModel(refTopicUri, relatingAssocChildTopics));
}
// ---
@Override
public ChildTopics addDeletionRef(String compDefUri, long refTopicId) {
return _updateMany(compDefUri, mf.newTopicDeletionModel(refTopicId));
......
......@@ -1115,7 +1115,7 @@ public class CoreServiceTest extends CoreServiceTestEnvironment {
child1 = dmx.createTopic(mf.newTopicModel("dmx.test.child", new SimpleValue("Child 1")));
// 3) create composite instance
parent1 = dmx.createTopic(mf.newTopicModel("dmx.test.parent"));
parent1.getChildTopics().addRef("dmx.test.child", child1.getId());
parent1.update(mf.newChildTopicsModel().addRef("dmx.test.child", child1.getId()));
tx.success();
} finally {
tx.finish();
......
......@@ -67,9 +67,10 @@ public class DM5CoreServiceTest extends CoreServiceTestEnvironment {
Topic num2 = dmx.createTopic(mf.newTopicModel("lotto.number", new SimpleValue(42)));
//
Topic draw = dmx.createTopic(mf.newTopicModel("lotto.draw"));
draw.getChildTopics()
draw.update(mf.newChildTopicsModel()
.addRef("lotto.number", num1.getId())
.addRef("lotto.number", num2.getId());
.addRef("lotto.number", num2.getId())
);
} finally {
tx.finish();
}
......@@ -260,7 +261,7 @@ public class DM5CoreServiceTest extends CoreServiceTestEnvironment {
assertEquals(2, dmx.getTopicsByType(SIMPLE_NAME).size());
//
// add child topic by-ref
topic.getChildTopics().addRef(SIMPLE_NAME, topic2.getId());
topic.update(mf.newChildTopicsModel().addRef(SIMPLE_NAME, topic2.getId()));
// now the composite has 2 children
List<RelatedTopic> children = topic.getChildTopics().getTopics(SIMPLE_NAME);
assertEquals(2, children.size());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment