<commit_before>/**
 * Copyright (C) 2011 - present by OpenGamma Inc. and the OpenGamma group of companies
 * 
 * Please see distribution for license.
 */
package com.opengamma.engine.view.calc;

import com.opengamma.core.change.ChangeEvent;
import com.opengamma.core.change.ChangeListener;

/**
 * Change listener for a single view definition which notifies a computation job.
 */
public class ViewDefinitionChangeListener implements ChangeListener {

  private final ViewComputationJob _computationJob;
  private final String _viewDefinitionName;
  
  public ViewDefinitionChangeListener(ViewComputationJob computationJob, String viewDefinitionName) {
    _computationJob = computationJob;
    _viewDefinitionName = viewDefinitionName;
  }
  
  @Override
  public void entityChanged(ChangeEvent event) {
    if (event.getAfterId() == null) {
      // View definition could have been deleted - do we want to stop the process?
      return;
    }
    if (event.getBeforeId().getValue().equals(getViewDefinitionName())) {
      getViewComputationJob().dirtyViewDefinition();
    }
  }
  
  private String getViewDefinitionName() {
    return _viewDefinitionName;
  }
  
  private ViewComputationJob getViewComputationJob() {
    return _computationJob;
  }
  
}
<commit_msg>Stop throwing when view definition is created<commit_after>/**
 * Copyright (C) 2011 - present by OpenGamma Inc. and the OpenGamma group of companies
 * 
 * Please see distribution for license.
 */
package com.opengamma.engine.view.calc;

import com.opengamma.core.change.ChangeEvent;
import com.opengamma.core.change.ChangeListener;

/**
 * Change listener for a single view definition which notifies a computation job.
 */
public class ViewDefinitionChangeListener implements ChangeListener {

  private final ViewComputationJob _computationJob;
  private final String _viewDefinitionName;
  
  public ViewDefinitionChangeListener(ViewComputationJob computationJob, String viewDefinitionName) {
    _computationJob = computationJob;
    _viewDefinitionName = viewDefinitionName;
  }
  
  @Override
  public void entityChanged(ChangeEvent event) {
    if (event.getBeforeId() == null) {
      // View definition created 
      return;
    }
    if (event.getAfterId() == null) {
      // View definition could have been deleted - do we want to stop the process?
      return;
    }
    if (event.getBeforeId().getValue().equals(getViewDefinitionName())) {
      getViewComputationJob().dirtyViewDefinition();
    }
  }
  
  private String getViewDefinitionName() {
    return _viewDefinitionName;
  }
  
  private ViewComputationJob getViewComputationJob() {
    return _computationJob;
  }
  
}

{'fraction_non_alphanumeric': 0.08017984263769203, 'fraction_numerical': 0.0029973772948669914, 'mean_word_length': 4.0, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2897362', 'n_tokens_mistral': 725, 'n_tokens_neox': 711, 'n_words': 201}