Search in sources :

Example 1 with Entity2SubsetTypeRelationship

use of org.tmdmaker.core.model.Entity2SubsetTypeRelationship in project tmdmaker by tmdmaker.

the class Entity2SubsetTypeRelationshipEditPart method updateFigure.

/**
 * @param figure
 *            再描画対象のFigure
 */
private void updateFigure(Entity2SubsetTypeRelationshipFigure figure) {
    Entity2SubsetTypeRelationship relationship = (Entity2SubsetTypeRelationship) getModel();
    figure.update(relationship);
}
Also used : Entity2SubsetTypeRelationship(org.tmdmaker.core.model.Entity2SubsetTypeRelationship)

Example 2 with Entity2SubsetTypeRelationship

use of org.tmdmaker.core.model.Entity2SubsetTypeRelationship in project tmdmaker by tmdmaker.

the class EditPartFactoryTest method testCreateEditPart.

/**
 * Test method for
 * {@link org.tmdmaker.ui.editor.gef3.editparts.TMDEditPartFactory#createEditPart(org.eclipse.gef.EditPart, java.lang.Object)}
 * .
 */
@Test
public void testCreateEditPart() {
    Object o = new Attribute();
    EditPart editPart = factory.createEditPart(null, o);
    assertThat(editPart, instanceOf(AttributeEditPart.class));
    AbstractRelationship r = Relationship.of(r1, r2);
    r.connect();
    o = r.getTable();
    editPart = factory.createEditPart(null, o);
    assertThat(editPart, instanceOf(CombinationTableEditPart.class));
    Entity res1 = Entity.ofResource(new Identifier("リソース番号"));
    Entity ev1 = Entity.ofEvent(new Identifier("イベント番号"));
    AbstractRelationship rel = Relationship.of(res1, ev1);
    rel.connect();
    rel.setSourceCardinality(Cardinality.MANY);
    rel.setTargetCardinality(Cardinality.MANY);
    ev1.multivalueAnd().builder().build();
    o = ev1.multivalueAnd().detail();
    editPart = factory.createEditPart(null, o);
    assertThat(editPart, instanceOf(DetailEditPart.class));
    o = new Diagram();
    editPart = factory.createEditPart(null, o);
    assertThat(editPart, instanceOf(DiagramEditPart.class));
    o = Entity.ofResource(new ModelName("個体"), new Identifier("番号"));
    editPart = factory.createEditPart(null, o);
    assertThat(editPart, instanceOf(EntityEditPart.class));
    o = Laputa.of();
    editPart = factory.createEditPart(null, o);
    assertThat(editPart, instanceOf(LaputaEditPart.class));
    o = new MappingList();
    editPart = factory.createEditPart(null, o);
    assertThat(editPart, instanceOf(MappingListEditPart.class));
    o = ev1.multivalueAnd().superset();
    editPart = factory.createEditPart(null, o);
    assertThat(editPart, instanceOf(MultivalueAndSupersetEditPart.class));
    Entity ev2 = Entity.ofEvent(new Identifier("イベント番号"));
    ev2.multivalueOr().builder().typeName("テスト種別").build();
    o = ev2.multivalueOr().query().findByName(new ModelName("イベント.テスト種別")).get(0);
    editPart = factory.createEditPart(null, o);
    assertThat(editPart, instanceOf(MultivalueOrEditPart.class));
    o = new RecursiveTable();
    editPart = factory.createEditPart(null, o);
    assertThat(editPart, instanceOf(RecursiveTableEditPart.class));
    Entity e = Entity.ofResource(new Identifier("親ID"));
    e.subsets().builder().add(new ModelName("サブセット")).build();
    o = e.subsets().query().findByName(new ModelName("サブセット")).get(0);
    editPart = factory.createEditPart(null, o);
    assertThat(editPart, instanceOf(SubsetEntityEditPart.class));
    ModelName searchName = new ModelName("みなし");
    e.virtualEntities().builder().virtualEntityName(searchName).build();
    o = e.virtualEntities().query().findByName(searchName).get(0);
    editPart = factory.createEditPart(null, o);
    assertThat(editPart, instanceOf(VirtualEntityEditPart.class));
    o = VirtualSuperset.of(new ModelName("スーパーセット"));
    editPart = factory.createEditPart(null, o);
    assertThat(editPart, instanceOf(VirtualSupersetEditPart.class));
    o = new RecursiveRelationship(e1);
    editPart = factory.createEditPart(null, o);
    assertThat(editPart, instanceOf(RecursiveRelationshipEditPart.class));
    o = new Event2EventRelationship(e1, e2);
    editPart = factory.createEditPart(null, o);
    assertThat(editPart, instanceOf(RelationshipEditPart.class));
    Entity2SubsetTypeRelationship r1 = new Entity2SubsetTypeRelationship(e1);
    r1.connect();
    editPart = factory.createEditPart(null, r1);
    assertThat(editPart, instanceOf(Entity2SubsetTypeRelationshipEditPart.class));
    o = (Entity2VirtualSupersetTypeRelationship) vtype.getModelTargetConnections().get(0);
    editPart = factory.createEditPart(null, o);
    assertThat(editPart, instanceOf(RelatedRelationshipEditPart.class));
    o = ev1.multivalueAnd().aggregator();
    editPart = factory.createEditPart(null, o);
    assertThat(editPart, instanceOf(MultivalueAndAggregatorEditPart.class));
    o = new RelatedRelationship(e1, e2);
    editPart = factory.createEditPart(null, o);
    assertThat(editPart, instanceOf(RelatedRelationshipEditPart.class));
    Entity2SubsetTypeRelationship r2 = new Entity2SubsetTypeRelationship(null);
    editPart = factory.createEditPart(null, r2.getSubsetType());
    assertThat(editPart, instanceOf(SubsetTypeEditPart.class));
    o = vtype;
    editPart = factory.createEditPart(null, o);
    assertThat(editPart, instanceOf(VirtualSupersetTypeEditPart.class));
    o = new ModelElement();
    editPart = factory.createEditPart(null, o);
    assertThat(editPart, nullValue());
// TODO 必要になったらaccept(IVisitor)メソッドをIdentifierRefでoverrideする
// o = new IdentifierRef(e1.getIdentifier());
// editPart = factory.createEditPart(null, o);
// assertThat(editPart, nullValue());
// TODO 必要になったらaccept(IVisitor)メソッドをIdentifierでoverrideする
// Identifier i = e1.getIdentifier();
// editPart = factory.createEditPart(null, i);
// assertThat(editPart, nullValue());
}
Also used : RecursiveRelationshipEditPart(org.tmdmaker.ui.editor.gef3.editparts.relationship.RecursiveRelationshipEditPart) Entity(org.tmdmaker.core.model.Entity) LaputaEditPart(org.tmdmaker.ui.editor.gef3.editparts.node.LaputaEditPart) MultivalueOrEditPart(org.tmdmaker.ui.editor.gef3.editparts.node.MultivalueOrEditPart) RecursiveRelationship(org.tmdmaker.core.model.RecursiveRelationship) Attribute(org.tmdmaker.core.model.Attribute) Entity2SubsetTypeRelationship(org.tmdmaker.core.model.Entity2SubsetTypeRelationship) VirtualSupersetTypeEditPart(org.tmdmaker.ui.editor.gef3.editparts.node.VirtualSupersetTypeEditPart) SubsetEntityEditPart(org.tmdmaker.ui.editor.gef3.editparts.node.SubsetEntityEditPart) ModelElement(org.tmdmaker.core.model.ModelElement) RecursiveTableEditPart(org.tmdmaker.ui.editor.gef3.editparts.node.RecursiveTableEditPart) Identifier(org.tmdmaker.core.model.Identifier) Event2EventRelationship(org.tmdmaker.core.model.Event2EventRelationship) RecursiveTable(org.tmdmaker.core.model.RecursiveTable) EntityEditPart(org.tmdmaker.ui.editor.gef3.editparts.node.EntityEditPart) SubsetEntityEditPart(org.tmdmaker.ui.editor.gef3.editparts.node.SubsetEntityEditPart) VirtualEntityEditPart(org.tmdmaker.ui.editor.gef3.editparts.node.VirtualEntityEditPart) MultivalueAndAggregatorEditPart(org.tmdmaker.ui.editor.gef3.editparts.node.MultivalueAndAggregatorEditPart) SubsetTypeEditPart(org.tmdmaker.ui.editor.gef3.editparts.node.SubsetTypeEditPart) MultivalueAndSupersetEditPart(org.tmdmaker.ui.editor.gef3.editparts.node.MultivalueAndSupersetEditPart) VirtualEntityEditPart(org.tmdmaker.ui.editor.gef3.editparts.node.VirtualEntityEditPart) MappingListEditPart(org.tmdmaker.ui.editor.gef3.editparts.node.MappingListEditPart) ModelName(org.tmdmaker.core.model.parts.ModelName) AbstractRelationship(org.tmdmaker.core.model.AbstractRelationship) DetailEditPart(org.tmdmaker.ui.editor.gef3.editparts.node.DetailEditPart) DiagramEditPart(org.tmdmaker.ui.editor.gef3.editparts.DiagramEditPart) MultivalueOrEditPart(org.tmdmaker.ui.editor.gef3.editparts.node.MultivalueOrEditPart) MultivalueAndAggregatorEditPart(org.tmdmaker.ui.editor.gef3.editparts.node.MultivalueAndAggregatorEditPart) RelationshipEditPart(org.tmdmaker.ui.editor.gef3.editparts.relationship.RelationshipEditPart) Entity2SubsetTypeRelationshipEditPart(org.tmdmaker.ui.editor.gef3.editparts.relationship.Entity2SubsetTypeRelationshipEditPart) AttributeEditPart(org.tmdmaker.ui.editor.gef3.editparts.node.AttributeEditPart) RecursiveRelationshipEditPart(org.tmdmaker.ui.editor.gef3.editparts.relationship.RecursiveRelationshipEditPart) RelatedRelationshipEditPart(org.tmdmaker.ui.editor.gef3.editparts.relationship.RelatedRelationshipEditPart) VirtualSupersetEditPart(org.tmdmaker.ui.editor.gef3.editparts.node.VirtualSupersetEditPart) EntityEditPart(org.tmdmaker.ui.editor.gef3.editparts.node.EntityEditPart) MultivalueAndSupersetEditPart(org.tmdmaker.ui.editor.gef3.editparts.node.MultivalueAndSupersetEditPart) EditPart(org.eclipse.gef.EditPart) MappingListEditPart(org.tmdmaker.ui.editor.gef3.editparts.node.MappingListEditPart) SubsetEntityEditPart(org.tmdmaker.ui.editor.gef3.editparts.node.SubsetEntityEditPart) SubsetTypeEditPart(org.tmdmaker.ui.editor.gef3.editparts.node.SubsetTypeEditPart) CombinationTableEditPart(org.tmdmaker.ui.editor.gef3.editparts.node.CombinationTableEditPart) RecursiveTableEditPart(org.tmdmaker.ui.editor.gef3.editparts.node.RecursiveTableEditPart) VirtualEntityEditPart(org.tmdmaker.ui.editor.gef3.editparts.node.VirtualEntityEditPart) LaputaEditPart(org.tmdmaker.ui.editor.gef3.editparts.node.LaputaEditPart) VirtualSupersetTypeEditPart(org.tmdmaker.ui.editor.gef3.editparts.node.VirtualSupersetTypeEditPart) MappingList(org.tmdmaker.core.model.MappingList) Entity2SubsetTypeRelationshipEditPart(org.tmdmaker.ui.editor.gef3.editparts.relationship.Entity2SubsetTypeRelationshipEditPart) RelatedRelationshipEditPart(org.tmdmaker.ui.editor.gef3.editparts.relationship.RelatedRelationshipEditPart) Diagram(org.tmdmaker.core.model.Diagram) CombinationTableEditPart(org.tmdmaker.ui.editor.gef3.editparts.node.CombinationTableEditPart) AttributeEditPart(org.tmdmaker.ui.editor.gef3.editparts.node.AttributeEditPart) DiagramEditPart(org.tmdmaker.ui.editor.gef3.editparts.DiagramEditPart) RelationshipEditPart(org.tmdmaker.ui.editor.gef3.editparts.relationship.RelationshipEditPart) Entity2SubsetTypeRelationshipEditPart(org.tmdmaker.ui.editor.gef3.editparts.relationship.Entity2SubsetTypeRelationshipEditPart) RecursiveRelationshipEditPart(org.tmdmaker.ui.editor.gef3.editparts.relationship.RecursiveRelationshipEditPart) RelatedRelationshipEditPart(org.tmdmaker.ui.editor.gef3.editparts.relationship.RelatedRelationshipEditPart) VirtualSupersetEditPart(org.tmdmaker.ui.editor.gef3.editparts.node.VirtualSupersetEditPart) RelatedRelationship(org.tmdmaker.core.model.RelatedRelationship) DetailEditPart(org.tmdmaker.ui.editor.gef3.editparts.node.DetailEditPart) Test(org.junit.Test)

