code: protected String getDiagramResourceForDefinition(DeploymentEntity deployment, String resourceName, DefinitionEntity definition, Map<String, ResourceEntity> resources) {
      for (String diagramSuffix: getDiagramSuffixes()) {
        String definitionDiagramResource = getDefinitionDiagramResourceName(resourceName, definition, diagramSuffix);
        String diagramForFileResource = getGeneralDiagramResourceName(resourceName, definition, diagramSuffix);
        if (resources.containsKey(definitionDiagramResource)) {
          return definitionDiagramResource;
        } else if (resources.containsKey(diagramForFileResource)) {
          return diagramForFileResource;
        }
      }
      // no matching diagram found
      return null;
    }
docs: Returns the default name of the image resource for a certain definition.
  
  It will first look for an image resource which matches the definition
  specifically, before resorting to an image resource which matches the file
  containing the definition.
  
  Example: if the deployment contains a BPMN 2.0 xml resource called
  'abc.bpmn20.xml' containing only one process with key 'myProcess', then
  this method will look for an image resources called 'abc.myProcess.png'
  (or .jpg, or .gif, etc.) or 'abc.png' if the previous one wasn't found.
  
  Example 2: if the deployment contains a BPMN 2.0 xml resource called
  'abc.bpmn20.xml' containing three processes (with keys a, b and c),
  then this method will first look for an image resource called 'abc.a.png'
  before looking for 'abc.png' (likewise for b and c).
  Note that if abc.a.png, abc.b.png and abc.c.png don't exist, all
  processes will have the same image: abc.png.
  
  @return null if no matching image resource is found.