Fine grained repository permissions (#2562)
1. Introduce @PrreAuthorize check based on hasPermission - allowing custom processing (compared with non-modifiable hasAuthority/Role processing) 2. Dedicated permissions could be implemented on management api level. Check is made by plugged in PermissionEvaluator 3. Thus common XXX_REPOSITORY permissions could differ for extending services 4. Change create/update entity builder pattern - not via EntityFactory but via clean static lombok based builders (with fine fluent api). 5. Implement abstract repository management jpa class that handles the boilerplate code from extending classes in single place consistently -> AbsreactJpaRepositoryManagement 6. Register management api-s as **Sevice**-s instead of **Bean**-s in order to make easier maintainable and get away from heavy argument forwading 7. Simplify custom hawkbit repository registration + adding proxy to handle exception mapping at lower level - thus not depending on Aspects for converting exceptions 8. Implemented general purpose 'copy' utility (ObjectCopyUtil) that using getter/setter patterns is able to copy (e.g. Create/Update) objects to other objects (e.g. JPA entity objects)
This commit is contained in:
@@ -40,7 +40,7 @@ public interface ArtifactManagement {
|
||||
* @return the total amount of local artifacts stored in the artifact
|
||||
* management
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
long count();
|
||||
|
||||
/**
|
||||
@@ -56,7 +56,7 @@ public interface ArtifactManagement {
|
||||
* @throws InvalidSHA1HashException if check against provided SHA1 checksum failed
|
||||
* @throws ConstraintViolationException if {@link ArtifactUpload} contains invalid values
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_CREATE_REPOSITORY)
|
||||
Artifact create(@NotNull @Valid ArtifactUpload artifactUpload);
|
||||
|
||||
/**
|
||||
@@ -66,7 +66,7 @@ public interface ArtifactManagement {
|
||||
* @throws ArtifactDeleteFailedException if deletion failed (MongoDB is not available)
|
||||
* @throws EntityNotFoundException if artifact with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_DELETE_REPOSITORY)
|
||||
void delete(long id);
|
||||
|
||||
/**
|
||||
@@ -75,7 +75,7 @@ public interface ArtifactManagement {
|
||||
* @param id to search for
|
||||
* @return found {@link Artifact}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.IS_CONTROLLER)
|
||||
Optional<Artifact> get(long id);
|
||||
|
||||
@@ -87,7 +87,7 @@ public interface ArtifactManagement {
|
||||
* @return found {@link Artifact}
|
||||
* @throws EntityNotFoundException if software module with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.IS_CONTROLLER)
|
||||
Optional<Artifact> getByFilenameAndSoftwareModule(@NotNull String filename, long softwareModuleId);
|
||||
|
||||
@@ -97,7 +97,7 @@ public interface ArtifactManagement {
|
||||
* @param sha1 the sha1
|
||||
* @return the first local artifact
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.IS_CONTROLLER)
|
||||
Optional<Artifact> findFirstBySHA1(@NotNull String sha1);
|
||||
|
||||
@@ -107,7 +107,7 @@ public interface ArtifactManagement {
|
||||
* @param filename to search for
|
||||
* @return found List of {@link Artifact}s.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.IS_CONTROLLER)
|
||||
Optional<Artifact> getByFilename(@NotNull String filename);
|
||||
|
||||
@@ -119,7 +119,7 @@ public interface ArtifactManagement {
|
||||
* @return Page<Artifact>
|
||||
* @throws EntityNotFoundException if software module with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
Page<Artifact> findBySoftwareModule(long softwareModuleId, @NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
@@ -129,7 +129,7 @@ public interface ArtifactManagement {
|
||||
* @return count by software module
|
||||
* @throws EntityNotFoundException if software module with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
long countBySoftwareModule(long softwareModuleId);
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Bosch.IO GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository;
|
||||
|
||||
/**
|
||||
* Provider that returns a base repository implementation dynamically based on repository type
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface BaseRepositoryTypeProvider {
|
||||
|
||||
/**
|
||||
* Return a base repository implementation that shall be used based on provided repository type
|
||||
*
|
||||
* @param repositoryType type of repository
|
||||
* @return base repository implementation class
|
||||
*/
|
||||
Class<?> getBaseRepositoryType(final Class<?> repositoryType);
|
||||
}
|
||||
@@ -26,6 +26,8 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
*/
|
||||
public interface ConfirmationManagement {
|
||||
|
||||
String CONFIRMATION_CODE_MSG_PREFIX = "Confirmation status code: %d";
|
||||
|
||||
/**
|
||||
* Activate auto confirmation for a given controller ID. In case auto confirmation is active already, this method will fail with an exception.
|
||||
*
|
||||
|
||||
@@ -121,7 +121,7 @@ public interface DeploymentManagement {
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
|
||||
List<DistributionSetAssignmentResult> offlineAssignedDistributionSets(Collection<Entry<String, Long>> assignments, String initiatedBy);
|
||||
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
List<DistributionSetAssignmentResult> offlineAssignedDistributionSets(Collection<Entry<String, Long>> assignments);
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,20 +9,25 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository;
|
||||
|
||||
import static org.eclipse.hawkbit.im.authentication.SpringEvalExpressions.HAS_AUTH_READ_DISTRIBUTION_SET;
|
||||
import static org.eclipse.hawkbit.im.authentication.SpringEvalExpressions.HAS_AUTH_UPDATE_DISTRIBUTION_SET;
|
||||
import static org.eclipse.hawkbit.im.authentication.SpringEvalExpressions.HAS_READ_REPOSITORY;
|
||||
import static org.eclipse.hawkbit.im.authentication.SpringEvalExpressions.HAS_UPDATE_REPOSITORY;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpringEvalExpressions;
|
||||
import org.eclipse.hawkbit.repository.builder.DistributionSetCreate;
|
||||
import org.eclipse.hawkbit.repository.builder.DistributionSetUpdate;
|
||||
import lombok.Builder;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.eclipse.hawkbit.repository.exception.AssignmentQuotaExceededException;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||
@@ -35,6 +40,9 @@ import org.eclipse.hawkbit.repository.exception.UnsupportedSoftwareModuleForThis
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetFilter;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||
import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.Statistic;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -45,7 +53,14 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
/**
|
||||
* Management service for {@link DistributionSet}s.
|
||||
*/
|
||||
public interface DistributionSetManagement extends RepositoryManagement<DistributionSet, DistributionSetCreate, DistributionSetUpdate> {
|
||||
public interface DistributionSetManagement<T extends DistributionSet>
|
||||
extends RepositoryManagement<T, DistributionSetManagement.Create, DistributionSetManagement.Update> {
|
||||
|
||||
@Override
|
||||
default String permissionGroup() {
|
||||
return "DISTRIBUTION_SET";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Find {@link DistributionSet} based on given ID including (lazy loaded) details, e.g. {@link DistributionSet#getModules()}. <br/>
|
||||
@@ -54,8 +69,8 @@ public interface DistributionSetManagement extends RepositoryManagement<Distribu
|
||||
* @param id to look for.
|
||||
* @return {@link DistributionSet}
|
||||
*/
|
||||
@PreAuthorize(HAS_AUTH_READ_DISTRIBUTION_SET)
|
||||
Optional<DistributionSet> getWithDetails(long id);
|
||||
@PreAuthorize(HAS_READ_REPOSITORY)
|
||||
Optional<T> getWithDetails(long id);
|
||||
|
||||
/**
|
||||
* Find distribution set by id and throw an exception if it is (soft) deleted.
|
||||
@@ -64,16 +79,16 @@ public interface DistributionSetManagement extends RepositoryManagement<Distribu
|
||||
* @return the found valid {@link DistributionSet}
|
||||
* @throws EntityNotFoundException if distribution set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(HAS_AUTH_READ_DISTRIBUTION_SET)
|
||||
DistributionSet getOrElseThrowException(long id);
|
||||
@PreAuthorize(HAS_READ_REPOSITORY)
|
||||
T getOrElseThrowException(long id);
|
||||
|
||||
/**
|
||||
* Sets the specified {@link DistributionSet} as invalidated.
|
||||
*
|
||||
* @param distributionSet the ID of the {@link DistributionSet} to be set to invalid
|
||||
*/
|
||||
@PreAuthorize(HAS_AUTH_UPDATE_DISTRIBUTION_SET)
|
||||
void invalidate(DistributionSet distributionSet);
|
||||
@PreAuthorize(HAS_UPDATE_REPOSITORY)
|
||||
void invalidate(T distributionSet);
|
||||
|
||||
/**
|
||||
* Assigns {@link SoftwareModule} to existing {@link DistributionSet}.
|
||||
@@ -88,8 +103,8 @@ public interface DistributionSetManagement extends RepositoryManagement<Distribu
|
||||
* @throws AssignmentQuotaExceededException if the maximum number of {@link SoftwareModule}s is exceeded for the addressed
|
||||
* {@link DistributionSet}.
|
||||
*/
|
||||
@PreAuthorize(HAS_AUTH_UPDATE_DISTRIBUTION_SET)
|
||||
DistributionSet assignSoftwareModules(long id, @NotEmpty Collection<Long> moduleIds);
|
||||
@PreAuthorize(HAS_UPDATE_REPOSITORY)
|
||||
T assignSoftwareModules(long id, @NotEmpty Collection<Long> moduleIds);
|
||||
|
||||
/**
|
||||
* Unassigns a {@link SoftwareModule} form an existing {@link DistributionSet}.
|
||||
@@ -100,8 +115,8 @@ public interface DistributionSetManagement extends RepositoryManagement<Distribu
|
||||
* @throws EntityNotFoundException if given module or DS does not exist
|
||||
* @throws EntityReadOnlyException if use tries to change the {@link DistributionSet} s while the DS is already in use.
|
||||
*/
|
||||
@PreAuthorize(HAS_AUTH_UPDATE_DISTRIBUTION_SET)
|
||||
DistributionSet unassignSoftwareModule(long id, long moduleId);
|
||||
@PreAuthorize(HAS_UPDATE_REPOSITORY)
|
||||
T unassignSoftwareModule(long id, long moduleId);
|
||||
|
||||
/**
|
||||
* Assign a {@link DistributionSetTag} assignment to given {@link DistributionSet}s.
|
||||
@@ -111,8 +126,8 @@ public interface DistributionSetManagement extends RepositoryManagement<Distribu
|
||||
* @return list of assigned ds
|
||||
* @throws EntityNotFoundException if tag with given ID does not exist or (at least one) of the distribution sets.
|
||||
*/
|
||||
@PreAuthorize(HAS_AUTH_UPDATE_DISTRIBUTION_SET)
|
||||
List<DistributionSet> assignTag(@NotEmpty Collection<Long> ids, long tagId);
|
||||
@PreAuthorize(HAS_UPDATE_REPOSITORY)
|
||||
List<T> assignTag(@NotEmpty Collection<Long> ids, long tagId);
|
||||
|
||||
/**
|
||||
* Unassign a {@link DistributionSetTag} assignment to given {@link DistributionSet}s.
|
||||
@@ -122,8 +137,8 @@ public interface DistributionSetManagement extends RepositoryManagement<Distribu
|
||||
* @return list of assigned ds
|
||||
* @throws EntityNotFoundException if tag with given ID does not exist or (at least one) of the distribution sets.
|
||||
*/
|
||||
@PreAuthorize(HAS_AUTH_UPDATE_DISTRIBUTION_SET)
|
||||
List<DistributionSet> unassignTag(@NotEmpty Collection<Long> ids, long tagId);
|
||||
@PreAuthorize(HAS_UPDATE_REPOSITORY)
|
||||
List<T> unassignTag(@NotEmpty Collection<Long> ids, long tagId);
|
||||
|
||||
/**
|
||||
* Creates a map of distribution set meta-data entries.
|
||||
@@ -134,7 +149,7 @@ public interface DistributionSetManagement extends RepositoryManagement<Distribu
|
||||
* @throws EntityAlreadyExistsException in case one of the meta-data entry already exists for the specific key
|
||||
* @throws AssignmentQuotaExceededException if the maximum number of meta-data entries is exceeded for the addressed {@link DistributionSet}
|
||||
*/
|
||||
@PreAuthorize(HAS_AUTH_UPDATE_DISTRIBUTION_SET)
|
||||
@PreAuthorize(HAS_UPDATE_REPOSITORY)
|
||||
void createMetadata(long id, @NotEmpty Map<String, String> metadata);
|
||||
|
||||
/**
|
||||
@@ -144,7 +159,7 @@ public interface DistributionSetManagement extends RepositoryManagement<Distribu
|
||||
* @return a paged result of all meta-data entries for a given distribution set id
|
||||
* @throws EntityNotFoundException if distribution set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(HAS_AUTH_READ_DISTRIBUTION_SET)
|
||||
@PreAuthorize(HAS_READ_REPOSITORY)
|
||||
Map<String, String> getMetadata(long id);
|
||||
|
||||
/**
|
||||
@@ -155,7 +170,7 @@ public interface DistributionSetManagement extends RepositoryManagement<Distribu
|
||||
* @param value meta data-entry to be new value
|
||||
* @throws EntityNotFoundException in case the meta-data entry does not exist and cannot be updated
|
||||
*/
|
||||
@PreAuthorize(HAS_AUTH_UPDATE_DISTRIBUTION_SET)
|
||||
@PreAuthorize(HAS_UPDATE_REPOSITORY)
|
||||
void updateMetadata(long id, @NotNull String key, @NotNull String value);
|
||||
|
||||
/**
|
||||
@@ -165,7 +180,7 @@ public interface DistributionSetManagement extends RepositoryManagement<Distribu
|
||||
* @param key of the meta-data element
|
||||
* @throws EntityNotFoundException if given set does not exist
|
||||
*/
|
||||
@PreAuthorize(HAS_AUTH_UPDATE_DISTRIBUTION_SET)
|
||||
@PreAuthorize(HAS_UPDATE_REPOSITORY)
|
||||
void deleteMetadata(long id, @NotEmpty String key);
|
||||
|
||||
/**
|
||||
@@ -174,7 +189,7 @@ public interface DistributionSetManagement extends RepositoryManagement<Distribu
|
||||
* @param id the distribution set id
|
||||
* @throws EntityNotFoundException if distribution set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(HAS_AUTH_UPDATE_DISTRIBUTION_SET)
|
||||
@PreAuthorize(HAS_UPDATE_REPOSITORY)
|
||||
void lock(final long id);
|
||||
|
||||
/**
|
||||
@@ -185,7 +200,7 @@ public interface DistributionSetManagement extends RepositoryManagement<Distribu
|
||||
* @param id the distribution set id
|
||||
* @throws EntityNotFoundException if distribution set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(HAS_AUTH_UPDATE_DISTRIBUTION_SET)
|
||||
@PreAuthorize(HAS_UPDATE_REPOSITORY)
|
||||
void unlock(final long id);
|
||||
|
||||
/**
|
||||
@@ -196,8 +211,8 @@ public interface DistributionSetManagement extends RepositoryManagement<Distribu
|
||||
* @throws EntityNotFoundException if distribution set with given ID does not exist
|
||||
* @throws InvalidDistributionSetException if distribution set with given ID is invalidated
|
||||
*/
|
||||
@PreAuthorize(HAS_AUTH_READ_DISTRIBUTION_SET)
|
||||
DistributionSet getValid(long id);
|
||||
@PreAuthorize(HAS_READ_REPOSITORY)
|
||||
T getValid(long id);
|
||||
|
||||
/**
|
||||
* Find distribution set by id and throw an exception if it is deleted, incomplete or invalidated.
|
||||
@@ -208,8 +223,8 @@ public interface DistributionSetManagement extends RepositoryManagement<Distribu
|
||||
* @throws InvalidDistributionSetException if distribution set with given ID is invalidated
|
||||
* @throws IncompleteDistributionSetException if distribution set with given ID is incomplete
|
||||
*/
|
||||
@PreAuthorize(HAS_AUTH_READ_DISTRIBUTION_SET)
|
||||
DistributionSet getValidAndComplete(long id);
|
||||
@PreAuthorize(HAS_READ_REPOSITORY)
|
||||
T getValidAndComplete(long id);
|
||||
|
||||
/**
|
||||
* Retrieves the distribution set for a given action.
|
||||
@@ -218,8 +233,8 @@ public interface DistributionSetManagement extends RepositoryManagement<Distribu
|
||||
* @return the distribution set which is associated with the action
|
||||
* @throws EntityNotFoundException if action with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(HAS_AUTH_READ_DISTRIBUTION_SET)
|
||||
Optional<DistributionSet> findByAction(long actionId);
|
||||
@PreAuthorize(HAS_READ_REPOSITORY)
|
||||
Optional<T> findByAction(long actionId);
|
||||
|
||||
/**
|
||||
* Find distribution set by name and version.
|
||||
@@ -228,8 +243,8 @@ public interface DistributionSetManagement extends RepositoryManagement<Distribu
|
||||
* @param version version of {@link DistributionSet}
|
||||
* @return the page with the found {@link DistributionSet}
|
||||
*/
|
||||
@PreAuthorize(HAS_AUTH_READ_DISTRIBUTION_SET)
|
||||
Optional<DistributionSet> findByNameAndVersion(@NotEmpty String distributionName, @NotEmpty String version);
|
||||
@PreAuthorize(HAS_READ_REPOSITORY)
|
||||
Optional<T> findByNameAndVersion(@NotEmpty String distributionName, @NotEmpty String version);
|
||||
|
||||
/**
|
||||
* Finds all {@link DistributionSet}s based on completeness.
|
||||
@@ -239,8 +254,8 @@ public interface DistributionSetManagement extends RepositoryManagement<Distribu
|
||||
* @param pageable the pagination parameter
|
||||
* @return all found {@link DistributionSet}s
|
||||
*/
|
||||
@PreAuthorize(HAS_AUTH_READ_DISTRIBUTION_SET)
|
||||
Slice<DistributionSet> findByCompleted(Boolean complete, @NotNull Pageable pageable);
|
||||
@PreAuthorize(HAS_READ_REPOSITORY)
|
||||
Slice<T> findByCompleted(Boolean complete, @NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
* Retrieves {@link DistributionSet}s by filtering on the given parameters.
|
||||
@@ -249,8 +264,8 @@ public interface DistributionSetManagement extends RepositoryManagement<Distribu
|
||||
* @param pageable page parameter
|
||||
* @return the page of found {@link DistributionSet}
|
||||
*/
|
||||
@PreAuthorize(HAS_AUTH_READ_DISTRIBUTION_SET)
|
||||
Slice<DistributionSet> findByDistributionSetFilter(@NotNull DistributionSetFilter distributionSetFilter, @NotNull Pageable pageable);
|
||||
@PreAuthorize(HAS_READ_REPOSITORY)
|
||||
Slice<T> findByDistributionSetFilter(@NotNull DistributionSetFilter distributionSetFilter, @NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
* Retrieves {@link DistributionSet}s by filtering on the given parameters.
|
||||
@@ -263,8 +278,8 @@ public interface DistributionSetManagement extends RepositoryManagement<Distribu
|
||||
* @throws RSQLParameterSyntaxException if the RSQL syntax is wrong
|
||||
* @throws EntityNotFoundException of distribution set tag with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(HAS_AUTH_READ_DISTRIBUTION_SET)
|
||||
Page<DistributionSet> findByTag(long tagId, @NotNull Pageable pageable);
|
||||
@PreAuthorize(HAS_READ_REPOSITORY)
|
||||
Page<T> findByTag(long tagId, @NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
* Retrieves {@link DistributionSet}s by filtering on the given parameters.
|
||||
@@ -275,8 +290,8 @@ public interface DistributionSetManagement extends RepositoryManagement<Distribu
|
||||
* @return the page of found {@link DistributionSet}
|
||||
* @throws EntityNotFoundException of distribution set tag with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(HAS_AUTH_READ_DISTRIBUTION_SET)
|
||||
Page<DistributionSet> findByRsqlAndTag(@NotNull String rsql, long tagId, @NotNull Pageable pageable);
|
||||
@PreAuthorize(HAS_READ_REPOSITORY)
|
||||
Page<T> findByRsqlAndTag(@NotNull String rsql, long tagId, @NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
* Counts all {@link DistributionSet}s based on completeness.
|
||||
@@ -285,7 +300,7 @@ public interface DistributionSetManagement extends RepositoryManagement<Distribu
|
||||
* nor <code>null</code> to count both.
|
||||
* @return count of all found {@link DistributionSet}s
|
||||
*/
|
||||
@PreAuthorize(HAS_AUTH_READ_DISTRIBUTION_SET)
|
||||
@PreAuthorize(HAS_READ_REPOSITORY)
|
||||
long countByCompleted(Boolean complete);
|
||||
|
||||
/**
|
||||
@@ -294,7 +309,7 @@ public interface DistributionSetManagement extends RepositoryManagement<Distribu
|
||||
* @param distributionSetFilter has details of filters to be applied.
|
||||
* @return count of {@link DistributionSet}s
|
||||
*/
|
||||
@PreAuthorize(HAS_AUTH_READ_DISTRIBUTION_SET)
|
||||
@PreAuthorize(HAS_READ_REPOSITORY)
|
||||
long countByDistributionSetFilter(@NotNull DistributionSetFilter distributionSetFilter);
|
||||
|
||||
/**
|
||||
@@ -305,7 +320,7 @@ public interface DistributionSetManagement extends RepositoryManagement<Distribu
|
||||
* @return number of {@link DistributionSet}s
|
||||
* @throws EntityNotFoundException if type with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(HAS_AUTH_READ_DISTRIBUTION_SET)
|
||||
@PreAuthorize(HAS_READ_REPOSITORY)
|
||||
long countByTypeId(long typeId);
|
||||
|
||||
/**
|
||||
@@ -315,7 +330,7 @@ public interface DistributionSetManagement extends RepositoryManagement<Distribu
|
||||
* @param id to check
|
||||
* @return <code>true</code> if in use
|
||||
*/
|
||||
@PreAuthorize(HAS_AUTH_READ_DISTRIBUTION_SET)
|
||||
@PreAuthorize(HAS_READ_REPOSITORY)
|
||||
boolean isInUse(long id);
|
||||
|
||||
/**
|
||||
@@ -325,7 +340,7 @@ public interface DistributionSetManagement extends RepositoryManagement<Distribu
|
||||
* @param id to look for
|
||||
* @return List of Statistics for {@link org.eclipse.hawkbit.repository.model.Rollout}s status counts
|
||||
*/
|
||||
@PreAuthorize(HAS_AUTH_READ_DISTRIBUTION_SET)
|
||||
@PreAuthorize(HAS_READ_REPOSITORY)
|
||||
List<Statistic> countRolloutsByStatusForDistributionSet(@NotNull Long id);
|
||||
|
||||
/**
|
||||
@@ -335,7 +350,7 @@ public interface DistributionSetManagement extends RepositoryManagement<Distribu
|
||||
* @param id to look for
|
||||
* @return List of Statistics for {@link org.eclipse.hawkbit.repository.model.Action}s status counts
|
||||
*/
|
||||
@PreAuthorize(HAS_AUTH_READ_DISTRIBUTION_SET)
|
||||
@PreAuthorize(HAS_READ_REPOSITORY)
|
||||
List<Statistic> countActionsByStatusForDistributionSet(@NotNull Long id);
|
||||
|
||||
/**
|
||||
@@ -345,6 +360,60 @@ public interface DistributionSetManagement extends RepositoryManagement<Distribu
|
||||
* @param id to look for
|
||||
* @return number of {@link org.eclipse.hawkbit.repository.builder.AutoAssignDistributionSetUpdate}s
|
||||
*/
|
||||
@PreAuthorize(HAS_AUTH_READ_DISTRIBUTION_SET)
|
||||
@PreAuthorize(HAS_READ_REPOSITORY)
|
||||
Long countAutoAssignmentsForDistributionSet(@NotNull Long id);
|
||||
|
||||
@SuperBuilder
|
||||
@Getter
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
final class Create extends UpdateCreate {
|
||||
|
||||
@NotNull
|
||||
private DistributionSetType type;
|
||||
|
||||
@Builder.Default
|
||||
private Set<? extends SoftwareModule> modules = Set.of();
|
||||
|
||||
public Create setType(@NotEmpty DistributionSetType type) {
|
||||
this.type = Objects.requireNonNull(type, "type must not be null");
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@SuperBuilder
|
||||
@Getter
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
final class Update extends UpdateCreate implements Identifiable<Long> {
|
||||
|
||||
@NotNull
|
||||
private Long id;
|
||||
|
||||
@Builder.Default
|
||||
private Boolean locked = false;
|
||||
}
|
||||
|
||||
@SuperBuilder
|
||||
@Getter
|
||||
class UpdateCreate {
|
||||
|
||||
@ValidString
|
||||
@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE)
|
||||
@NotNull(groups = Create.class)
|
||||
private String name;
|
||||
@ValidString
|
||||
@Size(min = 1, max = NamedVersionedEntity.VERSION_MAX_SIZE)
|
||||
@NotNull(groups = Create.class)
|
||||
private String version;
|
||||
@ValidString
|
||||
@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE)
|
||||
private String description;
|
||||
@Builder.Default
|
||||
private Boolean requiredMigrationStep = false;
|
||||
}
|
||||
}
|
||||
@@ -13,13 +13,18 @@ import java.util.Optional;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.eclipse.hawkbit.im.authentication.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.NamedEntity;
|
||||
import org.eclipse.hawkbit.repository.model.Tag;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -29,7 +34,8 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
/**
|
||||
* Management service for {@link DistributionSetTag}s.
|
||||
*/
|
||||
public interface DistributionSetTagManagement extends RepositoryManagement<DistributionSetTag, TagCreate, TagUpdate> {
|
||||
public interface DistributionSetTagManagement<T extends DistributionSetTag>
|
||||
extends RepositoryManagement<T, DistributionSetTagManagement.Create, DistributionSetTagManagement.Update> {
|
||||
|
||||
/**
|
||||
* Find {@link DistributionSet} based on given name.
|
||||
@@ -37,8 +43,8 @@ public interface DistributionSetTagManagement extends RepositoryManagement<Distr
|
||||
* @param name to look for.
|
||||
* @return {@link DistributionSet}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Optional<DistributionSetTag> findByName(@NotEmpty String name);
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
Optional<T> findByName(@NotEmpty String name);
|
||||
|
||||
/**
|
||||
* Finds all {@link TargetTag} assigned to given {@link Target}.
|
||||
@@ -48,8 +54,8 @@ public interface DistributionSetTagManagement extends RepositoryManagement<Distr
|
||||
* @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(long distributionSetId, @NotNull Pageable pageable);
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
Page<T> findByDistributionSet(long distributionSetId, @NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
* Deletes {@link DistributionSetTag} by given
|
||||
@@ -58,6 +64,40 @@ public interface DistributionSetTagManagement extends RepositoryManagement<Distr
|
||||
* @param tagName to be deleted
|
||||
* @throws EntityNotFoundException if tag with given name does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_DELETE_REPOSITORY)
|
||||
void delete(@NotEmpty String tagName);
|
||||
|
||||
@SuperBuilder
|
||||
@Getter
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
final class Create extends UpdateCreate {}
|
||||
|
||||
@SuperBuilder
|
||||
@Getter
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
final class Update extends UpdateCreate implements Identifiable<Long> {
|
||||
|
||||
@NotNull
|
||||
private Long id;
|
||||
}
|
||||
|
||||
@SuperBuilder
|
||||
@Getter
|
||||
class UpdateCreate {
|
||||
|
||||
@ValidString
|
||||
@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE)
|
||||
@NotNull(groups = Create.class)
|
||||
private String name;
|
||||
|
||||
@ValidString
|
||||
@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE)
|
||||
private String description;
|
||||
|
||||
@ValidString
|
||||
@Size(max = Tag.COLOUR_MAX_SIZE)
|
||||
private String colour;
|
||||
}
|
||||
}
|
||||
@@ -11,31 +11,39 @@ package org.eclipse.hawkbit.repository;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.eclipse.hawkbit.im.authentication.SpringEvalExpressions;
|
||||
import org.eclipse.hawkbit.repository.builder.DistributionSetTypeCreate;
|
||||
import org.eclipse.hawkbit.repository.builder.DistributionSetTypeUpdate;
|
||||
import org.eclipse.hawkbit.repository.exception.AssignmentQuotaExceededException;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityReadOnlyException;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.eclipse.hawkbit.repository.model.Type;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
/**
|
||||
* Management service for {@link DistributionSetType}s.
|
||||
*/
|
||||
public interface DistributionSetTypeManagement
|
||||
extends RepositoryManagement<DistributionSetType, DistributionSetTypeCreate, DistributionSetTypeUpdate> {
|
||||
public interface DistributionSetTypeManagement<T extends DistributionSetType>
|
||||
extends RepositoryManagement<T, DistributionSetTypeManagement.Create, DistributionSetTypeManagement.Update> {
|
||||
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Optional<DistributionSetType> findByKey(@NotEmpty String key);
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
Optional<T> findByKey(@NotEmpty String key);
|
||||
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Optional<DistributionSetType> findByName(@NotEmpty String name);
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
Optional<T> findByName(@NotEmpty String name);
|
||||
|
||||
/**
|
||||
* Assigns {@link DistributionSetType#getMandatoryModuleTypes()}.
|
||||
@@ -48,8 +56,8 @@ public interface DistributionSetTypeManagement
|
||||
* @throws AssignmentQuotaExceededException if the maximum number of {@link SoftwareModuleType}s is exceeded for the addressed
|
||||
* {@link DistributionSetType}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
DistributionSetType assignOptionalSoftwareModuleTypes(long id, @NotEmpty Collection<Long> softwareModuleTypeIds);
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_UPDATE_REPOSITORY)
|
||||
T assignOptionalSoftwareModuleTypes(long id, @NotEmpty Collection<Long> softwareModuleTypeIds);
|
||||
|
||||
/**
|
||||
* Assigns {@link DistributionSetType#getOptionalModuleTypes()}.
|
||||
@@ -62,8 +70,8 @@ public interface DistributionSetTypeManagement
|
||||
* @throws AssignmentQuotaExceededException if the maximum number of {@link SoftwareModuleType}s is exceeded for the addressed
|
||||
* {@link DistributionSetType}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
DistributionSetType assignMandatorySoftwareModuleTypes(long id, @NotEmpty Collection<Long> softwareModuleTypeIds);
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_UPDATE_REPOSITORY)
|
||||
T assignMandatorySoftwareModuleTypes(long id, @NotEmpty Collection<Long> softwareModuleTypeIds);
|
||||
|
||||
/**
|
||||
* Unassigns a {@link SoftwareModuleType} from the {@link DistributionSetType}. Does nothing if {@link SoftwareModuleType}
|
||||
@@ -75,6 +83,49 @@ public interface DistributionSetTypeManagement
|
||||
* @throws EntityNotFoundException in case the {@link DistributionSetType} does not exist
|
||||
* @throws EntityReadOnlyException if the {@link DistributionSetType} while it is already in use by a {@link DistributionSet}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
DistributionSetType unassignSoftwareModuleType(long id, long softwareModuleTypeId);
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_UPDATE_REPOSITORY)
|
||||
T unassignSoftwareModuleType(long id, long softwareModuleTypeId);
|
||||
|
||||
@SuperBuilder
|
||||
@Getter
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
final class Create extends UpdateCreate {
|
||||
|
||||
@Size(min = 1, max = Type.KEY_MAX_SIZE)
|
||||
@NotNull
|
||||
private String key;
|
||||
|
||||
@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE)
|
||||
@NotNull
|
||||
private String name;
|
||||
}
|
||||
|
||||
@SuperBuilder
|
||||
@Getter
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
final class Update extends UpdateCreate implements Identifiable<Long> {
|
||||
|
||||
@NotNull
|
||||
private Long id;
|
||||
}
|
||||
|
||||
@SuperBuilder
|
||||
@Getter
|
||||
class UpdateCreate {
|
||||
|
||||
@ValidString
|
||||
@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE)
|
||||
private String description;
|
||||
|
||||
@ValidString
|
||||
@Size(max = Type.COLOUR_MAX_SIZE)
|
||||
private String colour;
|
||||
|
||||
@Builder.Default
|
||||
private Set<? extends SoftwareModuleType> mandatoryModuleTypes = Set.of();
|
||||
@Builder.Default
|
||||
private Set<? extends SoftwareModuleType> optionalModuleTypes = Set.of();
|
||||
}
|
||||
}
|
||||
@@ -10,18 +10,15 @@
|
||||
package org.eclipse.hawkbit.repository;
|
||||
|
||||
import org.eclipse.hawkbit.repository.builder.ActionStatusBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.DistributionSetBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.DistributionSetTypeBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.RolloutBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.RolloutGroupBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.SoftwareModuleBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.SoftwareModuleMetadataBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.SoftwareModuleTypeBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.TagBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.TargetBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.TargetFilterQueryBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.TargetTypeBuilder;
|
||||
import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||
import org.eclipse.hawkbit.repository.model.Tag;
|
||||
|
||||
/**
|
||||
* central {@link BaseEntity} generation service. Objects are created but not
|
||||
@@ -34,11 +31,6 @@ public interface EntityFactory {
|
||||
*/
|
||||
ActionStatusBuilder actionStatus();
|
||||
|
||||
/**
|
||||
* @return {@link DistributionSetBuilder} object
|
||||
*/
|
||||
DistributionSetBuilder distributionSet();
|
||||
|
||||
/**
|
||||
* @return {@link SoftwareModuleMetadataBuilder} object
|
||||
*/
|
||||
@@ -47,33 +39,18 @@ public interface EntityFactory {
|
||||
/**
|
||||
* @return {@link TagBuilder} object
|
||||
*/
|
||||
TagBuilder tag();
|
||||
TagBuilder<Tag> tag();
|
||||
|
||||
/**
|
||||
* @return {@link RolloutGroupBuilder} object
|
||||
*/
|
||||
RolloutGroupBuilder rolloutGroup();
|
||||
|
||||
/**
|
||||
* @return {@link DistributionSetTypeBuilder} object
|
||||
*/
|
||||
DistributionSetTypeBuilder distributionSetType();
|
||||
|
||||
/**
|
||||
* @return {@link RolloutBuilder} object
|
||||
*/
|
||||
RolloutBuilder rollout();
|
||||
|
||||
/**
|
||||
* @return {@link SoftwareModuleBuilder} object
|
||||
*/
|
||||
SoftwareModuleBuilder softwareModule();
|
||||
|
||||
/**
|
||||
* @return {@link SoftwareModuleTypeBuilder} object
|
||||
*/
|
||||
SoftwareModuleTypeBuilder softwareModuleType();
|
||||
|
||||
/**
|
||||
* @return {@link TargetBuilder} object
|
||||
*/
|
||||
|
||||
@@ -33,70 +33,30 @@ 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
|
||||
* @param <C> type of the create request
|
||||
* @param <U> type of the update request
|
||||
*/
|
||||
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 @Valid Collection<C> creates);
|
||||
public interface RepositoryManagement<T extends BaseEntity, C, U extends Identifiable<Long>> {
|
||||
|
||||
/**
|
||||
* Creates new {@link BaseEntity}.
|
||||
*
|
||||
* @param create to create
|
||||
* @param create bean with properties of the object 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)
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_CREATE_REPOSITORY)
|
||||
T create(@NotNull @Valid C create);
|
||||
|
||||
/**
|
||||
* Updates existing {@link BaseEntity}.
|
||||
* Creates multiple {@link BaseEntity}s.
|
||||
*
|
||||
* @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 exist and cannot be updated
|
||||
* @param create beans with properties of the object to create
|
||||
* @return created Entity
|
||||
* @throws ConstraintViolationException if fields are not filled as specified. Check {@link BaseEntity} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
T update(@NotNull @Valid U update);
|
||||
|
||||
/**
|
||||
* 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(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);
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_CREATE_REPOSITORY)
|
||||
List<T> create(@NotNull @Valid Collection<C> create);
|
||||
|
||||
/**
|
||||
* Retrieve {@link BaseEntity}
|
||||
@@ -104,16 +64,25 @@ public interface RepositoryManagement<T, C, U> {
|
||||
* @param id to search for
|
||||
* @return {@link BaseEntity} in the repository with given {@link BaseEntity#getId()}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
Optional<T> get(long id);
|
||||
|
||||
/**
|
||||
* Retrieves all {@link BaseEntity}s without details.
|
||||
*
|
||||
* @param ids the ids to for
|
||||
* @return the found {@link BaseEntity}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
List<T> get(@NotEmpty Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 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)
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
Slice<T> findAll(@NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
@@ -126,7 +95,7 @@ public interface RepositoryManagement<T, C, U> {
|
||||
* {@code fieldNameProvider}
|
||||
* @throws RSQLParameterSyntaxException if the RSQL syntax is wrong
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
Page<T> findByRsql(@NotNull String rsql, @NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
@@ -135,12 +104,56 @@ public interface RepositoryManagement<T, C, U> {
|
||||
* @param id of entity to check existence
|
||||
* @return <code>true</code> if entity with given ID exists
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
boolean exists(long id);
|
||||
|
||||
/**
|
||||
* @return number of {@link BaseEntity}s in the repository.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
long count();
|
||||
|
||||
/**
|
||||
* Counts the number of {@link BaseEntity}s matching the given RSQL filter.
|
||||
*
|
||||
* @param rsql filter definition in RSQL syntax
|
||||
* @return number of matching {@link BaseEntity}s in the repository.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
long countByRsql(String rsql);
|
||||
|
||||
/**
|
||||
* Updates existing {@link BaseEntity}.
|
||||
*
|
||||
* @param update bean with properties of the object 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 exist and cannot be updated
|
||||
* @throws ConstraintViolationException if fields are not filled as specified. Check {@link BaseEntity} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_UPDATE_REPOSITORY)
|
||||
T update(@NotNull @Valid U update);
|
||||
|
||||
/**
|
||||
* 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_DELETE_REPOSITORY)
|
||||
void delete(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_DELETE_REPOSITORY)
|
||||
void delete(@NotEmpty Collection<Long> ids);
|
||||
|
||||
default String permissionGroup() {
|
||||
return "REPOSITORY";
|
||||
}
|
||||
}
|
||||
@@ -17,19 +17,26 @@ import java.util.Optional;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.eclipse.hawkbit.im.authentication.SpringEvalExpressions;
|
||||
import org.eclipse.hawkbit.repository.builder.SoftwareModuleCreate;
|
||||
import org.eclipse.hawkbit.repository.builder.SoftwareModuleMetadataCreate;
|
||||
import org.eclipse.hawkbit.repository.builder.SoftwareModuleMetadataUpdate;
|
||||
import org.eclipse.hawkbit.repository.builder.SoftwareModuleUpdate;
|
||||
import org.eclipse.hawkbit.repository.exception.AssignmentQuotaExceededException;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||
import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.eclipse.hawkbit.repository.model.Type;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Slice;
|
||||
@@ -38,19 +45,24 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
/**
|
||||
* Service for managing {@link SoftwareModule}s.
|
||||
*/
|
||||
public interface SoftwareModuleManagement extends RepositoryManagement<SoftwareModule, SoftwareModuleCreate, SoftwareModuleUpdate> {
|
||||
public interface SoftwareModuleManagement<T extends SoftwareModule>
|
||||
extends RepositoryManagement<T, SoftwareModuleManagement.Create, SoftwareModuleManagement.Update> {
|
||||
|
||||
@Override
|
||||
default String permissionGroup() {
|
||||
return "SOFTWARE_MODULE";
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a list of software module meta-data entries.
|
||||
*
|
||||
* @param metadata the meta-data entries to create
|
||||
* @return the updated or created software module meta-data entries
|
||||
* @throws EntityAlreadyExistsException in case one of the meta-data entry already exists for the specific key
|
||||
* @throws EntityNotFoundException if software module with given ID does not exist
|
||||
* @throws AssignmentQuotaExceededException if the maximum number of {@link SoftwareModuleMetadata} entries is exceeded for the addressed
|
||||
* {@link SoftwareModule}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_UPDATE_REPOSITORY)
|
||||
void createMetadata(@NotNull @Valid Collection<SoftwareModuleMetadataCreate> metadata);
|
||||
|
||||
/**
|
||||
@@ -60,7 +72,7 @@ public interface SoftwareModuleManagement extends RepositoryManagement<SoftwareM
|
||||
* @return a paged result of all meta-data entries for a given software module id
|
||||
* @throws EntityNotFoundException if software module with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
List<SoftwareModuleMetadata> getMetadata(long id);
|
||||
|
||||
/**
|
||||
@@ -71,7 +83,7 @@ public interface SoftwareModuleManagement extends RepositoryManagement<SoftwareM
|
||||
* @return a paged result of all meta-data entries for a given software module id
|
||||
* @throws EntityNotFoundException if software module with given ID does not exist ot the
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
SoftwareModuleMetadata getMetadata(long id, String key);
|
||||
|
||||
/**
|
||||
@@ -82,7 +94,7 @@ public interface SoftwareModuleManagement extends RepositoryManagement<SoftwareM
|
||||
* @return a paged result of all meta-data entries for a given software module id
|
||||
* @throws EntityNotFoundException if software module with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
Page<SoftwareModuleMetadata> findMetaDataBySoftwareModuleIdAndTargetVisible(long id, @NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
@@ -95,7 +107,7 @@ public interface SoftwareModuleManagement extends RepositoryManagement<SoftwareM
|
||||
* @throws AssignmentQuotaExceededException if the maximum number of {@link SoftwareModuleMetadata}
|
||||
* entries is exceeded for the addressed {@link SoftwareModule}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_UPDATE_REPOSITORY)
|
||||
SoftwareModuleMetadata updateMetadata(@NotNull @Valid SoftwareModuleMetadataCreate metadata);
|
||||
|
||||
/**
|
||||
@@ -105,7 +117,7 @@ public interface SoftwareModuleManagement extends RepositoryManagement<SoftwareM
|
||||
* @return the updated meta-data entry
|
||||
* @throws EntityNotFoundException in case the meta-data entry does not exist and cannot be updated
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_UPDATE_REPOSITORY)
|
||||
SoftwareModuleMetadata updateMetadata(@NotNull @Valid SoftwareModuleMetadataUpdate update);
|
||||
|
||||
/**
|
||||
@@ -113,10 +125,10 @@ public interface SoftwareModuleManagement extends RepositoryManagement<SoftwareM
|
||||
*
|
||||
* @param id where meta-data has to be deleted
|
||||
* @param key of the meta-data element
|
||||
* @throws EntityNotFoundException if software module with given ID does not exist or the key is not found
|
||||
* @return true if really deleted, false if not
|
||||
* @throws EntityNotFoundException if software module with given ID does not exist or the key is not found
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_UPDATE_REPOSITORY)
|
||||
void deleteMetadata(long id, @NotEmpty String key);
|
||||
|
||||
/**
|
||||
@@ -125,7 +137,7 @@ public interface SoftwareModuleManagement extends RepositoryManagement<SoftwareM
|
||||
* @param id the software module id
|
||||
* @throws EntityNotFoundException if software module with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_UPDATE_REPOSITORY)
|
||||
void lock(long id);
|
||||
|
||||
/**
|
||||
@@ -136,7 +148,7 @@ public interface SoftwareModuleManagement extends RepositoryManagement<SoftwareM
|
||||
* @param id the software module id
|
||||
* @throws EntityNotFoundException if software module with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_UPDATE_REPOSITORY)
|
||||
void unlock(long id);
|
||||
|
||||
/**
|
||||
@@ -147,8 +159,8 @@ public interface SoftwareModuleManagement extends RepositoryManagement<SoftwareM
|
||||
* @return all {@link SoftwareModule}s that are assigned to given {@link DistributionSet}.
|
||||
* @throws EntityNotFoundException if distribution set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<SoftwareModule> findByAssignedTo(long distributionSetId, @NotNull Pageable pageable);
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
Page<T> findByAssignedTo(long distributionSetId, @NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
* Filter {@link SoftwareModule}s with given {@link SoftwareModule#getName()} or {@link SoftwareModule#getVersion()}
|
||||
@@ -160,8 +172,8 @@ public interface SoftwareModuleManagement extends RepositoryManagement<SoftwareM
|
||||
* @return the page of found {@link SoftwareModule}
|
||||
* @throws EntityNotFoundException if given software module type does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Slice<SoftwareModule> findByTextAndType(String searchText, Long typeId, @NotNull Pageable pageable);
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
Slice<T> findByTextAndType(String searchText, Long typeId, @NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
* Retrieves {@link SoftwareModule} by their name AND version AND type.
|
||||
@@ -172,8 +184,8 @@ public interface SoftwareModuleManagement extends RepositoryManagement<SoftwareM
|
||||
* @return the found {@link SoftwareModule}
|
||||
* @throws EntityNotFoundException if software module type with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Optional<SoftwareModule> findByNameAndVersionAndType(@NotEmpty String name, @NotEmpty String version, long typeId);
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
Optional<T> findByNameAndVersionAndType(@NotEmpty String name, @NotEmpty String version, long typeId);
|
||||
|
||||
/**
|
||||
* Retrieves the {@link SoftwareModule}s by their {@link SoftwareModuleType}
|
||||
@@ -183,10 +195,10 @@ public interface SoftwareModuleManagement extends RepositoryManagement<SoftwareM
|
||||
* @return the found {@link SoftwareModule}s
|
||||
* @throws EntityNotFoundException if software module type with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Slice<SoftwareModule> findByType(long typeId, @NotNull Pageable pageable);
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
Slice<T> findByType(long typeId, @NotNull Pageable pageable);
|
||||
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
Map<Long, List<SoftwareModuleMetadata>> findMetaDataBySoftwareModuleIdsAndTargetVisible(Collection<Long> moduleIds);
|
||||
|
||||
/**
|
||||
@@ -196,6 +208,48 @@ public interface SoftwareModuleManagement extends RepositoryManagement<SoftwareM
|
||||
* @return count of {@link SoftwareModule}s that are assigned to given {@link DistributionSet}.
|
||||
* @throws EntityNotFoundException if distribution set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
long countByAssignedTo(long distributionSetId);
|
||||
|
||||
@SuperBuilder
|
||||
@Getter
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
final class Create extends UpdateCreate {
|
||||
|
||||
private boolean encrypted;
|
||||
}
|
||||
|
||||
@SuperBuilder
|
||||
@Getter
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
final class Update extends UpdateCreate implements Identifiable<Long> {
|
||||
|
||||
@NotNull
|
||||
private Long id;
|
||||
@Builder.Default
|
||||
private Boolean locked = false;
|
||||
}
|
||||
|
||||
@SuperBuilder
|
||||
@Getter
|
||||
class UpdateCreate {
|
||||
|
||||
@ValidString
|
||||
@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE)
|
||||
@NotNull(groups = Create.class)
|
||||
private String name;
|
||||
@ValidString
|
||||
@Size(min = 1, max = NamedVersionedEntity.VERSION_MAX_SIZE)
|
||||
@NotNull(groups = Create.class)
|
||||
private String version;
|
||||
@ValidString
|
||||
@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE)
|
||||
private String description;
|
||||
@ValidString
|
||||
@Size(max = SoftwareModule.VENDOR_MAX_SIZE)
|
||||
private String vendor;
|
||||
private SoftwareModuleType type;
|
||||
}
|
||||
}
|
||||
@@ -12,30 +12,78 @@ package org.eclipse.hawkbit.repository;
|
||||
import java.util.Optional;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.eclipse.hawkbit.im.authentication.SpringEvalExpressions;
|
||||
import org.eclipse.hawkbit.repository.builder.SoftwareModuleTypeCreate;
|
||||
import org.eclipse.hawkbit.repository.builder.SoftwareModuleTypeUpdate;
|
||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.eclipse.hawkbit.repository.model.Type;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
/**
|
||||
* Service for managing {@link SoftwareModuleType}s.
|
||||
*/
|
||||
public interface SoftwareModuleTypeManagement
|
||||
extends RepositoryManagement<SoftwareModuleType, SoftwareModuleTypeCreate, SoftwareModuleTypeUpdate> {
|
||||
public interface SoftwareModuleTypeManagement<T extends SoftwareModuleType>
|
||||
extends RepositoryManagement<T, SoftwareModuleTypeManagement.Create, SoftwareModuleTypeManagement.Update> {
|
||||
|
||||
/**
|
||||
* @param key to search for
|
||||
* @return {@link SoftwareModuleType} in the repository with given {@link SoftwareModuleType#getKey()}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Optional<SoftwareModuleType> findByKey(@NotEmpty String key);
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
Optional<T> findByKey(@NotEmpty String key);
|
||||
|
||||
/**
|
||||
* @param name to search for
|
||||
* @return all {@link SoftwareModuleType}s in the repository with given {@link SoftwareModuleType#getName()}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Optional<SoftwareModuleType> findByName(@NotEmpty String name);
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
Optional<T> findByName(@NotEmpty String name);
|
||||
|
||||
@SuperBuilder
|
||||
@Getter
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
final class Create extends UpdateCreate {
|
||||
|
||||
@Size(min = 1, max = Type.KEY_MAX_SIZE)
|
||||
@NotNull
|
||||
private String key;
|
||||
|
||||
@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE)
|
||||
@NotNull
|
||||
private String name;
|
||||
|
||||
@Builder.Default
|
||||
private int maxAssignments = 1;
|
||||
}
|
||||
|
||||
@SuperBuilder
|
||||
@Getter
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
final class Update extends UpdateCreate implements Identifiable<Long> {
|
||||
|
||||
@NotNull
|
||||
private Long id;
|
||||
}
|
||||
|
||||
@SuperBuilder
|
||||
@Getter
|
||||
class UpdateCreate {
|
||||
|
||||
@ValidString
|
||||
@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE)
|
||||
private String description;
|
||||
|
||||
@ValidString
|
||||
@Size(max = Type.COLOUR_MAX_SIZE)
|
||||
private String colour;
|
||||
}
|
||||
}
|
||||
@@ -76,7 +76,7 @@ public interface SystemManagement {
|
||||
/**
|
||||
* @return {@link TenantMetaData} of {@link TenantAware#getCurrentTenant()}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.HAS_AUTH_READ_TARGET + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION_READ + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.IS_CONTROLLER)
|
||||
@@ -85,7 +85,7 @@ public interface SystemManagement {
|
||||
/**
|
||||
* @return {@link TenantMetaData} of {@link TenantAware#getCurrentTenant()} without details ({@link TenantMetaData#getDefaultDsType()})
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.HAS_AUTH_READ_TARGET + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION_READ + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.IS_CONTROLLER)
|
||||
@@ -118,4 +118,4 @@ public interface SystemManagement {
|
||||
|
||||
@PreAuthorize(SpringEvalExpressions.IS_SYSTEM_CODE)
|
||||
TenantMetaData getTenantMetadata(long tenantId);
|
||||
}
|
||||
}
|
||||
@@ -15,12 +15,12 @@ import static org.eclipse.hawkbit.im.authentication.SpringEvalExpressions.HAS_AU
|
||||
import static org.eclipse.hawkbit.im.authentication.SpringEvalExpressions.HAS_AUTH_CREATE_TARGET;
|
||||
import static org.eclipse.hawkbit.im.authentication.SpringEvalExpressions.HAS_AUTH_DELETE_TARGET;
|
||||
import static org.eclipse.hawkbit.im.authentication.SpringEvalExpressions.HAS_AUTH_PREFIX;
|
||||
import static org.eclipse.hawkbit.im.authentication.SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY;
|
||||
import static org.eclipse.hawkbit.im.authentication.SpringEvalExpressions.HAS_READ_REPOSITORY;
|
||||
import static org.eclipse.hawkbit.im.authentication.SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET;
|
||||
import static org.eclipse.hawkbit.im.authentication.SpringEvalExpressions.HAS_AUTH_READ_TARGET;
|
||||
import static org.eclipse.hawkbit.im.authentication.SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ_AND_TARGET_READ;
|
||||
import static org.eclipse.hawkbit.im.authentication.SpringEvalExpressions.HAS_AUTH_SUFFIX;
|
||||
import static org.eclipse.hawkbit.im.authentication.SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY;
|
||||
import static org.eclipse.hawkbit.im.authentication.SpringEvalExpressions.HAS_UPDATE_REPOSITORY;
|
||||
import static org.eclipse.hawkbit.im.authentication.SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -752,7 +752,7 @@ public interface TargetManagement {
|
||||
* @throws EntityAlreadyExistsException in case one of the metad-ata entry already exists for the specific key
|
||||
* @throws AssignmentQuotaExceededException if the maximum number of meta-data entries is exceeded for the addressed {@link Target}
|
||||
*/
|
||||
@PreAuthorize(HAS_AUTH_UPDATE_REPOSITORY)
|
||||
@PreAuthorize(HAS_UPDATE_REPOSITORY)
|
||||
void createMetadata(@NotEmpty String controllerId, @NotEmpty Map<String, String> metadata);
|
||||
|
||||
/**
|
||||
@@ -762,7 +762,7 @@ public interface TargetManagement {
|
||||
* @return the found target meta-data
|
||||
* @throws EntityNotFoundException if target with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(HAS_AUTH_READ_REPOSITORY)
|
||||
@PreAuthorize(HAS_READ_REPOSITORY)
|
||||
Map<String, String> getMetadata(@NotEmpty String controllerId);
|
||||
|
||||
/**
|
||||
@@ -773,7 +773,7 @@ public interface TargetManagement {
|
||||
* @param value meta data-entry to be new value
|
||||
* @throws EntityNotFoundException in case the meta-data entry does not exist and cannot be updated
|
||||
*/
|
||||
@PreAuthorize(HAS_AUTH_UPDATE_REPOSITORY)
|
||||
@PreAuthorize(HAS_UPDATE_REPOSITORY)
|
||||
void updateMetadata(@NotEmpty String controllerId, @NotNull String key, @NotNull String value);
|
||||
|
||||
/**
|
||||
@@ -783,6 +783,6 @@ public interface TargetManagement {
|
||||
* @param key of the meta data element
|
||||
* @throws EntityNotFoundException if given target does not exist
|
||||
*/
|
||||
@PreAuthorize(HAS_AUTH_UPDATE_REPOSITORY)
|
||||
@PreAuthorize(HAS_UPDATE_REPOSITORY)
|
||||
void deleteMetadata(@NotEmpty String controllerId, @NotEmpty String key);
|
||||
}
|
||||
@@ -25,6 +25,7 @@ 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.Tag;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -53,7 +54,7 @@ public interface TargetTagManagement {
|
||||
* @throws ConstraintViolationException if fields are not filled as specified. Check {@link TagCreate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
|
||||
TargetTag create(@NotNull @Valid TagCreate create);
|
||||
TargetTag create(@NotNull @Valid TagCreate<Tag> create);
|
||||
|
||||
/**
|
||||
* Created multiple {@link TargetTag}s.
|
||||
@@ -64,7 +65,7 @@ public interface TargetTagManagement {
|
||||
* @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 @Valid Collection<TagCreate> creates);
|
||||
List<TargetTag> create(@NotNull @Valid Collection<TagCreate<Tag>> creates);
|
||||
|
||||
/**
|
||||
* Deletes {@link TargetTag} with given name.
|
||||
|
||||
@@ -25,7 +25,7 @@ public interface TenantStatsManagement {
|
||||
* @return collected statistics
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_SYSTEM_ADMIN + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.HAS_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.HAS_AUTH_READ_TARGET + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION_READ + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.IS_SYSTEM_CODE)
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
|
||||
/**
|
||||
* Builder for {@link DistributionSet}.
|
||||
*/
|
||||
public interface DistributionSetBuilder {
|
||||
|
||||
/**
|
||||
* @param id of the updatable entity
|
||||
* @return builder instance
|
||||
*/
|
||||
DistributionSetUpdate update(long id);
|
||||
|
||||
/**
|
||||
* @return builder instance
|
||||
*/
|
||||
DistributionSetCreate create();
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||
import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
|
||||
import org.eclipse.hawkbit.repository.model.Type;
|
||||
|
||||
/**
|
||||
* Builder to create a new {@link DistributionSet} entry. Defines all fields
|
||||
* that can be set at creation time. Other fields are set by the repository
|
||||
* automatically, e.g. {@link BaseEntity#getCreatedAt()}.
|
||||
*/
|
||||
public interface DistributionSetCreate {
|
||||
|
||||
/**
|
||||
* @param name for {@link DistributionSet#getName()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
DistributionSetCreate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name);
|
||||
|
||||
/**
|
||||
* @param version for {@link DistributionSet#getVersion()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
DistributionSetCreate version(@Size(min = 1, max = NamedVersionedEntity.VERSION_MAX_SIZE) @NotNull String version);
|
||||
|
||||
/**
|
||||
* @param description for {@link DistributionSet#getDescription()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
DistributionSetCreate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
|
||||
|
||||
/**
|
||||
* @param typeKey for {@link DistributionSet#getType()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
DistributionSetCreate type(@Size(min = 1, max = Type.KEY_MAX_SIZE) @NotNull String typeKey);
|
||||
|
||||
/**
|
||||
* @param type for {@link DistributionSet#getType()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
default DistributionSetCreate type(@NotNull final DistributionSetType type) {
|
||||
return type(type.getKey());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param modules for {@link DistributionSet#getModules()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
DistributionSetCreate modules(Collection<Long> modules);
|
||||
|
||||
/**
|
||||
* @param requiredMigrationStep for {@link DistributionSet#isRequiredMigrationStep()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
DistributionSetCreate requiredMigrationStep(Boolean requiredMigrationStep);
|
||||
|
||||
/**
|
||||
* @return peek on current state of {@link DistributionSet} in the builder
|
||||
*/
|
||||
DistributionSet build();
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||
|
||||
/**
|
||||
* Builder for {@link DistributionSetType}.
|
||||
*/
|
||||
public interface DistributionSetTypeBuilder {
|
||||
|
||||
/**
|
||||
* @param id of the updatable entity
|
||||
* @return builder instance
|
||||
*/
|
||||
DistributionSetTypeUpdate update(long id);
|
||||
|
||||
/**
|
||||
* @return builder instance
|
||||
*/
|
||||
DistributionSetTypeCreate create();
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Optional;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.eclipse.hawkbit.repository.model.Type;
|
||||
|
||||
/**
|
||||
* Builder to create a new {@link DistributionSetType} entry. Defines all fields
|
||||
* that can be set at creation time. Other fields are set by the repository
|
||||
* automatically, e.g. {@link BaseEntity#getCreatedAt()}.
|
||||
*/
|
||||
public interface DistributionSetTypeCreate {
|
||||
|
||||
/**
|
||||
* @param key for {@link DistributionSetType#getKey()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
DistributionSetTypeCreate key(@Size(min = 1, max = Type.KEY_MAX_SIZE) @NotNull String key);
|
||||
|
||||
/**
|
||||
* @param name for {@link DistributionSetType#getName()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
DistributionSetTypeCreate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name);
|
||||
|
||||
/**
|
||||
* @param description for {@link DistributionSetType#getDescription()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
DistributionSetTypeCreate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
|
||||
|
||||
/**
|
||||
* @param colour for {@link DistributionSetType#getColour()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
DistributionSetTypeCreate colour(@Size(max = Type.COLOUR_MAX_SIZE) String colour);
|
||||
|
||||
/**
|
||||
* @param mandatory for {@link DistributionSetType#getMandatoryModuleTypes()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
DistributionSetTypeCreate mandatory(Collection<Long> mandatory);
|
||||
|
||||
/**
|
||||
* @param mandatory for {@link DistributionSetType#getMandatoryModuleTypes()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
default DistributionSetTypeCreate mandatory(final Long mandatory) {
|
||||
return mandatory(Collections.singletonList(mandatory));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mandatory for {@link DistributionSetType#getOptionalModuleTypes()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
default DistributionSetTypeCreate mandatory(final SoftwareModuleType mandatory) {
|
||||
return mandatory(Optional.ofNullable(mandatory).map(SoftwareModuleType::getId).orElse(null));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param optional for {@link DistributionSetType#getOptionalModuleTypes()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
DistributionSetTypeCreate optional(Collection<Long> optional);
|
||||
|
||||
/**
|
||||
* @param optional for {@link DistributionSetType#getOptionalModuleTypes()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
default DistributionSetTypeCreate optional(final Long optional) {
|
||||
return optional(Collections.singletonList(optional));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param optional for {@link DistributionSetType#getOptionalModuleTypes()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
default DistributionSetTypeCreate optional(final SoftwareModuleType optional) {
|
||||
return optional(Optional.ofNullable(optional).map(SoftwareModuleType::getId).orElse(null));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return peek on current state of {@link DistributionSetType} in the builder
|
||||
*/
|
||||
DistributionSetType build();
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||
import org.eclipse.hawkbit.repository.model.Type;
|
||||
|
||||
/**
|
||||
* Builder to update an existing {@link DistributionSetType} entry. Defines all
|
||||
* fields that can be updated.
|
||||
*/
|
||||
public interface DistributionSetTypeUpdate {
|
||||
|
||||
/**
|
||||
* @param description for {@link DistributionSetType#getDescription()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
DistributionSetTypeUpdate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
|
||||
|
||||
/**
|
||||
* @param colour for {@link DistributionSetType#getColour()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
DistributionSetTypeUpdate colour(@Size(max = Type.COLOUR_MAX_SIZE) String colour);
|
||||
|
||||
/**
|
||||
* @param mandatory for {@link DistributionSetType#getMandatoryModuleTypes()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
DistributionSetTypeUpdate mandatory(Collection<Long> mandatory);
|
||||
|
||||
/**
|
||||
* @param optional for {@link DistributionSetType#getOptionalModuleTypes()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
DistributionSetTypeUpdate optional(Collection<Long> optional);
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Null;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||
import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
|
||||
|
||||
/**
|
||||
* Builder to update an existing {@link DistributionSet} entry. Defines all fields that can be updated.
|
||||
*/
|
||||
public interface DistributionSetUpdate {
|
||||
|
||||
/**
|
||||
* @param name for {@link DistributionSet#getName()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
DistributionSetUpdate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name);
|
||||
|
||||
/**
|
||||
* @param version for {@link DistributionSet#getVersion()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
DistributionSetUpdate version(@Size(min = 1, max = NamedVersionedEntity.VERSION_MAX_SIZE) @NotNull String version);
|
||||
|
||||
/**
|
||||
* @param description for {@link DistributionSet#getDescription()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
DistributionSetUpdate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
|
||||
|
||||
/**
|
||||
* @param locked update request if any. If not empty shall be <code>true</code>
|
||||
* @return updated builder instance
|
||||
*/
|
||||
DistributionSetUpdate locked(@Null Boolean locked);
|
||||
|
||||
/**
|
||||
* @param requiredMigrationStep for {@link DistributionSet#isRequiredMigrationStep()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
DistributionSetUpdate requiredMigrationStep(Boolean requiredMigrationStep);
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
|
||||
/**
|
||||
* Builder for {@link SoftwareModule}.
|
||||
*/
|
||||
public interface SoftwareModuleBuilder {
|
||||
|
||||
/**
|
||||
* @param id of the updatable entity
|
||||
* @return builder instance
|
||||
*/
|
||||
SoftwareModuleUpdate update(long id);
|
||||
|
||||
/**
|
||||
* @return builder instance
|
||||
*/
|
||||
SoftwareModuleCreate create();
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||
import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.eclipse.hawkbit.repository.model.Type;
|
||||
|
||||
/**
|
||||
* Builder to create a new {@link SoftwareModule} entry. Defines all fields that
|
||||
* can be set at creation time. Other fields are set by the repository
|
||||
* automatically, e.g. {@link BaseEntity#getCreatedAt()}.
|
||||
*/
|
||||
public interface SoftwareModuleCreate {
|
||||
|
||||
/**
|
||||
* @param name for {@link SoftwareModule#getName()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
SoftwareModuleCreate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name);
|
||||
|
||||
/**
|
||||
* @param version for {@link SoftwareModule#getVersion()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
SoftwareModuleCreate version(@Size(min = 1, max = NamedVersionedEntity.VERSION_MAX_SIZE) @NotNull String version);
|
||||
|
||||
/**
|
||||
* @param description for {@link SoftwareModule#getDescription()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
SoftwareModuleCreate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
|
||||
|
||||
/**
|
||||
* @param vendor for {@link SoftwareModule#getVendor()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
SoftwareModuleCreate vendor(@Size(max = SoftwareModule.VENDOR_MAX_SIZE) String vendor);
|
||||
|
||||
/**
|
||||
* @param typeKey for {@link SoftwareModule#getType()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
SoftwareModuleCreate type(@Size(min = 1, max = Type.KEY_MAX_SIZE) @NotNull String typeKey);
|
||||
|
||||
/**
|
||||
* @param type for {@link SoftwareModule#getType()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
default SoftwareModuleCreate type(@NotNull final SoftwareModuleType type) {
|
||||
return type(type.getKey());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param encrypted if should be encrypted
|
||||
* @return updated builder instance
|
||||
*/
|
||||
SoftwareModuleCreate encrypted(boolean encrypted);
|
||||
|
||||
/**
|
||||
* @return peek on current state of {@link SoftwareModule} in the builder
|
||||
*/
|
||||
SoftwareModule build();
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
|
||||
/**
|
||||
* Builder for {@link SoftwareModuleType}.
|
||||
*/
|
||||
public interface SoftwareModuleTypeBuilder {
|
||||
|
||||
/**
|
||||
* @param id of the updatable entity
|
||||
* @return builder instance
|
||||
*/
|
||||
SoftwareModuleTypeUpdate update(long id);
|
||||
|
||||
/**
|
||||
* @return builder instance
|
||||
*/
|
||||
SoftwareModuleTypeCreate create();
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.eclipse.hawkbit.repository.model.Type;
|
||||
|
||||
/**
|
||||
* Builder to create a new {@link SoftwareModuleType} entry. Defines all fields
|
||||
* that can be set at creation time. Other fields are set by the repository
|
||||
* automatically, e.g. {@link BaseEntity#getCreatedAt()}.
|
||||
*/
|
||||
public interface SoftwareModuleTypeCreate {
|
||||
|
||||
/**
|
||||
* @param key for {@link SoftwareModuleType#getKey()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
SoftwareModuleTypeCreate key(@Size(min = 1, max = Type.KEY_MAX_SIZE) @NotNull String key);
|
||||
|
||||
/**
|
||||
* @param name for {@link SoftwareModuleType#getName()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
SoftwareModuleTypeCreate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name);
|
||||
|
||||
/**
|
||||
* @param description for {@link SoftwareModuleType#getDescription()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
SoftwareModuleTypeCreate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
|
||||
|
||||
/**
|
||||
* @param colour for {@link SoftwareModuleType#getColour()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
SoftwareModuleTypeCreate colour(@Size(max = Type.COLOUR_MAX_SIZE) String colour);
|
||||
|
||||
/**
|
||||
* @param maxAssignments for {@link SoftwareModuleType#getMaxAssignments()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
SoftwareModuleTypeCreate maxAssignments(int maxAssignments);
|
||||
|
||||
/**
|
||||
* @return peek on current state of {@link SoftwareModuleType} in the
|
||||
* builder
|
||||
*/
|
||||
SoftwareModuleType build();
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.eclipse.hawkbit.repository.model.Type;
|
||||
|
||||
/**
|
||||
* Builder to update an existing {@link SoftwareModuleType} entry. Defines all
|
||||
* fields that can be updated.
|
||||
*/
|
||||
public interface SoftwareModuleTypeUpdate {
|
||||
|
||||
/**
|
||||
* @param description for {@link SoftwareModuleType#getDescription()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
SoftwareModuleTypeUpdate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
|
||||
|
||||
/**
|
||||
* @param colour for {@link SoftwareModuleType#getColour()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
SoftwareModuleTypeUpdate colour(@Size(max = Type.COLOUR_MAX_SIZE) String colour);
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
import jakarta.validation.constraints.Null;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
|
||||
/**
|
||||
* Builder to update an existing {@link SoftwareModule} entry. Defines all
|
||||
* fields that can be updated.
|
||||
*/
|
||||
public interface SoftwareModuleUpdate {
|
||||
|
||||
/**
|
||||
* @param description for {@link SoftwareModule#getDescription()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
SoftwareModuleUpdate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
|
||||
|
||||
/**
|
||||
* @param vendor for {@link SoftwareModule#getVendor()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
SoftwareModuleUpdate vendor(@Size(max = SoftwareModule.VENDOR_MAX_SIZE) String vendor);
|
||||
|
||||
/**
|
||||
* @param locked update request if any. If not empty shall be <code>true</code>
|
||||
* @return updated builder instance
|
||||
*/
|
||||
SoftwareModuleUpdate locked(@Null Boolean locked);
|
||||
}
|
||||
@@ -14,7 +14,7 @@ import org.eclipse.hawkbit.repository.model.Tag;
|
||||
/**
|
||||
* Builder for {@link Tag}.
|
||||
*/
|
||||
public interface TagBuilder {
|
||||
public interface TagBuilder<T extends Tag> {
|
||||
|
||||
/**
|
||||
* @param id of the updatable entity
|
||||
@@ -25,5 +25,5 @@ public interface TagBuilder {
|
||||
/**
|
||||
* @return builder instance
|
||||
*/
|
||||
TagCreate create();
|
||||
TagCreate<T> create();
|
||||
}
|
||||
@@ -21,28 +21,28 @@ import org.eclipse.hawkbit.repository.model.Tag;
|
||||
* at creation time. Other fields are set by the repository automatically, e.g.
|
||||
* {@link BaseEntity#getCreatedAt()}.
|
||||
*/
|
||||
public interface TagCreate {
|
||||
public interface TagCreate<T extends Tag> {
|
||||
|
||||
/**
|
||||
* @param name for {@link Tag#getName()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
TagCreate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name);
|
||||
TagCreate<T> name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name);
|
||||
|
||||
/**
|
||||
* @param description for {@link Tag#getDescription()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
TagCreate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
|
||||
TagCreate<T> description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
|
||||
|
||||
/**
|
||||
* @param colour for {@link Tag#getColour()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
TagCreate colour(@Size(max = Tag.COLOUR_MAX_SIZE) String colour);
|
||||
TagCreate<T> colour(@Size(max = Tag.COLOUR_MAX_SIZE) String colour);
|
||||
|
||||
/**
|
||||
* @return peek on current state of {@link Tag} in the builder
|
||||
*/
|
||||
Tag build();
|
||||
T build();
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
@@ -19,6 +21,8 @@ import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
* Exception indicating that an artifact's binary does not exist anymore. This
|
||||
* might be caused due to the soft deletion of a {@link SoftwareModule}.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ArtifactBinaryNoLongerExistsException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -11,9 +11,13 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public final class ArtifactBinaryNotFoundException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -11,12 +11,16 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* Thrown if artifact deletion failed.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public final class ArtifactDeleteFailedException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -11,9 +11,13 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public final class ArtifactUploadFailedException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||
@@ -16,6 +18,8 @@ import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||
/**
|
||||
* Thrown if assignment quota is exceeded
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class AssignmentQuotaExceededException extends AbstractServerRtException {
|
||||
|
||||
private static final String ASSIGNMENT_QUOTA_EXCEEDED_MESSAGE = "Quota exceeded: Cannot assign %s more %s entities to %s '%s'. The maximum is %s.";
|
||||
|
||||
@@ -11,15 +11,17 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* The {@link AutoConfirmationAlreadyActiveException} is thrown when auto
|
||||
* confirmation is already active for a device but the
|
||||
* {@link org.eclipse.hawkbit.repository.ConfirmationManagement#activateAutoConfirmation}
|
||||
* is getting called.
|
||||
* The {@link AutoConfirmationAlreadyActiveException} is thrown when auto confirmation is already active for a device but the
|
||||
* {@link org.eclipse.hawkbit.repository.ConfirmationManagement#activateAutoConfirmation} is getting called.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class AutoConfirmationAlreadyActiveException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -11,15 +11,17 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* Thrown if cancellation of action is requested where the action cannot be
|
||||
* cancelled (e.g. the action is not active or is already a canceled action) or
|
||||
* controller provides cancellation feedback on an action that is actually not
|
||||
* in canceling state.
|
||||
* Thrown if cancellation of action is requested where the action cannot be cancelled (e.g. the action is not active or is already a canceled
|
||||
* action) or controller provides cancellation feedback on an action that is actually not in canceling state.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public final class CancelActionNotAllowedException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -11,14 +11,17 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* {@link ConcurrentModificationException} is thrown when a given entity in's
|
||||
* actual and cannot be stored within the current session. Reason could be that
|
||||
* it has been changed within another session.
|
||||
* {@link ConcurrentModificationException} is thrown when a given entity in's actual and cannot be stored within the current session.
|
||||
* Reason could be that it has been changed within another session.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ConcurrentModificationException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -11,6 +11,8 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||
@@ -18,6 +20,8 @@ import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||
/**
|
||||
* Thrown if assignment quota is exceeded
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DeletedException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -11,15 +11,18 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||
|
||||
/**
|
||||
* Thrown if the user tries to assign modules to a {@link DistributionSet} that
|
||||
* has to {@link DistributionSetType} defined.
|
||||
* Thrown if the user tries to assign modules to a {@link DistributionSet} that has to {@link DistributionSetType} defined.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DistributionSetTypeUndefinedException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -11,13 +11,17 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* the {@link EntityAlreadyExistsException} is thrown when an entity is tried to
|
||||
* be saved which already exists or which violates unique key constraints.
|
||||
* the {@link EntityAlreadyExistsException} is thrown when an entity is tried to be saved which already exists or which violates unique key
|
||||
* constraints.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class EntityAlreadyExistsException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -14,7 +14,10 @@ import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||
@@ -22,14 +25,18 @@ import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||
/**
|
||||
* the {@link EntityNotFoundException} is thrown when a entity queried but not found.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Getter
|
||||
public class EntityNotFoundException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public static final String KEY = "key";
|
||||
public static final String ENTITY_ID = "entityId";
|
||||
public static final String TYPE = "type";
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final SpServerError THIS_ERROR = SpServerError.SP_REPO_ENTITY_NOT_EXISTS;
|
||||
private static final int ENTITY_STRING_MAX_LENGTH = 100;
|
||||
|
||||
|
||||
@@ -11,13 +11,16 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* the {@link EntityReadOnlyException} is thrown when a entity is in read only
|
||||
* mode and a user tries to change it.
|
||||
* the {@link EntityReadOnlyException} is thrown when a entity is in read only mode and a user tries to change it.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class EntityReadOnlyException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -12,6 +12,7 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
import static org.eclipse.hawkbit.repository.SizeConversionHelper.byteValueToReadableString;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
@@ -19,6 +20,7 @@ import org.eclipse.hawkbit.exception.SpServerError;
|
||||
* Thrown if file size quota is exceeded
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class FileSizeQuotaExceededException extends AbstractServerRtException {
|
||||
|
||||
private static final String MAX_ARTIFACT_SIZE_EXCEEDED = "Maximum artifact size (%s) exceeded.";
|
||||
|
||||
@@ -11,12 +11,16 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* Thrown when force quitting an actions is not allowed. e.g. the action is not active, or it is not canceled before.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public final class ForceQuitActionNotAllowedException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
@@ -24,6 +25,7 @@ import org.eclipse.hawkbit.repository.model.TargetType;
|
||||
* Thrown if user tries to assign a {@link DistributionSet} to a {@link Target} that has an incompatible {@link TargetType}
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class IncompatibleTargetTypeException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -11,13 +11,16 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* Thrown if a distribution set is assigned to a a target that is incomplete
|
||||
* (i.e. mandatory modules are missing).
|
||||
* Thrown if a distribution set is assigned to a target that is incomplete (i.e. mandatory modules are missing).
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public final class IncompleteDistributionSetException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -11,35 +11,30 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* Exception which is thrown in case the current security context object does
|
||||
* not hold a required authority/permission.
|
||||
* Exception which is thrown in case the current security context object does not hold a required authority/permission.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InsufficientPermissionException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* creates new InsufficientPermissionException.
|
||||
*
|
||||
* @param cause the cause of the exception
|
||||
*/
|
||||
public InsufficientPermissionException(final Throwable cause) {
|
||||
super(SpServerError.SP_INSUFFICIENT_PERMISSION, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* creates new InsufficientPermissionException.
|
||||
*/
|
||||
public InsufficientPermissionException(final String message) {
|
||||
super(message, SpServerError.SP_INSUFFICIENT_PERMISSION);
|
||||
}
|
||||
|
||||
public InsufficientPermissionException() {
|
||||
super(SpServerError.SP_INSUFFICIENT_PERMISSION, null);
|
||||
this((String)null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,12 +12,16 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* Thrown if an action type for auto-assignment is neither 'forced', nor 'soft'.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InvalidAutoAssignActionTypeException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -12,6 +12,7 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
@@ -20,6 +21,7 @@ import org.eclipse.hawkbit.exception.SpServerError;
|
||||
* listed as enum {@link Reason}.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InvalidConfirmationFeedbackException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -11,9 +11,13 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InvalidDistributionSetException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -11,12 +11,16 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* Thrown if MD5 checksum check fails.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InvalidMD5HashException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -12,6 +12,7 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
@@ -21,6 +22,7 @@ import org.eclipse.hawkbit.exception.SpServerError;
|
||||
* time.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InvalidMaintenanceScheduleException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -11,12 +11,16 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* Thrown if SHA1 checksum check fails.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InvalidSHA1HashException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -11,12 +11,16 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* Thrown if SHA256 checksum check fails.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InvalidSHA256HashException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -11,12 +11,16 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* Exception which is thrown when trying to set an invalid target address.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InvalidTargetAddressException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -12,9 +12,13 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InvalidTargetAttributeException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -11,13 +11,16 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* The {@link #InvalidTenantConfigurationKeyException} is thrown when an invalid
|
||||
* configuration key is used.
|
||||
* The {@link #InvalidTenantConfigurationKeyException} is thrown when an invalid configuration key is used.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InvalidTenantConfigurationKeyException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -11,6 +11,8 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||
@@ -18,6 +20,8 @@ import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||
/**
|
||||
* Thrown if there is attempt to functionally modify a locked entity
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class LockedException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -11,12 +11,16 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* Thrown if repository operation is no longer supported.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public final class MethodNotSupportedException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -11,13 +11,16 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* This exception is thrown if an operation requires multiassignments, but the
|
||||
* feature is not enabled.
|
||||
* This exception is thrown if an operation requires multi-assignments, but the feature is not enabled.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MultiAssignmentIsNotEnabledException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -11,13 +11,16 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* This exception is thrown if multi assignments is enabled and an target
|
||||
* distribution set assignment request does not contain a weight value
|
||||
* This exception is thrown if multi assignments is enabled and a target distribution set assignment request does not contain a weight value
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class NoWeightProvidedInMultiAssignmentModeException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -19,8 +19,8 @@ import org.eclipse.hawkbit.exception.SpServerError;
|
||||
/**
|
||||
* Exception used by the REST API in case of RSQL search filter query.
|
||||
*/
|
||||
@ToString(callSuper = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class RSQLParameterSyntaxException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -19,8 +19,8 @@ import org.eclipse.hawkbit.exception.SpServerError;
|
||||
/**
|
||||
* Exception used by the REST API in case of invalid field name in the rsql search parameter.
|
||||
*/
|
||||
@ToString(callSuper = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class RSQLParameterUnsupportedFieldException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -11,14 +11,17 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* the {@link RolloutIllegalStateException} is thrown when a rollout is changing
|
||||
* it's state which is not valid. E.g. trying to start a already running
|
||||
* rollout, or trying to resume a already finished rollout.
|
||||
* the {@link RolloutIllegalStateException} is thrown when a rollout is changing it's state which is not valid. E.g. trying to start an already
|
||||
* running rollout, or trying to resume a already finished rollout.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class RolloutIllegalStateException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -12,6 +12,8 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
import java.io.Serial;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.repository.model.Action;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
|
||||
@@ -19,6 +21,8 @@ import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
* the {@link SoftwareModuleNotAssignedToTargetException} is thrown when a {@link SoftwareModule} is requested as part of an {@link Action}
|
||||
* that has however never been assigned to the {@link Target}.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class SoftwareModuleNotAssignedToTargetException extends EntityNotFoundException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -11,16 +11,18 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
|
||||
/**
|
||||
* the {@link SoftwareModuleTypeNotInDistributionSetTypeException} is thrown
|
||||
* when a {@link SoftwareModuleType} is requested as part of a
|
||||
* {@link DistributionSetType} but actually neither
|
||||
* {@link DistributionSetType#getMandatoryModuleTypes()} or
|
||||
* The {@link SoftwareModuleTypeNotInDistributionSetTypeException} is thrown when a {@link SoftwareModuleType} is requested as part of a
|
||||
* {@link DistributionSetType} but actually neither {@link DistributionSetType#getMandatoryModuleTypes()} or
|
||||
* {@link DistributionSetType#getOptionalModuleTypes()}.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class SoftwareModuleTypeNotInDistributionSetTypeException extends EntityNotFoundException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -11,14 +11,17 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* {@link StopRolloutException} is thrown when an error occurs while stopping
|
||||
* the rollout (due to an invalidation of distribution set). This could be
|
||||
* caused by a long ongoing creation of a rollout.
|
||||
* {@link StopRolloutException} is thrown when an error occurs while stopping the rollout (due to an invalidation of distribution set).
|
||||
* This could be caused by a long ongoing creation of a rollout.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class StopRolloutException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -12,6 +12,7 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
import static org.eclipse.hawkbit.repository.SizeConversionHelper.byteValueToReadableString;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
@@ -19,6 +20,7 @@ import org.eclipse.hawkbit.exception.SpServerError;
|
||||
* Thrown if storage quota is exceeded
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class StorageQuotaExceededException extends AbstractServerRtException {
|
||||
|
||||
private static final String MAX_ARTIFACT_SIZE_TOTAL_EXCEEDED = "Storage quota exceeded, %s left.";
|
||||
|
||||
@@ -11,12 +11,16 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* Thrown if target type is assigned
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class TargetTypeInUseException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -11,12 +11,16 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* Thrown if tried creation of type with no key nor name.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class TargetTypeKeyOrNameRequiredException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -11,13 +11,16 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* Exception which is thrown, when the validation of the configuration value has
|
||||
* not been successful.
|
||||
* Exception which is thrown, when the validation of the configuration value has not been successful.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class TenantConfigurationValidatorException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -11,12 +11,16 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* Exception which is supposed to be thrown if a property value is valid but cannot be set in the current context.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class TenantConfigurationValueChangeNotAllowedException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -11,15 +11,17 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* the {@link TenantNotExistException} is thrown when e.g. a controller tries to
|
||||
* register itself at SP as plug'n play target and the tenant specified in the
|
||||
* URL for this target does not exist. To avoid that targets could register
|
||||
* automatically new tenants.
|
||||
* The {@link TenantNotExistException} is thrown when e.g. a controller tries to register itself at SP as plug'n play target and the tenant
|
||||
* specified in the URL for this target does not exist. To avoid that targets could register automatically new tenants.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class TenantNotExistException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -11,6 +11,8 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
@@ -18,10 +20,10 @@ import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
|
||||
/**
|
||||
* Thrown if user tries to add a {@link SoftwareModule} to a
|
||||
* {@link DistributionSet} that is not defined by the
|
||||
* {@link DistributionSetType}.
|
||||
* Thrown if user tries to add a {@link SoftwareModule} to a {@link DistributionSet} that is not defined by the {@link DistributionSetType}.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class UnsupportedSoftwareModuleForThisDistributionSetException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -74,14 +74,4 @@ public interface DistributionSet extends NamedVersionedEntity {
|
||||
* and not automatically canceled if overridden by a newer update.
|
||||
*/
|
||||
boolean isRequiredMigrationStep();
|
||||
|
||||
/**
|
||||
* Searches through modules for the given type.
|
||||
*
|
||||
* @param type to search for
|
||||
* @return SoftwareModule of given type
|
||||
*/
|
||||
default Optional<SoftwareModule> findFirstModuleByType(final SoftwareModuleType type) {
|
||||
return getModules().stream().filter(module -> module.getType().equals(type)).findAny();
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.eclipse.hawkbit.im.authentication.Hierarchy;
|
||||
import org.eclipse.hawkbit.tenancy.configuration.ControllerPollProperties;
|
||||
@@ -26,6 +27,8 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.expression.EvaluationContext;
|
||||
import org.springframework.security.access.PermissionEvaluator;
|
||||
import org.springframework.security.access.expression.DenyAllPermissionEvaluator;
|
||||
import org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler;
|
||||
import org.springframework.security.access.expression.method.MethodSecurityExpressionHandler;
|
||||
import org.springframework.security.access.expression.method.MethodSecurityExpressionOperations;
|
||||
@@ -40,6 +43,7 @@ import org.springframework.util.function.SingletonSupplier;
|
||||
/**
|
||||
* Default configuration that is common to all repository implementations.
|
||||
*/
|
||||
@Slf4j
|
||||
@Configuration
|
||||
@EnableMethodSecurity(proxyTargetClass = true, securedEnabled = true)
|
||||
@EnableConfigurationProperties({ RepositoryProperties.class, ControllerPollProperties.class, TenantConfigurationProperties.class })
|
||||
@@ -52,10 +56,37 @@ public class RepositoryConfiguration {
|
||||
return RoleHierarchyImpl.fromHierarchy(Hierarchy.DEFAULT);
|
||||
}
|
||||
|
||||
@Bean
|
||||
PermissionEvaluator permissionEvaluator(final RoleHierarchy roleHierarchy) {
|
||||
return new DenyAllPermissionEvaluator() {
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(final Authentication authentication, final Object targetDomainObject, final Object permission) {
|
||||
if (targetDomainObject instanceof MethodSecurityExpressionOperations root) {
|
||||
final String neededPermission =
|
||||
permission + "_" + (root.getThis() instanceof RepositoryManagement<?, ?, ?> repositoryManagement
|
||||
? repositoryManagement.permissionGroup()
|
||||
: "REPOSITORY"); // TODO - should not fall back here - all using parmissions should extend repository management interface
|
||||
final boolean hasPermission = roleHierarchy.getReachableGrantedAuthorities(authentication.getAuthorities()).stream()
|
||||
.map(GrantedAuthority::getAuthority)
|
||||
.anyMatch(authority -> authority.equals(neededPermission));
|
||||
if (!hasPermission) {
|
||||
log.debug(
|
||||
"User {} does not have permission {} for target {}",
|
||||
authentication.getName(), neededPermission, targetDomainObject);
|
||||
}
|
||||
return hasPermission;
|
||||
}
|
||||
return super.hasPermission(authentication, targetDomainObject, permission);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
MethodSecurityExpressionHandler methodSecurityExpressionHandler(
|
||||
final Optional<RoleHierarchy> roleHierarchy, final Optional<ApplicationContext> applicationContext) {
|
||||
final RoleHierarchy roleHierarchy, final PermissionEvaluator permissionEvaluator,
|
||||
final Optional<ApplicationContext> applicationContext) {
|
||||
final DefaultMethodSecurityExpressionHandler methodSecurityExpressionHandler = new DefaultMethodSecurityExpressionHandler() {
|
||||
|
||||
@Override
|
||||
@@ -69,7 +100,8 @@ public class RepositoryConfiguration {
|
||||
return super.createSecurityExpressionRoot(new RawAuthoritiesAuthentication(authentication), mi);
|
||||
}
|
||||
};
|
||||
roleHierarchy.ifPresent(methodSecurityExpressionHandler::setRoleHierarchy);
|
||||
methodSecurityExpressionHandler.setRoleHierarchy(roleHierarchy);
|
||||
methodSecurityExpressionHandler.setPermissionEvaluator(permissionEvaluator);
|
||||
applicationContext.ifPresent(methodSecurityExpressionHandler::setApplicationContext);
|
||||
return methodSecurityExpressionHandler;
|
||||
}
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Create and update builder DTO.
|
||||
*
|
||||
* @param <T> update or create builder interface
|
||||
*/
|
||||
public abstract class AbstractDistributionSetTypeUpdateCreate<T> extends AbstractTypeUpdateCreate<T> {
|
||||
|
||||
protected Collection<Long> mandatory;
|
||||
protected Collection<Long> optional;
|
||||
|
||||
public T mandatory(final Collection<Long> mandatory) {
|
||||
this.mandatory = mandatory;
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T optional(final Collection<Long> optional) {
|
||||
this.optional = optional;
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public Optional<Collection<Long>> getMandatory() {
|
||||
return Optional.ofNullable(mandatory);
|
||||
}
|
||||
|
||||
public Optional<Collection<Long>> getOptional() {
|
||||
return Optional.ofNullable(optional);
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Optional;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.eclipse.hawkbit.repository.ValidString;
|
||||
|
||||
/**
|
||||
* Create and update builder DTO.
|
||||
*
|
||||
* @param <T> update or create builder interface
|
||||
*/
|
||||
public abstract class AbstractDistributionSetUpdateCreate<T> extends AbstractNamedEntityBuilder<T> {
|
||||
|
||||
@ValidString
|
||||
protected String version;
|
||||
protected Boolean requiredMigrationStep;
|
||||
@Getter
|
||||
protected Collection<Long> modules;
|
||||
|
||||
public T modules(final Collection<Long> modules) {
|
||||
this.modules = modules;
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T requiredMigrationStep(final Boolean requiredMigrationStep) {
|
||||
this.requiredMigrationStep = requiredMigrationStep;
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public Boolean isRequiredMigrationStep() {
|
||||
return requiredMigrationStep;
|
||||
}
|
||||
|
||||
public T version(final String version) {
|
||||
this.version = strip(version);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public Optional<String> getVersion() {
|
||||
return Optional.ofNullable(version);
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
/**
|
||||
* Create and update builder DTO.
|
||||
*
|
||||
* @param <T> update or create builder interface
|
||||
*/
|
||||
public abstract class AbstractSoftwareModuleTypeUpdateCreate<T> extends AbstractTypeUpdateCreate<T> {
|
||||
|
||||
protected int maxAssignments = 1;
|
||||
|
||||
public T maxAssignments(final int maxAssignments) {
|
||||
this.maxAssignments = maxAssignments;
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public int getMaxAssignments() {
|
||||
return maxAssignments;
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.hawkbit.repository.ValidString;
|
||||
|
||||
/**
|
||||
* Create and update builder DTO.
|
||||
*
|
||||
* @param <T> update or create builder interface
|
||||
*/
|
||||
public abstract class AbstractSoftwareModuleUpdateCreate<T> extends AbstractNamedEntityBuilder<T> {
|
||||
|
||||
@ValidString
|
||||
protected String version;
|
||||
@ValidString
|
||||
protected String vendor;
|
||||
@ValidString
|
||||
protected String type;
|
||||
|
||||
public T type(final String type) {
|
||||
this.type = AbstractBaseEntityBuilder.strip(type);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public Optional<String> getType() {
|
||||
return Optional.ofNullable(type);
|
||||
}
|
||||
|
||||
public T vendor(final String vendor) {
|
||||
this.vendor = AbstractBaseEntityBuilder.strip(vendor);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public Optional<String> getVendor() {
|
||||
return Optional.ofNullable(vendor);
|
||||
}
|
||||
|
||||
public T version(final String version) {
|
||||
this.version = AbstractBaseEntityBuilder.strip(version);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public Optional<String> getVersion() {
|
||||
return Optional.ofNullable(version);
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
/**
|
||||
* Update implementation.
|
||||
*/
|
||||
public class GenericDistributionSetTypeUpdate extends AbstractDistributionSetTypeUpdateCreate<DistributionSetTypeUpdate>
|
||||
implements DistributionSetTypeUpdate {
|
||||
|
||||
public GenericDistributionSetTypeUpdate(final Long id) {
|
||||
super.id = id;
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
import jakarta.annotation.Nullable;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* Update implementation.
|
||||
*/
|
||||
@Data
|
||||
@Accessors(fluent = true) // override locked()
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class GenericDistributionSetUpdate extends AbstractDistributionSetUpdateCreate<DistributionSetUpdate> implements DistributionSetUpdate {
|
||||
|
||||
@Nullable
|
||||
protected Boolean locked;
|
||||
|
||||
public GenericDistributionSetUpdate(final Long id) {
|
||||
super.id = id;
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
/**
|
||||
* Update implementation.
|
||||
*/
|
||||
public class GenericSoftwareModuleTypeUpdate extends AbstractSoftwareModuleTypeUpdateCreate<SoftwareModuleTypeUpdate>
|
||||
implements SoftwareModuleTypeUpdate {
|
||||
|
||||
public GenericSoftwareModuleTypeUpdate(final Long id) {
|
||||
super.id = id;
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
import jakarta.annotation.Nullable;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* Update implementation.
|
||||
*/
|
||||
@Data
|
||||
@Accessors(fluent = true) // override locked()
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class GenericSoftwareModuleUpdate extends AbstractSoftwareModuleUpdateCreate<SoftwareModuleUpdate>
|
||||
implements SoftwareModuleUpdate {
|
||||
|
||||
@Nullable
|
||||
protected Boolean locked;
|
||||
|
||||
public GenericSoftwareModuleUpdate(final Long id) {
|
||||
super.id = id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Contributors to the Eclipse Foundation
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.utils;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.eclipse.hawkbit.exception.GenericSpServerException;
|
||||
import org.eclipse.hawkbit.repository.exception.ConcurrentModificationException;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
|
||||
import org.eclipse.hawkbit.repository.exception.InsufficientPermissionException;
|
||||
import org.springframework.dao.DuplicateKeyException;
|
||||
import org.springframework.dao.OptimisticLockingFailureException;
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
import org.springframework.security.authorization.AuthorizationDeniedException;
|
||||
import org.springframework.transaction.TransactionSystemException;
|
||||
|
||||
/**
|
||||
* Maps the exception thrown by the management classes to management exceptions
|
||||
*/
|
||||
@NoArgsConstructor(access = lombok.AccessLevel.PRIVATE)
|
||||
@Slf4j
|
||||
public class ExceptionMapper {
|
||||
|
||||
private static final Map<String, String> EXCEPTION_MAPPING = new HashMap<>(4);
|
||||
|
||||
// this is required to enable a certain order of exception and to select the most specific mappable exception according to the type
|
||||
// hierarchy of the exception
|
||||
private static final List<Class<?>> MAPPED_EXCEPTION_ORDER = new ArrayList<>(4);
|
||||
|
||||
static {
|
||||
MAPPED_EXCEPTION_ORDER.add(DuplicateKeyException.class);
|
||||
MAPPED_EXCEPTION_ORDER.add(OptimisticLockingFailureException.class);
|
||||
MAPPED_EXCEPTION_ORDER.add(AccessDeniedException.class);
|
||||
|
||||
EXCEPTION_MAPPING.put(DuplicateKeyException.class.getName(), EntityAlreadyExistsException.class.getName());
|
||||
EXCEPTION_MAPPING.put(OptimisticLockingFailureException.class.getName(), ConcurrentModificationException.class.getName());
|
||||
EXCEPTION_MAPPING.put(AccessDeniedException.class.getName(), InsufficientPermissionException.class.getName());
|
||||
|
||||
EXCEPTION_MAPPING.put("org.hibernate.exception.ConstraintViolationException", EntityAlreadyExistsException.class.getName());
|
||||
EXCEPTION_MAPPING.put(AuthorizationDeniedException.class.getName(), InsufficientPermissionException.class.getName());
|
||||
}
|
||||
|
||||
public static RuntimeException mapRe(final Exception e) {
|
||||
final Exception mapped = map(e);
|
||||
if (RuntimeException.class.isAssignableFrom(mapped.getClass())) {
|
||||
return (RuntimeException) mapped;
|
||||
} else {
|
||||
return new GenericSpServerException(mapped);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps exceptions of the TransactionManager and PreAuthorize and wrap them to custom exceptions.
|
||||
*
|
||||
* @param e the thrown and catch exception
|
||||
* @return the mapped exception
|
||||
*/
|
||||
public static Exception map(final Exception e) {
|
||||
if (log.isTraceEnabled()) {
|
||||
log.trace("Handling exception {}", e.getClass().getName(), e);
|
||||
} else {
|
||||
log.debug("Handling exception {}", e.getClass().getName());
|
||||
}
|
||||
|
||||
// Workaround for EclipseLink merge where it does not throw ConstraintViolationException directly in case of existing entity update
|
||||
if (e instanceof TransactionSystemException transactionSystemException) {
|
||||
return replaceWithCauseIfConstraintViolationException(transactionSystemException);
|
||||
}
|
||||
|
||||
for (final Class<?> mappedEx : MAPPED_EXCEPTION_ORDER) {
|
||||
if (!mappedEx.isAssignableFrom(e.getClass())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (EXCEPTION_MAPPING.containsKey(mappedEx.getName())) {
|
||||
try {
|
||||
return (Exception) Class.forName(EXCEPTION_MAPPING.get(mappedEx.getName())).getConstructor(Throwable.class).newInstance(e);
|
||||
} catch (final ClassNotFoundException | NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException ex) {
|
||||
log.error(ex.getMessage(), ex);
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
log.error("there is no mapping configured for exception class {}", mappedEx.getName());
|
||||
return new GenericSpServerException(e);
|
||||
}
|
||||
|
||||
// not ordered
|
||||
final String mappingClass = EXCEPTION_MAPPING.get(e.getClass().getName());
|
||||
if (mappingClass != null) {
|
||||
try {
|
||||
return (Exception) Class.forName(mappingClass).getConstructor(Throwable.class).newInstance(e);
|
||||
} catch (final ClassNotFoundException | NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException ex) {
|
||||
log.error(ex.getMessage(), ex);
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
private static Exception replaceWithCauseIfConstraintViolationException(final TransactionSystemException rex) {
|
||||
Throwable exception = rex;
|
||||
do {
|
||||
final Throwable cause = exception.getCause();
|
||||
if (cause instanceof jakarta.validation.ConstraintViolationException) {
|
||||
return (Exception) cause;
|
||||
}
|
||||
exception = cause;
|
||||
} while (exception != null);
|
||||
|
||||
return rex;
|
||||
}
|
||||
}
|
||||
@@ -61,15 +61,13 @@ public class JpaConfiguration extends JpaBaseConfiguration {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link MultiTenantJpaTransactionManager} bean.
|
||||
*
|
||||
* @return a new {@link PlatformTransactionManager}
|
||||
* @see org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration#transactionManager(ObjectProvider)
|
||||
* {@link TransactionManager} bean. It mainly handles the tenancy but some other thins like conversion of dao / jpa exceptions to
|
||||
* transaction exceptions
|
||||
*/
|
||||
@Override
|
||||
@Bean
|
||||
public PlatformTransactionManager transactionManager(final ObjectProvider<TransactionManagerCustomizers> transactionManagerCustomizers) {
|
||||
return new MultiTenantJpaTransactionManager(tenantResolver);
|
||||
return new TransactionManager(tenantResolver);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,32 +16,37 @@ import jakarta.persistence.EntityManager;
|
||||
import jakarta.transaction.Transaction;
|
||||
|
||||
import org.eclipse.hawkbit.repository.jpa.model.EntityPropertyChangeListener;
|
||||
import org.eclipse.hawkbit.repository.jpa.utils.ExceptionMapper;
|
||||
import org.eclipse.hawkbit.tenancy.TenantAware;
|
||||
import org.eclipse.persistence.config.PersistenceUnitProperties;
|
||||
import org.eclipse.persistence.descriptors.ClassDescriptor;
|
||||
import org.eclipse.persistence.descriptors.DescriptorEventManager;
|
||||
import org.eclipse.persistence.sessions.Session;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.orm.jpa.EntityManagerHolder;
|
||||
import org.springframework.orm.jpa.JpaTransactionManager;
|
||||
import org.springframework.transaction.TransactionDefinition;
|
||||
import org.springframework.transaction.support.DefaultTransactionStatus;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
|
||||
/**
|
||||
* {@link JpaTransactionManager} that sets the {@link TenantAware#getCurrentTenant()} in the eclipselink session. This has
|
||||
* {@link org.springframework.orm.jpa.JpaTransactionManager} that sets the {@link TenantAware#getCurrentTenant()} in the eclipselink session. This has
|
||||
* to be done in eclipselink after a {@link Transaction} has been started.
|
||||
* <p/>
|
||||
* The class also handles setting the {@link EntityPropertyChangeListener} to the {@link DescriptorEventManager} of the
|
||||
* The class also handles setting:
|
||||
* <ul>
|
||||
* <li>the {@link EntityPropertyChangeListener} to the {@link DescriptorEventManager}</li>
|
||||
* <li>exception on doCommit mapping to management exceptions</li>
|
||||
* </ul>
|
||||
*/
|
||||
class MultiTenantJpaTransactionManager extends JpaTransactionManager {
|
||||
class TransactionManager extends JpaTransactionManager {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Class<?> JPA_TARGET;
|
||||
|
||||
private transient TenantAware.TenantResolver tenantResolver;
|
||||
|
||||
private static final Class<?> JPA_TARGET;
|
||||
|
||||
static {
|
||||
try {
|
||||
JPA_TARGET = Class.forName("org.eclipse.hawkbit.repository.jpa.model.JpaTarget");
|
||||
@@ -52,7 +57,7 @@ class MultiTenantJpaTransactionManager extends JpaTransactionManager {
|
||||
}
|
||||
}
|
||||
|
||||
MultiTenantJpaTransactionManager(final TenantAware.TenantResolver tenantResolver) {
|
||||
TransactionManager(final TenantAware.TenantResolver tenantResolver) {
|
||||
this.tenantResolver = tenantResolver;
|
||||
}
|
||||
|
||||
@@ -86,6 +91,15 @@ class MultiTenantJpaTransactionManager extends JpaTransactionManager {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doCommit(final DefaultTransactionStatus status) {
|
||||
try {
|
||||
super.doCommit(status);
|
||||
} catch (final RuntimeException e) {
|
||||
throw ExceptionMapper.mapRe(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void cleanupTenant(final EntityManager em) {
|
||||
if (em.isOpen() && em.getProperties().containsKey(PersistenceUnitProperties.MULTITENANT_PROPERTY_DEFAULT)) {
|
||||
em.setProperty(PersistenceUnitProperties.MULTITENANT_PROPERTY_DEFAULT, "");
|
||||
@@ -16,6 +16,7 @@ import java.util.Map;
|
||||
import lombok.Data;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.EntityPropertyChangeListener;
|
||||
|
||||
import org.eclipse.hawkbit.repository.jpa.utils.ExceptionMapper;
|
||||
import org.eclipse.hawkbit.repository.jpa.utils.JpaExceptionTranslator;
|
||||
import org.eclipse.hawkbit.tenancy.TenantAware;
|
||||
import org.hibernate.boot.Metadata;
|
||||
@@ -29,17 +30,21 @@ import org.hibernate.integrator.spi.Integrator;
|
||||
import org.hibernate.jpa.boot.spi.IntegratorProvider;
|
||||
import org.hibernate.service.spi.SessionFactoryServiceRegistry;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration;
|
||||
import org.springframework.boot.autoconfigure.orm.jpa.JpaProperties;
|
||||
import org.springframework.boot.autoconfigure.transaction.TransactionManagerCustomizers;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.orm.jpa.JpaTransactionManager;
|
||||
import org.springframework.orm.jpa.vendor.AbstractJpaVendorAdapter;
|
||||
import org.springframework.orm.jpa.vendor.HibernateJpaDialect;
|
||||
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
|
||||
import org.springframework.security.core.parameters.P;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.jta.JtaTransactionManager;
|
||||
import org.springframework.transaction.support.DefaultTransactionStatus;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@@ -88,6 +93,25 @@ public class JpaConfiguration extends JpaBaseConfiguration {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link PlatformTransactionManager} bean. It handles conversion of dao / jpa exceptions to transaction exceptions
|
||||
*/
|
||||
@Override
|
||||
@Bean
|
||||
public PlatformTransactionManager transactionManager(final ObjectProvider<TransactionManagerCustomizers> transactionManagerCustomizers) {
|
||||
return new JpaTransactionManager() {
|
||||
|
||||
@Override
|
||||
protected void doCommit(final DefaultTransactionStatus status) {
|
||||
try {
|
||||
super.doCommit(status);
|
||||
} catch (final RuntimeException e) {
|
||||
throw ExceptionMapper.mapRe(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, Object> getVendorProperties(final DataSource dataSource) {
|
||||
final Map<String, Object> properties = new HashMap<>();
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Bosch.IO GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
|
||||
import org.eclipse.hawkbit.repository.BaseRepositoryTypeProvider;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean;
|
||||
import org.springframework.data.repository.Repository;
|
||||
import org.springframework.data.repository.core.support.RepositoryFactorySupport;
|
||||
import org.springframework.lang.NonNull;
|
||||
|
||||
/**
|
||||
* A {@link JpaRepositoryFactoryBean} extension that allow injection of custom repository factories by using a
|
||||
* {@link BaseRepositoryTypeProvider} implementation, allows injecting different base repository implementations based on repository type
|
||||
*/
|
||||
@SuppressWarnings("java:S119") // java:S119 - ID is inherited from JpaRepositoryFactoryBean
|
||||
public class CustomBaseRepositoryFactoryBean<T extends Repository<S, ID>, S, ID> extends JpaRepositoryFactoryBean<T, S, ID> {
|
||||
|
||||
private BaseRepositoryTypeProvider baseRepoProvider;
|
||||
|
||||
/**
|
||||
* Creates a new {@link JpaRepositoryFactoryBean} for the given repository interface.
|
||||
*
|
||||
* @param repositoryInterface must not be {@literal null}.
|
||||
*/
|
||||
public CustomBaseRepositoryFactoryBean(final Class<? extends T> repositoryInterface) {
|
||||
super(repositoryInterface);
|
||||
}
|
||||
|
||||
@Autowired // if it is a constructor injection sometimes doesn't work - base repo provider is not available at construct time
|
||||
public void setBaseRepoProvider(final BaseRepositoryTypeProvider baseRepoProvider) {
|
||||
this.baseRepoProvider = baseRepoProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RepositoryFactorySupport createRepositoryFactory(@NonNull final EntityManager entityManager) {
|
||||
final RepositoryFactorySupport rfs = super.createRepositoryFactory(entityManager);
|
||||
rfs.setRepositoryBaseClass(baseRepoProvider.getBaseRepositoryType(getObjectType()));
|
||||
return rfs;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Bosch.IO GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.PersistenceContext;
|
||||
|
||||
import org.eclipse.hawkbit.repository.jpa.repository.HawkbitBaseRepository;
|
||||
import org.eclipse.hawkbit.repository.jpa.utils.ExceptionMapper;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.jpa.repository.query.EscapeCharacter;
|
||||
import org.springframework.data.jpa.repository.query.JpaQueryMethodFactory;
|
||||
import org.springframework.data.jpa.repository.support.JpaRepositoryFactory;
|
||||
import org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean;
|
||||
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;
|
||||
import org.springframework.data.mapping.context.MappingContext;
|
||||
import org.springframework.data.querydsl.EntityPathResolver;
|
||||
import org.springframework.data.querydsl.SimpleEntityPathResolver;
|
||||
import org.springframework.data.repository.Repository;
|
||||
import org.springframework.data.repository.core.RepositoryInformation;
|
||||
import org.springframework.data.repository.core.support.RepositoryFactorySupport;
|
||||
import org.springframework.data.repository.core.support.TransactionalRepositoryFactoryBeanSupport;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* A {@link TransactionalRepositoryFactoryBeanSupport} extension that uses {@link HawkbitBaseRepository} as base repository and
|
||||
* proxied repositories in order to convert exceptions to management exceptions.
|
||||
*/
|
||||
@SuppressWarnings("java:S119") // java:S119 - ID is inherited from TransactionalRepositoryFactoryBeanSupport
|
||||
public class HawkbitBaseRepositoryFactoryBean<T extends Repository<S, ID>, S, ID> extends TransactionalRepositoryFactoryBeanSupport<T, S, ID> {
|
||||
|
||||
private EntityPathResolver entityPathResolver;
|
||||
private EscapeCharacter escapeCharacter = EscapeCharacter.DEFAULT;
|
||||
private JpaQueryMethodFactory queryMethodFactory;
|
||||
|
||||
@Nullable
|
||||
private EntityManager entityManager;
|
||||
|
||||
/**
|
||||
* Creates a new {@link JpaRepositoryFactoryBean} for the given repository interface.
|
||||
*
|
||||
* @param repositoryInterface must not be {@literal null}.
|
||||
*/
|
||||
public HawkbitBaseRepositoryFactoryBean(final Class<? extends T> repositoryInterface) {
|
||||
super(repositoryInterface);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setEntityPathResolver(final ObjectProvider<EntityPathResolver> resolver) {
|
||||
this.entityPathResolver = resolver.getIfAvailable(() -> SimpleEntityPathResolver.INSTANCE);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setEscapeCharacter(final char escapeCharacter) {
|
||||
this.escapeCharacter = EscapeCharacter.of(escapeCharacter);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setQueryMethodFactory(@Nullable final JpaQueryMethodFactory factory) {
|
||||
if (factory != null) {
|
||||
this.queryMethodFactory = factory;
|
||||
}
|
||||
}
|
||||
|
||||
@PersistenceContext
|
||||
public void setEntityManager(final EntityManager entityManager) {
|
||||
this.entityManager = entityManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
Objects.requireNonNull(entityManager, "EntityManager must not be null");
|
||||
super.afterPropertiesSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMappingContext(final MappingContext<?, ?> mappingContext) {
|
||||
super.setMappingContext(mappingContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RepositoryFactorySupport doCreateRepositoryFactory() {
|
||||
Objects.requireNonNull(entityManager, "EntityManager must not be null");
|
||||
final JpaRepositoryFactory jpaRepositoryFactory = new JpaRepositoryFactory(entityManager) {
|
||||
|
||||
@Override
|
||||
protected JpaRepositoryImplementation<?, ?> getTargetRepository(
|
||||
final RepositoryInformation information, final EntityManager entityManager) {
|
||||
final JpaRepositoryImplementation<?, ?> jpaRepositoryImplementation = super.getTargetRepository(information, entityManager);
|
||||
return (JpaRepositoryImplementation<?, ?>) Proxy.newProxyInstance(
|
||||
jpaRepositoryImplementation.getClass().getClassLoader(),
|
||||
interfaces(jpaRepositoryImplementation.getClass(), new HashSet<>()).toArray(new Class<?>[0]),
|
||||
(proxy, method, args) -> {
|
||||
try {
|
||||
return method.invoke(jpaRepositoryImplementation, args);
|
||||
} catch (final InvocationTargetException e) {
|
||||
final Throwable cause = e.getCause() == null ? e : e.getCause();
|
||||
throw cause instanceof Exception exc ? ExceptionMapper.map(exc) : e;
|
||||
} catch (final Exception e) {
|
||||
throw ExceptionMapper.map(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
jpaRepositoryFactory.setEntityPathResolver(entityPathResolver);
|
||||
jpaRepositoryFactory.setEscapeCharacter(escapeCharacter);
|
||||
|
||||
if (queryMethodFactory != null) {
|
||||
jpaRepositoryFactory.setQueryMethodFactory(queryMethodFactory);
|
||||
}
|
||||
jpaRepositoryFactory.setRepositoryBaseClass(HawkbitBaseRepository.class);
|
||||
return jpaRepositoryFactory;
|
||||
}
|
||||
|
||||
private static Set<Class<?>> interfaces(final Class<?> type, final Set<Class<?>> interfaces) {
|
||||
Collections.addAll(interfaces, type.getInterfaces());
|
||||
final Class<?> superclass = type.getSuperclass();
|
||||
if (superclass != null && superclass != Object.class) {
|
||||
return interfaces(superclass, interfaces);
|
||||
} else {
|
||||
return interfaces;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,21 +11,17 @@ package org.eclipse.hawkbit.repository.jpa;
|
||||
|
||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||
import org.eclipse.hawkbit.repository.builder.ActionStatusBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.DistributionSetBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.DistributionSetTypeBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.RolloutBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.RolloutGroupBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.SoftwareModuleBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.SoftwareModuleMetadataBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.SoftwareModuleTypeBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.TagBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.TargetBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.TargetFilterQueryBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.TargetTypeBuilder;
|
||||
import org.eclipse.hawkbit.repository.jpa.builder.JpaActionStatusBuilder;
|
||||
import org.eclipse.hawkbit.repository.jpa.builder.JpaRolloutGroupBuilder;
|
||||
import org.eclipse.hawkbit.repository.jpa.builder.JpaSoftwareModuleTypeBuilder;
|
||||
import org.eclipse.hawkbit.repository.jpa.builder.JpaTagBuilder;
|
||||
import org.eclipse.hawkbit.repository.model.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
/**
|
||||
@@ -37,26 +33,19 @@ public class JpaEntityFactory implements EntityFactory {
|
||||
private final TargetBuilder targetBuilder;
|
||||
private final TargetTypeBuilder targetTypeBuilder;
|
||||
private final TargetFilterQueryBuilder targetFilterQueryBuilder;
|
||||
private final SoftwareModuleBuilder softwareModuleBuilder;
|
||||
private final SoftwareModuleMetadataBuilder softwareModuleMetadataBuilder;
|
||||
private final DistributionSetBuilder distributionSetBuilder;
|
||||
private final DistributionSetTypeBuilder distributionSetTypeBuilder;
|
||||
private final RolloutBuilder rolloutBuilder;
|
||||
|
||||
@SuppressWarnings("java:S107")
|
||||
public JpaEntityFactory(
|
||||
final TargetBuilder targetBuilder, final TargetTypeBuilder targetTypeBuilder,
|
||||
final TargetFilterQueryBuilder targetFilterQueryBuilder,
|
||||
final SoftwareModuleBuilder softwareModuleBuilder, final SoftwareModuleMetadataBuilder softwareModuleMetadataBuilder,
|
||||
final DistributionSetBuilder distributionSetBuilder, final DistributionSetTypeBuilder distributionSetTypeBuilder,
|
||||
final SoftwareModuleMetadataBuilder softwareModuleMetadataBuilder,
|
||||
final RolloutBuilder rolloutBuilder) {
|
||||
this.targetBuilder = targetBuilder;
|
||||
this.targetTypeBuilder = targetTypeBuilder;
|
||||
this.targetFilterQueryBuilder = targetFilterQueryBuilder;
|
||||
this.softwareModuleBuilder = softwareModuleBuilder;
|
||||
this.softwareModuleMetadataBuilder = softwareModuleMetadataBuilder;
|
||||
this.distributionSetBuilder = distributionSetBuilder;
|
||||
this.distributionSetTypeBuilder = distributionSetTypeBuilder;
|
||||
this.rolloutBuilder = rolloutBuilder;
|
||||
}
|
||||
@Override
|
||||
@@ -64,46 +53,27 @@ public class JpaEntityFactory implements EntityFactory {
|
||||
return new JpaActionStatusBuilder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DistributionSetBuilder distributionSet() {
|
||||
return distributionSetBuilder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SoftwareModuleMetadataBuilder softwareModuleMetadata() {
|
||||
return softwareModuleMetadataBuilder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TagBuilder tag() {
|
||||
return new JpaTagBuilder();
|
||||
public TagBuilder<Tag> tag() {
|
||||
return (TagBuilder)new JpaTagBuilder();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public RolloutGroupBuilder rolloutGroup() {
|
||||
return new JpaRolloutGroupBuilder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DistributionSetTypeBuilder distributionSetType() {
|
||||
return distributionSetTypeBuilder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RolloutBuilder rollout() {
|
||||
return rolloutBuilder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SoftwareModuleBuilder softwareModule() {
|
||||
return softwareModuleBuilder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SoftwareModuleTypeBuilder softwareModuleType() {
|
||||
return new JpaSoftwareModuleTypeBuilder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TargetBuilder target() {
|
||||
return targetBuilder;
|
||||
|
||||
@@ -11,7 +11,6 @@ package org.eclipse.hawkbit.repository.jpa;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@@ -19,19 +18,10 @@ import jakarta.persistence.EntityManager;
|
||||
import jakarta.validation.Validation;
|
||||
|
||||
import io.micrometer.core.instrument.MeterRegistry;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.eclipse.hawkbit.ContextAware;
|
||||
import org.eclipse.hawkbit.repository.artifact.ArtifactRepository;
|
||||
import org.eclipse.hawkbit.cache.TenancyCacheManager;
|
||||
import org.eclipse.hawkbit.repository.artifact.encryption.ArtifactEncryption;
|
||||
import org.eclipse.hawkbit.repository.artifact.encryption.ArtifactEncryptionSecretsStore;
|
||||
import org.eclipse.hawkbit.repository.artifact.encryption.ArtifactEncryptionService;
|
||||
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
||||
import org.eclipse.hawkbit.repository.BaseRepositoryTypeProvider;
|
||||
import org.eclipse.hawkbit.repository.ConfirmationManagement;
|
||||
import org.eclipse.hawkbit.repository.ControllerManagement;
|
||||
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetTagManagement;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
|
||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||
import org.eclipse.hawkbit.repository.PropertiesQuotaManagement;
|
||||
@@ -44,20 +34,16 @@ import org.eclipse.hawkbit.repository.RolloutGroupManagement;
|
||||
import org.eclipse.hawkbit.repository.RolloutHandler;
|
||||
import org.eclipse.hawkbit.repository.RolloutManagement;
|
||||
import org.eclipse.hawkbit.repository.RolloutStatusCache;
|
||||
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
|
||||
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
|
||||
import org.eclipse.hawkbit.repository.SystemManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetTagManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetTypeManagement;
|
||||
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||
import org.eclipse.hawkbit.repository.TenantStatsManagement;
|
||||
import org.eclipse.hawkbit.repository.artifact.encryption.ArtifactEncryption;
|
||||
import org.eclipse.hawkbit.repository.artifact.encryption.ArtifactEncryptionSecretsStore;
|
||||
import org.eclipse.hawkbit.repository.artifact.encryption.ArtifactEncryptionService;
|
||||
import org.eclipse.hawkbit.repository.autoassign.AutoAssignExecutor;
|
||||
import org.eclipse.hawkbit.repository.builder.DistributionSetBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.DistributionSetTypeBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.RolloutBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.SoftwareModuleBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.SoftwareModuleMetadataBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.TargetBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.TargetFilterQueryBuilder;
|
||||
@@ -73,38 +59,18 @@ import org.eclipse.hawkbit.repository.jpa.autoassign.AutoAssignScheduler;
|
||||
import org.eclipse.hawkbit.repository.jpa.autocleanup.AutoActionCleanup;
|
||||
import org.eclipse.hawkbit.repository.jpa.autocleanup.AutoCleanupScheduler;
|
||||
import org.eclipse.hawkbit.repository.jpa.autocleanup.CleanupTask;
|
||||
import org.eclipse.hawkbit.repository.jpa.builder.JpaDistributionSetBuilder;
|
||||
import org.eclipse.hawkbit.repository.jpa.builder.JpaDistributionSetTypeBuilder;
|
||||
import org.eclipse.hawkbit.repository.jpa.builder.JpaRolloutBuilder;
|
||||
import org.eclipse.hawkbit.repository.jpa.builder.JpaSoftwareModuleBuilder;
|
||||
import org.eclipse.hawkbit.repository.jpa.builder.JpaSoftwareModuleMetadataBuilder;
|
||||
import org.eclipse.hawkbit.repository.jpa.builder.JpaTargetBuilder;
|
||||
import org.eclipse.hawkbit.repository.jpa.builder.JpaTargetFilterQueryBuilder;
|
||||
import org.eclipse.hawkbit.repository.jpa.builder.JpaTargetTypeBuilder;
|
||||
import org.eclipse.hawkbit.repository.jpa.cluster.LockProperties;
|
||||
import org.eclipse.hawkbit.repository.jpa.cluster.DistributedLockRepository;
|
||||
import org.eclipse.hawkbit.repository.jpa.cluster.LockProperties;
|
||||
import org.eclipse.hawkbit.repository.jpa.event.JpaEventEntityManager;
|
||||
import org.eclipse.hawkbit.repository.jpa.executor.AfterTransactionCommitDefaultServiceExecutor;
|
||||
import org.eclipse.hawkbit.repository.jpa.executor.AfterTransactionCommitExecutor;
|
||||
import org.eclipse.hawkbit.repository.jpa.management.JpaArtifactManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.management.JpaConfirmationManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.management.JpaControllerManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.management.JpaDeploymentManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.management.JpaDistributionSetInvalidationManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.management.JpaDistributionSetManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.management.JpaDistributionSetTagManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.management.JpaDistributionSetTypeManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.management.JpaRolloutGroupManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.management.JpaRolloutManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.utils.ExceptionMapper;
|
||||
import org.eclipse.hawkbit.repository.jpa.management.JpaSoftwareModuleManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.management.JpaSoftwareModuleTypeManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.management.JpaSystemManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.management.JpaTargetFilterQueryManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.management.JpaTargetManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.management.JpaTargetTagManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.management.JpaTargetTypeManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.management.JpaTenantConfigurationManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.management.JpaTenantStatsManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaAction;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaArtifact;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSet;
|
||||
@@ -118,24 +84,16 @@ import org.eclipse.hawkbit.repository.jpa.model.helper.EntityInterceptorHolder;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.helper.SecurityTokenGeneratorHolder;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.helper.TenantAwareHolder;
|
||||
import org.eclipse.hawkbit.repository.jpa.repository.ActionRepository;
|
||||
import org.eclipse.hawkbit.repository.jpa.repository.ActionStatusRepository;
|
||||
import org.eclipse.hawkbit.repository.jpa.repository.DistributionSetRepository;
|
||||
import org.eclipse.hawkbit.repository.jpa.repository.DistributionSetTagRepository;
|
||||
import org.eclipse.hawkbit.repository.jpa.repository.DistributionSetTypeRepository;
|
||||
import org.eclipse.hawkbit.repository.jpa.repository.HawkbitBaseRepository;
|
||||
import org.eclipse.hawkbit.repository.jpa.repository.LocalArtifactRepository;
|
||||
import org.eclipse.hawkbit.repository.jpa.repository.RolloutGroupRepository;
|
||||
import org.eclipse.hawkbit.repository.jpa.repository.RolloutRepository;
|
||||
import org.eclipse.hawkbit.repository.jpa.repository.RolloutTargetGroupRepository;
|
||||
import org.eclipse.hawkbit.repository.jpa.repository.SoftwareModuleMetadataRepository;
|
||||
import org.eclipse.hawkbit.repository.jpa.repository.SoftwareModuleRepository;
|
||||
import org.eclipse.hawkbit.repository.jpa.repository.SoftwareModuleTypeRepository;
|
||||
import org.eclipse.hawkbit.repository.jpa.repository.TargetFilterQueryRepository;
|
||||
import org.eclipse.hawkbit.repository.jpa.repository.TargetRepository;
|
||||
import org.eclipse.hawkbit.repository.jpa.repository.TargetTagRepository;
|
||||
import org.eclipse.hawkbit.repository.jpa.repository.TargetTypeRepository;
|
||||
import org.eclipse.hawkbit.repository.jpa.repository.TenantConfigurationRepository;
|
||||
import org.eclipse.hawkbit.repository.jpa.repository.TenantMetaDataRepository;
|
||||
import org.eclipse.hawkbit.repository.jpa.rollout.RolloutScheduler;
|
||||
import org.eclipse.hawkbit.repository.jpa.rollout.condition.PauseRolloutGroupAction;
|
||||
import org.eclipse.hawkbit.repository.jpa.rollout.condition.RolloutGroupActionEvaluator;
|
||||
@@ -144,25 +102,19 @@ import org.eclipse.hawkbit.repository.jpa.rollout.condition.RolloutGroupEvaluati
|
||||
import org.eclipse.hawkbit.repository.jpa.rollout.condition.StartNextGroupRolloutGroupSuccessAction;
|
||||
import org.eclipse.hawkbit.repository.jpa.rollout.condition.ThresholdRolloutGroupErrorCondition;
|
||||
import org.eclipse.hawkbit.repository.jpa.rollout.condition.ThresholdRolloutGroupSuccessCondition;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||
import org.eclipse.hawkbit.repository.jpa.rsql.RsqlUtility;
|
||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
||||
import org.eclipse.hawkbit.repository.model.TargetType;
|
||||
import org.eclipse.hawkbit.repository.model.helper.SystemSecurityContextHolder;
|
||||
import org.eclipse.hawkbit.repository.model.helper.TenantConfigurationManagementHolder;
|
||||
import org.eclipse.hawkbit.repository.jpa.rsql.RsqlUtility;
|
||||
import org.eclipse.hawkbit.security.HawkbitSecurityProperties;
|
||||
import org.eclipse.hawkbit.security.SecurityTokenGenerator;
|
||||
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
||||
import org.eclipse.hawkbit.tenancy.TenantAware;
|
||||
import org.eclipse.hawkbit.tenancy.UserAuthoritiesResolver;
|
||||
import org.eclipse.hawkbit.tenancy.configuration.ControllerPollProperties;
|
||||
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationProperties;
|
||||
import org.eclipse.hawkbit.utils.TenantConfigHelper;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -172,16 +124,13 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.autoconfigure.domain.EntityScan;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.orm.jpa.JpaProperties;
|
||||
import org.springframework.cache.CacheManager;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.data.domain.AuditorAware;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
import org.springframework.integration.jdbc.lock.DefaultLockRepository;
|
||||
@@ -192,14 +141,19 @@ import org.springframework.integration.support.locks.LockRegistry;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.retry.annotation.EnableRetry;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.security.authorization.AuthorizationDeniedException;
|
||||
import org.springframework.security.authorization.AuthorizationResult;
|
||||
import org.springframework.security.authorization.method.MethodAuthorizationDeniedHandler;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
import org.springframework.validation.beanvalidation.MethodValidationPostProcessor;
|
||||
|
||||
;
|
||||
|
||||
/**
|
||||
* General configuration for hawkBit's Repository.
|
||||
*/
|
||||
@EnableJpaRepositories(value = "org.eclipse.hawkbit.repository.jpa.repository", repositoryFactoryBeanClass = CustomBaseRepositoryFactoryBean.class)
|
||||
@EnableJpaRepositories(value = "org.eclipse.hawkbit.repository.jpa.repository", repositoryFactoryBeanClass = HawkbitBaseRepositoryFactoryBean.class)
|
||||
@EnableTransactionManagement
|
||||
@EnableJpaAuditing
|
||||
@EnableAspectJAutoProxy
|
||||
@@ -207,8 +161,10 @@ import org.springframework.validation.beanvalidation.MethodValidationPostProcess
|
||||
@EnableScheduling
|
||||
@EnableRetry
|
||||
@EntityScan("org.eclipse.hawkbit.repository.jpa.model")
|
||||
@ComponentScan("org.eclipse.hawkbit.repository.jpa.management")
|
||||
@PropertySource("classpath:/hawkbit-jpa-defaults.properties")
|
||||
@Import({ JpaConfiguration.class, RepositoryConfiguration.class, LockProperties.class, DataSourceAutoConfiguration.class, SystemManagementCacheKeyGenerator.class })
|
||||
@Import({ JpaConfiguration.class, RepositoryConfiguration.class, LockProperties.class, DataSourceAutoConfiguration.class,
|
||||
SystemManagementCacheKeyGenerator.class })
|
||||
@AutoConfigureAfter(DataSourceAutoConfiguration.class)
|
||||
public class JpaRepositoryConfiguration {
|
||||
|
||||
@@ -224,7 +180,8 @@ public class JpaRepositoryConfiguration {
|
||||
// methods shall not be called - we need the validator in future
|
||||
processor.setValidator(Validation.byDefaultProvider()
|
||||
.configure()
|
||||
.addProperty(org.hibernate.validator.BaseHibernateValidatorConfiguration.ALLOW_PARALLEL_METHODS_DEFINE_PARAMETER_CONSTRAINTS, "true")
|
||||
.addProperty(org.hibernate.validator.BaseHibernateValidatorConfiguration.ALLOW_PARALLEL_METHODS_DEFINE_PARAMETER_CONSTRAINTS,
|
||||
"true")
|
||||
.buildValidatorFactory()
|
||||
.getValidator());
|
||||
return processor;
|
||||
@@ -270,7 +227,8 @@ public class JpaRepositoryConfiguration {
|
||||
@Bean
|
||||
@ConditionalOnProperty(name = "hawkbit.lock", havingValue = "distributed", matchIfMissing = true)
|
||||
@ConditionalOnMissingBean
|
||||
LockRepository lockRepository(final DataSource dataSource, final LockProperties lockProperties, final PlatformTransactionManager txManager) {
|
||||
LockRepository lockRepository(final DataSource dataSource, final LockProperties lockProperties,
|
||||
final PlatformTransactionManager txManager) {
|
||||
final DefaultLockRepository repository = new DistributedLockRepository(dataSource, lockProperties, txManager);
|
||||
repository.setPrefix("SP_");
|
||||
return repository;
|
||||
@@ -279,7 +237,7 @@ public class JpaRepositoryConfiguration {
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public LockRegistry lockRegistry(final Optional<LockRepository> lockRepository) {
|
||||
return lockRepository.<LockRegistry>map(JdbcLockRegistry::new).orElseGet(DefaultLockRegistry::new);
|
||||
return lockRepository.<LockRegistry> map(JdbcLockRegistry::new).orElseGet(DefaultLockRegistry::new);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -351,17 +309,6 @@ public class JpaRepositoryConfiguration {
|
||||
return e -> e instanceof TargetPollEvent && !repositoryProperties.isPublishTargetPollEvent();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param distributionSetTypeManagement to loading the {@link DistributionSetType}
|
||||
* @param softwareManagement for loading {@link DistributionSet#getModules()}
|
||||
* @return DistributionSetBuilder bean
|
||||
*/
|
||||
@Bean
|
||||
DistributionSetBuilder distributionSetBuilder(final DistributionSetTypeManagement distributionSetTypeManagement,
|
||||
final SoftwareModuleManagement softwareManagement) {
|
||||
return new JpaDistributionSetBuilder(distributionSetTypeManagement, softwareManagement);
|
||||
}
|
||||
|
||||
@Bean
|
||||
TargetBuilder targetBuilder(final TargetTypeManagement targetTypeManagement) {
|
||||
return new JpaTargetBuilder(targetTypeManagement);
|
||||
@@ -378,30 +325,10 @@ public class JpaRepositoryConfiguration {
|
||||
|
||||
@Bean
|
||||
SoftwareModuleMetadataBuilder softwareModuleMetadataBuilder(
|
||||
final SoftwareModuleManagement softwareModuleManagement) {
|
||||
final JpaSoftwareModuleManagement softwareModuleManagement) {
|
||||
return new JpaSoftwareModuleMetadataBuilder(softwareModuleManagement);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param softwareModuleTypeManagement for loading {@link DistributionSetType#getMandatoryModuleTypes()}
|
||||
* and {@link DistributionSetType#getOptionalModuleTypes()}
|
||||
* @return DistributionSetTypeBuilder bean
|
||||
*/
|
||||
@Bean
|
||||
DistributionSetTypeBuilder distributionSetTypeBuilder(
|
||||
final SoftwareModuleTypeManagement softwareModuleTypeManagement) {
|
||||
return new JpaDistributionSetTypeBuilder(softwareModuleTypeManagement);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param softwareModuleTypeManagement for loading {@link SoftwareModule#getType()}
|
||||
* @return SoftwareModuleBuilder bean
|
||||
*/
|
||||
@Bean
|
||||
SoftwareModuleBuilder softwareModuleBuilder(final SoftwareModuleTypeManagement softwareModuleTypeManagement) {
|
||||
return new JpaSoftwareModuleBuilder(softwareModuleTypeManagement);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param distributionSetManagement for loading {@link Rollout#getDistributionSet()}
|
||||
* @return RolloutBuilder bean
|
||||
@@ -485,221 +412,6 @@ public class JpaRepositoryConfiguration {
|
||||
return new ExceptionMappingAspectHandler();
|
||||
}
|
||||
|
||||
/**
|
||||
* Default {@link BaseRepositoryTypeProvider} bean always provides the NoCountBaseRepository
|
||||
*
|
||||
* @return a {@link BaseRepositoryTypeProvider} bean
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
BaseRepositoryTypeProvider baseRepositoryTypeProvider() {
|
||||
return new HawkbitBaseRepository.RepositoryTypeProvider();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link JpaSystemManagement} bean.
|
||||
*
|
||||
* @return a new {@link SystemManagement}
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
SystemManagement systemManagement(
|
||||
final TargetRepository targetRepository, final TargetTypeRepository targetTypeRepository,
|
||||
final TargetTagRepository targetTagRepository, final TargetFilterQueryRepository targetFilterQueryRepository,
|
||||
final SoftwareModuleRepository softwareModuleRepository, final SoftwareModuleTypeRepository softwareModuleTypeRepository,
|
||||
final DistributionSetRepository distributionSetRepository, final DistributionSetTypeRepository distributionSetTypeRepository,
|
||||
final DistributionSetTagRepository distributionSetTagRepository, final RolloutRepository rolloutRepository,
|
||||
final TenantConfigurationRepository tenantConfigurationRepository, final TenantMetaDataRepository tenantMetaDataRepository,
|
||||
final TenantStatsManagement systemStatsManagement, final SystemManagementCacheKeyGenerator currentTenantCacheKeyGenerator,
|
||||
final SystemSecurityContext systemSecurityContext, final TenantAware tenantAware, final PlatformTransactionManager txManager,
|
||||
final TenancyCacheManager cacheManager, final RolloutStatusCache rolloutStatusCache,
|
||||
final EntityManager entityManager, final RepositoryProperties repositoryProperties,
|
||||
final JpaProperties properties) {
|
||||
return new JpaSystemManagement(targetRepository, targetTypeRepository, targetTagRepository,
|
||||
targetFilterQueryRepository, softwareModuleRepository, softwareModuleTypeRepository, distributionSetRepository,
|
||||
distributionSetTypeRepository, distributionSetTagRepository, rolloutRepository, tenantConfigurationRepository,
|
||||
tenantMetaDataRepository, systemStatsManagement, currentTenantCacheKeyGenerator, systemSecurityContext,
|
||||
tenantAware, txManager, cacheManager, rolloutStatusCache, entityManager, repositoryProperties, properties);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link JpaDistributionSetManagement} bean.
|
||||
*
|
||||
* @return a new {@link DistributionSetManagement}
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
DistributionSetManagement distributionSetManagement(
|
||||
final EntityManager entityManager,
|
||||
final DistributionSetRepository distributionSetRepository,
|
||||
final DistributionSetTagManagement distributionSetTagManagement, final SystemManagement systemManagement,
|
||||
final DistributionSetTypeManagement distributionSetTypeManagement, final QuotaManagement quotaManagement,
|
||||
final TargetRepository targetRepository,
|
||||
final TargetFilterQueryRepository targetFilterQueryRepository, final ActionRepository actionRepository,
|
||||
final SystemSecurityContext systemSecurityContext, final TenantConfigurationManagement tenantConfigurationManagement,
|
||||
final SoftwareModuleRepository softwareModuleRepository,
|
||||
final DistributionSetTagRepository distributionSetTagRepository, final RepositoryProperties repositoryProperties) {
|
||||
return new JpaDistributionSetManagement(entityManager, distributionSetRepository, distributionSetTagManagement,
|
||||
systemManagement, distributionSetTypeManagement, quotaManagement,
|
||||
targetRepository, targetFilterQueryRepository, actionRepository,
|
||||
TenantConfigHelper.usingContext(systemSecurityContext, tenantConfigurationManagement),
|
||||
softwareModuleRepository, distributionSetTagRepository, repositoryProperties);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link JpaDistributionSetManagement} bean.
|
||||
*
|
||||
* @return a new {@link DistributionSetManagement}
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
DistributionSetTypeManagement distributionSetTypeManagement(
|
||||
final DistributionSetTypeRepository distributionSetTypeRepository,
|
||||
final SoftwareModuleTypeRepository softwareModuleTypeRepository,
|
||||
final DistributionSetRepository distributionSetRepository, final TargetTypeRepository targetTypeRepository,
|
||||
final QuotaManagement quotaManagement) {
|
||||
return new JpaDistributionSetTypeManagement(distributionSetTypeRepository, softwareModuleTypeRepository,
|
||||
distributionSetRepository, targetTypeRepository, quotaManagement);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link JpaTargetTypeManagement} bean.
|
||||
*
|
||||
* @return a new {@link TargetTypeManagement}
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
TargetTypeManagement targetTypeManagement(final TargetTypeRepository targetTypeRepository,
|
||||
final TargetRepository targetRepository, final DistributionSetTypeRepository distributionSetTypeRepository,
|
||||
final QuotaManagement quotaManagement) {
|
||||
return new JpaTargetTypeManagement(targetTypeRepository, targetRepository, distributionSetTypeRepository, quotaManagement);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link JpaTenantStatsManagement} bean.
|
||||
*
|
||||
* @return a new {@link TenantStatsManagement}
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
TenantStatsManagement tenantStatsManagement(
|
||||
final TargetRepository targetRepository, final LocalArtifactRepository artifactRepository, final ActionRepository actionRepository,
|
||||
final TenantAware tenantAware) {
|
||||
return new JpaTenantStatsManagement(targetRepository, artifactRepository, actionRepository, tenantAware);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link JpaTenantConfigurationManagement} bean.
|
||||
*
|
||||
* @return a new {@link TenantConfigurationManagement}
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
TenantConfigurationManagement tenantConfigurationManagement(
|
||||
final TenantConfigurationRepository tenantConfigurationRepository,
|
||||
final TenantConfigurationProperties tenantConfigurationProperties,
|
||||
final CacheManager cacheManager, final AfterTransactionCommitExecutor afterCommitExecutor,
|
||||
final ApplicationContext applicationContext) {
|
||||
return new JpaTenantConfigurationManagement(tenantConfigurationRepository, tenantConfigurationProperties,
|
||||
cacheManager, afterCommitExecutor, applicationContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link JpaTargetManagement} bean.
|
||||
*
|
||||
* @return a new {@link JpaTargetManagement}
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
TargetManagement targetManagement(
|
||||
final EntityManager entityManager, final QuotaManagement quotaManagement,
|
||||
final TargetRepository targetRepository,
|
||||
final RolloutGroupRepository rolloutGroupRepository,
|
||||
final TargetFilterQueryRepository targetFilterQueryRepository,
|
||||
final TargetTypeRepository targetTypeRepository, final TargetTagRepository targetTagRepository,
|
||||
final TenantAware tenantAware, final DistributionSetManagement distributionSetManagement) {
|
||||
return new JpaTargetManagement(entityManager, distributionSetManagement, quotaManagement, targetRepository,
|
||||
targetTypeRepository, rolloutGroupRepository, targetFilterQueryRepository,
|
||||
targetTagRepository, tenantAware);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link JpaTargetFilterQueryManagement} bean.
|
||||
*
|
||||
* @param targetFilterQueryRepository holding {@link TargetFilterQuery} entities
|
||||
* @param targetManagement managing {@link Target} entities
|
||||
* @param distributionSetManagement for auto assign DS access
|
||||
* @param quotaManagement to access quotas
|
||||
* @return a new {@link TargetFilterQueryManagement}
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
TargetFilterQueryManagement targetFilterQueryManagement(
|
||||
final TargetFilterQueryRepository targetFilterQueryRepository, final TargetManagement targetManagement,
|
||||
final DistributionSetManagement distributionSetManagement, final QuotaManagement quotaManagement,
|
||||
final TenantConfigurationManagement tenantConfigurationManagement, final RepositoryProperties repositoryProperties,
|
||||
final SystemSecurityContext systemSecurityContext, final ContextAware contextAware, final AuditorAware<String> auditorAware) {
|
||||
return new JpaTargetFilterQueryManagement(targetFilterQueryRepository, targetManagement,
|
||||
distributionSetManagement, quotaManagement, tenantConfigurationManagement, repositoryProperties,
|
||||
systemSecurityContext, contextAware, auditorAware);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link JpaTargetTagManagement} bean.
|
||||
*
|
||||
* @return a new {@link TargetTagManagement}
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
TargetTagManagement targetTagManagement(final TargetTagRepository targetTagRepository) {
|
||||
return new JpaTargetTagManagement(targetTagRepository);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link JpaDistributionSetTagManagement} bean.
|
||||
*
|
||||
* @return a new {@link JpaDistributionSetTagManagement}
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
DistributionSetTagManagement distributionSetTagManagement(
|
||||
final DistributionSetTagRepository distributionSetTagRepository,
|
||||
final DistributionSetRepository distributionSetRepository) {
|
||||
return new JpaDistributionSetTagManagement(
|
||||
distributionSetTagRepository, distributionSetRepository);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link JpaSoftwareModuleManagement} bean.
|
||||
*
|
||||
* @return a new {@link SoftwareModuleManagement}
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
SoftwareModuleManagement softwareModuleManagement(final EntityManager entityManager,
|
||||
final DistributionSetRepository distributionSetRepository,
|
||||
final SoftwareModuleRepository softwareModuleRepository,
|
||||
final SoftwareModuleMetadataRepository softwareModuleMetadataRepository,
|
||||
final SoftwareModuleTypeRepository softwareModuleTypeRepository, final AuditorAware<String> auditorProvider,
|
||||
final ArtifactManagement artifactManagement, final QuotaManagement quotaManagement) {
|
||||
return new JpaSoftwareModuleManagement(entityManager, distributionSetRepository, softwareModuleRepository,
|
||||
softwareModuleMetadataRepository, softwareModuleTypeRepository, auditorProvider, artifactManagement, quotaManagement);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link JpaSoftwareModuleTypeManagement} bean.
|
||||
*
|
||||
* @return a new {@link SoftwareModuleTypeManagement}
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
SoftwareModuleTypeManagement softwareModuleTypeManagement(
|
||||
final DistributionSetTypeRepository distributionSetTypeRepository,
|
||||
final SoftwareModuleTypeRepository softwareModuleTypeRepository,
|
||||
final SoftwareModuleRepository softwareModuleRepository) {
|
||||
return new JpaSoftwareModuleTypeManagement(distributionSetTypeRepository, softwareModuleTypeRepository, softwareModuleRepository);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
RolloutHandler rolloutHandler(final TenantAware tenantAware, final RolloutManagement rolloutManagement,
|
||||
@@ -726,28 +438,6 @@ public class JpaRepositoryConfiguration {
|
||||
tenantAware, repositoryProperties);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
RolloutManagement rolloutManagement(
|
||||
final RolloutRepository rolloutRepository,
|
||||
final RolloutGroupRepository rolloutGroupRepository,
|
||||
final RolloutApprovalStrategy rolloutApprovalStrategy,
|
||||
final StartNextGroupRolloutGroupSuccessAction startNextRolloutGroupAction,
|
||||
final RolloutStatusCache rolloutStatusCache,
|
||||
final ActionRepository actionRepository,
|
||||
final TargetManagement targetManagement,
|
||||
final DistributionSetManagement distributionSetManagement,
|
||||
final TenantConfigurationManagement tenantConfigurationManagement,
|
||||
final QuotaManagement quotaManagement,
|
||||
final AfterTransactionCommitExecutor afterCommit,
|
||||
final SystemSecurityContext systemSecurityContext, final ContextAware contextAware,
|
||||
final RepositoryProperties repositoryProperties) {
|
||||
return new JpaRolloutManagement(rolloutRepository, rolloutGroupRepository, rolloutApprovalStrategy,
|
||||
startNextRolloutGroupAction, rolloutStatusCache, actionRepository, targetManagement,
|
||||
distributionSetManagement, tenantConfigurationManagement, quotaManagement, afterCommit,
|
||||
systemSecurityContext, contextAware, repositoryProperties);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link DefaultRolloutApprovalStrategy} bean.
|
||||
*
|
||||
@@ -758,90 +448,7 @@ public class JpaRepositoryConfiguration {
|
||||
RolloutApprovalStrategy rolloutApprovalStrategy(final UserAuthoritiesResolver userAuthoritiesResolver,
|
||||
final TenantConfigurationManagement tenantConfigurationManagement,
|
||||
final SystemSecurityContext systemSecurityContext) {
|
||||
return new DefaultRolloutApprovalStrategy(userAuthoritiesResolver, tenantConfigurationManagement,
|
||||
systemSecurityContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link JpaRolloutGroupManagement} bean.
|
||||
*
|
||||
* @return a new {@link RolloutGroupManagement}
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
RolloutGroupManagement rolloutGroupManagement(final RolloutGroupRepository rolloutGroupRepository,
|
||||
final RolloutRepository rolloutRepository, final ActionRepository actionRepository,
|
||||
final TargetRepository targetRepository, final EntityManager entityManager, final RolloutStatusCache rolloutStatusCache) {
|
||||
return new JpaRolloutGroupManagement(rolloutGroupRepository, rolloutRepository, actionRepository,
|
||||
targetRepository, entityManager, rolloutStatusCache);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link JpaDeploymentManagement} bean.
|
||||
*
|
||||
* @return a new {@link DeploymentManagement}
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
DeploymentManagement deploymentManagement(final EntityManager entityManager,
|
||||
final ActionRepository actionRepository,
|
||||
final DistributionSetManagement distributionSetManagement, final TargetRepository targetRepository,
|
||||
final ActionStatusRepository actionStatusRepository, final AuditorAware<String> auditorProvider,
|
||||
final AfterTransactionCommitExecutor afterCommit, final PlatformTransactionManager txManager,
|
||||
final TenantConfigurationManagement tenantConfigurationManagement, final QuotaManagement quotaManagement,
|
||||
final SystemSecurityContext systemSecurityContext, final TenantAware tenantAware, final AuditorAware<String> auditorAware,
|
||||
final JpaProperties properties, final RepositoryProperties repositoryProperties) {
|
||||
return new JpaDeploymentManagement(entityManager, actionRepository, distributionSetManagement, targetRepository, actionStatusRepository,
|
||||
auditorProvider,
|
||||
afterCommit, txManager, tenantConfigurationManagement,
|
||||
quotaManagement, systemSecurityContext, tenantAware, auditorAware, properties.getDatabase(), repositoryProperties);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
ConfirmationManagement confirmationManagement(final TargetRepository targetRepository,
|
||||
final ActionRepository actionRepository, final ActionStatusRepository actionStatusRepository,
|
||||
final RepositoryProperties repositoryProperties, final QuotaManagement quotaManagement,
|
||||
final EntityManager entityManager, final EntityFactory entityFactory) {
|
||||
return new JpaConfirmationManagement(targetRepository, actionRepository, actionStatusRepository,
|
||||
repositoryProperties, quotaManagement, entityManager, entityFactory);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link JpaControllerManagement} bean.
|
||||
*
|
||||
* @return a new {@link ControllerManagement}
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
ControllerManagement controllerManagement(
|
||||
final ActionRepository actionRepository, final ActionStatusRepository actionStatusRepository, final QuotaManagement quotaManagement,
|
||||
final RepositoryProperties repositoryProperties,
|
||||
final TargetRepository targetRepository, final TargetTypeManagement targetTypeManagement,
|
||||
final DeploymentManagement deploymentManagement, final ConfirmationManagement confirmationManagement,
|
||||
final SoftwareModuleRepository softwareModuleRepository, final SoftwareModuleMetadataRepository softwareModuleMetadataRepository,
|
||||
final DistributionSetManagement distributionSetManagement,
|
||||
final TenantConfigurationManagement tenantConfigurationManagement, final ControllerPollProperties controllerPollProperties,
|
||||
final PlatformTransactionManager txManager, final EntityFactory entityFactory, final EntityManager entityManager,
|
||||
final AfterTransactionCommitExecutor afterCommit,
|
||||
final SystemSecurityContext systemSecurityContext, final TenantAware tenantAware,
|
||||
final ScheduledExecutorService executorService) {
|
||||
return new JpaControllerManagement(actionRepository, actionStatusRepository, quotaManagement, repositoryProperties,
|
||||
targetRepository, targetTypeManagement, deploymentManagement, confirmationManagement, softwareModuleRepository,
|
||||
softwareModuleMetadataRepository, distributionSetManagement, tenantConfigurationManagement, controllerPollProperties,
|
||||
txManager,entityFactory, entityManager, afterCommit, systemSecurityContext, tenantAware, executorService);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
ArtifactManagement artifactManagement(
|
||||
final EntityManager entityManager, final PlatformTransactionManager txManager,
|
||||
final LocalArtifactRepository localArtifactRepository, final SoftwareModuleRepository softwareModuleRepository,
|
||||
final Optional<ArtifactRepository> artifactRepository,
|
||||
final QuotaManagement quotaManagement, final TenantAware tenantAware) {
|
||||
return new JpaArtifactManagement(
|
||||
entityManager, txManager, localArtifactRepository, softwareModuleRepository, artifactRepository.orElse(null),
|
||||
quotaManagement, tenantAware);
|
||||
return new DefaultRolloutApprovalStrategy(userAuthoritiesResolver, tenantConfigurationManagement, systemSecurityContext);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -854,11 +461,11 @@ public class JpaRepositoryConfiguration {
|
||||
EntityFactory entityFactory(
|
||||
final TargetBuilder targetBuilder, final TargetTypeBuilder targetTypeBuilder,
|
||||
final TargetFilterQueryBuilder targetFilterQueryBuilder,
|
||||
final SoftwareModuleBuilder softwareModuleBuilder, final SoftwareModuleMetadataBuilder softwareModuleMetadataBuilder,
|
||||
final DistributionSetBuilder distributionSetBuilder, final DistributionSetTypeBuilder distributionSetTypeBuilder,
|
||||
final SoftwareModuleMetadataBuilder softwareModuleMetadataBuilder,
|
||||
final RolloutBuilder rolloutBuilder) {
|
||||
return new JpaEntityFactory(targetBuilder, targetTypeBuilder, targetFilterQueryBuilder, softwareModuleBuilder,
|
||||
softwareModuleMetadataBuilder, distributionSetBuilder, distributionSetTypeBuilder, rolloutBuilder);
|
||||
return new JpaEntityFactory(
|
||||
targetBuilder, targetTypeBuilder, targetFilterQueryBuilder,
|
||||
softwareModuleMetadataBuilder, rolloutBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -976,7 +583,7 @@ public class JpaRepositoryConfiguration {
|
||||
RolloutScheduler rolloutScheduler(
|
||||
final SystemManagement systemManagement, final RolloutHandler rolloutHandler, final SystemSecurityContext systemSecurityContext,
|
||||
@Value("${hawkbit.rollout.executor.thread-pool.size:1}") final int threadPoolSize, final Optional<MeterRegistry> meterRegistry) {
|
||||
return new RolloutScheduler(rolloutHandler, systemManagement, systemSecurityContext, threadPoolSize, meterRegistry);
|
||||
return new RolloutScheduler(rolloutHandler, systemManagement, systemSecurityContext, threadPoolSize, meterRegistry);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -989,25 +596,6 @@ public class JpaRepositoryConfiguration {
|
||||
return RsqlUtility.getInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link JpaDistributionSetInvalidationManagement} bean.
|
||||
*
|
||||
* @return a new {@link JpaDistributionSetInvalidationManagement}
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
JpaDistributionSetInvalidationManagement distributionSetInvalidationManagement(
|
||||
final DistributionSetManagement distributionSetManagement, final RolloutManagement rolloutManagement,
|
||||
final DeploymentManagement deploymentManagement,
|
||||
final TargetFilterQueryManagement targetFilterQueryManagement, final ActionRepository actionRepository,
|
||||
final PlatformTransactionManager txManager, final RepositoryProperties repositoryProperties,
|
||||
final TenantAware tenantAware, final LockRegistry lockRegistry,
|
||||
final SystemSecurityContext systemSecurityContext) {
|
||||
return new JpaDistributionSetInvalidationManagement(distributionSetManagement, rolloutManagement,
|
||||
deploymentManagement, targetFilterQueryManagement, actionRepository, txManager, repositoryProperties,
|
||||
tenantAware, lockRegistry, systemSecurityContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* Default artifact encryption service bean that internally uses {@link ArtifactEncryption} and
|
||||
* {@link ArtifactEncryptionSecretsStore} beans for {@link SoftwareModule} artifacts encryption/decryption
|
||||
@@ -1019,4 +607,20 @@ public class JpaRepositoryConfiguration {
|
||||
ArtifactEncryptionService artifactEncryptionService() {
|
||||
return ArtifactEncryptionService.getInstance();
|
||||
}
|
||||
}
|
||||
|
||||
@Bean
|
||||
ManagementExceptionThrowingMethodAuthorizationDeniedHandler managementExceptionThrowingMethodAuthorizationDeniedHandler() {
|
||||
return new ManagementExceptionThrowingMethodAuthorizationDeniedHandler();
|
||||
}
|
||||
|
||||
public static class ManagementExceptionThrowingMethodAuthorizationDeniedHandler implements MethodAuthorizationDeniedHandler {
|
||||
|
||||
@Override
|
||||
public Object handleDeniedInvocation(final MethodInvocation methodInvocation, final AuthorizationResult authorizationResult) {
|
||||
throw ExceptionMapper.mapRe(
|
||||
authorizationResult instanceof AuthorizationDeniedException denied
|
||||
? denied
|
||||
: new AuthorizationDeniedException("Access Denied", authorizationResult));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,25 +9,13 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.aspects;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import jakarta.transaction.TransactionManager;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.annotation.AfterThrowing;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.eclipse.hawkbit.exception.GenericSpServerException;
|
||||
import org.eclipse.hawkbit.repository.exception.ConcurrentModificationException;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
|
||||
import org.eclipse.hawkbit.repository.exception.InsufficientPermissionException;
|
||||
import org.eclipse.hawkbit.repository.jpa.utils.ExceptionMapper;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.dao.DuplicateKeyException;
|
||||
import org.springframework.dao.OptimisticLockingFailureException;
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
import org.springframework.transaction.TransactionSystemException;
|
||||
|
||||
/**
|
||||
* {@link Aspect} catches persistence exceptions and wraps them to custom
|
||||
@@ -38,27 +26,8 @@ import org.springframework.transaction.TransactionSystemException;
|
||||
@Aspect
|
||||
public class ExceptionMappingAspectHandler implements Ordered {
|
||||
|
||||
private static final Map<String, String> EXCEPTION_MAPPING = new HashMap<>(4);
|
||||
|
||||
/**
|
||||
* this is required to enable a certain order of exception and to select the most specific mappable exception according to the type
|
||||
* hierarchy of the exception.
|
||||
*/
|
||||
private static final List<Class<?>> MAPPED_EXCEPTION_ORDER = new ArrayList<>(4);
|
||||
|
||||
static {
|
||||
MAPPED_EXCEPTION_ORDER.add(DuplicateKeyException.class);
|
||||
MAPPED_EXCEPTION_ORDER.add(OptimisticLockingFailureException.class);
|
||||
MAPPED_EXCEPTION_ORDER.add(AccessDeniedException.class);
|
||||
|
||||
EXCEPTION_MAPPING.put(DuplicateKeyException.class.getName(), EntityAlreadyExistsException.class.getName());
|
||||
|
||||
EXCEPTION_MAPPING.put(OptimisticLockingFailureException.class.getName(), ConcurrentModificationException.class.getName());
|
||||
EXCEPTION_MAPPING.put(AccessDeniedException.class.getName(), InsufficientPermissionException.class.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* catch exceptions of the {@link TransactionManager} and wrap them to custom exceptions.
|
||||
* Catches exceptions of the {@link TransactionManager} and wrap them to custom exceptions.
|
||||
*
|
||||
* @param ex the thrown and catched exception
|
||||
* @throws Throwable
|
||||
@@ -68,48 +37,11 @@ public class ExceptionMappingAspectHandler implements Ordered {
|
||||
// It is a AspectJ proxy which deals with exceptions.
|
||||
@SuppressWarnings({ "squid:S00112", "squid:S1162" })
|
||||
public void catchAndWrapJpaExceptionsService(final Exception ex) throws Throwable {
|
||||
if (log.isTraceEnabled()) {
|
||||
log.trace("Handling exception {}", ex.getClass().getName(), ex);
|
||||
} else {
|
||||
log.debug("Handling exception {}", ex.getClass().getName());
|
||||
}
|
||||
|
||||
// Workaround for EclipseLink merge where it does not throw ConstraintViolationException directly in case of existing entity update
|
||||
if (ex instanceof TransactionSystemException transactionSystemException) {
|
||||
throw replaceWithCauseIfConstraintViolationException(transactionSystemException);
|
||||
}
|
||||
|
||||
for (final Class<?> mappedEx : MAPPED_EXCEPTION_ORDER) {
|
||||
if (!mappedEx.isAssignableFrom(ex.getClass())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (EXCEPTION_MAPPING.containsKey(mappedEx.getName())) {
|
||||
throw (Exception) Class.forName(EXCEPTION_MAPPING.get(mappedEx.getName())).getConstructor(Throwable.class).newInstance(ex);
|
||||
}
|
||||
|
||||
log.error("there is no mapping configured for exception class {}", mappedEx.getName());
|
||||
throw new GenericSpServerException(ex);
|
||||
}
|
||||
|
||||
throw ex;
|
||||
throw ExceptionMapper.map(ex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static Exception replaceWithCauseIfConstraintViolationException(final TransactionSystemException rex) {
|
||||
Throwable exception = rex;
|
||||
do {
|
||||
final Throwable cause = exception.getCause();
|
||||
if (cause instanceof jakarta.validation.ConstraintViolationException) {
|
||||
return (Exception) cause;
|
||||
}
|
||||
exception = cause;
|
||||
} while (exception != null);
|
||||
|
||||
return rex;
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.builder;
|
||||
|
||||
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
|
||||
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
|
||||
import org.eclipse.hawkbit.repository.builder.DistributionSetBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.DistributionSetCreate;
|
||||
import org.eclipse.hawkbit.repository.builder.DistributionSetUpdate;
|
||||
import org.eclipse.hawkbit.repository.builder.GenericDistributionSetUpdate;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
|
||||
/**
|
||||
* Builder implementation for {@link DistributionSet}.
|
||||
*/
|
||||
public class JpaDistributionSetBuilder implements DistributionSetBuilder {
|
||||
|
||||
private final DistributionSetTypeManagement distributionSetTypeManagement;
|
||||
private final SoftwareModuleManagement softwareModuleManagement;
|
||||
|
||||
public JpaDistributionSetBuilder(final DistributionSetTypeManagement distributionSetTypeManagement,
|
||||
final SoftwareModuleManagement softwareManagement) {
|
||||
this.distributionSetTypeManagement = distributionSetTypeManagement;
|
||||
this.softwareModuleManagement = softwareManagement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DistributionSetUpdate update(final long id) {
|
||||
return new GenericDistributionSetUpdate(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DistributionSetCreate create() {
|
||||
return new JpaDistributionSetCreate(distributionSetTypeManagement, softwareModuleManagement);
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.builder;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Optional;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
|
||||
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
|
||||
import org.eclipse.hawkbit.repository.ValidString;
|
||||
import org.eclipse.hawkbit.repository.builder.AbstractDistributionSetUpdateCreate;
|
||||
import org.eclipse.hawkbit.repository.builder.DistributionSetCreate;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
/**
|
||||
* Create/build implementation.
|
||||
*/
|
||||
public class JpaDistributionSetCreate extends AbstractDistributionSetUpdateCreate<DistributionSetCreate> implements DistributionSetCreate {
|
||||
|
||||
private final DistributionSetTypeManagement distributionSetTypeManagement;
|
||||
private final SoftwareModuleManagement softwareModuleManagement;
|
||||
|
||||
@Getter
|
||||
@ValidString
|
||||
private String type;
|
||||
|
||||
JpaDistributionSetCreate(
|
||||
final DistributionSetTypeManagement distributionSetTypeManagement, final SoftwareModuleManagement softwareManagement) {
|
||||
this.distributionSetTypeManagement = distributionSetTypeManagement;
|
||||
this.softwareModuleManagement = softwareManagement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DistributionSetCreate type(final String type) {
|
||||
this.type = type.strip();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JpaDistributionSet build() {
|
||||
return new JpaDistributionSet(
|
||||
name, version, description,
|
||||
Optional.ofNullable(type).map(this::findDistributionSetTypeWithExceptionIfNotFound).orElse(null),
|
||||
findSoftwareModuleWithExceptionIfNotFound(modules),
|
||||
Optional.ofNullable(requiredMigrationStep).orElse(Boolean.FALSE));
|
||||
}
|
||||
|
||||
private DistributionSetType findDistributionSetTypeWithExceptionIfNotFound(final String distributionSetTypekey) {
|
||||
return distributionSetTypeManagement.findByKey(distributionSetTypekey)
|
||||
.orElseThrow(() -> new EntityNotFoundException(DistributionSetType.class, distributionSetTypekey));
|
||||
}
|
||||
|
||||
private Collection<SoftwareModule> findSoftwareModuleWithExceptionIfNotFound(final Collection<Long> softwareModuleIds) {
|
||||
if (CollectionUtils.isEmpty(softwareModuleIds)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
final Collection<SoftwareModule> modules = softwareModuleManagement.get(softwareModuleIds);
|
||||
if (modules.size() < softwareModuleIds.size()) {
|
||||
throw new EntityNotFoundException(SoftwareModule.class, softwareModuleIds);
|
||||
}
|
||||
|
||||
return modules;
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.builder;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
|
||||
import org.eclipse.hawkbit.repository.builder.DistributionSetTypeBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.DistributionSetTypeCreate;
|
||||
import org.eclipse.hawkbit.repository.builder.DistributionSetTypeUpdate;
|
||||
import org.eclipse.hawkbit.repository.builder.GenericDistributionSetTypeUpdate;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||
|
||||
/**
|
||||
* Builder implementation for {@link DistributionSetType}.
|
||||
*/
|
||||
public class JpaDistributionSetTypeBuilder implements DistributionSetTypeBuilder {
|
||||
|
||||
private final SoftwareModuleTypeManagement softwareModuleTypeManagement;
|
||||
|
||||
public JpaDistributionSetTypeBuilder(final SoftwareModuleTypeManagement softwareModuleTypeManagement) {
|
||||
this.softwareModuleTypeManagement = softwareModuleTypeManagement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DistributionSetTypeUpdate update(final long id) {
|
||||
return new GenericDistributionSetTypeUpdate(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DistributionSetTypeCreate create() {
|
||||
return new JpaDistributionSetTypeCreate(softwareModuleTypeManagement);
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.builder;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
|
||||
import org.eclipse.hawkbit.repository.builder.AbstractDistributionSetTypeUpdateCreate;
|
||||
import org.eclipse.hawkbit.repository.builder.DistributionSetTypeCreate;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSetType;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
/**
|
||||
* Create/build implementation.
|
||||
*/
|
||||
public class JpaDistributionSetTypeCreate extends AbstractDistributionSetTypeUpdateCreate<DistributionSetTypeCreate>
|
||||
implements DistributionSetTypeCreate {
|
||||
|
||||
private final SoftwareModuleTypeManagement softwareModuleTypeManagement;
|
||||
|
||||
JpaDistributionSetTypeCreate(final SoftwareModuleTypeManagement softwareModuleTypeManagement) {
|
||||
this.softwareModuleTypeManagement = softwareModuleTypeManagement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JpaDistributionSetType build() {
|
||||
final JpaDistributionSetType result = new JpaDistributionSetType(key, name, description, colour);
|
||||
|
||||
findSoftwareModuleTypeWithExceptionIfNotFound(mandatory).forEach(result::addMandatoryModuleType);
|
||||
findSoftwareModuleTypeWithExceptionIfNotFound(optional).forEach(result::addOptionalModuleType);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private Collection<SoftwareModuleType> findSoftwareModuleTypeWithExceptionIfNotFound(
|
||||
final Collection<Long> softwareModuleTypeId) {
|
||||
if (CollectionUtils.isEmpty(softwareModuleTypeId)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
final Collection<SoftwareModuleType> module = softwareModuleTypeManagement.get(softwareModuleTypeId);
|
||||
if (module.size() < softwareModuleTypeId.size()) {
|
||||
throw new EntityNotFoundException(SoftwareModuleType.class, softwareModuleTypeId);
|
||||
}
|
||||
|
||||
return module;
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.builder;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
|
||||
import org.eclipse.hawkbit.repository.builder.GenericSoftwareModuleUpdate;
|
||||
import org.eclipse.hawkbit.repository.builder.SoftwareModuleBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.SoftwareModuleCreate;
|
||||
import org.eclipse.hawkbit.repository.builder.SoftwareModuleUpdate;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
|
||||
/**
|
||||
* Builder implementation for {@link SoftwareModule}.
|
||||
*/
|
||||
public class JpaSoftwareModuleBuilder implements SoftwareModuleBuilder {
|
||||
|
||||
private final SoftwareModuleTypeManagement softwareModuleTypeManagement;
|
||||
|
||||
public JpaSoftwareModuleBuilder(final SoftwareModuleTypeManagement softwareModuleTypeManagement) {
|
||||
this.softwareModuleTypeManagement = softwareModuleTypeManagement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SoftwareModuleUpdate update(final long id) {
|
||||
return new GenericSoftwareModuleUpdate(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SoftwareModuleCreate create() {
|
||||
return new JpaSoftwareModuleCreate(softwareModuleTypeManagement);
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.builder;
|
||||
|
||||
import jakarta.validation.ValidationException;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
|
||||
import org.eclipse.hawkbit.repository.builder.AbstractSoftwareModuleUpdateCreate;
|
||||
import org.eclipse.hawkbit.repository.builder.SoftwareModuleCreate;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaSoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
|
||||
/**
|
||||
* Create/build implementation.
|
||||
*/
|
||||
public class JpaSoftwareModuleCreate extends AbstractSoftwareModuleUpdateCreate<SoftwareModuleCreate> implements SoftwareModuleCreate {
|
||||
|
||||
private final SoftwareModuleTypeManagement softwareModuleTypeManagement;
|
||||
private boolean encrypted;
|
||||
|
||||
JpaSoftwareModuleCreate(final SoftwareModuleTypeManagement softwareModuleTypeManagement) {
|
||||
this.softwareModuleTypeManagement = softwareModuleTypeManagement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SoftwareModuleCreate encrypted(final boolean encrypted) {
|
||||
this.encrypted = encrypted;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JpaSoftwareModule build() {
|
||||
return new JpaSoftwareModule(getSoftwareModuleTypeFromKeyString(type), name, version, description, vendor,
|
||||
encrypted);
|
||||
}
|
||||
|
||||
public boolean isEncrypted() {
|
||||
return encrypted;
|
||||
}
|
||||
|
||||
private SoftwareModuleType getSoftwareModuleTypeFromKeyString(final String type) {
|
||||
if (type == null) {
|
||||
throw new ValidationException("type cannot be null");
|
||||
}
|
||||
|
||||
return softwareModuleTypeManagement.findByKey(type.trim())
|
||||
.orElseThrow(() -> new EntityNotFoundException(SoftwareModuleType.class, type.trim()));
|
||||
}
|
||||
}
|
||||
@@ -9,11 +9,11 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.builder;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
|
||||
import org.eclipse.hawkbit.repository.builder.GenericSoftwareModuleMetadataUpdate;
|
||||
import org.eclipse.hawkbit.repository.builder.SoftwareModuleMetadataBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.SoftwareModuleMetadataCreate;
|
||||
import org.eclipse.hawkbit.repository.builder.SoftwareModuleMetadataUpdate;
|
||||
import org.eclipse.hawkbit.repository.jpa.management.JpaSoftwareModuleManagement;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
|
||||
|
||||
/**
|
||||
@@ -21,9 +21,9 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
|
||||
*/
|
||||
public class JpaSoftwareModuleMetadataBuilder implements SoftwareModuleMetadataBuilder {
|
||||
|
||||
private final SoftwareModuleManagement softwareModuleManagement;
|
||||
private final JpaSoftwareModuleManagement softwareModuleManagement;
|
||||
|
||||
public JpaSoftwareModuleMetadataBuilder(final SoftwareModuleManagement softwareModuleManagement) {
|
||||
public JpaSoftwareModuleMetadataBuilder(final JpaSoftwareModuleManagement softwareModuleManagement) {
|
||||
this.softwareModuleManagement = softwareModuleManagement;
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user