Search in sources :

Example 1 with ABCAnalysis

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());
}
Also used : ABCAnalysis(com.axelor.apps.base.db.ABCAnalysis) ABCAnalysisServiceImpl(com.axelor.apps.base.service.ABCAnalysisServiceImpl)

Example 2 with ABCAnalysis

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);
}
Also used : Context(com.axelor.rpc.Context) AxelorException(com.axelor.exception.AxelorException) ABCAnalysis(com.axelor.apps.base.db.ABCAnalysis) ABCAnalysisServiceImpl(com.axelor.apps.base.service.ABCAnalysisServiceImpl) ABCAnalysisRepository(com.axelor.apps.base.db.repo.ABCAnalysisRepository)

Example 3 with ABCAnalysis

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);
    }
}
Also used : AxelorException(com.axelor.exception.AxelorException) ABCAnalysis(com.axelor.apps.base.db.ABCAnalysis) ABCAnalysisClass(com.axelor.apps.base.db.ABCAnalysisClass) ABCAnalysisServiceImpl(com.axelor.apps.base.service.ABCAnalysisServiceImpl)

Example 4 with ABCAnalysis

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;
}
Also used : ABCAnalysis(com.axelor.apps.base.db.ABCAnalysis)

Aggregations

ABCAnalysis (com.axelor.apps.base.db.ABCAnalysis)4 ABCAnalysisServiceImpl (com.axelor.apps.base.service.ABCAnalysisServiceImpl)3 AxelorException (com.axelor.exception.AxelorException)2 ABCAnalysisClass (com.axelor.apps.base.db.ABCAnalysisClass)1 ABCAnalysisRepository (com.axelor.apps.base.db.repo.ABCAnalysisRepository)1 Context (com.axelor.rpc.Context)1