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

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

Introduction

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

Prototype

Isolation DEFAULT

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

Click Source Link

Document

Use the default isolation level of the underlying datastore.

Usage

From source file:com.francetelecom.clara.cloud.environment.impl.ManageEnvironmentImpl.java

@Override
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
public void stopEnvironment(String uid) throws EnvironmentNotFoundException {
    try {//w w  w  . j a  va 2s  . c  o m
        MDC.put(LOG_KEY_ENVUID, uid);
        log.debug("stopEnvironment: uid={}", new Object[] { uid });
        Environment environment = environmentRepository.findByUid(uid);
        assertHasWritePermissionFor(environment);
        MDC.put(LOG_KEY_ENVNAME, environment.getLabel());
        if (environment.isRunning()) {
            managePaasActivation.stop(environment.getTechnicalDeploymentInstance().getId());
            // TODO status should be set by managePaasActivation
            environment.setStatus(EnvironmentStatus.STOPPING);
        } else if (environment.isStopping() || environment.isStopped()) {
            log.info("Environment '" + environment.getUID()
                    + "' is already stopped or is stopping (ignoring call)");
        } else if (environment.isFailed()) {
            log.warn("Environment '" + environment.getUID() + "' is failed but (anyway) we try to stop it...");
            managePaasActivation.stop(environment.getTechnicalDeploymentInstance().getId());
            // TODO status should be set by managePaasActivation
            environment.setStatus(EnvironmentStatus.STOPPING);
        } else {
            throw new TechnicalException(
                    "Calling stop on environment which has a bad status: " + environment.getStatus());
        }
    } finally {
        MDC.remove(LOG_KEY_ENVNAME);
        MDC.remove(LOG_KEY_ENVUID);
    }
}

From source file:com.francetelecom.clara.cloud.environment.impl.ManageEnvironmentImpl.java

@Override
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
public void deleteEnvironment(String uid) throws EnvironmentNotFoundException {
    try {//from w w w.  j  a  v  a  2  s  . co  m
        MDC.put(LOG_KEY_ENVUID, uid);
        log.debug("deleteEnvironment: uid={}", new Object[] { uid });
        Environment environment = environmentRepository.findByUid(uid);
        assertHasWritePermissionFor(environment);
        MDC.put(LOG_KEY_ENVNAME, environment.getLabel());
        if (environment.isRemoved() || environment.isRemoving()) {
            log.info("Environment '" + environment.getUID()
                    + "' is already deleted or deletion is in progress (ignoring call)");
        } else {
            managePaasActivation.delete(environment.getTechnicalDeploymentInstance().getId());
            // TODO status should be set by managePaasActivation
            environment.setStatus(EnvironmentStatus.REMOVING);
        }
    } finally {
        MDC.remove(LOG_KEY_ENVNAME);
        MDC.remove(LOG_KEY_ENVUID);
    }
}

From source file:com.francetelecom.clara.cloud.environment.impl.ManageEnvironmentImpl.java

@Override
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
public void forceStatusForAndEnvironment(String uid, EnvironmentStatus newStatus)
        throws EnvironmentNotFoundException {
    Environment environment = environmentRepository.findByUid(uid);
    if (environment == null) {
        String message = "Environment with UID[" + uid + "] does not exist.";
        log.info(message);/*from  w ww.  ja  v a 2  s.c  o m*/
        throw new EnvironmentNotFoundException(message);
    }
    environment.updateStatus(newStatus, "", 100);
}

From source file:com.francetelecom.clara.cloud.environment.impl.ManageEnvironmentImpl.java

@Override
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
public List<Environment> findOldRemovedEnvironments() {
    log.info("*** find old environment (purgeRetentionDelayInDay={})", purgeRetentionDelayInDay);
    // find removed environment older than N day
    return environmentRepository
            .findRemovedOlderThanNDays(DateHelper.getDateDeltaDay(-purgeRetentionDelayInDay));
}

From source file:com.francetelecom.clara.cloud.environment.impl.ManageEnvironmentImpl.java

@Override
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
public void purgeRemovedEnvironment(String uid) throws EnvironmentNotFoundException {
    Environment environment = environmentRepository.findByUid(uid);
    if (environment == null) {
        String message = "Environment with UID[" + uid + "] does not exist.";
        log.info(message);/*  w  w  w. j  a v a  2  s.  com*/
        throw new EnvironmentNotFoundException(message);
    }

    assertHasWritePermissionFor(environment);

    environmentRepository.delete(environment);
}

From source file:com.francetelecom.clara.cloud.environment.impl.ManageEnvironmentImpl.java

@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
@Override//  w  ww.j a  v  a 2s .  c  om
public Environment update(EnvironmentDetailsDto environmentDetailsDto) {
    try {
        MDC.put(LOG_KEY_ENVUID, environmentDetailsDto.getUid());
        MDC.put(LOG_KEY_ENVNAME, environmentDetailsDto.getLabel());
        log.debug("updateEnvironment: uid={}", new Object[] { environmentDetailsDto.getUid() });
        Environment environment = environmentRepository.findByUid(environmentDetailsDto.getUid());
        assertHasWritePermissionFor(environment);
        environment.setComment(environmentDetailsDto.getComment());
        return environment;
    } finally {
        MDC.remove(LOG_KEY_ENVNAME);
        MDC.remove(LOG_KEY_ENVUID);
    }
}