Improvements repository validation constraints (#626)
* Add html tag Validator on strings. Add string trim. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Revert unintended changes. Sonar issues. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Remove weired comment. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Raise EclipseLink due to validation problem. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Fix permission. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Colour field test. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Fix sonar issues. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
@@ -85,7 +85,7 @@ public class JpaArtifactManagement implements ArtifactManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public Artifact create(final InputStream stream, final Long moduleId, final String filename,
|
||||
public Artifact create(final InputStream stream, final long moduleId, final String filename,
|
||||
final String providedMd5Sum, final String providedSha1Sum, final boolean overrideExisting,
|
||||
final String contentType) {
|
||||
AbstractDbArtifact result = null;
|
||||
@@ -117,7 +117,7 @@ public class JpaArtifactManagement implements ArtifactManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public boolean clearArtifactBinary(final String sha1Hash, final Long moduleId) {
|
||||
public boolean clearArtifactBinary(final String sha1Hash, final long moduleId) {
|
||||
|
||||
if (localArtifactRepository.existsWithSha1HashAndSoftwareModuleIdIsNot(sha1Hash, moduleId)) {
|
||||
// there are still other artifacts that need the binary
|
||||
@@ -137,7 +137,7 @@ public class JpaArtifactManagement implements ArtifactManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public void delete(final Long id) {
|
||||
public void delete(final long id) {
|
||||
final JpaArtifact existing = (JpaArtifact) get(id)
|
||||
.orElseThrow(() -> new EntityNotFoundException(Artifact.class, id));
|
||||
|
||||
@@ -149,12 +149,12 @@ public class JpaArtifactManagement implements ArtifactManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Artifact> get(final Long id) {
|
||||
public Optional<Artifact> get(final long id) {
|
||||
return Optional.ofNullable(localArtifactRepository.findOne(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Artifact> getByFilenameAndSoftwareModule(final String filename, final Long softwareModuleId) {
|
||||
public Optional<Artifact> getByFilenameAndSoftwareModule(final String filename, final long softwareModuleId) {
|
||||
throwExceptionIfSoftwareModuleDoesNotExist(softwareModuleId);
|
||||
|
||||
return localArtifactRepository.findFirstByFilenameAndSoftwareModuleId(filename, softwareModuleId);
|
||||
@@ -171,7 +171,7 @@ public class JpaArtifactManagement implements ArtifactManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Artifact> findBySoftwareModule(final Pageable pageReq, final Long swId) {
|
||||
public Page<Artifact> findBySoftwareModule(final Pageable pageReq, final long swId) {
|
||||
throwExceptionIfSoftwareModuleDoesNotExist(swId);
|
||||
|
||||
return localArtifactRepository.findBySoftwareModuleId(pageReq, swId);
|
||||
@@ -206,7 +206,7 @@ public class JpaArtifactManagement implements ArtifactManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public Artifact create(final InputStream inputStream, final Long moduleId, final String filename,
|
||||
public Artifact create(final InputStream inputStream, final long moduleId, final String filename,
|
||||
final boolean overrideExisting) {
|
||||
return create(inputStream, moduleId, filename, null, null, overrideExisting, null);
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ public class JpaControllerManagement implements ControllerManagement {
|
||||
|
||||
@Override
|
||||
public Optional<Action> getActionForDownloadByTargetAndSoftwareModule(final String controllerId,
|
||||
final Long moduleId) {
|
||||
final long moduleId) {
|
||||
throwExceptionIfTargetDoesNotExist(controllerId);
|
||||
throwExceptionIfSoftwareModuleDoesNotExist(moduleId);
|
||||
|
||||
@@ -215,7 +215,7 @@ public class JpaControllerManagement implements ControllerManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTargetArtifactAssigned(final Long targetId, final String sha1Hash) {
|
||||
public boolean hasTargetArtifactAssigned(final long targetId, final String sha1Hash) {
|
||||
throwExceptionIfTargetDoesNotExist(targetId);
|
||||
return actionRepository.count(ActionSpecifications.hasTargetAssignedArtifact(targetId, sha1Hash)) > 0;
|
||||
}
|
||||
@@ -233,7 +233,7 @@ public class JpaControllerManagement implements ControllerManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Action> findActionWithDetails(final Long actionId) {
|
||||
public Optional<Action> findActionWithDetails(final long actionId) {
|
||||
return actionRepository.getById(actionId);
|
||||
}
|
||||
|
||||
@@ -556,7 +556,7 @@ public class JpaControllerManagement implements ControllerManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public Action registerRetrieved(final Long actionId, final String message) {
|
||||
public Action registerRetrieved(final long actionId, final String message) {
|
||||
return handleRegisterRetrieved(actionId, message);
|
||||
}
|
||||
|
||||
@@ -640,12 +640,12 @@ public class JpaControllerManagement implements ControllerManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Target> get(final Long targetId) {
|
||||
public Optional<Target> get(final long targetId) {
|
||||
return Optional.ofNullable(targetRepository.findOne(targetId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ActionStatus> findActionStatusByAction(final Pageable pageReq, final Long actionId) {
|
||||
public Page<ActionStatus> findActionStatusByAction(final Pageable pageReq, final long actionId) {
|
||||
if (!actionRepository.exists(actionId)) {
|
||||
throw new EntityNotFoundException(Action.class, actionId);
|
||||
}
|
||||
@@ -654,7 +654,7 @@ public class JpaControllerManagement implements ControllerManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getActionHistoryMessages(final Long actionId, final int messageCount) {
|
||||
public List<String> getActionHistoryMessages(final long actionId, final int messageCount) {
|
||||
// Just return empty list in case messageCount is zero.
|
||||
if (messageCount == 0) {
|
||||
return Collections.emptyList();
|
||||
@@ -676,7 +676,7 @@ public class JpaControllerManagement implements ControllerManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<SoftwareModule> getSoftwareModule(final Long id) {
|
||||
public Optional<SoftwareModule> getSoftwareModule(final long id) {
|
||||
return Optional.ofNullable(softwareModuleRepository.findOne(id));
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
|
||||
@Transactional(isolation = Isolation.READ_COMMITTED)
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public DistributionSetAssignmentResult assignDistributionSet(final Long dsID, final ActionType actionType,
|
||||
public DistributionSetAssignmentResult assignDistributionSet(final long dsID, final ActionType actionType,
|
||||
final long forcedTimestamp, final Collection<String> controllerIDs) {
|
||||
|
||||
return assignDistributionSetToTargets(dsID,
|
||||
@@ -176,7 +176,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
|
||||
@Transactional(isolation = Isolation.READ_COMMITTED)
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public DistributionSetAssignmentResult assignDistributionSet(final Long dsID,
|
||||
public DistributionSetAssignmentResult assignDistributionSet(final long dsID,
|
||||
final Collection<TargetWithActionType> targets) {
|
||||
|
||||
return assignDistributionSetToTargets(dsID, targets, null, onlineDsAssignmentStrategy);
|
||||
@@ -186,7 +186,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
|
||||
@Transactional(isolation = Isolation.READ_COMMITTED)
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public DistributionSetAssignmentResult assignDistributionSet(final Long dsID,
|
||||
public DistributionSetAssignmentResult assignDistributionSet(final long dsID,
|
||||
final Collection<TargetWithActionType> targets, final String actionMessage) {
|
||||
|
||||
return assignDistributionSetToTargets(dsID, targets, actionMessage, onlineDsAssignmentStrategy);
|
||||
@@ -319,7 +319,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
|
||||
@Transactional(isolation = Isolation.READ_COMMITTED)
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public Action cancelAction(final Long actionId) {
|
||||
public Action cancelAction(final long actionId) {
|
||||
LOG.debug("cancelAction({})", actionId);
|
||||
|
||||
final JpaAction action = actionRepository.findById(actionId)
|
||||
@@ -349,7 +349,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
|
||||
@Transactional(isolation = Isolation.READ_COMMITTED)
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public Action forceQuitAction(final Long actionId) {
|
||||
public Action forceQuitAction(final long actionId) {
|
||||
final JpaAction action = actionRepository.findById(actionId)
|
||||
.orElseThrow(() -> new EntityNotFoundException(Action.class, actionId));
|
||||
|
||||
@@ -374,7 +374,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long startScheduledActionsByRolloutGroupParent(final Long rolloutId, final Long distributionSetId,
|
||||
public long startScheduledActionsByRolloutGroupParent(final long rolloutId, final long distributionSetId,
|
||||
final Long rolloutGroupParentId) {
|
||||
long totalActionsCount = 0L;
|
||||
long lastStartedActionsCount;
|
||||
@@ -483,12 +483,12 @@ public class JpaDeploymentManagement implements DeploymentManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Action> findAction(final Long actionId) {
|
||||
public Optional<Action> findAction(final long actionId) {
|
||||
return Optional.ofNullable(actionRepository.findOne(actionId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Action> findActionWithDetails(final Long actionId) {
|
||||
public Optional<Action> findActionWithDetails(final long actionId) {
|
||||
return actionRepository.getById(actionId);
|
||||
}
|
||||
|
||||
@@ -562,7 +562,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public Action forceTargetAction(final Long actionId) {
|
||||
public Action forceTargetAction(final long actionId) {
|
||||
final JpaAction action = actionRepository.findById(actionId)
|
||||
.orElseThrow(() -> new EntityNotFoundException(Action.class, actionId));
|
||||
|
||||
@@ -574,7 +574,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ActionStatus> findActionStatusByAction(final Pageable pageReq, final Long actionId) {
|
||||
public Page<ActionStatus> findActionStatusByAction(final Pageable pageReq, final long actionId) {
|
||||
if (!actionRepository.exists(actionId)) {
|
||||
throw new EntityNotFoundException(Action.class, actionId);
|
||||
}
|
||||
@@ -583,7 +583,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<String> findMessagesByActionStatusId(final Pageable pageable, final Long actionStatusId) {
|
||||
public Page<String> findMessagesByActionStatusId(final Pageable pageable, final long actionStatusId) {
|
||||
final CriteriaBuilder cb = entityManager.getCriteriaBuilder();
|
||||
|
||||
final CriteriaQuery<Long> countMsgQuery = cb.createQuery(Long.class);
|
||||
@@ -625,7 +625,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Slice<Action> findActionsByDistributionSet(final Pageable pageable, final Long dsId) {
|
||||
public Slice<Action> findActionsByDistributionSet(final Pageable pageable, final long dsId) {
|
||||
throwExceptionIfDistributionSetDoesNotExist(dsId);
|
||||
|
||||
return actionRepository.findByDistributionSetId(pageable, dsId);
|
||||
|
||||
@@ -131,12 +131,12 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
private AfterTransactionCommitExecutor afterCommit;
|
||||
|
||||
@Override
|
||||
public Optional<DistributionSet> getWithDetails(final Long distid) {
|
||||
public Optional<DistributionSet> getWithDetails(final long distid) {
|
||||
return Optional.ofNullable(distributionSetRepository.findOne(DistributionSetSpecification.byId(distid)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public long countByTypeId(final Long typeId) {
|
||||
public long countByTypeId(final long typeId) {
|
||||
if (!distributionSetTypeManagement.exists(typeId)) {
|
||||
throw new EntityNotFoundException(DistributionSetType.class, typeId);
|
||||
}
|
||||
@@ -304,7 +304,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public DistributionSet assignSoftwareModules(final Long setId, final Collection<Long> moduleIds) {
|
||||
public DistributionSet assignSoftwareModules(final long setId, final Collection<Long> moduleIds) {
|
||||
|
||||
final Collection<JpaSoftwareModule> modules = softwareModuleRepository.findByIdIn(moduleIds);
|
||||
|
||||
@@ -325,7 +325,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public DistributionSet unassignSoftwareModule(final Long setId, final Long moduleId) {
|
||||
public DistributionSet unassignSoftwareModule(final long setId, final long moduleId) {
|
||||
final JpaDistributionSet set = findDistributionSetAndThrowExceptionIfNotFound(setId);
|
||||
final JpaSoftwareModule module = findSoftwareModuleAndThrowExceptionIfNotFound(moduleId);
|
||||
|
||||
@@ -446,7 +446,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public List<DistributionSetMetadata> createMetaData(final Long dsId, final Collection<MetaData> md) {
|
||||
public List<DistributionSetMetadata> createMetaData(final long dsId, final Collection<MetaData> md) {
|
||||
|
||||
md.forEach(meta -> checkAndThrowAlreadyIfDistributionSetMetadataExists(
|
||||
new DsMetadataCompositeKey(dsId, meta.getKey())));
|
||||
@@ -463,7 +463,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public DistributionSetMetadata updateMetaData(final Long dsId, final MetaData md) {
|
||||
public DistributionSetMetadata updateMetaData(final long dsId, final MetaData md) {
|
||||
|
||||
// check if exists otherwise throw entity not found exception
|
||||
final JpaDistributionSetMetadata toUpdate = (JpaDistributionSetMetadata) getMetaDataByDistributionSetId(dsId,
|
||||
@@ -480,7 +480,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public void deleteMetaData(final Long distributionSetId, final String key) {
|
||||
public void deleteMetaData(final long distributionSetId, final String key) {
|
||||
final JpaDistributionSetMetadata metadata = (JpaDistributionSetMetadata) getMetaDataByDistributionSetId(
|
||||
distributionSetId, key).orElseThrow(
|
||||
() -> new EntityNotFoundException(DistributionSetMetadata.class, distributionSetId, key));
|
||||
@@ -521,7 +521,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
|
||||
@Override
|
||||
public Page<DistributionSetMetadata> findMetaDataByDistributionSetId(final Pageable pageable,
|
||||
final Long distributionSetId) {
|
||||
final long distributionSetId) {
|
||||
throwExceptionIfDistributionSetDoesNotExist(distributionSetId);
|
||||
|
||||
return convertMdPage(distributionSetMetadataRepository
|
||||
@@ -533,7 +533,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
|
||||
@Override
|
||||
public Page<DistributionSetMetadata> findMetaDataByDistributionSetIdAndRsql(final Pageable pageable,
|
||||
final Long distributionSetId, final String rsqlParam) {
|
||||
final long distributionSetId, final String rsqlParam) {
|
||||
|
||||
throwExceptionIfDistributionSetDoesNotExist(distributionSetId);
|
||||
|
||||
@@ -555,14 +555,14 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<DistributionSetMetadata> getMetaDataByDistributionSetId(final Long setId, final String key) {
|
||||
public Optional<DistributionSetMetadata> getMetaDataByDistributionSetId(final long setId, final String key) {
|
||||
throwExceptionIfDistributionSetDoesNotExist(setId);
|
||||
|
||||
return Optional.ofNullable(distributionSetMetadataRepository.findOne(new DsMetadataCompositeKey(setId, key)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<DistributionSet> getByAction(final Long actionId) {
|
||||
public Optional<DistributionSet> getByAction(final long actionId) {
|
||||
if (!actionRepository.exists(actionId)) {
|
||||
throw new EntityNotFoundException(Action.class, actionId);
|
||||
}
|
||||
@@ -571,7 +571,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInUse(final Long setId) {
|
||||
public boolean isInUse(final long setId) {
|
||||
throwExceptionIfDistributionSetDoesNotExist(setId);
|
||||
|
||||
return actionRepository.countByDistributionSetId(setId) > 0;
|
||||
@@ -665,7 +665,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public List<DistributionSet> assignTag(final Collection<Long> dsIds, final Long dsTagId) {
|
||||
public List<DistributionSet> assignTag(final Collection<Long> dsIds, final long dsTagId) {
|
||||
final List<JpaDistributionSet> allDs = findDistributionSetListWithDetails(dsIds);
|
||||
|
||||
if (allDs.size() < dsIds.size()) {
|
||||
@@ -690,7 +690,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public DistributionSet unAssignTag(final Long dsId, final Long dsTagId) {
|
||||
public DistributionSet unAssignTag(final long dsId, final long dsTagId) {
|
||||
final JpaDistributionSet set = (JpaDistributionSet) getWithDetails(dsId)
|
||||
.orElseThrow(() -> new EntityNotFoundException(DistributionSet.class, dsId));
|
||||
|
||||
@@ -710,7 +710,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public void delete(final Long setId) {
|
||||
public void delete(final long setId) {
|
||||
throwExceptionIfDistributionSetDoesNotExist(setId);
|
||||
|
||||
delete(Arrays.asList(setId));
|
||||
@@ -728,7 +728,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<DistributionSet> findByTag(final Pageable pageable, final Long tagId) {
|
||||
public Page<DistributionSet> findByTag(final Pageable pageable, final long tagId) {
|
||||
throwEntityNotFoundExceptionIfDsTagDoesNotExist(tagId);
|
||||
|
||||
return convertDsPage(distributionSetRepository.findByTag(pageable, tagId), pageable);
|
||||
@@ -742,7 +742,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<DistributionSet> findByRsqlAndTag(final Pageable pageable, final String rsqlParam, final Long tagId) {
|
||||
public Page<DistributionSet> findByRsqlAndTag(final Pageable pageable, final String rsqlParam, final long tagId) {
|
||||
throwEntityNotFoundExceptionIfDsTagDoesNotExist(tagId);
|
||||
|
||||
final Specification<JpaDistributionSet> spec = RSQLUtility.parse(rsqlParam, DistributionSetFields.class,
|
||||
@@ -769,12 +769,12 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<DistributionSet> get(final Long id) {
|
||||
public Optional<DistributionSet> get(final long id) {
|
||||
return Optional.ofNullable(distributionSetRepository.findOne(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean exists(final Long id) {
|
||||
public boolean exists(final long id) {
|
||||
return distributionSetRepository.exists(id);
|
||||
}
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ public class JpaDistributionSetTagManagement implements DistributionSetTagManage
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<DistributionSetTag> findByDistributionSet(final Pageable pageable, final Long setId) {
|
||||
public Page<DistributionSetTag> findByDistributionSet(final Pageable pageable, final long setId) {
|
||||
if (!distributionSetRepository.exists(setId)) {
|
||||
throw new EntityNotFoundException(DistributionSet.class, setId);
|
||||
}
|
||||
@@ -176,7 +176,7 @@ public class JpaDistributionSetTagManagement implements DistributionSetTagManage
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<DistributionSetTag> get(final Long id) {
|
||||
public Optional<DistributionSetTag> get(final long id) {
|
||||
return Optional.ofNullable(distributionSetTagRepository.findOne(id));
|
||||
}
|
||||
|
||||
@@ -184,12 +184,12 @@ public class JpaDistributionSetTagManagement implements DistributionSetTagManage
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public void delete(final Long id) {
|
||||
public void delete(final long id) {
|
||||
distributionSetTagRepository.delete(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean exists(final Long id) {
|
||||
public boolean exists(final long id) {
|
||||
return distributionSetTagRepository.exists(id);
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ public class JpaDistributionSetTypeManagement implements DistributionSetTypeMana
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public DistributionSetType assignMandatorySoftwareModuleTypes(final Long dsTypeId,
|
||||
public DistributionSetType assignMandatorySoftwareModuleTypes(final long dsTypeId,
|
||||
final Collection<Long> softwareModulesTypeIds) {
|
||||
final Collection<JpaSoftwareModuleType> modules = softwareModuleTypeRepository.findAll(softwareModulesTypeIds);
|
||||
|
||||
@@ -122,7 +122,7 @@ public class JpaDistributionSetTypeManagement implements DistributionSetTypeMana
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public DistributionSetType assignOptionalSoftwareModuleTypes(final Long dsTypeId,
|
||||
public DistributionSetType assignOptionalSoftwareModuleTypes(final long dsTypeId,
|
||||
final Collection<Long> softwareModulesTypeIds) {
|
||||
|
||||
final Collection<JpaSoftwareModuleType> modules = softwareModuleTypeRepository.findAll(softwareModulesTypeIds);
|
||||
@@ -143,7 +143,7 @@ public class JpaDistributionSetTypeManagement implements DistributionSetTypeMana
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public DistributionSetType unassignSoftwareModuleType(final Long dsTypeId, final Long softwareModuleTypeId) {
|
||||
public DistributionSetType unassignSoftwareModuleType(final long dsTypeId, final long softwareModuleTypeId) {
|
||||
final JpaDistributionSetType type = findDistributionSetTypeAndThrowExceptionIfNotFound(dsTypeId);
|
||||
|
||||
checkDistributionSetTypeSoftwareModuleTypesIsAllowedToModify(dsTypeId);
|
||||
@@ -197,7 +197,7 @@ public class JpaDistributionSetTypeManagement implements DistributionSetTypeMana
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public void delete(final Long typeId) {
|
||||
public void delete(final long typeId) {
|
||||
|
||||
final JpaDistributionSetType toDelete = distributionSetTypeRepository.findById(typeId)
|
||||
.orElseThrow(() -> new EntityNotFoundException(DistributionSetType.class, typeId));
|
||||
@@ -275,12 +275,12 @@ public class JpaDistributionSetTypeManagement implements DistributionSetTypeMana
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<DistributionSetType> get(final Long id) {
|
||||
public Optional<DistributionSetType> get(final long id) {
|
||||
return Optional.ofNullable(distributionSetTypeRepository.findOne(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean exists(final Long id) {
|
||||
public boolean exists(final long id) {
|
||||
return distributionSetTypeRepository.exists(id);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ import javax.persistence.criteria.Join;
|
||||
import javax.persistence.criteria.JoinType;
|
||||
import javax.persistence.criteria.ListJoin;
|
||||
import javax.persistence.criteria.Root;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.eclipse.hawkbit.repository.RolloutGroupFields;
|
||||
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
|
||||
@@ -85,12 +84,12 @@ public class JpaRolloutGroupManagement implements RolloutGroupManagement {
|
||||
private RolloutStatusCache rolloutStatusCache;
|
||||
|
||||
@Override
|
||||
public Optional<RolloutGroup> get(final Long rolloutGroupId) {
|
||||
public Optional<RolloutGroup> get(final long rolloutGroupId) {
|
||||
return Optional.ofNullable(rolloutGroupRepository.findOne(rolloutGroupId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<RolloutGroup> findByRollout(final Pageable pageable, final Long rolloutId) {
|
||||
public Page<RolloutGroup> findByRollout(final Pageable pageable, final long rolloutId) {
|
||||
throwEntityNotFoundExceptionIfRolloutDoesNotExist(rolloutId);
|
||||
|
||||
return convertPage(rolloutGroupRepository.findByRolloutId(rolloutId, pageable), pageable);
|
||||
@@ -105,7 +104,7 @@ public class JpaRolloutGroupManagement implements RolloutGroupManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<RolloutGroup> findByRolloutAndRsql(final Pageable pageable, final Long rolloutId,
|
||||
public Page<RolloutGroup> findByRolloutAndRsql(final Pageable pageable, final long rolloutId,
|
||||
final String rsqlParam) {
|
||||
throwEntityNotFoundExceptionIfRolloutDoesNotExist(rolloutId);
|
||||
|
||||
@@ -130,7 +129,7 @@ public class JpaRolloutGroupManagement implements RolloutGroupManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<RolloutGroup> findByRolloutWithDetailedStatus(final Pageable pageable, final Long rolloutId) {
|
||||
public Page<RolloutGroup> findByRolloutWithDetailedStatus(final Pageable pageable, final long rolloutId) {
|
||||
throwEntityNotFoundExceptionIfRolloutDoesNotExist(rolloutId);
|
||||
|
||||
final Page<JpaRolloutGroup> rolloutGroups = rolloutGroupRepository.findByRolloutId(rolloutId, pageable);
|
||||
@@ -155,7 +154,7 @@ public class JpaRolloutGroupManagement implements RolloutGroupManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<RolloutGroup> getWithDetailedStatus(final Long rolloutGroupId) {
|
||||
public Optional<RolloutGroup> getWithDetailedStatus(final long rolloutGroupId) {
|
||||
final Optional<RolloutGroup> rolloutGroup = get(rolloutGroupId);
|
||||
|
||||
if (!rolloutGroup.isPresent()) {
|
||||
@@ -201,7 +200,7 @@ public class JpaRolloutGroupManagement implements RolloutGroupManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Target> findTargetsOfRolloutGroupByRsql(final Pageable pageable, final Long rolloutGroupId,
|
||||
public Page<Target> findTargetsOfRolloutGroupByRsql(final Pageable pageable, final long rolloutGroupId,
|
||||
final String rsqlParam) {
|
||||
|
||||
throwExceptionIfRolloutGroupDoesNotExist(rolloutGroupId);
|
||||
@@ -219,7 +218,7 @@ public class JpaRolloutGroupManagement implements RolloutGroupManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Target> findTargetsOfRolloutGroup(final Pageable page, final Long rolloutGroupId) {
|
||||
public Page<Target> findTargetsOfRolloutGroup(final Pageable page, final long rolloutGroupId) {
|
||||
final JpaRolloutGroup rolloutGroup = rolloutGroupRepository.findById(rolloutGroupId)
|
||||
.orElseThrow(() -> new EntityNotFoundException(RolloutGroup.class, rolloutGroupId));
|
||||
|
||||
@@ -238,7 +237,7 @@ public class JpaRolloutGroupManagement implements RolloutGroupManagement {
|
||||
|
||||
@Override
|
||||
public Page<TargetWithActionStatus> findAllTargetsOfRolloutGroupWithActionStatus(final Pageable pageRequest,
|
||||
final Long rolloutGroupId) {
|
||||
final long rolloutGroupId) {
|
||||
throwExceptionIfRolloutGroupDoesNotExist(rolloutGroupId);
|
||||
|
||||
final CriteriaBuilder cb = entityManager.getCriteriaBuilder();
|
||||
@@ -269,7 +268,7 @@ public class JpaRolloutGroupManagement implements RolloutGroupManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long countTargetsOfRolloutsGroup(@NotNull final Long rolloutGroupId) {
|
||||
public long countTargetsOfRolloutsGroup(final long rolloutGroupId) {
|
||||
throwExceptionIfRolloutGroupDoesNotExist(rolloutGroupId);
|
||||
|
||||
final CriteriaBuilder cb = entityManager.getCriteriaBuilder();
|
||||
@@ -287,7 +286,7 @@ public class JpaRolloutGroupManagement implements RolloutGroupManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long countByRollout(final Long rolloutId) {
|
||||
public long countByRollout(final long rolloutId) {
|
||||
throwEntityNotFoundExceptionIfRolloutDoesNotExist(rolloutId);
|
||||
|
||||
return rolloutGroupRepository.countByRolloutId(rolloutId);
|
||||
|
||||
@@ -186,7 +186,7 @@ public class JpaRolloutManagement extends AbstractRolloutManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Rollout> get(final Long rolloutId) {
|
||||
public Optional<Rollout> get(final long rolloutId) {
|
||||
return Optional.ofNullable(rolloutRepository.findOne(rolloutId));
|
||||
}
|
||||
|
||||
@@ -439,7 +439,7 @@ public class JpaRolloutManagement extends AbstractRolloutManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public Rollout start(final Long rolloutId) {
|
||||
public Rollout start(final long rolloutId) {
|
||||
LOGGER.debug("startRollout called for rollout {}", rolloutId);
|
||||
|
||||
final JpaRollout rollout = getRolloutAndThrowExceptionIfNotFound(rolloutId);
|
||||
@@ -571,7 +571,7 @@ public class JpaRolloutManagement extends AbstractRolloutManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public void pauseRollout(final Long rolloutId) {
|
||||
public void pauseRollout(final long rolloutId) {
|
||||
final JpaRollout rollout = getRolloutAndThrowExceptionIfNotFound(rolloutId);
|
||||
if (!RolloutStatus.RUNNING.equals(rollout.getStatus())) {
|
||||
throw new RolloutIllegalStateException("Rollout can only be paused in state running but current state is "
|
||||
@@ -590,7 +590,7 @@ public class JpaRolloutManagement extends AbstractRolloutManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public void resumeRollout(final Long rolloutId) {
|
||||
public void resumeRollout(final long rolloutId) {
|
||||
final JpaRollout rollout = getRolloutAndThrowExceptionIfNotFound(rolloutId);
|
||||
if (!(RolloutStatus.PAUSED.equals(rollout.getStatus()))) {
|
||||
throw new RolloutIllegalStateException("Rollout can only be resumed in state paused but current state is "
|
||||
@@ -818,7 +818,7 @@ public class JpaRolloutManagement extends AbstractRolloutManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public void delete(final Long rolloutId) {
|
||||
public void delete(final long rolloutId) {
|
||||
final JpaRollout jpaRollout = rolloutRepository.findOne(rolloutId);
|
||||
|
||||
if (jpaRollout == null) {
|
||||
@@ -982,7 +982,7 @@ public class JpaRolloutManagement extends AbstractRolloutManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Rollout> getWithDetailedStatus(final Long rolloutId) {
|
||||
public Optional<Rollout> getWithDetailedStatus(final long rolloutId) {
|
||||
final Optional<Rollout> rollout = get(rolloutId);
|
||||
|
||||
if (!rollout.isPresent()) {
|
||||
@@ -1041,7 +1041,7 @@ public class JpaRolloutManagement extends AbstractRolloutManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean exists(final Long rolloutId) {
|
||||
public boolean exists(final long rolloutId) {
|
||||
return rolloutRepository.exists(rolloutId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ public class JpaSoftwareModuleManagement implements SoftwareModuleManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Slice<SoftwareModule> findByType(final Pageable pageable, final Long typeId) {
|
||||
public Slice<SoftwareModule> findByType(final Pageable pageable, final long typeId) {
|
||||
throwExceptionIfSoftwareModuleTypeDoesNotExist(typeId);
|
||||
|
||||
final List<Specification<JpaSoftwareModule>> specList = Lists.newArrayListWithExpectedSize(2);
|
||||
@@ -181,13 +181,13 @@ public class JpaSoftwareModuleManagement implements SoftwareModuleManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<SoftwareModule> get(final Long id) {
|
||||
public Optional<SoftwareModule> get(final long id) {
|
||||
return Optional.ofNullable(softwareModuleRepository.findOne(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<SoftwareModule> getByNameAndVersionAndType(final String name, final String version,
|
||||
final Long typeId) {
|
||||
final long typeId) {
|
||||
|
||||
throwExceptionIfSoftwareModuleTypeDoesNotExist(typeId);
|
||||
|
||||
@@ -325,7 +325,7 @@ public class JpaSoftwareModuleManagement implements SoftwareModuleManagement {
|
||||
|
||||
@Override
|
||||
public Slice<AssignedSoftwareModule> findAllOrderBySetAssignmentAndModuleNameAscModuleVersionAsc(
|
||||
final Pageable pageable, final Long orderByDistributionId, final String searchText, final Long typeId) {
|
||||
final Pageable pageable, final long orderByDistributionId, final String searchText, final Long typeId) {
|
||||
|
||||
final List<AssignedSoftwareModule> resultList = new ArrayList<>();
|
||||
final int pageSize = pageable.getPageSize();
|
||||
@@ -436,7 +436,7 @@ public class JpaSoftwareModuleManagement implements SoftwareModuleManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<SoftwareModule> findByAssignedTo(final Pageable pageable, final Long setId) {
|
||||
public Page<SoftwareModule> findByAssignedTo(final Pageable pageable, final long setId) {
|
||||
if (!distributionSetRepository.exists(setId)) {
|
||||
throw new EntityNotFoundException(DistributionSet.class, setId);
|
||||
}
|
||||
@@ -526,7 +526,7 @@ public class JpaSoftwareModuleManagement implements SoftwareModuleManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public void deleteMetaData(final Long moduleId, final String key) {
|
||||
public void deleteMetaData(final long moduleId, final String key) {
|
||||
final JpaSoftwareModuleMetadata metadata = (JpaSoftwareModuleMetadata) getMetaDataBySoftwareModuleId(moduleId,
|
||||
key).orElseThrow(() -> new EntityNotFoundException(SoftwareModuleMetadata.class, moduleId, key));
|
||||
|
||||
@@ -541,7 +541,7 @@ public class JpaSoftwareModuleManagement implements SoftwareModuleManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<SoftwareModuleMetadata> findMetaDataByRsql(final Pageable pageable, final Long softwareModuleId,
|
||||
public Page<SoftwareModuleMetadata> findMetaDataByRsql(final Pageable pageable, final long softwareModuleId,
|
||||
final String rsqlParam) {
|
||||
|
||||
throwExceptionIfSoftwareModuleDoesNotExist(softwareModuleId);
|
||||
@@ -565,7 +565,7 @@ public class JpaSoftwareModuleManagement implements SoftwareModuleManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<SoftwareModuleMetadata> findMetaDataBySoftwareModuleId(final Pageable pageable, final Long swId) {
|
||||
public Page<SoftwareModuleMetadata> findMetaDataBySoftwareModuleId(final Pageable pageable, final long swId) {
|
||||
throwExceptionIfSoftwareModuleDoesNotExist(swId);
|
||||
|
||||
return convertMdPage(softwareModuleMetadataRepository.findAll(
|
||||
@@ -575,7 +575,7 @@ public class JpaSoftwareModuleManagement implements SoftwareModuleManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<SoftwareModuleMetadata> getMetaDataBySoftwareModuleId(final Long moduleId, final String key) {
|
||||
public Optional<SoftwareModuleMetadata> getMetaDataBySoftwareModuleId(final long moduleId, final String key) {
|
||||
throwExceptionIfSoftwareModuleDoesNotExist(moduleId);
|
||||
|
||||
return Optional.ofNullable(softwareModuleMetadataRepository.findOne(new SwMetadataCompositeKey(moduleId, key)));
|
||||
@@ -589,18 +589,18 @@ public class JpaSoftwareModuleManagement implements SoftwareModuleManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public void delete(final Long moduleId) {
|
||||
public void delete(final long moduleId) {
|
||||
delete(Arrays.asList(moduleId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean exists(final Long id) {
|
||||
public boolean exists(final long id) {
|
||||
return softwareModuleRepository.exists(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<SoftwareModuleMetadata> findMetaDataBySoftwareModuleIdAndTargetVisible(final Pageable pageable,
|
||||
final Long moduleId) {
|
||||
final long moduleId) {
|
||||
throwExceptionIfSoftwareModuleDoesNotExist(moduleId);
|
||||
|
||||
return convertMdPage(softwareModuleMetadataRepository.findBySoftwareModuleIdAndTargetVisible(
|
||||
|
||||
@@ -128,7 +128,7 @@ public class JpaSoftwareModuleTypeManagement implements SoftwareModuleTypeManage
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public void delete(final Long typeId) {
|
||||
public void delete(final long typeId) {
|
||||
final JpaSoftwareModuleType toDelete = softwareModuleTypeRepository.findById(typeId)
|
||||
.orElseThrow(() -> new EntityNotFoundException(SoftwareModuleType.class, typeId));
|
||||
|
||||
@@ -180,12 +180,12 @@ public class JpaSoftwareModuleTypeManagement implements SoftwareModuleTypeManage
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<SoftwareModuleType> get(final Long id) {
|
||||
public Optional<SoftwareModuleType> get(final long id) {
|
||||
return Optional.ofNullable(softwareModuleTypeRepository.findOne(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean exists(final Long id) {
|
||||
public boolean exists(final long id) {
|
||||
return softwareModuleTypeRepository.exists(id);
|
||||
}
|
||||
|
||||
|
||||
@@ -281,7 +281,7 @@ public class JpaSystemManagement implements CurrentTenantCacheKeyGenerator, Syst
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public TenantMetaData updateTenantMetadata(final Long defaultDsType) {
|
||||
public TenantMetaData updateTenantMetadata(final long defaultDsType) {
|
||||
final JpaTenantMetaData data = (JpaTenantMetaData) getTenantMetadata();
|
||||
|
||||
data.setDefaultDsType(distributionSetTypeRepository.findOne(defaultDsType));
|
||||
@@ -319,7 +319,7 @@ public class JpaSystemManagement implements CurrentTenantCacheKeyGenerator, Syst
|
||||
}
|
||||
|
||||
@Override
|
||||
public TenantMetaData getTenantMetadata(final Long tenantId) {
|
||||
public TenantMetaData getTenantMetadata(final long tenantId) {
|
||||
return tenantMetaDataRepository.findOne(tenantId);
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ public class JpaTargetFilterQueryManagement implements TargetFilterQueryManageme
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public void delete(final Long targetFilterQueryId) {
|
||||
public void delete(final long targetFilterQueryId) {
|
||||
if (!targetFilterQueryRepository.exists(targetFilterQueryId)) {
|
||||
throw new EntityNotFoundException(TargetFilterQuery.class, targetFilterQueryId);
|
||||
}
|
||||
@@ -136,7 +136,7 @@ public class JpaTargetFilterQueryManagement implements TargetFilterQueryManageme
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<TargetFilterQuery> findByAutoAssignDSAndRsql(final Pageable pageable, final Long setId,
|
||||
public Page<TargetFilterQuery> findByAutoAssignDSAndRsql(final Pageable pageable, final long setId,
|
||||
final String rsqlFilter) {
|
||||
final List<Specification<JpaTargetFilterQuery>> specList = Lists.newArrayListWithExpectedSize(2);
|
||||
|
||||
@@ -173,7 +173,7 @@ public class JpaTargetFilterQueryManagement implements TargetFilterQueryManageme
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<TargetFilterQuery> get(final Long targetFilterQueryId) {
|
||||
public Optional<TargetFilterQuery> get(final long targetFilterQueryId) {
|
||||
return Optional.ofNullable(targetFilterQueryRepository.findOne(targetFilterQueryId));
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ public class JpaTargetFilterQueryManagement implements TargetFilterQueryManageme
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public TargetFilterQuery updateAutoAssignDS(final Long queryId, final Long dsId) {
|
||||
public TargetFilterQuery updateAutoAssignDS(final long queryId, final Long dsId) {
|
||||
final JpaTargetFilterQuery targetFilterQuery = findTargetFilterQueryOrThrowExceptionIfNotFound(queryId);
|
||||
|
||||
targetFilterQuery.setAutoAssignDistributionSet(
|
||||
|
||||
@@ -24,7 +24,6 @@ import javax.persistence.criteria.CriteriaQuery;
|
||||
import javax.persistence.criteria.Expression;
|
||||
import javax.persistence.criteria.Predicate;
|
||||
import javax.persistence.criteria.Root;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.eclipse.hawkbit.repository.FilterParams;
|
||||
import org.eclipse.hawkbit.repository.TargetFields;
|
||||
@@ -137,7 +136,7 @@ public class JpaTargetManagement implements TargetManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Slice<Target> findByTargetFilterQuery(final Pageable pageable, final Long targetFilterQueryId) {
|
||||
public Slice<Target> findByTargetFilterQuery(final Pageable pageable, final long targetFilterQueryId) {
|
||||
final TargetFilterQuery targetFilterQuery = targetFilterQueryRepository.findById(targetFilterQueryId)
|
||||
.orElseThrow(() -> new EntityNotFoundException(TargetFilterQuery.class, targetFilterQueryId));
|
||||
|
||||
@@ -205,14 +204,14 @@ public class JpaTargetManagement implements TargetManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Target> findByAssignedDistributionSet(final Pageable pageReq, final Long distributionSetID) {
|
||||
public Page<Target> findByAssignedDistributionSet(final Pageable pageReq, final long distributionSetID) {
|
||||
throwEntityNotFoundIfDsDoesNotExist(distributionSetID);
|
||||
|
||||
return targetRepository.findByAssignedDistributionSetId(pageReq, distributionSetID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Target> findByAssignedDistributionSetAndRsql(final Pageable pageReq, final Long distributionSetID,
|
||||
public Page<Target> findByAssignedDistributionSetAndRsql(final Pageable pageReq, final long distributionSetID,
|
||||
final String rsqlParam) {
|
||||
throwEntityNotFoundIfDsDoesNotExist(distributionSetID);
|
||||
|
||||
@@ -242,13 +241,13 @@ public class JpaTargetManagement implements TargetManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Target> findByInstalledDistributionSet(final Pageable pageReq, final Long distributionSetID) {
|
||||
public Page<Target> findByInstalledDistributionSet(final Pageable pageReq, final long distributionSetID) {
|
||||
throwEntityNotFoundIfDsDoesNotExist(distributionSetID);
|
||||
return targetRepository.findByInstalledDistributionSetId(pageReq, distributionSetID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Target> findByInstalledDistributionSetAndRsql(final Pageable pageable, final Long distributionSetId,
|
||||
public Page<Target> findByInstalledDistributionSetAndRsql(final Pageable pageable, final long distributionSetId,
|
||||
final String rsqlParam) {
|
||||
throwEntityNotFoundIfDsDoesNotExist(distributionSetId);
|
||||
|
||||
@@ -372,7 +371,7 @@ public class JpaTargetManagement implements TargetManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public List<Target> assignTag(final Collection<String> controllerIds, final Long tagId) {
|
||||
public List<Target> assignTag(final Collection<String> controllerIds, final long tagId) {
|
||||
|
||||
final List<JpaTarget> allTargets = targetRepository
|
||||
.findAll(TargetSpecifications.byControllerIdWithTagsInJoin(controllerIds));
|
||||
@@ -399,7 +398,7 @@ public class JpaTargetManagement implements TargetManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public Target unAssignTag(final String controllerID, final Long targetTagId) {
|
||||
public Target unAssignTag(final String controllerID, final long targetTagId) {
|
||||
final JpaTarget target = (JpaTarget) targetRepository.findByControllerId(controllerID)
|
||||
.orElseThrow(() -> new EntityNotFoundException(Target.class, controllerID));
|
||||
|
||||
@@ -417,7 +416,7 @@ public class JpaTargetManagement implements TargetManagement {
|
||||
|
||||
@Override
|
||||
public Slice<Target> findByFilterOrderByLinkedDistributionSet(final Pageable pageable,
|
||||
final Long orderByDistributionId, final FilterParams filterParams) {
|
||||
final long orderByDistributionId, final FilterParams filterParams) {
|
||||
final CriteriaBuilder cb = entityManager.getCriteriaBuilder();
|
||||
final CriteriaQuery<JpaTarget> query = cb.createQuery(JpaTarget.class);
|
||||
final Root<JpaTarget> targetRoot = query.from(JpaTarget.class);
|
||||
@@ -470,21 +469,21 @@ public class JpaTargetManagement implements TargetManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long countByAssignedDistributionSet(final Long distId) {
|
||||
public long countByAssignedDistributionSet(final long distId) {
|
||||
throwEntityNotFoundIfDsDoesNotExist(distId);
|
||||
|
||||
return targetRepository.countByAssignedDistributionSetId(distId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long countByInstalledDistributionSet(final Long distId) {
|
||||
public long countByInstalledDistributionSet(final long distId) {
|
||||
throwEntityNotFoundIfDsDoesNotExist(distId);
|
||||
|
||||
return targetRepository.countByInstalledDistributionSetId(distId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Target> findByTargetFilterQueryAndNonDS(final Pageable pageRequest, final Long distributionSetId,
|
||||
public Page<Target> findByTargetFilterQueryAndNonDS(final Pageable pageRequest, final long distributionSetId,
|
||||
final String targetFilterQuery) {
|
||||
throwEntityNotFoundIfDsDoesNotExist(distributionSetId);
|
||||
|
||||
@@ -512,8 +511,7 @@ public class JpaTargetManagement implements TargetManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Target> findByInRolloutGroupWithoutAction(@NotNull final Pageable pageRequest,
|
||||
@NotNull final Long group) {
|
||||
public Page<Target> findByInRolloutGroupWithoutAction(final Pageable pageRequest, final long group) {
|
||||
if (!rolloutGroupRepository.exists(group)) {
|
||||
throw new EntityNotFoundException(RolloutGroup.class, group);
|
||||
}
|
||||
@@ -534,7 +532,7 @@ public class JpaTargetManagement implements TargetManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long countByRsqlAndNonDS(final Long distributionSetId, final String targetFilterQuery) {
|
||||
public long countByRsqlAndNonDS(final long distributionSetId, final String targetFilterQuery) {
|
||||
throwEntityNotFoundIfDsDoesNotExist(distributionSetId);
|
||||
|
||||
final Specification<JpaTarget> spec = RSQLUtility.parse(targetFilterQuery, TargetFields.class,
|
||||
@@ -564,7 +562,7 @@ public class JpaTargetManagement implements TargetManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Target> findByTag(final Pageable pageable, final Long tagId) {
|
||||
public Page<Target> findByTag(final Pageable pageable, final long tagId) {
|
||||
throwEntityNotFoundExceptionIfTagDoesNotExist(tagId);
|
||||
|
||||
return convertPage(targetRepository.findByTag(pageable, tagId), pageable);
|
||||
@@ -577,7 +575,7 @@ public class JpaTargetManagement implements TargetManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Target> findByRsqlAndTag(final Pageable pageable, final String rsqlParam, final Long tagId) {
|
||||
public Page<Target> findByRsqlAndTag(final Pageable pageable, final String rsqlParam, final long tagId) {
|
||||
|
||||
throwEntityNotFoundExceptionIfTagDoesNotExist(tagId);
|
||||
|
||||
@@ -589,7 +587,7 @@ public class JpaTargetManagement implements TargetManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long countByTargetFilterQuery(final Long targetFilterQueryId) {
|
||||
public long countByTargetFilterQuery(final long targetFilterQueryId) {
|
||||
final TargetFilterQuery targetFilterQuery = targetFilterQueryRepository.findById(targetFilterQueryId)
|
||||
.orElseThrow(() -> new EntityNotFoundException(TargetFilterQuery.class, targetFilterQueryId));
|
||||
|
||||
@@ -609,7 +607,7 @@ public class JpaTargetManagement implements TargetManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Target> get(final Long id) {
|
||||
public Optional<Target> get(final long id) {
|
||||
return Optional.ofNullable(targetRepository.findOne(id));
|
||||
}
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ public class JpaTargetTagManagement implements TargetTagManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<TargetTag> get(final Long id) {
|
||||
public Optional<TargetTag> get(final long id) {
|
||||
return Optional.ofNullable(targetTagRepository.findOne(id));
|
||||
}
|
||||
|
||||
|
||||
@@ -18,13 +18,13 @@ import javax.persistence.Index;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
import org.eclipse.hawkbit.artifact.repository.model.AbstractDbArtifact;
|
||||
import org.eclipse.hawkbit.repository.model.Artifact;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* JPA implementation of {@link LocalArtifact}.
|
||||
|
||||
@@ -17,12 +17,12 @@ import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.UniqueConstraint;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* Stored target filter.
|
||||
|
||||
@@ -13,11 +13,11 @@ import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.UniqueConstraint;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.TenantConfiguration;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* A JPA entity which stores the tenant specific configuration.
|
||||
|
||||
Reference in New Issue
Block a user