@Test public void testFindLabeledDocumentsByCrisisID() { try { documentDTO.setHasHumanLabels(true); entityManager.getTransaction().begin(); documentDTO = documentResourceFacadeImp.addDocument(documentDTO); entityManager.getTransaction().commit(); Long crisisId = documentDTO.getCrisisDTO().getCrisisID(); List<DocumentDTO> result = documentResourceFacadeImp .findLabeledDocumentsByCrisisID(crisisId); assertNotNull(result); assertEquals(true, result.get(0).getHasHumanLabels()); assertTrue(result.size() >= 1); } catch (PropertyNotSetException ex) { logger.error("PropertyNotSetException while finding Labelled documents by crisisId "+ex.getMessage()); fail("testFindLabeledDocumentsByCrisisID failed"); } }
@Override public List<DocumentDTO> findLabeledDocumentsByCrisisID(Long crisisId) throws PropertyNotSetException { Criterion criterion = Restrictions.conjunction() .add(Restrictions.eq("collection.id",crisisId)) .add(Restrictions.eq("hasHumanLabels", true)); List<DocumentDTO> dtoList = new ArrayList<DocumentDTO>(); List<Document> list = this.getAllByCriteria(criterion); if (list != null && !list.isEmpty()) { for (Document doc : list) { DocumentDTO dto = new DocumentDTO(doc); dtoList.add(dto); } } logger.info("Done creating DTO list, size = " + dtoList.size()); return dtoList; }
DocumentResourceFacadeImp extends CoreDBServiceFacadeImp<Document, Long> implements DocumentResourceFacade { @Override public List<DocumentDTO> findLabeledDocumentsByCrisisID(Long crisisId) throws PropertyNotSetException { Criterion criterion = Restrictions.conjunction() .add(Restrictions.eq("collection.id",crisisId)) .add(Restrictions.eq("hasHumanLabels", true)); List<DocumentDTO> dtoList = new ArrayList<DocumentDTO>(); List<Document> list = this.getAllByCriteria(criterion); if (list != null && !list.isEmpty()) { for (Document doc : list) { DocumentDTO dto = new DocumentDTO(doc); dtoList.add(dto); } } logger.info("Done creating DTO list, size = " + dtoList.size()); return dtoList; } }
DocumentResourceFacadeImp extends CoreDBServiceFacadeImp<Document, Long> implements DocumentResourceFacade { @Override public List<DocumentDTO> findLabeledDocumentsByCrisisID(Long crisisId) throws PropertyNotSetException { Criterion criterion = Restrictions.conjunction() .add(Restrictions.eq("collection.id",crisisId)) .add(Restrictions.eq("hasHumanLabels", true)); List<DocumentDTO> dtoList = new ArrayList<DocumentDTO>(); List<Document> list = this.getAllByCriteria(criterion); if (list != null && !list.isEmpty()) { for (Document doc : list) { DocumentDTO dto = new DocumentDTO(doc); dtoList.add(dto); } } logger.info("Done creating DTO list, size = " + dtoList.size()); return dtoList; } DocumentResourceFacadeImp(); }
DocumentResourceFacadeImp extends CoreDBServiceFacadeImp<Document, Long> implements DocumentResourceFacade { @Override public List<DocumentDTO> findLabeledDocumentsByCrisisID(Long crisisId) throws PropertyNotSetException { Criterion criterion = Restrictions.conjunction() .add(Restrictions.eq("collection.id",crisisId)) .add(Restrictions.eq("hasHumanLabels", true)); List<DocumentDTO> dtoList = new ArrayList<DocumentDTO>(); List<Document> list = this.getAllByCriteria(criterion); if (list != null && !list.isEmpty()) { for (Document doc : list) { DocumentDTO dto = new DocumentDTO(doc); dtoList.add(dto); } } logger.info("Done creating DTO list, size = " + dtoList.size()); return dtoList; } DocumentResourceFacadeImp(); @Override void updateHasHumanLabel(DocumentDTO document); @Override List<DocumentDTO> getDocumentCollectionForNominalLabel(Criterion criterion); @Override int deleteNoLabelDocument(DocumentDTO document); @Override int deleteNoLabelDocument(List<DocumentDTO> collection); @Override int deleteUnassignedDocument(DocumentDTO document); @Override int deleteUnassignedDocument(Long documentID); @Override int deleteUnassignedDocumentCollection(List<Long> documentIDList); @Override int deleteStaleDocuments(String joinType, String joinTable, String joinColumn,
			String sortOrder, String[] orderBy, 
			final String maxTaskAge, final String scanInterval); @Override DocumentDTO addDocument(DocumentDTO doc); @Override DocumentDTO editDocument(DocumentDTO doc); @Override Integer deleteDocument(DocumentDTO doc); @Override List<DocumentDTO> findByCriteria(String columnName, Object value); @Override DocumentDTO findDocumentByID(Long id); @Override List<DocumentDTO> findDocumentsByCrisisID(Long crisisId); @Override DocumentDTO getDocumentWithAllFieldsByID(Long id); @Override boolean isDocumentExists(Long id); @Override List<DocumentDTO> getAllDocuments(); @Override List<DocumentDTO> findLabeledDocumentsByCrisisID(Long crisisId); @Override List<DocumentDTO> findUnLabeledDocumentsByCrisisID(Long crisisId); @Override Integer getDocumentCountForNominalLabelAndCrisis(Long nominalLabelID, String crisisCode); @Override List<DocumentDTO> getDocumentCollectionWithNominalLabelData(Long nominalLabelID); @Override Integer getUnlabeledDocumentsCountByCrisisID(Long crisisId); @Override boolean deleteDocuments(List<DocumentDTO> documents); @Override List<Long> getUnassignedDocumentIDsByCrisisID(Long crisisID, Integer count); @Override List<DocumentDTO> getDocumentForNominalLabelAndCrisis(List<Long> nominalLabelID, Long crisisId); }
