# Memento Pattern for BPMN Shapes

**URL:** <https://forum.camunda.io/t/memento-pattern-for-bpmn-shapes/16858>\
**Category:** Discussion & Questions\
**Created:** [December 15, 2019, 5:29pm UTC](https://forum.camunda.io/t/memento-pattern-for-bpmn-shapes/16858 "2019-12-15T17:29:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Einstein](https://forum.camunda.io/user_avatar/forum.camunda.io/einstein/32/8157_2.png) [@Einstein](https://forum.camunda.io/u/Einstein)\
**Post date:** [December 15, 2019, 5:29pm UTC](https://forum.camunda.io/t/memento-pattern-for-bpmn-shapes/16858/1 "2019-12-15T17:29:33Z")

</div>

Hey,

what would be the easiest way to save and restore Diagram JS Shapes programatically in the modeler? I’m writing a plugin that creates its own shapes and deletes them for our use case. I also want to be able to “pack” shapes into a parent shape which should also be able to restore them at will.

Right now I’ve written a solution that simply extends the parent shape and stores the needed data as BPMN Extension fields. The problem with that approach is that meta information like placement and incoming and outgoing flows are lost on packing and unpacking.

Would there be a simpler solution to this problem?

Best regards

Crosslink to [bpmn.io](http://bpmn.io) forums: [Memento Pattern for BPMN Shapes - Modeler - Forum - bpmn.io](https://forum.bpmn.io/t/memento-pattern-for-bpmn-shapes/4217)

---

<div class="post-metadata">

**Author:** ![Niall](https://forum.camunda.io/user_avatar/forum.camunda.io/niall/32/15333_2.png) [@Niall](https://forum.camunda.io/u/Niall)\
**Post date:** [December 16, 2019, 7:20am UTC](https://forum.camunda.io/t/memento-pattern-for-bpmn-shapes/16858/2 "2019-12-16T07:20:34Z")

</div>

Sounds like a question that’s best asked on the [bpmn.io forum](https://forum.bpmn.io/) feel free to post here a link to any answer you get on that forum 🙂

---

<div class="post-metadata">

**Author:** ![system](https://forum.camunda.io/uploads/default/original/3X/5/8/58d50142eacca605d35cb1ef9e6b86ae85f49436.png) [@system](https://forum.camunda.io/u/system)\
**Post date:** [January 30, 2024, 12:06pm UTC](https://forum.camunda.io/t/memento-pattern-for-bpmn-shapes/16858/3 "2024-01-30T12:06:10Z")

</div>

Closed on January 30, 2024, 12:06pm UTC


