class CaseManagementClearCommand extends ClearCommand {

    @Override
    @SuppressWarnings("unchecked")
    public CommandResult<CanvasViolation> execute(AbstractCanvasHandler context) {
        final String rootUUID = context.getDiagram().getMetadata().getCanvasRootUUID();
        final Shape rootShape = context.getCanvas().getShape(rootUUID);

        final CommandResult<CanvasViolation> result = super.execute(context);

        final Node<View, Edge> node = context.getGraphIndex().getNode(rootUUID);

        // re-register the root shape
        context.deregister(rootShape, node, true);
        context.register(context.getDiagram().getMetadata().getShapeSetId(), node);

        return result;
    }

}