Example 3 with Entity2SubsetTypeRelationship

use of org.tmdmaker.core.model.Entity2SubsetTypeRelationship in project tmdmaker by tmdmaker.

the class SubsetTest method testRemoveSubset.

@Test
public void testRemoveSubset() {
    SubsetType subsetType = e1.findSubsetType();
    SubsetEntity s1 = subsetType.getSubsetList().get(0);
    SubsetEntity s2 = subsetType.getSubsetList().get(1);
    assertEquals(true, s1.isDeletable());
    assertEquals(true, s2.isDeletable());
    assertEquals(true, s1.getModelTargetConnections().get(0).isDeletable());
    assertEquals(true, s2.getModelTargetConnections().get(0).isDeletable());
    s2.getModelTargetConnections().get(0).isDeletable();
    s1.getModelTargetConnections().get(0).disconnect();
    s2.getModelTargetConnections().get(0).disconnect();
    assertEquals(false, subsetType.hasSubsetEntity());
    AbstractConnectionModel r1 = subsetType.getModelTargetConnections().get(0);
    assertEquals(true, r1 instanceof Entity2SubsetTypeRelationship);
    Entity2SubsetTypeRelationship r2 = (Entity2SubsetTypeRelationship) r1;
    assertEquals(true, r2.isDeletable());
    r2.disconnect();
    assertEquals(true, subsetType.isInitialPosition());
}
Also used : SubsetEntity(org.tmdmaker.core.model.SubsetEntity) SubsetType(org.tmdmaker.core.model.SubsetType) Entity2SubsetTypeRelationship(org.tmdmaker.core.model.Entity2SubsetTypeRelationship) AbstractConnectionModel(org.tmdmaker.core.model.AbstractConnectionModel) Test(org.junit.Test)

