1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-24 13:57:33 +00:00

Support long name and alias in Chen-EER

This commit is contained in:
Benjamin Davies 2024-03-16 18:42:55 +13:00
parent 8312e8c22f
commit 90a88ce4ee
No known key found for this signature in database
GPG Key ID: 9FFDE0674336C460
5 changed files with 281 additions and 257 deletions

View File

@ -55,54 +55,54 @@ import net.sourceforge.plantuml.utils.LineLocation;
public class CommandAssociate extends SingleLineCommand2<ChenEerDiagram> {
public CommandAssociate() {
super(getRegexConcat());
}
public CommandAssociate() {
super(getRegexConcat());
}
private static IRegex getRegexConcat() {
return RegexConcat.build(CommandCreateEntity.class.getName(), RegexLeaf.start(), //
new RegexLeaf("NAME1", "([\\w-]+)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("PARTICIPATION", "([-=])"), //
new RegexOptional( //
new RegexLeaf("CARDINALITY", "(\\w+|\\(\\w+,[%s]*\\w+\\))")), //
new RegexLeaf("PARTICIPATION2", "([-=])"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("NAME2", "([\\w-]+)"), //
RegexLeaf.end());
}
private static IRegex getRegexConcat() {
return RegexConcat.build(CommandCreateEntity.class.getName(), RegexLeaf.start(), //
new RegexLeaf("NAME1", "([\\w-]+)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("PARTICIPATION", "([-=])"), //
new RegexOptional( //
new RegexLeaf("CARDINALITY", "(\\w+|\\(\\w+,[%s]*\\w+\\))")), //
new RegexLeaf("PARTICIPATION2", "([-=])"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("NAME2", "([\\w-]+)"), //
RegexLeaf.end());
}
@Override
protected CommandExecutionResult executeArg(ChenEerDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final String name1 = diagram.cleanId(arg.get("NAME1", 0));
final String name2 = diagram.cleanId(arg.get("NAME2", 0));
final boolean isDouble = arg.get("PARTICIPATION", 0).equals("=");
final String cardinality = arg.get("CARDINALITY", 0);
@Override
protected CommandExecutionResult executeArg(ChenEerDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final String name1 = diagram.cleanId(arg.get("NAME1", 0));
final String name2 = diagram.cleanId(arg.get("NAME2", 0));
final boolean isDouble = arg.get("PARTICIPATION", 0).equals("=");
final String cardinality = arg.get("CARDINALITY", 0);
final Quark<Entity> quark1 = diagram.quarkInContext(true, name1);
final Entity entity1 = quark1.getData();
if (entity1 == null) {
return CommandExecutionResult.error("No such entity: " + name1);
}
final Quark<Entity> quark1 = diagram.quarkInContext(true, name1);
final Entity entity1 = quark1.getData();
if (entity1 == null) {
return CommandExecutionResult.error("No such entity: " + name1);
}
final Quark<Entity> quark2 = diagram.quarkInContext(true, name2);
final Entity entity2 = quark2.getData();
if (entity2 == null) {
return CommandExecutionResult.error("No such entity: " + name2);
}
final Quark<Entity> quark2 = diagram.quarkInContext(true, name2);
final Entity entity2 = quark2.getData();
if (entity2 == null) {
return CommandExecutionResult.error("No such entity: " + name2);
}
LinkType linkType = new LinkType(LinkDecor.NONE, LinkDecor.NONE);
if (isDouble) {
linkType = linkType.goBold();
}
final Link link = new Link(diagram.getEntityFactory(), diagram.getCurrentStyleBuilder(), entity1, entity2,
linkType,
LinkArg.build(Display.getWithNewlines(cardinality), 3));
link.setPortMembers(diagram.getPortId(entity1.getName()), diagram.getPortId(entity2.getName()));
diagram.addLink(link);
LinkType linkType = new LinkType(LinkDecor.NONE, LinkDecor.NONE);
if (isDouble) {
linkType = linkType.goBold();
}
final Link link = new Link(diagram.getEntityFactory(), diagram.getCurrentStyleBuilder(), entity1, entity2,
linkType,
LinkArg.build(Display.getWithNewlines(cardinality), 3));
link.setPortMembers(diagram.getPortId(entity1.getName()), diagram.getPortId(entity2.getName()));
diagram.addLink(link);
return CommandExecutionResult.ok();
}
return CommandExecutionResult.ok();
}
}

View File

@ -5,12 +5,12 @@
* (C) Copyright 2009-2024, Arnaud Roques
*
* Project Info: https://plantuml.com
*
*
* If you like this project or if you find it useful, you can support us at:
*
*
* https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/paypal
*
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
@ -30,7 +30,7 @@
*
*
* Original Author: Arnaud Roques
*
*
*
*/
package net.sourceforge.plantuml.cheneer.command;
@ -50,66 +50,77 @@ import net.sourceforge.plantuml.plasma.Quark;
import net.sourceforge.plantuml.regex.IRegex;
import net.sourceforge.plantuml.regex.RegexConcat;
import net.sourceforge.plantuml.regex.RegexLeaf;
import net.sourceforge.plantuml.regex.RegexOptional;
import net.sourceforge.plantuml.regex.RegexResult;
import net.sourceforge.plantuml.stereo.Stereotype;
import net.sourceforge.plantuml.utils.LineLocation;
public class CommandCreateAttribute extends SingleLineCommand2<ChenEerDiagram> {
public CommandCreateAttribute() {
super(getRegexConcat());
}
public CommandCreateAttribute() {
super(getRegexConcat());
}
private static IRegex getRegexConcat() {
return RegexConcat.build(CommandCreateEntity.class.getName(), RegexLeaf.start(), //
RegexLeaf.spaceZeroOrMore(),
new RegexLeaf("NAME", "([^<>{}=-]+)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(<<.*>>)?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("COMPOSITE", "(\\{)?"), //
RegexLeaf.end());
}
private static IRegex getRegexConcat() {
return RegexConcat.build(CommandCreateEntity.class.getName(), RegexLeaf.start(), //
RegexLeaf.spaceZeroOrMore(),
new RegexOptional( // Copied from CommandCreatePackageBlock
new RegexConcat( //
new RegexLeaf("DISPLAY", "[%g]([^%g]+)[%g]"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("as"), //
RegexLeaf.spaceOneOrMore() //
)), //
new RegexLeaf("CODE", "([%pLN%s_.:<>]+)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(<<.*>>)?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("COMPOSITE", "(\\{)?"), //
RegexLeaf.end());
}
@Override
protected CommandExecutionResult executeArg(ChenEerDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final Entity owner = diagram.peekOwner();
if (owner == null) {
return CommandExecutionResult.error("Attribute must be inside an entity, relationship or another attribute");
}
@Override
protected CommandExecutionResult executeArg(ChenEerDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final Entity owner = diagram.peekOwner();
if (owner == null) {
return CommandExecutionResult.error("Attribute must be inside an entity, relationship or another attribute");
}
final LeafType type = LeafType.CHEN_ATTRIBUTE;
final String name = diagram.cleanId(arg.get("NAME", 0).trim());
final String id = owner.getName() + "/" + name;
final String stereo = arg.get("STEREO", 0);
final boolean composite = arg.get("COMPOSITE", 0) != null;
final LeafType type = LeafType.CHEN_ATTRIBUTE;
final String idShort = diagram.cleanId(arg.get("CODE", 0).trim());
final String id = owner.getName() + "/" + idShort;
final Quark<Entity> quark = diagram.quarkInContext(true, id);
String displayText = arg.get("DISPLAY", 0);
if (displayText == null)
displayText = quark.getName();
final Quark<Entity> quark = diagram.quarkInContext(true, id);
final String stereo = arg.get("STEREO", 0);
final boolean composite = arg.get("COMPOSITE", 0) != null;
Entity entity = quark.getData();
if (entity == null) {
final Display display = Display.getWithNewlines(name);
entity = diagram.reallyCreateLeaf(quark, display, type, null);
} else {
return CommandExecutionResult.error("Attribute already exists");
}
Entity entity = quark.getData();
if (entity == null) {
final Display display = Display.getWithNewlines(displayText);
entity = diagram.reallyCreateLeaf(quark, display, type, null);
} else {
return CommandExecutionResult.error("Attribute already exists");
}
if (stereo != null) {
entity.setStereotype(Stereotype.build(stereo));
entity.setStereostyle(stereo);
}
if (stereo != null) {
entity.setStereotype(Stereotype.build(stereo));
entity.setStereostyle(stereo);
}
final LinkType linkType = new LinkType(LinkDecor.NONE, LinkDecor.NONE);
final Link link = new Link(diagram.getEntityFactory(), diagram.getCurrentStyleBuilder(), entity, owner, linkType,
LinkArg.build(Display.NULL, 2));
diagram.addLink(link);
final LinkType linkType = new LinkType(LinkDecor.NONE, LinkDecor.NONE);
final Link link = new Link(diagram.getEntityFactory(), diagram.getCurrentStyleBuilder(), entity, owner, linkType,
LinkArg.build(Display.NULL, 2));
diagram.addLink(link);
if (composite) {
diagram.pushOwner(entity);
}
if (composite) {
diagram.pushOwner(entity);
}
return CommandExecutionResult.ok();
}
return CommandExecutionResult.ok();
}
}

View File

@ -5,12 +5,12 @@
* (C) Copyright 2009-2024, Arnaud Roques
*
* Project Info: https://plantuml.com
*
*
* If you like this project or if you find it useful, you can support us at:
*
*
* https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/paypal
*
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
@ -30,7 +30,7 @@
*
*
* Original Author: Arnaud Roques
*
*
*
*/
package net.sourceforge.plantuml.cheneer.command;
@ -46,65 +46,78 @@ import net.sourceforge.plantuml.plasma.Quark;
import net.sourceforge.plantuml.regex.IRegex;
import net.sourceforge.plantuml.regex.RegexConcat;
import net.sourceforge.plantuml.regex.RegexLeaf;
import net.sourceforge.plantuml.regex.RegexOptional;
import net.sourceforge.plantuml.regex.RegexOr;
import net.sourceforge.plantuml.regex.RegexResult;
import net.sourceforge.plantuml.stereo.Stereotype;
import net.sourceforge.plantuml.utils.LineLocation;
public class CommandCreateEntity extends SingleLineCommand2<ChenEerDiagram> {
public CommandCreateEntity() {
super(getRegexConcat());
}
public CommandCreateEntity() {
super(getRegexConcat());
}
private static IRegex getRegexConcat() {
return RegexConcat.build(CommandCreateEntity.class.getName(), RegexLeaf.start(), //
new RegexLeaf("TYPE", "(entity|relationship)"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("NAME", "([^<>{}]+)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(<<.+>>)?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("\\{"), //
RegexLeaf.end());
}
private static IRegex getRegexConcat() {
return RegexConcat.build(CommandCreateEntity.class.getName(), RegexLeaf.start(), //
new RegexLeaf("TYPE", "(entity|relationship)"), //
RegexLeaf.spaceOneOrMore(), //
new RegexOptional( // Copied from CommandCreatePackageBlock
new RegexConcat( //
new RegexLeaf("DISPLAY", "[%g]([^%g]+)[%g]"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("as"), //
RegexLeaf.spaceOneOrMore() //
)), //
new RegexLeaf("CODE", "([%pLN_.]+)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(<<.+>>)?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("\\{"), //
RegexLeaf.end());
}
@Override
protected CommandExecutionResult executeArg(ChenEerDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
LeafType type;
switch (arg.get("TYPE", 0)) {
case "entity":
type = LeafType.CHEN_ENTITY;
break;
case "relationship":
type = LeafType.CHEN_RELATIONSHIP;
break;
default:
throw new IllegalStateException();
}
@Override
protected CommandExecutionResult executeArg(ChenEerDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
LeafType type;
switch (arg.get("TYPE", 0)) {
case "entity":
type = LeafType.CHEN_ENTITY;
break;
case "relationship":
type = LeafType.CHEN_RELATIONSHIP;
break;
default:
throw new IllegalStateException();
}
final String name = diagram.cleanId(arg.get("NAME", 0).trim());
final String stereo = arg.get("STEREO", 0);
final String idShort = arg.get("CODE", 0);
final Quark<Entity> quark = diagram.quarkInContext(true, diagram.cleanId(idShort));
String displayText = arg.get("DISPLAY", 0);
if (displayText == null)
displayText = quark.getName();
final Quark<Entity> quark = diagram.quarkInContext(true, name);
Entity entity = quark.getData();
final String stereo = arg.get("STEREO", 0);
if (entity == null) {
Display display = Display.getWithNewlines(name);
entity = diagram.reallyCreateLeaf(quark, display, type, null);
} else {
if (entity.muteToType(type, null) == false)
return CommandExecutionResult.error("Bad name");
}
Entity entity = quark.getData();
if (stereo != null) {
entity.setStereotype(Stereotype.build(stereo));
entity.setStereostyle(stereo);
}
if (entity == null) {
Display display = Display.getWithNewlines(displayText);
entity = diagram.reallyCreateLeaf(quark, display, type, null);
} else {
if (entity.muteToType(type, null) == false)
return CommandExecutionResult.error("Bad name");
}
diagram.pushOwner(entity);
if (stereo != null) {
entity.setStereotype(Stereotype.build(stereo));
entity.setStereostyle(stereo);
}
return CommandExecutionResult.ok();
}
diagram.pushOwner(entity);
return CommandExecutionResult.ok();
}
}

View File

@ -59,80 +59,80 @@ import net.sourceforge.plantuml.utils.LineLocation;
public class CommandMultiSubclass extends SingleLineCommand2<ChenEerDiagram> {
public CommandMultiSubclass() {
super(getRegexConcat());
}
public CommandMultiSubclass() {
super(getRegexConcat());
}
private static IRegex getRegexConcat() {
return RegexConcat.build(CommandCreateEntity.class.getName(), RegexLeaf.start(), //
new RegexLeaf("SUPERCLASS", "([\\w-]+)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("PARTICIPATION", "([-=])"), //
new RegexLeaf("(>)"), //
new RegexLeaf("PARTICIPATION2", "([-=])"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("SYMBOL", "([doU])"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("\\{"), //
new RegexLeaf("SUBCLASSES", "(.+)"), //
new RegexLeaf("\\}"), //
RegexLeaf.end());
}
private static IRegex getRegexConcat() {
return RegexConcat.build(CommandCreateEntity.class.getName(), RegexLeaf.start(), //
new RegexLeaf("SUPERCLASS", "([\\w-]+)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("PARTICIPATION", "([-=])"), //
new RegexLeaf("(>)"), //
new RegexLeaf("PARTICIPATION2", "([-=])"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("SYMBOL", "([doU])"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("\\{"), //
new RegexLeaf("SUBCLASSES", "(.+)"), //
new RegexLeaf("\\}"), //
RegexLeaf.end());
}
@Override
protected CommandExecutionResult executeArg(ChenEerDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final String superclass = diagram.cleanId(arg.get("SUPERCLASS", 0));
final String subclasses = arg.get("SUBCLASSES", 0);
final List<String> subclassIds = Arrays.stream(subclasses.split(","))
.map(String::trim)
.map(diagram::cleanId)
.collect(Collectors.toList());
final boolean isDouble = arg.get("PARTICIPATION", 0).equals("=");
final String symbol = arg.get("SYMBOL", 0);
@Override
protected CommandExecutionResult executeArg(ChenEerDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final String superclass = diagram.cleanId(arg.get("SUPERCLASS", 0));
final String subclasses = arg.get("SUBCLASSES", 0);
final List<String> subclassIds = Arrays.stream(subclasses.split(","))
.map(String::trim)
.map(diagram::cleanId)
.collect(Collectors.toList());
final boolean isDouble = arg.get("PARTICIPATION", 0).equals("=");
final String symbol = arg.get("SYMBOL", 0);
final Quark<Entity> centerQuark = diagram.quarkInContext(false, superclass + "/" + symbol + subclasses + "/center");
final Entity centerEntity = diagram.reallyCreateLeaf(centerQuark, Display.create(symbol), LeafType.CHEN_CIRCLE, null);
final Quark<Entity> centerQuark = diagram.quarkInContext(false, superclass + "/" + symbol + subclasses + "/center");
final Entity centerEntity = diagram.reallyCreateLeaf(centerQuark, Display.create(symbol), LeafType.CHEN_CIRCLE, null);
final Quark<Entity> superclassQuark = diagram.quarkInContext(true, superclass);
final Entity superclassEntity = superclassQuark.getData();
if (superclassEntity == null) {
return CommandExecutionResult.error("No such entity: " + superclass);
}
final Quark<Entity> superclassQuark = diagram.quarkInContext(true, superclass);
final Entity superclassEntity = superclassQuark.getData();
if (superclassEntity == null) {
return CommandExecutionResult.error("No such entity: " + superclass);
}
LinkType linkType = new LinkType(LinkDecor.NONE, LinkDecor.NONE);
if (isDouble) {
linkType = linkType.goBold();
}
if (symbol.equals("U")) {
linkType = linkType.withMiddleSuperset();
}
final Link link = new Link(diagram.getEntityFactory(), diagram.getCurrentStyleBuilder(), superclassEntity,
centerEntity,
linkType,
LinkArg.build(Display.NULL, 2));
link.setPortMembers(diagram.getPortId(superclassEntity.getName()), diagram.getPortId(centerEntity.getName()));
diagram.addLink(link);
LinkType linkType = new LinkType(LinkDecor.NONE, LinkDecor.NONE);
if (isDouble) {
linkType = linkType.goBold();
}
if (symbol.equals("U")) {
linkType = linkType.withMiddleSuperset();
}
final Link link = new Link(diagram.getEntityFactory(), diagram.getCurrentStyleBuilder(), superclassEntity,
centerEntity,
linkType,
LinkArg.build(Display.NULL, 2));
link.setPortMembers(diagram.getPortId(superclassEntity.getName()), diagram.getPortId(centerEntity.getName()));
diagram.addLink(link);
for (String subclass : subclassIds) {
final Quark<Entity> subclassQuark = diagram.quarkInContext(true, subclass);
final Entity subclassEntity = subclassQuark.getData();
if (subclassEntity == null) {
return CommandExecutionResult.error("No such entity: " + subclass);
}
for (String subclass : subclassIds) {
final Quark<Entity> subclassQuark = diagram.quarkInContext(true, subclass);
final Entity subclassEntity = subclassQuark.getData();
if (subclassEntity == null) {
return CommandExecutionResult.error("No such entity: " + subclass);
}
LinkType subclassLinkType = new LinkType(LinkDecor.NONE, LinkDecor.NONE);
if (!symbol.equals("U")) {
subclassLinkType = subclassLinkType.withMiddleSuperset();
}
final Link subclassLink = new Link(diagram.getEntityFactory(), diagram.getCurrentStyleBuilder(), centerEntity,
subclassEntity,
subclassLinkType,
LinkArg.build(Display.NULL, 3));
diagram.addLink(subclassLink);
}
LinkType subclassLinkType = new LinkType(LinkDecor.NONE, LinkDecor.NONE);
if (!symbol.equals("U")) {
subclassLinkType = subclassLinkType.withMiddleSuperset();
}
final Link subclassLink = new Link(diagram.getEntityFactory(), diagram.getCurrentStyleBuilder(), centerEntity,
subclassEntity,
subclassLinkType,
LinkArg.build(Display.NULL, 3));
diagram.addLink(subclassLink);
}
return CommandExecutionResult.ok();
}
return CommandExecutionResult.ok();
}
}

View File

@ -54,58 +54,58 @@ import net.sourceforge.plantuml.utils.LineLocation;
public class CommandSimpleSubclass extends SingleLineCommand2<ChenEerDiagram> {
public CommandSimpleSubclass() {
super(getRegexConcat());
}
public CommandSimpleSubclass() {
super(getRegexConcat());
}
private static IRegex getRegexConcat() {
return RegexConcat.build(CommandCreateEntity.class.getName(), RegexLeaf.start(), //
new RegexLeaf("NAME1", "([\\w-]+)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("PARTICIPATION", "([-=])"), //
new RegexLeaf("DIRECTION", "([<>])"), //
new RegexLeaf("PARTICIPATION2", "([-=])"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("NAME2", "([\\w-]+)"), //
RegexLeaf.end());
}
private static IRegex getRegexConcat() {
return RegexConcat.build(CommandCreateEntity.class.getName(), RegexLeaf.start(), //
new RegexLeaf("NAME1", "([\\w-]+)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("PARTICIPATION", "([-=])"), //
new RegexLeaf("DIRECTION", "([<>])"), //
new RegexLeaf("PARTICIPATION2", "([-=])"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("NAME2", "([\\w-]+)"), //
RegexLeaf.end());
}
@Override
protected CommandExecutionResult executeArg(ChenEerDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
String name1 = diagram.cleanId(arg.get("NAME1", 0));
String name2 = diagram.cleanId(arg.get("NAME2", 0));
final boolean isDouble = arg.get("PARTICIPATION", 0).equals("=");
final boolean isSuperset = arg.get("DIRECTION", 0).equals(">");
@Override
protected CommandExecutionResult executeArg(ChenEerDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
String name1 = diagram.cleanId(arg.get("NAME1", 0));
String name2 = diagram.cleanId(arg.get("NAME2", 0));
final boolean isDouble = arg.get("PARTICIPATION", 0).equals("=");
final boolean isSuperset = arg.get("DIRECTION", 0).equals(">");
final Quark<Entity> quark1 = diagram.quarkInContext(true, name1);
final Entity entity1 = quark1.getData();
if (entity1 == null) {
return CommandExecutionResult.error("No such entity: " + name1);
}
final Quark<Entity> quark1 = diagram.quarkInContext(true, name1);
final Entity entity1 = quark1.getData();
if (entity1 == null) {
return CommandExecutionResult.error("No such entity: " + name1);
}
final Quark<Entity> quark2 = diagram.quarkInContext(true, name2);
final Entity entity2 = quark2.getData();
if (entity2 == null) {
return CommandExecutionResult.error("No such entity: " + name2);
}
final Quark<Entity> quark2 = diagram.quarkInContext(true, name2);
final Entity entity2 = quark2.getData();
if (entity2 == null) {
return CommandExecutionResult.error("No such entity: " + name2);
}
LinkType linkType = new LinkType(LinkDecor.NONE, LinkDecor.NONE);
if (isDouble) {
linkType = linkType.goBold();
}
if (isSuperset) {
linkType = linkType.withMiddleSuperset();
} else {
linkType = linkType.withMiddleSubset();
}
final Link link = new Link(diagram.getEntityFactory(), diagram.getCurrentStyleBuilder(), entity1, entity2,
linkType,
LinkArg.build(Display.NULL, 3));
link.setPortMembers(diagram.getPortId(entity1.getName()), diagram.getPortId(entity2.getName()));
diagram.addLink(link);
LinkType linkType = new LinkType(LinkDecor.NONE, LinkDecor.NONE);
if (isDouble) {
linkType = linkType.goBold();
}
if (isSuperset) {
linkType = linkType.withMiddleSuperset();
} else {
linkType = linkType.withMiddleSubset();
}
final Link link = new Link(diagram.getEntityFactory(), diagram.getCurrentStyleBuilder(), entity1, entity2,
linkType,
LinkArg.build(Display.NULL, 3));
link.setPortMembers(diagram.getPortId(entity1.getName()), diagram.getPortId(entity2.getName()));
diagram.addLink(link);
return CommandExecutionResult.ok();
}
return CommandExecutionResult.ok();
}
}