use of org.tmdmaker.core.model.VirtualSuperset in project tmdmaker by tmdmaker.
the class VirtualSupersetTypeEditPart method getCommand.
/**
* {@inheritDoc}
*
* @see org.eclipse.gef.editparts.AbstractEditPart#getCommand(org.eclipse.gef.Request)
*/
@Override
public Command getCommand(Request request) {
if (!REQ_OPEN.equals(request.getType()))
return super.getCommand(request);
VirtualSupersetType type = getModel();
VirtualSuperset superset = type.getSuperset();
Diagram diagram = superset.getDiagram();
List<AbstractEntityModel> list = type.getSubsetList();
VirtualSupersetCreateDialog dialog = new VirtualSupersetCreateDialog(getViewer().getControl().getShell(), diagram, superset, list);
if (dialog.open() != Dialog.OK)
return null;
return new VirtualSupersetEditCommand(superset, dialog.getEditedValue(), dialog.getSelection(), dialog.getEditedAggregator().isApplyAttribute());
}
use of org.tmdmaker.core.model.VirtualSuperset in project tmdmaker by tmdmaker.
the class ModelFeatureTest method testCanCreateMultivalueOr.
/**
* モデル毎の多値のOR作成可否をテスト
*/
@Test
public void testCanCreateMultivalueOr() {
CombinationTable t = new CombinationTable();
assertEquals(true, t.canCreateMultivalueOr());
Entity e = new Entity();
assertEquals(true, e.canCreateMultivalueOr());
Detail d = new Detail();
assertEquals(true, d.canCreateMultivalueOr());
Laputa l = new Laputa();
assertEquals(false, l.canCreateMultivalueOr());
MappingList m = new MappingList();
assertEquals(true, m.canCreateMultivalueOr());
MultivalueAndSuperset ms = new MultivalueAndSuperset();
assertEquals(false, ms.canCreateMultivalueOr());
MultivalueOrEntity mo = new MultivalueOrEntity();
assertEquals(true, mo.canCreateMultivalueOr());
RecursiveTable r = new RecursiveTable();
assertEquals(true, r.canCreateMultivalueOr());
SubsetEntity s = new SubsetEntity();
assertEquals(true, s.canCreateMultivalueOr());
VirtualEntity v = new VirtualEntity();
assertEquals(false, v.canCreateMultivalueOr());
VirtualSuperset vs = new VirtualSuperset();
assertEquals(false, vs.canCreateMultivalueOr());
Memo mm = new Memo();
assertEquals(false, mm.canCreateMultivalueOr());
TurboFile tb = new TurboFile();
assertEquals(false, tb.canCreateMultivalueOr());
}
use of org.tmdmaker.core.model.VirtualSuperset in project tmdmaker by tmdmaker.
the class RelatedRelationshipTest method testVirtualSupersetHelper.
/**
* Test method for {@link org.tmdmaker.core.model.RelatedRelationship}
* .
*/
@Test
public void testVirtualSupersetHelper() {
Diagram diagram = new Diagram();
Entity e1 = Entity.ofEvent(new Identifier("テスト1番号")).withDefaultAttribute();
diagram.addChild(e1);
Entity e2 = Entity.ofEvent(new Identifier("テスト2番号")).withDefaultAttribute();
diagram.addChild(e2);
VirtualSuperset vsp = VirtualSuperset.of(new ModelName("スーパーセット"));
VirtualSupersetType type = new VirtualSupersetType();
diagram.addChild(vsp);
diagram.addChild(type);
RelatedRelationship t2v = new RelatedRelationship(type, vsp);
Entity2VirtualSupersetTypeRelationship m2t1 = new Entity2VirtualSupersetTypeRelationship(e1, type);
Entity2VirtualSupersetTypeRelationship m2t2 = new Entity2VirtualSupersetTypeRelationship(e2, type);
t2v.connect();
m2t1.connect();
m2t2.connect();
assertEquals(true, t2v.isDeletable());
assertEquals("スーパーセット", t2v.getSourceName());
assertEquals("テスト1,テスト2", t2v.getTargetName());
assertEquals("スーパーセット", m2t1.getSourceName());
assertEquals("テスト1", m2t1.getTargetName());
}
use of org.tmdmaker.core.model.VirtualSuperset in project tmdmaker by tmdmaker.
the class VirtualSupersetTest method testEditSuperSuper1.
@Test
public void testEditSuperSuper1() {
List<AbstractEntityModel> list = new ArrayList<AbstractEntityModel>();
Diagram diagram = new Diagram();
Entity e1 = Entity.ofEvent(new Identifier("テスト1番号")).withDefaultAttribute();
diagram.addChild(e1);
Entity e2 = Entity.ofEvent(new Identifier("テスト2番号")).withDefaultAttribute();
diagram.addChild(e2);
Entity e3 = Entity.ofEvent(new Identifier("テスト2番号")).withDefaultAttribute();
diagram.addChild(e3);
VirtualSuperset vsp1 = VirtualSuperset.of(new ModelName("スーパーセット"));
VirtualSubsetBuilder builder = vsp1.virtualSubsets().builder();
list.add(e1);
list.add(e2);
list.add(e3);
builder.subsetList(list).build();
assertEquals(3, vsp1.virtualSubsets().all().size());
List<AbstractEntityModel> list2 = new ArrayList<AbstractEntityModel>();
list2.add(e1);
list2.add(e2);
builder = vsp1.virtualSubsets().builder();
builder.subsetList(list2).build();
assertTrue(vsp1.hasSubset());
assertEquals(vsp1.virtualSubsets().all().size(), 2);
builder.rollback();
assertTrue(vsp1.hasSubset());
assertEquals(vsp1.virtualSubsets().all().size(), 3);
}
use of org.tmdmaker.core.model.VirtualSuperset in project tmdmaker by tmdmaker.
the class VirtualSupersetTest method testRemoveSubset.
@Test
public void testRemoveSubset() {
Diagram diagram = new Diagram();
Entity e1 = Entity.ofResource(new Identifier("テスト1番号")).withDefaultAttribute();
diagram.addChild(e1);
Entity e2 = Entity.ofResource(new Identifier("テスト2番号")).withDefaultAttribute();
diagram.addChild(e2);
List<AbstractEntityModel> list = new ArrayList<AbstractEntityModel>();
list.add(e1);
list.add(e2);
VirtualSuperset vsp = VirtualSuperset.of(new ModelName("スーパーセット"));
VirtualSubsetBuilder builder = vsp.virtualSubsets().builder();
builder.subsetList(list).build();
assertTrue(vsp.hasSubset());
VirtualSupersetType type1 = vsp.getVirtualSupersetType();
assertEquals(true, vsp.isDeletable());
assertEquals(true, type1.isApplyAttribute());
assertEquals(false, vsp.isEntityTypeEditable());
assertEquals(true, vsp.hasSubset());
assertEquals(2, vsp.getVirtualSubsetRelationshipList().size());
builder.rollback();
assertTrue(!vsp.hasSubset());
VirtualSupersetType type2 = vsp.getVirtualSupersetType();
if (!diagram.contains(type2)) {
return;
}
}
Aggregations