Example 4 with Entity2SubsetTypeRelationship

use of org.tmdmaker.core.model.Entity2SubsetTypeRelationship in project tmdmaker by tmdmaker.

the class Patch023SerializerHandler method convertRelatedRelationships.

private void convertRelatedRelationships(List<AbstractConnectionModel> connections) {
    AnchorConstraintMigrator converter = new AnchorConstraintMigrator();
    for (AbstractConnectionModel c : connections) {
        if (c instanceof RelatedRelationship) {
            logger.debug("convertRelatedRelationships():{}", c);
            converter.convertNullLocationPoint(c);
        }
        if (c instanceof Entity2SubsetTypeRelationship) {
            logger.debug("convertEntity2SubsetTypeRelationships():{}", c);
            converter.convertNullLocationPoint(c);
        }
    }
}
Also used : RelatedRelationship(org.tmdmaker.core.model.RelatedRelationship) Entity2SubsetTypeRelationship(org.tmdmaker.core.model.Entity2SubsetTypeRelationship) AbstractConnectionModel(org.tmdmaker.core.model.AbstractConnectionModel)

Example 5 with Entity2SubsetTypeRelationship

use of org.tmdmaker.core.model.Entity2SubsetTypeRelationship in project tmdmaker by tmdmaker.

the class SubsetTest method testPartision.

