/** {@inheritDoc} */
  @Transactional
  public void setStatusByCode(BugEnum bugRef, boolean enabled) {
    Bug bug = em.find(Bug.class, bugRef.getCode());

    if (bug != null) {
      bug.setEnabled(enabled);
    } else {
      final Bug newBug = new Bug();
      newBug.setCode(bugRef.getCode());
      newBug.setEnabled(enabled);
      em.persist(newBug);
    }
  }
  /** {@inheritDoc} */
  @Transactional(readOnly = true)
  public Bug findByCode(BugEnum bugRef) {
    if (bugRef == null) {
      return null;
    }

    return em.find(Bug.class, bugRef.getCode());
  }