Search in sources :

Example 1 with HrBatch

use of com.axelor.apps.hr.db.HrBatch in project axelor-open-suite by axelor.

the class HrBatchController method launchHrBatch.

/**
 * Launch any type of HR batch
 *
 * @param request
 * @param response
 * @throws AxelorException
 */
public void launchHrBatch(ActionRequest request, ActionResponse response) throws AxelorException {
    HrBatch hrBatch = request.getContext().asType(HrBatch.class);
    Batch batch = Beans.get(HrBatchService.class).run(Beans.get(HrBatchRepository.class).find(hrBatch.getId()));
    if (batch != null) {
        response.setFlash(batch.getComments());
    }
    response.setReload(true);
}
Also used : Batch(com.axelor.apps.base.db.Batch) HrBatch(com.axelor.apps.hr.db.HrBatch) HrBatchService(com.axelor.apps.hr.service.batch.HrBatchService) HrBatch(com.axelor.apps.hr.db.HrBatch)

Example 2 with HrBatch

use of com.axelor.apps.hr.db.HrBatch in project axelor-open-suite by axelor.

the class HrBatchService method run.

@Override
public Batch run(Model batchModel) throws AxelorException {
    HrBatch hrBatch = (HrBatch) batchModel;
    Batch batch = null;
    switch(hrBatch.getActionSelect()) {
        case HrBatchRepository.ACTION_LEAVE_MANAGEMENT:
            batch = leaveManagement(hrBatch);
            break;
        case HrBatchRepository.ACTION_SENIORITY_LEAVE_MANAGEMENT:
            batch = seniorityLeaveManagement(hrBatch);
            break;
        case HrBatchRepository.ACTION_PAYROLL_PREPARATION_GENERATION:
            batch = payrollPreparationGeneration(hrBatch);
            break;
        case HrBatchRepository.ACTION_PAYROLL_PREPARATION_EXPORT:
            batch = payrollPreparationExport(hrBatch);
            break;
        case HrBatchRepository.ACTION_LEAVE_MANAGEMENT_RESET:
            batch = leaveManagementReset(hrBatch);
            break;
        case HrBatchRepository.ACTION_EMPLOYMENT_CONTRACT_EXPORT:
            batch = employmentContractExport(hrBatch);
            break;
        case HrBatchHRRepository.ACTION_TIMESHEET_REMINDER:
            batch = runTimesheetReminderBatch(hrBatch);
            break;
        default:
            throw new AxelorException(TraceBackRepository.CATEGORY_INCONSISTENCY, I18n.get(IExceptionMessage.BASE_BATCH_1), hrBatch.getActionSelect(), hrBatch.getCode());
    }
    return batch;
}
Also used : AxelorException(com.axelor.exception.AxelorException) Batch(com.axelor.apps.base.db.Batch) HrBatch(com.axelor.apps.hr.db.HrBatch) HrBatch(com.axelor.apps.hr.db.HrBatch)

Example 3 with HrBatch

use of com.axelor.apps.hr.db.HrBatch in project axelor-open-suite by axelor.

the class HrBatchHRRepository method copy.

@Override
public HrBatch copy(HrBatch entity, boolean deep) {
    HrBatch copy = super.copy(entity, deep);
    copy.setBatchList(null);
    return copy;
}
Also used : HrBatch(com.axelor.apps.hr.db.HrBatch)

Aggregations

HrBatch (com.axelor.apps.hr.db.HrBatch)3 Batch (com.axelor.apps.base.db.Batch)2 HrBatchService (com.axelor.apps.hr.service.batch.HrBatchService)1 AxelorException (com.axelor.exception.AxelorException)1