@Test
public void testPartision() {
    SubsetType subsetType = e1.findSubsetType();
    Attribute a1 = new Attribute("テスト属性1");
    subsetType.setPartitionAttribute(a1);
    assertEquals(a1, subsetType.getPartitionAttribute());
    Attribute a2 = new Attribute("テスト属性2");
    subsetType.setPartitionAttribute(a2);
    assertEquals(a2, subsetType.getPartitionAttribute());
    Entity2SubsetTypeRelationship r1 = subsetType.getEntityRelationship();
    assertEquals("テスト属性2", r1.getPartitionAttributeName());
    subsetType.setExceptNull(true);
    assertEquals("NULL(テスト属性2)", r1.getPartitionAttributeName());
    assertThat(r1.isDeletable(), is(true));
    subsetType.setPartitionAttribute(null);
    assertEquals("", r1.getPartitionAttributeName());
}
Also used : Attribute(org.tmdmaker.core.model.Attribute) SubsetType(org.tmdmaker.core.model.SubsetType) Entity2SubsetTypeRelationship(org.tmdmaker.core.model.Entity2SubsetTypeRelationship) Test(org.junit.Test)

Aggregations

Entity2SubsetTypeRelationship (org.tmdmaker.core.model.Entity2SubsetTypeRelationship)5 Test (org.junit.Test)3 AbstractConnectionModel (org.tmdmaker.core.model.AbstractConnectionModel)2 Attribute (org.tmdmaker.core.model.Attribute)2 RelatedRelationship (org.tmdmaker.core.model.RelatedRelationship)2 SubsetType (org.tmdmaker.core.model.SubsetType)2 EditPart (org.eclipse.gef.EditPart)1 AbstractRelationship (org.tmdmaker.core.model.AbstractRelationship)1 Diagram (org.tmdmaker.core.model.Diagram)1 Entity (org.tmdmaker.core.model.Entity)1 Event2EventRelationship (org.tmdmaker.core.model.Event2EventRelationship)1 Identifier (org.tmdmaker.core.model.Identifier)1 MappingList (org.tmdmaker.core.model.MappingList)1 ModelElement (org.tmdmaker.core.model.ModelElement)1 RecursiveRelationship (org.tmdmaker.core.model.RecursiveRelationship)1 RecursiveTable (org.tmdmaker.core.model.RecursiveTable)1 SubsetEntity (org.tmdmaker.core.model.SubsetEntity)1 ModelName (org.tmdmaker.core.model.parts.ModelName)1 DiagramEditPart (org.tmdmaker.ui.editor.gef3.editparts.DiagramEditPart)1 AttributeEditPart (org.tmdmaker.ui.editor.gef3.editparts.node.AttributeEditPart)1