Complete repository refactoring - method renaming (#575)
* Split Tag management Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Repo method naming schame applied. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * findAll returns slice instead of page. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Complete javadoc. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Allow null values again. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Readability improvements. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Forgot a method. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Fixed broken completed filter. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
@@ -39,7 +39,7 @@ public interface ArtifactManagement {
|
||||
* management
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Long countArtifactsAll();
|
||||
long count();
|
||||
|
||||
/**
|
||||
* Persists artifact binary as provided by given InputStream. assign the
|
||||
@@ -63,7 +63,7 @@ public interface ArtifactManagement {
|
||||
* if given software module does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
Artifact createArtifact(@NotNull InputStream inputStream, @NotNull Long moduleId, final String filename,
|
||||
Artifact create(@NotNull InputStream inputStream, @NotNull Long moduleId, final String filename,
|
||||
final boolean overrideExisting);
|
||||
|
||||
/**
|
||||
@@ -99,7 +99,7 @@ public interface ArtifactManagement {
|
||||
* if check against provided SHA1 checksum failed
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
||||
Artifact createArtifact(@NotNull InputStream stream, @NotNull Long moduleId, @NotEmpty String filename,
|
||||
Artifact create(@NotNull InputStream stream, @NotNull Long moduleId, @NotEmpty String filename,
|
||||
String providedMd5Sum, String providedSha1Sum, boolean overrideExisting, String contentType);
|
||||
|
||||
/**
|
||||
@@ -129,7 +129,7 @@ public interface ArtifactManagement {
|
||||
* if artifact with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
||||
void deleteArtifact(@NotNull Long id);
|
||||
void delete(@NotNull Long id);
|
||||
|
||||
/**
|
||||
* Searches for {@link Artifact} with given {@link Identifiable}.
|
||||
@@ -140,7 +140,7 @@ public interface ArtifactManagement {
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.IS_CONTROLLER)
|
||||
Optional<Artifact> findArtifact(@NotNull Long id);
|
||||
Optional<Artifact> get(@NotNull Long id);
|
||||
|
||||
/**
|
||||
* Find by artifact by software module id and filename.
|
||||
@@ -156,7 +156,7 @@ public interface ArtifactManagement {
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.IS_CONTROLLER)
|
||||
Optional<Artifact> findByFilenameAndSoftwareModule(@NotNull String filename, @NotNull Long softwareModuleId);
|
||||
Optional<Artifact> getByFilenameAndSoftwareModule(@NotNull String filename, @NotNull Long softwareModuleId);
|
||||
|
||||
/**
|
||||
* Find all local artifact by sha1 and return the first artifact.
|
||||
@@ -167,7 +167,7 @@ public interface ArtifactManagement {
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.IS_CONTROLLER)
|
||||
Optional<Artifact> findFirstArtifactBySHA1(@NotNull String sha1);
|
||||
Optional<Artifact> findFirstBySHA1(@NotNull String sha1);
|
||||
|
||||
/**
|
||||
* Searches for {@link Artifact} with given file name.
|
||||
@@ -178,13 +178,13 @@ public interface ArtifactManagement {
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.IS_CONTROLLER)
|
||||
Optional<Artifact> findArtifactByFilename(@NotNull String filename);
|
||||
Optional<Artifact> getByFilename(@NotNull String filename);
|
||||
|
||||
/**
|
||||
* Get local artifact for a base software module.
|
||||
*
|
||||
* @param pageReq
|
||||
* Pageable
|
||||
* Pageable parameter
|
||||
* @param swId
|
||||
* software module id
|
||||
* @return Page<Artifact>
|
||||
@@ -193,7 +193,7 @@ public interface ArtifactManagement {
|
||||
* if software module with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<Artifact> findArtifactBySoftwareModule(@NotNull Pageable pageReq, @NotNull Long swId);
|
||||
Page<Artifact> findBySoftwareModule(@NotNull Pageable pageReq, @NotNull Long swId);
|
||||
|
||||
/**
|
||||
* Loads {@link AbstractDbArtifact} from store for given {@link Artifact}.
|
||||
|
||||
@@ -64,6 +64,16 @@ public interface ControllerManagement {
|
||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||
Action addCancelActionStatus(@NotNull ActionStatusCreate create);
|
||||
|
||||
/**
|
||||
* Retrieves assigned {@link SoftwareModule} of a target.
|
||||
*
|
||||
* @param moduleId
|
||||
* of the {@link SoftwareModule}
|
||||
* @return {@link SoftwareModule} identified by ID
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||
Optional<SoftwareModule> getSoftwareModule(@NotNull final Long moduleId);
|
||||
|
||||
/**
|
||||
* Simple addition of a new {@link ActionStatus} entry to the {@link Action}
|
||||
* . No state changes.
|
||||
@@ -282,7 +292,7 @@ public interface ControllerManagement {
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.IS_SYSTEM_CODE)
|
||||
Optional<Target> findByControllerId(@NotEmpty String controllerId);
|
||||
Optional<Target> getByControllerId(@NotEmpty String controllerId);
|
||||
|
||||
/**
|
||||
* Finds {@link Target} based on given ID returns found Target without
|
||||
@@ -296,7 +306,7 @@ public interface ControllerManagement {
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.IS_SYSTEM_CODE)
|
||||
Optional<Target> findByTargetId(@NotNull Long targetId);
|
||||
Optional<Target> get(@NotNull Long targetId);
|
||||
|
||||
/**
|
||||
* Retrieves the specified number of messages from action history of the
|
||||
|
||||
@@ -187,19 +187,19 @@ public interface DeploymentManagement {
|
||||
* if target with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Long countActionsByTarget(@NotNull String rsqlParam, @NotEmpty String controllerId);
|
||||
long countActionsByTarget(@NotNull String rsqlParam, @NotEmpty String controllerId);
|
||||
|
||||
/**
|
||||
* @return the total amount of stored action status
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Long countActionStatusAll();
|
||||
long countActionStatusAll();
|
||||
|
||||
/**
|
||||
* @return the total amount of stored actions
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Long countActionsAll();
|
||||
long countActionsAll();
|
||||
|
||||
/**
|
||||
* counts all actions associated to a specific target.
|
||||
@@ -212,7 +212,7 @@ public interface DeploymentManagement {
|
||||
* if target with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Long countActionsByTarget(@NotEmpty String controllerId);
|
||||
long countActionsByTarget(@NotEmpty String controllerId);
|
||||
|
||||
/**
|
||||
* Get the {@link Action} entity for given actionId.
|
||||
|
||||
@@ -12,20 +12,17 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.validation.ConstraintViolationException;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
||||
import org.eclipse.hawkbit.repository.builder.DistributionSetCreate;
|
||||
import org.eclipse.hawkbit.repository.builder.DistributionSetUpdate;
|
||||
import org.eclipse.hawkbit.repository.exception.DistributionSetCreationFailedMissingMandatoryModuleException;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityReadOnlyException;
|
||||
import org.eclipse.hawkbit.repository.exception.RSQLParameterSyntaxException;
|
||||
import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException;
|
||||
import org.eclipse.hawkbit.repository.exception.UnsupportedSoftwareModuleForThisDistributionSetException;
|
||||
import org.eclipse.hawkbit.repository.model.Action;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetFilter;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetFilter.DistributionSetFilterBuilder;
|
||||
@@ -45,7 +42,8 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
* Management service for {@link DistributionSet}s.
|
||||
*
|
||||
*/
|
||||
public interface DistributionSetManagement {
|
||||
public interface DistributionSetManagement
|
||||
extends RepositoryManagement<DistributionSet, DistributionSetCreate, DistributionSetUpdate> {
|
||||
|
||||
/**
|
||||
* Assigns {@link SoftwareModule} to existing {@link DistributionSet}.
|
||||
@@ -66,8 +64,6 @@ public interface DistributionSetManagement {
|
||||
* @throws UnsupportedSoftwareModuleForThisDistributionSetException
|
||||
* is {@link SoftwareModule#getType()} is not supported by this
|
||||
* {@link DistributionSet#getType()}.
|
||||
*
|
||||
*
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
DistributionSet assignSoftwareModules(@NotNull Long setId, @NotEmpty Collection<Long> moduleIds);
|
||||
@@ -76,7 +72,7 @@ public interface DistributionSetManagement {
|
||||
* Assign a {@link DistributionSetTag} assignment to given
|
||||
* {@link DistributionSet}s.
|
||||
*
|
||||
* @param dsIds
|
||||
* @param setIds
|
||||
* to assign for
|
||||
* @param tagId
|
||||
* to assign
|
||||
@@ -87,42 +83,12 @@ public interface DistributionSetManagement {
|
||||
* distribution sets.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
List<DistributionSet> assignTag(@NotEmpty Collection<Long> dsIds, @NotNull Long tagId);
|
||||
|
||||
/**
|
||||
* Count all {@link DistributionSet}s in the repository that are not marked
|
||||
* as deleted.
|
||||
*
|
||||
* @return number of {@link DistributionSet}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Long countDistributionSetsAll();
|
||||
|
||||
/**
|
||||
* Creates a new {@link DistributionSet}.
|
||||
*
|
||||
* @param create
|
||||
* {@link DistributionSet} to be created
|
||||
* @return the new persisted {@link DistributionSet}
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* if a provided linked entity does not exists (
|
||||
* {@link DistributionSet#getModules()} or
|
||||
* {@link DistributionSet#getType()})
|
||||
* @throws DistributionSetCreationFailedMissingMandatoryModuleException
|
||||
* is {@link DistributionSet} does not contain mandatory
|
||||
* {@link SoftwareModule}s.
|
||||
* @throws ConstraintViolationException
|
||||
* if fields are not filled as specified. Check
|
||||
* {@link DistributionSetCreate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
||||
DistributionSet createDistributionSet(@NotNull DistributionSetCreate create);
|
||||
List<DistributionSet> assignTag(@NotEmpty Collection<Long> setIds, @NotNull Long tagId);
|
||||
|
||||
/**
|
||||
* creates a list of distribution set meta data entries.
|
||||
*
|
||||
* @param dsId
|
||||
* @param setId
|
||||
* if the {@link DistributionSet} the metadata has to be created
|
||||
* for
|
||||
* @param metadata
|
||||
@@ -136,69 +102,12 @@ public interface DistributionSetManagement {
|
||||
* specific key
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
List<DistributionSetMetadata> createDistributionSetMetadata(@NotNull Long dsId,
|
||||
@NotEmpty Collection<MetaData> metadata);
|
||||
|
||||
/**
|
||||
* Creates multiple {@link DistributionSet}s.
|
||||
*
|
||||
* @param creates
|
||||
* to be created
|
||||
* @return the new {@link DistributionSet}s
|
||||
* @throws EntityNotFoundException
|
||||
* if a provided linked entity does not exists (
|
||||
* {@link DistributionSet#getModules()} or
|
||||
* {@link DistributionSet#getType()})
|
||||
* @throws DistributionSetCreationFailedMissingMandatoryModuleException
|
||||
* is {@link DistributionSet} does not contain mandatory
|
||||
* {@link SoftwareModule}s.
|
||||
* @throws ConstraintViolationException
|
||||
* if fields are not filled as specified. Check
|
||||
* {@link DistributionSetCreate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
||||
List<DistributionSet> createDistributionSets(@NotNull Collection<DistributionSetCreate> creates);
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* {@link DistributionSet} can be deleted/erased from the repository if they
|
||||
* have never been assigned to any {@link Action} or {@link Target}.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* If they have been assigned that need to be marked as deleted which as a
|
||||
* result means that they cannot be assigned anymore to any targets. (define
|
||||
* e.g. findByDeletedFalse())
|
||||
* </p>
|
||||
*
|
||||
* @param setId
|
||||
* to delete
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* if given {@link DistributionSet} does not exist
|
||||
*
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
||||
void deleteDistributionSet(@NotNull Long setId);
|
||||
|
||||
/**
|
||||
* Deleted {@link DistributionSet}s by their IDs. That is either a soft
|
||||
* delete of the entities have been linked to an {@link Action} before or a
|
||||
* hard delete if not.
|
||||
*
|
||||
* @param dsIds
|
||||
* to be deleted
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* if (at least one) given distribution set does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
||||
void deleteDistributionSet(@NotEmpty Collection<Long> dsIds);
|
||||
List<DistributionSetMetadata> createMetaData(@NotNull Long setId, @NotEmpty Collection<MetaData> metadata);
|
||||
|
||||
/**
|
||||
* deletes a distribution set meta data entry.
|
||||
*
|
||||
* @param dsId
|
||||
* @param setId
|
||||
* where meta data has to be deleted
|
||||
* @param key
|
||||
* of the meta data element
|
||||
@@ -207,7 +116,7 @@ public interface DistributionSetManagement {
|
||||
* if given set does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
void deleteDistributionSetMetadata(@NotNull final Long dsId, @NotEmpty final String key);
|
||||
void deleteMetaData(@NotNull Long setId, @NotEmpty String key);
|
||||
|
||||
/**
|
||||
* retrieves the distribution set for a given action.
|
||||
@@ -220,33 +129,21 @@ public interface DistributionSetManagement {
|
||||
* if action with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Optional<DistributionSet> findDistributionSetByAction(@NotNull Long actionId);
|
||||
|
||||
/**
|
||||
* Find {@link DistributionSet} based on given ID without details, e.g.
|
||||
* {@link DistributionSet#getModules()}.
|
||||
*
|
||||
* @param distid
|
||||
* to look for.
|
||||
* @return {@link DistributionSet}
|
||||
*
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Optional<DistributionSet> findDistributionSetById(@NotNull Long distid);
|
||||
Optional<DistributionSet> getByAction(@NotNull Long actionId);
|
||||
|
||||
/**
|
||||
* Find {@link DistributionSet} based on given ID including (lazy loaded)
|
||||
* details, e.g. {@link DistributionSet#getModules()}.
|
||||
*
|
||||
* Note: for performance reasons it is recommended to use
|
||||
* {@link #findDistributionSetById(Long)} if details are not necessary.
|
||||
* Note: for performance reasons it is recommended to use {@link #get(Long)}
|
||||
* if details are not necessary.
|
||||
*
|
||||
* @param distid
|
||||
* @param setId
|
||||
* to look for.
|
||||
* @return {@link DistributionSet}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Optional<DistributionSet> findDistributionSetByIdWithDetails(@NotNull Long distid);
|
||||
Optional<DistributionSet> getWithDetails(@NotNull Long setId);
|
||||
|
||||
/**
|
||||
* Find distribution set by name and version.
|
||||
@@ -258,16 +155,16 @@ public interface DistributionSetManagement {
|
||||
* @return the page with the found {@link DistributionSet}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Optional<DistributionSet> findDistributionSetByNameAndVersion(@NotEmpty String distributionName,
|
||||
@NotEmpty String version);
|
||||
Optional<DistributionSet> getByNameAndVersion(@NotEmpty String distributionName, @NotEmpty String version);
|
||||
|
||||
/**
|
||||
* finds all meta data by the given distribution set id.
|
||||
*
|
||||
* @param distributionSetId
|
||||
* the distribution set id to retrieve the meta data from
|
||||
*
|
||||
* @param pageable
|
||||
* the page request to page the result
|
||||
* @param setId
|
||||
* the distribution set id to retrieve the meta data from
|
||||
*
|
||||
* @return a paged result of all meta data entries for a given distribution
|
||||
* set id
|
||||
*
|
||||
@@ -275,18 +172,18 @@ public interface DistributionSetManagement {
|
||||
* if distribution set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<DistributionSetMetadata> findDistributionSetMetadataByDistributionSetId(@NotNull Long distributionSetId,
|
||||
@NotNull Pageable pageable);
|
||||
Page<DistributionSetMetadata> findMetaDataByDistributionSetId(@NotNull Pageable pageable, @NotNull Long setId);
|
||||
|
||||
/**
|
||||
* finds all meta data by the given distribution set id.
|
||||
*
|
||||
* @param distributionSetId
|
||||
*
|
||||
* @param pageable
|
||||
* the page request to page the result
|
||||
* @param setId
|
||||
* the distribution set id to retrieve the meta data from
|
||||
* @param rsqlParam
|
||||
* rsql query string
|
||||
* @param pageable
|
||||
* the page request to page the result
|
||||
*
|
||||
* @return a paged result of all meta data entries for a given distribution
|
||||
* set id
|
||||
*
|
||||
@@ -300,19 +197,14 @@ public interface DistributionSetManagement {
|
||||
* of distribution set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<DistributionSetMetadata> findDistributionSetMetadataByDistributionSetId(@NotNull Long distributionSetId,
|
||||
@NotNull String rsqlParam, @NotNull Pageable pageable);
|
||||
Page<DistributionSetMetadata> findMetaDataByDistributionSetIdAndRsql(@NotNull Pageable pageable,
|
||||
@NotNull Long setId, @NotNull String rsqlParam);
|
||||
|
||||
/**
|
||||
* finds all {@link DistributionSet}s.
|
||||
*
|
||||
* @param pageReq
|
||||
* @param pageable
|
||||
* the pagination parameter
|
||||
* @param deleted
|
||||
* if TRUE, {@link DistributionSet}s marked as deleted are
|
||||
* returned. If FALSE, on {@link DistributionSet}s with
|
||||
* {@link DistributionSet#isDeleted()} == FALSE are returned.
|
||||
* <code>null</code> if both are to be returned
|
||||
* @param complete
|
||||
* to <code>true</code> for returning only completed distribution
|
||||
* sets or <code>false</code> for only incomplete ones nor
|
||||
@@ -322,47 +214,7 @@ public interface DistributionSetManagement {
|
||||
* @return all found {@link DistributionSet}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<DistributionSet> findDistributionSetsByDeletedAndOrCompleted(@NotNull Pageable pageReq, Boolean deleted,
|
||||
Boolean complete);
|
||||
|
||||
/**
|
||||
* finds all {@link DistributionSet}s.
|
||||
*
|
||||
* @param rsqlParam
|
||||
* rsql query string
|
||||
* @param pageReq
|
||||
* the pagination parameter
|
||||
* @param deleted
|
||||
* if TRUE, {@link DistributionSet}s marked as deleted are
|
||||
* returned. If FALSE, on {@link DistributionSet}s not marked as
|
||||
* deleted are returned. <code>null</code> if both are to be
|
||||
* returned
|
||||
* @return all found {@link DistributionSet}s
|
||||
*
|
||||
* @throws RSQLParameterUnsupportedFieldException
|
||||
* if a field in the RSQL string is used but not provided by the
|
||||
* given {@code fieldNameProvider}
|
||||
* @throws RSQLParameterSyntaxException
|
||||
* if the RSQL syntax is wrong
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<DistributionSet> findDistributionSetsAll(@NotNull String rsqlParam, @NotNull Pageable pageReq,
|
||||
Boolean deleted);
|
||||
|
||||
/**
|
||||
* finds all {@link DistributionSet}s.
|
||||
*
|
||||
* @param pageReq
|
||||
* the pagination parameter
|
||||
* @param deleted
|
||||
* if TRUE, {@link DistributionSet}s marked as deleted are
|
||||
* returned. If FALSE, on {@link DistributionSet}s not marked as
|
||||
* deleted are returned. <code>null</code> if both are to be
|
||||
* returned
|
||||
* @return all found {@link DistributionSet}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<DistributionSet> findDistributionSetsAll(@NotNull Pageable pageReq, Boolean deleted);
|
||||
Page<DistributionSet> findByCompleted(@NotNull Pageable pageable, Boolean complete);
|
||||
|
||||
/**
|
||||
* method retrieves all {@link DistributionSet}s from the repository in the
|
||||
@@ -386,7 +238,7 @@ public interface DistributionSetManagement {
|
||||
* @return {@link DistributionSet}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<DistributionSet> findDistributionSetsAllOrderedByLinkTarget(@NotNull Pageable pageable,
|
||||
Page<DistributionSet> findByFilterAndAssignedInstalledDsOrderedByLinkTarget(@NotNull Pageable pageable,
|
||||
@NotNull DistributionSetFilterBuilder distributionSetFilterBuilder, @NotEmpty String assignedOrInstalled);
|
||||
|
||||
/**
|
||||
@@ -399,7 +251,7 @@ public interface DistributionSetManagement {
|
||||
* @return the page of found {@link DistributionSet}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<DistributionSet> findDistributionSetsByFilters(@NotNull Pageable pageable,
|
||||
Page<DistributionSet> findByDistributionSetFilter(@NotNull Pageable pageable,
|
||||
@NotNull DistributionSetFilter distributionSetFilter);
|
||||
|
||||
/**
|
||||
@@ -421,7 +273,7 @@ public interface DistributionSetManagement {
|
||||
* of distribution set tag with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<DistributionSet> findDistributionSetsByTag(@NotNull final Pageable pageable, @NotNull final Long tagId);
|
||||
Page<DistributionSet> findByTag(@NotNull Pageable pageable, @NotNull Long tagId);
|
||||
|
||||
/**
|
||||
* retrieves {@link DistributionSet}s by filtering on the given parameters.
|
||||
@@ -438,8 +290,7 @@ public interface DistributionSetManagement {
|
||||
* of distribution set tag with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<DistributionSet> findDistributionSetsByTag(@NotNull final Pageable pageable, @NotNull String rsqlParam,
|
||||
@NotNull final Long tagId);
|
||||
Page<DistributionSet> findByRsqlAndTag(@NotNull Pageable pageable, @NotNull String rsqlParam, @NotNull Long tagId);
|
||||
|
||||
/**
|
||||
* finds a single distribution set meta data by its id.
|
||||
@@ -454,7 +305,7 @@ public interface DistributionSetManagement {
|
||||
* is set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Optional<DistributionSetMetadata> findDistributionSetMetadata(@NotNull Long setId, @NotEmpty String key);
|
||||
Optional<DistributionSetMetadata> getMetaDataByDistributionSetId(@NotNull Long setId, @NotEmpty String key);
|
||||
|
||||
/**
|
||||
* Checks if a {@link DistributionSet} is currently in use by a target in
|
||||
@@ -466,7 +317,7 @@ public interface DistributionSetManagement {
|
||||
* @return <code>true</code> if in use
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
boolean isDistributionSetInUse(@NotNull Long setId);
|
||||
boolean isInUse(@NotNull Long setId);
|
||||
|
||||
/**
|
||||
* Toggles {@link DistributionSetTag} assignment to given
|
||||
@@ -474,7 +325,7 @@ public interface DistributionSetManagement {
|
||||
* the list have the {@link Tag} not yet assigned, they will be. If all of
|
||||
* theme have the tag already assigned they will be removed instead.
|
||||
*
|
||||
* @param dsIds
|
||||
* @param setIds
|
||||
* to toggle for
|
||||
* @param tagName
|
||||
* to toggle
|
||||
@@ -485,7 +336,7 @@ public interface DistributionSetManagement {
|
||||
* if given tag does not exist or (at least one) module
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
DistributionSetTagAssignmentResult toggleTagAssignment(@NotEmpty Collection<Long> dsIds, @NotNull String tagName);
|
||||
DistributionSetTagAssignmentResult toggleTagAssignment(@NotEmpty Collection<Long> setIds, @NotNull String tagName);
|
||||
|
||||
/**
|
||||
* Unassigns a {@link SoftwareModule} form an existing
|
||||
@@ -511,7 +362,7 @@ public interface DistributionSetManagement {
|
||||
* Unassign a {@link DistributionSetTag} assignment to given
|
||||
* {@link DistributionSet}.
|
||||
*
|
||||
* @param dsId
|
||||
* @param setId
|
||||
* to unassign for
|
||||
* @param tagId
|
||||
* to unassign
|
||||
@@ -521,34 +372,14 @@ public interface DistributionSetManagement {
|
||||
* if set or tag with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
DistributionSet unAssignTag(@NotNull Long dsId, @NotNull Long tagId);
|
||||
|
||||
/**
|
||||
* Updates existing {@link DistributionSet}.
|
||||
*
|
||||
* @param update
|
||||
* to update
|
||||
*
|
||||
* @return the saved entity.
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* if given set does not exist
|
||||
* @throws EntityReadOnlyException
|
||||
* if user tries to change requiredMigrationStep or type on a DS
|
||||
* that is already assigned to targets
|
||||
* @throws ConstraintViolationException
|
||||
* if fields are not filled as specified. Check
|
||||
* {@link DistributionSetUpdate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
DistributionSet updateDistributionSet(@NotNull DistributionSetUpdate update);
|
||||
DistributionSet unAssignTag(@NotNull Long setId, @NotNull Long tagId);
|
||||
|
||||
/**
|
||||
* updates a distribution set meta data value if corresponding entry exists.
|
||||
*
|
||||
* @param dsId
|
||||
* @param setId
|
||||
* {@link DistributionSet} of the meta data entry to be updated
|
||||
* @param md
|
||||
* @param metadata
|
||||
* meta data entry to be updated
|
||||
* @return the updated meta data entry
|
||||
*
|
||||
@@ -557,16 +388,21 @@ public interface DistributionSetManagement {
|
||||
* updated
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
DistributionSetMetadata updateDistributionSetMetadata(@NotNull Long dsId, @NotNull MetaData md);
|
||||
DistributionSetMetadata updateMetaData(@NotNull Long setId, @NotNull MetaData metadata);
|
||||
|
||||
/**
|
||||
* Retrieves all distribution set without details.
|
||||
* Count all {@link DistributionSet}s in the repository that are not marked
|
||||
* as deleted.
|
||||
*
|
||||
* @param typeId
|
||||
* to look for
|
||||
*
|
||||
* @param ids
|
||||
* the ids to for
|
||||
* @return the found {@link DistributionSet}s
|
||||
* @return number of {@link DistributionSet}s
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* if type with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
List<DistributionSet> findDistributionSetsById(@NotEmpty Collection<Long> ids);
|
||||
long countByTypeId(@NotNull Long typeId);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
||||
import org.eclipse.hawkbit.repository.builder.TagCreate;
|
||||
import org.eclipse.hawkbit.repository.builder.TagUpdate;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
/**
|
||||
* Management service for {@link DistributionSetTag}s.
|
||||
*
|
||||
*/
|
||||
public interface DistributionSetTagManagement extends RepositoryManagement<DistributionSetTag, TagCreate, TagUpdate> {
|
||||
|
||||
/**
|
||||
* Deletes {@link DistributionSetTag} by given
|
||||
* {@link DistributionSetTag#getName()}.
|
||||
*
|
||||
* @param tagName
|
||||
* to be deleted
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* if tag with given name does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
||||
void delete(@NotEmpty String tagName);
|
||||
|
||||
/**
|
||||
* Find {@link DistributionSet} based on given name.
|
||||
*
|
||||
* @param name
|
||||
* to look for.
|
||||
* @return {@link DistributionSet}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Optional<DistributionSetTag> getByName(@NotEmpty String name);
|
||||
|
||||
/**
|
||||
* Finds all {@link TargetTag} assigned to given {@link Target}.
|
||||
*
|
||||
* @param pageable
|
||||
* information for page size, offset and sort order.
|
||||
*
|
||||
* @param setId
|
||||
* of the {@link DistributionSet}
|
||||
* @return page of the found {@link TargetTag}s
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* if {@link DistributionSet} with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<DistributionSetTag> findByDistributionSet(@NotNull Pageable pageable, @NotNull Long setId);
|
||||
|
||||
}
|
||||
@@ -9,10 +9,8 @@
|
||||
package org.eclipse.hawkbit.repository;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.validation.ConstraintViolationException;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
||||
@@ -20,84 +18,18 @@ import org.eclipse.hawkbit.repository.builder.DistributionSetTypeCreate;
|
||||
import org.eclipse.hawkbit.repository.builder.DistributionSetTypeUpdate;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityReadOnlyException;
|
||||
import org.eclipse.hawkbit.repository.exception.RSQLParameterSyntaxException;
|
||||
import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
/**
|
||||
* Management service for {@link DistributionSetType}s.
|
||||
*
|
||||
*/
|
||||
public interface DistributionSetTypeManagement {
|
||||
|
||||
/**
|
||||
* Creates new {@link DistributionSetType}.
|
||||
*
|
||||
* @param create
|
||||
* to create
|
||||
* @return created entity
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* if a provided linked entity does not exists (
|
||||
* {@link DistributionSetType#getMandatoryModuleTypes()} or
|
||||
* {@link DistributionSetType#getOptionalModuleTypes()}
|
||||
* @throws ConstraintViolationException
|
||||
* if fields are not filled as specified. Check
|
||||
* {@link DistributionSetTypeCreate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
||||
DistributionSetType createDistributionSetType(@NotNull DistributionSetTypeCreate create);
|
||||
|
||||
/**
|
||||
* Creates multiple {@link DistributionSetType}s.
|
||||
*
|
||||
* @param creates
|
||||
* to create
|
||||
* @return created entity
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* if a provided linked entity does not exists (
|
||||
* {@link DistributionSetType#getMandatoryModuleTypes()} or
|
||||
* {@link DistributionSetType#getOptionalModuleTypes()}
|
||||
* @throws ConstraintViolationException
|
||||
* if fields are not filled as specified. Check
|
||||
* {@link DistributionSetTypeCreate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
||||
List<DistributionSetType> createDistributionSetTypes(@NotNull Collection<DistributionSetTypeCreate> creates);
|
||||
|
||||
/**
|
||||
* Count all {@link DistributionSet}s in the repository that are not marked
|
||||
* as deleted.
|
||||
*
|
||||
* @param typeId
|
||||
* to look for
|
||||
*
|
||||
* @return number of {@link DistributionSet}s
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* if type with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Long countDistributionSetsByType(@NotNull Long typeId);
|
||||
|
||||
/**
|
||||
* Deletes or mark as delete in case the type is in use.
|
||||
*
|
||||
* @param typeId
|
||||
* to delete
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* if given set does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
||||
void deleteDistributionSetType(@NotNull Long typeId);
|
||||
public interface DistributionSetTypeManagement
|
||||
extends RepositoryManagement<DistributionSetType, DistributionSetTypeCreate, DistributionSetTypeUpdate> {
|
||||
|
||||
/**
|
||||
* @param key
|
||||
@@ -106,7 +38,7 @@ public interface DistributionSetTypeManagement {
|
||||
*/
|
||||
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Optional<DistributionSetType> findDistributionSetTypeByKey(@NotEmpty String key);
|
||||
Optional<DistributionSetType> getByKey(@NotEmpty String key);
|
||||
|
||||
/**
|
||||
* @param name
|
||||
@@ -114,66 +46,7 @@ public interface DistributionSetTypeManagement {
|
||||
* @return {@link DistributionSetType}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Optional<DistributionSetType> findDistributionSetTypeByName(@NotEmpty String name);
|
||||
|
||||
/**
|
||||
* @param pageable
|
||||
* parameter
|
||||
* @return all {@link DistributionSetType}s in the repository.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<DistributionSetType> findDistributionSetTypesAll(@NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
* Generic predicate based query for {@link DistributionSetType}.
|
||||
*
|
||||
* @param rsqlParam
|
||||
* rsql query string
|
||||
* @param pageable
|
||||
* parameter for paging
|
||||
*
|
||||
* @return the found {@link SoftwareModuleType}s
|
||||
*
|
||||
* @throws RSQLParameterUnsupportedFieldException
|
||||
* if a field in the RSQL string is used but not provided by the
|
||||
* given {@code fieldNameProvider}
|
||||
* @throws RSQLParameterSyntaxException
|
||||
* if the RSQL syntax is wrong
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<DistributionSetType> findDistributionSetTypesAll(@NotNull String rsqlParam, @NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* as {@link DistributionSetType#getId()}
|
||||
* @return {@link DistributionSetType}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Optional<DistributionSetType> findDistributionSetTypeById(@NotNull Long id);
|
||||
|
||||
/**
|
||||
* Updates existing {@link DistributionSetType}. Resets assigned
|
||||
* {@link SoftwareModuleType}s as well and sets as provided.
|
||||
*
|
||||
* @param update
|
||||
* to update
|
||||
*
|
||||
* @return updated entity
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* in case the {@link DistributionSetType} does not exists and
|
||||
* cannot be updated
|
||||
*
|
||||
* @throws EntityReadOnlyException
|
||||
* if the {@link DistributionSetType} is already in use by a
|
||||
* {@link DistributionSet} and user tries to change list of
|
||||
* {@link SoftwareModuleType}s
|
||||
* @throws ConstraintViolationException
|
||||
* if fields are not filled as specified. Check
|
||||
* {@link DistributionSetTypeUpdate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
DistributionSetType updateDistributionSetType(@NotNull DistributionSetTypeUpdate update);
|
||||
Optional<DistributionSetType> getByName(@NotEmpty String name);
|
||||
|
||||
/**
|
||||
* Assigns {@link DistributionSetType#getMandatoryModuleTypes()}.
|
||||
@@ -238,10 +111,4 @@ public interface DistributionSetTypeManagement {
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
DistributionSetType unassignSoftwareModuleType(@NotNull Long dsTypeId, @NotNull Long softwareModuleId);
|
||||
|
||||
/**
|
||||
* @return number of {@link DistributionSetType}s in the repository.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Long countDistributionSetTypesAll();
|
||||
|
||||
}
|
||||
|
||||
@@ -21,17 +21,17 @@ import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||
*/
|
||||
public class FilterParams {
|
||||
|
||||
private Collection<TargetUpdateStatus> filterByStatus;
|
||||
private Boolean overdueState;
|
||||
private String filterBySearchText;
|
||||
private Boolean selectTargetWithNoTag;
|
||||
private String[] filterByTagNames;
|
||||
private Long filterByDistributionId;
|
||||
private final Collection<TargetUpdateStatus> filterByStatus;
|
||||
private final Boolean overdueState;
|
||||
private final String filterBySearchText;
|
||||
private final Boolean selectTargetWithNoTag;
|
||||
private final String[] filterByTagNames;
|
||||
private final Long filterByDistributionId;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param filterByDistributionId
|
||||
* @param filterByInstalledOrAssignedDistributionSetId
|
||||
* if set, a filter is added for the given
|
||||
* {@link DistributionSet#getId()}
|
||||
* @param filterByStatus
|
||||
@@ -47,13 +47,13 @@ public class FilterParams {
|
||||
* if tag-filtering is enabled, a filter is added for the given
|
||||
* tag-names
|
||||
*/
|
||||
public FilterParams(Long filterByDistributionId, Collection<TargetUpdateStatus> filterByStatus,
|
||||
Boolean overdueState, String filterBySearchText, Boolean selectTargetWithNoTag,
|
||||
String... filterByTagNames) {
|
||||
public FilterParams(final Collection<TargetUpdateStatus> filterByStatus, final Boolean overdueState,
|
||||
final String filterBySearchText, final Long filterByInstalledOrAssignedDistributionSetId,
|
||||
final Boolean selectTargetWithNoTag, final String... filterByTagNames) {
|
||||
this.filterByStatus = filterByStatus;
|
||||
this.overdueState = overdueState;
|
||||
this.filterBySearchText = filterBySearchText;
|
||||
this.filterByDistributionId = filterByDistributionId;
|
||||
this.filterByDistributionId = filterByInstalledOrAssignedDistributionSetId;
|
||||
this.selectTargetWithNoTag = selectTargetWithNoTag;
|
||||
this.filterByTagNames = filterByTagNames;
|
||||
}
|
||||
@@ -68,16 +68,6 @@ public class FilterParams {
|
||||
return filterByDistributionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets {@link DistributionSet#getId()} to filter the result.
|
||||
*
|
||||
* @param filterByDistributionId
|
||||
* the distribution set id
|
||||
*/
|
||||
public void setFilterByDistributionId(Long filterByDistributionId) {
|
||||
this.filterByDistributionId = filterByDistributionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a collection of target states to filter for. <br>
|
||||
* If set to <code>null</code> this filter is disabled.
|
||||
@@ -88,16 +78,6 @@ public class FilterParams {
|
||||
return filterByStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the collection of target states to filter for.
|
||||
*
|
||||
* @param filterByStatus
|
||||
* collection of target update status
|
||||
*/
|
||||
public void setFilterByStatus(Collection<TargetUpdateStatus> filterByStatus) {
|
||||
this.filterByStatus = filterByStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the flag for overdue filter; if set to <code>true</code>, the
|
||||
* overdue filter is activated. Overdued targets a targets that did not
|
||||
@@ -110,17 +90,6 @@ public class FilterParams {
|
||||
return overdueState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the flag for overdue filter; if set to <code>true</code>, the
|
||||
* overdue filter is activated.
|
||||
*
|
||||
* @param overdueState
|
||||
* if the overdue filter should be activates
|
||||
*/
|
||||
public void setOverdueState(Boolean overdueState) {
|
||||
this.overdueState = overdueState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the search text to filter for. This is used to find targets having
|
||||
* the text anywhere in name or description <br>
|
||||
@@ -132,16 +101,6 @@ public class FilterParams {
|
||||
return filterBySearchText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the search text to filter for.
|
||||
*
|
||||
* @param filterBySearchText
|
||||
* search text
|
||||
*/
|
||||
public void setFilterBySearchText(String filterBySearchText) {
|
||||
this.filterBySearchText = filterBySearchText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the flag indicating if tagging filter is used. <br>
|
||||
* If set to <code>null</code> this filter is disabled.
|
||||
@@ -152,16 +111,6 @@ public class FilterParams {
|
||||
return selectTargetWithNoTag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the flag indicating if tagging filter is used.
|
||||
*
|
||||
* @param selectTargetWithNoTag
|
||||
* should the tagging filter be used?
|
||||
*/
|
||||
public void setSelectTargetWithNoTag(Boolean selectTargetWithNoTag) {
|
||||
this.selectTargetWithNoTag = selectTargetWithNoTag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the tags that are used to filter for. The activation of this filter
|
||||
* is done by {@link #setSelectTargetWithNoTag(Boolean)}.
|
||||
@@ -171,14 +120,4 @@ public class FilterParams {
|
||||
public String[] getFilterByTagNames() {
|
||||
return filterByTagNames;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the tags that are used to filter for.
|
||||
*
|
||||
* @param filterByTagNames
|
||||
* array of tag names
|
||||
*/
|
||||
public void setFilterByTagNames(String[] filterByTagNames) {
|
||||
this.filterByTagNames = filterByTagNames;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.validation.ConstraintViolationException;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityReadOnlyException;
|
||||
import org.eclipse.hawkbit.repository.exception.RSQLParameterSyntaxException;
|
||||
import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException;
|
||||
import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Generic management methods common to (software) repository content.
|
||||
*
|
||||
* @param <T>
|
||||
* type of the {@link BaseEntity}
|
||||
* @param <C>
|
||||
* entity create builder
|
||||
* @param <U>
|
||||
* entity update builder
|
||||
*/
|
||||
public interface RepositoryManagement<T, C, U> {
|
||||
|
||||
/**
|
||||
* Creates multiple {@link BaseEntity}s.
|
||||
*
|
||||
* @param creates
|
||||
* to create
|
||||
* @return created Entity
|
||||
*
|
||||
* @throws ConstraintViolationException
|
||||
* if fields are not filled as specified. Check
|
||||
* {@link BaseEntity} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
||||
List<T> create(@NotNull Collection<C> creates);
|
||||
|
||||
/**
|
||||
* Creates new {@link SoftwareModuleType}.
|
||||
*
|
||||
* @param create
|
||||
* to create
|
||||
* @return created Entity
|
||||
*
|
||||
* @throws ConstraintViolationException
|
||||
* if fields are not filled as specified. Check
|
||||
* {@link BaseEntity} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
||||
T create(@NotNull C create);
|
||||
|
||||
/**
|
||||
* Updates existing {@link BaseEntity}.
|
||||
*
|
||||
* @param update
|
||||
* to update
|
||||
*
|
||||
* @return updated Entity
|
||||
*
|
||||
* @throws EntityReadOnlyException
|
||||
* if the {@link BaseEntity} cannot be updated (e.g. is already
|
||||
* in use)
|
||||
* @throws EntityNotFoundException
|
||||
* in case the {@link BaseEntity} does not exists and cannot be
|
||||
* updated
|
||||
* @throws ConstraintViolationException
|
||||
* if fields are not filled as specified. Check
|
||||
* {@link BaseEntity} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
T update(@NotNull U update);
|
||||
|
||||
/**
|
||||
* @return number of {@link BaseEntity}s in the repository.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
long count();
|
||||
|
||||
/**
|
||||
* Deletes or marks as delete in case the {@link BaseEntity} is in use.
|
||||
*
|
||||
* @param id
|
||||
* to delete
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* BaseEntity with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
||||
void delete(@NotNull Long id);
|
||||
|
||||
/**
|
||||
* Delete {@link BaseEntity}s by their IDs. That is either a soft delete of
|
||||
* the entities have been linked to another entity before or a hard delete
|
||||
* if not.
|
||||
*
|
||||
* @param ids
|
||||
* to be deleted
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* if (at least one) given distribution set does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
||||
void delete(@NotEmpty Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* Retrieves all {@link BaseEntity}s without details.
|
||||
*
|
||||
* @param ids
|
||||
* the ids to for
|
||||
* @return the found {@link BaseEntity}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
List<T> get(@NotEmpty Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* Verifies that {@link BaseEntity} with given ID exists in the repository.
|
||||
*
|
||||
* @param id
|
||||
* of entity to check existence
|
||||
* @return <code>true</code> if entity with given ID exists
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
boolean exists(@NotNull Long id);
|
||||
|
||||
/**
|
||||
* Retrieve {@link BaseEntity}
|
||||
*
|
||||
* @param id
|
||||
* to search for
|
||||
* @return {@link BaseEntity} in the repository with given
|
||||
* {@link BaseEntity#getId()}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Optional<T> get(@NotNull Long id);
|
||||
|
||||
/**
|
||||
* Retrieves {@link Page} of all {@link BaseEntity} of given type.
|
||||
*
|
||||
* @param pageable
|
||||
* paging parameter
|
||||
* @return all {@link BaseEntity}s in the repository.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Slice<T> findAll(@NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
* Retrieves all {@link BaseEntity}s with a given specification.
|
||||
*
|
||||
* @param pageable
|
||||
* pagination parameter
|
||||
* @param rsqlParam
|
||||
* filter definition in RSQL syntax
|
||||
*
|
||||
* @return the found {@link BaseEntity}s
|
||||
*
|
||||
* @throws RSQLParameterUnsupportedFieldException
|
||||
* if a field in the RSQL string is used but not provided by the
|
||||
* given {@code fieldNameProvider}
|
||||
* @throws RSQLParameterSyntaxException
|
||||
* if the RSQL syntax is wrong
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<T> findByRsql(@NotNull Pageable pageable, @NotNull String rsqlParam);
|
||||
}
|
||||
@@ -34,17 +34,18 @@ public interface RolloutGroupManagement {
|
||||
* Retrieves a page of {@link RolloutGroup}s filtered by a given
|
||||
* {@link Rollout} with the detailed status.
|
||||
*
|
||||
* @param rolloutId
|
||||
* the ID of the rollout to filter the {@link RolloutGroup}s
|
||||
* @param pageable
|
||||
* the page request to sort and limit the result
|
||||
* @param rolloutId
|
||||
* the ID of the rollout to filter the {@link RolloutGroup}s
|
||||
*
|
||||
* @return a page of found {@link RolloutGroup}s
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* of rollout with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
|
||||
Page<RolloutGroup> findAllRolloutGroupsWithDetailedStatus(@NotNull Long rolloutId, @NotNull Pageable pageable);
|
||||
Page<RolloutGroup> findByRolloutWithDetailedStatus(@NotNull Pageable pageable, @NotNull Long rolloutId);
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -63,7 +64,7 @@ public interface RolloutGroupManagement {
|
||||
* if rollout group with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ_AND_TARGET_READ)
|
||||
Page<TargetWithActionStatus> findAllTargetsWithActionStatus(@NotNull Pageable pageable,
|
||||
Page<TargetWithActionStatus> findAllTargetsOfRolloutGroupWithActionStatus(@NotNull Pageable pageable,
|
||||
@NotNull Long rolloutGroupId);
|
||||
|
||||
/**
|
||||
@@ -76,19 +77,20 @@ public interface RolloutGroupManagement {
|
||||
*
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
|
||||
Optional<RolloutGroup> findRolloutGroupById(@NotNull Long rolloutGroupId);
|
||||
Optional<RolloutGroup> get(@NotNull Long rolloutGroupId);
|
||||
|
||||
/**
|
||||
* Retrieves a page of {@link RolloutGroup}s filtered by a given
|
||||
* {@link Rollout} and the an rsql filter.
|
||||
*
|
||||
* @param pageable
|
||||
* the page request to sort and limit the result
|
||||
* @param rolloutId
|
||||
* the rollout to filter the {@link RolloutGroup}s
|
||||
* @param rsqlParam
|
||||
* the specification to filter the result set based on attributes
|
||||
* of the {@link RolloutGroup}
|
||||
* @param pageable
|
||||
* the page request to sort and limit the result
|
||||
*
|
||||
* @return a page of found {@link RolloutGroup}s
|
||||
*
|
||||
* @throws RSQLParameterUnsupportedFieldException
|
||||
@@ -98,8 +100,22 @@ public interface RolloutGroupManagement {
|
||||
* if the RSQL syntax is wrong
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
|
||||
Page<RolloutGroup> findRolloutGroupsAll(@NotNull Long rolloutId, @NotNull String rsqlParam,
|
||||
@NotNull Pageable pageable);
|
||||
Page<RolloutGroup> findByRolloutAndRsql(@NotNull Pageable pageable, @NotNull Long rolloutId,
|
||||
@NotNull String rsqlParam);
|
||||
|
||||
/**
|
||||
* Retrieves a page of {@link RolloutGroup}s filtered by a given
|
||||
* {@link Rollout}.
|
||||
*
|
||||
* @param pageable
|
||||
* the page request to sort and limit the result
|
||||
* @param rolloutId
|
||||
* the ID of the rollout to filter the {@link RolloutGroup}s
|
||||
*
|
||||
* @return a page of found {@link RolloutGroup}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
|
||||
Page<RolloutGroup> findByRollout(@NotNull Pageable pageable, @NotNull Long rolloutId);
|
||||
|
||||
/**
|
||||
* Retrieves a page of {@link RolloutGroup}s filtered by a given
|
||||
@@ -112,28 +128,15 @@ public interface RolloutGroupManagement {
|
||||
* @return a page of found {@link RolloutGroup}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
|
||||
Page<RolloutGroup> findRolloutGroupsByRolloutId(@NotNull Long rolloutId, @NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
* Retrieves a page of {@link RolloutGroup}s filtered by a given
|
||||
* {@link Rollout}.
|
||||
*
|
||||
* @param rolloutId
|
||||
* the ID of the rollout to filter the {@link RolloutGroup}s
|
||||
* @param pageable
|
||||
* the page request to sort and limit the result
|
||||
* @return a page of found {@link RolloutGroup}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
|
||||
long countRolloutGroupsByRolloutId(@NotNull Long rolloutId);
|
||||
long countByRollout(@NotNull Long rolloutId);
|
||||
|
||||
/**
|
||||
* Get targets of specified rollout group.
|
||||
*
|
||||
* @param pageable
|
||||
* the page request to sort and limit the result
|
||||
* @param rolloutGroupId
|
||||
* rollout group
|
||||
* @param page
|
||||
* the page request to sort and limit the result
|
||||
*
|
||||
* @return Page<Target> list of targets of a rollout group
|
||||
*
|
||||
@@ -141,17 +144,17 @@ public interface RolloutGroupManagement {
|
||||
* if group with ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ_AND_TARGET_READ)
|
||||
Page<Target> findRolloutGroupTargets(@NotNull Long rolloutGroupId, @NotNull Pageable page);
|
||||
Page<Target> findTargetsOfRolloutGroup(@NotNull Pageable pageable, @NotNull Long rolloutGroupId);
|
||||
|
||||
/**
|
||||
* Get targets of specified rollout group.
|
||||
*
|
||||
* @param pageable
|
||||
* the page request to sort and limit the result
|
||||
* @param rolloutGroupId
|
||||
* rollout group
|
||||
* @param rsqlParam
|
||||
* the specification for filtering the targets of a rollout group
|
||||
* @param pageable
|
||||
* the page request to sort and limit the result
|
||||
*
|
||||
* @return Page<Target> list of targets of a rollout group
|
||||
*
|
||||
@@ -162,8 +165,8 @@ public interface RolloutGroupManagement {
|
||||
* if the RSQL syntax is wrong
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ_AND_TARGET_READ)
|
||||
Page<Target> findRolloutGroupTargets(@NotNull Long rolloutGroupId, @NotNull String rsqlParam,
|
||||
@NotNull Pageable pageable);
|
||||
Page<Target> findTargetsOfRolloutGroupByRsql(@NotNull Pageable pageable, @NotNull Long rolloutGroupId,
|
||||
@NotNull String rsqlParam);
|
||||
|
||||
/**
|
||||
* Get {@link RolloutGroup} by Id.
|
||||
@@ -174,7 +177,7 @@ public interface RolloutGroupManagement {
|
||||
*
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
|
||||
Optional<RolloutGroup> findRolloutGroupWithDetailedStatus(@NotNull Long rolloutGroupId);
|
||||
Optional<RolloutGroup> getWithDetailedStatus(@NotNull Long rolloutGroupId);
|
||||
|
||||
/**
|
||||
* Count targets of rollout group.
|
||||
@@ -187,5 +190,5 @@ public interface RolloutGroupManagement {
|
||||
* if rollout group with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
|
||||
Long countTargetsOfRolloutsGroup(@NotNull Long rolloutGroupId);
|
||||
long countTargetsOfRolloutsGroup(@NotNull Long rolloutGroupId);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public interface RolloutManagement {
|
||||
* For {@link RolloutStatus#READY} that means switching to
|
||||
* {@link RolloutStatus#STARTING} if the {@link Rollout#getStartAt()} is set
|
||||
* and time of calling this method is beyond this point in time. This auto
|
||||
* start mechanism is optional. Call {@link #startRollout(Long)} otherwise.
|
||||
* start mechanism is optional. Call {@link #start(Long)} otherwise.
|
||||
*
|
||||
* For {@link RolloutStatus#STARTING} that means starting the first
|
||||
* {@link RolloutGroup}s in line and when finished switch to
|
||||
@@ -81,7 +81,7 @@ public interface RolloutManagement {
|
||||
* @return number of roll outs
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
|
||||
Long countRolloutsAll();
|
||||
long count();
|
||||
|
||||
/**
|
||||
* Count rollouts by given text in name or description.
|
||||
@@ -91,7 +91,7 @@ public interface RolloutManagement {
|
||||
* @return total count rollouts for specified filter text.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
|
||||
Long countRolloutsAllByFilters(@NotEmpty String searchText);
|
||||
long countByFilters(@NotEmpty String searchText);
|
||||
|
||||
/**
|
||||
* Persists a new rollout entity. The filter within the
|
||||
@@ -107,7 +107,7 @@ public interface RolloutManagement {
|
||||
* The RolloutScheduler will start to assign targets to the groups. Once all
|
||||
* targets have been assigned to the groups, the rollout status is changed
|
||||
* to {@link RolloutStatus#READY} so it can be started with
|
||||
* {@link #startRollout(Rollout)}.
|
||||
* {@link #start(Rollout)}.
|
||||
*
|
||||
* @param create
|
||||
* the rollout entity to create
|
||||
@@ -124,7 +124,7 @@ public interface RolloutManagement {
|
||||
* if rollout or group parameters are invalid.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_WRITE)
|
||||
Rollout createRollout(@NotNull RolloutCreate create, int amountGroup, @NotNull RolloutGroupConditions conditions);
|
||||
Rollout create(@NotNull RolloutCreate create, int amountGroup, @NotNull RolloutGroupConditions conditions);
|
||||
|
||||
/**
|
||||
* Persists a new rollout entity. The filter within the
|
||||
@@ -140,7 +140,7 @@ public interface RolloutManagement {
|
||||
* The RolloutScheduler will start to assign targets to the groups. Once all
|
||||
* targets have been assigned to the groups, the rollout status is changed
|
||||
* to {@link RolloutStatus#READY} so it can be started with
|
||||
* {@link #startRollout(Rollout)}.
|
||||
* {@link #start(Rollout)}.
|
||||
*
|
||||
* @param rollout
|
||||
* the rollout entity to create
|
||||
@@ -158,7 +158,7 @@ public interface RolloutManagement {
|
||||
* if rollout or group parameters are invalid
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_WRITE)
|
||||
Rollout createRollout(@NotNull RolloutCreate rollout, @NotNull List<RolloutGroupCreate> groups,
|
||||
Rollout create(@NotNull RolloutCreate rollout, @NotNull List<RolloutGroupCreate> groups,
|
||||
RolloutGroupConditions conditions);
|
||||
|
||||
/**
|
||||
@@ -205,17 +205,18 @@ public interface RolloutManagement {
|
||||
* statuses
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
|
||||
Page<Rollout> findAllRolloutsWithDetailedStatus(@NotNull Pageable pageable, boolean deleted);
|
||||
Page<Rollout> findAllWithDetailedStatus(@NotNull Pageable pageable, boolean deleted);
|
||||
|
||||
/**
|
||||
* Retrieves all rollouts found by the given specification.
|
||||
*
|
||||
* @param rsqlParam
|
||||
* the specification to filter rollouts
|
||||
*
|
||||
* @param pageable
|
||||
* the page request to sort and limit the result
|
||||
* @param rsqlParam
|
||||
* the specification to filter rollouts
|
||||
* @param deleted
|
||||
* flag if deleted rollouts should be included
|
||||
*
|
||||
* @return a page of found rollouts
|
||||
*
|
||||
* @throws RSQLParameterUnsupportedFieldException
|
||||
@@ -225,7 +226,7 @@ public interface RolloutManagement {
|
||||
* if the RSQL syntax is wrong
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
|
||||
Page<Rollout> findAllByPredicate(@NotNull String rsqlParam, @NotNull Pageable pageable, boolean deleted);
|
||||
Page<Rollout> findByRsql(@NotNull Pageable pageable, @NotNull String rsqlParam, boolean deleted);
|
||||
|
||||
/**
|
||||
* Finds rollouts by given text in name or description.
|
||||
@@ -240,7 +241,7 @@ public interface RolloutManagement {
|
||||
* not exists
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
|
||||
Slice<Rollout> findRolloutWithDetailedStatusByFilters(@NotNull Pageable pageable, @NotEmpty String searchText,
|
||||
Slice<Rollout> findByFiltersWithDetailedStatus(@NotNull Pageable pageable, @NotEmpty String searchText,
|
||||
boolean deleted);
|
||||
|
||||
/**
|
||||
@@ -252,7 +253,7 @@ public interface RolloutManagement {
|
||||
* not exists
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
|
||||
Optional<Rollout> findRolloutById(@NotNull Long rolloutId);
|
||||
Optional<Rollout> get(@NotNull Long rolloutId);
|
||||
|
||||
/**
|
||||
* Retrieves a specific rollout by its name.
|
||||
@@ -263,7 +264,7 @@ public interface RolloutManagement {
|
||||
* does not exists
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
|
||||
Optional<Rollout> findRolloutByName(@NotEmpty String rolloutName);
|
||||
Optional<Rollout> getByName(@NotEmpty String rolloutName);
|
||||
|
||||
/**
|
||||
* Get count of targets in different status in rollout.
|
||||
@@ -277,7 +278,7 @@ public interface RolloutManagement {
|
||||
*
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
|
||||
Optional<Rollout> findRolloutWithDetailedStatus(@NotNull Long rolloutId);
|
||||
Optional<Rollout> getWithDetailedStatus(@NotNull Long rolloutId);
|
||||
|
||||
/**
|
||||
* Checks if rollout with given ID exists.
|
||||
@@ -350,7 +351,7 @@ public interface RolloutManagement {
|
||||
* ready rollouts can be started.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_WRITE)
|
||||
Rollout startRollout(@NotNull Long rolloutId);
|
||||
Rollout start(@NotNull Long rolloutId);
|
||||
|
||||
/**
|
||||
* Update rollout details.
|
||||
@@ -368,7 +369,7 @@ public interface RolloutManagement {
|
||||
*
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_WRITE)
|
||||
Rollout updateRollout(@NotNull RolloutUpdate update);
|
||||
Rollout update(@NotNull RolloutUpdate update);
|
||||
|
||||
/**
|
||||
* Deletes a rollout. A rollout might be deleted asynchronously by
|
||||
@@ -379,6 +380,6 @@ public interface RolloutManagement {
|
||||
* the ID of the rollout to be deleted
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_WRITE)
|
||||
void deleteRollout(long rolloutId);
|
||||
void delete(@NotNull Long rolloutId);
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.validation.ConstraintViolationException;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
||||
@@ -38,7 +37,8 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
* Service for managing {@link SoftwareModule}s.
|
||||
*
|
||||
*/
|
||||
public interface SoftwareModuleManagement {
|
||||
public interface SoftwareModuleManagement
|
||||
extends RepositoryManagement<SoftwareModule, SoftwareModuleCreate, SoftwareModuleUpdate> {
|
||||
|
||||
/**
|
||||
* Counts {@link SoftwareModule}s with given
|
||||
@@ -55,51 +55,7 @@ public interface SoftwareModuleManagement {
|
||||
* if software module type with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Long countSoftwareModuleByFilters(String searchText, Long typeId);
|
||||
|
||||
/**
|
||||
* Count all {@link SoftwareModule}s in the repository that are not marked
|
||||
* as deleted.
|
||||
*
|
||||
* @return number of {@link SoftwareModule}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Long countSoftwareModulesAll();
|
||||
|
||||
/**
|
||||
* Create {@link SoftwareModule}s in the repository.
|
||||
*
|
||||
* @param creates
|
||||
* {@link SoftwareModule}s to create
|
||||
* @return SoftwareModule
|
||||
*
|
||||
* @throws EntityAlreadyExistsException
|
||||
* if a given entity already exists
|
||||
* @throws EntityNotFoundException
|
||||
* of given software module type does not exist
|
||||
* @throws ConstraintViolationException
|
||||
* if fields are not filled as specified. Check
|
||||
* {@link SoftwareModuleCreate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
||||
List<SoftwareModule> createSoftwareModule(@NotNull Collection<SoftwareModuleCreate> creates);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param create
|
||||
* SoftwareModule to create
|
||||
* @return SoftwareModule
|
||||
*
|
||||
* @throws EntityAlreadyExistsException
|
||||
* if a given entity already exists
|
||||
* @throws EntityNotFoundException
|
||||
* of given software module type does not exist
|
||||
* @throws ConstraintViolationException
|
||||
* if fields are not filled as specified. Check
|
||||
* {@link SoftwareModuleCreate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
||||
SoftwareModule createSoftwareModule(@NotNull SoftwareModuleCreate create);
|
||||
long countByTextAndType(String searchText, Long typeId);
|
||||
|
||||
/**
|
||||
* creates a list of software module meta data entries.
|
||||
@@ -116,8 +72,7 @@ public interface SoftwareModuleManagement {
|
||||
* if software module with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
List<SoftwareModuleMetadata> createSoftwareModuleMetadata(@NotNull Long moduleId,
|
||||
@NotNull Collection<MetaData> metadata);
|
||||
List<SoftwareModuleMetadata> createMetaData(@NotNull Long moduleId, @NotNull Collection<MetaData> metadata);
|
||||
|
||||
/**
|
||||
* creates or updates a single software module meta data entry.
|
||||
@@ -134,16 +89,7 @@ public interface SoftwareModuleManagement {
|
||||
* if software module with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
SoftwareModuleMetadata createSoftwareModuleMetadata(@NotNull Long moduleId, @NotNull MetaData metadata);
|
||||
|
||||
/**
|
||||
* Deletes the given {@link SoftwareModule} Entity.
|
||||
*
|
||||
* @param moduleId
|
||||
* is the {@link SoftwareModule} to be deleted
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
||||
void deleteSoftwareModule(@NotNull Long moduleId);
|
||||
SoftwareModuleMetadata createMetaData(@NotNull Long moduleId, @NotNull MetaData metadata);
|
||||
|
||||
/**
|
||||
* deletes a software module meta data entry.
|
||||
@@ -157,19 +103,7 @@ public interface SoftwareModuleManagement {
|
||||
* of module or metadata entry does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
void deleteSoftwareModuleMetadata(@NotNull Long moduleId, @NotEmpty String key);
|
||||
|
||||
/**
|
||||
* Deletes {@link SoftwareModule}s which is any if the given ids.
|
||||
*
|
||||
* @param moduleIds
|
||||
* of the Software Modules to be deleted
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* if (at least one) module with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
||||
void deleteSoftwareModules(@NotNull Collection<Long> moduleIds);
|
||||
void deleteMetaData(@NotNull Long moduleId, @NotEmpty String key);
|
||||
|
||||
/**
|
||||
* @param pageable
|
||||
@@ -183,7 +117,7 @@ public interface SoftwareModuleManagement {
|
||||
* if distribution set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<SoftwareModule> findSoftwareModuleByAssignedTo(@NotNull Pageable pageable, @NotNull Long setId);
|
||||
Page<SoftwareModule> findByAssignedTo(@NotNull Pageable pageable, @NotNull Long setId);
|
||||
|
||||
/**
|
||||
* Filter {@link SoftwareModule}s with given
|
||||
@@ -202,30 +136,7 @@ public interface SoftwareModuleManagement {
|
||||
* if given software module type does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Slice<SoftwareModule> findSoftwareModuleByFilters(@NotNull Pageable pageable, String searchText, Long typeId);
|
||||
|
||||
/**
|
||||
* Finds {@link SoftwareModuleType} by given id.
|
||||
*
|
||||
* @param ids
|
||||
* to search for
|
||||
* @return the found {@link SoftwareModuleType}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.IS_CONTROLLER)
|
||||
List<SoftwareModuleType> findSoftwareModuleTypesById(@NotEmpty Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* Finds {@link SoftwareModule} by given id.
|
||||
*
|
||||
* @param id
|
||||
* to search for
|
||||
* @return the found {@link SoftwareModule}s
|
||||
*
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.IS_CONTROLLER)
|
||||
Optional<SoftwareModule> findSoftwareModuleById(@NotNull Long id);
|
||||
Slice<SoftwareModule> findByTextAndType(@NotNull Pageable pageable, String searchText, Long typeId);
|
||||
|
||||
/**
|
||||
* retrieves {@link SoftwareModule} by their name AND version AND type..
|
||||
@@ -242,7 +153,7 @@ public interface SoftwareModuleManagement {
|
||||
* if software module type with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Optional<SoftwareModule> findSoftwareModuleByNameAndVersion(@NotEmpty String name, @NotEmpty String version,
|
||||
Optional<SoftwareModule> getByNameAndVersionAndType(@NotEmpty String name, @NotEmpty String version,
|
||||
@NotNull Long typeId);
|
||||
|
||||
/**
|
||||
@@ -258,15 +169,16 @@ public interface SoftwareModuleManagement {
|
||||
* is module with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Optional<SoftwareModuleMetadata> findSoftwareModuleMetadata(@NotNull Long moduleId, @NotEmpty String key);
|
||||
Optional<SoftwareModuleMetadata> getMetaDataBySoftwareModuleId(@NotNull Long moduleId, @NotEmpty String key);
|
||||
|
||||
/**
|
||||
* finds all meta data by the given software module id.
|
||||
*
|
||||
* @param swId
|
||||
* the software module id to retrieve the meta data from
|
||||
*
|
||||
* @param pageable
|
||||
* the page request to page the result
|
||||
* @param moduleId
|
||||
* the software module id to retrieve the meta data from
|
||||
*
|
||||
* @return a paged result of all meta data entries for a given software
|
||||
* module id
|
||||
*
|
||||
@@ -274,18 +186,18 @@ public interface SoftwareModuleManagement {
|
||||
* if software module with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<SoftwareModuleMetadata> findSoftwareModuleMetadataBySoftwareModuleId(@NotNull Long swId,
|
||||
@NotNull Pageable pageable);
|
||||
Page<SoftwareModuleMetadata> findMetaDataBySoftwareModuleId(@NotNull Pageable pageable, @NotNull Long moduleId);
|
||||
|
||||
/**
|
||||
* finds all meta data by the given software module id.
|
||||
*
|
||||
*
|
||||
* @param pageable
|
||||
* the page request to page the result
|
||||
* @param moduleId
|
||||
* the software module id to retrieve the meta data from
|
||||
* @param rsqlParam
|
||||
* filter definition in RSQL syntax
|
||||
* @param pageable
|
||||
* the page request to page the result
|
||||
*
|
||||
* @return a paged result of all meta data entries for a given software
|
||||
* module id
|
||||
*
|
||||
@@ -298,25 +210,8 @@ public interface SoftwareModuleManagement {
|
||||
* if software module with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<SoftwareModuleMetadata> findSoftwareModuleMetadataBySoftwareModuleId(@NotNull Long moduleId,
|
||||
@NotNull String rsqlParam, @NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
* Finds all meta data by the given software module id.
|
||||
*
|
||||
* @param pageable
|
||||
* pagination parameter
|
||||
*
|
||||
* @param moduleId
|
||||
* the software module id to retrieve the meta data from
|
||||
* @return page with found software module metadata
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* of software module with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<SoftwareModuleMetadata> findSoftwareModuleMetadataBySoftwareModuleId(@NotNull Pageable pageable,
|
||||
@NotNull Long moduleId);
|
||||
Page<SoftwareModuleMetadata> findMetaDataByRsql(@NotNull Pageable pageable, @NotNull Long moduleId,
|
||||
@NotNull String rsqlParam);
|
||||
|
||||
/**
|
||||
* Filter {@link SoftwareModule}s with given
|
||||
@@ -342,48 +237,9 @@ public interface SoftwareModuleManagement {
|
||||
* if given software module type does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Slice<AssignedSoftwareModule> findSoftwareModuleOrderBySetAssignmentAndModuleNameAscModuleVersionAsc(
|
||||
Slice<AssignedSoftwareModule> findAllOrderBySetAssignmentAndModuleNameAscModuleVersionAsc(
|
||||
@NotNull Pageable pageable, @NotNull Long orderByDistributionId, String searchText, Long typeId);
|
||||
|
||||
/**
|
||||
* Retrieves all software modules. Deleted ones are filtered.
|
||||
*
|
||||
* @param pageable
|
||||
* pagination parameter
|
||||
* @return the found {@link SoftwareModule}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Slice<SoftwareModule> findSoftwareModulesAll(@NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
* Retrieves all software modules with a given list of ids
|
||||
* {@link SoftwareModule#getId()}.
|
||||
*
|
||||
* @param ids
|
||||
* to search for
|
||||
* @return {@link List} of found {@link SoftwareModule}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
List<SoftwareModule> findSoftwareModulesById(@NotEmpty Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* Retrieves all {@link SoftwareModule}s with a given specification.
|
||||
*
|
||||
* @param rsqlParam
|
||||
* filter definition in RSQL syntax
|
||||
* @param pageable
|
||||
* pagination parameter
|
||||
* @return the found {@link SoftwareModule}s
|
||||
*
|
||||
* @throws RSQLParameterUnsupportedFieldException
|
||||
* if a field in the RSQL string is used but not provided by the
|
||||
* given {@code fieldNameProvider}
|
||||
* @throws RSQLParameterSyntaxException
|
||||
* if the RSQL syntax is wrong
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<SoftwareModule> findSoftwareModulesByPredicate(@NotNull String rsqlParam, @NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
* retrieves the {@link SoftwareModule}s by their {@link SoftwareModuleType}
|
||||
* .
|
||||
@@ -398,29 +254,7 @@ public interface SoftwareModuleManagement {
|
||||
* if software module type with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Slice<SoftwareModule> findSoftwareModulesByType(@NotNull Pageable pageable, @NotNull Long typeId);
|
||||
|
||||
/**
|
||||
* Updates existing {@link SoftwareModule}. Update-able values are
|
||||
* {@link SoftwareModule#getDescription()}
|
||||
* {@link SoftwareModule#getVendor()}.
|
||||
*
|
||||
* @param update
|
||||
* contains properties to update
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* if given module does not exist
|
||||
*
|
||||
* @return the saved Entity.
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* if given {@link SoftwareModule} does not exist
|
||||
* @throws ConstraintViolationException
|
||||
* if fields are not filled as specified. Check
|
||||
* {@link SoftwareModuleUpdate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
SoftwareModule updateSoftwareModule(@NotNull SoftwareModuleUpdate update);
|
||||
Slice<SoftwareModule> findByType(@NotNull Pageable pageable, @NotNull Long typeId);
|
||||
|
||||
/**
|
||||
* updates a distribution set meta data value if corresponding entry exists.
|
||||
@@ -437,5 +271,5 @@ public interface SoftwareModuleManagement {
|
||||
* updated
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
SoftwareModuleMetadata updateSoftwareModuleMetadata(@NotNull Long moduleId, @NotNull MetaData metadata);
|
||||
SoftwareModuleMetadata updateMetaData(@NotNull Long moduleId, @NotNull MetaData metadata);
|
||||
}
|
||||
|
||||
@@ -8,86 +8,21 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.validation.ConstraintViolationException;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
||||
import org.eclipse.hawkbit.repository.builder.SoftwareModuleTypeCreate;
|
||||
import org.eclipse.hawkbit.repository.builder.SoftwareModuleTypeUpdate;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||
import org.eclipse.hawkbit.repository.exception.RSQLParameterSyntaxException;
|
||||
import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
/**
|
||||
* Service for managing {@link SoftwareModuleType}s.
|
||||
*
|
||||
*/
|
||||
public interface SoftwareModuleTypeManagement {
|
||||
|
||||
/**
|
||||
* @return number of {@link SoftwareModuleType}s in the repository.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Long countSoftwareModuleTypesAll();
|
||||
|
||||
/**
|
||||
* Creates multiple {@link SoftwareModuleType}s.
|
||||
*
|
||||
* @param creates
|
||||
* to create
|
||||
* @return created Entity
|
||||
*
|
||||
* @throws ConstraintViolationException
|
||||
* if fields are not filled as specified. Check
|
||||
* {@link SoftwareModuleTypeCreate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
||||
List<SoftwareModuleType> createSoftwareModuleType(@NotNull Collection<SoftwareModuleTypeCreate> creates);
|
||||
|
||||
/**
|
||||
* Creates new {@link SoftwareModuleType}.
|
||||
*
|
||||
* @param create
|
||||
* to create
|
||||
* @return created Entity
|
||||
*
|
||||
* @throws ConstraintViolationException
|
||||
* if fields are not filled as specified. Check
|
||||
* {@link SoftwareModuleTypeCreate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
||||
SoftwareModuleType createSoftwareModuleType(@NotNull SoftwareModuleTypeCreate create);
|
||||
|
||||
/**
|
||||
* Deletes or marks as delete in case the type is in use.
|
||||
*
|
||||
* @param typeId
|
||||
* to delete
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* not found is type with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
||||
void deleteSoftwareModuleType(@NotNull Long typeId);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
* to search for
|
||||
* @return {@link SoftwareModuleType} in the repository with given
|
||||
* {@link SoftwareModuleType#getId()}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Optional<SoftwareModuleType> findSoftwareModuleTypeById(@NotNull Long id);
|
||||
public interface SoftwareModuleTypeManagement
|
||||
extends RepositoryManagement<SoftwareModuleType, SoftwareModuleTypeCreate, SoftwareModuleTypeUpdate> {
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -97,7 +32,7 @@ public interface SoftwareModuleTypeManagement {
|
||||
* {@link SoftwareModuleType#getKey()}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Optional<SoftwareModuleType> findSoftwareModuleTypeByKey(@NotEmpty String key);
|
||||
Optional<SoftwareModuleType> getByKey(@NotEmpty String key);
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -107,50 +42,5 @@ public interface SoftwareModuleTypeManagement {
|
||||
* {@link SoftwareModuleType#getName()}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Optional<SoftwareModuleType> findSoftwareModuleTypeByName(@NotEmpty String name);
|
||||
|
||||
/**
|
||||
* @param pageable
|
||||
* parameter
|
||||
* @return all {@link SoftwareModuleType}s in the repository.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<SoftwareModuleType> findSoftwareModuleTypesAll(@NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
* Retrieves all {@link SoftwareModuleType}s with a given specification.
|
||||
*
|
||||
* @param rsqlParam
|
||||
* filter definition in RSQL syntax
|
||||
* @param pageable
|
||||
* pagination parameter
|
||||
* @return the found {@link SoftwareModuleType}s
|
||||
*
|
||||
* @throws RSQLParameterUnsupportedFieldException
|
||||
* if a field in the RSQL string is used but not provided by the
|
||||
* given {@code fieldNameProvider}
|
||||
* @throws RSQLParameterSyntaxException
|
||||
* if the RSQL syntax is wrong
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<SoftwareModuleType> findSoftwareModuleTypesAll(@NotNull String rsqlParam, @NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
* Updates existing {@link SoftwareModuleType}.
|
||||
*
|
||||
* @param update
|
||||
* to update
|
||||
*
|
||||
* @return updated Entity
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* in case the {@link SoftwareModuleType} does not exists and
|
||||
* cannot be updated
|
||||
* @throws ConstraintViolationException
|
||||
* if fields are not filled as specified. Check
|
||||
* {@link SoftwareModuleTypeUpdate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
SoftwareModuleType updateSoftwareModuleType(@NotNull SoftwareModuleTypeUpdate update);
|
||||
|
||||
Optional<SoftwareModuleType> getByName(@NotEmpty String name);
|
||||
}
|
||||
|
||||
@@ -1,303 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.validation.ConstraintViolationException;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
||||
import org.eclipse.hawkbit.repository.builder.TagCreate;
|
||||
import org.eclipse.hawkbit.repository.builder.TagUpdate;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||
import org.eclipse.hawkbit.repository.exception.RSQLParameterSyntaxException;
|
||||
import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||
import org.eclipse.hawkbit.repository.model.Tag;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
/**
|
||||
* Management service for {@link Tag}s.
|
||||
*
|
||||
*/
|
||||
public interface TagManagement {
|
||||
|
||||
/**
|
||||
* count {@link TargetTag}s.
|
||||
*
|
||||
* @return size of {@link TargetTag}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
long countTargetTags();
|
||||
|
||||
/**
|
||||
* Creates a {@link DistributionSet}.
|
||||
*
|
||||
* @param create
|
||||
* to be created.
|
||||
* @return the new {@link DistributionSet}
|
||||
*
|
||||
* @throws EntityAlreadyExistsException
|
||||
* if distributionSetTag already exists
|
||||
* @throws ConstraintViolationException
|
||||
* if fields are not filled as specified. Check
|
||||
* {@link TagCreate} for field constraints.
|
||||
*
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
||||
DistributionSetTag createDistributionSetTag(@NotNull TagCreate create);
|
||||
|
||||
/**
|
||||
* Creates multiple {@link DistributionSetTag}s.
|
||||
*
|
||||
* @param creates
|
||||
* to be created
|
||||
* @return the new {@link DistributionSetTag}
|
||||
*
|
||||
* @throws EntityAlreadyExistsException
|
||||
* if a given entity already exists
|
||||
* @throws ConstraintViolationException
|
||||
* if fields are not filled as specified. Check
|
||||
* {@link TagCreate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
||||
List<DistributionSetTag> createDistributionSetTags(@NotNull Collection<TagCreate> creates);
|
||||
|
||||
/**
|
||||
* Creates a new {@link TargetTag}.
|
||||
*
|
||||
* @param create
|
||||
* to be created
|
||||
*
|
||||
* @return the new created {@link TargetTag}
|
||||
*
|
||||
* @throws EntityAlreadyExistsException
|
||||
* if given object already exists
|
||||
* @throws ConstraintViolationException
|
||||
* if fields are not filled as specified. Check
|
||||
* {@link TagCreate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
|
||||
TargetTag createTargetTag(@NotNull TagCreate create);
|
||||
|
||||
/**
|
||||
* created multiple {@link TargetTag}s.
|
||||
*
|
||||
* @param creates
|
||||
* to be created
|
||||
* @return the new created {@link TargetTag}s
|
||||
*
|
||||
* @throws EntityAlreadyExistsException
|
||||
* if given object has already an ID.
|
||||
* @throws ConstraintViolationException
|
||||
* if fields are not filled as specified. Check
|
||||
* {@link TagCreate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
|
||||
List<TargetTag> createTargetTags(@NotNull Collection<TagCreate> creates);
|
||||
|
||||
/**
|
||||
* Deletes {@link DistributionSetTag} by given
|
||||
* {@link DistributionSetTag#getName()}.
|
||||
*
|
||||
* @param tagName
|
||||
* to be deleted
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* if tag with given name does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
||||
void deleteDistributionSetTag(@NotEmpty String tagName);
|
||||
|
||||
/**
|
||||
* Deletes {@link TargetTag} with given name.
|
||||
*
|
||||
* @param targetTagName
|
||||
* tag name of the {@link TargetTag} to be deleted
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* if tag with given name does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_TARGET)
|
||||
void deleteTargetTag(@NotEmpty String targetTagName);
|
||||
|
||||
/**
|
||||
* returns all {@link DistributionSetTag}s.
|
||||
*
|
||||
* @param pageReq
|
||||
* page parameter
|
||||
* @return all {@link DistributionSetTag}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<DistributionSetTag> findAllDistributionSetTags(@NotNull Pageable pageReq);
|
||||
|
||||
/**
|
||||
* Retrieves all DistributionSet tags based on the given specification.
|
||||
*
|
||||
* @param rsqlParam
|
||||
* rsql query string
|
||||
* @param pageable
|
||||
* pagination parameter
|
||||
* @return the found {@link DistributionSetTag}s, never {@code null}
|
||||
*
|
||||
* @throws RSQLParameterUnsupportedFieldException
|
||||
* if a field in the RSQL string is used but not provided by the
|
||||
* given {@code fieldNameProvider}
|
||||
* @throws RSQLParameterSyntaxException
|
||||
* if the RSQL syntax is wrong
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<DistributionSetTag> findAllDistributionSetTags(@NotNull String rsqlParam, @NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
* returns all {@link TargetTag}s.
|
||||
*
|
||||
* @param pageable
|
||||
* page parameter
|
||||
*
|
||||
* @return all {@link TargetTag}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<TargetTag> findAllTargetTags(@NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
* Returns all {@link TargetTag}s assigned to {@link Target} with given ID.
|
||||
*
|
||||
* @param pageable
|
||||
* page parameter
|
||||
* @param controllerId
|
||||
*
|
||||
* @return {@link TargetTag}s assigned to {@link Target} with given ID
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* if target with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<TargetTag> findAllTargetTags(@NotNull Pageable pageable, @NotEmpty String controllerId);
|
||||
|
||||
/**
|
||||
* Retrieves all target tags based on the given specification.
|
||||
*
|
||||
* @param rsqlParam
|
||||
* rsql query string
|
||||
* @param pageable
|
||||
* pagination parameter
|
||||
* @return the found {@link Target}s, never {@code null}
|
||||
*
|
||||
* @throws RSQLParameterUnsupportedFieldException
|
||||
* if a field in the RSQL string is used but not provided by the
|
||||
* given {@code fieldNameProvider}
|
||||
* @throws RSQLParameterSyntaxException
|
||||
* if the RSQL syntax is wrong
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<TargetTag> findAllTargetTags(@NotNull String rsqlParam, @NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
* Find {@link DistributionSet} based on given name.
|
||||
*
|
||||
* @param name
|
||||
* to look for.
|
||||
* @return {@link DistributionSet}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Optional<DistributionSetTag> findDistributionSetTag(@NotEmpty String name);
|
||||
|
||||
/**
|
||||
* Finds {@link DistributionSetTag} by given id.
|
||||
*
|
||||
* @param id
|
||||
* to search for
|
||||
* @return the found {@link DistributionSetTag}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Optional<DistributionSetTag> findDistributionSetTagById(@NotNull Long id);
|
||||
|
||||
/**
|
||||
* Find {@link TargetTag} based on given Name.
|
||||
*
|
||||
* @param name
|
||||
* to look for.
|
||||
* @return {@link TargetTag}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Optional<TargetTag> findTargetTag(@NotEmpty String name);
|
||||
|
||||
/**
|
||||
* Finds {@link TargetTag} by given id.
|
||||
*
|
||||
* @param id
|
||||
* to search for
|
||||
* @return the found {@link TargetTag}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Optional<TargetTag> findTargetTagById(@NotNull Long id);
|
||||
|
||||
/**
|
||||
* Finds all {@link TargetTag} assigned to given {@link Target}.
|
||||
*
|
||||
* @param pageable
|
||||
* information for page size, offset and sort order.
|
||||
*
|
||||
* @param setId
|
||||
* of the {@link DistributionSet}
|
||||
* @return page of the found {@link TargetTag}s
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* if {@link DistributionSet} with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<DistributionSetTag> findDistributionSetTagsByDistributionSet(@NotNull Pageable pageable, @NotNull Long setId);
|
||||
|
||||
/**
|
||||
* Updates an existing {@link DistributionSetTag}.
|
||||
*
|
||||
* @param update
|
||||
* to be updated
|
||||
*
|
||||
* @return the updated {@link DistributionSet}
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* in case the {@link DistributionSetTag} does not exists and
|
||||
* cannot be updated
|
||||
* @throws ConstraintViolationException
|
||||
* if fields are not filled as specified. Check
|
||||
* {@link TagUpdate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
DistributionSetTag updateDistributionSetTag(@NotNull TagUpdate update);
|
||||
|
||||
/**
|
||||
* updates the {@link TargetTag}.
|
||||
*
|
||||
* @param update
|
||||
* the {@link TargetTag} with updated values
|
||||
* @return the updated {@link TargetTag}
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* in case the {@link TargetTag} does not exists and cannot be
|
||||
* updated
|
||||
* @throws ConstraintViolationException
|
||||
* if fields are not filled as specified. Check
|
||||
* {@link TagUpdate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
||||
TargetTag updateTargetTag(@NotNull TagUpdate update);
|
||||
|
||||
}
|
||||
@@ -41,7 +41,7 @@ public interface TargetFilterQueryManagement {
|
||||
* {@link TargetFilterQueryCreate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
|
||||
TargetFilterQuery createTargetFilterQuery(@NotNull TargetFilterQueryCreate create);
|
||||
TargetFilterQuery create(@NotNull TargetFilterQueryCreate create);
|
||||
|
||||
/**
|
||||
* Delete target filter query.
|
||||
@@ -53,7 +53,7 @@ public interface TargetFilterQueryManagement {
|
||||
* if filter with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_TARGET)
|
||||
void deleteTargetFilterQuery(@NotNull Long targetFilterQueryId);
|
||||
void delete(@NotNull Long targetFilterQueryId);
|
||||
|
||||
/**
|
||||
* Verifies provided filter syntax.
|
||||
@@ -81,7 +81,7 @@ public interface TargetFilterQueryManagement {
|
||||
* @return the found {@link TargetFilterQuery}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<TargetFilterQuery> findAllTargetFilterQuery(@NotNull Pageable pageable);
|
||||
Page<TargetFilterQuery> findAll(@NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
* Counts all target filter queries
|
||||
@@ -89,7 +89,7 @@ public interface TargetFilterQueryManagement {
|
||||
* @return the number of all target filter queries
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Long countAllTargetFilterQuery();
|
||||
long count();
|
||||
|
||||
/**
|
||||
* Retrieves all target filter query which {@link TargetFilterQuery}.
|
||||
@@ -102,7 +102,7 @@ public interface TargetFilterQueryManagement {
|
||||
* @return the page with the found {@link TargetFilterQuery}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<TargetFilterQuery> findTargetFilterQueryByName(@NotNull Pageable pageable, @NotNull String name);
|
||||
Page<TargetFilterQuery> findByName(@NotNull Pageable pageable, @NotNull String name);
|
||||
|
||||
/**
|
||||
* Retrieves all target filter query which {@link TargetFilterQuery}.
|
||||
@@ -115,7 +115,7 @@ public interface TargetFilterQueryManagement {
|
||||
* @return the page with the found {@link TargetFilterQuery}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<TargetFilterQuery> findTargetFilterQueryByFilter(@NotNull Pageable pageable, @NotNull String rsqlFilter);
|
||||
Page<TargetFilterQuery> findByRsql(@NotNull Pageable pageable, @NotNull String rsqlFilter);
|
||||
|
||||
/**
|
||||
* Retrieves all target filter query which have exactly the provided query.
|
||||
@@ -127,7 +127,7 @@ public interface TargetFilterQueryManagement {
|
||||
* @return the page with the found {@link TargetFilterQuery}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<TargetFilterQuery> findTargetFilterQueryByQuery(@NotNull Pageable pageable, @NotNull String query);
|
||||
Page<TargetFilterQuery> findByQuery(@NotNull Pageable pageable, @NotNull String query);
|
||||
|
||||
/**
|
||||
* Retrieves all target filter query which {@link TargetFilterQuery}.
|
||||
@@ -145,7 +145,7 @@ public interface TargetFilterQueryManagement {
|
||||
* if DS with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<TargetFilterQuery> findTargetFilterQueryByAutoAssignDS(@NotNull Pageable pageable, @NotNull Long setId,
|
||||
Page<TargetFilterQuery> findByAutoAssignDSAndRsql(@NotNull Pageable pageable, @NotNull Long setId,
|
||||
String rsqlParam);
|
||||
|
||||
/**
|
||||
@@ -157,7 +157,7 @@ public interface TargetFilterQueryManagement {
|
||||
* @param pageable
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<TargetFilterQuery> findTargetFilterQueryWithAutoAssignDS(@NotNull Pageable pageable);
|
||||
Page<TargetFilterQuery> findWithAutoAssignDS(@NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
* Find target filter query by id.
|
||||
@@ -168,7 +168,7 @@ public interface TargetFilterQueryManagement {
|
||||
*
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Optional<TargetFilterQuery> findTargetFilterQueryById(@NotNull Long targetFilterQueryId);
|
||||
Optional<TargetFilterQuery> get(@NotNull Long targetFilterQueryId);
|
||||
|
||||
/**
|
||||
* Find target filter query by name.
|
||||
@@ -179,7 +179,7 @@ public interface TargetFilterQueryManagement {
|
||||
*
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Optional<TargetFilterQuery> findTargetFilterQueryByName(@NotNull String targetFilterQueryName);
|
||||
Optional<TargetFilterQuery> getByName(@NotNull String targetFilterQueryName);
|
||||
|
||||
/**
|
||||
* updates the {@link TargetFilterQuery}.
|
||||
@@ -197,7 +197,7 @@ public interface TargetFilterQueryManagement {
|
||||
* {@link TargetFilterQueryUpdate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
||||
TargetFilterQuery updateTargetFilterQuery(@NotNull TargetFilterQueryUpdate update);
|
||||
TargetFilterQuery update(@NotNull TargetFilterQueryUpdate update);
|
||||
|
||||
/**
|
||||
* updates the {@link TargetFilterQuery#getAutoAssignDistributionSet()}.
|
||||
@@ -213,6 +213,6 @@ public interface TargetFilterQueryManagement {
|
||||
* provided but not found
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
||||
TargetFilterQuery updateTargetFilterQueryAutoAssignDS(@NotNull Long queryId, Long dsId);
|
||||
TargetFilterQuery updateAutoAssignDS(@NotNull Long queryId, Long dsId);
|
||||
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public interface TargetManagement {
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Long countTargetByAssignedDistributionSet(@NotNull Long distId);
|
||||
long countByAssignedDistributionSet(@NotNull Long distId);
|
||||
|
||||
/**
|
||||
* Count {@link Target}s for all the given filter parameters.
|
||||
@@ -104,7 +104,7 @@ public interface TargetManagement {
|
||||
* if distribution set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Long countTargetByFilters(Collection<TargetUpdateStatus> status, Boolean overdueState, String searchText,
|
||||
long countByFilters(Collection<TargetUpdateStatus> status, Boolean overdueState, String searchText,
|
||||
Long installedOrAssignedDistributionSetId, Boolean selectTargetWithNoTag, String... tagNames);
|
||||
|
||||
/**
|
||||
@@ -120,7 +120,7 @@ public interface TargetManagement {
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Long countTargetByInstalledDistributionSet(@NotNull Long distId);
|
||||
long countByInstalledDistributionSet(@NotNull Long distId);
|
||||
|
||||
/**
|
||||
* Count {@link TargetFilterQuery}s for given target filter query.
|
||||
@@ -130,7 +130,7 @@ public interface TargetManagement {
|
||||
* @return the found number {@link Target}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Long countTargetByTargetFilterQuery(@NotEmpty String rsqlParam);
|
||||
long countByRsql(@NotEmpty String rsqlParam);
|
||||
|
||||
/**
|
||||
* Count {@link TargetFilterQuery}s for given target filter query.
|
||||
@@ -143,7 +143,7 @@ public interface TargetManagement {
|
||||
* if {@link TargetFilterQuery} with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Long countTargetByTargetFilterQuery(@NotNull Long targetFilterQueryId);
|
||||
long countByTargetFilterQuery(@NotNull Long targetFilterQueryId);
|
||||
|
||||
/**
|
||||
* Counts all {@link Target}s in the repository.
|
||||
@@ -151,7 +151,7 @@ public interface TargetManagement {
|
||||
* @return number of targets
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Long countTargetsAll();
|
||||
long count();
|
||||
|
||||
/**
|
||||
* creating a new {@link Target}.
|
||||
@@ -167,9 +167,8 @@ public interface TargetManagement {
|
||||
* {@link TargetCreate} for field constraints.
|
||||
*
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.IS_CONTROLLER)
|
||||
Target createTarget(@NotNull TargetCreate create);
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
|
||||
Target create(@NotNull TargetCreate create);
|
||||
|
||||
/**
|
||||
* creates multiple {@link Target}s. If some of the given {@link Target}s
|
||||
@@ -188,7 +187,7 @@ public interface TargetManagement {
|
||||
* {@link TargetCreate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
|
||||
List<Target> createTargets(@NotNull Collection<TargetCreate> creates);
|
||||
List<Target> create(@NotNull Collection<TargetCreate> creates);
|
||||
|
||||
/**
|
||||
* Deletes all targets with the given IDs.
|
||||
@@ -200,7 +199,7 @@ public interface TargetManagement {
|
||||
* if (at least one) of the given target IDs does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_TARGET)
|
||||
void deleteTargets(@NotEmpty Collection<Long> targetIDs);
|
||||
void delete(@NotEmpty Collection<Long> targetIDs);
|
||||
|
||||
/**
|
||||
* Deletes target with the given IDs.
|
||||
@@ -212,7 +211,7 @@ public interface TargetManagement {
|
||||
* if target with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_TARGET)
|
||||
void deleteTarget(@NotEmpty String controllerID);
|
||||
void deleteByControllerID(@NotEmpty String controllerID);
|
||||
|
||||
/**
|
||||
* Finds all targets for all the given parameter {@link TargetFilterQuery}
|
||||
@@ -231,8 +230,8 @@ public interface TargetManagement {
|
||||
* if distribution set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<Target> findAllTargetsByTargetFilterQueryAndNonDS(@NotNull Pageable pageRequest,
|
||||
@NotNull Long distributionSetId, @NotNull String rsqlParam);
|
||||
Page<Target> findByTargetFilterQueryAndNonDS(@NotNull Pageable pageRequest, @NotNull Long distributionSetId,
|
||||
@NotNull String rsqlParam);
|
||||
|
||||
/**
|
||||
* Counts all targets for all the given parameter {@link TargetFilterQuery}
|
||||
@@ -249,7 +248,7 @@ public interface TargetManagement {
|
||||
* if distribution set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Long countTargetsByTargetFilterQueryAndNonDS(@NotNull Long distributionSetId, @NotNull String rsqlParam);
|
||||
long countByRsqlAndNonDS(@NotNull Long distributionSetId, @NotNull String rsqlParam);
|
||||
|
||||
/**
|
||||
* Finds all targets for all the given parameter {@link TargetFilterQuery}
|
||||
@@ -264,7 +263,7 @@ public interface TargetManagement {
|
||||
* @return a page of the found {@link Target}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<Target> findAllTargetsByTargetFilterQueryAndNotInRolloutGroups(@NotNull Pageable pageRequest,
|
||||
Page<Target> findByTargetFilterQueryAndNotInRolloutGroups(@NotNull Pageable pageRequest,
|
||||
@NotEmpty Collection<Long> groups, @NotNull String rsqlParam);
|
||||
|
||||
/**
|
||||
@@ -278,8 +277,7 @@ public interface TargetManagement {
|
||||
* @return count of the found {@link Target}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Long countAllTargetsByTargetFilterQueryAndNotInRolloutGroups(@NotEmpty Collection<Long> groups,
|
||||
@NotNull String rsqlParam);
|
||||
long countByRsqlAndNotInRolloutGroups(@NotEmpty Collection<Long> groups, @NotNull String rsqlParam);
|
||||
|
||||
/**
|
||||
* Finds all targets of the provided {@link RolloutGroup} that have no
|
||||
@@ -295,37 +293,36 @@ public interface TargetManagement {
|
||||
* if rollout group with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<Target> findAllTargetsInRolloutGroupWithoutAction(@NotNull Pageable pageRequest, @NotNull Long group);
|
||||
Page<Target> findByInRolloutGroupWithoutAction(@NotNull Pageable pageRequest, @NotNull Long group);
|
||||
|
||||
/**
|
||||
* retrieves {@link Target}s by the assigned {@link DistributionSet} without
|
||||
* details, i.e. NO {@link Target#getTags()} and {@link Target#getActions()}
|
||||
* possible.
|
||||
*
|
||||
*
|
||||
* @param distributionSetID
|
||||
* the ID of the {@link DistributionSet}
|
||||
* retrieves {@link Target}s by the assigned {@link DistributionSet}.
|
||||
*
|
||||
* @param pageReq
|
||||
* page parameter
|
||||
* @param distributionSetID
|
||||
* the ID of the {@link DistributionSet}
|
||||
*
|
||||
*
|
||||
* @return the found {@link Target}s
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* if distribution set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_READ_TARGET)
|
||||
Page<Target> findTargetByAssignedDistributionSet(@NotNull Long distributionSetID, @NotNull Pageable pageReq);
|
||||
Page<Target> findByAssignedDistributionSet(@NotNull Pageable pageReq, @NotNull Long distributionSetID);
|
||||
|
||||
/**
|
||||
* Retrieves {@link Target}s by the assigned {@link DistributionSet} without
|
||||
* details, i.e. NO {@link Target#getTags()} and {@link Target#getActions()}
|
||||
* Retrieves {@link Target}s by the assigned {@link DistributionSet}
|
||||
* possible including additional filtering based on the given {@code spec}.
|
||||
*
|
||||
*
|
||||
* @param pageReq
|
||||
* page parameter
|
||||
* @param distributionSetID
|
||||
* the ID of the {@link DistributionSet}
|
||||
* @param rsqlParam
|
||||
* the specification to filter the result set
|
||||
* @param pageReq
|
||||
* page parameter
|
||||
*
|
||||
* @return the found {@link Target}s, never {@code null}
|
||||
* @throws RSQLParameterUnsupportedFieldException
|
||||
* if a field in the RSQL string is used but not provided by the
|
||||
@@ -336,20 +333,18 @@ public interface TargetManagement {
|
||||
* if distribution set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_READ_TARGET)
|
||||
Page<Target> findTargetByAssignedDistributionSet(@NotNull Long distributionSetID, @NotNull String rsqlParam,
|
||||
@NotNull Pageable pageReq);
|
||||
Page<Target> findByAssignedDistributionSetAndRsql(@NotNull Pageable pageReq, @NotNull Long distributionSetID,
|
||||
@NotNull String rsqlParam);
|
||||
|
||||
/**
|
||||
* Find {@link Target}s based a given IDs. The returned target will not
|
||||
* contain details (e.g {@link Target#getTags()} and
|
||||
* {@link Target#getActions()})
|
||||
* Find {@link Target}s based a given IDs.
|
||||
*
|
||||
* @param controllerIDs
|
||||
* to look for.
|
||||
* @return List of found{@link Target}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
List<Target> findTargetsByControllerID(@NotEmpty Collection<String> controllerIDs);
|
||||
List<Target> getByControllerID(@NotEmpty Collection<String> controllerIDs);
|
||||
|
||||
/**
|
||||
* Find a {@link Target} based a given ID.
|
||||
@@ -359,7 +354,7 @@ public interface TargetManagement {
|
||||
* @return {@link Target}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Optional<Target> findTargetByControllerID(@NotEmpty String controllerId);
|
||||
Optional<Target> getByControllerID(@NotEmpty String controllerId);
|
||||
|
||||
/**
|
||||
* Filter {@link Target}s for all the given parameters. If all parameters
|
||||
@@ -367,25 +362,9 @@ public interface TargetManagement {
|
||||
*
|
||||
* @param pageable
|
||||
* page parameters
|
||||
* @param status
|
||||
* find targets having this {@link TargetUpdateStatus}s. Set to
|
||||
* <code>null</code> in case this is not required.
|
||||
* @param overdueState
|
||||
* find targets that are overdue (targets that did not respond
|
||||
* during the configured intervals: poll_itvl + overdue_itvl).
|
||||
* @param searchText
|
||||
* to find targets having the text anywhere in name or
|
||||
* description. Set <code>null</code> in case this is not
|
||||
* required.
|
||||
* @param installedOrAssignedDistributionSetId
|
||||
* to find targets having the {@link DistributionSet} as
|
||||
* installed or assigned. Set to <code>null</code> in case this
|
||||
* is not required.
|
||||
* @param tagNames
|
||||
* to find targets which are having any one in this tag names.
|
||||
* Set <code>null</code> in case this is not required.
|
||||
* @param selectTargetWithNoTag
|
||||
* flag to select targets with no tag assigned
|
||||
* @param filterParams
|
||||
* the filters to apply; only filters are enabled that have
|
||||
* non-null value; filters are AND-gated
|
||||
*
|
||||
* @return the found {@link Target}s
|
||||
*
|
||||
@@ -393,38 +372,35 @@ public interface TargetManagement {
|
||||
* if distribution set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Slice<Target> findTargetByFilters(@NotNull Pageable pageable, Collection<TargetUpdateStatus> status,
|
||||
Boolean overdueState, String searchText, Long installedOrAssignedDistributionSetId,
|
||||
Boolean selectTargetWithNoTag, String... tagNames);
|
||||
Slice<Target> findByFilters(@NotNull Pageable pageable, @NotNull FilterParams filterParams);
|
||||
|
||||
/**
|
||||
* retrieves {@link Target}s by the installed {@link DistributionSet}without
|
||||
* details, i.e. NO {@link Target#getTags()} and {@link Target#getActions()}
|
||||
* possible.
|
||||
*
|
||||
* @param distributionSetID
|
||||
* the ID of the {@link DistributionSet}
|
||||
* retrieves {@link Target}s by the installed {@link DistributionSet}.
|
||||
*
|
||||
* @param pageReq
|
||||
* page parameter
|
||||
* @param distributionSetID
|
||||
* the ID of the {@link DistributionSet}
|
||||
*
|
||||
* @return the found {@link Target}s
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* if distribution set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_READ_TARGET)
|
||||
Page<Target> findTargetByInstalledDistributionSet(@NotNull Long distributionSetID, @NotNull Pageable pageReq);
|
||||
Page<Target> findByInstalledDistributionSet(@NotNull Pageable pageReq, @NotNull Long distributionSetID);
|
||||
|
||||
/**
|
||||
* retrieves {@link Target}s by the installed {@link DistributionSet}without
|
||||
* details, i.e. NO {@link Target#getTags()} and {@link Target#getActions()}
|
||||
* possible including additional filtering based on the given {@code spec}.
|
||||
*
|
||||
* retrieves {@link Target}s by the installed {@link DistributionSet}
|
||||
* including additional filtering based on the given {@code spec}.
|
||||
*
|
||||
* @param pageReq
|
||||
* page parameter
|
||||
* @param distributionSetId
|
||||
* the ID of the {@link DistributionSet}
|
||||
* @param rsqlParam
|
||||
* the specification to filter the result
|
||||
* @param pageReq
|
||||
* page parameter
|
||||
*
|
||||
* @return the found {@link Target}s, never {@code null}
|
||||
*
|
||||
* @throws RSQLParameterUnsupportedFieldException
|
||||
@@ -437,13 +413,12 @@ public interface TargetManagement {
|
||||
* if distribution set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_READ_TARGET)
|
||||
Page<Target> findTargetByInstalledDistributionSet(@NotNull Long distributionSetId, @NotNull String rsqlParam,
|
||||
@NotNull Pageable pageReq);
|
||||
Page<Target> findByInstalledDistributionSetAndRsql(@NotNull Pageable pageReq, @NotNull Long distributionSetId,
|
||||
@NotNull String rsqlParam);
|
||||
|
||||
/**
|
||||
* Retrieves the {@link Target} which have a certain
|
||||
* {@link TargetUpdateStatus} without details, i.e. NO
|
||||
* {@link Target#getTags()} and {@link Target#getActions()} possible.
|
||||
* {@link TargetUpdateStatus}.
|
||||
*
|
||||
* @param pageable
|
||||
* page parameter
|
||||
@@ -452,29 +427,25 @@ public interface TargetManagement {
|
||||
* @return the found {@link Target}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<Target> findTargetByUpdateStatus(@NotNull Pageable pageable, @NotNull TargetUpdateStatus status);
|
||||
Page<Target> findByUpdateStatus(@NotNull Pageable pageable, @NotNull TargetUpdateStatus status);
|
||||
|
||||
/**
|
||||
* Retrieves all targets without details, i.e. NO {@link Target#getTags()}
|
||||
* and {@link Target#getActions()} possible
|
||||
* Retrieves all targets.
|
||||
*
|
||||
* @param pageable
|
||||
* pagination parameter
|
||||
* @return the found {@link Target}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Slice<Target> findTargetsAll(@NotNull Pageable pageable);
|
||||
Slice<Target> findAll(@NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
* Retrieves all targets without details, i.e. NO {@link Target#getTags()}
|
||||
* and {@link Target#getActions()} possible based on
|
||||
* {@link TargetFilterQuery#getQuery()}
|
||||
*
|
||||
* @param rsqlParam
|
||||
* in RSQL notation
|
||||
* Retrieves all targets.
|
||||
*
|
||||
* @param pageable
|
||||
* pagination parameter
|
||||
* @param rsqlParam
|
||||
* in RSQL notation
|
||||
*
|
||||
* @return the found {@link Target}s, never {@code null}
|
||||
*
|
||||
@@ -486,17 +457,15 @@ public interface TargetManagement {
|
||||
* if the RSQL syntax is wrong
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<Target> findTargetsAll(@NotNull String rsqlParam, @NotNull Pageable pageable);
|
||||
Page<Target> findByRsql(@NotNull Pageable pageable, @NotNull String rsqlParam);
|
||||
|
||||
/**
|
||||
* Retrieves all targets without details, i.e. NO {@link Target#getTags()}
|
||||
* and {@link Target#getActions()} possible based on
|
||||
* {@link TargetFilterQuery#getQuery()}
|
||||
*
|
||||
* @param targetFilterQueryId
|
||||
* {@link TargetFilterQuery#getId()}
|
||||
* Retrieves all target based on {@link TargetFilterQuery}.
|
||||
*
|
||||
* @param pageable
|
||||
* pagination parameter
|
||||
* @param targetFilterQueryId
|
||||
* {@link TargetFilterQuery#getId()}
|
||||
*
|
||||
* @return the found {@link Target}s, never {@code null}
|
||||
*
|
||||
@@ -509,7 +478,7 @@ public interface TargetManagement {
|
||||
* if the RSQL syntax is wrong
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Slice<Target> findTargetsByTargetFilterQuery(@NotNull Long targetFilterQueryId, @NotNull Pageable pageable);
|
||||
Slice<Target> findByTargetFilterQuery(@NotNull Pageable pageable, @NotNull Long targetFilterQueryId);
|
||||
|
||||
/**
|
||||
* method retrieves all {@link Target}s from the repo in the following
|
||||
@@ -538,8 +507,8 @@ public interface TargetManagement {
|
||||
* if distribution set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Slice<Target> findTargetsAllOrderByLinkedDistributionSet(@NotNull Pageable pageable,
|
||||
@NotNull Long orderByDistributionId, FilterParams filterParams);
|
||||
Slice<Target> findByFilterOrderByLinkedDistributionSet(@NotNull Pageable pageable,
|
||||
@NotNull Long orderByDistributionId, @NotNull FilterParams filterParams);
|
||||
|
||||
/**
|
||||
* Find targets by tag name.
|
||||
@@ -554,7 +523,7 @@ public interface TargetManagement {
|
||||
* if target tag with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<Target> findTargetsByTag(@NotNull Pageable pageable, @NotNull Long tagId);
|
||||
Page<Target> findByTag(@NotNull Pageable pageable, @NotNull Long tagId);
|
||||
|
||||
/**
|
||||
* Find targets by tag name.
|
||||
@@ -577,7 +546,7 @@ public interface TargetManagement {
|
||||
* if the RSQL syntax is wrong
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<Target> findTargetsByTag(@NotNull Pageable pageable, @NotNull String rsqlParam, @NotNull Long tagId);
|
||||
Page<Target> findByRsqlAndTag(@NotNull Pageable pageable, @NotNull String rsqlParam, @NotNull Long tagId);
|
||||
|
||||
/**
|
||||
* Toggles {@link TargetTag} assignment to given {@link Target}s by means
|
||||
@@ -626,32 +595,28 @@ public interface TargetManagement {
|
||||
* if fields are not filled as specified. Check
|
||||
* {@link TargetUpdate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.IS_CONTROLLER)
|
||||
Target updateTarget(@NotNull TargetUpdate update);
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
||||
Target update(@NotNull TargetUpdate update);
|
||||
|
||||
/**
|
||||
* Find a {@link Target} based a given ID. The returned target will not
|
||||
* contain details (e.g {@link Target#getTags()} and
|
||||
* {@link Target#getActions()})
|
||||
* Find a {@link Target} based a given ID.
|
||||
*
|
||||
* @param id
|
||||
* to look for
|
||||
* @return {@link Target}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Optional<Target> findTargetById(Long id);
|
||||
Optional<Target> get(@NotNull Long id);
|
||||
|
||||
/**
|
||||
* Retrieves all targets without details, i.e. NO {@link Target#getTags()}
|
||||
* and {@link Target#getActions()} possible
|
||||
* Retrieves all targets.
|
||||
*
|
||||
* @param ids
|
||||
* the ids to for
|
||||
* @return the found {@link Target}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
List<Target> findTargetsById(@NotNull Collection<Long> ids);
|
||||
List<Target> get(@NotNull Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* Get controller attributes of given {@link Target}.
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.validation.ConstraintViolationException;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
||||
import org.eclipse.hawkbit.repository.builder.TagCreate;
|
||||
import org.eclipse.hawkbit.repository.builder.TagUpdate;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||
import org.eclipse.hawkbit.repository.exception.RSQLParameterSyntaxException;
|
||||
import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
/**
|
||||
* Management service for {@link TargetTag}s.
|
||||
*
|
||||
*/
|
||||
public interface TargetTagManagement {
|
||||
|
||||
/**
|
||||
* count {@link TargetTag}s.
|
||||
*
|
||||
* @return size of {@link TargetTag}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
long count();
|
||||
|
||||
/**
|
||||
* Creates a new {@link TargetTag}.
|
||||
*
|
||||
* @param create
|
||||
* to be created
|
||||
*
|
||||
* @return the new created {@link TargetTag}
|
||||
*
|
||||
* @throws EntityAlreadyExistsException
|
||||
* if given object already exists
|
||||
* @throws ConstraintViolationException
|
||||
* if fields are not filled as specified. Check
|
||||
* {@link TagCreate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
|
||||
TargetTag create(@NotNull TagCreate create);
|
||||
|
||||
/**
|
||||
* created multiple {@link TargetTag}s.
|
||||
*
|
||||
* @param creates
|
||||
* to be created
|
||||
* @return the new created {@link TargetTag}s
|
||||
*
|
||||
* @throws EntityAlreadyExistsException
|
||||
* if given object has already an ID.
|
||||
* @throws ConstraintViolationException
|
||||
* if fields are not filled as specified. Check
|
||||
* {@link TagCreate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
|
||||
List<TargetTag> create(@NotNull Collection<TagCreate> creates);
|
||||
|
||||
/**
|
||||
* Deletes {@link TargetTag} with given name.
|
||||
*
|
||||
* @param targetTagName
|
||||
* tag name of the {@link TargetTag} to be deleted
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* if tag with given name does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_TARGET)
|
||||
void delete(@NotEmpty String targetTagName);
|
||||
|
||||
/**
|
||||
* returns all {@link TargetTag}s.
|
||||
*
|
||||
* @param pageable
|
||||
* page parameter
|
||||
*
|
||||
* @return all {@link TargetTag}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<TargetTag> findAll(@NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
* Returns all {@link TargetTag}s assigned to {@link Target} with given ID.
|
||||
*
|
||||
* @param pageable
|
||||
* page parameter
|
||||
* @param controllerId
|
||||
* of the assigned target
|
||||
*
|
||||
* @return {@link TargetTag}s assigned to {@link Target} with given ID
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* if target with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<TargetTag> findByTarget(@NotNull Pageable pageable, @NotEmpty String controllerId);
|
||||
|
||||
/**
|
||||
* Retrieves all target tags based on the given specification.
|
||||
* @param pageable
|
||||
* pagination parameter
|
||||
* @param rsqlParam
|
||||
* rsql query string
|
||||
*
|
||||
* @return the found {@link Target}s, never {@code null}
|
||||
*
|
||||
* @throws RSQLParameterUnsupportedFieldException
|
||||
* if a field in the RSQL string is used but not provided by the
|
||||
* given {@code fieldNameProvider}
|
||||
* @throws RSQLParameterSyntaxException
|
||||
* if the RSQL syntax is wrong
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<TargetTag> findByRsql(@NotNull Pageable pageable, @NotNull String rsqlParam);
|
||||
|
||||
/**
|
||||
* Find {@link TargetTag} based on given Name.
|
||||
*
|
||||
* @param name
|
||||
* to look for.
|
||||
* @return {@link TargetTag}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Optional<TargetTag> getByName(@NotEmpty String name);
|
||||
|
||||
/**
|
||||
* Finds {@link TargetTag} by given id.
|
||||
*
|
||||
* @param id
|
||||
* to search for
|
||||
* @return the found {@link TargetTag}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Optional<TargetTag> get(@NotNull Long id);
|
||||
|
||||
/**
|
||||
* updates the {@link TargetTag}.
|
||||
*
|
||||
* @param update
|
||||
* the {@link TargetTag} with updated values
|
||||
* @return the updated {@link TargetTag}
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* in case the {@link TargetTag} does not exists and cannot be
|
||||
* updated
|
||||
* @throws ConstraintViolationException
|
||||
* if fields are not filled as specified. Check
|
||||
* {@link TagUpdate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
||||
TargetTag update(@NotNull TagUpdate update);
|
||||
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* Thrown if DS creation failed.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public final class DistributionSetCreationFailedMissingMandatoryModuleException extends AbstractServerRtException {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Creates a new FileUploadFailedException with
|
||||
* {@link SpServerError#SP_DS_CREATION_FAILED_MISSING_MODULE} error.
|
||||
*/
|
||||
public DistributionSetCreationFailedMissingMandatoryModuleException() {
|
||||
super(SpServerError.SP_DS_CREATION_FAILED_MISSING_MODULE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cause
|
||||
* for the exception
|
||||
*/
|
||||
public DistributionSetCreationFailedMissingMandatoryModuleException(final Throwable cause) {
|
||||
super(SpServerError.SP_DS_CREATION_FAILED_MISSING_MODULE, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message
|
||||
* of the error
|
||||
*/
|
||||
public DistributionSetCreationFailedMissingMandatoryModuleException(final String message) {
|
||||
super(message, SpServerError.SP_DS_CREATION_FAILED_MISSING_MODULE);
|
||||
}
|
||||
}
|
||||
@@ -70,7 +70,7 @@ public class DistributionSetAssignmentResult extends AssignmentResult<Target> {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return targetManagement.findTargetsByControllerID(assignedTargets);
|
||||
return targetManagement.getByControllerID(assignedTargets);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user