@Test public void testHasContent(){ Audit audit = auditDAO.read(Long.valueOf(1)); assertFalse(contentDAO.hasContent(audit)); audit = auditDAO.read(Long.valueOf(2)); assertFalse(contentDAO.hasContent(audit)); audit = auditDAO.read(Long.valueOf(3)); assertTrue(contentDAO.hasContent(audit)); }
@Override public boolean hasContent(Audit audit) { Query query = entityManager.createQuery( "SELECT count(s.id) FROM " + SSPImpl.class.getName() + " s" + " JOIN s.audit as a" + " WHERE a = :audit" + " AND s.source != null " + " AND s.source != '' "); query = query.setParameter(AUDIT_KEY, audit); return (Long) query.getSingleResult() > 0; }
ContentDAOImpl extends AbstractJPADAO<Content, Long> implements
        ContentDAO { @Override public boolean hasContent(Audit audit) { Query query = entityManager.createQuery( "SELECT count(s.id) FROM " + SSPImpl.class.getName() + " s" + " JOIN s.audit as a" + " WHERE a = :audit" + " AND s.source != null " + " AND s.source != '' "); query = query.setParameter(AUDIT_KEY, audit); return (Long) query.getSingleResult() > 0; } }
ContentDAOImpl extends AbstractJPADAO<Content, Long> implements
        ContentDAO { @Override public boolean hasContent(Audit audit) { Query query = entityManager.createQuery( "SELECT count(s.id) FROM " + SSPImpl.class.getName() + " s" + " JOIN s.audit as a" + " WHERE a = :audit" + " AND s.source != null " + " AND s.source != '' "); query = query.setParameter(AUDIT_KEY, audit); return (Long) query.getSingleResult() > 0; } ContentDAOImpl(); }
ContentDAOImpl extends AbstractJPADAO<Content, Long> implements
        ContentDAO { @Override public boolean hasContent(Audit audit) { Query query = entityManager.createQuery( "SELECT count(s.id) FROM " + SSPImpl.class.getName() + " s" + " JOIN s.audit as a" + " WHERE a = :audit" + " AND s.source != null " + " AND s.source != '' "); query = query.setParameter(AUDIT_KEY, audit); return (Long) query.getSingleResult() > 0; } ContentDAOImpl(); @Override Content find(Audit audit, String uri); @Override Content find(WebResource page, String uri); @Override Long findNumberOfSSPContentFromAudit(Audit audit); @Override boolean hasAdaptedSSP(Audit audit); @Override boolean hasContent(Audit audit); @Override Long findNumberOfOrphanContentFromWebResource(WebResource webResource); @Override List<Content> findOrphanContentList(
            WebResource webResource,
            int start,
            int chunkSize); @Override Long findNumberOfOrphanRelatedContentFromWebResource(
            WebResource webResource); @Override List<Content> findOrphanRelatedContentList(
            WebResource webResource,
            int start,
            int chunkSize); @Override Long findNumberOfSSPFromWebResource(WebResource webResource, int httpStatusCode); @Override Long findNumberOfRelatedContentFromWebResource(WebResource webResource); @Override Collection<StylesheetContent> findExternalStylesheetFromAudit(Audit audit); @Override void saveContentRelationShip(SSP ssp, Set<Long> relatedContentIdSet); @Override void saveAuditToContent(Long idContent, Long idAudit ); @Override List<Long> getSSPFromWebResource(
            Long webResourceId,
            int httpStatusCode,
            int start,
            int chunkSize); @Override List<Long> getRelatedContentFromWebResource(
            Long webResourceId,
            int start,
            int chunkSize); @Override Content readWithRelatedContent(Long id, boolean isFetchParameters); @Override Collection<RelatedContent> findRelatedContentFromAudit(Audit audit); @Override void deleteContentRelationShip(Long relatedContentId); @Override void deleteRelatedContentFromContent(Content content); }
ContentDAOImpl extends AbstractJPADAO<Content, Long> implements
        ContentDAO { @Override public boolean hasContent(Audit audit) { Query query = entityManager.createQuery( "SELECT count(s.id) FROM " + SSPImpl.class.getName() + " s" + " JOIN s.audit as a" + " WHERE a = :audit" + " AND s.source != null " + " AND s.source != '' "); query = query.setParameter(AUDIT_KEY, audit); return (Long) query.getSingleResult() > 0; } ContentDAOImpl(); @Override Content find(Audit audit, String uri); @Override Content find(WebResource page, String uri); @Override Long findNumberOfSSPContentFromAudit(Audit audit); @Override boolean hasAdaptedSSP(Audit audit); @Override boolean hasContent(Audit audit); @Override Long findNumberOfOrphanContentFromWebResource(WebResource webResource); @Override List<Content> findOrphanContentList(
            WebResource webResource,
            int start,
            int chunkSize); @Override Long findNumberOfOrphanRelatedContentFromWebResource(
            WebResource webResource); @Override List<Content> findOrphanRelatedContentList(
            WebResource webResource,
            int start,
            int chunkSize); @Override Long findNumberOfSSPFromWebResource(WebResource webResource, int httpStatusCode); @Override Long findNumberOfRelatedContentFromWebResource(WebResource webResource); @Override Collection<StylesheetContent> findExternalStylesheetFromAudit(Audit audit); @Override void saveContentRelationShip(SSP ssp, Set<Long> relatedContentIdSet); @Override void saveAuditToContent(Long idContent, Long idAudit ); @Override List<Long> getSSPFromWebResource(
            Long webResourceId,
            int httpStatusCode,
            int start,
            int chunkSize); @Override List<Long> getRelatedContentFromWebResource(
            Long webResourceId,
            int start,
            int chunkSize); @Override Content readWithRelatedContent(Long id, boolean isFetchParameters); @Override Collection<RelatedContent> findRelatedContentFromAudit(Audit audit); @Override void deleteContentRelationShip(Long relatedContentId); @Override void deleteRelatedContentFromContent(Content content);  }