use of com.axelor.apps.base.db.ABCAnalysis in project axelor-open-suite by axelor.
the class ABCAnalysisController method setSequence.
public void setSequence(ActionRequest request, ActionResponse response) {
ABCAnalysis abcAnalysis = request.getContext().asType(ABCAnalysis.class);
Beans.get(ABCAnalysisServiceImpl.class).setSequence(abcAnalysis);
response.setValue("abcAnalysisSeq", abcAnalysis.getAbcAnalysisSeq());
}
use of com.axelor.apps.base.db.ABCAnalysis in project axelor-open-suite by axelor.
the class ABCAnalysisController method printReport.
public void printReport(ActionRequest request, ActionResponse response) {
Context context = request.getContext();
Long abcAnalysisId = Long.parseLong(context.get("_abcAnalysisId").toString());
String reportType = (String) context.get("reportTypeSelect");
ABCAnalysis abcAnalysis = Beans.get(ABCAnalysisRepository.class).find(abcAnalysisId);
try {
String name = I18n.get("ABC Analysis N°") + " " + abcAnalysis.getAbcAnalysisSeq();
String fileLink = Beans.get(ABCAnalysisServiceImpl.class).printReport(abcAnalysis, reportType);
if (!Strings.isNullOrEmpty(fileLink)) {
response.setView(ActionView.define(name).add("html", fileLink).map());
}
} catch (AxelorException e) {
response.setError(e.getMessage());
}
response.setCanClose(true);
}
use of com.axelor.apps.base.db.ABCAnalysis in project axelor-open-suite by axelor.
the class ABCAnalysisController method runAnalysis.
@SuppressWarnings("unchecked")
public void runAnalysis(ActionRequest request, ActionResponse response) {
ABCAnalysis abcAnalysis = request.getContext().asType(ABCAnalysis.class);
try {
Class<? extends ABCAnalysisServiceImpl> clazz = (Class<? extends ABCAnalysisServiceImpl>) Class.forName(abcAnalysis.getTypeSelect());
Beans.get(clazz).runAnalysis(Beans.get(ABCAnalysisRepository.class).find(abcAnalysis.getId()));
response.setReload(true);
} catch (ClassNotFoundException | AxelorException e) {
TraceBackService.trace(response, e, ResponseMessageType.ERROR);
}
}
use of com.axelor.apps.base.db.ABCAnalysis in project axelor-open-suite by axelor.
the class ABCAnalysisBaseRepository method copy.
@Override
public ABCAnalysis copy(ABCAnalysis entity, boolean deep) {
ABCAnalysis abcAnalysis = super.copy(entity, true);
abcAnalysis.setStatusSelect(STATUS_DRAFT);
abcAnalysis.setAbcAnalysisSeq(null);
return abcAnalysis;
}
Aggregations