@Test public void testFindParameterSetFromAudit() { Audit audit = auditDAO.read(Long.valueOf(1)); Set<Parameter> paramSet = parameterDAO.findParameterSetFromAudit(audit); assertEquals(Integer.valueOf(2), Integer.valueOf(paramSet.size())); audit = auditDAO.read(Long.valueOf(2)); paramSet = parameterDAO.findParameterSetFromAudit(audit); assertEquals(Integer.valueOf(2), Integer.valueOf(paramSet.size())); audit = auditDAO.read(Long.valueOf(3)); paramSet = parameterDAO.findParameterSetFromAudit(audit); assertEquals(Integer.valueOf(2), Integer.valueOf(paramSet.size())); audit = auditDAO.read(Long.valueOf(4)); paramSet = parameterDAO.findParameterSetFromAudit(audit); assertEquals(Integer.valueOf(2), Integer.valueOf(paramSet.size())); audit = auditDAO.read(Long.valueOf(5)); paramSet = parameterDAO.findParameterSetFromAudit(audit); assertEquals(Integer.valueOf(0), Integer.valueOf(paramSet.size())); }
@Override public Set<Parameter> findParameterSetFromAudit(Audit audit) { if (audit != null) { Query query = entityManager.createQuery("SELECT a FROM " + AuditImpl.class.getName() + " a" + " WHERE a.id = :idAudit"); query.setParameter("idAudit", audit.getId()); try { audit = (Audit)(query.getSingleResult()); Set<Parameter> paramSet = new HashSet<Parameter>(); paramSet.addAll(audit.getParameterSet()); return paramSet; } catch (NoResultException nre) { return null; } } return null; }
ParameterDAOImpl extends AbstractJPADAO<Parameter, Long> implements
        ParameterDAO { @Override public Set<Parameter> findParameterSetFromAudit(Audit audit) { if (audit != null) { Query query = entityManager.createQuery("SELECT a FROM " + AuditImpl.class.getName() + " a" + " WHERE a.id = :idAudit"); query.setParameter("idAudit", audit.getId()); try { audit = (Audit)(query.getSingleResult()); Set<Parameter> paramSet = new HashSet<Parameter>(); paramSet.addAll(audit.getParameterSet()); return paramSet; } catch (NoResultException nre) { return null; } } return null; } }
ParameterDAOImpl extends AbstractJPADAO<Parameter, Long> implements
        ParameterDAO { @Override public Set<Parameter> findParameterSetFromAudit(Audit audit) { if (audit != null) { Query query = entityManager.createQuery("SELECT a FROM " + AuditImpl.class.getName() + " a" + " WHERE a.id = :idAudit"); query.setParameter("idAudit", audit.getId()); try { audit = (Audit)(query.getSingleResult()); Set<Parameter> paramSet = new HashSet<Parameter>(); paramSet.addAll(audit.getParameterSet()); return paramSet; } catch (NoResultException nre) { return null; } } return null; }  }
ParameterDAOImpl extends AbstractJPADAO<Parameter, Long> implements
        ParameterDAO { @Override public Set<Parameter> findParameterSetFromAudit(Audit audit) { if (audit != null) { Query query = entityManager.createQuery("SELECT a FROM " + AuditImpl.class.getName() + " a" + " WHERE a.id = :idAudit"); query.setParameter("idAudit", audit.getId()); try { audit = (Audit)(query.getSingleResult()); Set<Parameter> paramSet = new HashSet<Parameter>(); paramSet.addAll(audit.getParameterSet()); return paramSet; } catch (NoResultException nre) { return null; } } return null; }  @Override Set<Parameter> findParameterSet(ParameterFamily parameterFamily, Audit audit); @Override Set<Parameter> findDefaultParameterSet(); @Override Set<Parameter> findParameterSetFromAudit(Audit audit); @Override Parameter findParameter(ParameterElement parameterElement, String parameterValue); @Override Parameter findLevelParameter(String parameterValue); @Override @Transactional Parameter findParameter(Audit audit, String parameterElementCode); @Override Parameter findDefaultParameter(ParameterElement parameterElement); @Override Set<Parameter> findParametersFromParameterFamily(
            ParameterFamily parameterFamily, 
            Collection<Parameter> globalParamSet); String findLastParameterValueFromUser(
        Long contract,
        ParameterElement parameterElement,
        ScopeEnum scope); String findLastParameterValueFromContractAndScenario(
        Long contract,
        ParameterElement parameterElement,
        String scenarioName); }
ParameterDAOImpl extends AbstractJPADAO<Parameter, Long> implements
        ParameterDAO { @Override public Set<Parameter> findParameterSetFromAudit(Audit audit) { if (audit != null) { Query query = entityManager.createQuery("SELECT a FROM " + AuditImpl.class.getName() + " a" + " WHERE a.id = :idAudit"); query.setParameter("idAudit", audit.getId()); try { audit = (Audit)(query.getSingleResult()); Set<Parameter> paramSet = new HashSet<Parameter>(); paramSet.addAll(audit.getParameterSet()); return paramSet; } catch (NoResultException nre) { return null; } } return null; }  @Override Set<Parameter> findParameterSet(ParameterFamily parameterFamily, Audit audit); @Override Set<Parameter> findDefaultParameterSet(); @Override Set<Parameter> findParameterSetFromAudit(Audit audit); @Override Parameter findParameter(ParameterElement parameterElement, String parameterValue); @Override Parameter findLevelParameter(String parameterValue); @Override @Transactional Parameter findParameter(Audit audit, String parameterElementCode); @Override Parameter findDefaultParameter(ParameterElement parameterElement); @Override Set<Parameter> findParametersFromParameterFamily(
            ParameterFamily parameterFamily, 
            Collection<Parameter> globalParamSet); String findLastParameterValueFromUser(
        Long contract,
        ParameterElement parameterElement,
        ScopeEnum scope); String findLastParameterValueFromContractAndScenario(
        Long contract,
        ParameterElement parameterElement,
        String scenarioName);  }