if (casDoctor.isRepairsActive()) { try { casDoctor.repair(aProject, aCas); casDoctor.analyze(aProject, aCas);
checkClasses.addAll(scanChecks()); log.info("Detected SNAPSHOT/beta version - automatically enabling all checks");
public boolean analyze(Project aProject, CAS aCas, List<LogMessage> aMessages, boolean aFatalChecks) throws CasDoctorException { long tStart = System.currentTimeMillis(); boolean ok = true; for (Class<? extends Check> checkClass : checkClasses) { try { long tStartTask = System.currentTimeMillis(); Check check = checkClass.newInstance(); if (context != null) { context.getAutowireCapableBeanFactory().autowireBean(check); } log.debug("CasDoctor analysis [" + checkClass.getSimpleName() + "] running..."); ok &= check.check(aProject, aCas, aMessages); log.debug("CasDoctor analysis [" + checkClass.getSimpleName() + "] completed in " + (System.currentTimeMillis() - tStartTask) + "ms"); } catch (InstantiationException | IllegalAccessException e) { aMessages.add(new LogMessage(this, LogLevel.ERROR, "Cannot instantiate [%s]: %s", checkClass.getSimpleName(), ExceptionUtils.getRootCauseMessage(e))); log.error("Error running check", e); } } if (!ok) { aMessages.forEach(s -> log.error("{}", s)); }
CasDoctor casDoctor = new CasDoctor(); casDoctor.setApplicationContext(ApplicationContextProvider.getApplicationContext()); casDoctor.setFatalChecks(false); casDoctor.setCheckClasses(CasDoctor.scanChecks()); casDoctor.analyze(project, initialCas.getCas(), messageSet.messages); try { JCas correctionCas = casStorageService.readCas(sd, CORRECTION_USER, false); casDoctor.analyze(project, correctionCas.getCas(), messageSet.messages); try { JCas curationCas = casStorageService.readCas(sd, CURATION_USER, false); casDoctor.analyze(project, curationCas.getCas(), messageSet.messages); JCas userCas = casStorageService.readCas(ad.getDocument(), ad.getUser(), false); casDoctor.analyze(project, userCas.getCas(), messageSet.messages);
CasDoctor casDoctor = new CasDoctor(); casDoctor.setApplicationContext(ApplicationContextProvider.getApplicationContext()); casDoctor.setFatalChecks(false); casDoctor.setRepairClasses(formModel.repairs); casDoctor.repair(project, initialCas.getCas(), messageSet.messages); casStorageService.writeCas(sd, initialCas, INITIAL_CAS_PSEUDO_USER); try { JCas correctionCas = casStorageService.readCas(sd, CORRECTION_USER, false); casDoctor.repair(project, correctionCas.getCas(), messageSet.messages); CasPersistenceUtils.writeSerializedCas(correctionCas, documentService.getCasFile(sd, CORRECTION_USER)); try { JCas curationCas = casStorageService.readCas(sd, CURATION_USER, false); casDoctor.repair(project, curationCas.getCas(), messageSet.messages); CasPersistenceUtils.writeSerializedCas(curationCas, documentService.getCasFile(sd, CURATION_USER)); JCas userCas = casStorageService.readCas(ad.getDocument(), ad.getUser(), false); casDoctor.repair(project, userCas.getCas(), messageSet.messages); CasPersistenceUtils.writeSerializedCas(userCas, documentService.getCasFile(ad.getDocument(), ad.getUser()));
public boolean analyze(Project aProject, CAS aCas) throws CasDoctorException { List<LogMessage> messages = new ArrayList<>(); boolean result = analyze(aProject, aCas, messages); if (log.isDebugEnabled()) { messages.forEach(s -> log.debug("{}", s)); } return result; }
public void repair(Project aProject, CAS aCas) { List<LogMessage> messages = new ArrayList<>(); repair(aProject, aCas, messages); if (log.isWarnEnabled() && !messages.isEmpty()) { messages.forEach(s -> log.warn("{}", s)); } }
CasDoctor casDoctor = new CasDoctor(); casDoctor.setApplicationContext(ApplicationContextProvider.getApplicationContext()); casDoctor.setFatalChecks(false); casDoctor.setCheckClasses(CasDoctor.scanChecks()); casDoctor.analyze(project, initialCas.getCas(), messageSet.messages); try { JCas correctionCas = casStorageService.readCas(sd, CORRECTION_USER, false); casDoctor.analyze(project, correctionCas.getCas(), messageSet.messages); try { JCas curationCas = casStorageService.readCas(sd, CURATION_USER, false); casDoctor.analyze(project, curationCas.getCas(), messageSet.messages); JCas userCas = casStorageService.readCas(ad.getDocument(), ad.getUser(), false); casDoctor.analyze(project, userCas.getCas(), messageSet.messages);
CasDoctor casDoctor = new CasDoctor(); casDoctor.setApplicationContext(ApplicationContextProvider.getApplicationContext()); casDoctor.setFatalChecks(false); casDoctor.setRepairClasses(formModel.repairs); casDoctor.repair(project, initialCas.getCas(), messageSet.messages); casStorageService.writeCas(sd, initialCas, INITIAL_CAS_PSEUDO_USER); try { JCas correctionCas = casStorageService.readCas(sd, CORRECTION_USER, false); casDoctor.repair(project, correctionCas.getCas(), messageSet.messages); CasPersistenceUtils.writeSerializedCas(correctionCas, documentService.getCasFile(sd, CORRECTION_USER)); try { JCas curationCas = casStorageService.readCas(sd, CURATION_USER, false); casDoctor.repair(project, curationCas.getCas(), messageSet.messages); CasPersistenceUtils.writeSerializedCas(curationCas, documentService.getCasFile(sd, CURATION_USER)); JCas userCas = casStorageService.readCas(ad.getDocument(), ad.getUser(), false); casDoctor.repair(project, userCas.getCas(), messageSet.messages); CasPersistenceUtils.writeSerializedCas(userCas, documentService.getCasFile(ad.getDocument(), ad.getUser()));
analyze(aProject, aCas, aMessages, true);
if (casDoctor.isRepairsActive()) { try { casDoctor.repair(aProject, aCas); casDoctor.analyze(aProject, aCas);
casDoctor.analyze(aProject, aJcas.getCas());
if (casDoctor.isRepairsActive()) { try { casDoctor.repair(aProject, aCas); casDoctor.analyze(aProject, aCas);
casDoctor.analyze(aDocument.getProject(), aJcas.getCas());
casDoctor.analyze(aDocument.getProject(), aJcas.getCas());