Example usage for org.springframework.transaction.annotation Isolation READ_COMMITTED

List of usage examples for org.springframework.transaction.annotation Isolation READ_COMMITTED

Introduction

In this page you can find the example usage for org.springframework.transaction.annotation Isolation READ_COMMITTED.

Prototype

Isolation READ_COMMITTED

To view the source code for org.springframework.transaction.annotation Isolation READ_COMMITTED.

Click Source Link

Document

A constant indicating that dirty reads are prevented; non-repeatable reads and phantom reads can occur.

Usage

From source file:annis.administration.AdministrationDao.java

/**
 * Reads ANNIS files from several directories.
 *
 * @param path Specifies the path to the corpora, which should be imported.
 * @param aliasName An alias name for this corpus. Can be null.
 * @param overwrite If set to true conflicting top level corpora are deleted.
 * @param waitForOtherTasks If true wait for other tasks to finish, if false
 * abort.//from w  w w  .ja va  2  s . co m
 *
 * @return true if successful
 */
@Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW, isolation = Isolation.READ_COMMITTED)
public boolean importCorpus(String path, String aliasName, boolean overwrite, boolean waitForOtherTasks) {

    // check schema version first
    checkDatabaseSchemaVersion();

    if (!lockRepositoryMetadataTable(waitForOtherTasks)) {
        log.error("Another import is currently running");
        return false;
    }

    // explicitly unset any timeout
    getJdbcTemplate().update("SET statement_timeout TO 0");

    ANNISFormatVersion annisFormatVersion = getANNISFormatVersion(path);

    if (annisFormatVersion == ANNISFormatVersion.V3_3) {
        return importVersion4(path, aliasName, overwrite, annisFormatVersion);
    } else if (annisFormatVersion == ANNISFormatVersion.V3_1 || annisFormatVersion == ANNISFormatVersion.V3_2) {
        return importVersion3(path, aliasName, overwrite, annisFormatVersion);
    }

    log.error("Unknown ANNIS import format version");
    return false;
}

From source file:com.inkubator.hrm.service.impl.TempAttendanceRealizationServiceImpl.java

@Override
@Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED, propagation = Propagation.SUPPORTS, timeout = 50)
public RealizationAttendanceModel getStatisticEmpAttendaceRealization() throws Exception {
    WtPeriode wtPeriode = this.wtPeriodeDao.getEntityByAbsentTypeActive();

    RealizationAttendanceModel attendanceModel = new RealizationAttendanceModel();
    attendanceModel.setStardDate(wtPeriode.getFromPeriode());
    attendanceModel.setEndDate(wtPeriode.getUntilPeriode());
    attendanceModel.setTotalIzin(tempAttendanceRealizationDao.getTotalEmpPermit());
    attendanceModel.setTotalOnDuty(tempAttendanceRealizationDao.gettotalEmpOnDuty());
    attendanceModel.setTotalSick(tempAttendanceRealizationDao.gettotalEmpOnSick());
    attendanceModel.setTotaldayPresent(tempAttendanceRealizationDao.totalDayPresent());
    attendanceModel.setTotaldaySchedule(tempAttendanceRealizationDao.totalDaySchedule());
    return attendanceModel;

}

From source file:com.inkubator.hrm.service.impl.TempJadwalKaryawanServiceImpl.java

@Override
@Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public void saveMassPenempatanJadwal(List<Long> data, long groupWorkingId, Date createdOn, String createdBy)
        throws Exception {
    WtGroupWorking groupWorking = wtGroupWorkingDao.getEntiyByPK(groupWorkingId);
    groupWorking.setIsActive(Boolean.TRUE);
    wtGroupWorkingDao.update(groupWorking);

    for (Long empDataId : data) {
        EmpData empData = empDataDao.getEntiyByPK(empDataId);
        empData.setWtGroupWorking(wtGroupWorkingDao.getEntiyByPK(groupWorkingId));
        this.empDataDao.update(empData);
    }/*  w  ww . j a  v a2  s . c o m*/

    SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy hh:mm");
    String dataToJson = jsonConverter.getJson(data.toArray(new Long[data.size()]));
    final JsonObject jsonObject = new JsonObject();
    jsonObject.addProperty("listEmpId", dataToJson);
    jsonObject.addProperty("groupWorkingId", groupWorkingId);
    jsonObject.addProperty("createDate", dateFormat.format(createdOn));
    jsonObject.addProperty("createBy", createdBy);
    jsonObject.addProperty("locale", FacesUtil.getFacesContext().getViewRoot().getLocale().toString());

    this.jmsTemplateMassJadwalKerja.send(new MessageCreator() {
        @Override
        public Message createMessage(Session session) throws JMSException {
            return session.createTextMessage(jsonObject.toString());
        }
    });
}

From source file:com.inkubator.hrm.service.impl.MecineFingerServiceImpl.java

