diff --git a/src/net/sourceforge/plantuml/cheneer/ChenEerDiagramFactory.java b/src/net/sourceforge/plantuml/cheneer/ChenEerDiagramFactory.java index 5c23db469..f7a31bc29 100644 --- a/src/net/sourceforge/plantuml/cheneer/ChenEerDiagramFactory.java +++ b/src/net/sourceforge/plantuml/cheneer/ChenEerDiagramFactory.java @@ -59,8 +59,8 @@ public class ChenEerDiagramFactory extends PSystemCommandFactory { @Override protected void initCommandsList(List cmds) { cmds.add(new CommandCreateEntity()); - cmds.add(new CommandCreateAttribute()); cmds.add(new CommandCreateRelationship()); + cmds.add(new CommandCreateAttribute()); cmds.add(new CommandAssociateRelationship()); cmds.add(new CommandEndGroup()); diff --git a/src/net/sourceforge/plantuml/cheneer/command/CommandAssociateRelationship.java b/src/net/sourceforge/plantuml/cheneer/command/CommandAssociateRelationship.java index 4a030d358..6b8362c2a 100644 --- a/src/net/sourceforge/plantuml/cheneer/command/CommandAssociateRelationship.java +++ b/src/net/sourceforge/plantuml/cheneer/command/CommandAssociateRelationship.java @@ -61,37 +61,41 @@ public class CommandAssociateRelationship extends SingleLineCommand2 quark1 = diagram.quarkInContext(true, name1); + final Entity entity1 = quark1.getData(); + if (entity1 == null) { + return CommandExecutionResult.error("No such entity: " + name1); } - final String entityName = diagram.cleanId(arg.get("NAME", 0)); - - final Quark entityQuark = diagram.quarkInContext(true, entityName); - final Entity entity = entityQuark.getData(); - if (entity == null) { - return CommandExecutionResult.error("No such entity: " + entityName); + final Quark quark2 = diagram.quarkInContext(true, name2); + final Entity entity2 = quark2.getData(); + if (entity2 == null) { + return CommandExecutionResult.error("No such entity: " + name2); } final LinkType linkType = new LinkType(LinkDecor.NONE, LinkDecor.NONE); - final Link link = new Link(diagram.getEntityFactory(), diagram.getCurrentStyleBuilder(), relationship, entity, + final Link link = new Link(diagram.getEntityFactory(), diagram.getCurrentStyleBuilder(), entity1, entity2, linkType, // TODO: Cardinality LinkArg.build(Display.NULL, 3)); - link.setPortMembers(diagram.getPortId(relationship.getName()), diagram.getPortId(entity.getName())); + link.setPortMembers(diagram.getPortId(entity1.getName()), diagram.getPortId(entity2.getName())); diagram.addLink(link); return CommandExecutionResult.ok(); diff --git a/src/net/sourceforge/plantuml/cheneer/command/CommandCreateAttribute.java b/src/net/sourceforge/plantuml/cheneer/command/CommandCreateAttribute.java index 206760d11..481ad58ae 100644 --- a/src/net/sourceforge/plantuml/cheneer/command/CommandCreateAttribute.java +++ b/src/net/sourceforge/plantuml/cheneer/command/CommandCreateAttribute.java @@ -63,27 +63,11 @@ public class CommandCreateAttribute extends SingleLineCommand2 { private static IRegex getRegexConcat() { return RegexConcat.build(CommandCreateEntity.class.getName(), RegexLeaf.start(), // RegexLeaf.spaceZeroOrMore(), - new RegexOptional( // - new RegexConcat( // - new RegexLeaf("MULTI", "multi"), // - RegexLeaf.spaceOneOrMore())), // - new RegexOptional( // - new RegexConcat( // - new RegexLeaf("DERIVED", "derived"), // - RegexLeaf.spaceOneOrMore())), // - new RegexOptional( // - new RegexConcat( // - new RegexOptional( // - new RegexConcat( // - new RegexLeaf("PARTIAL", "partial"), // - RegexLeaf.spaceOneOrMore())), - new RegexLeaf("KEY", "key"), // - RegexLeaf.spaceOneOrMore())), // - new RegexOptional( // - new RegexConcat( // - new RegexLeaf("attr(:?ibute)?"), // - RegexLeaf.spaceOneOrMore())), // - new RegexLeaf("NAME", "(\\w+)"), // + new RegexLeaf("NAME", "([^<>{}-]+)"), // + new RegexOptional(// + new RegexConcat( + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("STEREOTYPE", "(<<.+>>)"))), // new RegexOptional(// new RegexConcat( // RegexLeaf.spaceZeroOrMore(), // @@ -104,6 +88,8 @@ public class CommandCreateAttribute extends SingleLineCommand2 { final String id = owner.getName() + "/" + name; final boolean composite = arg.get("COMPOSITE", 0) != null; + // TODO: stereotypes: multi, derived, key, partial key + final Quark quark = diagram.quarkInContext(true, id); Entity entity = quark.getData();