@Test public void testGetModelByCrisisID() { try { List<ModelWrapper> modelWrappers = modelResourceFacadeImp.getModelByCrisisID(crisisDTO.getCrisisID()); assertNotNull(modelWrappers); assertTrue(modelWrappers.size() == 1); } catch (PropertyNotSetException e) { logger.error("PropertyNotSetException while executing testGetModelByCrisisID "+e.getMessage()); } }
@Override public List<ModelWrapper> getModelByCrisisID(Long crisisID) throws PropertyNotSetException{ List<ModelWrapper> modelWrapperList = new ArrayList<ModelWrapper>(); Collection collection = getEntityManager().find(Collection.class, crisisID); getEntityManager().find(Collection.class, crisisID); Hibernate.initialize(collection.getModelFamilies()); List<ModelFamily> modelFamilyList = collection.getModelFamilies(); for (ModelFamily modelFamily : modelFamilyList) { Hibernate.initialize(modelFamily.getModels()); List<Model> modelList = modelFamily.getModels(); ModelWrapper modelWrapper = new ModelWrapper(); modelWrapper.setModelFamilyID(modelFamily.getModelFamilyId()); long classifiedElements = 0; double auc = 0.0; Long modelID = 0l; long trainingExamples = 0; if (modelList!=null && modelList.size() > 0) { for (Model model : modelList) { if (model.isIsCurrentModel()) { auc = model.getAvgAuc(); modelID = model.getModelId(); Hibernate.initialize(model.getModelNominalLabels()); long totalClassifiedDocuments = 0; for (ModelNominalLabel label : model.getModelNominalLabels()) { totalClassifiedDocuments += label.getClassifiedDocumentCount(); } classifiedElements = totalClassifiedDocuments; } } } modelWrapper.setTrainingExamples(trainingExamples); modelWrapper.setAttribute(modelFamily.getNominalAttribute().getName()); modelWrapper.setAttributeID(modelFamily.getNominalAttribute().getNominalAttributeId()); modelWrapper.setAuc(auc); modelWrapper.setClassifiedDocuments(classifiedElements); String status = ""; if (modelFamily.isIsActive()) { status = "Active"; } else { status = "Inactive"; } modelWrapper.setStatus(status); modelWrapper.setModelID(modelID); modelWrapperList.add(modelWrapper); } return modelWrapperList; }
ModelResourceFacadeImp extends CoreDBServiceFacadeImp<Model, Long> implements ModelResourceFacade { @Override public List<ModelWrapper> getModelByCrisisID(Long crisisID) throws PropertyNotSetException{ List<ModelWrapper> modelWrapperList = new ArrayList<ModelWrapper>(); Collection collection = getEntityManager().find(Collection.class, crisisID); getEntityManager().find(Collection.class, crisisID); Hibernate.initialize(collection.getModelFamilies()); List<ModelFamily> modelFamilyList = collection.getModelFamilies(); for (ModelFamily modelFamily : modelFamilyList) { Hibernate.initialize(modelFamily.getModels()); List<Model> modelList = modelFamily.getModels(); ModelWrapper modelWrapper = new ModelWrapper(); modelWrapper.setModelFamilyID(modelFamily.getModelFamilyId()); long classifiedElements = 0; double auc = 0.0; Long modelID = 0l; long trainingExamples = 0; if (modelList!=null && modelList.size() > 0) { for (Model model : modelList) { if (model.isIsCurrentModel()) { auc = model.getAvgAuc(); modelID = model.getModelId(); Hibernate.initialize(model.getModelNominalLabels()); long totalClassifiedDocuments = 0; for (ModelNominalLabel label : model.getModelNominalLabels()) { totalClassifiedDocuments += label.getClassifiedDocumentCount(); } classifiedElements = totalClassifiedDocuments; } } } modelWrapper.setTrainingExamples(trainingExamples); modelWrapper.setAttribute(modelFamily.getNominalAttribute().getName()); modelWrapper.setAttributeID(modelFamily.getNominalAttribute().getNominalAttributeId()); modelWrapper.setAuc(auc); modelWrapper.setClassifiedDocuments(classifiedElements); String status = ""; if (modelFamily.isIsActive()) { status = "Active"; } else { status = "Inactive"; } modelWrapper.setStatus(status); modelWrapper.setModelID(modelID); modelWrapperList.add(modelWrapper); } return modelWrapperList; } }
ModelResourceFacadeImp extends CoreDBServiceFacadeImp<Model, Long> implements ModelResourceFacade { @Override public List<ModelWrapper> getModelByCrisisID(Long crisisID) throws PropertyNotSetException{ List<ModelWrapper> modelWrapperList = new ArrayList<ModelWrapper>(); Collection collection = getEntityManager().find(Collection.class, crisisID); getEntityManager().find(Collection.class, crisisID); Hibernate.initialize(collection.getModelFamilies()); List<ModelFamily> modelFamilyList = collection.getModelFamilies(); for (ModelFamily modelFamily : modelFamilyList) { Hibernate.initialize(modelFamily.getModels()); List<Model> modelList = modelFamily.getModels(); ModelWrapper modelWrapper = new ModelWrapper(); modelWrapper.setModelFamilyID(modelFamily.getModelFamilyId()); long classifiedElements = 0; double auc = 0.0; Long modelID = 0l; long trainingExamples = 0; if (modelList!=null && modelList.size() > 0) { for (Model model : modelList) { if (model.isIsCurrentModel()) { auc = model.getAvgAuc(); modelID = model.getModelId(); Hibernate.initialize(model.getModelNominalLabels()); long totalClassifiedDocuments = 0; for (ModelNominalLabel label : model.getModelNominalLabels()) { totalClassifiedDocuments += label.getClassifiedDocumentCount(); } classifiedElements = totalClassifiedDocuments; } } } modelWrapper.setTrainingExamples(trainingExamples); modelWrapper.setAttribute(modelFamily.getNominalAttribute().getName()); modelWrapper.setAttributeID(modelFamily.getNominalAttribute().getNominalAttributeId()); modelWrapper.setAuc(auc); modelWrapper.setClassifiedDocuments(classifiedElements); String status = ""; if (modelFamily.isIsActive()) { status = "Active"; } else { status = "Inactive"; } modelWrapper.setStatus(status); modelWrapper.setModelID(modelID); modelWrapperList.add(modelWrapper); } return modelWrapperList; } ModelResourceFacadeImp(); }
ModelResourceFacadeImp extends CoreDBServiceFacadeImp<Model, Long> implements ModelResourceFacade { @Override public List<ModelWrapper> getModelByCrisisID(Long crisisID) throws PropertyNotSetException{ List<ModelWrapper> modelWrapperList = new ArrayList<ModelWrapper>(); Collection collection = getEntityManager().find(Collection.class, crisisID); getEntityManager().find(Collection.class, crisisID); Hibernate.initialize(collection.getModelFamilies()); List<ModelFamily> modelFamilyList = collection.getModelFamilies(); for (ModelFamily modelFamily : modelFamilyList) { Hibernate.initialize(modelFamily.getModels()); List<Model> modelList = modelFamily.getModels(); ModelWrapper modelWrapper = new ModelWrapper(); modelWrapper.setModelFamilyID(modelFamily.getModelFamilyId()); long classifiedElements = 0; double auc = 0.0; Long modelID = 0l; long trainingExamples = 0; if (modelList!=null && modelList.size() > 0) { for (Model model : modelList) { if (model.isIsCurrentModel()) { auc = model.getAvgAuc(); modelID = model.getModelId(); Hibernate.initialize(model.getModelNominalLabels()); long totalClassifiedDocuments = 0; for (ModelNominalLabel label : model.getModelNominalLabels()) { totalClassifiedDocuments += label.getClassifiedDocumentCount(); } classifiedElements = totalClassifiedDocuments; } } } modelWrapper.setTrainingExamples(trainingExamples); modelWrapper.setAttribute(modelFamily.getNominalAttribute().getName()); modelWrapper.setAttributeID(modelFamily.getNominalAttribute().getNominalAttributeId()); modelWrapper.setAuc(auc); modelWrapper.setClassifiedDocuments(classifiedElements); String status = ""; if (modelFamily.isIsActive()) { status = "Active"; } else { status = "Inactive"; } modelWrapper.setStatus(status); modelWrapper.setModelID(modelID); modelWrapperList.add(modelWrapper); } return modelWrapperList; } ModelResourceFacadeImp(); @Override List<ModelDTO> getAllModels(); @Override ModelDTO getModelByID(Long id); @Override @SuppressWarnings("unchecked") Integer getModelCountByModelFamilyID(Long modelFamilyID); @Override @SuppressWarnings("unchecked") List<ModelHistoryWrapper> getModelByModelFamilyID(Long modelFamilyID, Integer start, Integer limit); @Override @SuppressWarnings("unchecked") List<ModelHistoryWrapper> getModelByModelFamilyID(Long modelFamilyID, Integer start, Integer limit, 
			String sortColumn, String sortDirection); @Override List<ModelWrapper> getModelByCrisisID(Long crisisID); @Override boolean deleteModel(Long modelID); }
