class BPMNDelegateGraphFactory implements BPMNGraphFactory {

    @Override
    public Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata) {
        final Optional<ProjectType> projectType = (Objects.nonNull(metadata) && metadata instanceof ProjectMetadata)
                ? Optional.ofNullable(((ProjectMetadata) metadata).getProjectType()).map(ProjectType::valueOf)
                : Optional.empty();
        return graphFactoryDelegation.get(projectType).build(uuid, definition, metadata);
    }

    @Inject public  BPMNDelegateGraphFactory(final BPMNGraphFactoryImpl bpmnGraphFactory,
                                    final CaseGraphFactoryImpl caseGraphFactory);

}