Exemplo n.º 1
0
  /** {@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);
    }
  }
Exemplo n.º 2
0
  /** {@inheritDoc} */
  @Transactional(readOnly = true)
  public Bug findByCode(BugEnum bugRef) {
    if (bugRef == null) {
      return null;
    }

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