ModelResourceFacadeImp extends CoreDBServiceFacadeImp<Model, Long> implements ModelResourceFacade { @Override public List<ModelWrapper> getModelByCrisisID(Long crisisID) throws PropertyNotSetException{ List<ModelWrapper> modelWrapperList = new ArrayList<ModelWrapper>(); Collection collection = getEntityManager().find(Collection.class, crisisID); getEntityManager().find(Collection.class, crisisID); Hibernate.initialize(collection.getModelFamilies()); List<ModelFamily> modelFamilyList = collection.getModelFamilies(); for (ModelFamily modelFamily : modelFamilyList) { Hibernate.initialize(modelFamily.getModels()); List<Model> modelList = modelFamily.getModels(); ModelWrapper modelWrapper = new ModelWrapper(); modelWrapper.setModelFamilyID(modelFamily.getModelFamilyId()); long classifiedElements = 0; double auc = 0.0; Long modelID = 0l; long trainingExamples = 0; if (modelList!=null && modelList.size() > 0) { for (Model model : modelList) { if (model.isIsCurrentModel()) { auc = model.getAvgAuc(); modelID = model.getModelId(); Hibernate.initialize(model.getModelNominalLabels()); long totalClassifiedDocuments = 0; for (ModelNominalLabel label : model.getModelNominalLabels()) { totalClassifiedDocuments += label.getClassifiedDocumentCount(); } classifiedElements = totalClassifiedDocuments; } } } modelWrapper.setTrainingExamples(trainingExamples); modelWrapper.setAttribute(modelFamily.getNominalAttribute().getName()); modelWrapper.setAttributeID(modelFamily.getNominalAttribute().getNominalAttributeId()); modelWrapper.setAuc(auc); modelWrapper.setClassifiedDocuments(classifiedElements); String status = ""; if (modelFamily.isIsActive()) { status = "Active"; } else { status = "Inactive"; } modelWrapper.setStatus(status); modelWrapper.setModelID(modelID); modelWrapperList.add(modelWrapper); } return modelWrapperList; } ModelResourceFacadeImp(); @Override List<ModelDTO> getAllModels(); @Override ModelDTO getModelByID(Long id); @Override @SuppressWarnings("unchecked") Integer getModelCountByModelFamilyID(Long modelFamilyID); @Override @SuppressWarnings("unchecked") List<ModelHistoryWrapper> getModelByModelFamilyID(Long modelFamilyID, Integer start, Integer limit); @Override @SuppressWarnings("unchecked") List<ModelHistoryWrapper> getModelByModelFamilyID(Long modelFamilyID, Integer start, Integer limit, 
			String sortColumn, String sortDirection); @Override List<ModelWrapper> getModelByCrisisID(Long crisisID); @Override boolean deleteModel(Long modelID);  }