@Override
@Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public void saveMesineQuery(MecineFingerQueryModel serviceModel) throws Exception {
    MecineFinger mecineFinger = this.mecineFingerDao.getEntiyByPK(serviceModel.getId());
    String hostIp = String.valueOf(serviceModel.getDbHost1() + "." + serviceModel.getDbHost2() + "."
            + serviceModel.getDbHost3() + "." + serviceModel.getDbHost4());
    mecineFinger.setDbHost(hostIp);/*from   w w w.j  ava2  s  . co m*/
    mecineFinger.setDbPass(serviceModel.getDbPassword());
    mecineFinger.setDbSwapBase(serviceModel.getSwapTimeFieldName());
    mecineFinger.setDbType(serviceModel.getDbType());
    mecineFinger.setDbUser(serviceModel.getDbUserName());
    mecineFinger.setQuery(serviceModel.getDbQuery());
    mecineFinger.setMatchBase(serviceModel.getEmployeeIdFieldName());
    mecineFinger.setUpdatedBy(UserInfoUtil.getUserName());
    mecineFinger.setUpdatedOn(new Date());
    mecineFingerDao.update(mecineFinger);
}

From source file:com.inkubator.hrm.service.impl.BioDataServiceImpl.java

@Override
@Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED, propagation = Propagation.SUPPORTS, timeout = 30)
public Long getTotalByParam(BioDataSearchParameter parameter) throws Exception {
    return this.bioDataDao.getTotalByParam(parameter);
}

From source file:com.inkubator.hrm.service.impl.MecineFingerServiceImpl.java

@Override
@Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED, propagation = Propagation.SUPPORTS, timeout = 50)
public List<MecineFinger> getAllDataByMachineMethod(Integer machineMethod) throws Exception {
    return mecineFingerDao.getAllDataByMachineMethod(machineMethod);
}

From source file:com.inkubator.hrm.service.impl.PayTempKalkulasiServiceImpl.java

@Override
@Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED, propagation = Propagation.SUPPORTS, timeout = 50)
public List<PayTempKalkulasiModel> getByParam(String searchParameter, int firstResult, int maxResults,
        Order order) throws Exception {
    return payTempKalkulasiDao.getByParam(searchParameter, firstResult, maxResults, order);
}

From source file:com.inkubator.hrm.service.impl.EmpCareerHistoryServiceImpl.java

@Override
@Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public void approved(long approvalActivityId, String pendingDataUpdate, String comment) throws Exception {
    Map<String, Object> result = super.approvedAndCheckNextApproval(approvalActivityId, pendingDataUpdate,
            comment);//ww w  . ja v  a 2 s.com
    ApprovalActivity appActivity = (ApprovalActivity) result.get("approvalActivity");
    if (StringUtils.equals((String) result.get("isEndOfApprovalProcess"), "true")) {
        /**
         * kalau status akhir sudah di approved dan tidak ada next approval,
         * berarti langsung insert ke database
         */
        EmpCareerHistoryModel model = this.convertJsonToModel(appActivity.getPendingData());
        model.setApprovalActivityNumber(appActivity.getActivityNumber()); //set approval activity number, for history approval purpose

        /** saving to DB */
        this.saveTransition(model, Boolean.TRUE);
    }

    //if there is no error, then sending the email notification
    sendingApprovalNotification(appActivity);

}

From source file:com.inkubator.hrm.service.impl.TempJadwalKaryawanServiceImpl.java

@Override
@Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public void approved(long approvalActivityId, String pendingDataUpdate, String comment) throws Exception {
    Map<String, Object> result = super.approvedAndCheckNextApproval(approvalActivityId, pendingDataUpdate,
            comment);/* www.  ja  v a 2  s  .  c  om*/
    ApprovalActivity appActivity = (ApprovalActivity) result.get("approvalActivity");
    if (StringUtils.equals((String) result.get("isEndOfApprovalProcess"), "true")) {
        /**
         * kalau status akhir sudah di approved dan tidak ada next approval,
         * berarti langsung insert ke database
         */
        String pendingData = appActivity.getPendingData();
        JsonObject jsonObject = (JsonObject) jsonConverter.getClassFromJson(pendingData, JsonObject.class);
        SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy hh:mm");
        Date createdOn = dateFormat.parse(jsonObject.get("createDate").getAsString());
        Gson gson = new GsonBuilder().create();
        List<Long> listEmpId = new GsonBuilder().create().fromJson(jsonObject.get("listEmpId").getAsString(),
                new TypeToken<List<Long>>() {
                }.getType());
        this.saveMassPenempatanJadwal(listEmpId, jsonObject.get("groupWorkingId").getAsLong(), createdOn,
                jsonObject.get("createBy").getAsString());
    }

    //if there is no error, then sending the email notification
    sendingApprovalNotification(appActivity);
}

From source file:com.inkubator.hrm.service.impl.PayTempKalkulasiServiceImpl.java

@Override
@Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED, propagation = Propagation.SUPPORTS, timeout = 30)
public Long getTotalPayTempKalkulasiByParam(String searchParameter) throws Exception {
    return payTempKalkulasiDao.getTotalPayTempKalkulasiByParam(searchParameter);
}