use of com.buschmais.jqassistant.core.analysis.api.model.ConceptDescriptor in project jqa-core-framework by buschmais.
the class AnalyzerRuleVisitor method visitConcept.
@Override
public boolean visitConcept(Concept concept, Severity effectiveSeverity) throws RuleException {
ConceptDescriptor conceptDescriptor = analyzerContext.getStore().find(ConceptDescriptor.class, concept.getId());
Result.Status status;
if (conceptDescriptor == null || configuration.isExecuteAppliedConcepts()) {
analyzerContext.getLogger().info("Applying concept '" + concept.getId() + "' with severity: '" + concept.getSeverity().getInfo(effectiveSeverity) + "'" + ".");
reportPlugin.beginConcept(concept);
Result<Concept> result = execute(concept, effectiveSeverity);
reportPlugin.setResult(result);
status = result.getStatus();
if (conceptDescriptor == null) {
conceptDescriptor = analyzerContext.getStore().create(ConceptDescriptor.class);
conceptDescriptor.setId(concept.getId());
conceptDescriptor.setStatus(status);
}
reportPlugin.endConcept();
} else {
status = conceptDescriptor.getStatus();
}
return Result.Status.SUCCESS.equals(status);
}
use of com.buschmais.jqassistant.core.analysis.api.model.ConceptDescriptor in project jqa-core-framework by buschmais.
the class AnalyzerVisitor method visitConcept.
@Override
public boolean visitConcept(Concept concept, Severity effectiveSeverity) throws RuleExecutorException {
try {
store.beginTransaction();
ConceptDescriptor conceptDescriptor = store.find(ConceptDescriptor.class, concept.getId());
Result.Status status;
if (conceptDescriptor == null || configuration.isExecuteAppliedConcepts()) {
logger.info("Applying concept '" + concept.getId() + "' with severity: '" + concept.getSeverity().getInfo(effectiveSeverity) + "'.");
reportPlugin.beginConcept(concept);
Result<Concept> result = execute(concept, effectiveSeverity);
reportPlugin.setResult(result);
status = result.getStatus();
if (conceptDescriptor == null) {
conceptDescriptor = store.create(ConceptDescriptor.class);
conceptDescriptor.setId(concept.getId());
conceptDescriptor.setStatus(result.getStatus());
}
reportPlugin.endConcept();
} else {
status = conceptDescriptor.getStatus();
}
store.commitTransaction();
return Result.Status.SUCCESS.equals(status);
} catch (XOException e) {
store.rollbackTransaction();
throw new RuleExecutorException("Cannot apply concept " + concept.getId(), e);
}
}
Aggregations