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