Set default behavior of our repository transaction isolation level to
READ_UNCOMMITED. Signed-off-by: Kai Zimmermann <kai.zimmermann@bosch-si.com>
This commit is contained in:
@@ -29,13 +29,14 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
|||||||
import org.springframework.data.jpa.repository.Modifying;
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link Action} repository.
|
* {@link Action} repository.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
public interface ActionRepository extends BaseEntityRepository<Action, Long>, JpaSpecificationExecutor<Action> {
|
public interface ActionRepository extends BaseEntityRepository<Action, Long>, JpaSpecificationExecutor<Action> {
|
||||||
/**
|
/**
|
||||||
* Retrieves an Action with all lazy attributes.
|
* Retrieves an Action with all lazy attributes.
|
||||||
@@ -172,7 +173,7 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
|
|||||||
* active
|
* active
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Query("UPDATE Action a SET a.active = false WHERE a IN :keySet AND a.target IN :targetsIds")
|
@Query("UPDATE Action a SET a.active = false WHERE a IN :keySet AND a.target IN :targetsIds")
|
||||||
void setToInactive(@Param("keySet") List<Action> keySet, @Param("targetsIds") List<Long> targetsIds);
|
void setToInactive(@Param("keySet") List<Action> keySet, @Param("targetsIds") List<Long> targetsIds);
|
||||||
|
|
||||||
@@ -191,7 +192,7 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
|
|||||||
* the current status of the actions which are affected
|
* the current status of the actions which are affected
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Query("UPDATE Action a SET a.status = :statusToSet WHERE a.target IN :targetsIds AND a.active = :active AND a.status = :currentStatus AND a.distributionSet.requiredMigrationStep = false")
|
@Query("UPDATE Action a SET a.status = :statusToSet WHERE a.target IN :targetsIds AND a.active = :active AND a.status = :currentStatus AND a.distributionSet.requiredMigrationStep = false")
|
||||||
void switchStatus(@Param("statusToSet") Action.Status statusToSet, @Param("targetsIds") List<Long> targetIds,
|
void switchStatus(@Param("statusToSet") Action.Status statusToSet, @Param("targetsIds") List<Long> targetIds,
|
||||||
@Param("active") boolean active, @Param("currentStatus") Action.Status currentStatus);
|
@Param("active") boolean active, @Param("currentStatus") Action.Status currentStatus);
|
||||||
@@ -211,7 +212,7 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
|
|||||||
* the current status of the actions which are affected
|
* the current status of the actions which are affected
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Query("UPDATE Action a SET a.status = :statusToSet WHERE a.rollout = :rollout AND a.active = :active AND a.status = :currentStatus")
|
@Query("UPDATE Action a SET a.status = :statusToSet WHERE a.rollout = :rollout AND a.active = :active AND a.status = :currentStatus")
|
||||||
void switchStatus(@Param("statusToSet") Action.Status statusToSet, @Param("rollout") Rollout rollout,
|
void switchStatus(@Param("statusToSet") Action.Status statusToSet, @Param("rollout") Rollout rollout,
|
||||||
@Param("active") boolean active, @Param("currentStatus") Action.Status currentStatus);
|
@Param("active") boolean active, @Param("currentStatus") Action.Status currentStatus);
|
||||||
@@ -386,6 +387,4 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
|
|||||||
@Query("SELECT NEW org.eclipse.hawkbit.repository.model.TotalTargetCountActionStatus(a.rolloutGroup.id, a.status , COUNT(a.target)) FROM Action a WHERE a.rolloutGroup.id IN ?1 GROUP BY a.rolloutGroup.id, a.status")
|
@Query("SELECT NEW org.eclipse.hawkbit.repository.model.TotalTargetCountActionStatus(a.rolloutGroup.id, a.status , COUNT(a.target)) FROM Action a WHERE a.rolloutGroup.id IN ?1 GROUP BY a.rolloutGroup.id, a.status")
|
||||||
List<TotalTargetCountActionStatus> getStatusCountByRolloutGroupId(List<Long> rolloutGroupId);
|
List<TotalTargetCountActionStatus> getStatusCountByRolloutGroupId(List<Long> rolloutGroupId);
|
||||||
|
|
||||||
// Asha-ends here
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,13 +16,14 @@ import org.springframework.data.domain.Pageable;
|
|||||||
import org.springframework.data.jpa.repository.EntityGraph;
|
import org.springframework.data.jpa.repository.EntityGraph;
|
||||||
import org.springframework.data.jpa.repository.EntityGraph.EntityGraphType;
|
import org.springframework.data.jpa.repository.EntityGraph.EntityGraphType;
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link ActionStatus} repository.
|
* {@link ActionStatus} repository.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
public interface ActionStatusRepository
|
public interface ActionStatusRepository
|
||||||
extends BaseEntityRepository<ActionStatus, Long>, JpaSpecificationExecutor<ActionStatus> {
|
extends BaseEntityRepository<ActionStatus, Long>, JpaSpecificationExecutor<ActionStatus> {
|
||||||
|
|
||||||
|
|||||||
@@ -43,17 +43,15 @@ import org.springframework.data.jpa.repository.Modifying;
|
|||||||
import org.springframework.hateoas.Identifiable;
|
import org.springframework.hateoas.Identifiable;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* service for {@link Artifact} management operations.
|
* Service for {@link Artifact} management operations.
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Validated
|
@Validated
|
||||||
@Service
|
@Service
|
||||||
public class ArtifactManagement {
|
public class ArtifactManagement {
|
||||||
@@ -108,7 +106,7 @@ public class ArtifactManagement {
|
|||||||
* if check against provided SHA1 checksum failed
|
* if check against provided SHA1 checksum failed
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
||||||
public LocalArtifact createLocalArtifact(@NotNull final InputStream stream, @NotNull final Long moduleId,
|
public LocalArtifact createLocalArtifact(@NotNull final InputStream stream, @NotNull final Long moduleId,
|
||||||
@NotEmpty final String filename, final String providedMd5Sum, final String providedSha1Sum,
|
@NotEmpty final String filename, final String providedMd5Sum, final String providedSha1Sum,
|
||||||
@@ -138,7 +136,7 @@ public class ArtifactManagement {
|
|||||||
return storeArtifactMetadata(softwareModule, filename, result, existing);
|
return storeArtifactMetadata(softwareModule, filename, result, existing);
|
||||||
}
|
}
|
||||||
|
|
||||||
private LocalArtifact checkForExistingArtifact(final String filename, final boolean overrideExisting,
|
private static LocalArtifact checkForExistingArtifact(final String filename, final boolean overrideExisting,
|
||||||
final SoftwareModule softwareModule) {
|
final SoftwareModule softwareModule) {
|
||||||
if (softwareModule.getLocalArtifactByFilename(filename).isPresent()) {
|
if (softwareModule.getLocalArtifactByFilename(filename).isPresent()) {
|
||||||
if (overrideExisting) {
|
if (overrideExisting) {
|
||||||
@@ -222,9 +220,7 @@ public class ArtifactManagement {
|
|||||||
artifact.setSize(result.getSize());
|
artifact.setSize(result.getSize());
|
||||||
|
|
||||||
LOG.debug("storing new artifact into repository {}", artifact);
|
LOG.debug("storing new artifact into repository {}", artifact);
|
||||||
final LocalArtifact artifactPersisted = localArtifactRepository.save(artifact);
|
return localArtifactRepository.save(artifact);
|
||||||
|
|
||||||
return artifactPersisted;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -242,7 +238,7 @@ public class ArtifactManagement {
|
|||||||
* @return created {@link ExternalArtifactProvider}
|
* @return created {@link ExternalArtifactProvider}
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
||||||
public ExternalArtifactProvider createExternalArtifactProvider(@NotEmpty final String name,
|
public ExternalArtifactProvider createExternalArtifactProvider(@NotEmpty final String name,
|
||||||
final String description, @NotNull final String basePath, final String defaultUrlSuffix) {
|
final String description, @NotNull final String basePath, final String defaultUrlSuffix) {
|
||||||
@@ -268,16 +264,13 @@ public class ArtifactManagement {
|
|||||||
* if {@link SoftwareModule} with given ID does not exist
|
* if {@link SoftwareModule} with given ID does not exist
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
||||||
public ExternalArtifact createExternalArtifact(@NotNull final ExternalArtifactProvider externalRepository,
|
public ExternalArtifact createExternalArtifact(@NotNull final ExternalArtifactProvider externalRepository,
|
||||||
final String urlSuffix, @NotNull final Long moduleId) {
|
final String urlSuffix, @NotNull final Long moduleId) {
|
||||||
|
|
||||||
final SoftwareModule module = getModuleAndThrowExceptionIfThatFails(moduleId);
|
final SoftwareModule module = getModuleAndThrowExceptionIfThatFails(moduleId);
|
||||||
final ExternalArtifact result = externalArtifactRepository
|
return externalArtifactRepository.save(new ExternalArtifact(externalRepository, urlSuffix, module));
|
||||||
.save(new ExternalArtifact(externalRepository, urlSuffix, module));
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -290,7 +283,7 @@ public class ArtifactManagement {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
||||||
public void deleteLocalArtifact(@NotNull final Long id) {
|
public void deleteLocalArtifact(@NotNull final Long id) {
|
||||||
final LocalArtifact existing = localArtifactRepository.findOne(id);
|
final LocalArtifact existing = localArtifactRepository.findOne(id);
|
||||||
@@ -313,7 +306,7 @@ public class ArtifactManagement {
|
|||||||
* the related local artifact
|
* the related local artifact
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
||||||
public void deleteGridFsArtifact(@NotNull final LocalArtifact existing) {
|
public void deleteGridFsArtifact(@NotNull final LocalArtifact existing) {
|
||||||
if (existing == null) {
|
if (existing == null) {
|
||||||
@@ -350,7 +343,7 @@ public class ArtifactManagement {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
||||||
public void deleteExternalArtifact(@NotNull final Long id) {
|
public void deleteExternalArtifact(@NotNull final Long id) {
|
||||||
final ExternalArtifact existing = externalArtifactRepository.findOne(id);
|
final ExternalArtifact existing = externalArtifactRepository.findOne(id);
|
||||||
@@ -425,17 +418,17 @@ public class ArtifactManagement {
|
|||||||
* @param filename
|
* @param filename
|
||||||
* of the artifact
|
* of the artifact
|
||||||
* @param overrideExisting
|
* @param overrideExisting
|
||||||
* to <code>true</code> if the artifact binary can be overdiden
|
* to <code>true</code> if the artifact binary can be overridden
|
||||||
* if it already exists
|
* if it already exists
|
||||||
* @param contentType
|
* @param contentType
|
||||||
* the contentType of the file
|
* the contentType of the file
|
||||||
*
|
*
|
||||||
* @return uploaded {@link LocalArtifact}
|
* @return uploaded {@link LocalArtifact}
|
||||||
*
|
*
|
||||||
* @throw ArtifactUploadFailedException if upload failes
|
* @throw ArtifactUploadFailedException if upload fails
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||||
public LocalArtifact createLocalArtifact(final InputStream inputStream, final Long moduleId, final String filename,
|
public LocalArtifact createLocalArtifact(final InputStream inputStream, final Long moduleId, final String filename,
|
||||||
final boolean overrideExisting, final String contentType) {
|
final boolean overrideExisting, final String contentType) {
|
||||||
@@ -461,7 +454,7 @@ public class ArtifactManagement {
|
|||||||
* @throw ArtifactUploadFailedException if upload failes
|
* @throw ArtifactUploadFailedException if upload failes
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||||
public LocalArtifact createLocalArtifact(final InputStream inputStream, final Long moduleId, final String filename,
|
public LocalArtifact createLocalArtifact(final InputStream inputStream, final Long moduleId, final String filename,
|
||||||
final boolean overrideExisting) {
|
final boolean overrideExisting) {
|
||||||
|
|||||||
@@ -14,21 +14,19 @@ import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
|
|||||||
import org.springframework.data.jpa.repository.Modifying;
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
import org.springframework.data.repository.NoRepositoryBean;
|
import org.springframework.data.repository.NoRepositoryBean;
|
||||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Command repository operations for all {@link TenantAwareBaseEntity}s.
|
* Command repository operations for all {@link TenantAwareBaseEntity}s.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param <T>
|
* @param <T>
|
||||||
* type if the entity type
|
* type if the entity type
|
||||||
* @param <I>
|
* @param <I>
|
||||||
* of the entity type
|
* of the entity type
|
||||||
*/
|
*/
|
||||||
@NoRepositoryBean
|
@NoRepositoryBean
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
public interface BaseEntityRepository<T extends TenantAwareBaseEntity, I extends Serializable>
|
public interface BaseEntityRepository<T extends TenantAwareBaseEntity, I extends Serializable>
|
||||||
extends PagingAndSortingRepository<T, I> {
|
extends PagingAndSortingRepository<T, I> {
|
||||||
|
|
||||||
@@ -39,7 +37,7 @@ public interface BaseEntityRepository<T extends TenantAwareBaseEntity, I extends
|
|||||||
* to delete data from
|
* to delete data from
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
void deleteByTenantIgnoreCase(String tenant);
|
void deleteByTenantIgnoreCase(String tenant);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import org.springframework.data.jpa.domain.Specification;
|
|||||||
import org.springframework.data.jpa.repository.Modifying;
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
@@ -54,7 +55,7 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Validated
|
@Validated
|
||||||
@Service
|
@Service
|
||||||
public class ControllerManagement {
|
public class ControllerManagement {
|
||||||
@@ -129,7 +130,7 @@ public class ControllerManagement {
|
|||||||
* if target with given ID could not be found
|
* if target with given ID could not be found
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||||
public Target updateLastTargetQuery(@NotEmpty final String targetid, final URI address) {
|
public Target updateLastTargetQuery(@NotEmpty final String targetid, final URI address) {
|
||||||
final Target target = targetRepository.findByControllerId(targetid);
|
final Target target = targetRepository.findByControllerId(targetid);
|
||||||
@@ -178,7 +179,7 @@ public class ControllerManagement {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||||
public TargetInfo updateLastTargetQuery(@NotNull final TargetInfo target, final URI address) {
|
public TargetInfo updateLastTargetQuery(@NotNull final TargetInfo target, final URI address) {
|
||||||
return updateTargetStatus(target, null, System.currentTimeMillis(), address);
|
return updateTargetStatus(target, null, System.currentTimeMillis(), address);
|
||||||
@@ -235,7 +236,7 @@ public class ControllerManagement {
|
|||||||
* @return target reference
|
* @return target reference
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||||
public Target findOrRegisterTargetIfItDoesNotexist(@NotEmpty final String targetid, final URI address) {
|
public Target findOrRegisterTargetIfItDoesNotexist(@NotEmpty final String targetid, final URI address) {
|
||||||
final Specification<Target> spec = (targetRoot, query, cb) -> cb.equal(targetRoot.get(Target_.controllerId),
|
final Specification<Target> spec = (targetRoot, query, cb) -> cb.equal(targetRoot.get(Target_.controllerId),
|
||||||
@@ -271,7 +272,7 @@ public class ControllerManagement {
|
|||||||
* @return the updated TargetInfo
|
* @return the updated TargetInfo
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||||
public TargetInfo updateTargetStatus(@NotNull final TargetInfo targetInfo, final TargetUpdateStatus status,
|
public TargetInfo updateTargetStatus(@NotNull final TargetInfo targetInfo, final TargetUpdateStatus status,
|
||||||
final Long lastTargetQuery, final URI address) {
|
final Long lastTargetQuery, final URI address) {
|
||||||
@@ -300,7 +301,7 @@ public class ControllerManagement {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||||
public Action addCancelActionStatus(@NotNull final ActionStatus actionStatus, final Action action) {
|
public Action addCancelActionStatus(@NotNull final ActionStatus actionStatus, final Action action) {
|
||||||
|
|
||||||
@@ -346,7 +347,7 @@ public class ControllerManagement {
|
|||||||
* inserted
|
* inserted
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||||
public Action addUpdateActionStatus(@NotNull final ActionStatus actionStatus, final Action action) {
|
public Action addUpdateActionStatus(@NotNull final ActionStatus actionStatus, final Action action) {
|
||||||
|
|
||||||
@@ -454,7 +455,7 @@ public class ControllerManagement {
|
|||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@NotNull
|
@NotNull
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||||
public Target updateControllerAttributes(@NotEmpty final String targetid, @NotNull final Map<String, String> data) {
|
public Target updateControllerAttributes(@NotEmpty final String targetid, @NotNull final Map<String, String> data) {
|
||||||
final Target target = targetRepository.findByControllerId(targetid);
|
final Target target = targetRepository.findByControllerId(targetid);
|
||||||
@@ -492,7 +493,7 @@ public class ControllerManagement {
|
|||||||
* {@link Status#RETRIEVED}
|
* {@link Status#RETRIEVED}
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||||
public Action registerRetrieved(final Action action, final String message) {
|
public Action registerRetrieved(final Action action, final String message) {
|
||||||
return handleRegisterRetrieved(action, message);
|
return handleRegisterRetrieved(action, message);
|
||||||
@@ -556,7 +557,7 @@ public class ControllerManagement {
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
public void addActionStatusMessage(final ActionStatus statusMessage) {
|
public void addActionStatusMessage(final ActionStatus statusMessage) {
|
||||||
actionStatusRepository.save(statusMessage);
|
actionStatusRepository.save(statusMessage);
|
||||||
}
|
}
|
||||||
@@ -573,7 +574,7 @@ public class ControllerManagement {
|
|||||||
* @return the security context of the target, in case no target exists for
|
* @return the security context of the target, in case no target exists for
|
||||||
* the given controllerId {@code null} is returned
|
* the given controllerId {@code null} is returned
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
public String getSecurityTokenByControllerId(final String controllerId) {
|
public String getSecurityTokenByControllerId(final String controllerId) {
|
||||||
final Target target = targetRepository.findByControllerId(controllerId);
|
final Target target = targetRepository.findByControllerId(controllerId);
|
||||||
return target != null ? target.getSecurityToken() : null;
|
return target != null ? target.getSecurityToken() : null;
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ import org.springframework.data.jpa.domain.Specification;
|
|||||||
import org.springframework.data.jpa.repository.Modifying;
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
@@ -78,7 +79,7 @@ import com.google.common.eventbus.EventBus;
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Validated
|
@Validated
|
||||||
@Service
|
@Service
|
||||||
public class DeploymentManagement {
|
public class DeploymentManagement {
|
||||||
@@ -133,7 +134,7 @@ public class DeploymentManagement {
|
|||||||
* {@link SoftwareModuleType} are not assigned as define by the
|
* {@link SoftwareModuleType} are not assigned as define by the
|
||||||
* {@link DistributionSetType}. *
|
* {@link DistributionSetType}. *
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Modifying
|
@Modifying
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
|
||||||
@CacheEvict(value = { "distributionUsageAssigned" }, allEntries = true)
|
@CacheEvict(value = { "distributionUsageAssigned" }, allEntries = true)
|
||||||
@@ -167,7 +168,7 @@ public class DeploymentManagement {
|
|||||||
* {@link DistributionSetType}.
|
* {@link DistributionSetType}.
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
|
||||||
@CacheEvict(value = { "distributionUsageAssigned" }, allEntries = true)
|
@CacheEvict(value = { "distributionUsageAssigned" }, allEntries = true)
|
||||||
public DistributionSetAssignmentResult assignDistributionSet(@NotNull final Long dsID,
|
public DistributionSetAssignmentResult assignDistributionSet(@NotNull final Long dsID,
|
||||||
@@ -195,7 +196,7 @@ public class DeploymentManagement {
|
|||||||
* {@link DistributionSetType}.
|
* {@link DistributionSetType}.
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
|
||||||
@CacheEvict(value = { "distributionUsageAssigned" }, allEntries = true)
|
@CacheEvict(value = { "distributionUsageAssigned" }, allEntries = true)
|
||||||
public DistributionSetAssignmentResult assignDistributionSet(@NotNull final Long dsID, final ActionType actionType,
|
public DistributionSetAssignmentResult assignDistributionSet(@NotNull final Long dsID, final ActionType actionType,
|
||||||
@@ -219,7 +220,7 @@ public class DeploymentManagement {
|
|||||||
* {@link DistributionSetType}.
|
* {@link DistributionSetType}.
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
|
||||||
@CacheEvict(value = { "distributionUsageAssigned" }, allEntries = true)
|
@CacheEvict(value = { "distributionUsageAssigned" }, allEntries = true)
|
||||||
public DistributionSetAssignmentResult assignDistributionSet(@NotNull final Long dsID,
|
public DistributionSetAssignmentResult assignDistributionSet(@NotNull final Long dsID,
|
||||||
@@ -243,7 +244,7 @@ public class DeploymentManagement {
|
|||||||
* a list of all targets and their action type
|
* a list of all targets and their action type
|
||||||
* @param rollout
|
* @param rollout
|
||||||
* the rollout for this assignment
|
* the rollout for this assignment
|
||||||
* @param rolloutgroup
|
* @param rolloutGroup
|
||||||
* the rollout group for this assignment
|
* the rollout group for this assignment
|
||||||
* @return the assignment result
|
* @return the assignment result
|
||||||
*
|
*
|
||||||
@@ -252,7 +253,7 @@ public class DeploymentManagement {
|
|||||||
* {@link DistributionSetType}.
|
* {@link DistributionSetType}.
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
|
||||||
@CacheEvict(value = { "distributionUsageAssigned" }, allEntries = true)
|
@CacheEvict(value = { "distributionUsageAssigned" }, allEntries = true)
|
||||||
public DistributionSetAssignmentResult assignDistributionSet(@NotNull final Long dsID,
|
public DistributionSetAssignmentResult assignDistributionSet(@NotNull final Long dsID,
|
||||||
@@ -276,7 +277,7 @@ public class DeploymentManagement {
|
|||||||
* a list of all targets and their action type
|
* a list of all targets and their action type
|
||||||
* @param rollout
|
* @param rollout
|
||||||
* the rollout for this assignment
|
* the rollout for this assignment
|
||||||
* @param rolloutgroup
|
* @param rolloutGroup
|
||||||
* the rollout group for this assignment
|
* the rollout group for this assignment
|
||||||
* @return the assignment result
|
* @return the assignment result
|
||||||
*
|
*
|
||||||
@@ -389,8 +390,8 @@ public class DeploymentManagement {
|
|||||||
softwareModules));
|
softwareModules));
|
||||||
}
|
}
|
||||||
|
|
||||||
private Action createTargetAction(final Map<String, TargetWithActionType> targetsWithActionMap, final Target target,
|
private static Action createTargetAction(final Map<String, TargetWithActionType> targetsWithActionMap,
|
||||||
final DistributionSet set, final Rollout rollout, final RolloutGroup rolloutGroup) {
|
final Target target, final DistributionSet set, final Rollout rollout, final RolloutGroup rolloutGroup) {
|
||||||
final Action actionForTarget = new Action();
|
final Action actionForTarget = new Action();
|
||||||
final TargetWithActionType targetWithActionType = targetsWithActionMap.get(target.getControllerId());
|
final TargetWithActionType targetWithActionType = targetsWithActionMap.get(target.getControllerId());
|
||||||
actionForTarget.setActionType(targetWithActionType.getActionType());
|
actionForTarget.setActionType(targetWithActionType.getActionType());
|
||||||
@@ -512,7 +513,7 @@ public class DeploymentManagement {
|
|||||||
* action
|
* action
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
||||||
public Action cancelAction(@NotNull final Action action, @NotNull final Target target) {
|
public Action cancelAction(@NotNull final Action action, @NotNull final Target target) {
|
||||||
LOG.debug("cancelAction({}, {})", action, target);
|
LOG.debug("cancelAction({}, {})", action, target);
|
||||||
@@ -569,7 +570,7 @@ public class DeploymentManagement {
|
|||||||
* in case the given action is not active
|
* in case the given action is not active
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
||||||
public Action forceQuitAction(@NotNull final Action action) {
|
public Action forceQuitAction(@NotNull final Action action) {
|
||||||
final Action mergedAction = entityManager.merge(action);
|
final Action mergedAction = entityManager.merge(action);
|
||||||
@@ -614,7 +615,7 @@ public class DeploymentManagement {
|
|||||||
* the rolloutgroup for this action
|
* the rolloutgroup for this action
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
||||||
public void createScheduledAction(final List<Target> targets, final DistributionSet distributionSet,
|
public void createScheduledAction(final List<Target> targets, final DistributionSet distributionSet,
|
||||||
final ActionType actionType, final long forcedTime, final Rollout rollout,
|
final ActionType actionType, final long forcedTime, final Rollout rollout,
|
||||||
@@ -648,7 +649,7 @@ public class DeploymentManagement {
|
|||||||
* @return the action which has been started
|
* @return the action which has been started
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET + SpringEvalExpressions.HAS_AUTH_OR
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET + SpringEvalExpressions.HAS_AUTH_OR
|
||||||
+ SpringEvalExpressions.IS_SYSTEM_CODE)
|
+ SpringEvalExpressions.IS_SYSTEM_CODE)
|
||||||
public Action startScheduledAction(@NotNull final Action action) {
|
public Action startScheduledAction(@NotNull final Action action) {
|
||||||
@@ -911,7 +912,7 @@ public class DeploymentManagement {
|
|||||||
* @return the updated or the found {@link TargetAction}
|
* @return the updated or the found {@link TargetAction}
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
||||||
public Action forceTargetAction(final Long actionId) {
|
public Action forceTargetAction(final Long actionId) {
|
||||||
final Action action = actionRepository.findOne(actionId);
|
final Action action = actionRepository.findOne(actionId);
|
||||||
@@ -923,7 +924,7 @@ public class DeploymentManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* retrieves all the {@link ActionStatus} entries of the given
|
* Retrieves all the {@link ActionStatus} entries of the given
|
||||||
* {@link Action} and {@link Target}.
|
* {@link Action} and {@link Target}.
|
||||||
*
|
*
|
||||||
* @param pageReq
|
* @param pageReq
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ import org.springframework.data.jpa.domain.Specification;
|
|||||||
import org.springframework.data.jpa.repository.Modifying;
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
@@ -69,7 +70,7 @@ import com.google.common.eventbus.EventBus;
|
|||||||
* Business facade for managing the {@link DistributionSet}s.
|
* Business facade for managing the {@link DistributionSet}s.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Validated
|
@Validated
|
||||||
@Service
|
@Service
|
||||||
public class DistributionSetManagement {
|
public class DistributionSetManagement {
|
||||||
@@ -142,7 +143,7 @@ public class DistributionSetManagement {
|
|||||||
* the assignment outcome.
|
* the assignment outcome.
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@NotNull
|
@NotNull
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||||
public DistributionSetTagAssignmentResult toggleTagAssignment(@NotEmpty final List<DistributionSet> sets,
|
public DistributionSetTagAssignmentResult toggleTagAssignment(@NotEmpty final List<DistributionSet> sets,
|
||||||
@@ -164,7 +165,7 @@ public class DistributionSetManagement {
|
|||||||
* the assignment outcome.
|
* the assignment outcome.
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@NotNull
|
@NotNull
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||||
public DistributionSetTagAssignmentResult toggleTagAssignment(@NotEmpty final Collection<Long> dsIds,
|
public DistributionSetTagAssignmentResult toggleTagAssignment(@NotEmpty final Collection<Long> dsIds,
|
||||||
@@ -229,7 +230,7 @@ public class DistributionSetManagement {
|
|||||||
* @throw DataDependencyViolationException in case of illegal update
|
* @throw DataDependencyViolationException in case of illegal update
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||||
public DistributionSet updateDistributionSet(@NotNull final DistributionSet ds) {
|
public DistributionSet updateDistributionSet(@NotNull final DistributionSet ds) {
|
||||||
checkNotNull(ds.getId());
|
checkNotNull(ds.getId());
|
||||||
@@ -254,7 +255,7 @@ public class DistributionSetManagement {
|
|||||||
* to delete
|
* to delete
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
||||||
public void deleteDistributionSet(@NotNull final DistributionSet set) {
|
public void deleteDistributionSet(@NotNull final DistributionSet set) {
|
||||||
deleteDistributionSet(set.getId());
|
deleteDistributionSet(set.getId());
|
||||||
@@ -269,7 +270,7 @@ public class DistributionSetManagement {
|
|||||||
* to be deleted
|
* to be deleted
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
||||||
public void deleteDistributionSet(@NotEmpty final Long... distributionSetIDs) {
|
public void deleteDistributionSet(@NotEmpty final Long... distributionSetIDs) {
|
||||||
final List<Long> toHardDelete = new ArrayList<>();
|
final List<Long> toHardDelete = new ArrayList<>();
|
||||||
@@ -310,7 +311,7 @@ public class DistributionSetManagement {
|
|||||||
* {@link SoftwareModule}s.
|
* {@link SoftwareModule}s.
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
||||||
public DistributionSet createDistributionSet(@NotNull final DistributionSet dSet) {
|
public DistributionSet createDistributionSet(@NotNull final DistributionSet dSet) {
|
||||||
prepareDsSave(dSet);
|
prepareDsSave(dSet);
|
||||||
@@ -344,7 +345,7 @@ public class DistributionSetManagement {
|
|||||||
* {@link SoftwareModule}s.
|
* {@link SoftwareModule}s.
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
||||||
public List<DistributionSet> createDistributionSets(@NotNull final Iterable<DistributionSet> distributionSets) {
|
public List<DistributionSet> createDistributionSets(@NotNull final Iterable<DistributionSet> distributionSets) {
|
||||||
for (final DistributionSet ds : distributionSets) {
|
for (final DistributionSet ds : distributionSets) {
|
||||||
@@ -366,7 +367,7 @@ public class DistributionSetManagement {
|
|||||||
* @return the updated {@link DistributionSet}.
|
* @return the updated {@link DistributionSet}.
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||||
public DistributionSet assignSoftwareModules(@NotNull final DistributionSet ds,
|
public DistributionSet assignSoftwareModules(@NotNull final DistributionSet ds,
|
||||||
final Set<SoftwareModule> softwareModules) {
|
final Set<SoftwareModule> softwareModules) {
|
||||||
@@ -388,7 +389,7 @@ public class DistributionSetManagement {
|
|||||||
* @return the updated {@link DistributionSet}.
|
* @return the updated {@link DistributionSet}.
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||||
public DistributionSet unassignSoftwareModule(@NotNull final DistributionSet ds,
|
public DistributionSet unassignSoftwareModule(@NotNull final DistributionSet ds,
|
||||||
final SoftwareModule softwareModule) {
|
final SoftwareModule softwareModule) {
|
||||||
@@ -413,7 +414,7 @@ public class DistributionSetManagement {
|
|||||||
* s while the DS type is already in use.
|
* s while the DS type is already in use.
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||||
public DistributionSetType updateDistributionSetType(@NotNull final DistributionSetType dsType) {
|
public DistributionSetType updateDistributionSetType(@NotNull final DistributionSetType dsType) {
|
||||||
checkNotNull(dsType.getId());
|
checkNotNull(dsType.getId());
|
||||||
@@ -715,7 +716,7 @@ public class DistributionSetManagement {
|
|||||||
* @return created {@link Entity}
|
* @return created {@link Entity}
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
||||||
public DistributionSetType createDistributionSetType(@NotNull final DistributionSetType type) {
|
public DistributionSetType createDistributionSetType(@NotNull final DistributionSetType type) {
|
||||||
if (type.getId() != null) {
|
if (type.getId() != null) {
|
||||||
@@ -732,7 +733,7 @@ public class DistributionSetManagement {
|
|||||||
* to delete
|
* to delete
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
||||||
public void deleteDistributionSetType(@NotNull final DistributionSetType type) {
|
public void deleteDistributionSetType(@NotNull final DistributionSetType type) {
|
||||||
|
|
||||||
@@ -755,7 +756,7 @@ public class DistributionSetManagement {
|
|||||||
* in case the meta data entry already exists for the specific
|
* in case the meta data entry already exists for the specific
|
||||||
* key
|
* key
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Modifying
|
@Modifying
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||||
public DistributionSetMetadata createDistributionSetMetadata(@NotNull final DistributionSetMetadata metadata) {
|
public DistributionSetMetadata createDistributionSetMetadata(@NotNull final DistributionSetMetadata metadata) {
|
||||||
@@ -780,7 +781,7 @@ public class DistributionSetManagement {
|
|||||||
* in case one of the meta data entry already exists for the
|
* in case one of the meta data entry already exists for the
|
||||||
* specific key
|
* specific key
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Modifying
|
@Modifying
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||||
public List<DistributionSetMetadata> createDistributionSetMetadata(
|
public List<DistributionSetMetadata> createDistributionSetMetadata(
|
||||||
@@ -802,7 +803,7 @@ public class DistributionSetManagement {
|
|||||||
* in case the meta data entry does not exists and cannot be
|
* in case the meta data entry does not exists and cannot be
|
||||||
* updated
|
* updated
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Modifying
|
@Modifying
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||||
public DistributionSetMetadata updateDistributionSetMetadata(@NotNull final DistributionSetMetadata metadata) {
|
public DistributionSetMetadata updateDistributionSetMetadata(@NotNull final DistributionSetMetadata metadata) {
|
||||||
@@ -820,7 +821,7 @@ public class DistributionSetManagement {
|
|||||||
* @param id
|
* @param id
|
||||||
* the ID of the distribution set meta data to delete
|
* the ID of the distribution set meta data to delete
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Modifying
|
@Modifying
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||||
public void deleteDistributionSetMetadata(@NotNull final DsMetadataCompositeKey id) {
|
public void deleteDistributionSetMetadata(@NotNull final DsMetadataCompositeKey id) {
|
||||||
@@ -913,7 +914,7 @@ public class DistributionSetManagement {
|
|||||||
* @return created {@link Entity}
|
* @return created {@link Entity}
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
||||||
public List<DistributionSetType> createDistributionSetTypes(@NotNull final Collection<DistributionSetType> types) {
|
public List<DistributionSetType> createDistributionSetTypes(@NotNull final Collection<DistributionSetType> types) {
|
||||||
return types.stream().map(this::createDistributionSetType).collect(Collectors.toList());
|
return types.stream().map(this::createDistributionSetType).collect(Collectors.toList());
|
||||||
@@ -926,7 +927,7 @@ public class DistributionSetManagement {
|
|||||||
* @param softwareModules
|
* @param softwareModules
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||||
public void checkDistributionSetAlreadyUse(final DistributionSet distributionSet) {
|
public void checkDistributionSetAlreadyUse(final DistributionSet distributionSet) {
|
||||||
checkDistributionSetSoftwareModulesIsAllowedToModify(distributionSet);
|
checkDistributionSetSoftwareModulesIsAllowedToModify(distributionSet);
|
||||||
@@ -992,14 +993,14 @@ public class DistributionSetManagement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Boolean isDSWithNoTagSelected(final DistributionSetFilter distributionSetFilter) {
|
private static Boolean isDSWithNoTagSelected(final DistributionSetFilter distributionSetFilter) {
|
||||||
if (distributionSetFilter.getSelectDSWithNoTag() != null && distributionSetFilter.getSelectDSWithNoTag()) {
|
if (distributionSetFilter.getSelectDSWithNoTag() != null && distributionSetFilter.getSelectDSWithNoTag()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Boolean isTagsSelected(final DistributionSetFilter distributionSetFilter) {
|
private static Boolean isTagsSelected(final DistributionSetFilter distributionSetFilter) {
|
||||||
if (distributionSetFilter.getTagNames() != null && !distributionSetFilter.getTagNames().isEmpty()) {
|
if (distributionSetFilter.getTagNames() != null && !distributionSetFilter.getTagNames().isEmpty()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1033,7 +1034,7 @@ public class DistributionSetManagement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void throwMetadataKeyAlreadyExists(final String metadataKey) {
|
private static void throwMetadataKeyAlreadyExists(final String metadataKey) {
|
||||||
throw new EntityAlreadyExistsException("Metadata entry with key '" + metadataKey + "' already exists");
|
throw new EntityAlreadyExistsException("Metadata entry with key '" + metadataKey + "' already exists");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1048,7 +1049,7 @@ public class DistributionSetManagement {
|
|||||||
* @return list of assigned ds
|
* @return list of assigned ds
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@NotNull
|
@NotNull
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
||||||
public List<DistributionSet> assignTag(@NotEmpty final Collection<Long> dsIds,
|
public List<DistributionSet> assignTag(@NotEmpty final Collection<Long> dsIds,
|
||||||
@@ -1077,7 +1078,7 @@ public class DistributionSetManagement {
|
|||||||
* @return list of unassigned ds
|
* @return list of unassigned ds
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@NotNull
|
@NotNull
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
||||||
public List<DistributionSet> unAssignAllDistributionSetsByTag(@NotNull final DistributionSetTag tag) {
|
public List<DistributionSet> unAssignAllDistributionSetsByTag(@NotNull final DistributionSetTag tag) {
|
||||||
@@ -1095,7 +1096,7 @@ public class DistributionSetManagement {
|
|||||||
* @return the unassigned ds or <null> if no ds is unassigned
|
* @return the unassigned ds or <null> if no ds is unassigned
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
||||||
public DistributionSet unAssignTag(@NotNull final Long dsId, @NotNull final DistributionSetTag distributionSetTag) {
|
public DistributionSet unAssignTag(@NotNull final Long dsId, @NotNull final DistributionSetTag distributionSetTag) {
|
||||||
final List<DistributionSet> allDs = findDistributionSetListWithDetails(Arrays.asList(dsId));
|
final List<DistributionSet> allDs = findDistributionSetListWithDetails(Arrays.asList(dsId));
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import org.eclipse.hawkbit.repository.model.DistributionSetMetadata;
|
|||||||
import org.eclipse.hawkbit.repository.model.DsMetadataCompositeKey;
|
import org.eclipse.hawkbit.repository.model.DsMetadataCompositeKey;
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -20,7 +21,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
public interface DistributionSetMetadataRepository
|
public interface DistributionSetMetadataRepository
|
||||||
extends PagingAndSortingRepository<DistributionSetMetadata, DsMetadataCompositeKey>,
|
extends PagingAndSortingRepository<DistributionSetMetadata, DsMetadataCompositeKey>,
|
||||||
JpaSpecificationExecutor<DistributionSetMetadata> {
|
JpaSpecificationExecutor<DistributionSetMetadata> {
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
|||||||
import org.springframework.data.jpa.repository.Modifying;
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -29,7 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
public interface DistributionSetRepository
|
public interface DistributionSetRepository
|
||||||
extends BaseEntityRepository<DistributionSet, Long>, JpaSpecificationExecutor<DistributionSet> {
|
extends BaseEntityRepository<DistributionSet, Long>, JpaSpecificationExecutor<DistributionSet> {
|
||||||
|
|
||||||
@@ -50,7 +51,7 @@ public interface DistributionSetRepository
|
|||||||
* to be deleted
|
* to be deleted
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Query("update DistributionSet d set d.deleted = 1 where d.id in :ids")
|
@Query("update DistributionSet d set d.deleted = 1 where d.id in :ids")
|
||||||
void deleteDistributionSet(@Param("ids") Long... ids);
|
void deleteDistributionSet(@Param("ids") Long... ids);
|
||||||
|
|
||||||
@@ -62,7 +63,7 @@ public interface DistributionSetRepository
|
|||||||
* @return number of affected/deleted records
|
* @return number of affected/deleted records
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
// Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=349477
|
// Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=349477
|
||||||
@Query("DELETE FROM DistributionSet d WHERE d.id IN ?1")
|
@Query("DELETE FROM DistributionSet d WHERE d.id IN ?1")
|
||||||
int deleteByIdIn(Collection<Long> ids);
|
int deleteByIdIn(Collection<Long> ids);
|
||||||
@@ -82,7 +83,7 @@ public interface DistributionSetRepository
|
|||||||
* yet to an {@link UpdateAction}, i.e. unused.
|
* yet to an {@link UpdateAction}, i.e. unused.
|
||||||
*
|
*
|
||||||
* @param ids
|
* @param ids
|
||||||
* to searcgh for
|
* to search for
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Query("select ac.distributionSet.id from Action ac where ac.distributionSet.id in :ids")
|
@Query("select ac.distributionSet.id from Action ac where ac.distributionSet.id in :ids")
|
||||||
|
|||||||
@@ -15,15 +15,14 @@ import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
|||||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
import org.springframework.data.jpa.repository.Modifying;
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link TargetTag} repository.
|
* {@link TargetTag} repository.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
public interface DistributionSetTagRepository
|
public interface DistributionSetTagRepository
|
||||||
extends BaseEntityRepository<DistributionSetTag, Long>, JpaSpecificationExecutor<DistributionSetTag> {
|
extends BaseEntityRepository<DistributionSetTag, Long>, JpaSpecificationExecutor<DistributionSetTag> {
|
||||||
/**
|
/**
|
||||||
@@ -34,7 +33,7 @@ public interface DistributionSetTagRepository
|
|||||||
* @return 1 if tag was deleted
|
* @return 1 if tag was deleted
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
Long deleteByName(final String tagName);
|
Long deleteByName(final String tagName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -14,16 +14,14 @@ import org.springframework.data.domain.Page;
|
|||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link PagingAndSortingRepository} for {@link DistributionSetType}.
|
* {@link PagingAndSortingRepository} for {@link DistributionSetType}.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
public interface DistributionSetTypeRepository
|
public interface DistributionSetTypeRepository
|
||||||
extends BaseEntityRepository<DistributionSetType, Long>, JpaSpecificationExecutor<DistributionSetType> {
|
extends BaseEntityRepository<DistributionSetType, Long>, JpaSpecificationExecutor<DistributionSetType> {
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.Query;
|
import javax.persistence.Query;
|
||||||
import javax.transaction.Transactional;
|
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.TargetInfo;
|
import org.eclipse.hawkbit.repository.model.TargetInfo;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||||
@@ -21,16 +20,16 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.cache.annotation.CacheEvict;
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
import org.springframework.data.jpa.repository.Modifying;
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom repository implementation as standard spring repository fails as of
|
* Custom repository implementation as standard spring repository fails as of
|
||||||
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=415027 .
|
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=415027 .
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@Transactional
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
public class EclipseLinkTargetInfoRepository implements TargetInfoRepository {
|
public class EclipseLinkTargetInfoRepository implements TargetInfoRepository {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -38,6 +37,7 @@ public class EclipseLinkTargetInfoRepository implements TargetInfoRepository {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Modifying
|
@Modifying
|
||||||
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
public void setTargetUpdateStatus(final TargetUpdateStatus status, final List<Long> targets) {
|
public void setTargetUpdateStatus(final TargetUpdateStatus status, final List<Long> targets) {
|
||||||
final Query query = entityManager.createQuery(
|
final Query query = entityManager.createQuery(
|
||||||
"update TargetInfo ti set ti.updateStatus = :status where ti.targetId in :targets and ti.updateStatus != :status");
|
"update TargetInfo ti set ti.updateStatus = :status where ti.targetId in :targets and ti.updateStatus != :status");
|
||||||
@@ -48,6 +48,7 @@ public class EclipseLinkTargetInfoRepository implements TargetInfoRepository {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Modifying
|
@Modifying
|
||||||
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@CacheEvict(value = { "targetStatus", "distributionUsageInstalled", "targetsLastPoll" }, allEntries = true)
|
@CacheEvict(value = { "targetStatus", "distributionUsageInstalled", "targetsLastPoll" }, allEntries = true)
|
||||||
public <S extends TargetInfo> S save(final S entity) {
|
public <S extends TargetInfo> S save(final S entity) {
|
||||||
|
|
||||||
@@ -61,6 +62,7 @@ public class EclipseLinkTargetInfoRepository implements TargetInfoRepository {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Modifying
|
@Modifying
|
||||||
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@CacheEvict(value = { "targetStatus", "distributionUsageInstalled", "targetsLastPoll" }, allEntries = true)
|
@CacheEvict(value = { "targetStatus", "distributionUsageInstalled", "targetsLastPoll" }, allEntries = true)
|
||||||
public void deleteByTargetIdIn(final Collection<Long> targetIDs) {
|
public void deleteByTargetIdIn(final Collection<Long> targetIDs) {
|
||||||
final javax.persistence.Query query = entityManager
|
final javax.persistence.Query query = entityManager
|
||||||
|
|||||||
@@ -9,16 +9,14 @@
|
|||||||
package org.eclipse.hawkbit.repository;
|
package org.eclipse.hawkbit.repository;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.ExternalArtifactProvider;
|
import org.eclipse.hawkbit.repository.model.ExternalArtifactProvider;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Repository for {@link ExternalArtifactProvider}.
|
* Repository for {@link ExternalArtifactProvider}.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
public interface ExternalArtifactProviderRepository extends BaseEntityRepository<ExternalArtifactProvider, Long> {
|
public interface ExternalArtifactProviderRepository extends BaseEntityRepository<ExternalArtifactProvider, Long> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,15 +11,14 @@ package org.eclipse.hawkbit.repository;
|
|||||||
import org.eclipse.hawkbit.repository.model.ExternalArtifact;
|
import org.eclipse.hawkbit.repository.model.ExternalArtifact;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link ExternalArtifact} repository.
|
* {@link ExternalArtifact} repository.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
public interface ExternalArtifactRepository extends BaseEntityRepository<ExternalArtifact, Long> {
|
public interface ExternalArtifactRepository extends BaseEntityRepository<ExternalArtifact, Long> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -15,13 +15,14 @@ import org.eclipse.hawkbit.repository.model.LocalArtifact;
|
|||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link LocalArtifact} repository.
|
* {@link LocalArtifact} repository.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
public interface LocalArtifactRepository extends BaseEntityRepository<LocalArtifact, Long> {
|
public interface LocalArtifactRepository extends BaseEntityRepository<LocalArtifact, Long> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -48,14 +48,15 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service layer for generating SP reportings.
|
* Service layer for generating hawkBit reports.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Validated
|
@Validated
|
||||||
@Service
|
@Service
|
||||||
public class ReportManagement {
|
public class ReportManagement {
|
||||||
@@ -404,7 +405,7 @@ public class ReportManagement {
|
|||||||
return innerOuterReport;
|
return innerOuterReport;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final class InnerOuter {
|
private static final class InnerOuter {
|
||||||
final DSName name;
|
final DSName name;
|
||||||
long count;
|
long count;
|
||||||
final List<InnerOuter> outer;
|
final List<InnerOuter> outer;
|
||||||
@@ -433,9 +434,6 @@ public class ReportManagement {
|
|||||||
/**
|
/**
|
||||||
* Object contains the name and the id of an entity.
|
* Object contains the name and the id of an entity.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
private static final class DSName {
|
private static final class DSName {
|
||||||
|
|
||||||
@@ -510,9 +508,6 @@ public class ReportManagement {
|
|||||||
* Return DateTypes.
|
* Return DateTypes.
|
||||||
*/
|
*/
|
||||||
public static final class DateTypes implements Serializable {
|
public static final class DateTypes implements Serializable {
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private static final PerMonth PER_MONTH = new PerMonth();
|
private static final PerMonth PER_MONTH = new PerMonth();
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import org.springframework.data.domain.Pageable;
|
|||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
@@ -52,7 +53,7 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
*/
|
*/
|
||||||
@Validated
|
@Validated
|
||||||
@Service
|
@Service
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
public class RolloutGroupManagement {
|
public class RolloutGroupManagement {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -213,7 +214,7 @@ public class RolloutGroupManagement {
|
|||||||
return targetRepository.findByActionsRolloutGroup(rolloutGroup, page);
|
return targetRepository.findByActionsRolloutGroup(rolloutGroup, page);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isRolloutStatusReady(final RolloutGroup rolloutGroup) {
|
private static boolean isRolloutStatusReady(final RolloutGroup rolloutGroup) {
|
||||||
return rolloutGroup != null && RolloutStatus.READY.equals(rolloutGroup.getRollout().getStatus());
|
return rolloutGroup != null && RolloutStatus.READY.equals(rolloutGroup.getRollout().getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -259,5 +260,4 @@ public class RolloutGroupManagement {
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
return new PageImpl<>(targetWithActionStatus, pageRequest, totalCount);
|
return new PageImpl<>(targetWithActionStatus, pageRequest, totalCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -18,12 +18,13 @@ import org.springframework.data.domain.Pageable;
|
|||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The repository interface for the {@link RolloutGroup} model.
|
* The repository interface for the {@link RolloutGroup} model.
|
||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
public interface RolloutGroupRepository
|
public interface RolloutGroupRepository
|
||||||
extends BaseEntityRepository<RolloutGroup, Long>, JpaSpecificationExecutor<RolloutGroup> {
|
extends BaseEntityRepository<RolloutGroup, Long>, JpaSpecificationExecutor<RolloutGroup> {
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.PlatformTransactionManager;
|
import org.springframework.transaction.PlatformTransactionManager;
|
||||||
import org.springframework.transaction.TransactionDefinition;
|
import org.springframework.transaction.TransactionDefinition;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.transaction.support.DefaultTransactionDefinition;
|
import org.springframework.transaction.support.DefaultTransactionDefinition;
|
||||||
import org.springframework.transaction.support.TransactionTemplate;
|
import org.springframework.transaction.support.TransactionTemplate;
|
||||||
@@ -72,7 +73,7 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
@Validated
|
@Validated
|
||||||
@Service
|
@Service
|
||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
public class RolloutManagement {
|
public class RolloutManagement {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(RolloutManagement.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(RolloutManagement.class);
|
||||||
|
|
||||||
@@ -199,7 +200,7 @@ public class RolloutManagement {
|
|||||||
* @throws IllegalArgumentException
|
* @throws IllegalArgumentException
|
||||||
* in case the given groupSize is zero or lower.
|
* in case the given groupSize is zero or lower.
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Modifying
|
@Modifying
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_WRITE)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_WRITE)
|
||||||
public Rollout createRollout(final Rollout rollout, final int amountGroup,
|
public Rollout createRollout(final Rollout rollout, final int amountGroup,
|
||||||
@@ -242,7 +243,7 @@ public class RolloutManagement {
|
|||||||
* @return the created rollout entity in state
|
* @return the created rollout entity in state
|
||||||
* {@link RolloutStatus#CREATING}
|
* {@link RolloutStatus#CREATING}
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Modifying
|
@Modifying
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_WRITE)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_WRITE)
|
||||||
public Rollout createRolloutAsync(final Rollout rollout, final int amountGroup,
|
public Rollout createRolloutAsync(final Rollout rollout, final int amountGroup,
|
||||||
@@ -280,7 +281,7 @@ public class RolloutManagement {
|
|||||||
return rolloutRepository.save(rollout);
|
return rolloutRepository.save(rollout);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void verifyRolloutGroupParameter(final int amountGroup) {
|
private static void verifyRolloutGroupParameter(final int amountGroup) {
|
||||||
if (amountGroup <= 0) {
|
if (amountGroup <= 0) {
|
||||||
throw new IllegalArgumentException("the amountGroup must be greater than zero");
|
throw new IllegalArgumentException("the amountGroup must be greater than zero");
|
||||||
} else if (amountGroup > 500) {
|
} else if (amountGroup > 500) {
|
||||||
@@ -362,11 +363,13 @@ public class RolloutManagement {
|
|||||||
* @param rollout
|
* @param rollout
|
||||||
* the rollout to be started
|
* the rollout to be started
|
||||||
*
|
*
|
||||||
|
* @return started rollout
|
||||||
|
*
|
||||||
* @throws RolloutIllegalStateException
|
* @throws RolloutIllegalStateException
|
||||||
* if given rollout is not in {@link RolloutStatus#READY}. Only
|
* if given rollout is not in {@link RolloutStatus#READY}. Only
|
||||||
* ready rollouts can be started.
|
* ready rollouts can be started.
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Modifying
|
@Modifying
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_WRITE + SpringEvalExpressions.HAS_AUTH_OR
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_WRITE + SpringEvalExpressions.HAS_AUTH_OR
|
||||||
+ SpringEvalExpressions.IS_SYSTEM_CODE)
|
+ SpringEvalExpressions.IS_SYSTEM_CODE)
|
||||||
@@ -389,6 +392,8 @@ public class RolloutManagement {
|
|||||||
* @param rollout
|
* @param rollout
|
||||||
* the rollout to be started
|
* the rollout to be started
|
||||||
*
|
*
|
||||||
|
* @return the started rollout
|
||||||
|
*
|
||||||
* @throws RolloutIllegalStateException
|
* @throws RolloutIllegalStateException
|
||||||
* if given rollout is not in {@link RolloutStatus#READY}. Only
|
* if given rollout is not in {@link RolloutStatus#READY}. Only
|
||||||
* ready rollouts can be started.
|
* ready rollouts can be started.
|
||||||
@@ -468,7 +473,7 @@ public class RolloutManagement {
|
|||||||
* if given rollout is not in {@link RolloutStatus#RUNNING}.
|
* if given rollout is not in {@link RolloutStatus#RUNNING}.
|
||||||
* Only running rollouts can be paused.
|
* Only running rollouts can be paused.
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Modifying
|
@Modifying
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_WRITE + SpringEvalExpressions.HAS_AUTH_OR
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_WRITE + SpringEvalExpressions.HAS_AUTH_OR
|
||||||
+ SpringEvalExpressions.IS_SYSTEM_CODE)
|
+ SpringEvalExpressions.IS_SYSTEM_CODE)
|
||||||
@@ -498,7 +503,7 @@ public class RolloutManagement {
|
|||||||
* if given rollout is not in {@link RolloutStatus#PAUSED}. Only
|
* if given rollout is not in {@link RolloutStatus#PAUSED}. Only
|
||||||
* paused rollouts can be resumed.
|
* paused rollouts can be resumed.
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Modifying
|
@Modifying
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_WRITE + SpringEvalExpressions.HAS_AUTH_OR
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_WRITE + SpringEvalExpressions.HAS_AUTH_OR
|
||||||
+ SpringEvalExpressions.IS_SYSTEM_CODE)
|
+ SpringEvalExpressions.IS_SYSTEM_CODE)
|
||||||
@@ -540,7 +545,7 @@ public class RolloutManagement {
|
|||||||
* this check. This check is only applied if the last check is
|
* this check. This check is only applied if the last check is
|
||||||
* less than (lastcheck-delay).
|
* less than (lastcheck-delay).
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Modifying
|
@Modifying
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_WRITE + SpringEvalExpressions.HAS_AUTH_OR
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_WRITE + SpringEvalExpressions.HAS_AUTH_OR
|
||||||
+ SpringEvalExpressions.IS_SYSTEM_CODE)
|
+ SpringEvalExpressions.IS_SYSTEM_CODE)
|
||||||
@@ -783,7 +788,7 @@ public class RolloutManagement {
|
|||||||
* @return Rollout updated rollout
|
* @return Rollout updated rollout
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Modifying
|
@Modifying
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_WRITE)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_WRITE)
|
||||||
public Rollout updateRollout(@NotNull final Rollout rollout) {
|
public Rollout updateRollout(@NotNull final Rollout rollout) {
|
||||||
@@ -845,7 +850,7 @@ public class RolloutManagement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkIfRolloutCanStarted(final Rollout rollout, final Rollout mergedRollout) {
|
private static void checkIfRolloutCanStarted(final Rollout rollout, final Rollout mergedRollout) {
|
||||||
if (!(RolloutStatus.READY.equals(mergedRollout.getStatus()))) {
|
if (!(RolloutStatus.READY.equals(mergedRollout.getStatus()))) {
|
||||||
throw new RolloutIllegalStateException("Rollout can only be started in state ready but current state is "
|
throw new RolloutIllegalStateException("Rollout can only be started in state ready but current state is "
|
||||||
+ rollout.getStatus().name().toLowerCase());
|
+ rollout.getStatus().name().toLowerCase());
|
||||||
|
|||||||
@@ -18,12 +18,13 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
|||||||
import org.springframework.data.jpa.repository.Modifying;
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The repository interface for the {@link Rollout} model.
|
* The repository interface for the {@link Rollout} model.
|
||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
public interface RolloutRepository extends BaseEntityRepository<Rollout, Long>, JpaSpecificationExecutor<Rollout> {
|
public interface RolloutRepository extends BaseEntityRepository<Rollout, Long>, JpaSpecificationExecutor<Rollout> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,7 +41,7 @@ public interface RolloutRepository extends BaseEntityRepository<Rollout, Long>,
|
|||||||
* @return the count of the updated rows. Zero if no row has been updated
|
* @return the count of the updated rows. Zero if no row has been updated
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Query("UPDATE Rollout r SET r.lastCheck = :lastCheck WHERE r.lastCheck < (:lastCheck - :delay) AND r.status=:status")
|
@Query("UPDATE Rollout r SET r.lastCheck = :lastCheck WHERE r.lastCheck < (:lastCheck - :delay) AND r.status=:status")
|
||||||
int updateLastCheck(@Param("lastCheck") final long lastCheck, @Param("delay") final long delay,
|
int updateLastCheck(@Param("lastCheck") final long lastCheck, @Param("delay") final long delay,
|
||||||
@Param("status") final RolloutStatus status);
|
@Param("status") final RolloutStatus status);
|
||||||
|
|||||||
@@ -12,11 +12,14 @@ import org.eclipse.hawkbit.repository.model.RolloutTargetGroup;
|
|||||||
import org.eclipse.hawkbit.repository.model.RolloutTargetGroupId;
|
import org.eclipse.hawkbit.repository.model.RolloutTargetGroupId;
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
import org.springframework.data.repository.CrudRepository;
|
import org.springframework.data.repository.CrudRepository;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Spring data repository for {@link RolloutTargetGroup}.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
public interface RolloutTargetGroupRepository
|
public interface RolloutTargetGroupRepository
|
||||||
extends CrudRepository<RolloutTargetGroup, RolloutTargetGroupId>, JpaSpecificationExecutor<RolloutTargetGroup> {
|
extends CrudRepository<RolloutTargetGroup, RolloutTargetGroupId>, JpaSpecificationExecutor<RolloutTargetGroup> {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ import org.springframework.data.jpa.domain.Specification;
|
|||||||
import org.springframework.data.jpa.repository.Modifying;
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
@@ -62,7 +63,7 @@ import com.google.common.collect.Sets;
|
|||||||
* Business facade for managing {@link SoftwareModule}s.
|
* Business facade for managing {@link SoftwareModule}s.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Validated
|
@Validated
|
||||||
@Service
|
@Service
|
||||||
public class SoftwareManagement {
|
public class SoftwareManagement {
|
||||||
@@ -108,7 +109,7 @@ public class SoftwareManagement {
|
|||||||
* of {@link SoftwareModule#getId()} is <code>null</code>
|
* of {@link SoftwareModule#getId()} is <code>null</code>
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||||
public SoftwareModule updateSoftwareModule(@NotNull final SoftwareModule sm) {
|
public SoftwareModule updateSoftwareModule(@NotNull final SoftwareModule sm) {
|
||||||
checkNotNull(sm.getId());
|
checkNotNull(sm.getId());
|
||||||
@@ -138,7 +139,7 @@ public class SoftwareManagement {
|
|||||||
* @return updated {@link Entity}
|
* @return updated {@link Entity}
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||||
public SoftwareModuleType updateSoftwareModuleType(@NotNull final SoftwareModuleType sm) {
|
public SoftwareModuleType updateSoftwareModuleType(@NotNull final SoftwareModuleType sm) {
|
||||||
checkNotNull(sm.getId());
|
checkNotNull(sm.getId());
|
||||||
@@ -283,7 +284,7 @@ public class SoftwareManagement {
|
|||||||
* is the {@link SoftwareModule} to be deleted
|
* is the {@link SoftwareModule} to be deleted
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
||||||
public void deleteSoftwareModule(@NotNull final SoftwareModule bsm) {
|
public void deleteSoftwareModule(@NotNull final SoftwareModule bsm) {
|
||||||
|
|
||||||
@@ -314,10 +315,10 @@ public class SoftwareManagement {
|
|||||||
* Deletes {@link SoftwareModule}s which is any if the given ids.
|
* Deletes {@link SoftwareModule}s which is any if the given ids.
|
||||||
*
|
*
|
||||||
* @param ids
|
* @param ids
|
||||||
* of the Software Moduels to be deleted
|
* of the Software Modules to be deleted
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
||||||
public void deleteSoftwareModules(@NotNull final Iterable<Long> ids) {
|
public void deleteSoftwareModules(@NotNull final Iterable<Long> ids) {
|
||||||
final List<SoftwareModule> swModulesToDelete = softwareModuleRepository.findByIdIn(ids);
|
final List<SoftwareModule> swModulesToDelete = softwareModuleRepository.findByIdIn(ids);
|
||||||
@@ -579,7 +580,7 @@ public class SoftwareManagement {
|
|||||||
return new SliceImpl<>(resultList);
|
return new SliceImpl<>(resultList);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Specification<SoftwareModule>> buildSpecificationList(final String searchText,
|
private static List<Specification<SoftwareModule>> buildSpecificationList(final String searchText,
|
||||||
final SoftwareModuleType type) {
|
final SoftwareModuleType type) {
|
||||||
final List<Specification<SoftwareModule>> specList = new ArrayList<>();
|
final List<Specification<SoftwareModule>> specList = new ArrayList<>();
|
||||||
if (!Strings.isNullOrEmpty(searchText)) {
|
if (!Strings.isNullOrEmpty(searchText)) {
|
||||||
@@ -700,7 +701,7 @@ public class SoftwareManagement {
|
|||||||
* @return created {@link Entity}
|
* @return created {@link Entity}
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
||||||
public SoftwareModuleType createSoftwareModuleType(@NotNull final SoftwareModuleType type) {
|
public SoftwareModuleType createSoftwareModuleType(@NotNull final SoftwareModuleType type) {
|
||||||
if (type.getId() != null) {
|
if (type.getId() != null) {
|
||||||
@@ -718,7 +719,7 @@ public class SoftwareManagement {
|
|||||||
* @return created {@link Entity}
|
* @return created {@link Entity}
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
||||||
public List<SoftwareModuleType> createSoftwareModuleType(@NotNull final Collection<SoftwareModuleType> types) {
|
public List<SoftwareModuleType> createSoftwareModuleType(@NotNull final Collection<SoftwareModuleType> types) {
|
||||||
return types.stream().map(this::createSoftwareModuleType).collect(Collectors.toList());
|
return types.stream().map(this::createSoftwareModuleType).collect(Collectors.toList());
|
||||||
@@ -731,7 +732,7 @@ public class SoftwareManagement {
|
|||||||
* to delete
|
* to delete
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
||||||
public void deleteSoftwareModuleType(@NotNull final SoftwareModuleType type) {
|
public void deleteSoftwareModuleType(@NotNull final SoftwareModuleType type) {
|
||||||
|
|
||||||
@@ -785,7 +786,7 @@ public class SoftwareManagement {
|
|||||||
* in case the meta data entry already exists for the specific
|
* in case the meta data entry already exists for the specific
|
||||||
* key
|
* key
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Modifying
|
@Modifying
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||||
public SoftwareModuleMetadata createSoftwareModuleMetadata(@NotNull final SoftwareModuleMetadata metadata) {
|
public SoftwareModuleMetadata createSoftwareModuleMetadata(@NotNull final SoftwareModuleMetadata metadata) {
|
||||||
@@ -810,7 +811,7 @@ public class SoftwareManagement {
|
|||||||
* in case one of the meta data entry already exists for the
|
* in case one of the meta data entry already exists for the
|
||||||
* specific key
|
* specific key
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Modifying
|
@Modifying
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||||
public List<SoftwareModuleMetadata> createSoftwareModuleMetadata(
|
public List<SoftwareModuleMetadata> createSoftwareModuleMetadata(
|
||||||
@@ -832,7 +833,7 @@ public class SoftwareManagement {
|
|||||||
* in case the meta data entry does not exists and cannot be
|
* in case the meta data entry does not exists and cannot be
|
||||||
* updated
|
* updated
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Modifying
|
@Modifying
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||||
public SoftwareModuleMetadata updateSoftwareModuleMetadata(@NotNull final SoftwareModuleMetadata metadata) {
|
public SoftwareModuleMetadata updateSoftwareModuleMetadata(@NotNull final SoftwareModuleMetadata metadata) {
|
||||||
@@ -851,7 +852,7 @@ public class SoftwareManagement {
|
|||||||
* @param id
|
* @param id
|
||||||
* the ID of the software module meta data to delete
|
* the ID of the software module meta data to delete
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Modifying
|
@Modifying
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||||
public void deleteSoftwareModuleMetadata(@NotNull final SwMetadataCompositeKey id) {
|
public void deleteSoftwareModuleMetadata(@NotNull final SwMetadataCompositeKey id) {
|
||||||
@@ -925,7 +926,7 @@ public class SoftwareManagement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void throwMetadataKeyAlreadyExists(final String metadataKey) {
|
private static void throwMetadataKeyAlreadyExists(final String metadataKey) {
|
||||||
throw new EntityAlreadyExistsException("Metadata entry with key '" + metadataKey + "' already exists");
|
throw new EntityAlreadyExistsException("Metadata entry with key '" + metadataKey + "' already exists");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,15 +16,14 @@ import org.springframework.data.domain.Page;
|
|||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link SoftwareModuleMetadata} repository.
|
* {@link SoftwareModuleMetadata} repository.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
public interface SoftwareModuleMetadataRepository
|
public interface SoftwareModuleMetadataRepository
|
||||||
extends PagingAndSortingRepository<SoftwareModuleMetadata, SwMetadataCompositeKey>,
|
extends PagingAndSortingRepository<SoftwareModuleMetadata, SwMetadataCompositeKey>,
|
||||||
JpaSpecificationExecutor<SoftwareModuleMetadata> {
|
JpaSpecificationExecutor<SoftwareModuleMetadata> {
|
||||||
|
|||||||
@@ -21,15 +21,14 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
|||||||
import org.springframework.data.jpa.repository.Modifying;
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link SoftwareModule} repository.
|
* {@link SoftwareModule} repository.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
public interface SoftwareModuleRepository
|
public interface SoftwareModuleRepository
|
||||||
extends BaseEntityRepository<SoftwareModule, Long>, JpaSpecificationExecutor<SoftwareModule> {
|
extends BaseEntityRepository<SoftwareModule, Long>, JpaSpecificationExecutor<SoftwareModule> {
|
||||||
|
|
||||||
@@ -69,7 +68,7 @@ public interface SoftwareModuleRepository
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Query("UPDATE SoftwareModule b SET b.deleted = 1, b.lastModifiedAt = :lastModifiedAt, b.lastModifiedBy = :lastModifiedBy WHERE b.id IN :ids")
|
@Query("UPDATE SoftwareModule b SET b.deleted = 1, b.lastModifiedAt = :lastModifiedAt, b.lastModifiedBy = :lastModifiedBy WHERE b.id IN :ids")
|
||||||
void deleteSoftwareModule(@Param("lastModifiedAt") Long modifiedAt, @Param("lastModifiedBy") String modifiedBy,
|
void deleteSoftwareModule(@Param("lastModifiedAt") Long modifiedAt, @Param("lastModifiedBy") String modifiedBy,
|
||||||
@Param("ids") final Long... ids);
|
@Param("ids") final Long... ids);
|
||||||
|
|||||||
@@ -12,16 +12,14 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
|||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Repository for {@link SoftwareModuleType}.
|
* Repository for {@link SoftwareModuleType}.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
public interface SoftwareModuleTypeRepository
|
public interface SoftwareModuleTypeRepository
|
||||||
extends BaseEntityRepository<SoftwareModuleType, Long>, JpaSpecificationExecutor<SoftwareModuleType> {
|
extends BaseEntityRepository<SoftwareModuleType, Long>, JpaSpecificationExecutor<SoftwareModuleType> {
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import org.springframework.context.annotation.Bean;
|
|||||||
import org.springframework.data.jpa.repository.Modifying;
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Propagation;
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@@ -43,7 +44,7 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
* Central system management operations of the SP server.
|
* Central system management operations of the SP server.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Validated
|
@Validated
|
||||||
@Service
|
@Service
|
||||||
public class SystemManagement {
|
public class SystemManagement {
|
||||||
@@ -179,7 +180,7 @@ public class SystemManagement {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Cacheable(value = "tenantMetadata", key = "#tenant.toUpperCase()")
|
@Cacheable(value = "tenantMetadata", key = "#tenant.toUpperCase()")
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Modifying
|
@Modifying
|
||||||
@NotNull
|
@NotNull
|
||||||
public TenantMetaData getTenantMetadata(@NotNull final String tenant) {
|
public TenantMetaData getTenantMetadata(@NotNull final String tenant) {
|
||||||
@@ -218,7 +219,7 @@ public class SystemManagement {
|
|||||||
* to delete
|
* to delete
|
||||||
*/
|
*/
|
||||||
@CacheEvict(value = { "tenantMetadata" }, key = "#tenant.toUpperCase()")
|
@CacheEvict(value = { "tenantMetadata" }, key = "#tenant.toUpperCase()")
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Modifying
|
@Modifying
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_SYSTEM_ADMIN)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_SYSTEM_ADMIN)
|
||||||
// tenant independent
|
// tenant independent
|
||||||
@@ -250,7 +251,7 @@ public class SystemManagement {
|
|||||||
* @return {@link TenantMetaData} of {@link TenantAware#getCurrentTenant()}
|
* @return {@link TenantMetaData} of {@link TenantAware#getCurrentTenant()}
|
||||||
*/
|
*/
|
||||||
@Cacheable(value = "tenantMetadata", keyGenerator = "tenantKeyGenerator")
|
@Cacheable(value = "tenantMetadata", keyGenerator = "tenantKeyGenerator")
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Modifying
|
@Modifying
|
||||||
@NotNull
|
@NotNull
|
||||||
public TenantMetaData getTenantMetadata() {
|
public TenantMetaData getTenantMetadata() {
|
||||||
@@ -279,7 +280,7 @@ public class SystemManagement {
|
|||||||
// suspend the transaction here to do a read-request against the medata
|
// suspend the transaction here to do a read-request against the medata
|
||||||
// table, when the current
|
// table, when the current
|
||||||
// tenant is not cached anyway already.
|
// tenant is not cached anyway already.
|
||||||
@Transactional(propagation = Propagation.NOT_SUPPORTED)
|
@Transactional(propagation = Propagation.NOT_SUPPORTED, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
public String currentTenant() {
|
public String currentTenant() {
|
||||||
final String initialTenantCreation = createInitialTenant.get();
|
final String initialTenantCreation = createInitialTenant.get();
|
||||||
if (initialTenantCreation == null) {
|
if (initialTenantCreation == null) {
|
||||||
@@ -298,7 +299,7 @@ public class SystemManagement {
|
|||||||
* @return updated {@link TenantMetaData} entity
|
* @return updated {@link TenantMetaData} entity
|
||||||
*/
|
*/
|
||||||
@CachePut(value = "tenantMetadata", key = "#metaData.tenant.toUpperCase()")
|
@CachePut(value = "tenantMetadata", key = "#metaData.tenant.toUpperCase()")
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Modifying
|
@Modifying
|
||||||
@NotNull
|
@NotNull
|
||||||
public TenantMetaData updateTenantMetadata(@NotNull final TenantMetaData metaData) {
|
public TenantMetaData updateTenantMetadata(@NotNull final TenantMetaData metaData) {
|
||||||
|
|||||||
@@ -38,21 +38,17 @@ import org.springframework.data.jpa.domain.Specification;
|
|||||||
import org.springframework.data.jpa.repository.Modifying;
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import com.google.common.eventbus.EventBus;
|
import com.google.common.eventbus.EventBus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Management service class for {@link Tag}s.
|
||||||
* Mangement service class for {@link Tag}s.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Validated
|
@Validated
|
||||||
@Service
|
@Service
|
||||||
public class TagManagement {
|
public class TagManagement {
|
||||||
@@ -102,7 +98,7 @@ public class TagManagement {
|
|||||||
* if given object already exists
|
* if given object already exists
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@NotNull
|
@NotNull
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
|
||||||
public TargetTag createTargetTag(@NotNull final TargetTag targetTag) {
|
public TargetTag createTargetTag(@NotNull final TargetTag targetTag) {
|
||||||
@@ -133,7 +129,7 @@ public class TagManagement {
|
|||||||
* if given object has already an ID.
|
* if given object has already an ID.
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@NotNull
|
@NotNull
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
|
||||||
public List<TargetTag> createTargetTags(@NotNull final Iterable<TargetTag> targetTags) {
|
public List<TargetTag> createTargetTags(@NotNull final Iterable<TargetTag> targetTags) {
|
||||||
@@ -155,7 +151,7 @@ public class TagManagement {
|
|||||||
* tag name of the {@link TargetTag} to be deleted
|
* tag name of the {@link TargetTag} to be deleted
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_TARGET)
|
||||||
public void deleteTargetTag(@NotEmpty final String targetTagName) {
|
public void deleteTargetTag(@NotEmpty final String targetTagName) {
|
||||||
final TargetTag tag = targetTagRepository.findByNameEquals(targetTagName);
|
final TargetTag tag = targetTagRepository.findByNameEquals(targetTagName);
|
||||||
@@ -220,7 +216,7 @@ public class TagManagement {
|
|||||||
* @return the new {@link TargetTag}
|
* @return the new {@link TargetTag}
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@NotNull
|
@NotNull
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
||||||
public TargetTag updateTargetTag(@NotNull final TargetTag targetTag) {
|
public TargetTag updateTargetTag(@NotNull final TargetTag targetTag) {
|
||||||
@@ -254,7 +250,7 @@ public class TagManagement {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
||||||
public DistributionSetTag createDistributionSetTag(@NotNull final DistributionSetTag distributionSetTag) {
|
public DistributionSetTag createDistributionSetTag(@NotNull final DistributionSetTag distributionSetTag) {
|
||||||
if (null != distributionSetTag.getId()) {
|
if (null != distributionSetTag.getId()) {
|
||||||
@@ -282,7 +278,7 @@ public class TagManagement {
|
|||||||
* if a given entity already exists
|
* if a given entity already exists
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
||||||
public List<DistributionSetTag> createDistributionSetTags(
|
public List<DistributionSetTag> createDistributionSetTags(
|
||||||
@NotNull final Iterable<DistributionSetTag> distributionSetTags) {
|
@NotNull final Iterable<DistributionSetTag> distributionSetTags) {
|
||||||
@@ -306,7 +302,7 @@ public class TagManagement {
|
|||||||
* to be deleted
|
* to be deleted
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
||||||
public void deleteDistributionSetTag(@NotEmpty final String tagName) {
|
public void deleteDistributionSetTag(@NotEmpty final String tagName) {
|
||||||
final DistributionSetTag tag = distributionSetTagRepository.findByNameEquals(tagName);
|
final DistributionSetTag tag = distributionSetTagRepository.findByNameEquals(tagName);
|
||||||
@@ -335,7 +331,7 @@ public class TagManagement {
|
|||||||
* of {@link DistributionSetTag#getName()} is <code>null</code>
|
* of {@link DistributionSetTag#getName()} is <code>null</code>
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@NotNull
|
@NotNull
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||||
public DistributionSetTag updateDistributionSetTag(@NotNull final DistributionSetTag distributionSetTag) {
|
public DistributionSetTag updateDistributionSetTag(@NotNull final DistributionSetTag distributionSetTag) {
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import org.springframework.data.jpa.domain.Specifications;
|
|||||||
import org.springframework.data.jpa.repository.Modifying;
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@@ -35,10 +36,8 @@ import com.google.common.base.Strings;
|
|||||||
/**
|
/**
|
||||||
* Business service facade for managing {@link TargetFilterQuery}s.
|
* Business service facade for managing {@link TargetFilterQuery}s.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Validated
|
@Validated
|
||||||
@Service
|
@Service
|
||||||
public class TargetFilterQueryManagement {
|
public class TargetFilterQueryManagement {
|
||||||
@@ -53,7 +52,7 @@ public class TargetFilterQueryManagement {
|
|||||||
* @return the created {@link TargetFilterQuery}
|
* @return the created {@link TargetFilterQuery}
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@NotNull
|
@NotNull
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
|
||||||
public TargetFilterQuery createTargetFilterQuery(@NotNull final TargetFilterQuery customTargetFilter) {
|
public TargetFilterQuery createTargetFilterQuery(@NotNull final TargetFilterQuery customTargetFilter) {
|
||||||
@@ -71,7 +70,7 @@ public class TargetFilterQueryManagement {
|
|||||||
* IDs of target filter query to be deleted
|
* IDs of target filter query to be deleted
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_TARGET)
|
||||||
public void deleteTargetFilterQuery(@NotNull final Long targetFilterQueryId) {
|
public void deleteTargetFilterQuery(@NotNull final Long targetFilterQueryId) {
|
||||||
targetFilterQueryRepository.delete(targetFilterQueryId);
|
targetFilterQueryRepository.delete(targetFilterQueryId);
|
||||||
@@ -161,7 +160,7 @@ public class TargetFilterQueryManagement {
|
|||||||
* @return the updated {@link TargetFilterQuery}
|
* @return the updated {@link TargetFilterQuery}
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@NotNull
|
@NotNull
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
||||||
public TargetFilterQuery updateTargetFilterQuery(@NotNull final TargetFilterQuery targetFilterQuery) {
|
public TargetFilterQuery updateTargetFilterQuery(@NotNull final TargetFilterQuery targetFilterQuery) {
|
||||||
|
|||||||
@@ -12,13 +12,14 @@ import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
|||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
import org.springframework.data.jpa.repository.Modifying;
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Spring data repositories for {@link TargetFilterQuery}s.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
public interface TargetFilterQueryRepository
|
public interface TargetFilterQueryRepository
|
||||||
extends BaseEntityRepository<TargetFilterQuery, Long>, JpaSpecificationExecutor<TargetFilterQuery> {
|
extends BaseEntityRepository<TargetFilterQuery, Long>, JpaSpecificationExecutor<TargetFilterQuery> {
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import java.util.Collection;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.transaction.Transactional;
|
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.TargetInfo;
|
import org.eclipse.hawkbit.repository.model.TargetInfo;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||||
@@ -20,15 +19,16 @@ import org.springframework.cache.annotation.CacheEvict;
|
|||||||
import org.springframework.data.jpa.repository.Modifying;
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Usually a JPA spring data repository to handle {@link TargetInfo} entity.
|
* Usually a JPA spring data repository to handle {@link TargetInfo} entity.
|
||||||
* However, do to an eclipselink bug with spring boot now a regular interface
|
* However, do to an eclipselink bug with spring boot now a regular interface
|
||||||
* that is implemented by {@link EclipseLinkTargetInfoRepository}.
|
* that is implemented by {@link EclipseLinkTargetInfoRepository}.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
public interface TargetInfoRepository {
|
public interface TargetInfoRepository {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,7 +41,7 @@ public interface TargetInfoRepository {
|
|||||||
* to set it for
|
* to set it for
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Query("update TargetInfo ti set ti.updateStatus = :status where ti.targetId in :targets and ti.updateStatus != :status")
|
@Query("update TargetInfo ti set ti.updateStatus = :status where ti.targetId in :targets and ti.updateStatus != :status")
|
||||||
void setTargetUpdateStatus(@Param("status") TargetUpdateStatus status, @Param("targets") List<Long> targets);
|
void setTargetUpdateStatus(@Param("status") TargetUpdateStatus status, @Param("targets") List<Long> targets);
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ public interface TargetInfoRepository {
|
|||||||
* to delete
|
* to delete
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@CacheEvict(value = { "targetStatus", "distributionUsageInstalled", "targetsLastPoll" }, allEntries = true)
|
@CacheEvict(value = { "targetStatus", "distributionUsageInstalled", "targetsLastPoll" }, allEntries = true)
|
||||||
void deleteByTargetIdIn(final Collection<Long> targetIDs);
|
void deleteByTargetIdIn(final Collection<Long> targetIDs);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ import org.springframework.data.jpa.domain.Specification;
|
|||||||
import org.springframework.data.jpa.repository.Modifying;
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@@ -74,7 +75,7 @@ import com.google.common.eventbus.EventBus;
|
|||||||
* Business service facade for managing {@link Target}s.
|
* Business service facade for managing {@link Target}s.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Validated
|
@Validated
|
||||||
@Service
|
@Service
|
||||||
public class TargetManagement {
|
public class TargetManagement {
|
||||||
@@ -260,7 +261,7 @@ public class TargetManagement {
|
|||||||
* @return the updated {@link Target}
|
* @return the updated {@link Target}
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@NotNull
|
@NotNull
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET + SpringEvalExpressions.HAS_AUTH_OR
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET + SpringEvalExpressions.HAS_AUTH_OR
|
||||||
+ SpringEvalExpressions.IS_CONTROLLER)
|
+ SpringEvalExpressions.IS_CONTROLLER)
|
||||||
@@ -278,7 +279,7 @@ public class TargetManagement {
|
|||||||
* @return the updated {@link Target}s
|
* @return the updated {@link Target}s
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@NotNull
|
@NotNull
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET + SpringEvalExpressions.HAS_AUTH_OR
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET + SpringEvalExpressions.HAS_AUTH_OR
|
||||||
+ SpringEvalExpressions.IS_CONTROLLER)
|
+ SpringEvalExpressions.IS_CONTROLLER)
|
||||||
@@ -294,7 +295,7 @@ public class TargetManagement {
|
|||||||
* the technical IDs of the targets to be deleted
|
* the technical IDs of the targets to be deleted
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_TARGET)
|
||||||
public void deleteTargets(@NotEmpty final Long... targetIDs) {
|
public void deleteTargets(@NotEmpty final Long... targetIDs) {
|
||||||
// we need to select the target IDs first to check the if the targetIDs
|
// we need to select the target IDs first to check the if the targetIDs
|
||||||
@@ -527,11 +528,11 @@ public class TargetManagement {
|
|||||||
* @param targets
|
* @param targets
|
||||||
* to toggle for
|
* to toggle for
|
||||||
* @param tag
|
* @param tag
|
||||||
* to toogle
|
* to toggle
|
||||||
* @return TagAssigmentResult with all metadata of the assigment outcome.
|
* @return TagAssigmentResult with all metadata of the assignment outcome.
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@NotNull
|
@NotNull
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
||||||
public TargetTagAssignmentResult toggleTagAssignment(@NotEmpty final List<Target> targets,
|
public TargetTagAssignmentResult toggleTagAssignment(@NotEmpty final List<Target> targets,
|
||||||
@@ -553,7 +554,7 @@ public class TargetManagement {
|
|||||||
* @return TagAssigmentResult with all metadata of the assigment outcome.
|
* @return TagAssigmentResult with all metadata of the assigment outcome.
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@NotNull
|
@NotNull
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
||||||
public TargetTagAssignmentResult toggleTagAssignment(@NotEmpty final Collection<String> targetIds,
|
public TargetTagAssignmentResult toggleTagAssignment(@NotEmpty final Collection<String> targetIds,
|
||||||
@@ -596,7 +597,7 @@ public class TargetManagement {
|
|||||||
* @return list of assigned targets
|
* @return list of assigned targets
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@NotNull
|
@NotNull
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
||||||
public List<Target> assignTag(@NotEmpty final Collection<String> targetIds, @NotNull final TargetTag tag) {
|
public List<Target> assignTag(@NotEmpty final Collection<String> targetIds, @NotNull final TargetTag tag) {
|
||||||
@@ -635,7 +636,7 @@ public class TargetManagement {
|
|||||||
* @return list of unassigned targets
|
* @return list of unassigned targets
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@NotNull
|
@NotNull
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
||||||
public List<Target> unAssignAllTargetsByTag(@NotNull final TargetTag tag) {
|
public List<Target> unAssignAllTargetsByTag(@NotNull final TargetTag tag) {
|
||||||
@@ -652,7 +653,7 @@ public class TargetManagement {
|
|||||||
* @return the unassigned target or <null> if no target is unassigned
|
* @return the unassigned target or <null> if no target is unassigned
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
||||||
public Target unAssignTag(@NotNull final String controllerID, @NotNull final TargetTag targetTag) {
|
public Target unAssignTag(@NotNull final String controllerID, @NotNull final TargetTag targetTag) {
|
||||||
final List<Target> allTargets = targetRepository
|
final List<Target> allTargets = targetRepository
|
||||||
@@ -934,7 +935,7 @@ public class TargetManagement {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@NotNull
|
@NotNull
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET + SpringEvalExpressions.HAS_AUTH_OR
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET + SpringEvalExpressions.HAS_AUTH_OR
|
||||||
+ SpringEvalExpressions.IS_CONTROLLER)
|
+ SpringEvalExpressions.IS_CONTROLLER)
|
||||||
@@ -972,7 +973,7 @@ public class TargetManagement {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@NotNull
|
@NotNull
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET + SpringEvalExpressions.HAS_AUTH_OR
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET + SpringEvalExpressions.HAS_AUTH_OR
|
||||||
+ SpringEvalExpressions.IS_CONTROLLER)
|
+ SpringEvalExpressions.IS_CONTROLLER)
|
||||||
@@ -996,7 +997,7 @@ public class TargetManagement {
|
|||||||
* already exist.
|
* already exist.
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@NotNull
|
@NotNull
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
|
||||||
public List<Target> createTargets(@NotNull final List<Target> targets) {
|
public List<Target> createTargets(@NotNull final List<Target> targets) {
|
||||||
@@ -1028,7 +1029,7 @@ public class TargetManagement {
|
|||||||
* @return newly created target
|
* @return newly created target
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@NotNull
|
@NotNull
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
|
||||||
public List<Target> createTargets(@NotNull final Collection<Target> targets,
|
public List<Target> createTargets(@NotNull final Collection<Target> targets,
|
||||||
|
|||||||
@@ -27,15 +27,14 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
|||||||
import org.springframework.data.jpa.repository.Modifying;
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link Target} repository.
|
* {@link Target} repository.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
public interface TargetRepository extends BaseEntityRepository<Target, Long>, JpaSpecificationExecutor<Target> {
|
public interface TargetRepository extends BaseEntityRepository<Target, Long>, JpaSpecificationExecutor<Target> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -64,7 +63,7 @@ public interface TargetRepository extends BaseEntityRepository<Target, Long>, Jp
|
|||||||
* to be deleted
|
* to be deleted
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
// Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=349477
|
// Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=349477
|
||||||
@Query("DELETE FROM Target t WHERE t.id IN ?1")
|
@Query("DELETE FROM Target t WHERE t.id IN ?1")
|
||||||
void deleteByIdIn(final Collection<Long> targetIDs);
|
void deleteByIdIn(final Collection<Long> targetIDs);
|
||||||
@@ -153,7 +152,7 @@ public interface TargetRepository extends BaseEntityRepository<Target, Long>, Jp
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@CacheEvict(value = { "targetStatus", "distributionUsageInstalled", "targetsLastPoll" }, allEntries = true)
|
@CacheEvict(value = { "targetStatus", "distributionUsageInstalled", "targetsLastPoll" }, allEntries = true)
|
||||||
<S extends Target> List<S> save(Iterable<S> entities);
|
<S extends Target> List<S> save(Iterable<S> entities);
|
||||||
|
|
||||||
@@ -167,7 +166,7 @@ public interface TargetRepository extends BaseEntityRepository<Target, Long>, Jp
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@CacheEvict(value = { "targetStatus", "distributionUsageInstalled", "targetsLastPoll" }, allEntries = true)
|
@CacheEvict(value = { "targetStatus", "distributionUsageInstalled", "targetsLastPoll" }, allEntries = true)
|
||||||
<S extends Target> S save(S entity);
|
<S extends Target> S save(S entity);
|
||||||
|
|
||||||
@@ -276,7 +275,7 @@ public interface TargetRepository extends BaseEntityRepository<Target, Long>, Jp
|
|||||||
* to update
|
* to update
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Query("UPDATE Target t SET t.assignedDistributionSet = :set, t.lastModifiedAt = :lastModifiedAt, t.lastModifiedBy = :lastModifiedBy WHERE t.id IN :targets")
|
@Query("UPDATE Target t SET t.assignedDistributionSet = :set, t.lastModifiedAt = :lastModifiedAt, t.lastModifiedBy = :lastModifiedBy WHERE t.id IN :targets")
|
||||||
void setAssignedDistributionSet(@Param("set") DistributionSet set, @Param("lastModifiedAt") Long modifiedAt,
|
void setAssignedDistributionSet(@Param("set") DistributionSet set, @Param("lastModifiedAt") Long modifiedAt,
|
||||||
@Param("lastModifiedBy") String modifiedBy, @Param("targets") Collection<Long> targets);
|
@Param("lastModifiedBy") String modifiedBy, @Param("targets") Collection<Long> targets);
|
||||||
|
|||||||
@@ -13,15 +13,14 @@ import java.util.List;
|
|||||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
import org.springframework.data.jpa.repository.Modifying;
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link TargetTag} repository.
|
* {@link TargetTag} repository.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
public interface TargetTagRepository
|
public interface TargetTagRepository
|
||||||
extends BaseEntityRepository<TargetTag, Long>, JpaSpecificationExecutor<TargetTag> {
|
extends BaseEntityRepository<TargetTag, Long>, JpaSpecificationExecutor<TargetTag> {
|
||||||
|
|
||||||
@@ -33,7 +32,7 @@ public interface TargetTagRepository
|
|||||||
* @return 1 if tag was deleted
|
* @return 1 if tag was deleted
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
Long deleteByName(final String tagName);
|
Long deleteByName(final String tagName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -24,13 +24,14 @@ import org.springframework.core.convert.support.DefaultConversionService;
|
|||||||
import org.springframework.core.env.Environment;
|
import org.springframework.core.env.Environment;
|
||||||
import org.springframework.data.jpa.repository.Modifying;
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Central tenant configuration management operations of the SP server.
|
* Central tenant configuration management operations of the SP server.
|
||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Validated
|
@Validated
|
||||||
public class TenantConfigurationManagement implements EnvironmentAware {
|
public class TenantConfigurationManagement implements EnvironmentAware {
|
||||||
|
|
||||||
@@ -221,7 +222,7 @@ public class TenantConfigurationManagement implements EnvironmentAware {
|
|||||||
* if the property cannot be converted to the given
|
* if the property cannot be converted to the given
|
||||||
*/
|
*/
|
||||||
@CacheEvict(value = "tenantConfiguration", key = "#configurationKey.getKeyName()")
|
@CacheEvict(value = "tenantConfiguration", key = "#configurationKey.getKeyName()")
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Modifying
|
@Modifying
|
||||||
@PreAuthorize(value = SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION)
|
@PreAuthorize(value = SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION)
|
||||||
public <T> TenantConfigurationValue<T> addOrUpdateConfiguration(final TenantConfigurationKey configurationKey,
|
public <T> TenantConfigurationValue<T> addOrUpdateConfiguration(final TenantConfigurationKey configurationKey,
|
||||||
@@ -264,7 +265,7 @@ public class TenantConfigurationManagement implements EnvironmentAware {
|
|||||||
* the configuration key to be deleted
|
* the configuration key to be deleted
|
||||||
*/
|
*/
|
||||||
@CacheEvict(value = "tenantConfiguration", key = "#configurationKey.getKeyName()")
|
@CacheEvict(value = "tenantConfiguration", key = "#configurationKey.getKeyName()")
|
||||||
@Transactional
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Modifying
|
@Modifying
|
||||||
@PreAuthorize(value = SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION)
|
@PreAuthorize(value = SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION)
|
||||||
public void deleteConfiguration(final TenantConfigurationKey configurationKey) {
|
public void deleteConfiguration(final TenantConfigurationKey configurationKey) {
|
||||||
|
|||||||
@@ -11,13 +11,14 @@ package org.eclipse.hawkbit.repository;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.TenantConfiguration;
|
import org.eclipse.hawkbit.repository.model.TenantConfiguration;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The spring-data repository for the entity {@link TenantConfiguration}.
|
* The spring-data repository for the entity {@link TenantConfiguration}.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
public interface TenantConfigurationRepository extends BaseEntityRepository<TenantConfiguration, Long> {
|
public interface TenantConfigurationRepository extends BaseEntityRepository<TenantConfiguration, Long> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -12,16 +12,14 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.TenantMetaData;
|
import org.eclipse.hawkbit.repository.model.TenantMetaData;
|
||||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* repository for operations on {@link TenantMetaData} entity.
|
* repository for operations on {@link TenantMetaData} entity.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
public interface TenantMetaDataRepository extends PagingAndSortingRepository<TenantMetaData, Long> {
|
public interface TenantMetaDataRepository extends PagingAndSortingRepository<TenantMetaData, Long> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user