DocumentResourceFacadeImp extends CoreDBServiceFacadeImp<Document, Long> implements DocumentResourceFacade { @Override public List<DocumentDTO> findLabeledDocumentsByCrisisID(Long crisisId) throws PropertyNotSetException { Criterion criterion = Restrictions.conjunction() .add(Restrictions.eq("collection.id",crisisId)) .add(Restrictions.eq("hasHumanLabels", true)); List<DocumentDTO> dtoList = new ArrayList<DocumentDTO>(); List<Document> list = this.getAllByCriteria(criterion); if (list != null && !list.isEmpty()) { for (Document doc : list) { DocumentDTO dto = new DocumentDTO(doc); dtoList.add(dto); } } logger.info("Done creating DTO list, size = " + dtoList.size()); return dtoList; } DocumentResourceFacadeImp(); @Override void updateHasHumanLabel(DocumentDTO document); @Override List<DocumentDTO> getDocumentCollectionForNominalLabel(Criterion criterion); @Override int deleteNoLabelDocument(DocumentDTO document); @Override int deleteNoLabelDocument(List<DocumentDTO> collection); @Override int deleteUnassignedDocument(DocumentDTO document); @Override int deleteUnassignedDocument(Long documentID); @Override int deleteUnassignedDocumentCollection(List<Long> documentIDList); @Override int deleteStaleDocuments(String joinType, String joinTable, String joinColumn,
			String sortOrder, String[] orderBy, 
			final String maxTaskAge, final String scanInterval); @Override DocumentDTO addDocument(DocumentDTO doc); @Override DocumentDTO editDocument(DocumentDTO doc); @Override Integer deleteDocument(DocumentDTO doc); @Override List<DocumentDTO> findByCriteria(String columnName, Object value); @Override DocumentDTO findDocumentByID(Long id); @Override List<DocumentDTO> findDocumentsByCrisisID(Long crisisId); @Override DocumentDTO getDocumentWithAllFieldsByID(Long id); @Override boolean isDocumentExists(Long id); @Override List<DocumentDTO> getAllDocuments(); @Override List<DocumentDTO> findLabeledDocumentsByCrisisID(Long crisisId); @Override List<DocumentDTO> findUnLabeledDocumentsByCrisisID(Long crisisId); @Override Integer getDocumentCountForNominalLabelAndCrisis(Long nominalLabelID, String crisisCode); @Override List<DocumentDTO> getDocumentCollectionWithNominalLabelData(Long nominalLabelID); @Override Integer getUnlabeledDocumentsCountByCrisisID(Long crisisId); @Override boolean deleteDocuments(List<DocumentDTO> documents); @Override List<Long> getUnassignedDocumentIDsByCrisisID(Long crisisID, Integer count); @Override List<DocumentDTO> getDocumentForNominalLabelAndCrisis(List<Long> nominalLabelID, Long crisisId);  }