Optimize UI queries (#1234)
* first iteration of query optimization for target and distribution set * fixed type distribution set filter * adapted all ui dataproviders to use repository count * adapted test to not check target attributes within search query * unified search behaviuor for ds and sm * removed unneccessary count queries for some mgmt calls * removed unneccessary type id proprty from ProxyDistributionSetInfo to minimize lazy fetches * refactored mgmt classes * removed duplication of name version filter * fixed copy rollout compatibility check * cleaned-up management left overs * added index to rollouts table on tenant/status queries Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch.io>
This commit is contained in:
@@ -160,6 +160,19 @@ public interface ArtifactManagement {
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<Artifact> findBySoftwareModule(@NotNull Pageable pageReq, long swId);
|
||||
|
||||
/**
|
||||
* Count local artifacts for a base software module.
|
||||
*
|
||||
* @param swId
|
||||
* software module id
|
||||
* @return count by software module
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* if software module with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
long countBySoftwareModule(long swId);
|
||||
|
||||
/**
|
||||
* Loads {@link DbArtifact} from store for given {@link Artifact}.
|
||||
*
|
||||
|
||||
@@ -331,7 +331,7 @@ public interface DeploymentManagement {
|
||||
|
||||
/**
|
||||
* Retrieves all the {@link ActionStatus} entries of the given
|
||||
* {@link Action} and {@link Target}.
|
||||
* {@link Action}.
|
||||
*
|
||||
* @param pageReq
|
||||
* pagination parameter
|
||||
@@ -345,6 +345,19 @@ public interface DeploymentManagement {
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<ActionStatus> findActionStatusByAction(@NotNull Pageable pageReq, long actionId);
|
||||
|
||||
/**
|
||||
* Counts all the {@link ActionStatus} entries of the given {@link Action}.
|
||||
*
|
||||
* @param actionId
|
||||
* to be filtered on
|
||||
* @return count of {@link ActionStatus} entries
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* if action with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
long countActionStatusByAction(long actionId);
|
||||
|
||||
/**
|
||||
* Retrieves all messages for an {@link ActionStatus}.
|
||||
*
|
||||
@@ -358,6 +371,19 @@ public interface DeploymentManagement {
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<String> findMessagesByActionStatusId(@NotNull Pageable pageable, long actionStatusId);
|
||||
|
||||
/**
|
||||
* Counts all messages for an {@link ActionStatus}.
|
||||
*
|
||||
*
|
||||
* @param pageable
|
||||
* the page request parameter for paging and sorting the result
|
||||
* @param actionStatusId
|
||||
* the id of {@link ActionStatus} to count the messages from
|
||||
* @return count of messages by a specific {@link ActionStatus} id
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
long countMessagesByActionStatusId(long actionStatusId);
|
||||
|
||||
/**
|
||||
* Get the {@link Action} entity for given actionId with all lazy attributes
|
||||
* (i.e. distributionSet, target, target.assignedDs).
|
||||
|
||||
@@ -29,7 +29,6 @@ import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldExc
|
||||
import org.eclipse.hawkbit.repository.exception.UnsupportedSoftwareModuleForThisDistributionSetException;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetFilter;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetFilter.DistributionSetFilterBuilder;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetMetadata;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult;
|
||||
@@ -39,6 +38,7 @@ import org.eclipse.hawkbit.repository.model.Tag;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Slice;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
/**
|
||||
@@ -244,6 +244,22 @@ public interface DistributionSetManagement
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<DistributionSetMetadata> findMetaDataByDistributionSetId(@NotNull Pageable pageable, long setId);
|
||||
|
||||
/**
|
||||
* Counts all meta data by the given distribution set id.
|
||||
*
|
||||
* @param pageable
|
||||
* the page request to page the result
|
||||
* @param setId
|
||||
* the distribution set id to retrieve the meta data count from
|
||||
*
|
||||
* @return count of ds metadata
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* if distribution set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
long countMetaDataByDistributionSetId(long setId);
|
||||
|
||||
/**
|
||||
* Finds all meta data by the given distribution set id.
|
||||
*
|
||||
@@ -272,7 +288,7 @@ public interface DistributionSetManagement
|
||||
@NotNull String rsqlParam);
|
||||
|
||||
/**
|
||||
* Finds all {@link DistributionSet}s.
|
||||
* Finds all {@link DistributionSet}s based on completeness.
|
||||
*
|
||||
* @param pageable
|
||||
* the pagination parameter
|
||||
@@ -284,7 +300,33 @@ public interface DistributionSetManagement
|
||||
* @return all found {@link DistributionSet}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<DistributionSet> findByCompleted(@NotNull Pageable pageable, Boolean complete);
|
||||
Slice<DistributionSet> findByCompleted(@NotNull Pageable pageable, Boolean complete);
|
||||
|
||||
/**
|
||||
* Counts all {@link DistributionSet}s based on completeness.
|
||||
*
|
||||
* @param complete
|
||||
* to <code>true</code> for counting only completed distribution
|
||||
* sets or <code>false</code> for only incomplete ones nor
|
||||
* <code>null</code> to count both.
|
||||
*
|
||||
* @return count of all found {@link DistributionSet}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
long countByCompleted(Boolean complete);
|
||||
|
||||
/**
|
||||
* Retrieves {@link DistributionSet}s by filtering on the given parameters.
|
||||
*
|
||||
* @param pageable
|
||||
* page parameter
|
||||
* @param distributionSetFilter
|
||||
* has details of filters to be applied.
|
||||
* @return the page of found {@link DistributionSet}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Slice<DistributionSet> findByDistributionSetFilter(@NotNull Pageable pageable,
|
||||
@NotNull DistributionSetFilter distributionSetFilter);
|
||||
|
||||
/**
|
||||
* Method retrieves all {@link DistributionSet}s from the repository in the
|
||||
@@ -301,29 +343,27 @@ public interface DistributionSetManagement
|
||||
*
|
||||
* @param pageable
|
||||
* the page request to page the result set *
|
||||
* @param distributionSetFilterBuilder
|
||||
* has details of filters to be applied
|
||||
* @param distributionSetFilter
|
||||
* has details of filters to be applied.
|
||||
* @param assignedOrInstalled
|
||||
* the id of the Target to be ordered by
|
||||
*
|
||||
* @return {@link DistributionSet}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<DistributionSet> findByFilterAndAssignedInstalledDsOrderedByLinkTarget(@NotNull Pageable pageable,
|
||||
@NotNull DistributionSetFilterBuilder distributionSetFilterBuilder, @NotEmpty String assignedOrInstalled);
|
||||
Slice<DistributionSet> findByDistributionSetFilterOrderByLinkedTarget(@NotNull Pageable pageable,
|
||||
@NotNull DistributionSetFilter distributionSetFilter, @NotEmpty String assignedOrInstalled);
|
||||
|
||||
/**
|
||||
* Retrieves {@link DistributionSet}s by filtering on the given parameters.
|
||||
* Counts all {@link DistributionSet}s in repository based on given filter.
|
||||
*
|
||||
* @param pageable
|
||||
* page parameter
|
||||
* @param distributionSetFilter
|
||||
* has details of filters to be applied.
|
||||
* @return the page of found {@link DistributionSet}
|
||||
*
|
||||
* @return count of {@link DistributionSet}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<DistributionSet> findByDistributionSetFilter(@NotNull Pageable pageable,
|
||||
@NotNull DistributionSetFilter distributionSetFilter);
|
||||
long countByDistributionSetFilter(@NotNull DistributionSetFilter distributionSetFilter);
|
||||
|
||||
/**
|
||||
* Retrieves {@link DistributionSet}s by filtering on the given parameters.
|
||||
|
||||
@@ -181,8 +181,8 @@ public interface RolloutManagement {
|
||||
RolloutGroupConditions conditions);
|
||||
|
||||
/**
|
||||
* Calculates how many targets are addressed by each rollout group and returns
|
||||
* the validation information.
|
||||
* Calculates how many targets are addressed by each rollout group and
|
||||
* returns the validation information.
|
||||
*
|
||||
* @param groups
|
||||
* a list of rollout groups
|
||||
@@ -226,7 +226,7 @@ public interface RolloutManagement {
|
||||
* statuses
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
|
||||
Page<Rollout> findAllWithDetailedStatus(@NotNull Pageable pageable, boolean deleted);
|
||||
Slice<Rollout> findAllWithDetailedStatus(@NotNull Pageable pageable, boolean deleted);
|
||||
|
||||
/**
|
||||
* Retrieves all rollouts found by the given specification.
|
||||
|
||||
@@ -220,6 +220,20 @@ public interface SoftwareModuleManagement
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<SoftwareModuleMetadata> findMetaDataBySoftwareModuleId(@NotNull Pageable pageable, long moduleId);
|
||||
|
||||
/**
|
||||
* Counts all meta data by the given software module id.
|
||||
*
|
||||
* @param moduleId
|
||||
* the software module id to retrieve the meta data count from
|
||||
*
|
||||
* @return count of all meta data entries for a given software module id
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* if software module with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
long countMetaDataBySoftwareModuleId(long moduleId);
|
||||
|
||||
/**
|
||||
* Finds all meta data by the given software module id where
|
||||
* {@link SoftwareModuleMetadata#isTargetVisible()}.
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Slice;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
/**
|
||||
@@ -96,7 +97,7 @@ public interface TargetFilterQueryManagement {
|
||||
* @return the found {@link TargetFilterQuery}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<TargetFilterQuery> findAll(@NotNull Pageable pageable);
|
||||
Slice<TargetFilterQuery> findAll(@NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
* Counts all {@link TargetFilterQuery}s.
|
||||
@@ -128,7 +129,17 @@ public interface TargetFilterQueryManagement {
|
||||
* @return the page with the found {@link TargetFilterQuery}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<TargetFilterQuery> findByName(@NotNull Pageable pageable, @NotNull String name);
|
||||
Slice<TargetFilterQuery> findByName(@NotNull Pageable pageable, @NotNull String name);
|
||||
|
||||
/**
|
||||
* Counts all {@link TargetFilterQuery}s which match the given name filter.
|
||||
*
|
||||
* @param name
|
||||
* name filter
|
||||
* @return count of found {@link TargetFilterQuery}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
long countByName(@NotNull String name);
|
||||
|
||||
/**
|
||||
* Retrieves all {@link TargetFilterQuery} which match the given RSQL
|
||||
@@ -153,7 +164,23 @@ public interface TargetFilterQueryManagement {
|
||||
* @return the page with the found {@link TargetFilterQuery}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<TargetFilterQuery> findByQuery(@NotNull Pageable pageable, @NotNull String query);
|
||||
Slice<TargetFilterQuery> findByQuery(@NotNull Pageable pageable, @NotNull String query);
|
||||
|
||||
/**
|
||||
* Retrieves all {@link TargetFilterQuery}s which match the given
|
||||
* auto-assign distribution set ID.
|
||||
*
|
||||
* @param pageable
|
||||
* pagination parameter
|
||||
* @param setId
|
||||
* the auto assign distribution set
|
||||
* @return the page with the found {@link TargetFilterQuery}s
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* if DS with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Slice<TargetFilterQuery> findByAutoAssignDistributionSetId(@NotNull Pageable pageable, long setId);
|
||||
|
||||
/**
|
||||
* Retrieves all {@link TargetFilterQuery}s which match the given
|
||||
@@ -181,7 +208,7 @@ public interface TargetFilterQueryManagement {
|
||||
* @param pageable
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<TargetFilterQuery> findWithAutoAssignDS(@NotNull Pageable pageable);
|
||||
Slice<TargetFilterQuery> findWithAutoAssignDS(@NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
* Finds the {@link TargetFilterQuery} by id.
|
||||
|
||||
@@ -8,6 +8,16 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.validation.ConstraintViolationException;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
||||
import org.eclipse.hawkbit.repository.builder.TargetCreate;
|
||||
import org.eclipse.hawkbit.repository.builder.TargetUpdate;
|
||||
@@ -34,15 +44,6 @@ import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Slice;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
import javax.validation.ConstraintViolationException;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Management service for {@link Target}s.
|
||||
*
|
||||
@@ -109,7 +110,9 @@ public interface TargetManagement {
|
||||
* @throws EntityNotFoundException
|
||||
* if distribution set with given ID does not exist
|
||||
*
|
||||
* @deprecated this method {@link TargetManagement#countByFilters(FilterParams)} should be used instead.
|
||||
* @deprecated this method
|
||||
* {@link TargetManagement#countByFilters(FilterParams)} should
|
||||
* be used instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
@@ -146,7 +149,8 @@ public interface TargetManagement {
|
||||
long countByInstalledDistributionSet(long distId);
|
||||
|
||||
/**
|
||||
* Checks if there is already a {@link Target} that has the given distribution set Id assigned or installed.
|
||||
* Checks if there is already a {@link Target} that has the given
|
||||
* distribution set Id assigned or installed.
|
||||
*
|
||||
* @param distId
|
||||
* to search for
|
||||
@@ -170,8 +174,8 @@ public interface TargetManagement {
|
||||
long countByRsql(@NotEmpty String rsqlParam);
|
||||
|
||||
/**
|
||||
* Count all targets for given {@link TargetFilterQuery} and that are compatible
|
||||
* with the passed {@link DistributionSetType}.
|
||||
* Count all targets for given {@link TargetFilterQuery} and that are
|
||||
* compatible with the passed {@link DistributionSetType}.
|
||||
*
|
||||
* @param rsqlParam
|
||||
* filter definition in RSQL syntax
|
||||
@@ -190,7 +194,7 @@ public interface TargetManagement {
|
||||
* {@link TargetFilterQuery#getId()}
|
||||
* @return the found number of {@link Target}s
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* @throws EntityNotFoundException
|
||||
* if {@link TargetFilterQuery} with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
@@ -265,9 +269,9 @@ public interface TargetManagement {
|
||||
void deleteByControllerID(@NotEmpty String controllerID);
|
||||
|
||||
/**
|
||||
* Finds all targets for all the given parameter {@link TargetFilterQuery} and
|
||||
* that don't have the specified distribution set in their action history and
|
||||
* are compatible with the passed {@link DistributionSetType}.
|
||||
* Finds all targets for all the given parameter {@link TargetFilterQuery}
|
||||
* and that don't have the specified distribution set in their action
|
||||
* history and are compatible with the passed {@link DistributionSetType}.
|
||||
*
|
||||
* @param pageRequest
|
||||
* the pageRequest to enhance the query for paging and sorting
|
||||
@@ -281,13 +285,13 @@ public interface TargetManagement {
|
||||
* if distribution set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<Target> findByTargetFilterQueryAndNonDSAndCompatible(@NotNull Pageable pageRequest, long distributionSetId,
|
||||
Slice<Target> findByTargetFilterQueryAndNonDSAndCompatible(@NotNull Pageable pageRequest, long distributionSetId,
|
||||
@NotNull String rsqlParam);
|
||||
|
||||
/**
|
||||
* Counts all targets for all the given parameter {@link TargetFilterQuery} and
|
||||
* that don't have the specified distribution set in their action history and
|
||||
* are compatible with the passed {@link DistributionSetType}.
|
||||
* Counts all targets for all the given parameter {@link TargetFilterQuery}
|
||||
* and that don't have the specified distribution set in their action
|
||||
* history and are compatible with the passed {@link DistributionSetType}.
|
||||
*
|
||||
* @param distributionSetId
|
||||
* id of the {@link DistributionSet}
|
||||
@@ -302,9 +306,9 @@ public interface TargetManagement {
|
||||
long countByRsqlAndNonDSAndCompatible(long distributionSetId, @NotNull String rsqlParam);
|
||||
|
||||
/**
|
||||
* Finds all targets for all the given parameter {@link TargetFilterQuery} and
|
||||
* that are not assigned to one of the {@link RolloutGroup}s and are compatible
|
||||
* with the passed {@link DistributionSetType}.
|
||||
* Finds all targets for all the given parameter {@link TargetFilterQuery}
|
||||
* and that are not assigned to one of the {@link RolloutGroup}s and are
|
||||
* compatible with the passed {@link DistributionSetType}.
|
||||
*
|
||||
* @param pageRequest
|
||||
* the pageRequest to enhance the query for paging and sorting
|
||||
@@ -313,27 +317,27 @@ public interface TargetManagement {
|
||||
* @param rsqlParam
|
||||
* filter definition in RSQL syntax
|
||||
* @param distributionSetType
|
||||
* type of the {@link DistributionSet} the targets must be compatible
|
||||
* with
|
||||
* type of the {@link DistributionSet} the targets must be
|
||||
* compatible with
|
||||
* @return a page of the found {@link Target}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<Target> findByTargetFilterQueryAndNotInRolloutGroupsAndCompatible(@NotNull Pageable pageRequest,
|
||||
Slice<Target> findByTargetFilterQueryAndNotInRolloutGroupsAndCompatible(@NotNull Pageable pageRequest,
|
||||
@NotEmpty Collection<Long> groups, @NotNull String rsqlParam,
|
||||
@NotNull DistributionSetType distributionSetType);
|
||||
|
||||
/**
|
||||
* Counts all targets for all the given parameter {@link TargetFilterQuery} and
|
||||
* that are not assigned to one of the {@link RolloutGroup}s and are compatible
|
||||
* with the passed {@link DistributionSetType}.
|
||||
* Counts all targets for all the given parameter {@link TargetFilterQuery}
|
||||
* and that are not assigned to one of the {@link RolloutGroup}s and are
|
||||
* compatible with the passed {@link DistributionSetType}.
|
||||
*
|
||||
* @param groups
|
||||
* the list of {@link RolloutGroup}s
|
||||
* @param rsqlParam
|
||||
* filter definition in RSQL syntax
|
||||
* @param distributionSetType
|
||||
* type of the {@link DistributionSet} the targets must be compatible
|
||||
* with
|
||||
* type of the {@link DistributionSet} the targets must be
|
||||
* compatible with
|
||||
* @return count of the found {@link Target}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
@@ -354,7 +358,7 @@ public interface TargetManagement {
|
||||
* if rollout group with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<Target> findByInRolloutGroupWithoutAction(@NotNull Pageable pageRequest, long group);
|
||||
Slice<Target> findByInRolloutGroupWithoutAction(@NotNull Pageable pageRequest, long group);
|
||||
|
||||
/**
|
||||
* retrieves {@link Target}s by the assigned {@link DistributionSet}.
|
||||
@@ -518,7 +522,7 @@ public interface TargetManagement {
|
||||
* if the RSQL syntax is wrong
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<Target> findByRsql(@NotNull Pageable pageable, @NotNull String rsqlParam);
|
||||
Slice<Target> findByRsql(@NotNull Pageable pageable, @NotNull String rsqlParam);
|
||||
|
||||
/**
|
||||
* Retrieves all target based on {@link TargetFilterQuery}.
|
||||
@@ -612,8 +616,8 @@ public interface TargetManagement {
|
||||
/**
|
||||
* Toggles {@link TargetTag} assignment to given {@link Target}s by means
|
||||
* that if some (or all) of the targets in the list have the {@link Tag} not
|
||||
* yet assigned, they will be. Only if all of theme have the tag already assigned
|
||||
* they will be removed instead.
|
||||
* yet assigned, they will be. Only if all of theme have the tag already
|
||||
* assigned they will be removed instead.
|
||||
*
|
||||
* @param controllerIds
|
||||
* to toggle for
|
||||
@@ -627,12 +631,11 @@ public interface TargetManagement {
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
||||
TargetTagAssignmentResult toggleTagAssignment(@NotEmpty Collection<String> controllerIds, @NotEmpty String tagName);
|
||||
|
||||
|
||||
/**
|
||||
* Initiates {@link TargetType} assignment to given {@link Target}s. If some
|
||||
* targets in the list have the {@link TargetType} not yet assigned, they will
|
||||
* get assigned. If all targets are already of that type, there will be no
|
||||
* un-assignment.
|
||||
* targets in the list have the {@link TargetType} not yet assigned, they
|
||||
* will get assigned. If all targets are already of that type, there will be
|
||||
* no un-assignment.
|
||||
*
|
||||
* @param controllerIds
|
||||
* to set the type to
|
||||
@@ -648,8 +651,8 @@ public interface TargetManagement {
|
||||
TargetTypeAssignmentResult assignType(@NotEmpty Collection<String> controllerIds, @NotNull Long typeId);
|
||||
|
||||
/**
|
||||
* Initiates {@link TargetType} un-assignment to given {@link Target}s. The type
|
||||
* of the targets will be set to {@code null}
|
||||
* Initiates {@link TargetType} un-assignment to given {@link Target}s. The
|
||||
* type of the targets will be set to {@code null}
|
||||
*
|
||||
* @param controllerIds
|
||||
* to remove the type from
|
||||
@@ -851,6 +854,20 @@ public interface TargetManagement {
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<TargetMetadata> findMetaDataByControllerId(@NotNull Pageable pageable, @NotEmpty String controllerId);
|
||||
|
||||
/**
|
||||
* Counts all meta data by the given target id.
|
||||
*
|
||||
* @param controllerId
|
||||
* the controller id to retrieve the meta data from
|
||||
*
|
||||
* @return count of all meta data entries for a given target id
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* if target with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
long countMetaDataByControllerId(@NotEmpty String controllerId);
|
||||
|
||||
/**
|
||||
* Finds all meta data by the given target id and query.
|
||||
*
|
||||
|
||||
@@ -8,21 +8,23 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission;
|
||||
import org.eclipse.hawkbit.repository.builder.TargetTypeCreate;
|
||||
import org.eclipse.hawkbit.repository.builder.TargetTypeUpdate;
|
||||
import org.eclipse.hawkbit.repository.model.TargetType;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Slice;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Management service for {@link TargetType}s.
|
||||
*
|
||||
@@ -43,9 +45,17 @@ public interface TargetTypeManagement {
|
||||
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
long count();
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* as {@link TargetType#getName()}
|
||||
* @return total count by name
|
||||
*/
|
||||
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
long countByName(String name);
|
||||
|
||||
/**
|
||||
* @param create
|
||||
* TargetTypeCreate
|
||||
* TargetTypeCreate
|
||||
* @return targetType
|
||||
*/
|
||||
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
|
||||
@@ -53,31 +63,32 @@ public interface TargetTypeManagement {
|
||||
|
||||
/**
|
||||
* @param creates
|
||||
* List of TargetTypeCreate
|
||||
* List of TargetTypeCreate
|
||||
* @return List of targetType
|
||||
*/
|
||||
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
|
||||
List<TargetType> create(@NotEmpty @Valid Collection<TargetTypeCreate> creates);
|
||||
|
||||
/**
|
||||
* @param id targetTypeId
|
||||
* @param id
|
||||
* targetTypeId
|
||||
*/
|
||||
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_DELETE_TARGET)
|
||||
void delete(@NotNull Long id);
|
||||
|
||||
/**
|
||||
* @param pageable
|
||||
* Page
|
||||
* Page
|
||||
* @return TargetType page
|
||||
*/
|
||||
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<TargetType> findAll(@NotNull Pageable pageable);
|
||||
Slice<TargetType> findAll(@NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
* @param pageable
|
||||
* Page
|
||||
* Page
|
||||
* @param rsqlParam
|
||||
* query param
|
||||
* query param
|
||||
* @return Target type
|
||||
*/
|
||||
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
@@ -93,11 +104,11 @@ public interface TargetTypeManagement {
|
||||
* @return the page of found {@link TargetType}
|
||||
*/
|
||||
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<TargetType> findByName(@NotNull Pageable pageable, String name);
|
||||
Slice<TargetType> findByName(@NotNull Pageable pageable, String name);
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* Target type ID
|
||||
* Target type ID
|
||||
* @return Target Type
|
||||
*/
|
||||
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
@@ -105,7 +116,7 @@ public interface TargetTypeManagement {
|
||||
|
||||
/**
|
||||
* @param targetId
|
||||
* Target ID
|
||||
* Target ID
|
||||
* @return Target Type
|
||||
*/
|
||||
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
@@ -113,7 +124,7 @@ public interface TargetTypeManagement {
|
||||
|
||||
/**
|
||||
* @param targetIds
|
||||
* List of Target ID
|
||||
* List of Target ID
|
||||
* @return Target Type
|
||||
*/
|
||||
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
@@ -121,7 +132,7 @@ public interface TargetTypeManagement {
|
||||
|
||||
/**
|
||||
* @param controllerId
|
||||
* Target controller ID
|
||||
* Target controller ID
|
||||
* @return Target Type
|
||||
*/
|
||||
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
@@ -129,25 +140,23 @@ public interface TargetTypeManagement {
|
||||
|
||||
/**
|
||||
* @param controllerIds
|
||||
* List of Target controller ID
|
||||
* List of Target controller ID
|
||||
* @return Target Type
|
||||
*/
|
||||
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
List<TargetType> findByTargetControllerIds(Collection<String> controllerIds);
|
||||
|
||||
|
||||
/**
|
||||
* @param ids
|
||||
* List of Target type ID
|
||||
* List of Target type ID
|
||||
* @return Target type list
|
||||
*/
|
||||
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
List<TargetType> get(@NotEmpty Collection<Long> ids);
|
||||
|
||||
|
||||
/**
|
||||
* @param update
|
||||
* TargetTypeUpdate
|
||||
* TargetTypeUpdate
|
||||
* @return Target Type
|
||||
*/
|
||||
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
||||
@@ -155,20 +164,20 @@ public interface TargetTypeManagement {
|
||||
|
||||
/**
|
||||
* @param targetTypeId
|
||||
* Target type ID
|
||||
* Target type ID
|
||||
* @param distributionSetTypeIds
|
||||
* Distribution set ID
|
||||
* Distribution set ID
|
||||
* @return Target type
|
||||
*/
|
||||
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
|
||||
TargetType assignCompatibleDistributionSetTypes(long targetTypeId,
|
||||
@NotEmpty Collection<Long> distributionSetTypeIds);
|
||||
@NotEmpty Collection<Long> distributionSetTypeIds);
|
||||
|
||||
/**
|
||||
* @param targetTypeId
|
||||
* Target type ID
|
||||
* Target type ID
|
||||
* @param distributionSetTypeIds
|
||||
* Distribution set ID
|
||||
* Distribution set ID
|
||||
* @return Target type
|
||||
*/
|
||||
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
|
||||
|
||||
@@ -21,9 +21,8 @@ public final class DistributionSetFilter {
|
||||
private Boolean isDeleted;
|
||||
private Boolean isComplete;
|
||||
private Boolean isValid;
|
||||
private DistributionSetType type;
|
||||
private Long typeId;
|
||||
private String searchText;
|
||||
private String filterString;
|
||||
private Boolean selectDSWithNoTag;
|
||||
private Collection<String> tagNames;
|
||||
private String assignedTargetId;
|
||||
@@ -68,11 +67,6 @@ public final class DistributionSetFilter {
|
||||
return this;
|
||||
}
|
||||
|
||||
public DistributionSetFilterBuilder setFilterString(final String filterString) {
|
||||
this.filterString = filterString;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DistributionSetFilterBuilder setSelectDSWithNoTag(final Boolean selectDSWithNoTag) {
|
||||
this.selectDSWithNoTag = selectDSWithNoTag;
|
||||
return this;
|
||||
@@ -83,8 +77,8 @@ public final class DistributionSetFilter {
|
||||
return this;
|
||||
}
|
||||
|
||||
public DistributionSetFilterBuilder setType(final DistributionSetType type) {
|
||||
this.type = type;
|
||||
public DistributionSetFilterBuilder setTypeId(final Long typeId) {
|
||||
this.typeId = typeId;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -93,9 +87,8 @@ public final class DistributionSetFilter {
|
||||
private final Boolean isDeleted;
|
||||
private final Boolean isComplete;
|
||||
private final Boolean isValid;
|
||||
private final DistributionSetType type;
|
||||
private final Long typeId;
|
||||
private final String searchText;
|
||||
private final String filterString;
|
||||
private final Boolean selectDSWithNoTag;
|
||||
private final Collection<String> tagNames;
|
||||
private final String assignedTargetId;
|
||||
@@ -112,9 +105,8 @@ public final class DistributionSetFilter {
|
||||
this.isDeleted = builder.isDeleted;
|
||||
this.isComplete = builder.isComplete;
|
||||
this.isValid = builder.isValid;
|
||||
this.type = builder.type;
|
||||
this.typeId = builder.typeId;
|
||||
this.searchText = builder.searchText;
|
||||
this.filterString = builder.filterString;
|
||||
this.selectDSWithNoTag = builder.selectDSWithNoTag;
|
||||
this.tagNames = builder.tagNames;
|
||||
this.assignedTargetId = builder.assignedTargetId;
|
||||
@@ -145,10 +137,6 @@ public final class DistributionSetFilter {
|
||||
return searchText;
|
||||
}
|
||||
|
||||
public String getFilterString() {
|
||||
return filterString;
|
||||
}
|
||||
|
||||
public Boolean getSelectDSWithNoTag() {
|
||||
return selectDSWithNoTag;
|
||||
}
|
||||
@@ -157,8 +145,8 @@ public final class DistributionSetFilter {
|
||||
return tagNames;
|
||||
}
|
||||
|
||||
public DistributionSetType getType() {
|
||||
return type;
|
||||
public Long getTypeId() {
|
||||
return typeId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user