@Test public void testAddDocument() throws Exception { assertEquals(document.getDocumentID(), documentNominalLabel.getIdDTO() .getDocumentId()); }
@Override public DocumentNominalLabelDTO addDocument(DocumentNominalLabelDTO doc) throws PropertyNotSetException { DocumentNominalLabel d = doc.toEntity(); try { em.persist(d); em.flush(); em.refresh(d); logger.debug("Success in saving to document_nominal_label table, doc = " + doc.getIdDTO().getDocumentId()); } catch (Exception e) { logger.error("Error in saving document nominal label for document = " + doc.getIdDTO().getDocumentId(), e); return null; } Document labeledDoc = null; try { labeledDoc = em.find(Document.class, d.getId().getDocumentId()); labeledDoc.setHasHumanLabels(true); em.merge(labeledDoc); em.flush(); logger.debug("Success in updating hashumanLabels field in document table, doc = " + labeledDoc.getDocumentId()); return new DocumentNominalLabelDTO(d); } catch (Exception e) { logger.error("Error in updating hasHumanLabel field of labeled document = " + labeledDoc.getDocumentId() +", rolling back transaction (delete from document_nominal_label)..."); return null; } }
DocumentNominalLabelResourceFacadeImp extends CoreDBServiceFacadeImp<DocumentNominalLabel, Long> implements DocumentNominalLabelResourceFacade { @Override public DocumentNominalLabelDTO addDocument(DocumentNominalLabelDTO doc) throws PropertyNotSetException { DocumentNominalLabel d = doc.toEntity(); try { em.persist(d); em.flush(); em.refresh(d); logger.debug("Success in saving to document_nominal_label table, doc = " + doc.getIdDTO().getDocumentId()); } catch (Exception e) { logger.error("Error in saving document nominal label for document = " + doc.getIdDTO().getDocumentId(), e); return null; } Document labeledDoc = null; try { labeledDoc = em.find(Document.class, d.getId().getDocumentId()); labeledDoc.setHasHumanLabels(true); em.merge(labeledDoc); em.flush(); logger.debug("Success in updating hashumanLabels field in document table, doc = " + labeledDoc.getDocumentId()); return new DocumentNominalLabelDTO(d); } catch (Exception e) { logger.error("Error in updating hasHumanLabel field of labeled document = " + labeledDoc.getDocumentId() +", rolling back transaction (delete from document_nominal_label)..."); return null; } } }
DocumentNominalLabelResourceFacadeImp extends CoreDBServiceFacadeImp<DocumentNominalLabel, Long> implements DocumentNominalLabelResourceFacade { @Override public DocumentNominalLabelDTO addDocument(DocumentNominalLabelDTO doc) throws PropertyNotSetException { DocumentNominalLabel d = doc.toEntity(); try { em.persist(d); em.flush(); em.refresh(d); logger.debug("Success in saving to document_nominal_label table, doc = " + doc.getIdDTO().getDocumentId()); } catch (Exception e) { logger.error("Error in saving document nominal label for document = " + doc.getIdDTO().getDocumentId(), e); return null; } Document labeledDoc = null; try { labeledDoc = em.find(Document.class, d.getId().getDocumentId()); labeledDoc.setHasHumanLabels(true); em.merge(labeledDoc); em.flush(); logger.debug("Success in updating hashumanLabels field in document table, doc = " + labeledDoc.getDocumentId()); return new DocumentNominalLabelDTO(d); } catch (Exception e) { logger.error("Error in updating hasHumanLabel field of labeled document = " + labeledDoc.getDocumentId() +", rolling back transaction (delete from document_nominal_label)..."); return null; } } protected  DocumentNominalLabelResourceFacadeImp(); }
DocumentNominalLabelResourceFacadeImp extends CoreDBServiceFacadeImp<DocumentNominalLabel, Long> implements DocumentNominalLabelResourceFacade { @Override public DocumentNominalLabelDTO addDocument(DocumentNominalLabelDTO doc) throws PropertyNotSetException { DocumentNominalLabel d = doc.toEntity(); try { em.persist(d); em.flush(); em.refresh(d); logger.debug("Success in saving to document_nominal_label table, doc = " + doc.getIdDTO().getDocumentId()); } catch (Exception e) { logger.error("Error in saving document nominal label for document = " + doc.getIdDTO().getDocumentId(), e); return null; } Document labeledDoc = null; try { labeledDoc = em.find(Document.class, d.getId().getDocumentId()); labeledDoc.setHasHumanLabels(true); em.merge(labeledDoc); em.flush(); logger.debug("Success in updating hashumanLabels field in document table, doc = " + labeledDoc.getDocumentId()); return new DocumentNominalLabelDTO(d); } catch (Exception e) { logger.error("Error in updating hasHumanLabel field of labeled document = " + labeledDoc.getDocumentId() +", rolling back transaction (delete from document_nominal_label)..."); return null; } } protected  DocumentNominalLabelResourceFacadeImp(); @Override void saveDocumentNominalLabel(DocumentNominalLabelDTO documentNominalLabel); @Override boolean foundDuplicate(DocumentNominalLabelDTO documentNominalLabel); @Override DocumentNominalLabelDTO addDocument(DocumentNominalLabelDTO doc); @Override DocumentNominalLabelDTO editDocument(DocumentNominalLabelDTO doc); @Override Integer deleteDocument(DocumentNominalLabelDTO doc); @Override List<DocumentNominalLabelDTO> findByCriteria(String columnName, Object value); @Override DocumentNominalLabelDTO findDocumentByPrimaryKey(DocumentNominalLabelIdDTO id); @Override boolean isDocumentExists(DocumentNominalLabelIdDTO id); @Override boolean isDocumentExists(Long id); @Override List<DocumentNominalLabelDTO> getAllDocuments(); @Override DocumentNominalLabelDTO findLabeledDocumentByID(Long id); @Override List<DocumentNominalLabelDTO> findLabeledDocumentListByID(Long id); @Override List<DocumentNominalLabelDTO> getLabeledDocumentCollectionForNominalLabel(Integer nominalLabelID); @Override void deleteDocumentNominalLabelByNominalLabel(Long nominalLabelID); }
DocumentNominalLabelResourceFacadeImp extends CoreDBServiceFacadeImp<DocumentNominalLabel, Long> implements DocumentNominalLabelResourceFacade { @Override public DocumentNominalLabelDTO addDocument(DocumentNominalLabelDTO doc) throws PropertyNotSetException { DocumentNominalLabel d = doc.toEntity(); try { em.persist(d); em.flush(); em.refresh(d); logger.debug("Success in saving to document_nominal_label table, doc = " + doc.getIdDTO().getDocumentId()); } catch (Exception e) { logger.error("Error in saving document nominal label for document = " + doc.getIdDTO().getDocumentId(), e); return null; } Document labeledDoc = null; try { labeledDoc = em.find(Document.class, d.getId().getDocumentId()); labeledDoc.setHasHumanLabels(true); em.merge(labeledDoc); em.flush(); logger.debug("Success in updating hashumanLabels field in document table, doc = " + labeledDoc.getDocumentId()); return new DocumentNominalLabelDTO(d); } catch (Exception e) { logger.error("Error in updating hasHumanLabel field of labeled document = " + labeledDoc.getDocumentId() +", rolling back transaction (delete from document_nominal_label)..."); return null; } } protected  DocumentNominalLabelResourceFacadeImp(); @Override void saveDocumentNominalLabel(DocumentNominalLabelDTO documentNominalLabel); @Override boolean foundDuplicate(DocumentNominalLabelDTO documentNominalLabel); @Override DocumentNominalLabelDTO addDocument(DocumentNominalLabelDTO doc); @Override DocumentNominalLabelDTO editDocument(DocumentNominalLabelDTO doc); @Override Integer deleteDocument(DocumentNominalLabelDTO doc); @Override List<DocumentNominalLabelDTO> findByCriteria(String columnName, Object value); @Override DocumentNominalLabelDTO findDocumentByPrimaryKey(DocumentNominalLabelIdDTO id); @Override boolean isDocumentExists(DocumentNominalLabelIdDTO id); @Override boolean isDocumentExists(Long id); @Override List<DocumentNominalLabelDTO> getAllDocuments(); @Override DocumentNominalLabelDTO findLabeledDocumentByID(Long id); @Override List<DocumentNominalLabelDTO> findLabeledDocumentListByID(Long id); @Override List<DocumentNominalLabelDTO> getLabeledDocumentCollectionForNominalLabel(Integer nominalLabelID); @Override void deleteDocumentNominalLabelByNominalLabel(Long nominalLabelID);  }