Code format hawkbit-repository-api (#1926)

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2024-11-05 09:32:03 +02:00
committed by GitHub
parent 71aa00ca7c
commit 67eb170f7c
243 changed files with 2256 additions and 3976 deletions

View File

@@ -9,89 +9,89 @@
SPDX-License-Identifier: EPL-2.0 SPDX-License-Identifier: EPL-2.0
--> -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>org.eclipse.hawkbit</groupId> <groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-repository</artifactId> <artifactId>hawkbit-repository</artifactId>
<version>${revision}</version> <version>${revision}</version>
</parent> </parent>
<artifactId>hawkbit-repository-api</artifactId> <artifactId>hawkbit-repository-api</artifactId>
<name>hawkBit :: Repository :: API</name> <name>hawkBit :: Repository :: API</name>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.eclipse.hawkbit</groupId> <groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-security-core</artifactId> <artifactId>hawkbit-security-core</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId> <artifactId>jackson-annotations</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>jakarta.validation</groupId> <groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId> <artifactId>jakarta.validation-api</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.hateoas</groupId> <groupId>org.springframework.hateoas</groupId>
<artifactId>spring-hateoas</artifactId> <artifactId>spring-hateoas</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-bus</artifactId> <artifactId>spring-cloud-bus</artifactId>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId> <artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion> </exclusion>
<exclusion> <exclusion>
<groupId>org.springframework.security</groupId> <groupId>org.springframework.security</groupId>
<artifactId>spring-security-rsa</artifactId> <artifactId>spring-security-rsa</artifactId>
</exclusion> </exclusion>
<exclusion> <exclusion>
<groupId>org.objenesis</groupId> <groupId>org.objenesis</groupId>
<artifactId>objenesis</artifactId> <artifactId>objenesis</artifactId>
</exclusion> </exclusion>
<exclusion> <exclusion>
<groupId>org.apache.tomcat.embed</groupId> <groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-el</artifactId> <artifactId>tomcat-embed-el</artifactId>
</exclusion> </exclusion>
<exclusion> <exclusion>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-context</artifactId> <artifactId>spring-cloud-function-context</artifactId>
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.cronutils</groupId> <groupId>com.cronutils</groupId>
<artifactId>cron-utils</artifactId> <artifactId>cron-utils</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>cz.jirutka.rsql</groupId> <groupId>cz.jirutka.rsql</groupId>
<artifactId>rsql-parser</artifactId> <artifactId>rsql-parser</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.jsoup</groupId> <groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId> <artifactId>jsoup</artifactId>
</dependency> </dependency>
<!-- TEST --> <!-- TEST -->
<dependency> <dependency>
<groupId>io.github.classgraph</groupId> <groupId>io.github.classgraph</groupId>
<artifactId>classgraph</artifactId> <artifactId>classgraph</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.qameta.allure</groupId> <groupId>io.qameta.allure</groupId>
<artifactId>allure-junit5</artifactId> <artifactId>allure-junit5</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>

View File

@@ -17,7 +17,6 @@ import org.eclipse.hawkbit.repository.exception.ArtifactEncryptionFailedExceptio
/** /**
* Interface definition for artifact encryption. * Interface definition for artifact encryption.
*
*/ */
public interface ArtifactEncryption { public interface ArtifactEncryption {
@@ -32,34 +31,27 @@ public interface ArtifactEncryption {
* Generates required secrets key/value pairs. * Generates required secrets key/value pairs.
* *
* @return secrets key/value pairs * @return secrets key/value pairs
* @throws ArtifactEncryptionFailedException * @throws ArtifactEncryptionFailedException thrown in case of an error while generating secrets
* thrown in case of an error while generating secrets
*/ */
Map<String, String> generateSecrets(); Map<String, String> generateSecrets();
/** /**
* Encrypts artifact stream with provided secrets. * Encrypts artifact stream with provided secrets.
* *
* @param secrets * @param secrets secrets key/value pairs to be used for encryption
* secrets key/value pairs to be used for encryption * @param stream artifact stream to encrypt
* @param stream
* artifact stream to encrypt
* @return encrypted input stream * @return encrypted input stream
* @throws ArtifactEncryptionFailedException * @throws ArtifactEncryptionFailedException thrown in case of an error while encrypting the provided stream
* thrown in case of an error while encrypting the provided stream
*/ */
InputStream encryptStream(final Map<String, String> secrets, final InputStream stream); InputStream encryptStream(final Map<String, String> secrets, final InputStream stream);
/** /**
* Decrypts encrypted artifact stream based on provided secrets. * Decrypts encrypted artifact stream based on provided secrets.
* *
* @param secrets * @param secrets secrets key/value pairs to be used for decryption
* secrets key/value pairs to be used for decryption * @param stream artifact stream to decrypt
* @param stream
* artifact stream to decrypt
* @return decrypted input stream * @return decrypted input stream
* @throws ArtifactEncryptionFailedException * @throws ArtifactEncryptionFailedException thrown in case of an error while decrypting the provided stream
* thrown in case of an error while decrypting the provided stream
*/ */
InputStream decryptStream(final Map<String, String> secrets, final InputStream stream); InputStream decryptStream(final Map<String, String> secrets, final InputStream stream);

View File

@@ -15,7 +15,6 @@ import org.eclipse.hawkbit.repository.model.SoftwareModule;
/** /**
* Interface definition for artifact encryption secrets store. * Interface definition for artifact encryption secrets store.
*
*/ */
public interface ArtifactEncryptionSecretsStore { public interface ArtifactEncryptionSecretsStore {
@@ -23,12 +22,9 @@ public interface ArtifactEncryptionSecretsStore {
* Adds secret key/value pair associated with particular * Adds secret key/value pair associated with particular
* {@link SoftwareModule} id to the store. * {@link SoftwareModule} id to the store.
* *
* @param softwareModuleId * @param softwareModuleId {@link SoftwareModule} id associated with the secret
* {@link SoftwareModule} id associated with the secret * @param secretKey key of the secret
* @param secretKey * @param secretValue value of the secret
* key of the secret
* @param secretValue
* value of the secret
*/ */
void addSecret(final long softwareModuleId, final String secretKey, final String secretValue); void addSecret(final long softwareModuleId, final String secretKey, final String secretValue);
@@ -36,10 +32,8 @@ public interface ArtifactEncryptionSecretsStore {
* Checks if secret is present for particular {@link SoftwareModule} id and * Checks if secret is present for particular {@link SoftwareModule} id and
* key in the store. * key in the store.
* *
* @param softwareModuleId * @param softwareModuleId {@link SoftwareModule} id associated with the secret
* {@link SoftwareModule} id associated with the secret * @param secretKey key of the secret
* @param secretKey
* key of the secret
*/ */
boolean secretExists(final long softwareModuleId, final String secretKey); boolean secretExists(final long softwareModuleId, final String secretKey);
@@ -47,10 +41,8 @@ public interface ArtifactEncryptionSecretsStore {
* Retrieves secret value associated with particular {@link SoftwareModule} * Retrieves secret value associated with particular {@link SoftwareModule}
* id and key from the store. * id and key from the store.
* *
* @param softwareModuleId * @param softwareModuleId {@link SoftwareModule} id associated with the secret
* {@link SoftwareModule} id associated with the secret * @param secretKey key of the secret
* @param secretKey
* key of the secret
*/ */
Optional<String> getSecret(final long softwareModuleId, final String secretKey); Optional<String> getSecret(final long softwareModuleId, final String secretKey);
@@ -58,10 +50,8 @@ public interface ArtifactEncryptionSecretsStore {
* Removes secret key/value pair associated with particular * Removes secret key/value pair associated with particular
* {@link SoftwareModule} id from the store. * {@link SoftwareModule} id from the store.
* *
* @param softwareModuleId * @param softwareModuleId {@link SoftwareModule} id associated with the secret
* {@link SoftwareModule} id associated with the secret * @param secretKey key of the secret
* @param secretKey
* key of the secret
*/ */
void removeSecret(final long softwareModuleId, final String secretKey); void removeSecret(final long softwareModuleId, final String secretKey);
} }

View File

@@ -20,7 +20,6 @@ import org.springframework.beans.factory.annotation.Autowired;
/** /**
* Service responsible for encryption operations. * Service responsible for encryption operations.
*
*/ */
public final class ArtifactEncryptionService { public final class ArtifactEncryptionService {
@@ -55,8 +54,7 @@ public final class ArtifactEncryptionService {
* Generates encryption secrets and saves them in secret store by software * Generates encryption secrets and saves them in secret store by software
* module id reference. * module id reference.
* *
* @param smId * @param smId software module id
* software module id
*/ */
public void addSoftwareModuleEncryptionSecrets(final long smId) { public void addSoftwareModuleEncryptionSecrets(final long smId) {
if (!isEncryptionSupported()) { if (!isEncryptionSupported()) {
@@ -73,10 +71,8 @@ public final class ArtifactEncryptionService {
* Encrypts artifact stream using the keys retrieved from secrets store by * Encrypts artifact stream using the keys retrieved from secrets store by
* software module id reference. * software module id reference.
* *
* @param smId * @param smId software module id
* software module id * @param artifactStream artifact stream to encrypt
* @param artifactStream
* artifact stream to encrypt
* @return encrypted input stream * @return encrypted input stream
*/ */
public InputStream encryptSoftwareModuleArtifact(final long smId, final InputStream artifactStream) { public InputStream encryptSoftwareModuleArtifact(final long smId, final InputStream artifactStream) {
@@ -87,26 +83,12 @@ public final class ArtifactEncryptionService {
return artifactEncryption.encryptStream(getSoftwareModuleEncryptionSecrets(smId), artifactStream); return artifactEncryption.encryptStream(getSoftwareModuleEncryptionSecrets(smId), artifactStream);
} }
private Map<String, String> getSoftwareModuleEncryptionSecrets(final long smId) {
final Set<String> requiredSecretsKeys = artifactEncryption.requiredSecretKeys();
final Map<String, String> requiredSecrets = new HashMap<>();
for (final String requiredSecretsKey : requiredSecretsKeys) {
final Optional<String> requiredSecretsValue = artifactEncryptionSecretsStore.getSecret(smId,
requiredSecretsKey);
requiredSecretsValue.ifPresent(secretValue -> requiredSecrets.put(requiredSecretsKey, secretValue));
}
return requiredSecrets;
}
/** /**
* Decrypts artifact stream using the keys retrieved from secrets store by * Decrypts artifact stream using the keys retrieved from secrets store by
* software module id reference. * software module id reference.
* *
* @param smId * @param smId software module id
* software module id * @param encryptedArtifactStream artifact stream to decrypt
* @param encryptedArtifactStream
* artifact stream to decrypt
* @return decrypted input stream * @return decrypted input stream
*/ */
public InputStream decryptSoftwareModuleArtifact(final long smId, final InputStream encryptedArtifactStream) { public InputStream decryptSoftwareModuleArtifact(final long smId, final InputStream encryptedArtifactStream) {
@@ -125,4 +107,16 @@ public final class ArtifactEncryptionService {
public int encryptionSizeOverhead() { public int encryptionSizeOverhead() {
return artifactEncryption.encryptionSizeOverhead(); return artifactEncryption.encryptionSizeOverhead();
} }
private Map<String, String> getSoftwareModuleEncryptionSecrets(final long smId) {
final Set<String> requiredSecretsKeys = artifactEncryption.requiredSecretKeys();
final Map<String, String> requiredSecrets = new HashMap<>();
for (final String requiredSecretsKey : requiredSecretsKeys) {
final Optional<String> requiredSecretsValue = artifactEncryptionSecretsStore.getSecret(smId,
requiredSecretsKey);
requiredSecretsValue.ifPresent(secretValue -> requiredSecrets.put(requiredSecretsKey, secretValue));
}
return requiredSecrets;
}
} }

View File

@@ -33,9 +33,9 @@ import org.springframework.security.access.prepost.PreAuthorize;
/** /**
* Service for {@link Artifact} management operations. * Service for {@link Artifact} management operations.
*
*/ */
public interface ArtifactManagement { public interface ArtifactManagement {
/** /**
* @return the total amount of local artifacts stored in the artifact * @return the total amount of local artifacts stored in the artifact
* management * management
@@ -47,23 +47,14 @@ public interface ArtifactManagement {
* Persists artifact binary as provided by given InputStream. assign the * Persists artifact binary as provided by given InputStream. assign the
* artifact in addition to given {@link SoftwareModule}. * artifact in addition to given {@link SoftwareModule}.
* *
* @param artifactUpload * @param artifactUpload {@link ArtifactUpload} containing the upload information
* {@link ArtifactUpload} containing the upload information
*
* @return uploaded {@link Artifact} * @return uploaded {@link Artifact}
* * @throws EntityNotFoundException if given software module does not exist
* @throws EntityNotFoundException * @throws EntityAlreadyExistsException if File with that name already exists in the Software Module
* if given software module does not exist * @throws ArtifactUploadFailedException if upload fails with internal server errors
* @throws EntityAlreadyExistsException * @throws InvalidMD5HashException if check against provided MD5 checksum failed
* if File with that name already exists in the Software Module * @throws InvalidSHA1HashException if check against provided SHA1 checksum failed
* @throws ArtifactUploadFailedException * @throws ConstraintViolationException if {@link ArtifactUpload} contains invalid values
* if upload fails with internal server errors
* @throws InvalidMD5HashException
* if check against provided MD5 checksum failed
* @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_AUTH_CREATE_REPOSITORY)
Artifact create(@NotNull @Valid ArtifactUpload artifactUpload); Artifact create(@NotNull @Valid ArtifactUpload artifactUpload);
@@ -71,12 +62,9 @@ public interface ArtifactManagement {
/** /**
* Deletes {@link Artifact} based on given id. * Deletes {@link Artifact} based on given id.
* *
* @param id * @param id of the {@link Artifact} that has to be deleted.
* of the {@link Artifact} that has to be deleted. * @throws ArtifactDeleteFailedException if deletion failed (MongoDB is not available)
* @throws ArtifactDeleteFailedException * @throws EntityNotFoundException if artifact with given ID does not exist
* 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_AUTH_DELETE_REPOSITORY)
void delete(long id); void delete(long id);
@@ -84,8 +72,7 @@ public interface ArtifactManagement {
/** /**
* Searches for {@link Artifact} with given {@link Identifiable}. * Searches for {@link Artifact} with given {@link Identifiable}.
* *
* @param id * @param id to search for
* to search for
* @return found {@link Artifact} * @return found {@link Artifact}
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR
@@ -95,14 +82,10 @@ public interface ArtifactManagement {
/** /**
* Find by artifact by software module id and filename. * Find by artifact by software module id and filename.
* *
* @param filename * @param filename file name
* file name * @param softwareModuleId software module id.
* @param softwareModuleId
* software module id.
* @return found {@link Artifact} * @return found {@link Artifact}
* * @throws EntityNotFoundException if software module with given ID does not exist
* @throws EntityNotFoundException
* if software module with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR
+ SpringEvalExpressions.IS_CONTROLLER) + SpringEvalExpressions.IS_CONTROLLER)
@@ -111,8 +94,7 @@ public interface ArtifactManagement {
/** /**
* Find all local artifact by sha1 and return the first artifact. * Find all local artifact by sha1 and return the first artifact.
* *
* @param sha1 * @param sha1 the sha1
* the sha1
* @return the first local artifact * @return the first local artifact
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR
@@ -122,8 +104,7 @@ public interface ArtifactManagement {
/** /**
* Searches for {@link Artifact} with given file name. * Searches for {@link Artifact} with given file name.
* *
* @param filename * @param filename to search for
* to search for
* @return found List of {@link Artifact}s. * @return found List of {@link Artifact}s.
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR
@@ -133,14 +114,10 @@ public interface ArtifactManagement {
/** /**
* Get local artifact for a base software module. * Get local artifact for a base software module.
* *
* @param pageReq * @param pageReq Pageable parameter
* Pageable parameter * @param softwareModuleId software module id
* @param softwareModuleId
* software module id
* @return Page<Artifact> * @return Page<Artifact>
* * @throws EntityNotFoundException if software module with given ID does not exist
* @throws EntityNotFoundException
* if software module with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Page<Artifact> findBySoftwareModule(@NotNull Pageable pageReq, long softwareModuleId); Page<Artifact> findBySoftwareModule(@NotNull Pageable pageReq, long softwareModuleId);
@@ -148,12 +125,9 @@ public interface ArtifactManagement {
/** /**
* Count local artifacts for a base software module. * Count local artifacts for a base software module.
* *
* @param softwareModuleId * @param softwareModuleId software module id
* software module id
* @return count by software module * @return count by software module
* * @throws EntityNotFoundException if software module with given ID does not exist
* @throws EntityNotFoundException
* if software module with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
long countBySoftwareModule(long softwareModuleId); long countBySoftwareModule(long softwareModuleId);
@@ -161,14 +135,10 @@ public interface ArtifactManagement {
/** /**
* Loads {@link DbArtifact} from store for given {@link Artifact}. * Loads {@link DbArtifact} from store for given {@link Artifact}.
* *
* @param sha1Hash * @param sha1Hash to search for
* to search for * @param softwareModuleId software module id.
* @param softwareModuleId * @param isEncrypted flag to indicate if artifact is encrypted.
* software module id.
* @param isEncrypted
* flag to indicate if artifact is encrypted.
* @return loaded {@link DbArtifact} * @return loaded {@link DbArtifact}
*
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DOWNLOAD_ARTIFACT + SpringEvalExpressions.HAS_AUTH_OR @PreAuthorize(SpringEvalExpressions.HAS_AUTH_DOWNLOAD_ARTIFACT + SpringEvalExpressions.HAS_AUTH_OR
+ SpringEvalExpressions.IS_CONTROLLER) + SpringEvalExpressions.IS_CONTROLLER)

View File

@@ -17,6 +17,7 @@ public interface BaseRepositoryTypeProvider {
/** /**
* Return a base repository implementation that shall be used based on provided repository type * Return a base repository implementation that shall be used based on provided repository type
*
* @param repositoryType type of repository * @param repositoryType type of repository
* @return base repository implementation class * @return base repository implementation class
*/ */

View File

@@ -9,17 +9,18 @@
*/ */
package org.eclipse.hawkbit.repository; package org.eclipse.hawkbit.repository;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import jakarta.validation.constraints.NotEmpty;
import org.eclipse.hawkbit.im.authentication.SpPermission; import org.eclipse.hawkbit.im.authentication.SpPermission;
import org.eclipse.hawkbit.repository.model.Action; import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.AutoConfirmationStatus; import org.eclipse.hawkbit.repository.model.AutoConfirmationStatus;
import org.eclipse.hawkbit.tenancy.TenantAware; import org.eclipse.hawkbit.tenancy.TenantAware;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import jakarta.validation.constraints.NotEmpty;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
/** /**
* Service layer for all confirmation related operations. * Service layer for all confirmation related operations.
*/ */
@@ -29,8 +30,7 @@ public interface ConfirmationManagement {
* Find active actions in the {@link Action.Status#WAIT_FOR_CONFIRMATION} state * Find active actions in the {@link Action.Status#WAIT_FOR_CONFIRMATION} state
* for a specific target with a specified controllerId. * for a specific target with a specified controllerId.
* *
* @param controllerId * @param controllerId of the target to check
* of the target to check
* @return a list of {@link Action} * @return a list of {@link Action}
*/ */
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_TARGET)
@@ -40,13 +40,10 @@ public interface ConfirmationManagement {
* Activate auto confirmation for a given controller ID. In case auto * Activate auto confirmation for a given controller ID. In case auto
* confirmation is active already, this method will fail with an exception. * confirmation is active already, this method will fail with an exception.
* *
* @param controllerId * @param controllerId to activate the feature for
* to activate the feature for * @param initiator who initiated this operation. If 'null' we will take the current
* @param initiator * user from {@link TenantAware#getCurrentUsername()}
* who initiated this operation. If 'null' we will take the current * @param remark optional field to set a remark
* user from {@link TenantAware#getCurrentUsername()}
* @param remark
* optional field to set a remark
* @return the persisted {@link AutoConfirmationStatus} * @return the persisted {@link AutoConfirmationStatus}
*/ */
@PreAuthorize(SpPermission.SpringEvalExpressions.IS_CONTROLLER_OR_HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET) @PreAuthorize(SpPermission.SpringEvalExpressions.IS_CONTROLLER_OR_HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
@@ -56,8 +53,7 @@ public interface ConfirmationManagement {
/** /**
* Get the current state of auto-confirmation for a given controllerId * Get the current state of auto-confirmation for a given controllerId
* *
* @param controllerId * @param controllerId to check the state for
* to check the state for
* @return instance of {@link AutoConfirmationStatus} wrapped in an * @return instance of {@link AutoConfirmationStatus} wrapped in an
* {@link Optional}. Present if active and empty if disabled. * {@link Optional}. Present if active and empty if disabled.
*/ */
@@ -69,8 +65,7 @@ public interface ConfirmationManagement {
* Auto confirm active actions for a specific controller ID having the * Auto confirm active actions for a specific controller ID having the
* {@link Action.Status#WAIT_FOR_CONFIRMATION} status. * {@link Action.Status#WAIT_FOR_CONFIRMATION} status.
* *
* @param controllerId * @param controllerId to confirm actions for
* to confirm actions for
* @return a list of confirmed actions * @return a list of confirmed actions
*/ */
@PreAuthorize(SpPermission.SpringEvalExpressions.IS_CONTROLLER_OR_HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET) @PreAuthorize(SpPermission.SpringEvalExpressions.IS_CONTROLLER_OR_HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
@@ -81,12 +76,9 @@ public interface ConfirmationManagement {
* {@link Action.Status#WAIT_FOR_CONFIRMATION} to {@link Action.Status#RUNNING} * {@link Action.Status#WAIT_FOR_CONFIRMATION} to {@link Action.Status#RUNNING}
* state. * state.
* *
* @param actionId * @param actionId mandatory to know which action to confirm
* mandatory to know which action to confirm * @param code optional value to specify a code for the created action status
* @param code * @param messages optional value to specify message for the created action status
* optional value to specify a code for the created action status
* @param messages
* optional value to specify message for the created action status
*/ */
@PreAuthorize(SpPermission.SpringEvalExpressions.IS_CONTROLLER_OR_HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET) @PreAuthorize(SpPermission.SpringEvalExpressions.IS_CONTROLLER_OR_HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
Action confirmAction(long actionId, Integer code, Collection<String> messages); Action confirmAction(long actionId, Integer code, Collection<String> messages);
@@ -95,12 +87,9 @@ public interface ConfirmationManagement {
* Deny a given action and leave it in * Deny a given action and leave it in
* {@link Action.Status#WAIT_FOR_CONFIRMATION} state. * {@link Action.Status#WAIT_FOR_CONFIRMATION} state.
* *
* @param actionId * @param actionId mandatory to know which action to deny
* mandatory to know which action to deny * @param code optional value to specify a code for the created action status
* @param code * @param messages optional value to specify message for the created action status
* optional value to specify a code for the created action status
* @param messages
* optional value to specify message for the created action status
*/ */
@PreAuthorize(SpPermission.SpringEvalExpressions.IS_CONTROLLER_OR_HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET) @PreAuthorize(SpPermission.SpringEvalExpressions.IS_CONTROLLER_OR_HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
Action denyAction(long actionId, Integer code, Collection<String> messages); Action denyAction(long actionId, Integer code, Collection<String> messages);
@@ -108,8 +97,7 @@ public interface ConfirmationManagement {
/** /**
* Deactivate auto confirmation for a specific controller id * Deactivate auto confirmation for a specific controller id
* *
* @param controllerId * @param controllerId to disable auto confirmation for
* to disable auto confirmation for
*/ */
@PreAuthorize(SpPermission.SpringEvalExpressions.IS_CONTROLLER_OR_HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET) @PreAuthorize(SpPermission.SpringEvalExpressions.IS_CONTROLLER_OR_HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
void deactivateAutoConfirmation(@NotEmpty String controllerId); void deactivateAutoConfirmation(@NotEmpty String controllerId);

View File

@@ -14,7 +14,6 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
/** /**
* Repository API constants. * Repository API constants.
*
*/ */
public final class Constants { public final class Constants {

View File

@@ -43,7 +43,6 @@ import org.springframework.security.access.prepost.PreAuthorize;
/** /**
* Service layer for all operations of the DDI API (with access permissions only * Service layer for all operations of the DDI API (with access permissions only
* for the controller). * for the controller).
*
*/ */
public interface ControllerManagement { public interface ControllerManagement {
@@ -51,22 +50,14 @@ public interface ControllerManagement {
* Adds an {@link ActionStatus} for a cancel {@link Action} including * Adds an {@link ActionStatus} for a cancel {@link Action} including
* potential state changes for the target and the {@link Action} itself. * potential state changes for the target and the {@link Action} itself.
* *
* @param create * @param create to be added
* to be added
* @return the updated {@link Action} * @return the updated {@link Action}
* * @throws EntityAlreadyExistsException if a given entity already exists
* @throws EntityAlreadyExistsException * @throws AssignmentQuotaExceededException if more than the allowed number of status entries or messages
* if a given entity already exists * per entry are inserted
* * @throws EntityNotFoundException if given action does not exist
* @throws AssignmentQuotaExceededException * @throws ConstraintViolationException if fields are not filled as specified. Check
* if more than the allowed number of status entries or messages * {@link ActionStatusCreate} for field constraints.
* per entry are inserted
* @throws EntityNotFoundException
* if given action does not exist
* @throws ConstraintViolationException
* if fields are not filled as specified. Check
* {@link ActionStatusCreate} for field constraints.
*
*/ */
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER) @PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
Action addCancelActionStatus(@NotNull @Valid ActionStatusCreate create); Action addCancelActionStatus(@NotNull @Valid ActionStatusCreate create);
@@ -74,8 +65,7 @@ public interface ControllerManagement {
/** /**
* Retrieves assigned {@link SoftwareModule} of a target. * Retrieves assigned {@link SoftwareModule} of a target.
* *
* @param moduleId * @param moduleId of the {@link SoftwareModule}
* of the {@link SoftwareModule}
* @return {@link SoftwareModule} identified by ID * @return {@link SoftwareModule} identified by ID
*/ */
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER) @PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
@@ -85,8 +75,7 @@ public interface ControllerManagement {
* Retrieves {@link SoftwareModuleMetadata} where * Retrieves {@link SoftwareModuleMetadata} where
* {@link SoftwareModuleMetadata#isTargetVisible()}. * {@link SoftwareModuleMetadata#isTargetVisible()}.
* *
* @param moduleId * @param moduleId of the {@link SoftwareModule}
* of the {@link SoftwareModule}
* @return list of {@link SoftwareModuleMetadata} with maximum size of * @return list of {@link SoftwareModuleMetadata} with maximum size of
* {@link RepositoryConstants#MAX_META_DATA_COUNT} * {@link RepositoryConstants#MAX_META_DATA_COUNT}
*/ */
@@ -98,19 +87,13 @@ public interface ControllerManagement {
* Simple addition of a new {@link ActionStatus} entry to the * Simple addition of a new {@link ActionStatus} entry to the
* {@link Action}. No state changes. * {@link Action}. No state changes.
* *
* @param create * @param create to add to the action
* to add to the action
*
* @return created {@link ActionStatus} entity * @return created {@link ActionStatus} entity
* * @throws AssignmentQuotaExceededException if more than the allowed number of status entries or messages
* @throws AssignmentQuotaExceededException * per entry are inserted
* if more than the allowed number of status entries or messages * @throws EntityNotFoundException if given action does not exist
* per entry are inserted * @throws ConstraintViolationException if fields are not filled as specified. Check
* @throws EntityNotFoundException * {@link ActionStatusCreate} for field constraints.
* if given action does not exist
* @throws ConstraintViolationException
* if fields are not filled as specified. Check
* {@link ActionStatusCreate} for field constraints.
*/ */
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER) @PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
ActionStatus addInformationalActionStatus(@NotNull @Valid ActionStatusCreate create); ActionStatus addInformationalActionStatus(@NotNull @Valid ActionStatusCreate create);
@@ -119,20 +102,14 @@ public interface ControllerManagement {
* Adds an {@link ActionStatus} entry for an update {@link Action} including * Adds an {@link ActionStatus} entry for an update {@link Action} including
* potential state changes for the target and the {@link Action} itself. * potential state changes for the target and the {@link Action} itself.
* *
* @param create * @param create to be added
* to be added
* @return the updated {@link Action} * @return the updated {@link Action}
* * @throws EntityAlreadyExistsException if a given entity already exists
* @throws EntityAlreadyExistsException * @throws AssignmentQuotaExceededException if more than the allowed number of status entries or messages
* if a given entity already exists * per entry are inserted
* @throws AssignmentQuotaExceededException * @throws EntityNotFoundException if action status not exist
* if more than the allowed number of status entries or messages * @throws ConstraintViolationException if fields are not filled as specified. Check
* per entry are inserted * {@link ActionStatusCreate} for field constraints.
* @throws EntityNotFoundException
* if action status not exist
* @throws ConstraintViolationException
* if fields are not filled as specified. Check
* {@link ActionStatusCreate} for field constraints.
*/ */
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER) @PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
Action addUpdateActionStatus(@NotNull @Valid ActionStatusCreate create); Action addUpdateActionStatus(@NotNull @Valid ActionStatusCreate create);
@@ -145,10 +122,8 @@ public interface ControllerManagement {
* {@link EntityNotFoundException} in case target with given controllerId * {@link EntityNotFoundException} in case target with given controllerId
* does not exist but will return an {@link Optional#empty()} instead. * does not exist but will return an {@link Optional#empty()} instead.
* *
* @param controllerId * @param controllerId identifies the target to retrieve the action from
* identifies the target to retrieve the action from
* @return the action * @return the action
*
*/ */
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER) @PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
Optional<Action> findActiveActionWithHighestWeight(@NotEmpty String controllerId); Optional<Action> findActiveActionWithHighestWeight(@NotEmpty String controllerId);
@@ -157,12 +132,9 @@ public interface ControllerManagement {
* Retrieves active {@link Action}s with highest weight that are assigned to * Retrieves active {@link Action}s with highest weight that are assigned to
* a {@link Target}. * a {@link Target}.
* *
* @param controllerId * @param controllerId identifies the target to retrieve the action from
* identifies the target to retrieve the action from * @param maxActionCount max size of returned list
* @param maxActionCount
* max size of returned list
* @return the action * @return the action
*
*/ */
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER) @PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
List<Action> findActiveActionsWithHighestWeight(@NotEmpty String controllerId, int maxActionCount); List<Action> findActiveActionsWithHighestWeight(@NotEmpty String controllerId, int maxActionCount);
@@ -171,8 +143,7 @@ public interface ControllerManagement {
* Get weight of an Action. Returns the default value if the weight is null * Get weight of an Action. Returns the default value if the weight is null
* according to the properties. * according to the properties.
* *
* @param action * @param action to extract the weight from
* to extract the weight from
* @return weight of the action * @return weight of the action
*/ */
int getWeightConsideringDefault(final Action action); int getWeightConsideringDefault(final Action action);
@@ -181,8 +152,7 @@ public interface ControllerManagement {
* Get the {@link Action} entity for given actionId with all lazy * Get the {@link Action} entity for given actionId with all lazy
* attributes. * attributes.
* *
* @param actionId * @param actionId to be id of the action
* to be id of the action
* @return the corresponding {@link Action} * @return the corresponding {@link Action}
*/ */
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER) @PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
@@ -192,14 +162,10 @@ public interface ControllerManagement {
* Retrieves all the {@link ActionStatus} entries of the given * Retrieves all the {@link ActionStatus} entries of the given
* {@link Action}. * {@link Action}.
* *
* @param pageReq * @param pageReq pagination parameter
* pagination parameter * @param actionId to be filtered on
* @param actionId
* to be filtered on
* @return the corresponding {@link Page} of {@link ActionStatus} * @return the corresponding {@link Page} of {@link ActionStatus}
* * @throws EntityNotFoundException if action with given ID does not exist
* @throws EntityNotFoundException
* if action with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER) @PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
Page<ActionStatus> findActionStatusByAction(@NotNull Pageable pageReq, long actionId); Page<ActionStatus> findActionStatusByAction(@NotNull Pageable pageReq, long actionId);
@@ -211,10 +177,8 @@ public interface ControllerManagement {
* {@link TargetUpdateStatus#UNKNOWN} to * {@link TargetUpdateStatus#UNKNOWN} to
* {@link TargetUpdateStatus#REGISTERED}. * {@link TargetUpdateStatus#REGISTERED}.
* *
* @param controllerId * @param controllerId reference
* reference * @param address the client IP address of the target, might be {@code null}
* @param address
* the client IP address of the target, might be {@code null}
* @return target reference * @return target reference
*/ */
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER) @PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
@@ -228,14 +192,10 @@ public interface ControllerManagement {
* switches if {@link TargetUpdateStatus#UNKNOWN} to * switches if {@link TargetUpdateStatus#UNKNOWN} to
* {@link TargetUpdateStatus#REGISTERED}. * {@link TargetUpdateStatus#REGISTERED}.
* *
* @param controllerId * @param controllerId reference
* reference * @param address the client IP address of the target, might be {@code null}
* @param address * @param name the name of the target
* the client IP address of the target, might be {@code null} * @param type the target type name of the target
* @param name
* the name of the target
* @param type
* the target type name of the target
* @return target reference * @return target reference
*/ */
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER) @PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
@@ -246,16 +206,11 @@ public interface ControllerManagement {
* Retrieves last {@link Action} for a download of an artifact of given * Retrieves last {@link Action} for a download of an artifact of given
* module and target if exists and is not canceled. * module and target if exists and is not canceled.
* *
* @param controllerId * @param controllerId to look for
* to look for * @param moduleId of the the {@link SoftwareModule} that should be assigned to
* @param moduleId * the target
* of the the {@link SoftwareModule} that should be assigned to
* the target
* @return last {@link Action} for given combination * @return last {@link Action} for given combination
* * @throws EntityNotFoundException if target with given ID does not exist
* @throws EntityNotFoundException
* if target with given ID does not exist
*
*/ */
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER) @PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
Optional<Action> getActionForDownloadByTargetAndSoftwareModule(@NotEmpty String controllerId, long moduleId); Optional<Action> getActionForDownloadByTargetAndSoftwareModule(@NotEmpty String controllerId, long moduleId);
@@ -297,10 +252,8 @@ public interface ControllerManagement {
* of maintenance window, it resets to default * of maintenance window, it resets to default
* {@link TenantConfigurationKey#POLLING_TIME_INTERVAL}. * {@link TenantConfigurationKey#POLLING_TIME_INTERVAL}.
* *
* @param actionId * @param actionId id the {@link Action} for which polling time is calculated
* id the {@link Action} for which polling time is calculated * based on it having maintenance window or not
* based on it having maintenance window or not
*
* @return current {@link TenantConfigurationKey#POLLING_TIME_INTERVAL}. * @return current {@link TenantConfigurationKey#POLLING_TIME_INTERVAL}.
*/ */
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER) @PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
@@ -313,17 +266,13 @@ public interface ControllerManagement {
* assigned or had ever been assigned to the target and so it's visible to a * assigned or had ever been assigned to the target and so it's visible to a
* specific target e.g. for downloading. * specific target e.g. for downloading.
* *
* @param controllerId * @param controllerId the ID of the target to check
* the ID of the target to check * @param sha1Hash of the artifact to verify if the given target had even been
* @param sha1Hash * assigned to
* of the artifact to verify if the given target had even been
* assigned to
* @return {@code true} if the given target has currently or had ever a * @return {@code true} if the given target has currently or had ever a
* relation to the given artifact through the action history, * relation to the given artifact through the action history,
* otherwise {@code false} * otherwise {@code false}
* * @throws EntityNotFoundException if target with given ID does not exist
* @throws EntityNotFoundException
* if target with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER) @PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
boolean hasTargetArtifactAssigned(@NotEmpty String controllerId, @NotEmpty String sha1Hash); boolean hasTargetArtifactAssigned(@NotEmpty String controllerId, @NotEmpty String sha1Hash);
@@ -335,17 +284,13 @@ public interface ControllerManagement {
* assigned or had ever been assigned to the target and so it's visible to a * assigned or had ever been assigned to the target and so it's visible to a
* specific target e.g. for downloading. * specific target e.g. for downloading.
* *
* @param targetId * @param targetId the ID of the target to check
* the ID of the target to check * @param sha1Hash of the artifact to verify if the given target had even been
* @param sha1Hash * assigned to
* of the artifact to verify if the given target had even been
* assigned to
* @return {@code true} if the given target has currently or had ever a * @return {@code true} if the given target has currently or had ever a
* relation to the given artifact through the action history, * relation to the given artifact through the action history,
* otherwise {@code false} * otherwise {@code false}
* * @throws EntityNotFoundException if target with given ID does not exist
* @throws EntityNotFoundException
* if target with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER) @PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
boolean hasTargetArtifactAssigned(long targetId, @NotEmpty String sha1Hash); boolean hasTargetArtifactAssigned(long targetId, @NotEmpty String sha1Hash);
@@ -354,15 +299,11 @@ public interface ControllerManagement {
* Registers retrieved status for given {@link Target} and {@link Action} if * Registers retrieved status for given {@link Target} and {@link Action} if
* it does not exist yet. * it does not exist yet.
* *
* @param actionId * @param actionId to the handle status for
* to the handle status for * @param message for the status
* @param message
* for the status
* @return the update action in case the status has been changed to * @return the update action in case the status has been changed to
* {@link Status#RETRIEVED} * {@link Status#RETRIEVED}
* * @throws EntityNotFoundException if action with given ID does not exist
* @throws EntityNotFoundException
* if action with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER) @PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
Action registerRetrieved(long actionId, String message); Action registerRetrieved(long actionId, String message);
@@ -371,21 +312,13 @@ public interface ControllerManagement {
* Updates attributes of the controller according to the given * Updates attributes of the controller according to the given
* {@link UpdateMode}. * {@link UpdateMode}.
* *
* @param controllerId * @param controllerId to update
* to update * @param attributes to insert
* @param attributes * @param mode the update mode or <code>null</code>
* to insert
* @param mode
* the update mode or <code>null</code>
*
* @return updated {@link Target} * @return updated {@link Target}
* * @throws EntityNotFoundException if target that has to be updated could not be found
* @throws EntityNotFoundException * @throws AssignmentQuotaExceededException if maximum number of attributes per target is exceeded
* if target that has to be updated could not be found * @throws InvalidTargetAttributeException if attributes violate constraints
* @throws AssignmentQuotaExceededException
* if maximum number of attributes per target is exceeded
* @throws InvalidTargetAttributeException
* if attributes violate constraints
*/ */
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER) @PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
Target updateControllerAttributes(@NotEmpty String controllerId, @NotNull Map<String, String> attributes, Target updateControllerAttributes(@NotEmpty String controllerId, @NotNull Map<String, String> attributes,
@@ -396,8 +329,7 @@ public interface ControllerManagement {
* without details, i.e. NO {@link Target#getTags()} and * without details, i.e. NO {@link Target#getTags()} and
* {@link Target#getActions()} possible. * {@link Target#getActions()} possible.
* *
* @param controllerId * @param controllerId to look for.
* to look for.
* @return {@link Target} or {@code null} if it does not exist * @return {@link Target} or {@code null} if it does not exist
* @see Target#getControllerId() * @see Target#getControllerId()
*/ */
@@ -410,8 +342,7 @@ public interface ControllerManagement {
* details, i.e. NO {@link Target#getTags()} and {@link Target#getActions()} * details, i.e. NO {@link Target#getTags()} and {@link Target#getActions()}
* possible. * possible.
* *
* @param targetId * @param targetId to look for.
* to look for.
* @return {@link Target} or {@code null} if it does not exist * @return {@link Target} or {@code null} if it does not exist
* @see Target#getId() * @see Target#getId()
*/ */
@@ -436,11 +367,8 @@ public interface ControllerManagement {
* first, the sub-ordering of messages from within single * first, the sub-ordering of messages from within single
* {@link ActionStatus} is unspecified. * {@link ActionStatus} is unspecified.
* *
* @param actionId * @param actionId to be filtered on
* to be filtered on * @param messageCount is the number of messages to return from history
* @param messageCount
* is the number of messages to return from history
*
* @return action history. * @return action history.
*/ */
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER) @PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
@@ -452,15 +380,10 @@ public interface ControllerManagement {
* cancellation. The controller needs to acknowledge or reject the * cancellation. The controller needs to acknowledge or reject the
* cancellation using {@link DdiRootController#postCancelActionFeedback}. * cancellation using {@link DdiRootController#postCancelActionFeedback}.
* *
* @param actionId * @param actionId to be canceled
* to be canceled
*
* @return canceled {@link Action} * @return canceled {@link Action}
* * @throws CancelActionNotAllowedException in case the given action is not active or is already canceled
* @throws CancelActionNotAllowedException * @throws EntityNotFoundException if action with given actionId does not exist.
* in case the given action is not active or is already canceled
* @throws EntityNotFoundException
* if action with given actionId does not exist.
*/ */
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER) @PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
Action cancelAction(long actionId); Action cancelAction(long actionId);
@@ -468,10 +391,8 @@ public interface ControllerManagement {
/** /**
* Updates given {@link Action} with its external id. * Updates given {@link Action} with its external id.
* *
* @param actionId * @param actionId to be updated
* to be updated * @param externalRef of the action
* @param externalRef
* of the action
*/ */
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER) @PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
void updateActionExternalRef(long actionId, @NotEmpty String externalRef); void updateActionExternalRef(long actionId, @NotEmpty String externalRef);
@@ -479,8 +400,7 @@ public interface ControllerManagement {
/** /**
* Retrieves an {@link Action} using {@link Action#getExternalRef()} * Retrieves an {@link Action} using {@link Action#getExternalRef()}
* *
* @param externalRef * @param externalRef of the action. See {@link Action#getExternalRef()}
* of the action. See {@link Action#getExternalRef()}
* @return {@link Action} or {@code null} if it does not exist * @return {@link Action} or {@code null} if it does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER) @PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
@@ -489,8 +409,7 @@ public interface ControllerManagement {
/** /**
* Delete a single target. * Delete a single target.
* *
* @param controllerId * @param controllerId of the target to delete
* of the target to delete
*/ */
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER) @PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
void deleteExistingTarget(@NotEmpty String controllerId); void deleteExistingTarget(@NotEmpty String controllerId);
@@ -498,8 +417,7 @@ public interface ControllerManagement {
/** /**
* Finds an {@link Action} based on the target that it's assigned to * Finds an {@link Action} based on the target that it's assigned to
* *
* @param controllerId * @param controllerId of the target the action is assigned to
* of the target the action is assigned to
*/ */
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER) @PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
Optional<Action> getInstalledActionByTarget(@NotEmpty String controllerId); Optional<Action> getInstalledActionByTarget(@NotEmpty String controllerId);
@@ -507,13 +425,10 @@ public interface ControllerManagement {
/** /**
* Activate auto confirmation for a given controllerId * Activate auto confirmation for a given controllerId
* *
* @param controllerId * @param controllerId to activate auto-confirmation on
* to activate auto-confirmation on * @param initiator can be set optionally (fallback is the current acting security
* @param initiator * user)
* can be set optionally (fallback is the current acting security * @param remark (optional) remark
* user)
* @param remark
* (optional) remark
* @return the persisted {@link AutoConfirmationStatus} * @return the persisted {@link AutoConfirmationStatus}
*/ */
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER) @PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
@@ -522,8 +437,7 @@ public interface ControllerManagement {
/** /**
* Deactivate auto confirmation for a given controllerId * Deactivate auto confirmation for a given controllerId
* *
* @param controllerId * @param controllerId to deactivate auto-confirmation on
* to deactivate auto-confirmation on
*/ */
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER) @PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
void deactivateAutoConfirmation(@NotEmpty String controllerId); void deactivateAutoConfirmation(@NotEmpty String controllerId);
@@ -531,17 +445,11 @@ public interface ControllerManagement {
/** /**
* Updates distributionSet installed version (experimental) * Updates distributionSet installed version (experimental)
* *
* @param distributionName * @param distributionName installed
* installed * @param version installed
* @param version
* installed
*
* @return updated {@link Target} * @return updated {@link Target}
* * @throws EntityNotFoundException if target that has to be updated could not be found
* @throws EntityNotFoundException * @throws java.util.NoSuchElementException if DistributionSetAssignmentResult list is empty
* if target that has to be updated could not be found
* @throws java.util.NoSuchElementException
* if DistributionSetAssignmentResult list is empty
*/ */
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER) @PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
boolean updateOfflineAssignedVersion(@NotEmpty String controllerId, String distributionName, String version); boolean updateOfflineAssignedVersion(@NotEmpty String controllerId, String distributionName, String version);

View File

@@ -48,34 +48,35 @@ import org.springframework.security.access.prepost.PreAuthorize;
/** /**
* A DeploymentManagement service provides operations for the deployment of * A DeploymentManagement service provides operations for the deployment of
* {@link DistributionSet}s to {@link Target}s. * {@link DistributionSet}s to {@link Target}s.
*
*/ */
public interface DeploymentManagement { public interface DeploymentManagement {
/**
* build a {@link DeploymentRequest} for a target distribution set
* assignment
*
* @param controllerId ID of target
* @param distributionSetId ID of distribution set
* @return the builder
*/
static DeploymentRequestBuilder deploymentRequest(final String controllerId, final long distributionSetId) {
return new DeploymentRequestBuilder(controllerId, distributionSetId);
}
/** /**
* Assigns {@link DistributionSet}s to {@link Target}s according to the * Assigns {@link DistributionSet}s to {@link Target}s according to the
* {@link DeploymentRequest}. * {@link DeploymentRequest}.
* *
* @param deploymentRequests * @param deploymentRequests information about all target-ds-assignments that shall be made
* information about all target-ds-assignments that shall be made
*
* @return the list of assignment results * @return the list of assignment results
* * @throws IncompleteDistributionSetException if mandatory {@link SoftwareModuleType} are not assigned as
* @throws IncompleteDistributionSetException * defined by the {@link DistributionSetType}.
* if mandatory {@link SoftwareModuleType} are not assigned as * @throws EntityNotFoundException if either provided {@link DistributionSet} or {@link Target}s
* defined by the {@link DistributionSetType}. * do not exist
* * @throws AssignmentQuotaExceededException if the maximum number of targets the distribution set can be
* @throws EntityNotFoundException * assigned to at once is exceeded
* if either provided {@link DistributionSet} or {@link Target}s * @throws MultiAssignmentIsNotEnabledException if the request results in multiple assignments to the same
* do not exist * target and multiassignment is disabled
*
* @throws AssignmentQuotaExceededException
* if the maximum number of targets the distribution set can be
* assigned to at once is exceeded
* @throws MultiAssignmentIsNotEnabledException
* if the request results in multiple assignments to the same
* target and multiassignment is disabled
*
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
List<DistributionSetAssignmentResult> assignDistributionSets( List<DistributionSetAssignmentResult> assignDistributionSets(
@@ -85,49 +86,23 @@ public interface DeploymentManagement {
* Assigns {@link DistributionSet}s to {@link Target}s according to the * Assigns {@link DistributionSet}s to {@link Target}s according to the
* {@link DeploymentRequest}. * {@link DeploymentRequest}.
* *
* @param initiatedBy * @param initiatedBy the username of the user who initiated the assignment
* the username of the user who initiated the assignment * @param deploymentRequests information about all target-ds-assignments that shall be made
* @param deploymentRequests * @param actionMessage an optional message for the action status
* information about all target-ds-assignments that shall be made
* @param actionMessage
* an optional message for the action status
*
* @return the list of assignment results * @return the list of assignment results
* * @throws IncompleteDistributionSetException if mandatory {@link SoftwareModuleType} are not assigned as
* @throws IncompleteDistributionSetException * defined by the {@link DistributionSetType}.
* if mandatory {@link SoftwareModuleType} are not assigned as * @throws EntityNotFoundException if either provided {@link DistributionSet} or {@link Target}s
* defined by the {@link DistributionSetType}. * do not exist
* * @throws AssignmentQuotaExceededException if the maximum number of targets the distribution set can be
* @throws EntityNotFoundException * assigned to at once is exceeded
* if either provided {@link DistributionSet} or {@link Target}s * @throws MultiAssignmentIsNotEnabledException if the request results in multiple assignments to the same
* do not exist * target and multiassignment is disabled
*
* @throws AssignmentQuotaExceededException
* if the maximum number of targets the distribution set can be
* assigned to at once is exceeded
* @throws MultiAssignmentIsNotEnabledException
* if the request results in multiple assignments to the same
* target and multiassignment is disabled
*
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
List<DistributionSetAssignmentResult> assignDistributionSets(String initiatedBy, List<DistributionSetAssignmentResult> assignDistributionSets(String initiatedBy,
@Valid @NotEmpty List<DeploymentRequest> deploymentRequests, String actionMessage); @Valid @NotEmpty List<DeploymentRequest> deploymentRequests, String actionMessage);
/**
* build a {@link DeploymentRequest} for a target distribution set
* assignment
*
* @param controllerId
* ID of target
* @param distributionSetId
* ID of distribution set
* @return the builder
*/
static DeploymentRequestBuilder deploymentRequest(final String controllerId, final long distributionSetId) {
return new DeploymentRequestBuilder(controllerId, distributionSetId);
}
/** /**
* Registers "offline" assignments. "offline" assignment means adding a * Registers "offline" assignments. "offline" assignment means adding a
* completed action for a {@link DistributionSet} to a {@link Target}. * completed action for a {@link DistributionSet} to a {@link Target}.
@@ -143,26 +118,17 @@ public interface DeploymentManagement {
* <li>does not send a {@link TargetAssignDistributionSetEvent}.</li> * <li>does not send a {@link TargetAssignDistributionSetEvent}.</li>
* </ol> * </ol>
* *
* @param assignments * @param assignments target IDs with the respective distribution set ID which they
* target IDs with the respective distribution set ID which they * are supposed to be assigned to
* are supposed to be assigned to
* @return the assignment results * @return the assignment results
* * @throws IncompleteDistributionSetException if mandatory {@link SoftwareModuleType} are not assigned as
* @throws IncompleteDistributionSetException * defined by the {@link DistributionSetType}.
* if mandatory {@link SoftwareModuleType} are not assigned as * @throws EntityNotFoundException if either provided {@link DistributionSet} or {@link Target}s
* defined by the {@link DistributionSetType}. * do not exist
* * @throws AssignmentQuotaExceededException if the maximum number of targets the distribution set can be
* @throws EntityNotFoundException * assigned to at once is exceeded
* if either provided {@link DistributionSet} or {@link Target}s * @throws MultiAssignmentIsNotEnabledException if the request results in multiple assignments to the same
* do not exist * target and multiassignment is disabled
*
* @throws AssignmentQuotaExceededException
* if the maximum number of targets the distribution set can be
* assigned to at once is exceeded
*
* @throws MultiAssignmentIsNotEnabledException
* if the request results in multiple assignments to the same
* target and multiassignment is disabled
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
List<DistributionSetAssignmentResult> offlineAssignedDistributionSets(Collection<Entry<String, Long>> assignments, String initiatedBy); List<DistributionSetAssignmentResult> offlineAssignedDistributionSets(Collection<Entry<String, Long>> assignments, String initiatedBy);
@@ -175,16 +141,11 @@ public interface DeploymentManagement {
* add a {@link Status#CANCELED} status to the action. However, it might be * add a {@link Status#CANCELED} status to the action. However, it might be
* possible that the controller will continue to work on the cancellation. * possible that the controller will continue to work on the cancellation.
* *
* @param actionId * @param actionId to be canceled
* to be canceled
*
* @return canceled {@link Action} * @return canceled {@link Action}
* * @throws CancelActionNotAllowedException in case the given action is not active or is already a cancel
* @throws CancelActionNotAllowedException * action
* in case the given action is not active or is already a cancel * @throws EntityNotFoundException if action with given ID does not exist
* action
* @throws EntityNotFoundException
* if action with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
Action cancelAction(long actionId); Action cancelAction(long actionId);
@@ -192,19 +153,13 @@ public interface DeploymentManagement {
/** /**
* Counts all actions associated to a specific target. * Counts all actions associated to a specific target.
* *
* @param rsqlParam * @param rsqlParam rsql query string
* rsql query string * @param controllerId the target associated to the actions to count
* @param controllerId
* the target associated to the actions to count
* @return the count value of found actions associated to the target * @return the count value of found actions associated to the target
* * @throws RSQLParameterUnsupportedFieldException if a field in the RSQL string is used but not provided by the
* @throws RSQLParameterUnsupportedFieldException * given {@code fieldNameProvider}
* if a field in the RSQL string is used but not provided by the * @throws RSQLParameterSyntaxException if the RSQL syntax is wrong
* given {@code fieldNameProvider} * @throws EntityNotFoundException if target with given ID does not exist
* @throws RSQLParameterSyntaxException
* if the RSQL syntax is wrong
* @throws EntityNotFoundException
* if target with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
long countActionsByTarget(@NotNull String rsqlParam, @NotEmpty String controllerId); long countActionsByTarget(@NotNull String rsqlParam, @NotEmpty String controllerId);
@@ -224,8 +179,7 @@ public interface DeploymentManagement {
* <p/> * <p/>
* No access control applied. * No access control applied.
* *
* @param rsqlParam * @param rsqlParam RSQL query.
* RSQL query.
* @return the total number of actions matching the given RSQL query. * @return the total number of actions matching the given RSQL query.
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
@@ -234,12 +188,9 @@ public interface DeploymentManagement {
/** /**
* Counts all actions associated to a specific target. * Counts all actions associated to a specific target.
* *
* @param controllerId * @param controllerId the target associated to the actions to count
* the target associated to the actions to count
* @return the count value of found actions associated to the target * @return the count value of found actions associated to the target
* * @throws EntityNotFoundException if target with given ID does not exist
* @throws EntityNotFoundException
* if target with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
long countActionsByTarget(@NotEmpty String controllerId); long countActionsByTarget(@NotEmpty String controllerId);
@@ -247,10 +198,8 @@ public interface DeploymentManagement {
/** /**
* Get the {@link Action} entity for given actionId. * Get the {@link Action} entity for given actionId.
* *
* @param actionId * @param actionId to be id of the action
* to be id of the action
* @return the corresponding {@link Action} * @return the corresponding {@link Action}
*
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Optional<Action> findAction(long actionId); Optional<Action> findAction(long actionId);
@@ -273,7 +222,6 @@ public interface DeploymentManagement {
* *
* @param rsqlParam RSQL query string * @param rsqlParam RSQL query string
* @param pageable the page request parameter for paging and sorting the result * @param pageable the page request parameter for paging and sorting the result
*
* @return a paged list of {@link Action}s. * @return a paged list of {@link Action}s.
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
@@ -283,20 +231,14 @@ public interface DeploymentManagement {
* Retrieves all {@link Action}s assigned to a specific {@link Target} and a * Retrieves all {@link Action}s assigned to a specific {@link Target} and a
* given specification. * given specification.
* *
* @param rsqlParam * @param rsqlParam rsql query string
* rsql query string * @param controllerId the target which must be assigned to the actions
* @param controllerId * @param pageable the page request
* the target which must be assigned to the actions
* @param pageable
* the page request
* @return a slice of actions assigned to the specific target and the * @return a slice of actions assigned to the specific target and the
* specification * specification
* * @throws RSQLParameterUnsupportedFieldException if a field in the RSQL string is used but not provided by the
* @throws RSQLParameterUnsupportedFieldException * given {@code fieldNameProvider}
* if a field in the RSQL string is used but not provided by the * @throws RSQLParameterSyntaxException if the RSQL syntax is wrong
* given {@code fieldNameProvider}
* @throws RSQLParameterSyntaxException
* if the RSQL syntax is wrong
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Slice<Action> findActionsByTarget(@NotNull String rsqlParam, @NotEmpty String controllerId, Slice<Action> findActionsByTarget(@NotNull String rsqlParam, @NotEmpty String controllerId,
@@ -306,12 +248,9 @@ public interface DeploymentManagement {
* Retrieves all {@link Action}s which are referring the given * Retrieves all {@link Action}s which are referring the given
* {@link Target}. * {@link Target}.
* *
* @param controllerId * @param controllerId the target to find actions for
* the target to find actions for * @param pageable the pageable request to limit, sort the actions
* @param pageable
* the pageable request to limit, sort the actions
* @return a slice of actions found for a specific target * @return a slice of actions found for a specific target
*
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Slice<Action> findActionsByTarget(@NotEmpty String controllerId, @NotNull Pageable pageable); Slice<Action> findActionsByTarget(@NotEmpty String controllerId, @NotNull Pageable pageable);
@@ -320,14 +259,10 @@ public interface DeploymentManagement {
* Retrieves all the {@link ActionStatus} entries of the given * Retrieves all the {@link ActionStatus} entries of the given
* {@link Action}. * {@link Action}.
* *
* @param pageReq * @param pageReq pagination parameter
* pagination parameter * @param actionId to be filtered on
* @param actionId
* to be filtered on
* @return the corresponding {@link Page} of {@link ActionStatus} * @return the corresponding {@link Page} of {@link ActionStatus}
* * @throws EntityNotFoundException if action with given ID does not exist
* @throws EntityNotFoundException
* if action with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Page<ActionStatus> findActionStatusByAction(@NotNull Pageable pageReq, long actionId); Page<ActionStatus> findActionStatusByAction(@NotNull Pageable pageReq, long actionId);
@@ -335,12 +270,9 @@ public interface DeploymentManagement {
/** /**
* Counts all the {@link ActionStatus} entries of the given {@link Action}. * Counts all the {@link ActionStatus} entries of the given {@link Action}.
* *
* @param actionId * @param actionId to be filtered on
* to be filtered on
* @return count of {@link ActionStatus} entries * @return count of {@link ActionStatus} entries
* * @throws EntityNotFoundException if action with given ID does not exist
* @throws EntityNotFoundException
* if action with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
long countActionStatusByAction(long actionId); long countActionStatusByAction(long actionId);
@@ -350,10 +282,8 @@ public interface DeploymentManagement {
* <p/> * <p/>
* No entity based access control applied. * No entity based access control applied.
* *
* @param pageable * @param pageable the page request parameter for paging and sorting the result
* the page request parameter for paging and sorting the result * @param actionStatusId the id of {@link ActionStatus} to retrieve the messages from
* @param actionStatusId
* the id of {@link ActionStatus} to retrieve the messages from
* @return a page of messages by a specific {@link ActionStatus} id * @return a page of messages by a specific {@link ActionStatus} id
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
@@ -363,8 +293,7 @@ public interface DeploymentManagement {
* Get the {@link Action} entity for given actionId with all lazy attributes * Get the {@link Action} entity for given actionId with all lazy attributes
* (i.e. distributionSet, target, target.assignedDs). * (i.e. distributionSet, target, target.assignedDs).
* *
* @param actionId * @param actionId to be id of the action
* to be id of the action
* @return the corresponding {@link Action} * @return the corresponding {@link Action}
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
@@ -373,14 +302,10 @@ public interface DeploymentManagement {
/** /**
* Retrieves all active {@link Action}s of a specific target. * Retrieves all active {@link Action}s of a specific target.
* *
* @param pageable * @param pageable the page request parameter for paging and sorting the result
* the page request parameter for paging and sorting the result * @param controllerId the target associated with the actions
* @param controllerId
* the target associated with the actions
* @return a list of actions associated with the given target * @return a list of actions associated with the given target
* * @throws EntityNotFoundException if target with given ID does not exist
* @throws EntityNotFoundException
* if target with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Page<Action> findActiveActionsByTarget(@NotNull Pageable pageable, @NotEmpty String controllerId); Page<Action> findActiveActionsByTarget(@NotNull Pageable pageable, @NotEmpty String controllerId);
@@ -388,14 +313,10 @@ public interface DeploymentManagement {
/** /**
* Retrieves all inactive {@link Action}s of a specific target. * Retrieves all inactive {@link Action}s of a specific target.
* *
* @param pageable * @param pageable the page request parameter for paging and sorting the result
* the page request parameter for paging and sorting the result * @param controllerId the target associated with the actions
* @param controllerId
* the target associated with the actions
* @return a list of actions associated with the given target * @return a list of actions associated with the given target
* * @throws EntityNotFoundException if target with given ID does not exist
* @throws EntityNotFoundException
* if target with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Page<Action> findInActiveActionsByTarget(@NotNull Pageable pageable, @NotEmpty String controllerId); Page<Action> findInActiveActionsByTarget(@NotNull Pageable pageable, @NotEmpty String controllerId);
@@ -404,12 +325,9 @@ public interface DeploymentManagement {
* Retrieves active {@link Action}s with highest weight that are assigned to a * Retrieves active {@link Action}s with highest weight that are assigned to a
* {@link Target}. * {@link Target}.
* *
* @param controllerId * @param controllerId identifies the target to retrieve the action from
* identifies the target to retrieve the action from * @param maxActionCount max size of returned list
* @param maxActionCount
* max size of returned list
* @return the action * @return the action
*
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
List<Action> findActiveActionsWithHighestWeight(@NotEmpty String controllerId, int maxActionCount); List<Action> findActiveActionsWithHighestWeight(@NotEmpty String controllerId, int maxActionCount);
@@ -418,8 +336,7 @@ public interface DeploymentManagement {
* Get weight of an Action. Returns the default value if the weight is null * Get weight of an Action. Returns the default value if the weight is null
* according to the properties. * according to the properties.
* *
* @param action * @param action to extract the weight from
* to extract the weight from
* @return weight of the action * @return weight of the action
*/ */
int getWeightConsideringDefault(final Action action); int getWeightConsideringDefault(final Action action);
@@ -430,16 +347,10 @@ public interface DeploymentManagement {
* and a cancel request is sent to the target. But however it's not tracked, * and a cancel request is sent to the target. But however it's not tracked,
* if the targets handles the cancel request or not. * if the targets handles the cancel request or not.
* *
* @param actionId * @param actionId to be canceled
* to be canceled
*
* @return quite {@link Action} * @return quite {@link Action}
* * @throws CancelActionNotAllowedException in case the given action is not active
* @throws CancelActionNotAllowedException * @throws EntityNotFoundException if action with given ID does not exist
* in case the given action is not active
*
* @throws EntityNotFoundException
* if action with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
Action forceQuitAction(long actionId); Action forceQuitAction(long actionId);
@@ -448,12 +359,9 @@ public interface DeploymentManagement {
* Updates a {@link Action} and forces the {@link Action} if it's not * Updates a {@link Action} and forces the {@link Action} if it's not
* already forced. * already forced.
* *
* @param actionId * @param actionId the ID of the action
* the ID of the action
* @return the updated or the found {@link Action} * @return the updated or the found {@link Action}
* * @throws EntityNotFoundException if action with given ID does not exist
* @throws EntityNotFoundException
* if action with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
Action forceTargetAction(long actionId); Action forceTargetAction(long actionId);
@@ -462,9 +370,7 @@ public interface DeploymentManagement {
* Sets the status of inactive scheduled {@link Action}s for the specified * Sets the status of inactive scheduled {@link Action}s for the specified
* {@link Target}s to {@link Status#CANCELED} * {@link Target}s to {@link Status#CANCELED}
* *
* @param targetIds * @param targetIds ids of the {@link Target}s the actions belong to
* ids of the {@link Target}s the actions belong to
*
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
void cancelInactiveScheduledActionsForTargets(List<Long> targetIds); void cancelInactiveScheduledActionsForTargets(List<Long> targetIds);
@@ -474,13 +380,10 @@ public interface DeploymentManagement {
* <p/> * <p/>
* No entity based access control applied. * No entity based access control applied.
* *
* @param rolloutId * @param rolloutId the rollout the actions belong to
* the rollout the actions belong to * @param distributionSetId to assign
* @param distributionSetId * @param rolloutGroupParentId the parent rollout group the actions should reference. null
* to assign * references the first group
* @param rolloutGroupParentId
* the parent rollout group the actions should reference. null
* references the first group
* @return the amount of started actions * @return the amount of started actions
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
@@ -497,12 +400,9 @@ public interface DeploymentManagement {
/** /**
* Returns {@link DistributionSet} that is assigned to given {@link Target}. * Returns {@link DistributionSet} that is assigned to given {@link Target}.
* *
* @param controllerId * @param controllerId of target
* of target
* @return assigned {@link DistributionSet} * @return assigned {@link DistributionSet}
* * @throws EntityNotFoundException if target with given ID does not exist
* @throws EntityNotFoundException
* if target with given ID does not exist
*/ */
Optional<DistributionSet> getAssignedDistributionSet(@NotEmpty String controllerId); Optional<DistributionSet> getAssignedDistributionSet(@NotEmpty String controllerId);
@@ -510,12 +410,9 @@ public interface DeploymentManagement {
* Returns {@link DistributionSet} that is installed on given * Returns {@link DistributionSet} that is installed on given
* {@link Target}. * {@link Target}.
* *
* @param controllerId * @param controllerId of target
* of target
* @return installed {@link DistributionSet} * @return installed {@link DistributionSet}
* * @throws EntityNotFoundException if target with given ID does not exist
* @throws EntityNotFoundException
* if target with given ID does not exist
*/ */
Optional<DistributionSet> getInstalledDistributionSet(@NotEmpty String controllerId); Optional<DistributionSet> getInstalledDistributionSet(@NotEmpty String controllerId);
@@ -525,11 +422,8 @@ public interface DeploymentManagement {
* <p/> * <p/>
* No entity based access control applied. * No entity based access control applied.
* *
* @param status * @param status Set of action status.
* Set of action status. * @param lastModified A time-stamp in milliseconds.
* @param lastModified
* A time-stamp in milliseconds.
*
* @return The number of action entries that were deleted. * @return The number of action entries that were deleted.
*/ */
@PreAuthorize(SpringEvalExpressions.IS_SYSTEM_CODE) @PreAuthorize(SpringEvalExpressions.IS_SYSTEM_CODE)
@@ -549,10 +443,8 @@ public interface DeploymentManagement {
* Cancels all actions that refer to a given distribution set. This method * Cancels all actions that refer to a given distribution set. This method
* is called when a distribution set is invalidated. * is called when a distribution set is invalidated.
* *
* @param cancelationType * @param cancelationType defines if a force or soft cancel is executed
* defines if a force or soft cancel is executed * @param set the distribution set for that the actions should be canceled
* @param set
* the distribution set for that the actions should be canceled
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
void cancelActionsForDistributionSet(final CancelationType cancelationType, final DistributionSet set); void cancelActionsForDistributionSet(final CancelationType cancelationType, final DistributionSet set);

View File

@@ -16,7 +16,6 @@ import org.eclipse.hawkbit.repository.model.DistributionSetInvalidationCount;
/** /**
* A DistributionSetInvalidationManagement service provides operations to * A DistributionSetInvalidationManagement service provides operations to
* invalidate {@link DistributionSet}s. * invalidate {@link DistributionSet}s.
*
*/ */
public interface DistributionSetInvalidationManagement { public interface DistributionSetInvalidationManagement {
@@ -26,9 +25,8 @@ public interface DistributionSetInvalidationManagement {
* can not be undone. Optionally, all rollouts and actions referring this * can not be undone. Optionally, all rollouts and actions referring this
* {@link DistributionSet} can be canceled. * {@link DistributionSet} can be canceled.
* *
* @param distributionSetInvalidation * @param distributionSetInvalidation defines the {@link DistributionSet} and options what should be
* defines the {@link DistributionSet} and options what should be * canceled
* canceled
*/ */
void invalidateDistributionSet(final DistributionSetInvalidation distributionSetInvalidation); void invalidateDistributionSet(final DistributionSetInvalidation distributionSetInvalidation);
@@ -36,10 +34,8 @@ public interface DistributionSetInvalidationManagement {
* Counts all entities for a list of {@link DistributionSet}s that will be * Counts all entities for a list of {@link DistributionSet}s that will be
* canceled when invalidation is called for those {@link DistributionSet}s. * canceled when invalidation is called for those {@link DistributionSet}s.
* *
* * @param distributionSetInvalidation defines the {@link DistributionSet} and options what should be
* @param distributionSetInvalidation * canceled
* defines the {@link DistributionSet} and options what should be
* canceled
* @return The {@link DistributionSetInvalidationCount} object that holds * @return The {@link DistributionSetInvalidationCount} object that holds
* information about the count of affected rollouts, * information about the count of affected rollouts,
* auto-assignments and actions * auto-assignments and actions

View File

@@ -45,7 +45,6 @@ import org.springframework.security.access.prepost.PreAuthorize;
/** /**
* Management service for {@link DistributionSet}s. * Management service for {@link DistributionSet}s.
*
*/ */
public interface DistributionSetManagement public interface DistributionSetManagement
extends RepositoryManagement<DistributionSet, DistributionSetCreate, DistributionSetUpdate> { extends RepositoryManagement<DistributionSet, DistributionSetCreate, DistributionSetUpdate> {
@@ -53,27 +52,16 @@ public interface DistributionSetManagement
/** /**
* Assigns {@link SoftwareModule} to existing {@link DistributionSet}. * Assigns {@link SoftwareModule} to existing {@link DistributionSet}.
* *
* @param id * @param id to assign and update
* to assign and update * @param moduleIds to get assigned
* @param moduleIds
* to get assigned
*
* @return the updated {@link DistributionSet}. * @return the updated {@link DistributionSet}.
* * @throws EntityNotFoundException if (at least one) given module does not exist
* @throws EntityNotFoundException * @throws EntityReadOnlyException if use tries to change the {@link DistributionSet} s while
* if (at least one) given module does not exist * the DS is already in use.
* * @throws UnsupportedSoftwareModuleForThisDistributionSetException if {@link SoftwareModule#getType()} is not supported by this
* @throws EntityReadOnlyException * {@link DistributionSet#getType()}.
* if use tries to change the {@link DistributionSet} s while * @throws AssignmentQuotaExceededException if the maximum number of {@link SoftwareModule}s is exceeded
* the DS is already in use. * for the addressed {@link DistributionSet}.
*
* @throws UnsupportedSoftwareModuleForThisDistributionSetException
* if {@link SoftwareModule#getType()} is not supported by this
* {@link DistributionSet#getType()}.
*
* @throws AssignmentQuotaExceededException
* if the maximum number of {@link SoftwareModule}s is exceeded
* for the addressed {@link DistributionSet}.
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
DistributionSet assignSoftwareModules(long id, @NotEmpty Collection<Long> moduleIds); DistributionSet assignSoftwareModules(long id, @NotEmpty Collection<Long> moduleIds);
@@ -82,16 +70,11 @@ public interface DistributionSetManagement
* Assign a {@link DistributionSetTag} assignment to given * Assign a {@link DistributionSetTag} assignment to given
* {@link DistributionSet}s. * {@link DistributionSet}s.
* *
* @param ids * @param ids to assign for
* to assign for * @param tagId to assign
* @param tagId
* to assign
*
* @return list of assigned ds * @return list of assigned ds
* * @throws EntityNotFoundException if tag with given ID does not exist or (at least one) of the
* @throws EntityNotFoundException * distribution sets.
* if tag with given ID does not exist or (at least one) of the
* distribution sets.
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
List<DistributionSet> assignTag(@NotEmpty Collection<Long> ids, long tagId); List<DistributionSet> assignTag(@NotEmpty Collection<Long> ids, long tagId);
@@ -110,23 +93,15 @@ public interface DistributionSetManagement
/** /**
* Creates a list of distribution set meta data entries. * Creates a list of distribution set meta data entries.
* *
* @param id * @param id if the {@link DistributionSet} the metadata has to be created
* if the {@link DistributionSet} the metadata has to be created * for
* for * @param metadata the meta data entries to create or update
* @param metadata
* the meta data entries to create or update
* @return the updated or created distribution set meta data entries * @return the updated or created distribution set meta data entries
* * @throws EntityNotFoundException if given set does not exist
* @throws EntityNotFoundException * @throws EntityAlreadyExistsException in case one of the meta data entry already exists for the
* if given set does not exist * specific key
* * @throws AssignmentQuotaExceededException if the maximum number of {@link MetaData} entries is exceeded
* @throws EntityAlreadyExistsException * for the addressed {@link DistributionSet}
* in case one of the meta data entry already exists for the
* specific key
*
* @throws AssignmentQuotaExceededException
* if the maximum number of {@link MetaData} entries is exceeded
* for the addressed {@link DistributionSet}
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
List<DistributionSetMetadata> createMetaData(long id, @NotEmpty Collection<MetaData> metadata); List<DistributionSetMetadata> createMetaData(long id, @NotEmpty Collection<MetaData> metadata);
@@ -134,13 +109,9 @@ public interface DistributionSetManagement
/** /**
* Deletes a distribution set meta data entry. * Deletes a distribution set meta data entry.
* *
* @param id * @param id where meta data has to be deleted
* where meta data has to be deleted * @param key of the meta data element
* @param key * @throws EntityNotFoundException if given set does not exist
* of the meta data element
*
* @throws EntityNotFoundException
* if given set does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
void deleteMetaData(long id, @NotEmpty String key); void deleteMetaData(long id, @NotEmpty String key);
@@ -169,12 +140,9 @@ public interface DistributionSetManagement
/** /**
* Retrieves the distribution set for a given action. * Retrieves the distribution set for a given action.
* *
* @param actionId * @param actionId the action associated with the distribution set
* the action associated with the distribution set
* @return the distribution set which is associated with the action * @return the distribution set which is associated with the action
* * @throws EntityNotFoundException if action with given ID does not exist
* @throws EntityNotFoundException
* if action with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Optional<DistributionSet> getByAction(long actionId); Optional<DistributionSet> getByAction(long actionId);
@@ -186,9 +154,7 @@ public interface DistributionSetManagement
* Note: for performance reasons it is recommended to use {@link #get(Long)} * Note: for performance reasons it is recommended to use {@link #get(Long)}
* if details are not necessary. * if details are not necessary.
* *
* @param id * @param id to look for.
* to look for.
*
* @return {@link DistributionSet} * @return {@link DistributionSet}
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
@@ -197,11 +163,8 @@ public interface DistributionSetManagement
/** /**
* Find distribution set by name and version. * Find distribution set by name and version.
* *
* @param distributionName * @param distributionName name of {@link DistributionSet}; case insensitive
* name of {@link DistributionSet}; case insensitive * @param version version of {@link DistributionSet}
* @param version
* version of {@link DistributionSet}
*
* @return the page with the found {@link DistributionSet} * @return the page with the found {@link DistributionSet}
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
@@ -211,19 +174,11 @@ public interface DistributionSetManagement
* Find distribution set by id and throw an exception if it is deleted, * Find distribution set by id and throw an exception if it is deleted,
* incomplete or invalidated. * incomplete or invalidated.
* *
* @param id * @param id id of {@link DistributionSet}
* id of {@link DistributionSet}
*
* @return the found valid {@link DistributionSet} * @return the found valid {@link DistributionSet}
* * @throws EntityNotFoundException if distribution set with given ID does not exist
* @throws EntityNotFoundException * @throws InvalidDistributionSetException if distribution set with given ID is invalidated
* if distribution set with given ID does not exist * @throws IncompleteDistributionSetException if distribution set with given ID is incomplete
*
* @throws InvalidDistributionSetException
* if distribution set with given ID is invalidated
*
* @throws IncompleteDistributionSetException
* if distribution set with given ID is incomplete
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
DistributionSet getValidAndComplete(long id); DistributionSet getValidAndComplete(long id);
@@ -232,16 +187,10 @@ public interface DistributionSetManagement
* Find distribution set by id and throw an exception if it is deleted or * Find distribution set by id and throw an exception if it is deleted or
* invalidated. * invalidated.
* *
* @param id * @param id id of {@link DistributionSet}
* id of {@link DistributionSet}
*
* @return the found valid {@link DistributionSet} * @return the found valid {@link DistributionSet}
* * @throws EntityNotFoundException if distribution set with given ID does not exist
* @throws EntityNotFoundException * @throws InvalidDistributionSetException if distribution set with given ID is invalidated
* if distribution set with given ID does not exist
*
* @throws InvalidDistributionSetException
* if distribution set with given ID is invalidated
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
DistributionSet getValid(long id); DistributionSet getValid(long id);
@@ -250,13 +199,9 @@ public interface DistributionSetManagement
* Find distribution set by id and throw an exception if it is (soft) * Find distribution set by id and throw an exception if it is (soft)
* deleted. * deleted.
* *
* @param id * @param id id of {@link DistributionSet}
* id of {@link DistributionSet}
*
* @return the found valid {@link DistributionSet} * @return the found valid {@link DistributionSet}
* * @throws EntityNotFoundException if distribution set with given ID does not exist
* @throws EntityNotFoundException
* if distribution set with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
DistributionSet getOrElseThrowException(long id); DistributionSet getOrElseThrowException(long id);
@@ -264,16 +209,11 @@ public interface DistributionSetManagement
/** /**
* Finds all meta data by the given distribution set id. * Finds all meta data by the given distribution set id.
* *
* @param pageable * @param pageable the page request to page the result
* the page request to page the result * @param id the distribution set id to retrieve the meta data from
* @param id
* the distribution set id to retrieve the meta data from
*
* @return a paged result of all meta data entries for a given distribution * @return a paged result of all meta data entries for a given distribution
* set id * set id
* * @throws EntityNotFoundException if distribution set with given ID does not exist
* @throws EntityNotFoundException
* if distribution set with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Page<DistributionSetMetadata> findMetaDataByDistributionSetId(@NotNull Pageable pageable, long id); Page<DistributionSetMetadata> findMetaDataByDistributionSetId(@NotNull Pageable pageable, long id);
@@ -281,13 +221,9 @@ public interface DistributionSetManagement
/** /**
* Counts all meta data by the given distribution set id. * Counts all meta data by the given distribution set id.
* *
* @param id * @param id the distribution set id to retrieve the meta data count from
* the distribution set id to retrieve the meta data count from
*
* @return count of ds metadata * @return count of ds metadata
* * @throws EntityNotFoundException if distribution set with given ID does not exist
* @throws EntityNotFoundException
* if distribution set with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
long countMetaDataByDistributionSetId(long id); long countMetaDataByDistributionSetId(long id);
@@ -295,40 +231,27 @@ public interface DistributionSetManagement
/** /**
* Finds all meta data by the given distribution set id. * Finds all meta data by the given distribution set id.
* *
* @param pageable * @param pageable the page request to page the result
* the page request to page the result * @param id the distribution set id to retrieve the meta data from
* @param id * @param rsqlParam rsql query string
* the distribution set id to retrieve the meta data from
* @param rsqlParam
* rsql query string
*
* @return a paged result of all meta data entries for a given distribution * @return a paged result of all meta data entries for a given distribution
* set id * set id
* * @throws RSQLParameterUnsupportedFieldException if a field in the RSQL string is used but not provided by the
* @throws RSQLParameterUnsupportedFieldException * given {@code fieldNameProvider}
* if a field in the RSQL string is used but not provided by the * @throws RSQLParameterSyntaxException if the RSQL syntax is wrong
* given {@code fieldNameProvider} * @throws EntityNotFoundException of distribution set with given ID does not exist
*
* @throws RSQLParameterSyntaxException
* if the RSQL syntax is wrong
*
* @throws EntityNotFoundException
* of distribution set with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Page<DistributionSetMetadata> findMetaDataByDistributionSetIdAndRsql(@NotNull Pageable pageable, Page<DistributionSetMetadata> findMetaDataByDistributionSetIdAndRsql(@NotNull Pageable pageable,
long id, @NotNull String rsqlParam); long id, @NotNull String rsqlParam);
/** /**
* Finds all {@link DistributionSet}s based on completeness. * Finds all {@link DistributionSet}s based on completeness.
* *
* @param pageable * @param pageable the pagination parameter
* the pagination parameter * @param complete to <code>true</code> for returning only completed distribution
* @param complete * sets or <code>false</code> for only incomplete ones nor
* to <code>true</code> for returning only completed distribution * <code>null</code> to return both.
* sets or <code>false</code> for only incomplete ones nor
* <code>null</code> to return both.
*
* @return all found {@link DistributionSet}s * @return all found {@link DistributionSet}s
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
@@ -337,11 +260,9 @@ public interface DistributionSetManagement
/** /**
* Counts all {@link DistributionSet}s based on completeness. * Counts all {@link DistributionSet}s based on completeness.
* *
* @param complete * @param complete to <code>true</code> for counting only completed distribution
* to <code>true</code> for counting only completed distribution * sets or <code>false</code> for only incomplete ones nor
* sets or <code>false</code> for only incomplete ones nor * <code>null</code> to count both.
* <code>null</code> to count both.
*
* @return count of all found {@link DistributionSet}s * @return count of all found {@link DistributionSet}s
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
@@ -350,10 +271,8 @@ public interface DistributionSetManagement
/** /**
* Retrieves {@link DistributionSet}s by filtering on the given parameters. * Retrieves {@link DistributionSet}s by filtering on the given parameters.
* *
* @param pageable * @param pageable page parameter
* page parameter * @param distributionSetFilter has details of filters to be applied.
* @param distributionSetFilter
* has details of filters to be applied.
* @return the page of found {@link DistributionSet} * @return the page of found {@link DistributionSet}
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
@@ -373,13 +292,9 @@ public interface DistributionSetManagement
* 3) {@link DistributionSet}s which have no connection to the given * 3) {@link DistributionSet}s which have no connection to the given
* {@link Target} ordered by ID of the DistributionSet. * {@link Target} ordered by ID of the DistributionSet.
* *
* @param pageable * @param pageable the page request to page the result set *
* the page request to page the result set * * @param distributionSetFilter has details of filters to be applied.
* @param distributionSetFilter * @param assignedOrInstalled the id of the Target to be ordered by
* has details of filters to be applied.
* @param assignedOrInstalled
* the id of the Target to be ordered by
*
* @return {@link DistributionSet}s * @return {@link DistributionSet}s
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
@@ -389,9 +304,7 @@ public interface DistributionSetManagement
/** /**
* Counts all {@link DistributionSet}s in repository based on given filter. * Counts all {@link DistributionSet}s in repository based on given filter.
* *
* @param distributionSetFilter * @param distributionSetFilter has details of filters to be applied.
* has details of filters to be applied.
*
* @return count of {@link DistributionSet}s * @return count of {@link DistributionSet}s
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
@@ -400,21 +313,13 @@ public interface DistributionSetManagement
/** /**
* Retrieves {@link DistributionSet}s by filtering on the given parameters. * Retrieves {@link DistributionSet}s by filtering on the given parameters.
* *
* @param pageable * @param pageable page parameter
* page parameter * @param tagId of the tag the DS are assigned to
* @param tagId
* of the tag the DS are assigned to
* @return the page of found {@link DistributionSet} * @return the page of found {@link DistributionSet}
* * @throws RSQLParameterUnsupportedFieldException if a field in the RSQL string is used but not provided by the
* @throws RSQLParameterUnsupportedFieldException * given {@code fieldNameProvider}
* if a field in the RSQL string is used but not provided by the * @throws RSQLParameterSyntaxException if the RSQL syntax is wrong
* given {@code fieldNameProvider} * @throws EntityNotFoundException of distribution set tag with given ID does not exist
*
* @throws RSQLParameterSyntaxException
* if the RSQL syntax is wrong
*
* @throws EntityNotFoundException
* of distribution set tag with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Page<DistributionSet> findByTag(@NotNull Pageable pageable, long tagId); Page<DistributionSet> findByTag(@NotNull Pageable pageable, long tagId);
@@ -422,16 +327,11 @@ public interface DistributionSetManagement
/** /**
* Retrieves {@link DistributionSet}s by filtering on the given parameters. * Retrieves {@link DistributionSet}s by filtering on the given parameters.
* *
* @param pageable * @param pageable page parameter
* page parameter * @param rsqlParam rsql query string
* @param rsqlParam * @param tagId of the tag the DS are assigned to
* rsql query string
* @param tagId
* of the tag the DS are assigned to
* @return the page of found {@link DistributionSet} * @return the page of found {@link DistributionSet}
* * @throws EntityNotFoundException of distribution set tag with given ID does not exist
* @throws EntityNotFoundException
* of distribution set tag with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Page<DistributionSet> findByRsqlAndTag(@NotNull Pageable pageable, @NotNull String rsqlParam, long tagId); Page<DistributionSet> findByRsqlAndTag(@NotNull Pageable pageable, @NotNull String rsqlParam, long tagId);
@@ -439,14 +339,10 @@ public interface DistributionSetManagement
/** /**
* Finds a single distribution set meta data by its id. * Finds a single distribution set meta data by its id.
* *
* @param id * @param id of the {@link DistributionSet}
* of the {@link DistributionSet} * @param key of the meta data element
* @param key
* of the meta data element
* @return the found DistributionSetMetadata * @return the found DistributionSetMetadata
* * @throws EntityNotFoundException is set with given ID does not exist
* @throws EntityNotFoundException
* is set with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Optional<DistributionSetMetadata> getMetaDataByDistributionSetId(long id, @NotEmpty String key); Optional<DistributionSetMetadata> getMetaDataByDistributionSetId(long id, @NotEmpty String key);
@@ -455,9 +351,7 @@ public interface DistributionSetManagement
* Checks if a {@link DistributionSet} is currently in use by a target in * Checks if a {@link DistributionSet} is currently in use by a target in
* the repository. * the repository.
* *
* @param id * @param id to check
* to check
*
* @return <code>true</code> if in use * @return <code>true</code> if in use
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
@@ -467,18 +361,12 @@ public interface DistributionSetManagement
* Unassigns a {@link SoftwareModule} form an existing * Unassigns a {@link SoftwareModule} form an existing
* {@link DistributionSet}. * {@link DistributionSet}.
* *
* @param id * @param id to get unassigned form
* to get unassigned form * @param moduleId to be unassigned
* @param moduleId
* to be unassigned
* @return the updated {@link DistributionSet}. * @return the updated {@link DistributionSet}.
* * @throws EntityNotFoundException if given module or DS does not exist
* @throws EntityNotFoundException * @throws EntityReadOnlyException if use tries to change the {@link DistributionSet} s while
* if given module or DS does not exist * the DS is already in use.
*
* @throws EntityReadOnlyException
* if use tries to change the {@link DistributionSet} s while
* the DS is already in use.
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
DistributionSet unassignSoftwareModule(long id, long moduleId); DistributionSet unassignSoftwareModule(long id, long moduleId);
@@ -486,15 +374,11 @@ public interface DistributionSetManagement
/** /**
* Updates a distribution set meta data value if corresponding entry exists. * Updates a distribution set meta data value if corresponding entry exists.
* *
* @param id * @param id {@link DistributionSet} of the meta data entry to be updated
* {@link DistributionSet} of the meta data entry to be updated * @param metadata meta data entry to be updated
* @param metadata
* meta data entry to be updated
* @return the updated meta data entry * @return the updated meta data entry
* * @throws EntityNotFoundException in case the meta data entry does not exists and cannot be
* @throws EntityNotFoundException * updated
* in case the meta data entry does not exists and cannot be
* updated
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
DistributionSetMetadata updateMetaData(long id, @NotNull MetaData metadata); DistributionSetMetadata updateMetaData(long id, @NotNull MetaData metadata);
@@ -503,13 +387,9 @@ public interface DistributionSetManagement
* Count all {@link DistributionSet}s in the repository that are not marked * Count all {@link DistributionSet}s in the repository that are not marked
* as deleted. * as deleted.
* *
* @param typeId * @param typeId to look for
* to look for
*
* @return number of {@link DistributionSet}s * @return number of {@link DistributionSet}s
* * @throws EntityNotFoundException if type with given ID does not exist
* @throws EntityNotFoundException
* if type with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
long countByTypeId(long typeId); long countByTypeId(long typeId);
@@ -518,11 +398,8 @@ public interface DistributionSetManagement
* Count all {@link org.eclipse.hawkbit.repository.model.Rollout}s by status for * Count all {@link org.eclipse.hawkbit.repository.model.Rollout}s by status for
* Distribution Set. * Distribution Set.
* *
* @param id * @param id to look for
* to look for
*
* @return List of Statistics for {@link org.eclipse.hawkbit.repository.model.Rollout}s status counts * @return List of Statistics for {@link org.eclipse.hawkbit.repository.model.Rollout}s status counts
*
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
List<Statistic> countRolloutsByStatusForDistributionSet(@NotNull Long id); List<Statistic> countRolloutsByStatusForDistributionSet(@NotNull Long id);
@@ -531,11 +408,8 @@ public interface DistributionSetManagement
* Count all {@link org.eclipse.hawkbit.repository.model.Action}s by status for * Count all {@link org.eclipse.hawkbit.repository.model.Action}s by status for
* Distribution Set. * Distribution Set.
* *
* @param id * @param id to look for
* to look for
*
* @return List of Statistics for {@link org.eclipse.hawkbit.repository.model.Action}s status counts * @return List of Statistics for {@link org.eclipse.hawkbit.repository.model.Action}s status counts
*
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
List<Statistic> countActionsByStatusForDistributionSet(@NotNull Long id); List<Statistic> countActionsByStatusForDistributionSet(@NotNull Long id);
@@ -544,11 +418,8 @@ public interface DistributionSetManagement
* Count all {@link org.eclipse.hawkbit.repository.builder.AutoAssignDistributionSetUpdate}s * Count all {@link org.eclipse.hawkbit.repository.builder.AutoAssignDistributionSetUpdate}s
* for Distribution Set. * for Distribution Set.
* *
* @param id * @param id to look for
* to look for
*
* @return number of {@link org.eclipse.hawkbit.repository.builder.AutoAssignDistributionSetUpdate}s * @return number of {@link org.eclipse.hawkbit.repository.builder.AutoAssignDistributionSetUpdate}s
*
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Long countAutoAssignmentsForDistributionSet(@NotNull Long id); Long countAutoAssignmentsForDistributionSet(@NotNull Long id);
@@ -556,8 +427,7 @@ public interface DistributionSetManagement
/** /**
* Sets the specified {@link DistributionSet} as invalidated. * Sets the specified {@link DistributionSet} as invalidated.
* *
* @param distributionSet * @param distributionSet the ID of the {@link DistributionSet} to be set to invalid
* the ID of the {@link DistributionSet} to be set to invalid
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
void invalidate(DistributionSet distributionSet); void invalidate(DistributionSet distributionSet);
@@ -568,25 +438,24 @@ public interface DistributionSetManagement
* the list have the {@link Tag} not yet assigned, they will be. Only if all * the list have the {@link Tag} not yet assigned, they will be. Only if all
* of theme have the tag already assigned they will be removed instead. * of theme have the tag already assigned they will be removed instead.
* *
* @deprecated since 0.6.0 in favor of assign/unassign
* @param ids to toggle for * @param ids to toggle for
* @param tagName to toggle * @param tagName to toggle
* @return {@link DistributionSetTagAssignmentResult} with all meta data of the assignment outcome. * @return {@link DistributionSetTagAssignmentResult} with all meta data of the assignment outcome.
* @throws EntityNotFoundException if given tag does not exist or (at least one) module * @throws EntityNotFoundException if given tag does not exist or (at least one) module
* @deprecated since 0.6.0 in favor of assign/unassign
*/ */
@Deprecated(forRemoval = true) @Deprecated(forRemoval = true)
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
DistributionSetTagAssignmentResult toggleTagAssignment(@NotEmpty Collection<Long> ids, @NotNull String tagName); DistributionSetTagAssignmentResult toggleTagAssignment(@NotEmpty Collection<Long> ids, @NotNull String tagName);
/** /**
* Unassign a {@link DistributionSetTag} assignment to given {@link DistributionSet}. * Unassign a {@link DistributionSetTag} assignment to given {@link DistributionSet}.
* *
* @deprecated since 0.6.0 in favor of unassignTag(List<Long>, long)
* @param id to unassign for * @param id to unassign for
* @param tagId to unassign * @param tagId to unassign
* @return the unassigned ds or <null> if no ds is unassigned * @return the unassigned ds or <null> if no ds is unassigned
* @throws EntityNotFoundException if set or tag with given ID does not exist * @throws EntityNotFoundException if set or tag with given ID does not exist
* @deprecated since 0.6.0 in favor of unassignTag(List<Long>, long)
*/ */
@Deprecated(forRemoval = true) @Deprecated(forRemoval = true)
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)

View File

@@ -28,7 +28,6 @@ import org.springframework.security.access.prepost.PreAuthorize;
/** /**
* Management service for {@link DistributionSetTag}s. * Management service for {@link DistributionSetTag}s.
*
*/ */
public interface DistributionSetTagManagement extends RepositoryManagement<DistributionSetTag, TagCreate, TagUpdate> { public interface DistributionSetTagManagement extends RepositoryManagement<DistributionSetTag, TagCreate, TagUpdate> {
@@ -36,11 +35,8 @@ public interface DistributionSetTagManagement extends RepositoryManagement<Distr
* Deletes {@link DistributionSetTag} by given * Deletes {@link DistributionSetTag} by given
* {@link DistributionSetTag#getName()}. * {@link DistributionSetTag#getName()}.
* *
* @param tagName * @param tagName to be deleted
* to be deleted * @throws EntityNotFoundException if tag with given name does not exist
*
* @throws EntityNotFoundException
* if tag with given name does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
void delete(@NotEmpty String tagName); void delete(@NotEmpty String tagName);
@@ -48,8 +44,7 @@ public interface DistributionSetTagManagement extends RepositoryManagement<Distr
/** /**
* Find {@link DistributionSet} based on given name. * Find {@link DistributionSet} based on given name.
* *
* @param name * @param name to look for.
* to look for.
* @return {@link DistributionSet} * @return {@link DistributionSet}
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
@@ -58,15 +53,10 @@ public interface DistributionSetTagManagement extends RepositoryManagement<Distr
/** /**
* Finds all {@link TargetTag} assigned to given {@link Target}. * Finds all {@link TargetTag} assigned to given {@link Target}.
* *
* @param pageable * @param pageable information for page size, offset and sort order.
* information for page size, offset and sort order. * @param distributionSetId of the {@link DistributionSet}
*
* @param distributionSetId
* of the {@link DistributionSet}
* @return page of the found {@link TargetTag}s * @return page of the found {@link TargetTag}s
* * @throws EntityNotFoundException if {@link DistributionSet} with given ID does not exist
* @throws EntityNotFoundException
* if {@link DistributionSet} with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Page<DistributionSetTag> findByDistributionSet(@NotNull Pageable pageable, long distributionSetId); Page<DistributionSetTag> findByDistributionSet(@NotNull Pageable pageable, long distributionSetId);

View File

@@ -17,9 +17,9 @@ import jakarta.validation.constraints.NotEmpty;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions; import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
import org.eclipse.hawkbit.repository.builder.DistributionSetTypeCreate; import org.eclipse.hawkbit.repository.builder.DistributionSetTypeCreate;
import org.eclipse.hawkbit.repository.builder.DistributionSetTypeUpdate; 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.EntityNotFoundException;
import org.eclipse.hawkbit.repository.exception.EntityReadOnlyException; import org.eclipse.hawkbit.repository.exception.EntityReadOnlyException;
import org.eclipse.hawkbit.repository.exception.AssignmentQuotaExceededException;
import org.eclipse.hawkbit.repository.model.DistributionSet; import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetType; import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType; import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
@@ -27,14 +27,12 @@ import org.springframework.security.access.prepost.PreAuthorize;
/** /**
* Management service for {@link DistributionSetType}s. * Management service for {@link DistributionSetType}s.
*
*/ */
public interface DistributionSetTypeManagement public interface DistributionSetTypeManagement
extends RepositoryManagement<DistributionSetType, DistributionSetTypeCreate, DistributionSetTypeUpdate> { extends RepositoryManagement<DistributionSetType, DistributionSetTypeCreate, DistributionSetTypeUpdate> {
/** /**
* @param key * @param key as {@link DistributionSetType#getKey()}
* as {@link DistributionSetType#getKey()}
* @return {@link DistributionSetType} * @return {@link DistributionSetType}
*/ */
@@ -42,8 +40,7 @@ public interface DistributionSetTypeManagement
Optional<DistributionSetType> getByKey(@NotEmpty String key); Optional<DistributionSetType> getByKey(@NotEmpty String key);
/** /**
* @param name * @param name as {@link DistributionSetType#getName()}
* as {@link DistributionSetType#getName()}
* @return {@link DistributionSetType} * @return {@link DistributionSetType}
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
@@ -52,23 +49,15 @@ public interface DistributionSetTypeManagement
/** /**
* Assigns {@link DistributionSetType#getMandatoryModuleTypes()}. * Assigns {@link DistributionSetType#getMandatoryModuleTypes()}.
* *
* @param id * @param id to update
* to update * @param softwareModuleTypeIds to assign
* @param softwareModuleTypeIds
* to assign
* @return updated {@link DistributionSetType} * @return updated {@link DistributionSetType}
* * @throws EntityNotFoundException in case the {@link DistributionSetType} or at least one of
* @throws EntityNotFoundException * the {@link SoftwareModuleType}s do not exist
* in case the {@link DistributionSetType} or at least one of * @throws EntityReadOnlyException if the {@link DistributionSetType} while it is already in use
* the {@link SoftwareModuleType}s do not exist * by a {@link DistributionSet}
* * @throws AssignmentQuotaExceededException if the maximum number of {@link SoftwareModuleType}s is
* @throws EntityReadOnlyException * exceeded for the addressed {@link DistributionSetType}
* if the {@link DistributionSetType} while it is already in use
* by a {@link DistributionSet}
*
* @throws AssignmentQuotaExceededException
* if the maximum number of {@link SoftwareModuleType}s is
* exceeded for the addressed {@link DistributionSetType}
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
DistributionSetType assignOptionalSoftwareModuleTypes(long id, @NotEmpty Collection<Long> softwareModuleTypeIds); DistributionSetType assignOptionalSoftwareModuleTypes(long id, @NotEmpty Collection<Long> softwareModuleTypeIds);
@@ -76,23 +65,15 @@ public interface DistributionSetTypeManagement
/** /**
* Assigns {@link DistributionSetType#getOptionalModuleTypes()}. * Assigns {@link DistributionSetType#getOptionalModuleTypes()}.
* *
* @param id * @param id to update
* to update * @param softwareModuleTypeIds to assign
* @param softwareModuleTypeIds
* to assign
* @return updated {@link DistributionSetType} * @return updated {@link DistributionSetType}
* * @throws EntityNotFoundException in case the {@link DistributionSetType} or at least one of
* @throws EntityNotFoundException * the {@link SoftwareModuleType}s do not exist
* in case the {@link DistributionSetType} or at least one of * @throws EntityReadOnlyException if the {@link DistributionSetType} while it is already in use
* the {@link SoftwareModuleType}s do not exist * by a {@link DistributionSet}
* * @throws AssignmentQuotaExceededException if the maximum number of {@link SoftwareModuleType}s is
* @throws EntityReadOnlyException * exceeded for the addressed {@link DistributionSetType}
* if the {@link DistributionSetType} while it is already in use
* by a {@link DistributionSet}
*
* @throws AssignmentQuotaExceededException
* if the maximum number of {@link SoftwareModuleType}s is
* exceeded for the addressed {@link DistributionSetType}
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
DistributionSetType assignMandatorySoftwareModuleTypes(long id, @NotEmpty Collection<Long> softwareModuleTypeIds); DistributionSetType assignMandatorySoftwareModuleTypes(long id, @NotEmpty Collection<Long> softwareModuleTypeIds);
@@ -102,18 +83,12 @@ public interface DistributionSetTypeManagement
* {@link DistributionSetType}. Does nothing if {@link SoftwareModuleType} * {@link DistributionSetType}. Does nothing if {@link SoftwareModuleType}
* has not been assigned in the first place. * has not been assigned in the first place.
* *
* @param id * @param id to update
* to update * @param softwareModuleTypeId to unassign
* @param softwareModuleTypeId
* to unassign
* @return updated {@link DistributionSetType} * @return updated {@link DistributionSetType}
* * @throws EntityNotFoundException in case the {@link DistributionSetType} does not exist
* @throws EntityNotFoundException * @throws EntityReadOnlyException if the {@link DistributionSetType} while it is already in use
* in case the {@link DistributionSetType} does not exist * by a {@link DistributionSet}
*
* @throws EntityReadOnlyException
* if the {@link DistributionSetType} while it is already in use
* by a {@link DistributionSet}
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
DistributionSetType unassignSoftwareModuleType(long id, long softwareModuleTypeId); DistributionSetType unassignSoftwareModuleType(long id, long softwareModuleTypeId);

View File

@@ -30,7 +30,6 @@ import org.eclipse.hawkbit.repository.model.MetaData;
/** /**
* central {@link BaseEntity} generation service. Objects are created but not * central {@link BaseEntity} generation service. Objects are created but not
* persisted. * persisted.
*
*/ */
public interface EntityFactory { public interface EntityFactory {
@@ -48,11 +47,8 @@ public interface EntityFactory {
* Generates an {@link MetaData} element for distribution set without * Generates an {@link MetaData} element for distribution set without
* persisting it. * persisting it.
* *
* @param key * @param key {@link MetaData#getKey()}
* {@link MetaData#getKey()} * @param value {@link MetaData#getValue()}
* @param value
* {@link MetaData#getValue()}
*
* @return {@link MetaData} object * @return {@link MetaData} object
*/ */
MetaData generateDsMetadata(@Size(min = 1, max = MetaData.KEY_MAX_SIZE) @NotNull String key, MetaData generateDsMetadata(@Size(min = 1, max = MetaData.KEY_MAX_SIZE) @NotNull String key,
@@ -61,11 +57,8 @@ public interface EntityFactory {
/** /**
* Generates an {@link MetaData} element for target without persisting it. * Generates an {@link MetaData} element for target without persisting it.
* *
* @param key * @param key {@link MetaData#getKey()}
* {@link MetaData#getKey()} * @param value {@link MetaData#getValue()}
* @param value
* {@link MetaData#getValue()}
*
* @return {@link MetaData} object * @return {@link MetaData} object
*/ */
MetaData generateTargetMetadata(@Size(min = 1, max = MetaData.KEY_MAX_SIZE) @NotNull String key, MetaData generateTargetMetadata(@Size(min = 1, max = MetaData.KEY_MAX_SIZE) @NotNull String key,

View File

@@ -35,21 +35,15 @@ public class FilterParams {
/** /**
* Constructor for the filter parameters of a Simple Filter. * Constructor for the filter parameters of a Simple Filter.
* *
* @param filterByInstalledOrAssignedDistributionSetId * @param filterByInstalledOrAssignedDistributionSetId if set, a filter is added for the given
* if set, a filter is added for the given * {@link DistributionSet#getId()}
* {@link DistributionSet#getId()} * @param filterByStatus if set, a filter is added for target states included by the
* @param filterByStatus * collection
* if set, a filter is added for target states included by the * @param overdueState if set, a filter is added for overdued devices
* collection * @param filterBySearchText if set, a filter is added for the given search text
* @param overdueState * @param selectTargetWithNoTag if set, tag-filtering is enabled
* if set, a filter is added for overdued devices * @param filterByTagNames if tag-filtering is enabled, a filter is added for the given
* @param filterBySearchText * tag-names
* if set, a filter is added for the given search text
* @param selectTargetWithNoTag
* if set, tag-filtering is enabled
* @param filterByTagNames
* if tag-filtering is enabled, a filter is added for the given
* tag-names
*/ */
public FilterParams(final Collection<TargetUpdateStatus> filterByStatus, final Boolean overdueState, public FilterParams(final Collection<TargetUpdateStatus> filterByStatus, final Boolean overdueState,
final String filterBySearchText, final Long filterByInstalledOrAssignedDistributionSetId, final String filterBySearchText, final Long filterByInstalledOrAssignedDistributionSetId,
@@ -67,18 +61,14 @@ public class FilterParams {
/** /**
* Constructor for the filter parameters of a Type Filter. * Constructor for the filter parameters of a Type Filter.
* *
* @param filterBySearchText * @param filterBySearchText if set, a filter is added for the given search text
* if set, a filter is added for the given search text * @param filterByInstalledOrAssignedDistributionSetId if set, a filter is added for the given
* @param filterByInstalledOrAssignedDistributionSetId * {@link DistributionSet#getId()}
* if set, a filter is added for the given * @param selectTargetWithNoType if true, a filter is added with no type
* {@link DistributionSet#getId()} * @param filterByType if set, a filter is added for the given target type
* @param selectTargetWithNoType
* if true, a filter is added with no type
* @param filterByType
* if set, a filter is added for the given target type
*/ */
public FilterParams(final String filterBySearchText, final Long filterByInstalledOrAssignedDistributionSetId, public FilterParams(final String filterBySearchText, final Long filterByInstalledOrAssignedDistributionSetId,
final Boolean selectTargetWithNoType, final Long filterByType) { final Boolean selectTargetWithNoType, final Long filterByType) {
this.filterBySearchText = filterBySearchText; this.filterBySearchText = filterBySearchText;
this.filterByDistributionId = filterByInstalledOrAssignedDistributionSetId; this.filterByDistributionId = filterByInstalledOrAssignedDistributionSetId;
this.filterByStatus = null; this.filterByStatus = null;

View File

@@ -16,14 +16,13 @@ import java.time.ZonedDateTime;
import java.time.format.DateTimeParseException; import java.time.format.DateTimeParseException;
import java.util.Optional; import java.util.Optional;
import org.eclipse.hawkbit.repository.exception.InvalidMaintenanceScheduleException;
import org.springframework.util.StringUtils;
import com.cronutils.model.Cron; import com.cronutils.model.Cron;
import com.cronutils.model.CronType; import com.cronutils.model.CronType;
import com.cronutils.model.definition.CronDefinitionBuilder; import com.cronutils.model.definition.CronDefinitionBuilder;
import com.cronutils.model.time.ExecutionTime; import com.cronutils.model.time.ExecutionTime;
import com.cronutils.parser.CronParser; import com.cronutils.parser.CronParser;
import org.eclipse.hawkbit.repository.exception.InvalidMaintenanceScheduleException;
import org.springframework.util.StringUtils;
/** /**
* Helper class to check validity of maintenance schedule definition and manage * Helper class to check validity of maintenance schedule definition and manage
@@ -43,23 +42,18 @@ public final class MaintenanceScheduleHelper {
/** /**
* Calculate the next available maintenance window. * Calculate the next available maintenance window.
* *
* @param cronSchedule * @param cronSchedule is a cron expression with 6 mandatory fields and 1 last
* is a cron expression with 6 mandatory fields and 1 last * optional field: "second minute hour dayofmonth month weekday
* optional field: "second minute hour dayofmonth month weekday * year".
* year". * @param duration in HH:mm:ss format specifying the duration of a maintenance
* @param duration * window, for example 00:30:00 for 30 minutes.
* in HH:mm:ss format specifying the duration of a maintenance * @param timezone is the time zone specified as +/-hh:mm offset from UTC. For
* window, for example 00:30:00 for 30 minutes. * example +02:00 for CET summer time and +00:00 for UTC. The
* @param timezone * start time of a maintenance window calculated based on the
* is the time zone specified as +/-hh:mm offset from UTC. For * cron expression is relative to this time zone.
* example +02:00 for CET summer time and +00:00 for UTC. The
* start time of a maintenance window calculated based on the
* cron expression is relative to this time zone.
*
* @return { @link Optional<ZonedDateTime>} of the next available window. In * @return { @link Optional<ZonedDateTime>} of the next available window. In
* case there is none, or there are maintenance window validation * case there is none, or there are maintenance window validation
* errors, returns empty value. * errors, returns empty value.
*
*/ */
// Exception squid:S1166 - if there are validation error(format of cron // Exception squid:S1166 - if there are validation error(format of cron
// expression or duration is wrong), we simply return empty value // expression or duration is wrong), we simply return empty value
@@ -79,15 +73,11 @@ public final class MaintenanceScheduleHelper {
/** /**
* Parse the given cron expression with quartz parser. * Parse the given cron expression with quartz parser.
* *
* @param cronSchedule * @param cronSchedule is a cron expression with 6 mandatory fields and 1 last
* is a cron expression with 6 mandatory fields and 1 last * optional field: "second minute hour dayofmonth month weekday
* optional field: "second minute hour dayofmonth month weekday * year".
* year".
*
* @return {@link Cron} object, that corresponds to the expression. * @return {@link Cron} object, that corresponds to the expression.
* * @throws IllegalArgumentException if the cron expression doesn't have a valid format.
* @throws IllegalArgumentException
* if the cron expression doesn't have a valid format.
*/ */
public static Cron getCronFromExpression(final String cronSchedule) { public static Cron getCronFromExpression(final String cronSchedule) {
return cronParser.parse(cronSchedule); return cronParser.parse(cronSchedule);
@@ -100,21 +90,16 @@ public final class MaintenanceScheduleHelper {
* either all the parameters: schedule, duration and time zone are valid or * either all the parameters: schedule, duration and time zone are valid or
* are null. * are null.
* *
* @param cronSchedule * @param cronSchedule is a cron expression with 6 mandatory fields and 1 last
* is a cron expression with 6 mandatory fields and 1 last * optional field: "second minute hour dayofmonth month weekday
* optional field: "second minute hour dayofmonth month weekday * year".
* year". * @param duration in HH:mm:ss format specifying the duration of a maintenance
* @param duration * window, for example 00:30:00 for 30 minutes.
* in HH:mm:ss format specifying the duration of a maintenance * @param timezone is the time zone specified as +/-hh:mm offset from UTC. For
* window, for example 00:30:00 for 30 minutes. * example +02:00 for CET summer time and +00:00 for UTC. The
* @param timezone * start time of a maintenance window calculated based on the
* is the time zone specified as +/-hh:mm offset from UTC. For * cron expression is relative to this time zone.
* example +02:00 for CET summer time and +00:00 for UTC. The * @throws InvalidMaintenanceScheduleException if the defined schedule fails the validity criteria.
* start time of a maintenance window calculated based on the
* cron expression is relative to this time zone.
*
* @throws InvalidMaintenanceScheduleException
* if the defined schedule fails the validity criteria.
*/ */
public static void validateMaintenanceSchedule(final String cronSchedule, final String duration, public static void validateMaintenanceSchedule(final String cronSchedule, final String duration,
final String timezone) { final String timezone) {
@@ -133,47 +118,28 @@ public final class MaintenanceScheduleHelper {
} }
} }
private static boolean atLeastOneNotEmpty(final String cronSchedule, final String duration, final String timezone) {
return !(StringUtils.isEmpty(cronSchedule) && StringUtils.isEmpty(duration) && StringUtils.isEmpty(timezone));
}
private static boolean allNotEmpty(final String cronSchedule, final String duration, final String timezone) {
return !StringUtils.isEmpty(cronSchedule) && !StringUtils.isEmpty(duration) && !StringUtils.isEmpty(timezone);
}
/** /**
* Convert the time interval or duration specified in "HH:mm:ss" format to * Convert the time interval or duration specified in "HH:mm:ss" format to
* ISO format. * ISO format.
* *
* @param timeInterval * @param timeInterval in "HH:mm:ss" string format. This format is popularly used but
* in "HH:mm:ss" string format. This format is popularly used but * can be confused with time of the day, hence conversion to ISO
* can be confused with time of the day, hence conversion to ISO * specified format for time duration is required.
* specified format for time duration is required.
*
* @return {@link Duration} in ISO format. * @return {@link Duration} in ISO format.
* * @throws DateTimeParseException if the text cannot be converted to ISO format.
* @throws DateTimeParseException
* if the text cannot be converted to ISO format.
*/ */
public static Duration convertToISODuration(final String timeInterval) { public static Duration convertToISODuration(final String timeInterval) {
return Duration.between(LocalTime.MIN, convertDurationToLocalTime(timeInterval)); return Duration.between(LocalTime.MIN, convertDurationToLocalTime(timeInterval));
} }
private static LocalTime convertDurationToLocalTime(final String timeInterval) {
return LocalTime.parse(StringUtils.trimWhitespace(timeInterval));
}
/** /**
* Validates the format of the maintenance window duration * Validates the format of the maintenance window duration
* *
* @param duration * @param duration in "HH:mm:ss" string format. This format is popularly used but
* in "HH:mm:ss" string format. This format is popularly used but * can be confused with time of the day, hence conversion to ISO
* can be confused with time of the day, hence conversion to ISO * specified format for time duration is required.
* specified format for time duration is required. * @throws InvalidMaintenanceScheduleException if the duration doesn't have a valid format to be converted
* * to ISO.
* @throws InvalidMaintenanceScheduleException
* if the duration doesn't have a valid format to be converted
* to ISO.
*/ */
public static void validateDuration(final String duration) { public static void validateDuration(final String duration) {
try { try {
@@ -188,13 +154,10 @@ public final class MaintenanceScheduleHelper {
/** /**
* Validates the format of the maintenance window cron expression * Validates the format of the maintenance window cron expression
* *
* @param cronSchedule * @param cronSchedule is a cron expression with 6 mandatory fields and 1 last
* is a cron expression with 6 mandatory fields and 1 last * optional field: "second minute hour dayofmonth month weekday
* optional field: "second minute hour dayofmonth month weekday * year".
* year". * @throws InvalidMaintenanceScheduleException if the cron expression doesn't have a valid quartz format.
*
* @throws InvalidMaintenanceScheduleException
* if the cron expression doesn't have a valid quartz format.
*/ */
public static void validateCronSchedule(final String cronSchedule) { public static void validateCronSchedule(final String cronSchedule) {
try { try {
@@ -205,4 +168,16 @@ public final class MaintenanceScheduleHelper {
throw new InvalidMaintenanceScheduleException(e.getMessage(), e); throw new InvalidMaintenanceScheduleException(e.getMessage(), e);
} }
} }
private static boolean atLeastOneNotEmpty(final String cronSchedule, final String duration, final String timezone) {
return !(StringUtils.isEmpty(cronSchedule) && StringUtils.isEmpty(duration) && StringUtils.isEmpty(timezone));
}
private static boolean allNotEmpty(final String cronSchedule, final String duration, final String timezone) {
return !StringUtils.isEmpty(cronSchedule) && !StringUtils.isEmpty(duration) && !StringUtils.isEmpty(timezone);
}
private static LocalTime convertDurationToLocalTime(final String timeInterval) {
return LocalTime.parse(StringUtils.trimWhitespace(timeInterval));
}
} }

View File

@@ -31,10 +31,8 @@ public final class OffsetBasedPageRequest extends PageRequest {
* Creates a new {@link OffsetBasedPageRequest}. Offsets are zero indexed, * Creates a new {@link OffsetBasedPageRequest}. Offsets are zero indexed,
* thus providing 0 for {@code offset} will return the first entry. * thus providing 0 for {@code offset} will return the first entry.
* *
* @param offset * @param offset zero-based offset index.
* zero-based offset index. * @param limit the limit of the page to be returned.
* @param limit
* the limit of the page to be returned.
*/ */
public OffsetBasedPageRequest(final long offset, final int limit) { public OffsetBasedPageRequest(final long offset, final int limit) {
this(offset, limit, Sort.unsorted()); this(offset, limit, Sort.unsorted());
@@ -44,12 +42,9 @@ public final class OffsetBasedPageRequest extends PageRequest {
* Creates a new {@link OffsetBasedPageRequest}. Offsets are zero indexed, * Creates a new {@link OffsetBasedPageRequest}. Offsets are zero indexed,
* thus providing 0 for {@code offset} will return the first entry. * thus providing 0 for {@code offset} will return the first entry.
* *
* @param offset * @param offset zero-based offset index.
* zero-based offset index. * @param limit the limit of the page to be returned.
* @param limit * @param sort sort can be {@literal null}.
* the limit of the page to be returned.
* @param sort
* sort can be {@literal null}.
*/ */
public OffsetBasedPageRequest(final long offset, final int limit, final Sort sort) { public OffsetBasedPageRequest(final long offset, final int limit, final Sort sort) {
super(0, limit, sort); super(0, limit, sort);

View File

@@ -16,7 +16,6 @@ import org.eclipse.hawkbit.repository.model.RolloutGroup;
/** /**
* Central service for defined limits of the repository. * Central service for defined limits of the repository.
*
*/ */
public interface QuotaManagement { public interface QuotaManagement {

View File

@@ -43,7 +43,7 @@ public class RegexCharacterCollection {
public enum RegexChar { public enum RegexChar {
WHITESPACE("\\s", "character.whitespace"), DIGITS("0-9", "character.digits"), QUOTATION_MARKS("'\"", WHITESPACE("\\s", "character.whitespace"), DIGITS("0-9", "character.digits"), QUOTATION_MARKS("'\"",
"character.quotationMarks"), SLASHES("\\/\\\\", "character.slashes"), GREATER_THAN( "character.quotationMarks"), SLASHES("\\/\\\\", "character.slashes"), GREATER_THAN(
">"), LESS_THAN("<"), EQUALS_SYMBOL("="), EXCLAMATION_MARK("!"), QUESTION_MARK("?"), COLON(":"); ">"), LESS_THAN("<"), EQUALS_SYMBOL("="), EXCLAMATION_MARK("!"), QUESTION_MARK("?"), COLON(":");
private final String regExp; private final String regExp;
private final String l18nReferenceDescription; private final String l18nReferenceDescription;

View File

@@ -16,7 +16,6 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
/** /**
* Repository constants. * Repository constants.
*
*/ */
public final class RepositoryConstants { public final class RepositoryConstants {

View File

@@ -32,25 +32,19 @@ import org.springframework.security.access.prepost.PreAuthorize;
/** /**
* Generic management methods common to (software) repository content. * Generic management methods common to (software) repository content.
* *
* @param <T> * @param <T> type of the {@link BaseEntity}
* type of the {@link BaseEntity} * @param <C> entity create builder
* @param <C> * @param <U> entity update builder
* entity create builder
* @param <U>
* entity update builder
*/ */
public interface RepositoryManagement<T, C, U> { public interface RepositoryManagement<T, C, U> {
/** /**
* Creates multiple {@link BaseEntity}s. * Creates multiple {@link BaseEntity}s.
* *
* @param creates * @param creates to create
* to create
* @return created Entity * @return created Entity
* * @throws ConstraintViolationException if fields are not filled as specified. Check
* @throws ConstraintViolationException * {@link BaseEntity} for field constraints.
* if fields are not filled as specified. Check
* {@link BaseEntity} for field constraints.
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
List<T> create(@NotNull @Valid Collection<C> creates); List<T> create(@NotNull @Valid Collection<C> creates);
@@ -58,13 +52,10 @@ public interface RepositoryManagement<T, C, U> {
/** /**
* Creates new {@link BaseEntity}. * Creates new {@link BaseEntity}.
* *
* @param create * @param create to create
* to create
* @return created Entity * @return created Entity
* * @throws ConstraintViolationException if fields are not filled as specified. Check
* @throws ConstraintViolationException * {@link BaseEntity} for field constraints.
* if fields are not filled as specified. Check
* {@link BaseEntity} for field constraints.
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
T create(@NotNull @Valid C create); T create(@NotNull @Valid C create);
@@ -72,20 +63,14 @@ public interface RepositoryManagement<T, C, U> {
/** /**
* Updates existing {@link BaseEntity}. * Updates existing {@link BaseEntity}.
* *
* @param update * @param update to update
* to update
*
* @return updated Entity * @return updated Entity
* * @throws EntityReadOnlyException if the {@link BaseEntity} cannot be updated (e.g. is already
* @throws EntityReadOnlyException * in use)
* if the {@link BaseEntity} cannot be updated (e.g. is already * @throws EntityNotFoundException in case the {@link BaseEntity} does not exists and cannot be
* in use) * updated
* @throws EntityNotFoundException * @throws ConstraintViolationException if fields are not filled as specified. Check
* in case the {@link BaseEntity} does not exists and cannot be * {@link BaseEntity} for field constraints.
* updated
* @throws ConstraintViolationException
* if fields are not filled as specified. Check
* {@link BaseEntity} for field constraints.
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
T update(@NotNull @Valid U update); T update(@NotNull @Valid U update);
@@ -99,11 +84,8 @@ public interface RepositoryManagement<T, C, U> {
/** /**
* Deletes or marks as delete in case the {@link BaseEntity} is in use. * Deletes or marks as delete in case the {@link BaseEntity} is in use.
* *
* @param id * @param id to delete
* to delete * @throws EntityNotFoundException BaseEntity with given ID does not exist
*
* @throws EntityNotFoundException
* BaseEntity with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
void delete(long id); void delete(long id);
@@ -113,11 +95,8 @@ public interface RepositoryManagement<T, C, U> {
* the entities have been linked to another entity before or a hard delete * the entities have been linked to another entity before or a hard delete
* if not. * if not.
* *
* @param ids * @param ids to be deleted
* to be deleted * @throws EntityNotFoundException if (at least one) given distribution set does not exist
*
* @throws EntityNotFoundException
* if (at least one) given distribution set does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
void delete(@NotEmpty Collection<Long> ids); void delete(@NotEmpty Collection<Long> ids);
@@ -125,8 +104,7 @@ public interface RepositoryManagement<T, C, U> {
/** /**
* Retrieves all {@link BaseEntity}s without details. * Retrieves all {@link BaseEntity}s without details.
* *
* @param ids * @param ids the ids to for
* the ids to for
* @return the found {@link BaseEntity}s * @return the found {@link BaseEntity}s
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
@@ -135,8 +113,7 @@ public interface RepositoryManagement<T, C, U> {
/** /**
* Verifies that {@link BaseEntity} with given ID exists in the repository. * Verifies that {@link BaseEntity} with given ID exists in the repository.
* *
* @param id * @param id of entity to check existence
* of entity to check existence
* @return <code>true</code> if entity with given ID exists * @return <code>true</code> if entity with given ID exists
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
@@ -145,8 +122,7 @@ public interface RepositoryManagement<T, C, U> {
/** /**
* Retrieve {@link BaseEntity} * Retrieve {@link BaseEntity}
* *
* @param id * @param id to search for
* to search for
* @return {@link BaseEntity} in the repository with given * @return {@link BaseEntity} in the repository with given
* {@link BaseEntity#getId()} * {@link BaseEntity#getId()}
*/ */
@@ -156,8 +132,7 @@ public interface RepositoryManagement<T, C, U> {
/** /**
* Retrieves {@link Page} of all {@link BaseEntity} of given type. * Retrieves {@link Page} of all {@link BaseEntity} of given type.
* *
* @param pageable * @param pageable paging parameter
* paging parameter
* @return all {@link BaseEntity}s in the repository. * @return all {@link BaseEntity}s in the repository.
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
@@ -166,18 +141,12 @@ public interface RepositoryManagement<T, C, U> {
/** /**
* Retrieves all {@link BaseEntity}s with a given specification. * Retrieves all {@link BaseEntity}s with a given specification.
* *
* @param pageable * @param pageable pagination parameter
* pagination parameter * @param rsqlParam filter definition in RSQL syntax
* @param rsqlParam
* filter definition in RSQL syntax
*
* @return the found {@link BaseEntity}s * @return the found {@link BaseEntity}s
* * @throws RSQLParameterUnsupportedFieldException if a field in the RSQL string is used but not provided by the
* @throws RSQLParameterUnsupportedFieldException * given {@code fieldNameProvider}
* if a field in the RSQL string is used but not provided by the * @throws RSQLParameterSyntaxException if the RSQL syntax is wrong
* given {@code fieldNameProvider}
* @throws RSQLParameterSyntaxException
* if the RSQL syntax is wrong
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Page<T> findByRsql(@NotNull Pageable pageable, @NotNull String rsqlParam); Page<T> findByRsql(@NotNull Pageable pageable, @NotNull String rsqlParam);

View File

@@ -27,7 +27,6 @@ import org.springframework.security.access.prepost.PreAuthorize;
/** /**
* Repository management service for RolloutGroup. * Repository management service for RolloutGroup.
*
*/ */
public interface RolloutGroupManagement { public interface RolloutGroupManagement {
@@ -35,34 +34,25 @@ public interface RolloutGroupManagement {
* Retrieves a page of {@link RolloutGroup}s filtered by a given * Retrieves a page of {@link RolloutGroup}s filtered by a given
* {@link Rollout} with the detailed status. * {@link Rollout} with the detailed status.
* *
* @param pageable * @param pageable the page request to sort and limit the result
* the page request to sort and limit the result * @param rolloutId the ID of the rollout to filter the {@link RolloutGroup}s
* @param rolloutId
* the ID of the rollout to filter the {@link RolloutGroup}s
*
* @return a page of found {@link RolloutGroup}s * @return a page of found {@link RolloutGroup}s
* * @throws EntityNotFoundException of rollout with given ID does not exist
* @throws EntityNotFoundException
* of rollout with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
Page<RolloutGroup> findByRolloutWithDetailedStatus(@NotNull Pageable pageable, long rolloutId); Page<RolloutGroup> findByRolloutWithDetailedStatus(@NotNull Pageable pageable, long rolloutId);
/** /**
*
* Find all targets with action status by rollout group id. The action * Find all targets with action status by rollout group id. The action
* status might be {@code null} if for the target within the rollout no * status might be {@code null} if for the target within the rollout no
* actions as been created, e.g. the target already had assigned the same * actions as been created, e.g. the target already had assigned the same
* distribution set we do not create an action for it but the target is in * distribution set we do not create an action for it but the target is in
* the result list of the rollout-group. * the result list of the rollout-group.
* *
* @param pageable * @param pageable the page request to sort and limit the result
* the page request to sort and limit the result * @param rolloutGroupId rollout group
* @param rolloutGroupId
* rollout group
* @return {@link TargetWithActionStatus} target with action status * @return {@link TargetWithActionStatus} target with action status
* @throws EntityNotFoundException * @throws EntityNotFoundException if rollout group with given ID does not exist
* if rollout group with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ_AND_TARGET_READ) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ_AND_TARGET_READ)
Page<TargetWithActionStatus> findAllTargetsOfRolloutGroupWithActionStatus(@NotNull Pageable pageable, Page<TargetWithActionStatus> findAllTargetsOfRolloutGroupWithActionStatus(@NotNull Pageable pageable,
@@ -71,11 +61,9 @@ public interface RolloutGroupManagement {
/** /**
* Retrieves a single {@link RolloutGroup} by its ID. * Retrieves a single {@link RolloutGroup} by its ID.
* *
* @param rolloutGroupId * @param rolloutGroupId the ID of the rollout group to find
* the ID of the rollout group to find
* @return the found {@link RolloutGroup} by its ID or {@code null} if it * @return the found {@link RolloutGroup} by its ID or {@code null} if it
* does not exists * does not exists
*
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
Optional<RolloutGroup> get(long rolloutGroupId); Optional<RolloutGroup> get(long rolloutGroupId);
@@ -84,46 +72,31 @@ public interface RolloutGroupManagement {
* Retrieves a page of {@link RolloutGroup}s filtered by a given * Retrieves a page of {@link RolloutGroup}s filtered by a given
* {@link Rollout} and the an rsql filter. * {@link Rollout} and the an rsql filter.
* *
* @param pageable * @param pageable the page request to sort and limit the result
* the page request to sort and limit the result * @param rolloutId the rollout to filter the {@link RolloutGroup}s
* @param rolloutId * @param rsqlParam the specification to filter the result set based on attributes
* the rollout to filter the {@link RolloutGroup}s * of the {@link RolloutGroup}
* @param rsqlParam
* the specification to filter the result set based on attributes
* of the {@link RolloutGroup}
*
* @return a page of found {@link RolloutGroup}s * @return a page of found {@link RolloutGroup}s
* * @throws RSQLParameterUnsupportedFieldException if a field in the RSQL string is used but not provided by the
* @throws RSQLParameterUnsupportedFieldException * given {@code fieldNameProvider}
* if a field in the RSQL string is used but not provided by the * @throws RSQLParameterSyntaxException if the RSQL syntax is wrong
* given {@code fieldNameProvider}
* @throws RSQLParameterSyntaxException
* if the RSQL syntax is wrong
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
Page<RolloutGroup> findByRolloutAndRsql(@NotNull Pageable pageable, long rolloutId, Page<RolloutGroup> findByRolloutAndRsql(@NotNull Pageable pageable, long rolloutId,
@NotNull String rsqlParam); @NotNull String rsqlParam);
/** /**
* Retrieves a page of {@link RolloutGroup}s filtered by a given * Retrieves a page of {@link RolloutGroup}s filtered by a given
* {@link Rollout} and a rsql filter with detailed status. * {@link Rollout} and a rsql filter with detailed status.
* *
* @param pageable * @param pageable the page request to sort and limit the result
* the page request to sort and limit the result * @param rolloutId the rollout to filter the {@link RolloutGroup}s
* @param rolloutId * @param rsqlParam the specification to filter the result set based on attributes
* the rollout to filter the {@link RolloutGroup}s * of the {@link RolloutGroup}
* @param rsqlParam
* the specification to filter the result set based on attributes
* of the {@link RolloutGroup}
*
* @return a page of found {@link RolloutGroup}s * @return a page of found {@link RolloutGroup}s
* * @throws RSQLParameterUnsupportedFieldException if a field in the RSQL string is used but not provided by the
* @throws RSQLParameterUnsupportedFieldException * given {@code fieldNameProvider}
* if a field in the RSQL string is used but not provided by the * @throws RSQLParameterSyntaxException if the RSQL syntax is wrong
* given {@code fieldNameProvider}
* @throws RSQLParameterSyntaxException
* if the RSQL syntax is wrong
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
Page<RolloutGroup> findByRolloutAndRsqlWithDetailedStatus(@NotNull Pageable pageable, long rolloutId, Page<RolloutGroup> findByRolloutAndRsqlWithDetailedStatus(@NotNull Pageable pageable, long rolloutId,
@@ -133,11 +106,8 @@ public interface RolloutGroupManagement {
* Retrieves a page of {@link RolloutGroup}s filtered by a given * Retrieves a page of {@link RolloutGroup}s filtered by a given
* {@link Rollout}. * {@link Rollout}.
* *
* @param pageable * @param pageable the page request to sort and limit the result
* the page request to sort and limit the result * @param rolloutId the ID of the rollout to filter the {@link RolloutGroup}s
* @param rolloutId
* the ID of the rollout to filter the {@link RolloutGroup}s
*
* @return a page of found {@link RolloutGroup}s * @return a page of found {@link RolloutGroup}s
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
@@ -147,10 +117,8 @@ public interface RolloutGroupManagement {
* Retrieves a page of {@link RolloutGroup}s filtered by a given * Retrieves a page of {@link RolloutGroup}s filtered by a given
* {@link Rollout}. * {@link Rollout}.
* *
* @param rolloutId * @param rolloutId the ID of the rollout to filter the {@link RolloutGroup}s
* the ID of the rollout to filter the {@link RolloutGroup}s * @param pageable the page request to sort and limit the result
* @param pageable
* the page request to sort and limit the result
* @return a page of found {@link RolloutGroup}s * @return a page of found {@link RolloutGroup}s
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
@@ -159,15 +127,10 @@ public interface RolloutGroupManagement {
/** /**
* Get targets of specified rollout group. * Get targets of specified rollout group.
* *
* @param pageable * @param pageable the page request to sort and limit the result
* the page request to sort and limit the result * @param rolloutGroupId rollout group
* @param rolloutGroupId
* rollout group
*
* @return Page<Target> list of targets of a rollout group * @return Page<Target> list of targets of a rollout group
* * @throws EntityNotFoundException if group with ID does not exist
* @throws EntityNotFoundException
* if group with ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ_AND_TARGET_READ) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ_AND_TARGET_READ)
Page<Target> findTargetsOfRolloutGroup(@NotNull Pageable pageable, long rolloutGroupId); Page<Target> findTargetsOfRolloutGroup(@NotNull Pageable pageable, long rolloutGroupId);
@@ -175,20 +138,13 @@ public interface RolloutGroupManagement {
/** /**
* Get targets of specified rollout group. * Get targets of specified rollout group.
* *
* @param pageable * @param pageable the page request to sort and limit the result
* the page request to sort and limit the result * @param rolloutGroupId rollout group
* @param rolloutGroupId * @param rsqlParam the specification for filtering the targets of a rollout group
* rollout group
* @param rsqlParam
* the specification for filtering the targets of a rollout group
*
* @return Page<Target> list of targets of a rollout group * @return Page<Target> list of targets of a rollout group
* * @throws RSQLParameterUnsupportedFieldException if a field in the RSQL string is used but not provided by the
* @throws RSQLParameterUnsupportedFieldException * given {@code fieldNameProvider}
* if a field in the RSQL string is used but not provided by the * @throws RSQLParameterSyntaxException if the RSQL syntax is wrong
* given {@code fieldNameProvider}
* @throws RSQLParameterSyntaxException
* if the RSQL syntax is wrong
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ_AND_TARGET_READ) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ_AND_TARGET_READ)
Page<Target> findTargetsOfRolloutGroupByRsql(@NotNull Pageable pageable, long rolloutGroupId, Page<Target> findTargetsOfRolloutGroupByRsql(@NotNull Pageable pageable, long rolloutGroupId,
@@ -197,10 +153,8 @@ public interface RolloutGroupManagement {
/** /**
* Get {@link RolloutGroup} by Id. * Get {@link RolloutGroup} by Id.
* *
* @param rolloutGroupId * @param rolloutGroupId rollout group id
* rollout group id
* @return rolloutGroup with details of targets count for different statuses * @return rolloutGroup with details of targets count for different statuses
*
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
Optional<RolloutGroup> getWithDetailedStatus(long rolloutGroupId); Optional<RolloutGroup> getWithDetailedStatus(long rolloutGroupId);
@@ -208,12 +162,9 @@ public interface RolloutGroupManagement {
/** /**
* Count targets of rollout group. * Count targets of rollout group.
* *
* @param rolloutGroupId * @param rolloutGroupId the rollout group id for the count
* the rollout group id for the count
* @return the target rollout group count * @return the target rollout group count
* * @throws EntityNotFoundException if rollout group with given ID does not exist
* @throws EntityNotFoundException
* if rollout group with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
long countTargetsOfRolloutsGroup(long rolloutGroupId); long countTargetsOfRolloutsGroup(long rolloutGroupId);

View File

@@ -46,7 +46,6 @@ public interface RolloutHandler {
* case rollout was already {@link Rollout.RolloutStatus#RUNNING} which results * case rollout was already {@link Rollout.RolloutStatus#RUNNING} which results
* in status change {@link Rollout.RolloutStatus#DELETED} or hard delete from * in status change {@link Rollout.RolloutStatus#DELETED} or hard delete from
* the persistence otherwise. * the persistence otherwise.
*
*/ */
@PreAuthorize(SpringEvalExpressions.IS_SYSTEM_CODE) @PreAuthorize(SpringEvalExpressions.IS_SYSTEM_CODE)
void handleAll(); void handleAll();

View File

@@ -59,8 +59,7 @@ public interface RolloutManagement {
/** /**
* Count rollouts by given text in name or description. * Count rollouts by given text in name or description.
* *
* @param searchText * @param searchText name or description
* name or description
* @return total count rollouts for specified filter text. * @return total count rollouts for specified filter text.
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
@@ -72,8 +71,7 @@ public interface RolloutManagement {
* <p/> * <p/>
* No access control applied * No access control applied
* *
* @param setId * @param setId the distribution set
* the distribution set
* @return the count * @return the count
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
@@ -94,25 +92,17 @@ public interface RolloutManagement {
* targets have been assigned to the groups, the rollout status is changed to * targets have been assigned to the groups, the rollout status is changed to
* {@link RolloutStatus#READY} so it can be started with . * {@link RolloutStatus#READY} so it can be started with .
* *
* @param create * @param create the rollout entity to create
* the rollout entity to create * @param amountGroup the amount of groups to split the rollout into
* @param amountGroup * @param confirmationRequired if a confirmation is required by the device group(s) of the rollout
* the amount of groups to split the rollout into * @param conditions the rolloutgroup conditions and actions which should be applied
* @param confirmationRequired * for each {@link RolloutGroup}
* if a confirmation is required by the device group(s) of the rollout
* @param conditions
* the rolloutgroup conditions and actions which should be applied
* for each {@link RolloutGroup}
* @param dynamicRolloutGroupTemplate the template for dynamic rollout groups * @param dynamicRolloutGroupTemplate the template for dynamic rollout groups
* @return the persisted rollout. * @return the persisted rollout.
* * @throws EntityNotFoundException if given {@link DistributionSet} does not exist
* @throws EntityNotFoundException * @throws ConstraintViolationException if rollout or group parameters are invalid.
* if given {@link DistributionSet} does not exist * @throws AssignmentQuotaExceededException if the maximum number of allowed targets per rollout group is
* @throws ConstraintViolationException * exceeded.
* if rollout or group parameters are invalid.
* @throws AssignmentQuotaExceededException
* if the maximum number of allowed targets per rollout group is
* exceeded.
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_CREATE) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_CREATE)
Rollout create(@NotNull @Valid RolloutCreate create, int amountGroup, boolean confirmationRequired, Rollout create(@NotNull @Valid RolloutCreate create, int amountGroup, boolean confirmationRequired,
@@ -133,24 +123,16 @@ public interface RolloutManagement {
* targets have been assigned to the groups, the rollout status is changed to * targets have been assigned to the groups, the rollout status is changed to
* {@link RolloutStatus#READY} so it can be started with . * {@link RolloutStatus#READY} so it can be started with .
* *
* @param create * @param create the rollout entity to create
* the rollout entity to create * @param amountGroup the amount of groups to split the rollout into
* @param amountGroup * @param confirmationRequired if a confirmation is required by the device group(s) of the rollout
* the amount of groups to split the rollout into * @param conditions the rolloutgroup conditions and actions which should be applied
* @param confirmationRequired * for each {@link RolloutGroup}
* if a confirmation is required by the device group(s) of the rollout
* @param conditions
* the rolloutgroup conditions and actions which should be applied
* for each {@link RolloutGroup}
* @return the persisted rollout. * @return the persisted rollout.
* * @throws EntityNotFoundException if given {@link DistributionSet} does not exist
* @throws EntityNotFoundException * @throws ConstraintViolationException if rollout or group parameters are invalid.
* if given {@link DistributionSet} does not exist * @throws AssignmentQuotaExceededException if the maximum number of allowed targets per rollout group is
* @throws ConstraintViolationException * exceeded.
* if rollout or group parameters are invalid.
* @throws AssignmentQuotaExceededException
* if the maximum number of allowed targets per rollout group is
* exceeded.
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_CREATE) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_CREATE)
Rollout create(@NotNull @Valid RolloutCreate create, int amountGroup, boolean confirmationRequired, Rollout create(@NotNull @Valid RolloutCreate create, int amountGroup, boolean confirmationRequired,
@@ -172,23 +154,16 @@ public interface RolloutManagement {
* {@link RolloutStatus#READY} so it can be started with * {@link RolloutStatus#READY} so it can be started with
* {@link #start(long)}. * {@link #start(long)}.
* *
* @param rollout * @param rollout the rollout entity to create
* the rollout entity to create * @param groups optional definition of groups
* @param groups * @param conditions the rollout group conditions and actions which should be applied
* optional definition of groups * for each {@link RolloutGroup} if not defined by the RolloutGroup
* @param conditions * itself
* the rollout group conditions and actions which should be applied
* for each {@link RolloutGroup} if not defined by the RolloutGroup
* itself
* @return the persisted rollout. * @return the persisted rollout.
* * @throws EntityNotFoundException if given {@link DistributionSet} does not exist
* @throws EntityNotFoundException * @throws ConstraintViolationException if rollout or group parameters are invalid
* if given {@link DistributionSet} does not exist * @throws AssignmentQuotaExceededException if the maximum number of allowed targets per rollout group is
* @throws ConstraintViolationException * exceeded.
* if rollout or group parameters are invalid
* @throws AssignmentQuotaExceededException
* if the maximum number of allowed targets per rollout group is
* exceeded.
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_CREATE) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_CREATE)
Rollout create(@Valid @NotNull RolloutCreate rollout, @NotNull @Valid List<RolloutGroupCreate> groups, Rollout create(@Valid @NotNull RolloutCreate rollout, @NotNull @Valid List<RolloutGroupCreate> groups,
@@ -198,20 +173,14 @@ public interface RolloutManagement {
* Calculates how many targets are addressed by each rollout group and * Calculates how many targets are addressed by each rollout group and
* returns the validation information. * returns the validation information.
* *
* @param groups * @param groups a list of rollout groups
* a list of rollout groups * @param targetFilter the rollout
* @param targetFilter * @param createdAt timestamp when the rollout was created
* the rollout * @param dsTypeId ID of the type of distribution set of the rollout
* @param createdAt
* timestamp when the rollout was created
* @param dsTypeId
* ID of the type of distribution set of the rollout
* @return the validation information * @return the validation information
* @throws RolloutIllegalStateException * @throws RolloutIllegalStateException thrown when no targets are targeted by the rollout
* thrown when no targets are targeted by the rollout * @throws ConstraintViolationException if fields are not filled as specified. Check
* @throws ConstraintViolationException * {@link RolloutGroupCreate} for field constraints.
* if fields are not filled as specified. Check
* {@link RolloutGroupCreate} for field constraints.
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ_AND_TARGET_READ) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ_AND_TARGET_READ)
ListenableFuture<RolloutGroupsValidation> validateTargetsInGroups(@Valid List<RolloutGroupCreate> groups, ListenableFuture<RolloutGroupsValidation> validateTargetsInGroups(@Valid List<RolloutGroupCreate> groups,
@@ -220,10 +189,8 @@ public interface RolloutManagement {
/** /**
* Retrieves all rollouts. * Retrieves all rollouts.
* *
* @param pageable * @param pageable the page request to sort and limit the result
* the page request to sort and limit the result * @param deleted flag if deleted rollouts should be included
* @param deleted
* flag if deleted rollouts should be included
* @return a page of found rollouts * @return a page of found rollouts
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
@@ -232,10 +199,8 @@ public interface RolloutManagement {
/** /**
* Get count of targets in different status in rollout. * Get count of targets in different status in rollout.
* *
* @param pageable * @param pageable the page request to sort and limit the result
* the page request to sort and limit the result * @param deleted flag if deleted rollouts should be included
* @param deleted
* flag if deleted rollouts should be included
* @return a list of rollouts with details of targets count for different * @return a list of rollouts with details of targets count for different
* statuses * statuses
*/ */
@@ -245,20 +210,13 @@ public interface RolloutManagement {
/** /**
* Retrieves all rollouts found by the given specification. * Retrieves all rollouts found by the given specification.
* *
* @param pageable * @param pageable the page request to sort and limit the result
* the page request to sort and limit the result * @param rsqlParam the specification to filter rollouts
* @param rsqlParam * @param deleted flag if deleted rollouts should be included
* the specification to filter rollouts
* @param deleted
* flag if deleted rollouts should be included
*
* @return a page of found rollouts * @return a page of found rollouts
* * @throws RSQLParameterUnsupportedFieldException if a field in the RSQL string is used but not provided by the
* @throws RSQLParameterUnsupportedFieldException * given {@code fieldNameProvider}
* if a field in the RSQL string is used but not provided by the * @throws RSQLParameterSyntaxException if the RSQL syntax is wrong
* given {@code fieldNameProvider}
* @throws RSQLParameterSyntaxException
* if the RSQL syntax is wrong
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
Page<Rollout> findByRsql(@NotNull Pageable pageable, @NotNull String rsqlParam, boolean deleted); Page<Rollout> findByRsql(@NotNull Pageable pageable, @NotNull String rsqlParam, boolean deleted);
@@ -266,12 +224,9 @@ public interface RolloutManagement {
/** /**
* Finds rollouts by given text in name or description. * Finds rollouts by given text in name or description.
* *
* @param pageable * @param pageable the page request to sort and limit the result
* the page request to sort and limit the result * @param searchText search text which matches name or description of rollout
* @param searchText * @param deleted flag if deleted rollouts should be included
* search text which matches name or description of rollout
* @param deleted
* flag if deleted rollouts should be included
* @return the founded rollout or {@code null} if rollout with given ID does * @return the founded rollout or {@code null} if rollout with given ID does
* not exists * not exists
*/ */
@@ -290,8 +245,7 @@ public interface RolloutManagement {
/** /**
* Retrieves a specific rollout by its ID. * Retrieves a specific rollout by its ID.
* *
* @param rolloutId * @param rolloutId the ID of the rollout to retrieve
* the ID of the rollout to retrieve
* @return the founded rollout or {@code null} if rollout with given ID does * @return the founded rollout or {@code null} if rollout with given ID does
* not exists * not exists
*/ */
@@ -301,8 +255,7 @@ public interface RolloutManagement {
/** /**
* Retrieves a specific rollout by its name. * Retrieves a specific rollout by its name.
* *
* @param rolloutName * @param rolloutName the name of the rollout to retrieve
* the name of the rollout to retrieve
* @return the founded rollout or {@code null} if rollout with given name * @return the founded rollout or {@code null} if rollout with given name
* does not exists * does not exists
*/ */
@@ -312,11 +265,8 @@ public interface RolloutManagement {
/** /**
* Get count of targets in different status in rollout. * Get count of targets in different status in rollout.
* *
* @param rolloutId * @param rolloutId rollout id
* rollout id
* @return rollout details of targets count for different statuses * @return rollout details of targets count for different statuses
*
*
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
Optional<Rollout> getWithDetailedStatus(long rolloutId); Optional<Rollout> getWithDetailedStatus(long rolloutId);
@@ -324,9 +274,7 @@ public interface RolloutManagement {
/** /**
* Checks if rollout with given ID exists. * Checks if rollout with given ID exists.
* *
* @param rolloutId * @param rolloutId rollout id
* rollout id
*
* @return <code>true</code> if rollout exists * @return <code>true</code> if rollout exists
*/ */
boolean exists(long rolloutId); boolean exists(long rolloutId);
@@ -343,15 +291,10 @@ public interface RolloutManagement {
* sufficient due the {@link #checkRunningRollouts(long)} will not check * sufficient due the {@link #checkRunningRollouts(long)} will not check
* this rollout anymore. * this rollout anymore.
* *
* @param rolloutId * @param rolloutId the rollout to be paused.
* the rollout to be paused. * @throws EntityNotFoundException if rollout or group with given ID does not exist
* * @throws RolloutIllegalStateException if given rollout is not in {@link RolloutStatus#RUNNING}.
* @throws EntityNotFoundException * Only running rollouts can be paused.
* if rollout or group with given ID does not exist
* @throws RolloutIllegalStateException
* if given rollout is not in {@link RolloutStatus#RUNNING}.
* Only running rollouts can be paused.
*
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_HANDLE) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_HANDLE)
void pauseRollout(long rolloutId); void pauseRollout(long rolloutId);
@@ -361,14 +304,10 @@ public interface RolloutManagement {
* {@link RolloutStatus#RUNNING} state which is then picked up again by the * {@link RolloutStatus#RUNNING} state which is then picked up again by the
* {@link #checkRunningRollouts(long)}. * {@link #checkRunningRollouts(long)}.
* *
* @param rolloutId * @param rolloutId the rollout to be resumed
* the rollout to be resumed * @throws EntityNotFoundException if rollout with given ID does not exist
* * @throws RolloutIllegalStateException if given rollout is not in {@link RolloutStatus#PAUSED}. Only
* @throws EntityNotFoundException * paused rollouts can be resumed.
* if rollout with given ID does not exist
* @throws RolloutIllegalStateException
* if given rollout is not in {@link RolloutStatus#PAUSED}. Only
* paused rollouts can be resumed.
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_HANDLE) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_HANDLE)
void resumeRollout(long rolloutId); void resumeRollout(long rolloutId);
@@ -379,19 +318,13 @@ public interface RolloutManagement {
* it switches state to {@link RolloutStatus#READY}, otherwise it switches * it switches state to {@link RolloutStatus#READY}, otherwise it switches
* to state {@link RolloutStatus#APPROVAL_DENIED} * to state {@link RolloutStatus#APPROVAL_DENIED}
* *
* @param rolloutId * @param rolloutId the rollout to be approved or denied.
* the rollout to be approved or denied. * @param decision decision whether a rollout is approved or denied.
* @param decision
* decision whether a rollout is approved or denied.
*
* @return approved or denied rollout * @return approved or denied rollout
* * @throws EntityNotFoundException if rollout with given ID does not exist
* @throws EntityNotFoundException * @throws RolloutIllegalStateException if given rollout is not in
* if rollout with given ID does not exist * {@link RolloutStatus#WAITING_FOR_APPROVAL}. Only rollouts
* @throws RolloutIllegalStateException * waiting for approval can be acted upon.
* if given rollout is not in
* {@link RolloutStatus#WAITING_FOR_APPROVAL}. Only rollouts
* waiting for approval can be acted upon.
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_APPROVE) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_APPROVE)
Rollout approveOrDeny(long rolloutId, Rollout.ApprovalDecision decision); Rollout approveOrDeny(long rolloutId, Rollout.ApprovalDecision decision);
@@ -402,21 +335,14 @@ public interface RolloutManagement {
* it switches state to {@link RolloutStatus#READY}, otherwise it switches * it switches state to {@link RolloutStatus#READY}, otherwise it switches
* to state {@link RolloutStatus#APPROVAL_DENIED} * to state {@link RolloutStatus#APPROVAL_DENIED}
* *
* @param rolloutId * @param rolloutId the rollout to be approved or denied.
* the rollout to be approved or denied. * @param decision decision whether a rollout is approved or denied.
* @param decision * @param remark user remark on approve / deny decision
* decision whether a rollout is approved or denied.
* @param remark
* user remark on approve / deny decision
*
* @return approved or denied rollout * @return approved or denied rollout
* * @throws EntityNotFoundException if rollout with given ID does not exist
* @throws EntityNotFoundException * @throws RolloutIllegalStateException if given rollout is not in
* if rollout with given ID does not exist * {@link RolloutStatus#WAITING_FOR_APPROVAL}. Only rollouts
* @throws RolloutIllegalStateException * waiting for approveOrDeny can be acted upon.
* if given rollout is not in
* {@link RolloutStatus#WAITING_FOR_APPROVAL}. Only rollouts
* waiting for approveOrDeny can be acted upon.
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_APPROVE) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_APPROVE)
Rollout approveOrDeny(long rolloutId, Rollout.ApprovalDecision decision, String remark); Rollout approveOrDeny(long rolloutId, Rollout.ApprovalDecision decision, String remark);
@@ -428,16 +354,11 @@ public interface RolloutManagement {
* all actions are created and the first group is started. The rollout * all actions are created and the first group is started. The rollout
* itself will be then also in {@link RolloutStatus#RUNNING}. * itself will be then also in {@link RolloutStatus#RUNNING}.
* *
* @param rolloutId * @param rolloutId the rollout to be started
* the rollout to be started
*
* @return started rollout * @return started rollout
* * @throws EntityNotFoundException if rollout with given ID does not exist
* @throws EntityNotFoundException * @throws RolloutIllegalStateException if given rollout is not in {@link RolloutStatus#READY}. Only
* if rollout with given ID does not exist * ready rollouts can be started.
* @throws RolloutIllegalStateException
* if given rollout is not in {@link RolloutStatus#READY}. Only
* ready rollouts can be started.
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_HANDLE) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_HANDLE)
Rollout start(long rolloutId); Rollout start(long rolloutId);
@@ -445,17 +366,11 @@ public interface RolloutManagement {
/** /**
* Update rollout details. * Update rollout details.
* *
* @param update * @param update rollout to be updated
* rollout to be updated
*
* @return Rollout updated rollout * @return Rollout updated rollout
* * @throws EntityNotFoundException if rollout or DS with given IDs do not exist
* @throws EntityNotFoundException * @throws EntityReadOnlyException if rollout is in soft deleted state, i.e. only kept as
* if rollout or DS with given IDs do not exist * reference
* @throws EntityReadOnlyException
* if rollout is in soft deleted state, i.e. only kept as
* reference
*
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_UPDATE) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_UPDATE)
Rollout update(@NotNull @Valid RolloutUpdate update); Rollout update(@NotNull @Valid RolloutUpdate update);
@@ -464,9 +379,7 @@ public interface RolloutManagement {
* Deletes a rollout. A rollout might be deleted asynchronously by * Deletes a rollout. A rollout might be deleted asynchronously by
* indicating the rollout by {@link RolloutStatus#DELETING} * indicating the rollout by {@link RolloutStatus#DELETING}
* *
* * @param rolloutId the ID of the rollout to be deleted
* @param rolloutId
* the ID of the rollout to be deleted
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_DELETE) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_DELETE)
void delete(long rolloutId); void delete(long rolloutId);
@@ -476,9 +389,8 @@ public interface RolloutManagement {
* This is called when a distribution set is invalidated and the cancel * This is called when a distribution set is invalidated and the cancel
* rollouts option is activated. * rollouts option is activated.
* *
* @param set * @param set the {@link DistributionSet} for that the rollouts should be
* the {@link DistributionSet} for that the rollouts should be * canceled
* canceled
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_UPDATE) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_UPDATE)
void cancelRolloutsForDistributionSet(DistributionSet set); void cancelRolloutsForDistributionSet(DistributionSet set);
@@ -487,14 +399,9 @@ public interface RolloutManagement {
* Triggers next group of a rollout for processing even success threshold * Triggers next group of a rollout for processing even success threshold
* isn't met yet. Current running groups will not change their status. * isn't met yet. Current running groups will not change their status.
* *
* @param rolloutId * @param rolloutId the rollout to be paused.
* the rollout to be paused. * @throws EntityNotFoundException if rollout or group with given ID does not exist
* * @throws RolloutIllegalStateException if given rollout is not in {@link RolloutStatus#RUNNING}.
* @throws EntityNotFoundException
* if rollout or group with given ID does not exist
* @throws RolloutIllegalStateException
* if given rollout is not in {@link RolloutStatus#RUNNING}.
*
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_UPDATE) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_UPDATE)
void triggerNextGroup(long rolloutId); void triggerNextGroup(long rolloutId);
@@ -502,9 +409,7 @@ public interface RolloutManagement {
/** /**
* Enrich the rollouts Slice with additional details * Enrich the rollouts Slice with additional details
* *
* @param rollouts * @param rollouts the rollouts to be enriched.
* the rollouts to be enriched.
*
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_UPDATE) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_UPDATE)
void setRolloutStatusDetails(final Slice<Rollout> rollouts); void setRolloutStatusDetails(final Slice<Rollout> rollouts);

View File

@@ -25,8 +25,7 @@ public final class SizeConversionHelper {
/** /**
* Convert byte values to human readable strings with units * Convert byte values to human readable strings with units
* *
* @param byteValue * @param byteValue Value to convert in bytes
* Value to convert in bytes
*/ */
public static String byteValueToReadableString(final long byteValue) { public static String byteValueToReadableString(final long byteValue) {
double outputValue = byteValue / 1024.0; double outputValue = byteValue / 1024.0;

View File

@@ -27,7 +27,6 @@ import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException; import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.exception.RSQLParameterSyntaxException; import org.eclipse.hawkbit.repository.exception.RSQLParameterSyntaxException;
import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException; import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException;
import org.eclipse.hawkbit.repository.model.AssignedSoftwareModule;
import org.eclipse.hawkbit.repository.model.DistributionSet; import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.SoftwareModule; import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata; import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
@@ -39,7 +38,6 @@ import org.springframework.security.access.prepost.PreAuthorize;
/** /**
* Service for managing {@link SoftwareModule}s. * Service for managing {@link SoftwareModule}s.
*
*/ */
public interface SoftwareModuleManagement public interface SoftwareModuleManagement
extends RepositoryManagement<SoftwareModule, SoftwareModuleCreate, SoftwareModuleUpdate> { extends RepositoryManagement<SoftwareModule, SoftwareModuleCreate, SoftwareModuleUpdate> {
@@ -47,21 +45,13 @@ public interface SoftwareModuleManagement
/** /**
* Creates a list of software module meta data entries. * Creates a list of software module meta data entries.
* *
* @param metadata * @param metadata the meta data entries to create
* the meta data entries to create
*
* @return the updated or created software module meta data entries * @return the updated or created software module meta data entries
* * @throws EntityAlreadyExistsException in case one of the meta data entry already exists for the
* @throws EntityAlreadyExistsException * specific key
* in case one of the meta data entry already exists for the * @throws EntityNotFoundException if software module with given ID does not exist
* specific key * @throws AssignmentQuotaExceededException if the maximum number of {@link SoftwareModuleMetadata}
* * entries is exceeded for the addressed {@link SoftwareModule}
* @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_AUTH_UPDATE_REPOSITORY)
List<SoftwareModuleMetadata> createMetaData(@NotNull @Valid Collection<SoftwareModuleMetadataCreate> metadata); List<SoftwareModuleMetadata> createMetaData(@NotNull @Valid Collection<SoftwareModuleMetadataCreate> metadata);
@@ -69,21 +59,13 @@ public interface SoftwareModuleManagement
/** /**
* Creates or updates a single software module meta data entry. * Creates or updates a single software module meta data entry.
* *
* @param metadata * @param metadata the meta data entry to create
* the meta data entry to create
*
* @return the updated or created software module meta data entry * @return the updated or created software module meta data entry
* * @throws EntityAlreadyExistsException in case the meta data entry already exists for the specific
* @throws EntityAlreadyExistsException * key
* in case the meta data entry already exists for the specific * @throws EntityNotFoundException if software module with given ID does not exist
* key * @throws AssignmentQuotaExceededException if the maximum number of {@link SoftwareModuleMetadata}
* * entries is exceeded for the addressed {@link SoftwareModule}
* @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_AUTH_UPDATE_REPOSITORY)
SoftwareModuleMetadata createMetaData(@NotNull @Valid SoftwareModuleMetadataCreate metadata); SoftwareModuleMetadata createMetaData(@NotNull @Valid SoftwareModuleMetadataCreate metadata);
@@ -91,13 +73,9 @@ public interface SoftwareModuleManagement
/** /**
* Deletes a software module meta data entry. * Deletes a software module meta data entry.
* *
* @param id * @param id where meta data has to be deleted
* where meta data has to be deleted * @param key of the metda data element
* @param key * @throws EntityNotFoundException of module or metadata entry does not exist
* of the metda data element
*
* @throws EntityNotFoundException
* of module or metadata entry does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
void deleteMetaData(long id, @NotEmpty String key); void deleteMetaData(long id, @NotEmpty String key);
@@ -105,16 +83,11 @@ public interface SoftwareModuleManagement
/** /**
* Returns all modules assigned to given {@link DistributionSet}. * Returns all modules assigned to given {@link DistributionSet}.
* *
* @param pageable * @param pageable the page request to page the result set
* the page request to page the result set * @param distributionSetId to search for
* @param distributionSetId
* to search for
*
* @return all {@link SoftwareModule}s that are assigned to given * @return all {@link SoftwareModule}s that are assigned to given
* {@link DistributionSet}. * {@link DistributionSet}.
* * @throws EntityNotFoundException if distribution set with given ID does not exist
* @throws EntityNotFoundException
* if distribution set with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Page<SoftwareModule> findByAssignedTo(@NotNull Pageable pageable, long distributionSetId); Page<SoftwareModule> findByAssignedTo(@NotNull Pageable pageable, long distributionSetId);
@@ -122,14 +95,10 @@ public interface SoftwareModuleManagement
/** /**
* Returns count of all modules assigned to given {@link DistributionSet}. * Returns count of all modules assigned to given {@link DistributionSet}.
* *
* @param distributionSetId * @param distributionSetId to search for
* to search for
*
* @return count of {@link SoftwareModule}s that are assigned to given * @return count of {@link SoftwareModule}s that are assigned to given
* {@link DistributionSet}. * {@link DistributionSet}.
* * @throws EntityNotFoundException if distribution set with given ID does not exist
* @throws EntityNotFoundException
* if distribution set with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
long countByAssignedTo(long distributionSetId); long countByAssignedTo(long distributionSetId);
@@ -139,17 +108,11 @@ public interface SoftwareModuleManagement
* {@link SoftwareModule#getName()} or {@link SoftwareModule#getVersion()} * {@link SoftwareModule#getName()} or {@link SoftwareModule#getVersion()}
* and {@link SoftwareModule#getType()} that are not marked as deleted. * and {@link SoftwareModule#getType()} that are not marked as deleted.
* *
* @param pageable * @param pageable page parameter
* page parameter * @param searchText to be filtered as "like" on {@link SoftwareModule#getName()}
* @param searchText * @param typeId to be filtered as "like" on {@link SoftwareModule#getType()}
* to be filtered as "like" on {@link SoftwareModule#getName()}
* @param typeId
* to be filtered as "like" on {@link SoftwareModule#getType()}
*
* @return the page of found {@link SoftwareModule} * @return the page of found {@link SoftwareModule}
* * @throws EntityNotFoundException if given software module type does not exist
* @throws EntityNotFoundException
* if given software module type does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Slice<SoftwareModule> findByTextAndType(@NotNull Pageable pageable, String searchText, Long typeId); Slice<SoftwareModule> findByTextAndType(@NotNull Pageable pageable, String searchText, Long typeId);
@@ -157,17 +120,11 @@ public interface SoftwareModuleManagement
/** /**
* Retrieves {@link SoftwareModule} by their name AND version AND type.. * Retrieves {@link SoftwareModule} by their name AND version AND type..
* *
* @param name * @param name of the {@link SoftwareModule}
* of the {@link SoftwareModule} * @param version of the {@link SoftwareModule}
* @param version * @param typeId of the {@link SoftwareModule}
* of the {@link SoftwareModule}
* @param typeId
* of the {@link SoftwareModule}
*
* @return the found {@link SoftwareModule} * @return the found {@link SoftwareModule}
* * @throws EntityNotFoundException if software module type with given ID does not exist
* @throws EntityNotFoundException
* if software module type with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Optional<SoftwareModule> getByNameAndVersionAndType(@NotEmpty String name, @NotEmpty String version, long typeId); Optional<SoftwareModule> getByNameAndVersionAndType(@NotEmpty String name, @NotEmpty String version, long typeId);
@@ -175,14 +132,10 @@ public interface SoftwareModuleManagement
/** /**
* Finds a single software module meta data by its id. * Finds a single software module meta data by its id.
* *
* @param id * @param id where meta data has to be found
* where meta data has to be found * @param key of the meta data element
* @param key
* of the meta data element
* @return the found SoftwareModuleMetadata or {@code null} if not exits * @return the found SoftwareModuleMetadata or {@code null} if not exits
* * @throws EntityNotFoundException is module with given ID does not exist
* @throws EntityNotFoundException
* is module with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Optional<SoftwareModuleMetadata> getMetaDataBySoftwareModuleId(long id, @NotEmpty String key); Optional<SoftwareModuleMetadata> getMetaDataBySoftwareModuleId(long id, @NotEmpty String key);
@@ -190,16 +143,11 @@ public interface SoftwareModuleManagement
/** /**
* Finds all meta data by the given software module id. * Finds all meta data by the given software module id.
* *
* @param pageable * @param pageable the page request to page the result
* the page request to page the result * @param id the software module id to retrieve the meta data from
* @param id
* the software module id to retrieve the meta data from
*
* @return a paged result of all meta data entries for a given software * @return a paged result of all meta data entries for a given software
* module id * module id
* * @throws EntityNotFoundException if software module with given ID does not exist
* @throws EntityNotFoundException
* if software module with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Page<SoftwareModuleMetadata> findMetaDataBySoftwareModuleId(@NotNull Pageable pageable, long id); Page<SoftwareModuleMetadata> findMetaDataBySoftwareModuleId(@NotNull Pageable pageable, long id);
@@ -207,13 +155,9 @@ public interface SoftwareModuleManagement
/** /**
* Counts all meta data by the given software module id. * Counts all meta data by the given software module id.
* *
* @param id * @param id the software module id to retrieve the meta data count from
* the software module id to retrieve the meta data count from
*
* @return count of all meta data entries for a given software module id * @return count of all meta data entries for a given software module id
* * @throws EntityNotFoundException if software module with given ID does not exist
* @throws EntityNotFoundException
* if software module with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
long countMetaDataBySoftwareModuleId(long id); long countMetaDataBySoftwareModuleId(long id);
@@ -222,16 +166,11 @@ public interface SoftwareModuleManagement
* Finds all meta data by the given software module id where * Finds all meta data by the given software module id where
* {@link SoftwareModuleMetadata#isTargetVisible()}. * {@link SoftwareModuleMetadata#isTargetVisible()}.
* *
* @param pageable * @param pageable the page request to page the result
* the page request to page the result * @param id the software module id to retrieve the meta data from
* @param id
* the software module id to retrieve the meta data from
*
* @return a paged result of all meta data entries for a given software * @return a paged result of all meta data entries for a given software
* module id * module id
* * @throws EntityNotFoundException if software module with given ID does not exist
* @throws EntityNotFoundException
* if software module with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Page<SoftwareModuleMetadata> findMetaDataBySoftwareModuleIdAndTargetVisible(@NotNull Pageable pageable, Page<SoftwareModuleMetadata> findMetaDataBySoftwareModuleIdAndTargetVisible(@NotNull Pageable pageable,
@@ -240,25 +179,15 @@ public interface SoftwareModuleManagement
/** /**
* Finds all meta data by the given software module id. * Finds all meta data by the given software module id.
* *
* @param pageable * @param pageable the page request to page the result
* the page request to page the result * @param id the software module id to retrieve the meta data from
* @param id * @param rsqlParam filter definition in RSQL syntax
* the software module id to retrieve the meta data from
* @param rsqlParam
* filter definition in RSQL syntax
*
* @return a paged result of all meta data entries for a given software * @return a paged result of all meta data entries for a given software
* module id * module id
* * @throws RSQLParameterUnsupportedFieldException if a field in the RSQL string is used but not provided by the
* @throws RSQLParameterUnsupportedFieldException * given {@code fieldNameProvider}
* if a field in the RSQL string is used but not provided by the * @throws RSQLParameterSyntaxException if the RSQL syntax is wrong
* given {@code fieldNameProvider} * @throws EntityNotFoundException if software module with given ID does not exist
*
* @throws RSQLParameterSyntaxException
* if the RSQL syntax is wrong
*
* @throws EntityNotFoundException
* if software module with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Page<SoftwareModuleMetadata> findMetaDataByRsql(@NotNull Pageable pageable, long id, Page<SoftwareModuleMetadata> findMetaDataByRsql(@NotNull Pageable pageable, long id,
@@ -268,11 +197,8 @@ public interface SoftwareModuleManagement
* Retrieves the {@link SoftwareModule}s by their {@link SoftwareModuleType} * Retrieves the {@link SoftwareModule}s by their {@link SoftwareModuleType}
* . * .
* *
* @param pageable * @param pageable page parameters
* page parameters * @param typeId to be filtered on
* @param typeId
* to be filtered on
*
* @return the found {@link SoftwareModule}s * @return the found {@link SoftwareModule}s
* @throws EntityNotFoundException if software module type with given ID does not exist * @throws EntityNotFoundException if software module type with given ID does not exist
*/ */
@@ -302,14 +228,10 @@ public interface SoftwareModuleManagement
/** /**
* Updates a distribution set meta data value if corresponding entry exists. * Updates a distribution set meta data value if corresponding entry exists.
* *
* @param update * @param update the meta data entry to be updated
* the meta data entry to be updated
*
* @return the updated meta data entry * @return the updated meta data entry
* * @throws EntityNotFoundException in case the meta data entry does not exists and cannot be
* @throws EntityNotFoundException * updated
* in case the meta data entry does not exists and cannot be
* updated
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
SoftwareModuleMetadata updateMetaData(@NotNull @Valid SoftwareModuleMetadataUpdate update); SoftwareModuleMetadata updateMetaData(@NotNull @Valid SoftwareModuleMetadataUpdate update);

View File

@@ -21,15 +21,12 @@ import org.springframework.security.access.prepost.PreAuthorize;
/** /**
* Service for managing {@link SoftwareModuleType}s. * Service for managing {@link SoftwareModuleType}s.
*
*/ */
public interface SoftwareModuleTypeManagement public interface SoftwareModuleTypeManagement
extends RepositoryManagement<SoftwareModuleType, SoftwareModuleTypeCreate, SoftwareModuleTypeUpdate> { extends RepositoryManagement<SoftwareModuleType, SoftwareModuleTypeCreate, SoftwareModuleTypeUpdate> {
/** /**
* * @param key to search for
* @param key
* to search for
* @return {@link SoftwareModuleType} in the repository with given * @return {@link SoftwareModuleType} in the repository with given
* {@link SoftwareModuleType#getKey()} * {@link SoftwareModuleType#getKey()}
*/ */
@@ -37,9 +34,7 @@ public interface SoftwareModuleTypeManagement
Optional<SoftwareModuleType> getByKey(@NotEmpty String key); Optional<SoftwareModuleType> getByKey(@NotEmpty String key);
/** /**
* * @param name to search for
* @param name
* to search for
* @return all {@link SoftwareModuleType}s in the repository with given * @return all {@link SoftwareModuleType}s in the repository with given
* {@link SoftwareModuleType#getName()} * {@link SoftwareModuleType#getName()}
*/ */

View File

@@ -26,7 +26,6 @@ import org.springframework.security.access.prepost.PreAuthorize;
/** /**
* Central system management operations of the update server. * Central system management operations of the update server.
*
*/ */
public interface SystemManagement { public interface SystemManagement {
@@ -40,16 +39,13 @@ public interface SystemManagement {
/** /**
* Deletes all data related to a given tenant. * Deletes all data related to a given tenant.
* *
* @param tenant * @param tenant to delete
* to delete
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_SYSTEM_ADMIN) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_SYSTEM_ADMIN)
void deleteTenant(@NotNull String tenant); void deleteTenant(@NotNull String tenant);
/** /**
* * @param pageable for paging information
* @param pageable
* for paging information
* @return list of all tenant names in the system. * @return list of all tenant names in the system.
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_SYSTEM_ADMIN) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_SYSTEM_ADMIN)
@@ -61,8 +57,7 @@ public interface SystemManagement {
* sliently (i.e. exceptions will be logged but operations will continue for * sliently (i.e. exceptions will be logged but operations will continue for
* further tenants). * further tenants).
* *
* @param consumer * @param consumer to run as teanant
* to run as teanant
*/ */
@PreAuthorize(SpringEvalExpressions.IS_SYSTEM_CODE) @PreAuthorize(SpringEvalExpressions.IS_SYSTEM_CODE)
void forEachTenant(Consumer<String> consumer); void forEachTenant(Consumer<String> consumer);
@@ -103,8 +98,7 @@ public interface SystemManagement {
* is not yet in the session). Please user {@link #getTenantMetadata()} for * is not yet in the session). Please user {@link #getTenantMetadata()} for
* regular requests. * regular requests.
* *
* @param tenant * @param tenant to retrieve data for
* to retrieve data for
* @return {@link TenantMetaData} of given tenant * @return {@link TenantMetaData} of given tenant
*/ */
@PreAuthorize(SpringEvalExpressions.IS_SYSTEM_CODE) @PreAuthorize(SpringEvalExpressions.IS_SYSTEM_CODE)
@@ -113,8 +107,7 @@ public interface SystemManagement {
/** /**
* Update call for {@link TenantMetaData} of the current tenant. * Update call for {@link TenantMetaData} of the current tenant.
* *
* @param defaultDsType * @param defaultDsType to update
* to update
* @return updated {@link TenantMetaData} entity * @return updated {@link TenantMetaData} entity
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION)
@@ -123,8 +116,7 @@ public interface SystemManagement {
/** /**
* Returns {@link TenantMetaData} of given tenant ID. * Returns {@link TenantMetaData} of given tenant ID.
* *
* @param tenantId * @param tenantId to retrieve data for
* to retrieve data for
* @return {@link TenantMetaData} of given tenant * @return {@link TenantMetaData} of given tenant
*/ */
@PreAuthorize(SpringEvalExpressions.IS_SYSTEM_CODE) @PreAuthorize(SpringEvalExpressions.IS_SYSTEM_CODE)

View File

@@ -36,25 +36,18 @@ import org.springframework.security.access.prepost.PreAuthorize;
/** /**
* Management service for {@link TargetFilterQuery}s. * Management service for {@link TargetFilterQuery}s.
*
*/ */
public interface TargetFilterQueryManagement { public interface TargetFilterQueryManagement {
/** /**
* Creates a new {@link TargetFilterQuery}. * Creates a new {@link TargetFilterQuery}.
* *
* @param create * @param create to create
* to create
*
* @return the new {@link TargetFilterQuery} * @return the new {@link TargetFilterQuery}
* * @throws ConstraintViolationException if fields are not filled as specified. Check
* @throws ConstraintViolationException * {@link TargetFilterQueryCreate} for field constraints.
* if fields are not filled as specified. Check * @throws AssignmentQuotaExceededException if the maximum number of targets that is addressed by the
* {@link TargetFilterQueryCreate} for field constraints. * given query is exceeded (auto-assignments only)
*
* @throws AssignmentQuotaExceededException
* if the maximum number of targets that is addressed by the
* given query is exceeded (auto-assignments only)
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
TargetFilterQuery create(@NotNull @Valid TargetFilterQueryCreate create); TargetFilterQuery create(@NotNull @Valid TargetFilterQueryCreate create);
@@ -62,11 +55,8 @@ public interface TargetFilterQueryManagement {
/** /**
* Deletes the {@link TargetFilterQuery} with the given ID. * Deletes the {@link TargetFilterQuery} with the given ID.
* *
* @param targetFilterQueryId * @param targetFilterQueryId IDs of target filter query to be deleted
* IDs of target filter query to be deleted * @throws EntityNotFoundException if filter with given ID does not exist
*
* @throws EntityNotFoundException
* if filter with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_TARGET)
void delete(long targetFilterQueryId); void delete(long targetFilterQueryId);
@@ -74,27 +64,19 @@ public interface TargetFilterQueryManagement {
/** /**
* Verifies the provided filter syntax. * Verifies the provided filter syntax.
* *
* @param query * @param query to verify
* to verify
*
* @return <code>true</code> if syntax is valid * @return <code>true</code> if syntax is valid
* * @throws RSQLParameterUnsupportedFieldException if a field in the RSQL string is used but not provided by the
* @throws RSQLParameterUnsupportedFieldException * given {@code fieldNameProvider}
* if a field in the RSQL string is used but not provided by the * @throws RSQLParameterSyntaxException if the RSQL syntax is wrong
* given {@code fieldNameProvider}
*
* @throws RSQLParameterSyntaxException
* if the RSQL syntax is wrong
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
boolean verifyTargetFilterQuerySyntax(@NotNull String query); boolean verifyTargetFilterQuerySyntax(@NotNull String query);
/** /**
*
* Retrieves all {@link TargetFilterQuery}s. * Retrieves all {@link TargetFilterQuery}s.
* *
* @param pageable * @param pageable pagination parameter
* pagination parameter
* @return the found {@link TargetFilterQuery}s * @return the found {@link TargetFilterQuery}s
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
@@ -114,8 +96,7 @@ public interface TargetFilterQueryManagement {
* <p/> * <p/>
* No access control applied * No access control applied
* *
* @param autoAssignDistributionSetId * @param autoAssignDistributionSetId the id of the distribution set
* the id of the distribution set
* @return the count * @return the count
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
@@ -125,10 +106,8 @@ public interface TargetFilterQueryManagement {
* Retrieves all {@link TargetFilterQuery}s which match the given name * Retrieves all {@link TargetFilterQuery}s which match the given name
* filter. * filter.
* *
* @param pageable * @param pageable pagination parameter
* pagination parameter * @param name name filter
* @param name
* name filter
* @return the page with the found {@link TargetFilterQuery}s * @return the page with the found {@link TargetFilterQuery}s
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
@@ -137,8 +116,7 @@ public interface TargetFilterQueryManagement {
/** /**
* Counts all {@link TargetFilterQuery}s which match the given name filter. * Counts all {@link TargetFilterQuery}s which match the given name filter.
* *
* @param name * @param name name filter
* name filter
* @return count of found {@link TargetFilterQuery}s * @return count of found {@link TargetFilterQuery}s
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
@@ -148,10 +126,8 @@ public interface TargetFilterQueryManagement {
* Retrieves all {@link TargetFilterQuery} which match the given RSQL * Retrieves all {@link TargetFilterQuery} which match the given RSQL
* filter. * filter.
* *
* @param pageable * @param pageable pagination parameter
* pagination parameter * @param rsqlFilter RSQL filter string
* @param rsqlFilter
* RSQL filter string
* @return the page with the found {@link TargetFilterQuery}s * @return the page with the found {@link TargetFilterQuery}s
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
@@ -160,10 +136,8 @@ public interface TargetFilterQueryManagement {
/** /**
* Retrieves all {@link TargetFilterQuery}s which match the given query. * Retrieves all {@link TargetFilterQuery}s which match the given query.
* *
* @param pageable * @param pageable pagination parameter
* pagination parameter * @param query the query saved in the target filter query
* @param query
* the query saved in the target filter query
* @return the page with the found {@link TargetFilterQuery}s * @return the page with the found {@link TargetFilterQuery}s
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
@@ -173,14 +147,10 @@ public interface TargetFilterQueryManagement {
* Retrieves all {@link TargetFilterQuery}s which match the given * Retrieves all {@link TargetFilterQuery}s which match the given
* auto-assign distribution set ID. * auto-assign distribution set ID.
* *
* @param pageable * @param pageable pagination parameter
* pagination parameter * @param setId the auto assign distribution set
* @param setId
* the auto assign distribution set
* @return the page with the found {@link TargetFilterQuery}s * @return the page with the found {@link TargetFilterQuery}s
* * @throws EntityNotFoundException if DS with given ID does not exist
* @throws EntityNotFoundException
* if DS with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Slice<TargetFilterQuery> findByAutoAssignDistributionSetId(@NotNull Pageable pageable, long setId); Slice<TargetFilterQuery> findByAutoAssignDistributionSetId(@NotNull Pageable pageable, long setId);
@@ -189,16 +159,11 @@ public interface TargetFilterQueryManagement {
* Retrieves all {@link TargetFilterQuery}s which match the given * Retrieves all {@link TargetFilterQuery}s which match the given
* auto-assign distribution set and RSQL filter. * auto-assign distribution set and RSQL filter.
* *
* @param pageable * @param pageable pagination parameter
* pagination parameter * @param setId the auto assign distribution set
* @param setId * @param rsqlParam RSQL filter
* the auto assign distribution set
* @param rsqlParam
* RSQL filter
* @return the page with the found {@link TargetFilterQuery}s * @return the page with the found {@link TargetFilterQuery}s
* * @throws EntityNotFoundException if DS with given ID does not exist
* @throws EntityNotFoundException
* if DS with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Page<TargetFilterQuery> findByAutoAssignDSAndRsql(@NotNull Pageable pageable, long setId, String rsqlParam); Page<TargetFilterQuery> findByAutoAssignDSAndRsql(@NotNull Pageable pageable, long setId, String rsqlParam);
@@ -207,9 +172,8 @@ public interface TargetFilterQueryManagement {
* Retrieves all {@link TargetFilterQuery}s with an auto-assign distribution * Retrieves all {@link TargetFilterQuery}s with an auto-assign distribution
* set. * set.
* *
* @param pageable pagination information
* @return the page with the found {@link TargetFilterQuery}s * @return the page with the found {@link TargetFilterQuery}s
* @param pageable
* pagination information
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Slice<TargetFilterQuery> findWithAutoAssignDS(@NotNull Pageable pageable); Slice<TargetFilterQuery> findWithAutoAssignDS(@NotNull Pageable pageable);
@@ -217,10 +181,8 @@ public interface TargetFilterQueryManagement {
/** /**
* Finds the {@link TargetFilterQuery} by id. * Finds the {@link TargetFilterQuery} by id.
* *
* @param targetFilterQueryId * @param targetFilterQueryId Target filter query id
* Target filter query id
* @return the found {@link TargetFilterQuery} * @return the found {@link TargetFilterQuery}
*
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Optional<TargetFilterQuery> get(long targetFilterQueryId); Optional<TargetFilterQuery> get(long targetFilterQueryId);
@@ -228,10 +190,8 @@ public interface TargetFilterQueryManagement {
/** /**
* Finds the {@link TargetFilterQuery} that matches the given name. * Finds the {@link TargetFilterQuery} that matches the given name.
* *
* @param targetFilterQueryName * @param targetFilterQueryName Target filter query name
* Target filter query name
* @return the found {@link TargetFilterQuery} * @return the found {@link TargetFilterQuery}
*
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Optional<TargetFilterQuery> getByName(@NotNull String targetFilterQueryName); Optional<TargetFilterQuery> getByName(@NotNull String targetFilterQueryName);
@@ -239,22 +199,14 @@ public interface TargetFilterQueryManagement {
/** /**
* Updates the {@link TargetFilterQuery}. * Updates the {@link TargetFilterQuery}.
* *
* @param update * @param update to be updated
* to be updated
*
* @return the updated {@link TargetFilterQuery} * @return the updated {@link TargetFilterQuery}
* * @throws EntityNotFoundException if either {@link TargetFilterQuery} and/or autoAssignDs are
* @throws EntityNotFoundException * provided but not found
* if either {@link TargetFilterQuery} and/or autoAssignDs are * @throws ConstraintViolationException if fields are not filled as specified. Check
* provided but not found * {@link TargetFilterQueryUpdate} for field constraints.
* * @throws QuotaExceededException if the update contains a new query which addresses too many
* @throws ConstraintViolationException * targets (auto-assignments only)
* if fields are not filled as specified. Check
* {@link TargetFilterQueryUpdate} for field constraints.
*
* @throws QuotaExceededException
* if the update contains a new query which addresses too many
* targets (auto-assignments only)
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
TargetFilterQuery update(@NotNull @Valid TargetFilterQueryUpdate update); TargetFilterQuery update(@NotNull @Valid TargetFilterQueryUpdate update);
@@ -262,30 +214,18 @@ public interface TargetFilterQueryManagement {
/** /**
* Updates the auto assign settings of an {@link TargetFilterQuery}. * Updates the auto assign settings of an {@link TargetFilterQuery}.
* *
* @param autoAssignDistributionSetUpdate * @param autoAssignDistributionSetUpdate the new auto assignment
* the new auto assignment
*
* @return the updated {@link TargetFilterQuery} * @return the updated {@link TargetFilterQuery}
* * @throws EntityNotFoundException if either {@link TargetFilterQuery} and/or autoAssignDs are
* @throws EntityNotFoundException * provided but not found
* if either {@link TargetFilterQuery} and/or autoAssignDs are * @throws AssignmentQuotaExceededException if the query that is already associated with this filter
* provided but not found * query addresses too many targets (auto-assignments only)
* * @throws InvalidAutoAssignActionTypeException if the provided auto-assign {@link ActionType} is not valid
* @throws AssignmentQuotaExceededException * (neither FORCED, nor SOFT)
* if the query that is already associated with this filter * @throws IncompleteDistributionSetException if the provided auto-assign {@link DistributionSet} is
* query addresses too many targets (auto-assignments only) * incomplete
* * @throws InvalidDistributionSetException if the provided auto-assign {@link DistributionSet} is
* @throws InvalidAutoAssignActionTypeException * invalidated
* if the provided auto-assign {@link ActionType} is not valid
* (neither FORCED, nor SOFT)
*
* @throws IncompleteDistributionSetException
* if the provided auto-assign {@link DistributionSet} is
* incomplete
*
* @throws InvalidDistributionSetException
* if the provided auto-assign {@link DistributionSet} is
* invalidated
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
TargetFilterQuery updateAutoAssignDS( TargetFilterQuery updateAutoAssignDS(
@@ -294,9 +234,8 @@ public interface TargetFilterQueryManagement {
/** /**
* Removes the given {@link DistributionSet} from all auto assignments. * Removes the given {@link DistributionSet} from all auto assignments.
* *
* @param setId * @param setId the {@link DistributionSet} to be removed from auto
* the {@link DistributionSet} to be removed from auto * assignments.
* assignments.
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
void cancelAutoAssignmentForDistributionSet(long setId); void cancelAutoAssignmentForDistributionSet(long setId);

View File

@@ -55,11 +55,9 @@ public interface TargetManagement {
/** /**
* Counts number of targets with the given distribution set assigned. * Counts number of targets with the given distribution set assigned.
* *
* @param distributionSetId * @param distributionSetId to search for
* to search for
* @return number of found {@link Target}s. * @return number of found {@link Target}s.
* @throws EntityNotFoundException * @throws EntityNotFoundException if distribution set with given ID does not exist
* if distribution set with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET + SpringEvalExpressions.HAS_AUTH_OR @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET + SpringEvalExpressions.HAS_AUTH_OR
+ SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) + SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
@@ -68,14 +66,10 @@ public interface TargetManagement {
/** /**
* Count {@link Target}s for all the given filter parameters. * Count {@link Target}s for all the given filter parameters.
* *
* @param filterParams * @param filterParams the filters to apply; only filters are enabled that have non-null
* the filters to apply; only filters are enabled that have non-null * value; filters are AND-gated
* value; filters are AND-gated
*
* @return the found number {@link Target}s * @return the found number {@link Target}s
* * @throws EntityNotFoundException if distribution set with given ID does not exist
* @throws EntityNotFoundException
* if distribution set with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
long countByFilters(@NotNull final FilterParams filterParams); long countByFilters(@NotNull final FilterParams filterParams);
@@ -83,11 +77,9 @@ public interface TargetManagement {
/** /**
* Get the count of targets with the given distribution set id. * Get the count of targets with the given distribution set id.
* *
* @param distributionSetId * @param distributionSetId to search for
* to search for
* @return number of found {@link Target}s. * @return number of found {@link Target}s.
* @throws EntityNotFoundException * @throws EntityNotFoundException if distribution set with given ID does not exist
* if distribution set with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET + SpringEvalExpressions.HAS_AUTH_OR @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET + SpringEvalExpressions.HAS_AUTH_OR
+ SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) + SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
@@ -97,11 +89,9 @@ public interface TargetManagement {
* Checks if there is already a {@link Target} that has the given distribution * Checks if there is already a {@link Target} that has the given distribution
* set Id assigned or installed. * set Id assigned or installed.
* *
* @param distributionSetId * @param distributionSetId to search for
* to search for
* @return <code>true</code> if a {@link Target} exists. * @return <code>true</code> if a {@link Target} exists.
* @throws EntityNotFoundException * @throws EntityNotFoundException if distribution set with given ID does not exist
* if distribution set with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET + SpringEvalExpressions.HAS_AUTH_OR @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET + SpringEvalExpressions.HAS_AUTH_OR
+ SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) + SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
@@ -110,8 +100,7 @@ public interface TargetManagement {
/** /**
* Count {@link TargetFilterQuery}s for given target filter query. * Count {@link TargetFilterQuery}s for given target filter query.
* *
* @param rsqlParam * @param rsqlParam filter definition in RSQL syntax
* filter definition in RSQL syntax
* @return the found number of {@link Target}s * @return the found number of {@link Target}s
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
@@ -120,8 +109,7 @@ public interface TargetManagement {
/** /**
* Count {@link TargetFilterQuery}s for given target filter query with UPDATE permission. * Count {@link TargetFilterQuery}s for given target filter query with UPDATE permission.
* *
* @param rsqlParam * @param rsqlParam filter definition in RSQL syntax
* filter definition in RSQL syntax
* @return the found number of {@link Target}s * @return the found number of {@link Target}s
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
@@ -131,11 +119,9 @@ public interface TargetManagement {
* Count all targets for given {@link TargetFilterQuery} and that are compatible * Count all targets for given {@link TargetFilterQuery} and that are compatible
* with the passed {@link DistributionSetType}. * with the passed {@link DistributionSetType}.
* *
* @param rsqlParam * @param rsqlParam filter definition in RSQL syntax
* filter definition in RSQL syntax * @param distributionSetIdTypeId ID of the {@link DistributionSetType} the targets need to be
* @param distributionSetIdTypeId * compatible with
* ID of the {@link DistributionSetType} the targets need to be
* compatible with
* @return the found number of{@link Target}s * @return the found number of{@link Target}s
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
@@ -145,11 +131,9 @@ public interface TargetManagement {
* Count all targets for given {@link TargetFilterQuery} and that are compatible * Count all targets for given {@link TargetFilterQuery} and that are compatible
* with the passed {@link DistributionSetType} and UPDATE permission. * with the passed {@link DistributionSetType} and UPDATE permission.
* *
* @param rsqlParam * @param rsqlParam filter definition in RSQL syntax
* filter definition in RSQL syntax * @param distributionSetIdTypeId ID of the {@link DistributionSetType} the targets need to be
* @param distributionSetIdTypeId * compatible with
* ID of the {@link DistributionSetType} the targets need to be
* compatible with
* @return the found number of{@link Target}s * @return the found number of{@link Target}s
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
@@ -160,11 +144,9 @@ public interface TargetManagement {
* compatible with the passed {@link DistributionSetType} and created after * compatible with the passed {@link DistributionSetType} and created after
* given timestamp * given timestamp
* *
* @param rolloutId * @param rolloutId rolloutId of the rollout to be retried.
* rolloutId of the rollout to be retried. * @param dsTypeId ID of the {@link DistributionSetType} the targets need to be
* @param dsTypeId * compatible with
* ID of the {@link DistributionSetType} the targets need to be
* compatible with
* @return the found number of{@link Target}s * @return the found number of{@link Target}s
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
@@ -173,12 +155,9 @@ public interface TargetManagement {
/** /**
* Count {@link TargetFilterQuery}s for given target filter query. * Count {@link TargetFilterQuery}s for given target filter query.
* *
* @param targetFilterQueryId * @param targetFilterQueryId {@link TargetFilterQuery#getId()}
* {@link TargetFilterQuery#getId()}
* @return the found number of {@link Target}s * @return the found number of {@link Target}s
* * @throws EntityNotFoundException if {@link TargetFilterQuery} with given ID does not exist
* @throws EntityNotFoundException
* if {@link TargetFilterQuery} with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
long countByTargetFilterQuery(long targetFilterQueryId); long countByTargetFilterQuery(long targetFilterQueryId);
@@ -194,16 +173,11 @@ public interface TargetManagement {
/** /**
* creating a new {@link Target}. * creating a new {@link Target}.
* *
* @param create * @param create to be created
* to be created
* @return the created {@link Target} * @return the created {@link Target}
* * @throws EntityAlreadyExistsException given target already exists.
* @throws EntityAlreadyExistsException * @throws ConstraintViolationException if fields are not filled as specified. Check {@link TargetCreate}
* given target already exists. * for field constraints.
* @throws ConstraintViolationException
* if fields are not filled as specified. Check {@link TargetCreate}
* for field constraints.
*
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
Target create(@NotNull @Valid TargetCreate create); Target create(@NotNull @Valid TargetCreate create);
@@ -213,15 +187,11 @@ public interface TargetManagement {
* in the DB an {@link EntityAlreadyExistsException} is thrown. {@link Target}s * in the DB an {@link EntityAlreadyExistsException} is thrown. {@link Target}s
* contain all objects of the parameter targets, including duplicates. * contain all objects of the parameter targets, including duplicates.
* *
* @param creates * @param creates to be created.
* to be created.
* @return the created {@link Target}s * @return the created {@link Target}s
* * @throws EntityAlreadyExistsException of one of the given targets already exist.
* @throws EntityAlreadyExistsException * @throws ConstraintViolationException if fields are not filled as specified. Check {@link TargetCreate}
* of one of the given targets already exist. * for field constraints.
* @throws ConstraintViolationException
* if fields are not filled as specified. Check {@link TargetCreate}
* for field constraints.
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
List<Target> create(@NotNull @Valid Collection<TargetCreate> creates); List<Target> create(@NotNull @Valid Collection<TargetCreate> creates);
@@ -229,11 +199,8 @@ public interface TargetManagement {
/** /**
* Deletes all targets with the given IDs. * Deletes all targets with the given IDs.
* *
* @param ids * @param ids the IDs of the targets to be deleted
* the IDs of the targets to be deleted * @throws EntityNotFoundException if (at least one) of the given target IDs does not exist
*
* @throws EntityNotFoundException
* if (at least one) of the given target IDs does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_TARGET)
void delete(@NotEmpty Collection<Long> ids); void delete(@NotEmpty Collection<Long> ids);
@@ -241,11 +208,8 @@ public interface TargetManagement {
/** /**
* Deletes target with the given controller ID. * Deletes target with the given controller ID.
* *
* @param controllerId * @param controllerId the controller ID of the target to be deleted
* the controller ID of the target to be deleted * @throws EntityNotFoundException if target with given ID does not exist
*
* @throws EntityNotFoundException
* if target with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_TARGET)
void deleteByControllerID(@NotEmpty String controllerId); void deleteByControllerID(@NotEmpty String controllerId);
@@ -255,16 +219,11 @@ public interface TargetManagement {
* that don't have the specified distribution set in their action history and * that don't have the specified distribution set in their action history and
* are compatible with the passed {@link DistributionSetType}. * are compatible with the passed {@link DistributionSetType}.
* *
* @param pageRequest * @param pageRequest the pageRequest to enhance the query for paging and sorting
* the pageRequest to enhance the query for paging and sorting * @param distributionSetId id of the {@link DistributionSet}
* @param distributionSetId * @param rsqlParam filter definition in RSQL syntax
* id of the {@link DistributionSet}
* @param rsqlParam
* filter definition in RSQL syntax
* @return a page of the found {@link Target}s * @return a page of the found {@link Target}s
* * @throws EntityNotFoundException if distribution set with given ID does not exist
* @throws EntityNotFoundException
* if distribution set with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
Slice<Target> findByTargetFilterQueryAndNonDSAndCompatibleAndUpdatable(@NotNull Pageable pageRequest, Slice<Target> findByTargetFilterQueryAndNonDSAndCompatibleAndUpdatable(@NotNull Pageable pageRequest,
@@ -275,14 +234,10 @@ public interface TargetManagement {
* that don't have the specified distribution set in their action history and * that don't have the specified distribution set in their action history and
* are compatible with the passed {@link DistributionSetType}. * are compatible with the passed {@link DistributionSetType}.
* *
* @param distributionSetId * @param distributionSetId id of the {@link DistributionSet}
* id of the {@link DistributionSet} * @param rsqlParam filter definition in RSQL syntax
* @param rsqlParam
* filter definition in RSQL syntax
* @return the count of found {@link Target}s * @return the count of found {@link Target}s
* * @throws EntityNotFoundException if distribution set with given ID does not exist
* @throws EntityNotFoundException
* if distribution set with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
long countByRsqlAndNonDSAndCompatibleAndUpdatable(long distributionSetId, @NotNull String rsqlParam); long countByRsqlAndNonDSAndCompatibleAndUpdatable(long distributionSetId, @NotNull String rsqlParam);
@@ -292,15 +247,11 @@ public interface TargetManagement {
* that are not assigned to one of the {@link RolloutGroup}s and are compatible * that are not assigned to one of the {@link RolloutGroup}s and are compatible
* with the passed {@link DistributionSetType}. * with the passed {@link DistributionSetType}.
* *
* @param pageRequest * @param pageRequest the pageRequest to enhance the query for paging and sorting
* the pageRequest to enhance the query for paging and sorting * @param groups the list of {@link RolloutGroup}s
* @param groups * @param targetFilterQuery filter definition in RSQL syntax
* the list of {@link RolloutGroup}s * @param distributionSetType type of the {@link DistributionSet} the targets must be compatible
* @param targetFilterQuery * withs
* filter definition in RSQL syntax
* @param distributionSetType
* type of the {@link DistributionSet} the targets must be compatible
* withs
* @return a page of the found {@link Target}s * @return a page of the found {@link Target}s
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
@@ -321,12 +272,9 @@ public interface TargetManagement {
* assigned to one of the retried {@link RolloutGroup}s and are compatible with * assigned to one of the retried {@link RolloutGroup}s and are compatible with
* the passed {@link DistributionSetType}. * the passed {@link DistributionSetType}.
* *
* @param pageRequest * @param pageRequest the pageRequest to enhance the query for paging and sorting
* the pageRequest to enhance the query for paging and sorting * @param groups the list of {@link RolloutGroup}s
* @param groups * @param rolloutId rolloutId of the rollout to be retried.
* the list of {@link RolloutGroup}s
* @param rolloutId
* rolloutId of the rollout to be retried.
* @return a page of the found {@link Target}s * @return a page of the found {@link Target}s
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
@@ -338,13 +286,10 @@ public interface TargetManagement {
* that are not assigned to one of the {@link RolloutGroup}s and are compatible * that are not assigned to one of the {@link RolloutGroup}s and are compatible
* with the passed {@link DistributionSetType}. * with the passed {@link DistributionSetType}.
* *
* @param groups * @param groups the list of {@link RolloutGroup}s
* the list of {@link RolloutGroup}s * @param rsqlParam filter definition in RSQL syntax
* @param rsqlParam * @param distributionSetType type of the {@link DistributionSet} the targets must be compatible
* filter definition in RSQL syntax * with
* @param distributionSetType
* type of the {@link DistributionSet} the targets must be compatible
* with
* @return count of the found {@link Target}s * @return count of the found {@link Target}s
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
@@ -356,10 +301,8 @@ public interface TargetManagement {
* assigned to one of the {@link RolloutGroup}s and are compatible with the * assigned to one of the {@link RolloutGroup}s and are compatible with the
* passed {@link DistributionSetType}. * passed {@link DistributionSetType}.
* *
* @param groups * @param groups the list of {@link RolloutGroup}s
* the list of {@link RolloutGroup}s * @param rolloutId rolloutId of the rollout to be retried.
* @param rolloutId
* rolloutId of the rollout to be retried.
* @return count of the found {@link Target}s * @return count of the found {@link Target}s
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
@@ -369,14 +312,10 @@ public interface TargetManagement {
* Finds all targets of the provided {@link RolloutGroup} that have no Action * Finds all targets of the provided {@link RolloutGroup} that have no Action
* for the RolloutGroup. * for the RolloutGroup.
* *
* @param pageRequest * @param pageRequest the pageRequest to enhance the query for paging and sorting
* the pageRequest to enhance the query for paging and sorting * @param group the {@link RolloutGroup}
* @param group
* the {@link RolloutGroup}
* @return the found {@link Target}s * @return the found {@link Target}s
* * @throws EntityNotFoundException if rollout group with given ID does not exist
* @throws EntityNotFoundException
* if rollout group with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Slice<Target> findByInRolloutGroupWithoutAction(@NotNull Pageable pageRequest, long group); Slice<Target> findByInRolloutGroupWithoutAction(@NotNull Pageable pageRequest, long group);
@@ -384,16 +323,10 @@ public interface TargetManagement {
/** /**
* retrieves {@link Target}s by the assigned {@link DistributionSet}. * retrieves {@link Target}s by the assigned {@link DistributionSet}.
* *
* @param pageReq * @param pageReq page parameter
* page parameter * @param distributionSetId the ID of the {@link DistributionSet}
* @param distributionSetId
* the ID of the {@link DistributionSet}
*
*
* @return the found {@link Target}s * @return the found {@link Target}s
* * @throws EntityNotFoundException if distribution set with given ID does not exist
* @throws EntityNotFoundException
* if distribution set with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_READ_TARGET)
Page<Target> findByAssignedDistributionSet(@NotNull Pageable pageReq, long distributionSetId); Page<Target> findByAssignedDistributionSet(@NotNull Pageable pageReq, long distributionSetId);
@@ -402,21 +335,14 @@ public interface TargetManagement {
* Retrieves {@link Target}s by the assigned {@link DistributionSet} possible * Retrieves {@link Target}s by the assigned {@link DistributionSet} possible
* including additional filtering based on the given {@code spec}. * including additional filtering based on the given {@code spec}.
* *
* @param pageReq * @param pageReq page parameter
* page parameter * @param distributionSetId the ID of the {@link DistributionSet}
* @param distributionSetId * @param rsqlParam the specification to filter the result set
* the ID of the {@link DistributionSet}
* @param rsqlParam
* the specification to filter the result set
*
* @return the found {@link Target}s, never {@code null} * @return the found {@link Target}s, never {@code null}
* @throws RSQLParameterUnsupportedFieldException * @throws RSQLParameterUnsupportedFieldException if a field in the RSQL string is used but not provided by the
* if a field in the RSQL string is used but not provided by the * given {@code fieldNameProvider}
* given {@code fieldNameProvider} * @throws RSQLParameterSyntaxException if the RSQL syntax is wrong
* @throws RSQLParameterSyntaxException * @throws EntityNotFoundException if distribution set with given ID does not exist
* if the RSQL syntax is wrong
* @throws EntityNotFoundException
* if distribution set with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_READ_TARGET)
Page<Target> findByAssignedDistributionSetAndRsql(@NotNull Pageable pageReq, long distributionSetId, Page<Target> findByAssignedDistributionSetAndRsql(@NotNull Pageable pageReq, long distributionSetId,
@@ -425,8 +351,7 @@ public interface TargetManagement {
/** /**
* Find {@link Target}s based a given IDs. * Find {@link Target}s based a given IDs.
* *
* @param controllerIDs * @param controllerIDs to look for.
* to look for.
* @return List of found{@link Target}s * @return List of found{@link Target}s
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
@@ -435,8 +360,7 @@ public interface TargetManagement {
/** /**
* Find a {@link Target} based a given ID. * Find a {@link Target} based a given ID.
* *
* @param controllerId * @param controllerId to look for.
* to look for.
* @return {@link Target} * @return {@link Target}
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
@@ -446,16 +370,11 @@ public interface TargetManagement {
* Filter {@link Target}s for all the given parameters. If all parameters except * Filter {@link Target}s for all the given parameters. If all parameters except
* pageable are null, all available {@link Target}s are returned. * pageable are null, all available {@link Target}s are returned.
* *
* @param pageable * @param pageable page parameters
* page parameters * @param filterParams the filters to apply; only filters are enabled that have non-null
* @param filterParams * value; filters are AND-gated
* the filters to apply; only filters are enabled that have non-null
* value; filters are AND-gated
*
* @return the found {@link Target}s * @return the found {@link Target}s
* * @throws EntityNotFoundException if distribution set with given ID does not exist
* @throws EntityNotFoundException
* if distribution set with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Slice<Target> findByFilters(@NotNull Pageable pageable, @NotNull FilterParams filterParams); Slice<Target> findByFilters(@NotNull Pageable pageable, @NotNull FilterParams filterParams);
@@ -463,15 +382,10 @@ public interface TargetManagement {
/** /**
* retrieves {@link Target}s by the installed {@link DistributionSet}. * retrieves {@link Target}s by the installed {@link DistributionSet}.
* *
* @param pageReq * @param pageReq page parameter
* page parameter * @param distributionSetId the ID of the {@link DistributionSet}
* @param distributionSetId
* the ID of the {@link DistributionSet}
*
* @return the found {@link Target}s * @return the found {@link Target}s
* * @throws EntityNotFoundException if distribution set with given ID does not exist
* @throws EntityNotFoundException
* if distribution set with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_READ_TARGET)
Page<Target> findByInstalledDistributionSet(@NotNull Pageable pageReq, long distributionSetId); Page<Target> findByInstalledDistributionSet(@NotNull Pageable pageReq, long distributionSetId);
@@ -480,23 +394,14 @@ public interface TargetManagement {
* retrieves {@link Target}s by the installed {@link DistributionSet} including * retrieves {@link Target}s by the installed {@link DistributionSet} including
* additional filtering based on the given {@code spec}. * additional filtering based on the given {@code spec}.
* *
* @param pageReq * @param pageReq page parameter
* page parameter * @param distributionSetId the ID of the {@link DistributionSet}
* @param distributionSetId * @param rsqlParam the specification to filter the result
* the ID of the {@link DistributionSet}
* @param rsqlParam
* the specification to filter the result
*
* @return the found {@link Target}s, never {@code null} * @return the found {@link Target}s, never {@code null}
* * @throws RSQLParameterUnsupportedFieldException if a field in the RSQL string is used but not provided by the
* @throws RSQLParameterUnsupportedFieldException * given {@code fieldNameProvider}
* if a field in the RSQL string is used but not provided by the * @throws RSQLParameterSyntaxException if the RSQL syntax is wrong
* given {@code fieldNameProvider} * @throws EntityNotFoundException if distribution set with given ID does not exist
* @throws RSQLParameterSyntaxException
* if the RSQL syntax is wrong
*
* @throws EntityNotFoundException
* if distribution set with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_READ_TARGET)
Page<Target> findByInstalledDistributionSetAndRsql(@NotNull Pageable pageReq, long distributionSetId, Page<Target> findByInstalledDistributionSetAndRsql(@NotNull Pageable pageReq, long distributionSetId,
@@ -505,10 +410,8 @@ public interface TargetManagement {
/** /**
* Retrieves the {@link Target} which have a certain {@link TargetUpdateStatus}. * Retrieves the {@link Target} which have a certain {@link TargetUpdateStatus}.
* *
* @param pageable * @param pageable page parameter
* page parameter * @param status the {@link TargetUpdateStatus} to be filtered on
* @param status
* the {@link TargetUpdateStatus} to be filtered on
* @return the found {@link Target}s * @return the found {@link Target}s
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
@@ -517,8 +420,7 @@ public interface TargetManagement {
/** /**
* Retrieves all targets. * Retrieves all targets.
* *
* @param pageable * @param pageable pagination parameter
* pagination parameter
* @return the found {@link Target}s * @return the found {@link Target}s
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
@@ -527,19 +429,12 @@ public interface TargetManagement {
/** /**
* Retrieves all targets. * Retrieves all targets.
* *
* @param pageable * @param pageable pagination parameter
* pagination parameter * @param rsqlParam in RSQL notation
* @param rsqlParam
* in RSQL notation
*
* @return the found {@link Target}s, never {@code null} * @return the found {@link Target}s, never {@code null}
* * @throws RSQLParameterUnsupportedFieldException if a field in the RSQL string is used but not provided by the
* * given {@code fieldNameProvider}
* @throws RSQLParameterUnsupportedFieldException * @throws RSQLParameterSyntaxException if the RSQL syntax is wrong
* if a field in the RSQL string is used but not provided by the
* given {@code fieldNameProvider}
* @throws RSQLParameterSyntaxException
* if the RSQL syntax is wrong
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Slice<Target> findByRsql(@NotNull Pageable pageable, @NotNull String rsqlParam); Slice<Target> findByRsql(@NotNull Pageable pageable, @NotNull String rsqlParam);
@@ -547,20 +442,13 @@ public interface TargetManagement {
/** /**
* Retrieves all target based on {@link TargetFilterQuery}. * Retrieves all target based on {@link TargetFilterQuery}.
* *
* @param pageable * @param pageable pagination parameter
* pagination parameter * @param targetFilterQueryId {@link TargetFilterQuery#getId()}
* @param targetFilterQueryId
* {@link TargetFilterQuery#getId()}
*
* @return the found {@link Target}s, never {@code null} * @return the found {@link Target}s, never {@code null}
* * @throws EntityNotFoundException if {@link TargetFilterQuery} with given ID does not exist.
* @throws EntityNotFoundException * @throws RSQLParameterUnsupportedFieldException if a field in the RSQL string is used but not provided by the
* if {@link TargetFilterQuery} with given ID does not exist. * given {@code fieldNameProvider}
* @throws RSQLParameterUnsupportedFieldException * @throws RSQLParameterSyntaxException if the RSQL syntax is wrong
* if a field in the RSQL string is used but not provided by the
* given {@code fieldNameProvider}
* @throws RSQLParameterSyntaxException
* if the RSQL syntax is wrong
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Slice<Target> findByTargetFilterQuery(@NotNull Pageable pageable, long targetFilterQueryId); Slice<Target> findByTargetFilterQuery(@NotNull Pageable pageable, long targetFilterQueryId);
@@ -577,18 +465,13 @@ public interface TargetManagement {
* {@link DistributionSet}</li> * {@link DistributionSet}</li>
* </ol> * </ol>
* *
* @param pageable * @param pageable the page request to page the result set
* the page request to page the result set * @param orderByDistributionSetId {@link DistributionSet#getId()} to be ordered by
* @param orderByDistributionSetId * @param filterParams the filters to apply; only filters are enabled that have non-null
* {@link DistributionSet#getId()} to be ordered by * value; filters are AND-gated
* @param filterParams
* the filters to apply; only filters are enabled that have non-null
* value; filters are AND-gated
* @return a paged result {@link Page} of the {@link Target}s in a defined * @return a paged result {@link Page} of the {@link Target}s in a defined
* order. * order.
* * @throws EntityNotFoundException if distribution set with given ID does not exist
* @throws EntityNotFoundException
* if distribution set with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Slice<Target> findByFilterOrderByLinkedDistributionSet(@NotNull Pageable pageable, long orderByDistributionSetId, Slice<Target> findByFilterOrderByLinkedDistributionSet(@NotNull Pageable pageable, long orderByDistributionSetId,
@@ -597,14 +480,10 @@ public interface TargetManagement {
/** /**
* Find targets by tag name. * Find targets by tag name.
* *
* @param pageable * @param pageable the page request parameter for paging and sorting the result
* the page request parameter for paging and sorting the result * @param tagId tag ID
* @param tagId
* tag ID
* @return list of matching targets * @return list of matching targets
* * @throws EntityNotFoundException if target tag with given ID does not exist
* @throws EntityNotFoundException
* if target tag with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Page<Target> findByTag(@NotNull Pageable pageable, long tagId); Page<Target> findByTag(@NotNull Pageable pageable, long tagId);
@@ -612,22 +491,14 @@ public interface TargetManagement {
/** /**
* Find targets by tag name. * Find targets by tag name.
* *
* @param pageable * @param pageable the page request parameter for paging and sorting the result
* the page request parameter for paging and sorting the result * @param tagId tag ID
* @param tagId * @param rsqlParam in RSQL notation
* tag ID
* @param rsqlParam
* in RSQL notation
*
* @return list of matching targets * @return list of matching targets
* * @throws EntityNotFoundException if target tag with given ID does not exist
* @throws EntityNotFoundException * @throws RSQLParameterUnsupportedFieldException if a field in the RSQL string is used but not provided by the
* if target tag with given ID does not exist * given {@code fieldNameProvider}
* @throws RSQLParameterUnsupportedFieldException * @throws RSQLParameterSyntaxException if the RSQL syntax is wrong
* if a field in the RSQL string is used but not provided by the
* given {@code fieldNameProvider}
* @throws RSQLParameterSyntaxException
* if the RSQL syntax is wrong
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Page<Target> findByRsqlAndTag(@NotNull Pageable pageable, @NotNull String rsqlParam, long tagId); Page<Target> findByRsqlAndTag(@NotNull Pageable pageable, @NotNull String rsqlParam, long tagId);
@@ -638,15 +509,11 @@ public interface TargetManagement {
* get assigned. If all targets are already of that type, there will be no * get assigned. If all targets are already of that type, there will be no
* un-assignment. * un-assignment.
* *
* @param controllerIds * @param controllerIds to set the type to
* to set the type to * @param typeId to assign targets to
* @param typeId
* to assign targets to
* @return {@link TargetTypeAssignmentResult} with all metadata of the * @return {@link TargetTypeAssignmentResult} with all metadata of the
* assignment outcome. * assignment outcome.
* * @throws EntityNotFoundException if target type with given id does not exist
* @throws EntityNotFoundException
* if target type with given id does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
TargetTypeAssignmentResult assignType(@NotEmpty Collection<String> controllerIds, @NotNull Long typeId); TargetTypeAssignmentResult assignType(@NotEmpty Collection<String> controllerIds, @NotNull Long typeId);
@@ -655,8 +522,7 @@ public interface TargetManagement {
* Initiates {@link TargetType} un-assignment to given {@link Target}s. The type * Initiates {@link TargetType} un-assignment to given {@link Target}s. The type
* of the targets will be set to {@code null} * of the targets will be set to {@code null}
* *
* @param controllerIds * @param controllerIds to remove the type from
* to remove the type from
* @return {@link TargetTypeAssignmentResult} with all metadata of the * @return {@link TargetTypeAssignmentResult} with all metadata of the
* assignment outcome. * assignment outcome.
*/ */
@@ -718,7 +584,6 @@ public interface TargetManagement {
* *
* @param controllerId to un-assign for * @param controllerId to un-assign for
* @return the unassigned target * @return the unassigned target
*
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
Target unassignType(@NotEmpty String controllerId); Target unassignType(@NotEmpty String controllerId);
@@ -726,14 +591,10 @@ public interface TargetManagement {
/** /**
* Assign a {@link TargetType} assignment to given {@link Target}. * Assign a {@link TargetType} assignment to given {@link Target}.
* *
* @param controllerId * @param controllerId to un-assign for
* to un-assign for * @param targetTypeId Target type id
* @param targetTypeId
* Target type id
* @return the unassigned target * @return the unassigned target
* * @throws EntityNotFoundException if TargetType with given target ID does not exist
* @throws EntityNotFoundException
* if TargetType with given target ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
Target assignType(@NotEmpty String controllerId, @NotNull Long targetTypeId); Target assignType(@NotEmpty String controllerId, @NotNull Long targetTypeId);
@@ -741,16 +602,11 @@ public interface TargetManagement {
/** /**
* updates the {@link Target}. * updates the {@link Target}.
* *
* @param update * @param update to be updated
* to be updated
*
* @return the updated {@link Target} * @return the updated {@link Target}
* * @throws EntityNotFoundException if given target does not exist
* @throws EntityNotFoundException * @throws ConstraintViolationException if fields are not filled as specified. Check {@link TargetUpdate}
* if given target does not exist * for field constraints.
* @throws ConstraintViolationException
* if fields are not filled as specified. Check {@link TargetUpdate}
* for field constraints.
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
Target update(@NotNull @Valid TargetUpdate update); Target update(@NotNull @Valid TargetUpdate update);
@@ -758,8 +614,7 @@ public interface TargetManagement {
/** /**
* Find a {@link Target} based a given ID. * Find a {@link Target} based a given ID.
* *
* @param id * @param id to look for
* to look for
* @return {@link Target} * @return {@link Target}
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
@@ -768,8 +623,7 @@ public interface TargetManagement {
/** /**
* Retrieves all targets. * Retrieves all targets.
* *
* @param ids * @param ids the ids to for
* the ids to for
* @return the found {@link Target}s * @return the found {@link Target}s
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
@@ -778,12 +632,9 @@ public interface TargetManagement {
/** /**
* Get controller attributes of given {@link Target}. * Get controller attributes of given {@link Target}.
* *
* @param controllerId * @param controllerId of the target
* of the target
* @return controller attributes as key/value pairs * @return controller attributes as key/value pairs
* * @throws EntityNotFoundException if target with given ID does not exist
* @throws EntityNotFoundException
* if target with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Map<String, String> getControllerAttributes(@NotEmpty String controllerId); Map<String, String> getControllerAttributes(@NotEmpty String controllerId);
@@ -791,11 +642,8 @@ public interface TargetManagement {
/** /**
* Trigger given {@link Target} to update its attributes. * Trigger given {@link Target} to update its attributes.
* *
* @param controllerId * @param controllerId of the target
* of the target * @throws EntityNotFoundException if target with given ID does not exist
*
* @throws EntityNotFoundException
* if target with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
void requestControllerAttributes(@NotEmpty String controllerId); void requestControllerAttributes(@NotEmpty String controllerId);
@@ -803,8 +651,7 @@ public interface TargetManagement {
/** /**
* Check if update of given {@link Target} attributes is already requested. * Check if update of given {@link Target} attributes is already requested.
* *
* @param controllerId * @param controllerId of target
* of target
* @return {@code true}: update of controller attributes triggered. * @return {@code true}: update of controller attributes triggered.
* {@code false}: update of controller attributes not requested. * {@code false}: update of controller attributes not requested.
*/ */
@@ -815,11 +662,8 @@ public interface TargetManagement {
* Retrieves {@link Target}s where * Retrieves {@link Target}s where
* {@link #isControllerAttributesRequested(String)}. * {@link #isControllerAttributesRequested(String)}.
* *
* @param pageReq * @param pageReq page parameter
* page parameter
*
* @return the found {@link Target}s * @return the found {@link Target}s
*
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Page<Target> findByControllerAttributesRequested(@NotNull Pageable pageReq); Page<Target> findByControllerAttributesRequested(@NotNull Pageable pageReq);
@@ -828,8 +672,7 @@ public interface TargetManagement {
* Verifies that {@link Target} with given controller ID exists in the * Verifies that {@link Target} with given controller ID exists in the
* repository. * repository.
* *
* @param controllerId * @param controllerId of target
* of target
* @return {@code true} if target with given ID exists * @return {@code true} if target with given ID exists
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
@@ -839,15 +682,12 @@ public interface TargetManagement {
* Verify if a target matches a specific target filter query, does not have a * Verify if a target matches a specific target filter query, does not have a
* specific DS already assigned and is compatible with it. * specific DS already assigned and is compatible with it.
* *
* @param controllerId * @param controllerId of the {@link org.eclipse.hawkbit.repository.model.Target} to
* of the {@link org.eclipse.hawkbit.repository.model.Target} to * check
* check * @param distributionSetId of the
* @param distributionSetId * {@link org.eclipse.hawkbit.repository.model.DistributionSet} to
* of the * consider
* {@link org.eclipse.hawkbit.repository.model.DistributionSet} to * @param targetFilterQuery to execute
* consider
* @param targetFilterQuery
* to execute
* @return true if it matches * @return true if it matches
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_READ_TARGET)
@@ -867,22 +707,14 @@ public interface TargetManagement {
/** /**
* Creates a list of target meta data entries. * Creates a list of target meta data entries.
* *
* @param controllerId * @param controllerId {@link Target} controller id the metadata has to be created for
* {@link Target} controller id the metadata has to be created for * @param metadata the meta data entries to create or update
* @param metadata
* the meta data entries to create or update
* @return the updated or created target metadata entries * @return the updated or created target metadata entries
* * @throws EntityNotFoundException if given target does not exist
* @throws EntityNotFoundException * @throws EntityAlreadyExistsException in case one of the metadata entry already exists for the specific
* if given target does not exist * key
* * @throws AssignmentQuotaExceededException if the maximum number of {@link MetaData} entries is exceeded for
* @throws EntityAlreadyExistsException * the addressed {@link Target}
* in case one of the metadata entry already exists for the specific
* key
*
* @throws AssignmentQuotaExceededException
* if the maximum number of {@link MetaData} entries is exceeded for
* the addressed {@link Target}
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
List<TargetMetadata> createMetaData(@NotEmpty String controllerId, @NotEmpty Collection<MetaData> metadata); List<TargetMetadata> createMetaData(@NotEmpty String controllerId, @NotEmpty Collection<MetaData> metadata);
@@ -890,13 +722,9 @@ public interface TargetManagement {
/** /**
* Deletes a target meta data entry. * Deletes a target meta data entry.
* *
* @param controllerId * @param controllerId where metadata has to be deleted
* where metadata has to be deleted * @param key of the meta data element
* @param key * @throws EntityNotFoundException if given target does not exist
* of the meta data element
*
* @throws EntityNotFoundException
* if given target does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
void deleteMetaData(@NotEmpty String controllerId, @NotEmpty String key); void deleteMetaData(@NotEmpty String controllerId, @NotEmpty String key);
@@ -904,15 +732,10 @@ public interface TargetManagement {
/** /**
* Finds all meta data by the given target id. * Finds all meta data by the given target id.
* *
* @param pageable * @param pageable the page request to page the result
* the page request to page the result * @param controllerId the controller id to retrieve the metadata from
* @param controllerId
* the controller id to retrieve the metadata from
*
* @return a paged result of all meta data entries for a given target id * @return a paged result of all meta data entries for a given target id
* * @throws EntityNotFoundException if target with given ID does not exist
* @throws EntityNotFoundException
* if target with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Page<TargetMetadata> findMetaDataByControllerId(@NotNull Pageable pageable, @NotEmpty String controllerId); Page<TargetMetadata> findMetaDataByControllerId(@NotNull Pageable pageable, @NotEmpty String controllerId);
@@ -920,13 +743,9 @@ public interface TargetManagement {
/** /**
* Counts all meta data by the given target id. * Counts all meta data by the given target id.
* *
* @param controllerId * @param controllerId the controller id to retrieve the meta data from
* the controller id to retrieve the meta data from
*
* @return count of all meta data entries for a given target id * @return count of all meta data entries for a given target id
* * @throws EntityNotFoundException if target with given ID does not exist
* @throws EntityNotFoundException
* if target with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
long countMetaDataByControllerId(@NotEmpty String controllerId); long countMetaDataByControllerId(@NotEmpty String controllerId);
@@ -934,24 +753,14 @@ public interface TargetManagement {
/** /**
* Finds all metadata by the given target id and query. * Finds all metadata by the given target id and query.
* *
* @param pageable * @param pageable the page request to page the result
* the page request to page the result * @param controllerId the controller id to retrieve the metadata from
* @param controllerId * @param rsqlParam rsql query string
* the controller id to retrieve the metadata from
* @param rsqlParam
* rsql query string
*
* @return a paged result of all meta data entries for a given target id * @return a paged result of all meta data entries for a given target id
* * @throws RSQLParameterUnsupportedFieldException if a field in the RSQL string is used but not provided by the
* @throws RSQLParameterUnsupportedFieldException * given {@code fieldNameProvider}
* if a field in the RSQL string is used but not provided by the * @throws RSQLParameterSyntaxException if the RSQL syntax is wrong
* given {@code fieldNameProvider} * @throws EntityNotFoundException if target with given ID does not exist
*
* @throws RSQLParameterSyntaxException
* if the RSQL syntax is wrong
*
* @throws EntityNotFoundException
* if target with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Page<TargetMetadata> findMetaDataByControllerIdAndRsql(@NotNull Pageable pageable, @NotEmpty String controllerId, Page<TargetMetadata> findMetaDataByControllerIdAndRsql(@NotNull Pageable pageable, @NotEmpty String controllerId,
@@ -960,14 +769,10 @@ public interface TargetManagement {
/** /**
* Finds a single target meta data by its id. * Finds a single target meta data by its id.
* *
* @param controllerId * @param controllerId of the {@link Target}
* of the {@link Target} * @param key of the meta data element
* @param key
* of the meta data element
* @return the found TargetMetadata * @return the found TargetMetadata
* * @throws EntityNotFoundException if target with given ID does not exist
* @throws EntityNotFoundException
* if target with given ID does not exist
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Optional<TargetMetadata> getMetaDataByControllerId(@NotEmpty String controllerId, @NotEmpty String key); Optional<TargetMetadata> getMetaDataByControllerId(@NotEmpty String controllerId, @NotEmpty String key);
@@ -975,14 +780,10 @@ public interface TargetManagement {
/** /**
* Updates a target meta data value if corresponding entry exists. * Updates a target meta data value if corresponding entry exists.
* *
* @param controllerId * @param controllerId {@link Target} controller id of the metadata entry to be updated
* {@link Target} controller id of the metadata entry to be updated * @param metadata meta data entry to be updated
* @param metadata
* meta data entry to be updated
* @return the updated meta data entry * @return the updated meta data entry
* * @throws EntityNotFoundException in case the metadata entry does not exist and cannot be updated
* @throws EntityNotFoundException
* in case the metadata entry does not exist and cannot be updated
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
TargetMetadata updateMetadata(@NotEmpty String controllerId, @NotNull MetaData metadata); TargetMetadata updateMetadata(@NotEmpty String controllerId, @NotNull MetaData metadata);
@@ -993,11 +794,11 @@ public interface TargetManagement {
* assigned, they will be. Only if all of them have the tag already assigned * assigned, they will be. Only if all of them have the tag already assigned
* they will be removed instead. * they will be removed instead.
* *
* @deprecated since 0.6.0 - not very usable with very unclear logic
* @param controllerIds to toggle for * @param controllerIds to toggle for
* @param tagName to toggle * @param tagName to toggle
* @return TagAssigmentResult with all metadata of the assignment outcome. * @return TagAssigmentResult with all metadata of the assignment outcome.
* @throws EntityNotFoundException if tag with given name does not exist * @throws EntityNotFoundException if tag with given name does not exist
* @deprecated since 0.6.0 - not very usable with very unclear logic
*/ */
@Deprecated @Deprecated
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
@@ -1006,11 +807,11 @@ public interface TargetManagement {
/** /**
* Un-assign a {@link TargetTag} assignment to given {@link Target}. * Un-assign a {@link TargetTag} assignment to given {@link Target}.
* *
* @deprecated since 0.6.0 - use {@link #unassignTag(Collection, long)} (List, long)} instead
* @param controllerId to un-assign for * @param controllerId to un-assign for
* @param targetTagId to un-assign * @param targetTagId to un-assign
* @return the unassigned target or <null> if no target is unassigned * @return the unassigned target or <null> if no target is unassigned
* @throws EntityNotFoundException if TAG with given ID does not exist * @throws EntityNotFoundException if TAG with given ID does not exist
* @deprecated since 0.6.0 - use {@link #unassignTag(Collection, long)} (List, long)} instead
*/ */
@Deprecated(forRemoval = true) @Deprecated(forRemoval = true)
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)

View File

@@ -12,7 +12,6 @@ package org.eclipse.hawkbit.repository;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.Set;
import jakarta.validation.ConstraintViolationException; import jakarta.validation.ConstraintViolationException;
import jakarta.validation.Valid; import jakarta.validation.Valid;
@@ -92,7 +91,7 @@ public interface TargetTagManagement {
* @param rsqlParam rsql query string * @param rsqlParam rsql query string
* @return the found {@link Target}s, never {@code null} * @return the found {@link Target}s, never {@code null}
* @throws RSQLParameterUnsupportedFieldException if a field in the RSQL string is used but not provided by the * @throws RSQLParameterUnsupportedFieldException if a field in the RSQL string is used but not provided by the
* given {@code fieldNameProvider} * given {@code fieldNameProvider}
* @throws RSQLParameterSyntaxException if the RSQL syntax is wrong * @throws RSQLParameterSyntaxException if the RSQL syntax is wrong
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
@@ -130,7 +129,6 @@ public interface TargetTagManagement {
* *
* @param update the {@link TargetTag} with updated values * @param update the {@link TargetTag} with updated values
* @return the updated {@link TargetTag} * @return the updated {@link TargetTag}
*
* @throws EntityNotFoundException in case the {@link TargetTag} does not exist and cannot be updated * @throws EntityNotFoundException in case the {@link TargetTag} does not exist and cannot be updated
* @throws ConstraintViolationException if fields are not filled as specified. Check {@link TagUpdate} for field constraints. * @throws ConstraintViolationException if fields are not filled as specified. Check {@link TagUpdate} for field constraints.
*/ */

View File

@@ -28,21 +28,18 @@ import org.springframework.security.access.prepost.PreAuthorize;
/** /**
* Management service for {@link TargetType}s. * Management service for {@link TargetType}s.
*
*/ */
public interface TargetTypeManagement { public interface TargetTypeManagement {
/** /**
* @param key * @param key as {@link TargetType#getKey()}
* as {@link TargetType#getKey()}
* @return {@link TargetType} * @return {@link TargetType}
*/ */
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Optional<TargetType> getByKey(@NotEmpty String key); Optional<TargetType> getByKey(@NotEmpty String key);
/** /**
* @param name * @param name as {@link TargetType#getName()}
* as {@link TargetType#getName()}
* @return {@link TargetType} * @return {@link TargetType}
*/ */
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_TARGET)
@@ -55,49 +52,42 @@ public interface TargetTypeManagement {
long count(); long count();
/** /**
* @param name * @param name as {@link TargetType#getName()}
* as {@link TargetType#getName()}
* @return total count by name * @return total count by name
*/ */
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_TARGET)
long countByName(String name); long countByName(String name);
/** /**
* @param create * @param create TargetTypeCreate
* TargetTypeCreate
* @return targetType * @return targetType
*/ */
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_CREATE_TARGET) @PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
TargetType create(@NotNull @Valid TargetTypeCreate create); TargetType create(@NotNull @Valid TargetTypeCreate create);
/** /**
* @param creates * @param creates List of TargetTypeCreate
* List of TargetTypeCreate
* @return List of targetType * @return List of targetType
*/ */
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_CREATE_TARGET) @PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
List<TargetType> create(@NotEmpty @Valid Collection<TargetTypeCreate> creates); List<TargetType> create(@NotEmpty @Valid Collection<TargetTypeCreate> creates);
/** /**
* @param id * @param id targetTypeId
* targetTypeId
*/ */
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_DELETE_TARGET) @PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_DELETE_TARGET)
void delete(@NotNull Long id); void delete(@NotNull Long id);
/** /**
* @param pageable * @param pageable Page
* Page
* @return TargetType page * @return TargetType page
*/ */
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Slice<TargetType> findAll(@NotNull Pageable pageable); Slice<TargetType> findAll(@NotNull Pageable pageable);
/** /**
* @param pageable * @param pageable Page
* Page * @param rsqlParam query param
* @param rsqlParam
* query param
* @return Target type * @return Target type
*/ */
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_TARGET)
@@ -106,44 +96,37 @@ public interface TargetTypeManagement {
/** /**
* Retrieves {@link TargetType}s by filtering on the given parameters. * Retrieves {@link TargetType}s by filtering on the given parameters.
* *
* @param pageable * @param pageable page parameter
* page parameter * @param name has text of filters to be applied.
* @param name
* has text of filters to be applied.
* @return the page of found {@link TargetType} * @return the page of found {@link TargetType}
*/ */
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Slice<TargetType> findByName(@NotNull Pageable pageable, String name); Slice<TargetType> findByName(@NotNull Pageable pageable, String name);
/** /**
* @param id * @param id Target type ID
* Target type ID
* @return Target Type * @return Target Type
*/ */
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Optional<TargetType> get(long id); Optional<TargetType> get(long id);
/** /**
* @param ids * @param ids List of Target type ID
* List of Target type ID
* @return Target type list * @return Target type list
*/ */
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_TARGET)
List<TargetType> get(@NotEmpty Collection<Long> ids); List<TargetType> get(@NotEmpty Collection<Long> ids);
/** /**
* @param update * @param update TargetTypeUpdate
* TargetTypeUpdate
* @return Target Type * @return Target Type
*/ */
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET) @PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
TargetType update(@NotNull @Valid TargetTypeUpdate update); TargetType update(@NotNull @Valid TargetTypeUpdate update);
/** /**
* @param id * @param id Target type ID
* Target type ID * @param distributionSetTypeIds Distribution set ID
* @param distributionSetTypeIds
* Distribution set ID
* @return Target type * @return Target type
*/ */
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET) @PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
@@ -151,10 +134,8 @@ public interface TargetTypeManagement {
@NotEmpty Collection<Long> distributionSetTypeIds); @NotEmpty Collection<Long> distributionSetTypeIds);
/** /**
* @param id * @param id Target type ID
* Target type ID * @param distributionSetTypeIds Distribution set ID
* @param distributionSetTypeIds
* Distribution set ID
* @return Target type * @return Target type
*/ */
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET) @PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)

View File

@@ -30,25 +30,19 @@ import org.springframework.security.access.prepost.PreAuthorize;
/** /**
* Management service for tenant configurations. * Management service for tenant configurations.
*
*/ */
public interface TenantConfigurationManagement { public interface TenantConfigurationManagement {
/** /**
* Adds or updates a specific configuration for a specific tenant. * Adds or updates a specific configuration for a specific tenant.
* *
* * @param configurationKeyName the key of the configuration
* @param configurationKeyName * @param value the configuration value which will be written into the
* the key of the configuration * database.
* @param value
* the configuration value which will be written into the
* database.
* @return the configuration value which was just written into the database. * @return the configuration value which was just written into the database.
* @throws TenantConfigurationValidatorException * @throws TenantConfigurationValidatorException if the {@code propertyType} and the value in general does not
* if the {@code propertyType} and the value in general does not * match the expected type and format defined by the Key
* match the expected type and format defined by the Key * @throws ConversionFailedException if the property cannot be converted to the given
* @throws ConversionFailedException
* if the property cannot be converted to the given
*/ */
@PreAuthorize(value = SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION) @PreAuthorize(value = SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION)
<T extends Serializable> TenantConfigurationValue<T> addOrUpdateConfiguration(String configurationKeyName, T value); <T extends Serializable> TenantConfigurationValue<T> addOrUpdateConfiguration(String configurationKeyName, T value);
@@ -56,25 +50,20 @@ public interface TenantConfigurationManagement {
/** /**
* Adds or updates a specific configuration for a specific tenant. * Adds or updates a specific configuration for a specific tenant.
* *
* * @param configurations map containing the key - value of the configuration
* @param configurations
* map containing the key - value of the configuration
* @return map of all configuration values which were written into the database. * @return map of all configuration values which were written into the database.
* @throws TenantConfigurationValidatorException * @throws TenantConfigurationValidatorException if the {@code propertyType} and the value in general does not
* if the {@code propertyType} and the value in general does not * match the expected type and format defined by the Key
* match the expected type and format defined by the Key * @throws ConversionFailedException if the property cannot be converted to the given
* @throws ConversionFailedException
* if the property cannot be converted to the given
*/ */
@PreAuthorize(value = SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION) @PreAuthorize(value = SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION)
<T extends Serializable> Map<String, TenantConfigurationValue<T>> addOrUpdateConfiguration(Map<String, T> configurations); <T extends Serializable> Map<String, TenantConfigurationValue<T>> addOrUpdateConfiguration(Map<String, T> configurations);
/** /**
* Deletes a specific configuration for the current tenant. Does nothing in * Deletes a specific configuration for the current tenant. Does nothing in
* case there is no tenant specific configuration value. * case there is no tenant specific configuration value.
* *
* @param configurationKey * @param configurationKey the configuration key to be deleted
* the configuration key to be deleted
*/ */
@PreAuthorize(value = SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION) @PreAuthorize(value = SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION)
void deleteConfiguration(String configurationKey); void deleteConfiguration(String configurationKey);
@@ -84,18 +73,15 @@ public interface TenantConfigurationManagement {
* configuration values or in case the tenant does not a have a specific * configuration values or in case the tenant does not a have a specific
* configuration the global default value hold in the {@link Environment}. * configuration the global default value hold in the {@link Environment}.
* *
* @param configurationKeyName * @param configurationKeyName the key of the configuration
* the key of the configuration
* @return the converted configuration value either from the tenant specific * @return the converted configuration value either from the tenant specific
* configuration stored or from the fall back default values or * configuration stored or from the fall back default values or
* {@code null} in case key has not been configured and not default * {@code null} in case key has not been configured and not default
* value exists * value exists
* @throws TenantConfigurationValidatorException * @throws TenantConfigurationValidatorException if the {@code propertyType} and the value in general does not
* if the {@code propertyType} and the value in general does not * match the expected type and format defined by the Key
* match the expected type and format defined by the Key * @throws ConversionFailedException if the property cannot be converted to the given
* @throws ConversionFailedException * {@code propertyType}
* if the property cannot be converted to the given
* {@code propertyType}
*/ */
@PreAuthorize(value = SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION_READ) @PreAuthorize(value = SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION_READ)
<T extends Serializable> TenantConfigurationValue<T> getConfigurationValue(String configurationKeyName); <T extends Serializable> TenantConfigurationValue<T> getConfigurationValue(String configurationKeyName);
@@ -105,23 +91,18 @@ public interface TenantConfigurationManagement {
* configuration values or in case the tenant does not a have a specific * configuration values or in case the tenant does not a have a specific
* configuration the global default value hold in the {@link Environment}. * configuration the global default value hold in the {@link Environment}.
* *
* @param <T> * @param <T> the type of the configuration value
* the type of the configuration value * @param configurationKeyName the key of the configuration
* @param configurationKeyName * @param propertyType the type of the configuration value, e.g. {@code String.class}
* the key of the configuration * , {@code Integer.class}, etc
* @param propertyType
* the type of the configuration value, e.g. {@code String.class}
* , {@code Integer.class}, etc
* @return the converted configuration value either from the tenant specific * @return the converted configuration value either from the tenant specific
* configuration stored or from the fallback default values or * configuration stored or from the fallback default values or
* {@code null} in case key has not been configured and not default * {@code null} in case key has not been configured and not default
* value exists * value exists
* @throws TenantConfigurationValidatorException * @throws TenantConfigurationValidatorException if the {@code propertyType} and the value in general does not
* if the {@code propertyType} and the value in general does not * match the expected type and format defined by the Key
* match the expected type and format defined by the Key * @throws ConversionFailedException if the property cannot be converted to the given
* @throws ConversionFailedException * {@code propertyType}
* if the property cannot be converted to the given
* {@code propertyType}
*/ */
@PreAuthorize(value = SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION_READ) @PreAuthorize(value = SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION_READ)
<T extends Serializable> TenantConfigurationValue<T> getConfigurationValue(String configurationKeyName, <T extends Serializable> TenantConfigurationValue<T> getConfigurationValue(String configurationKeyName,
@@ -131,21 +112,16 @@ public interface TenantConfigurationManagement {
* returns the global configuration property either defined in the property * returns the global configuration property either defined in the property
* file or an default value otherwise. * file or an default value otherwise.
* *
* @param <T> * @param <T> the type of the configuration value
* the type of the configuration value * @param configurationKeyName the key of the configuration
* @param configurationKeyName * @param propertyType the type of the configuration value, e.g. {@code String.class}
* the key of the configuration * , {@code Integer.class}, etc
* @param propertyType
* the type of the configuration value, e.g. {@code String.class}
* , {@code Integer.class}, etc
* @return the global configured value * @return the global configured value
* @throws TenantConfigurationValidatorException * @throws TenantConfigurationValidatorException if the {@code propertyType} and the value in the property
* if the {@code propertyType} and the value in the property * file or the default value does not match the expected type
* file or the default value does not match the expected type * and format defined by the Key
* and format defined by the Key * @throws ConversionFailedException if the property cannot be converted to the given
* @throws ConversionFailedException * {@code propertyType}
* if the property cannot be converted to the given
* {@code propertyType}
*/ */
@PreAuthorize(value = SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION_READ) @PreAuthorize(value = SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION_READ)
<T> T getGlobalConfigurationValue(String configurationKeyName, Class<T> propertyType); <T> T getGlobalConfigurationValue(String configurationKeyName, Class<T> propertyType);

View File

@@ -15,7 +15,6 @@ import org.springframework.security.access.prepost.PreAuthorize;
/** /**
* Management service for statistics of a single tenant. * Management service for statistics of a single tenant.
*
*/ */
@FunctionalInterface @FunctionalInterface
public interface TenantStatsManagement { public interface TenantStatsManagement {

View File

@@ -19,7 +19,6 @@ import jakarta.validation.Payload;
/** /**
* Constraint for strings submitted into the repository. * Constraint for strings submitted into the repository.
*
*/ */
@Constraint(validatedBy = ValidStringValidator.class) @Constraint(validatedBy = ValidStringValidator.class)
@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, @Target({ ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR,

View File

@@ -9,11 +9,10 @@
*/ */
package org.eclipse.hawkbit.repository; package org.eclipse.hawkbit.repository;
import com.cronutils.utils.StringUtils;
import jakarta.validation.ConstraintValidator; import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext; import jakarta.validation.ConstraintValidatorContext;
import com.cronutils.utils.StringUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import org.jsoup.nodes.Document; import org.jsoup.nodes.Document;
@@ -34,15 +33,6 @@ public class ValidStringValidator implements ConstraintValidator<ValidString, St
return StringUtils.isEmpty(value) || isValidString(value); return StringUtils.isEmpty(value) || isValidString(value);
} }
private boolean isValidString(final String value) {
try {
return cleaner.isValid(stringToDocument(value));
} catch (final Exception ex) {
log.error(String.format("There was an exception during bean field value (%s) validation", value), ex);
return false;
}
}
private static Document stringToDocument(final String value) { private static Document stringToDocument(final String value) {
final Document xmlFragment = Jsoup.parse(value, "", Parser.xmlParser()); final Document xmlFragment = Jsoup.parse(value, "", Parser.xmlParser());
final Document resultingDocument = Document.createShell(""); final Document resultingDocument = Document.createShell("");
@@ -51,4 +41,13 @@ public class ValidStringValidator implements ConstraintValidator<ValidString, St
return resultingDocument; return resultingDocument;
} }
private boolean isValidString(final String value) {
try {
return cleaner.isValid(stringToDocument(value));
} catch (final Exception ex) {
log.error(String.format("There was an exception during bean field value (%s) validation", value), ex);
return false;
}
}
} }

View File

@@ -25,8 +25,7 @@ public interface AutoAssignExecutor {
/** /**
* Method performs an auto assign check for a specific device only * Method performs an auto assign check for a specific device only
* *
* @param controllerId * @param controllerId of the device to check
* of the device to check
*/ */
void checkSingleTarget(String controllerId); void checkSingleTarget(String controllerId);

View File

@@ -13,14 +13,12 @@ import org.eclipse.hawkbit.repository.model.ActionStatus;
/** /**
* Builder for {@link ActionStatus}. * Builder for {@link ActionStatus}.
*
*/ */
@FunctionalInterface @FunctionalInterface
public interface ActionStatusBuilder { public interface ActionStatusBuilder {
/** /**
* @param actionId * @param actionId the status is for
* the status is for
* @return create builder * @return create builder
*/ */
ActionStatusCreate create(long actionId); ActionStatusCreate create(long actionId);

View File

@@ -21,19 +21,17 @@ import org.eclipse.hawkbit.repository.model.BaseEntity;
* Builder to create a new {@link ActionStatus} entry. Defines all fields that * Builder to create a new {@link ActionStatus} entry. Defines all fields that
* can be set at creation time. Other fields are set by the repository * can be set at creation time. Other fields are set by the repository
* automatically, e.g. {@link BaseEntity#getCreatedAt()}. * automatically, e.g. {@link BaseEntity#getCreatedAt()}.
*
*/ */
public interface ActionStatusCreate { public interface ActionStatusCreate {
/** /**
* @param status * @param status {@link ActionStatus#getStatus()}
* {@link ActionStatus#getStatus()}
* @return updated {@link ActionStatusCreate} object * @return updated {@link ActionStatusCreate} object
*/ */
ActionStatusCreate status(@NotNull Status status); ActionStatusCreate status(@NotNull Status status);
/** /**
* @param occurredAt * @param occurredAt for {@link ActionStatus#getOccurredAt()}
* for {@link ActionStatus#getOccurredAt()}
* @return updated {@link ActionStatusCreate} object * @return updated {@link ActionStatusCreate} object
*/ */
ActionStatusCreate occurredAt(long occurredAt); ActionStatusCreate occurredAt(long occurredAt);
@@ -41,15 +39,13 @@ public interface ActionStatusCreate {
ActionStatusCreate code(int code); ActionStatusCreate code(int code);
/** /**
* @param messages * @param messages for {@link ActionStatus#getMessages()}
* for {@link ActionStatus#getMessages()}
* @return updated {@link ActionStatusCreate} object * @return updated {@link ActionStatusCreate} object
*/ */
ActionStatusCreate messages(Collection<String> messages); ActionStatusCreate messages(Collection<String> messages);
/** /**
* @param message * @param message for {@link ActionStatus#getMessages()}
* for {@link ActionStatus#getMessages()}
* @return updated {@link ActionStatusCreate} object * @return updated {@link ActionStatusCreate} object
*/ */
ActionStatusCreate message(String message); ActionStatusCreate message(String message);

View File

@@ -42,8 +42,7 @@ public class AutoAssignDistributionSetUpdate {
/** /**
* Constructor * Constructor
* *
* @param targetFilterId * @param targetFilterId ID of {@link TargetFilterQuery} to update
* ID of {@link TargetFilterQuery} to update
*/ */
public AutoAssignDistributionSetUpdate(final long targetFilterId) { public AutoAssignDistributionSetUpdate(final long targetFilterId) {
this.targetFilterId = targetFilterId; this.targetFilterId = targetFilterId;
@@ -52,8 +51,7 @@ public class AutoAssignDistributionSetUpdate {
/** /**
* Specify {@link DistributionSet} * Specify {@link DistributionSet}
* *
* @param dsId * @param dsId ID of the {@link DistributionSet}
* ID of the {@link DistributionSet}
* @return updated builder instance * @return updated builder instance
*/ */
public AutoAssignDistributionSetUpdate ds(final Long dsId) { public AutoAssignDistributionSetUpdate ds(final Long dsId) {
@@ -64,8 +62,7 @@ public class AutoAssignDistributionSetUpdate {
/** /**
* Specify {@link DistributionSet} * Specify {@link DistributionSet}
* *
* @param actionType * @param actionType {@link ActionType} used for the auto assignment
* {@link ActionType} used for the auto assignment
* @return updated builder instance * @return updated builder instance
*/ */
public AutoAssignDistributionSetUpdate actionType(final ActionType actionType) { public AutoAssignDistributionSetUpdate actionType(final ActionType actionType) {
@@ -76,8 +73,7 @@ public class AutoAssignDistributionSetUpdate {
/** /**
* Specify weight of resulting {@link Action} * Specify weight of resulting {@link Action}
* *
* @param weight * @param weight weight used for the auto assignment
* weight used for the auto assignment
* @return updated builder instance * @return updated builder instance
*/ */
public AutoAssignDistributionSetUpdate weight(final Integer weight) { public AutoAssignDistributionSetUpdate weight(final Integer weight) {
@@ -88,9 +84,8 @@ public class AutoAssignDistributionSetUpdate {
/** /**
* Specify initial confirmation state of resulting {@link Action} * Specify initial confirmation state of resulting {@link Action}
* *
* @param confirmationRequired * @param confirmationRequired if confirmation is required for this auto assignment (considered
* if confirmation is required for this auto assignment (considered * with confirmation flow active)
* with confirmation flow active)
* @return updated builder instance * @return updated builder instance
*/ */
public AutoAssignDistributionSetUpdate confirmationRequired(final boolean confirmationRequired) { public AutoAssignDistributionSetUpdate confirmationRequired(final boolean confirmationRequired) {

View File

@@ -13,13 +13,11 @@ import org.eclipse.hawkbit.repository.model.DistributionSet;
/** /**
* Builder for {@link DistributionSet}. * Builder for {@link DistributionSet}.
*
*/ */
public interface DistributionSetBuilder { public interface DistributionSetBuilder {
/** /**
* @param id * @param id of the updatable entity
* of the updatable entity
* @return builder instance * @return builder instance
*/ */
DistributionSetUpdate update(long id); DistributionSetUpdate update(long id);

View File

@@ -25,41 +25,35 @@ import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
* Builder to create a new {@link DistributionSet} entry. Defines all fields * 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 * that can be set at creation time. Other fields are set by the repository
* automatically, e.g. {@link BaseEntity#getCreatedAt()}. * automatically, e.g. {@link BaseEntity#getCreatedAt()}.
*
*/ */
public interface DistributionSetCreate { public interface DistributionSetCreate {
/** /**
* @param name * @param name for {@link DistributionSet#getName()}
* for {@link DistributionSet#getName()}
* @return updated builder instance * @return updated builder instance
*/ */
DistributionSetCreate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name); DistributionSetCreate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name);
/** /**
* @param version * @param version for {@link DistributionSet#getVersion()}
* for {@link DistributionSet#getVersion()}
* @return updated builder instance * @return updated builder instance
*/ */
DistributionSetCreate version(@Size(min = 1, max = NamedVersionedEntity.VERSION_MAX_SIZE) @NotNull String version); DistributionSetCreate version(@Size(min = 1, max = NamedVersionedEntity.VERSION_MAX_SIZE) @NotNull String version);
/** /**
* @param description * @param description for {@link DistributionSet#getDescription()}
* for {@link DistributionSet#getDescription()}
* @return updated builder instance * @return updated builder instance
*/ */
DistributionSetCreate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description); DistributionSetCreate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
/** /**
* @param typeKey * @param typeKey for {@link DistributionSet#getType()}
* for {@link DistributionSet#getType()}
* @return updated builder instance * @return updated builder instance
*/ */
DistributionSetCreate type(@Size(min = 1, max = DistributionSetType.KEY_MAX_SIZE) @NotNull String typeKey); DistributionSetCreate type(@Size(min = 1, max = DistributionSetType.KEY_MAX_SIZE) @NotNull String typeKey);
/** /**
* @param type * @param type for {@link DistributionSet#getType()}
* for {@link DistributionSet#getType()}
* @return updated builder instance * @return updated builder instance
*/ */
default DistributionSetCreate type(final DistributionSetType type) { default DistributionSetCreate type(final DistributionSetType type) {
@@ -67,15 +61,13 @@ public interface DistributionSetCreate {
} }
/** /**
* @param modules * @param modules for {@link DistributionSet#getModules()}
* for {@link DistributionSet#getModules()}
* @return updated builder instance * @return updated builder instance
*/ */
DistributionSetCreate modules(Collection<Long> modules); DistributionSetCreate modules(Collection<Long> modules);
/** /**
* @param requiredMigrationStep * @param requiredMigrationStep for {@link DistributionSet#isRequiredMigrationStep()}
* for {@link DistributionSet#isRequiredMigrationStep()}
* @return updated builder instance * @return updated builder instance
*/ */
DistributionSetCreate requiredMigrationStep(Boolean requiredMigrationStep); DistributionSetCreate requiredMigrationStep(Boolean requiredMigrationStep);

View File

@@ -13,13 +13,11 @@ import org.eclipse.hawkbit.repository.model.DistributionSetType;
/** /**
* Builder for {@link DistributionSetType}. * Builder for {@link DistributionSetType}.
*
*/ */
public interface DistributionSetTypeBuilder { public interface DistributionSetTypeBuilder {
/** /**
* @param id * @param id of the updatable entity
* of the updatable entity
* @return builder instance * @return builder instance
*/ */
DistributionSetTypeUpdate update(long id); DistributionSetTypeUpdate update(long id);

View File

@@ -25,48 +25,41 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
* Builder to create a new {@link DistributionSetType} entry. Defines all fields * 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 * that can be set at creation time. Other fields are set by the repository
* automatically, e.g. {@link BaseEntity#getCreatedAt()}. * automatically, e.g. {@link BaseEntity#getCreatedAt()}.
*
*/ */
public interface DistributionSetTypeCreate { public interface DistributionSetTypeCreate {
/** /**
* @param key * @param key for {@link DistributionSetType#getKey()}
* for {@link DistributionSetType#getKey()}
* @return updated builder instance * @return updated builder instance
*/ */
DistributionSetTypeCreate key(@Size(min = 1, max = DistributionSetType.KEY_MAX_SIZE) @NotNull String key); DistributionSetTypeCreate key(@Size(min = 1, max = DistributionSetType.KEY_MAX_SIZE) @NotNull String key);
/** /**
* @param name * @param name for {@link DistributionSetType#getName()}
* for {@link DistributionSetType#getName()}
* @return updated builder instance * @return updated builder instance
*/ */
DistributionSetTypeCreate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name); DistributionSetTypeCreate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name);
/** /**
* @param description * @param description for {@link DistributionSetType#getDescription()}
* for {@link DistributionSetType#getDescription()}
* @return updated builder instance * @return updated builder instance
*/ */
DistributionSetTypeCreate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description); DistributionSetTypeCreate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
/** /**
* @param colour * @param colour for {@link DistributionSetType#getColour()}
* for {@link DistributionSetType#getColour()}
* @return updated builder instance * @return updated builder instance
*/ */
DistributionSetTypeCreate colour(@Size(max = DistributionSetType.COLOUR_MAX_SIZE) String colour); DistributionSetTypeCreate colour(@Size(max = DistributionSetType.COLOUR_MAX_SIZE) String colour);
/** /**
* @param mandatory * @param mandatory for {@link DistributionSetType#getMandatoryModuleTypes()}
* for {@link DistributionSetType#getMandatoryModuleTypes()}
* @return updated builder instance * @return updated builder instance
*/ */
DistributionSetTypeCreate mandatory(Collection<Long> mandatory); DistributionSetTypeCreate mandatory(Collection<Long> mandatory);
/** /**
* @param mandatory * @param mandatory for {@link DistributionSetType#getMandatoryModuleTypes()}
* for {@link DistributionSetType#getMandatoryModuleTypes()}
* @return updated builder instance * @return updated builder instance
*/ */
default DistributionSetTypeCreate mandatory(final Long mandatory) { default DistributionSetTypeCreate mandatory(final Long mandatory) {
@@ -74,8 +67,7 @@ public interface DistributionSetTypeCreate {
} }
/** /**
* @param mandatory * @param mandatory for {@link DistributionSetType#getOptionalModuleTypes()}
* for {@link DistributionSetType#getOptionalModuleTypes()}
* @return updated builder instance * @return updated builder instance
*/ */
default DistributionSetTypeCreate mandatory(final SoftwareModuleType mandatory) { default DistributionSetTypeCreate mandatory(final SoftwareModuleType mandatory) {
@@ -83,15 +75,13 @@ public interface DistributionSetTypeCreate {
} }
/** /**
* @param optional * @param optional for {@link DistributionSetType#getOptionalModuleTypes()}
* for {@link DistributionSetType#getOptionalModuleTypes()}
* @return updated builder instance * @return updated builder instance
*/ */
DistributionSetTypeCreate optional(Collection<Long> optional); DistributionSetTypeCreate optional(Collection<Long> optional);
/** /**
* @param optional * @param optional for {@link DistributionSetType#getOptionalModuleTypes()}
* for {@link DistributionSetType#getOptionalModuleTypes()}
* @return updated builder instance * @return updated builder instance
*/ */
default DistributionSetTypeCreate optional(final Long optional) { default DistributionSetTypeCreate optional(final Long optional) {
@@ -99,8 +89,7 @@ public interface DistributionSetTypeCreate {
} }
/** /**
* @param optional * @param optional for {@link DistributionSetType#getOptionalModuleTypes()}
* for {@link DistributionSetType#getOptionalModuleTypes()}
* @return updated builder instance * @return updated builder instance
*/ */
default DistributionSetTypeCreate optional(final SoftwareModuleType optional) { default DistributionSetTypeCreate optional(final SoftwareModuleType optional) {

View File

@@ -19,34 +19,29 @@ import org.eclipse.hawkbit.repository.model.NamedEntity;
/** /**
* Builder to update an existing {@link DistributionSetType} entry. Defines all * Builder to update an existing {@link DistributionSetType} entry. Defines all
* fields that can be updated. * fields that can be updated.
*
*/ */
public interface DistributionSetTypeUpdate { public interface DistributionSetTypeUpdate {
/** /**
* @param description * @param description for {@link DistributionSetType#getDescription()}
* for {@link DistributionSetType#getDescription()}
* @return updated builder instance * @return updated builder instance
*/ */
DistributionSetTypeUpdate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description); DistributionSetTypeUpdate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
/** /**
* @param colour * @param colour for {@link DistributionSetType#getColour()}
* for {@link DistributionSetType#getColour()}
* @return updated builder instance * @return updated builder instance
*/ */
DistributionSetTypeUpdate colour(@Size(max = DistributionSetType.COLOUR_MAX_SIZE) String colour); DistributionSetTypeUpdate colour(@Size(max = DistributionSetType.COLOUR_MAX_SIZE) String colour);
/** /**
* @param mandatory * @param mandatory for {@link DistributionSetType#getMandatoryModuleTypes()}
* for {@link DistributionSetType#getMandatoryModuleTypes()}
* @return updated builder instance * @return updated builder instance
*/ */
DistributionSetTypeUpdate mandatory(Collection<Long> mandatory); DistributionSetTypeUpdate mandatory(Collection<Long> mandatory);
/** /**
* @param optional * @param optional for {@link DistributionSetType#getOptionalModuleTypes()}
* for {@link DistributionSetType#getOptionalModuleTypes()}
* @return updated builder instance * @return updated builder instance
*/ */
DistributionSetTypeUpdate optional(Collection<Long> optional); DistributionSetTypeUpdate optional(Collection<Long> optional);

View File

@@ -17,14 +17,12 @@ import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.NamedEntity; import org.eclipse.hawkbit.repository.model.NamedEntity;
import org.eclipse.hawkbit.repository.model.NamedVersionedEntity; import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
import java.util.Optional;
/** /**
* Builder to update an existing {@link DistributionSet} entry. Defines all * Builder to update an existing {@link DistributionSet} entry. Defines all
* fields that can be updated. * fields that can be updated.
*
*/ */
public interface DistributionSetUpdate { public interface DistributionSetUpdate {
/** /**
* @param name for {@link DistributionSet#getName()} * @param name for {@link DistributionSet#getName()}
* @return updated builder instance * @return updated builder instance

View File

@@ -10,6 +10,7 @@
package org.eclipse.hawkbit.repository.builder; package org.eclipse.hawkbit.repository.builder;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import org.eclipse.hawkbit.repository.model.RolloutGroupConditions; import org.eclipse.hawkbit.repository.model.RolloutGroupConditions;

View File

@@ -25,7 +25,6 @@ import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
* Builder to create a new {@link Rollout} entry. Defines all fields that can be * Builder to create a new {@link Rollout} entry. Defines all fields that can be
* set at creation time. Other fields are set by the repository automatically, * set at creation time. Other fields are set by the repository automatically,
* e.g. {@link BaseEntity#getCreatedAt()}. * e.g. {@link BaseEntity#getCreatedAt()}.
*
*/ */
public interface RolloutCreate { public interface RolloutCreate {

View File

@@ -26,6 +26,7 @@ import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
* automatically, e.g. {@link BaseEntity#getCreatedAt()}. * automatically, e.g. {@link BaseEntity#getCreatedAt()}.
*/ */
public interface RolloutGroupCreate { public interface RolloutGroupCreate {
/** /**
* @param name for {@link Rollout#getName()} * @param name for {@link Rollout#getName()}
* @return updated builder instance * @return updated builder instance
@@ -59,7 +60,7 @@ public interface RolloutGroupCreate {
/** /**
* @param confirmationRequired if confirmation is required for this rollout group (considered * @param confirmationRequired if confirmation is required for this rollout group (considered
* with confirmation flow active) * with confirmation flow active)
* @return updated builder instance * @return updated builder instance
*/ */
RolloutGroupCreate confirmationRequired(boolean confirmationRequired); RolloutGroupCreate confirmationRequired(boolean confirmationRequired);

View File

@@ -20,6 +20,7 @@ import org.eclipse.hawkbit.repository.model.Rollout;
* can be updated. * can be updated.
*/ */
public interface RolloutUpdate { public interface RolloutUpdate {
/** /**
* Set name of the {@link Rollout} * Set name of the {@link Rollout}
* *

View File

@@ -13,13 +13,11 @@ import org.eclipse.hawkbit.repository.model.SoftwareModule;
/** /**
* Builder for {@link SoftwareModule}. * Builder for {@link SoftwareModule}.
*
*/ */
public interface SoftwareModuleBuilder { public interface SoftwareModuleBuilder {
/** /**
* @param id * @param id of the updatable entity
* of the updatable entity
* @return builder instance * @return builder instance
*/ */
SoftwareModuleUpdate update(long id); SoftwareModuleUpdate update(long id);

View File

@@ -24,47 +24,41 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
* Builder to create a new {@link SoftwareModule} entry. Defines all fields that * 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 * can be set at creation time. Other fields are set by the repository
* automatically, e.g. {@link BaseEntity#getCreatedAt()}. * automatically, e.g. {@link BaseEntity#getCreatedAt()}.
*
*/ */
public interface SoftwareModuleCreate { public interface SoftwareModuleCreate {
/** /**
* @param name * @param name for {@link SoftwareModule#getName()}
* for {@link SoftwareModule#getName()}
* @return updated builder instance * @return updated builder instance
*/ */
SoftwareModuleCreate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name); SoftwareModuleCreate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name);
/** /**
* @param version * @param version for {@link SoftwareModule#getVersion()}
* for {@link SoftwareModule#getVersion()}
* @return updated builder instance * @return updated builder instance
*/ */
SoftwareModuleCreate version(@Size(min = 1, max = NamedVersionedEntity.VERSION_MAX_SIZE) @NotNull String version); SoftwareModuleCreate version(@Size(min = 1, max = NamedVersionedEntity.VERSION_MAX_SIZE) @NotNull String version);
/** /**
* @param description * @param description for {@link SoftwareModule#getDescription()}
* for {@link SoftwareModule#getDescription()}
* @return updated builder instance * @return updated builder instance
*/ */
SoftwareModuleCreate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description); SoftwareModuleCreate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
/** /**
* @param vendor * @param vendor for {@link SoftwareModule#getVendor()}
* for {@link SoftwareModule#getVendor()}
* @return updated builder instance * @return updated builder instance
*/ */
SoftwareModuleCreate vendor(@Size(max = SoftwareModule.VENDOR_MAX_SIZE) String vendor); SoftwareModuleCreate vendor(@Size(max = SoftwareModule.VENDOR_MAX_SIZE) String vendor);
/** /**
* @param typeKey * @param typeKey for {@link SoftwareModule#getType()}
* for {@link SoftwareModule#getType()}
* @return updated builder instance * @return updated builder instance
*/ */
SoftwareModuleCreate type(@Size(min = 1, max = SoftwareModuleType.KEY_MAX_SIZE) @NotNull String typeKey); SoftwareModuleCreate type(@Size(min = 1, max = SoftwareModuleType.KEY_MAX_SIZE) @NotNull String typeKey);
/** /**
* @param type * @param type for {@link SoftwareModule#getType()}
* for {@link SoftwareModule#getType()}
* @return updated builder instance * @return updated builder instance
*/ */
default SoftwareModuleCreate type(final SoftwareModuleType type) { default SoftwareModuleCreate type(final SoftwareModuleType type) {
@@ -72,8 +66,7 @@ public interface SoftwareModuleCreate {
} }
/** /**
* @param encrypted * @param encrypted if should be encrypted
* if should be encrypted
* @return updated builder instance * @return updated builder instance
*/ */
SoftwareModuleCreate encrypted(boolean encrypted); SoftwareModuleCreate encrypted(boolean encrypted);

View File

@@ -15,22 +15,18 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
/** /**
* Builder for {@link SoftwareModuleMetadata}. * Builder for {@link SoftwareModuleMetadata}.
*
*/ */
public interface SoftwareModuleMetadataBuilder { public interface SoftwareModuleMetadataBuilder {
/** /**
* @param softwareModuleId * @param softwareModuleId of the {@link SoftwareModule} the {@link MetaData} belongs to
* of the {@link SoftwareModule} the {@link MetaData} belongs to * @param key of {@link MetaData#getKey()}
* @param key
* of {@link MetaData#getKey()}
* @return builder instance * @return builder instance
*/ */
SoftwareModuleMetadataUpdate update(long softwareModuleId, String key); SoftwareModuleMetadataUpdate update(long softwareModuleId, String key);
/** /**
* @param softwareModuleId * @param softwareModuleId of the {@link SoftwareModule} the {@link MetaData} belongs to
* of the {@link SoftwareModule} the {@link MetaData} belongs to
* @return builder instance * @return builder instance
*/ */
SoftwareModuleMetadataCreate create(long softwareModuleId); SoftwareModuleMetadataCreate create(long softwareModuleId);

View File

@@ -20,27 +20,23 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
* Builder to create a new {@link SoftwareModuleMetadata} entry. Defines all * Builder to create a new {@link SoftwareModuleMetadata} entry. Defines all
* fields that can be set at creation time. Other fields are set by the * fields that can be set at creation time. Other fields are set by the
* repository automatically, e.g. {@link BaseEntity#getCreatedAt()}. * repository automatically, e.g. {@link BaseEntity#getCreatedAt()}.
*
*/ */
public interface SoftwareModuleMetadataCreate { public interface SoftwareModuleMetadataCreate {
/** /**
* @param key * @param key for {@link MetaData#getKey()}
* for {@link MetaData#getKey()}
* @return updated builder instance * @return updated builder instance
*/ */
SoftwareModuleMetadataCreate key(@Size(min = 1, max = MetaData.KEY_MAX_SIZE) @NotNull String key); SoftwareModuleMetadataCreate key(@Size(min = 1, max = MetaData.KEY_MAX_SIZE) @NotNull String key);
/** /**
* @param value * @param value for {@link MetaData#getValue()}
* for {@link MetaData#getValue()}
* @return updated builder instance * @return updated builder instance
*/ */
SoftwareModuleMetadataCreate value(@Size(max = MetaData.VALUE_MAX_SIZE) String value); SoftwareModuleMetadataCreate value(@Size(max = MetaData.VALUE_MAX_SIZE) String value);
/** /**
* @param visible * @param visible for {@link SoftwareModuleMetadata#isTargetVisible()}
* for {@link SoftwareModuleMetadata#isTargetVisible()}
* @return updated builder instance * @return updated builder instance
*/ */
SoftwareModuleMetadataCreate targetVisible(Boolean visible); SoftwareModuleMetadataCreate targetVisible(Boolean visible);

View File

@@ -18,19 +18,17 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
/** /**
* Builder to update an existing {@link SoftwareModuleMetadata} entry. Defines * Builder to update an existing {@link SoftwareModuleMetadata} entry. Defines
* all fields that can be updated. * all fields that can be updated.
*
*/ */
public interface SoftwareModuleMetadataUpdate { public interface SoftwareModuleMetadataUpdate {
/** /**
* @param value * @param value for {@link MetaData#getValue()}
* for {@link MetaData#getValue()}
* @return updated builder instance * @return updated builder instance
*/ */
SoftwareModuleMetadataUpdate value(@Size(min = 1, max = MetaData.VALUE_MAX_SIZE) @NotNull String value); SoftwareModuleMetadataUpdate value(@Size(min = 1, max = MetaData.VALUE_MAX_SIZE) @NotNull String value);
/** /**
* @param visible * @param visible for {@link SoftwareModuleMetadata#isTargetVisible()}
* for {@link SoftwareModuleMetadata#isTargetVisible()}
* @return updated builder instance * @return updated builder instance
*/ */
SoftwareModuleMetadataUpdate targetVisible(Boolean visible); SoftwareModuleMetadataUpdate targetVisible(Boolean visible);

View File

@@ -13,13 +13,11 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
/** /**
* Builder for {@link SoftwareModuleType}. * Builder for {@link SoftwareModuleType}.
*
*/ */
public interface SoftwareModuleTypeBuilder { public interface SoftwareModuleTypeBuilder {
/** /**
* @param id * @param id of the updatable entity
* of the updatable entity
* @return builder instance * @return builder instance
*/ */
SoftwareModuleTypeUpdate update(long id); SoftwareModuleTypeUpdate update(long id);

View File

@@ -20,40 +20,35 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
* Builder to create a new {@link SoftwareModuleType} entry. Defines all fields * 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 * that can be set at creation time. Other fields are set by the repository
* automatically, e.g. {@link BaseEntity#getCreatedAt()}. * automatically, e.g. {@link BaseEntity#getCreatedAt()}.
*
*/ */
public interface SoftwareModuleTypeCreate { public interface SoftwareModuleTypeCreate {
/** /**
* @param key * @param key for {@link SoftwareModuleType#getKey()}
* for {@link SoftwareModuleType#getKey()}
* @return updated builder instance * @return updated builder instance
*/ */
SoftwareModuleTypeCreate key(@Size(min = 1, max = SoftwareModuleType.KEY_MAX_SIZE) @NotNull String key); SoftwareModuleTypeCreate key(@Size(min = 1, max = SoftwareModuleType.KEY_MAX_SIZE) @NotNull String key);
/** /**
* @param name * @param name for {@link SoftwareModuleType#getName()}
* for {@link SoftwareModuleType#getName()}
* @return updated builder instance * @return updated builder instance
*/ */
SoftwareModuleTypeCreate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name); SoftwareModuleTypeCreate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name);
/** /**
* @param description * @param description for {@link SoftwareModuleType#getDescription()}
* for {@link SoftwareModuleType#getDescription()}
* @return updated builder instance * @return updated builder instance
*/ */
SoftwareModuleTypeCreate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description); SoftwareModuleTypeCreate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
/** /**
* @param colour * @param colour for {@link SoftwareModuleType#getColour()}
* for {@link SoftwareModuleType#getColour()}
* @return updated builder instance * @return updated builder instance
*/ */
SoftwareModuleTypeCreate colour(@Size(max = SoftwareModuleType.COLOUR_MAX_SIZE) String colour); SoftwareModuleTypeCreate colour(@Size(max = SoftwareModuleType.COLOUR_MAX_SIZE) String colour);
/** /**
* @param maxAssignments * @param maxAssignments for {@link SoftwareModuleType#getMaxAssignments()}
* for {@link SoftwareModuleType#getMaxAssignments()}
* @return updated builder instance * @return updated builder instance
*/ */
SoftwareModuleTypeCreate maxAssignments(int maxAssignments); SoftwareModuleTypeCreate maxAssignments(int maxAssignments);

View File

@@ -17,19 +17,17 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
/** /**
* Builder to update an existing {@link SoftwareModuleType} entry. Defines all * Builder to update an existing {@link SoftwareModuleType} entry. Defines all
* fields that can be updated. * fields that can be updated.
*
*/ */
public interface SoftwareModuleTypeUpdate { public interface SoftwareModuleTypeUpdate {
/** /**
* @param description * @param description for {@link SoftwareModuleType#getDescription()}
* for {@link SoftwareModuleType#getDescription()}
* @return updated builder instance * @return updated builder instance
*/ */
SoftwareModuleTypeUpdate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description); SoftwareModuleTypeUpdate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
/** /**
* @param colour * @param colour for {@link SoftwareModuleType#getColour()}
* for {@link SoftwareModuleType#getColour()}
* @return updated builder instance * @return updated builder instance
*/ */
SoftwareModuleTypeUpdate colour(@Size(max = SoftwareModuleType.COLOUR_MAX_SIZE) String colour); SoftwareModuleTypeUpdate colour(@Size(max = SoftwareModuleType.COLOUR_MAX_SIZE) String colour);

View File

@@ -9,7 +9,6 @@
*/ */
package org.eclipse.hawkbit.repository.builder; package org.eclipse.hawkbit.repository.builder;
import jakarta.annotation.Nullable;
import jakarta.validation.constraints.Null; import jakarta.validation.constraints.Null;
import jakarta.validation.constraints.Size; import jakarta.validation.constraints.Size;
@@ -19,20 +18,17 @@ import org.eclipse.hawkbit.repository.model.SoftwareModule;
/** /**
* Builder to update an existing {@link SoftwareModule} entry. Defines all * Builder to update an existing {@link SoftwareModule} entry. Defines all
* fields that can be updated. * fields that can be updated.
*
*/ */
public interface SoftwareModuleUpdate { public interface SoftwareModuleUpdate {
/** /**
* @param description * @param description for {@link SoftwareModule#getDescription()}
* for {@link SoftwareModule#getDescription()}
* @return updated builder instance * @return updated builder instance
*/ */
SoftwareModuleUpdate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description); SoftwareModuleUpdate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
/** /**
* @param vendor * @param vendor for {@link SoftwareModule#getVendor()}
* for {@link SoftwareModule#getVendor()}
* @return updated builder instance * @return updated builder instance
*/ */
SoftwareModuleUpdate vendor(@Size(max = SoftwareModule.VENDOR_MAX_SIZE) String vendor); SoftwareModuleUpdate vendor(@Size(max = SoftwareModule.VENDOR_MAX_SIZE) String vendor);

View File

@@ -13,13 +13,11 @@ import org.eclipse.hawkbit.repository.model.Tag;
/** /**
* Builder for {@link Tag}. * Builder for {@link Tag}.
*
*/ */
public interface TagBuilder { public interface TagBuilder {
/** /**
* @param id * @param id of the updatable entity
* of the updatable entity
* @return builder instance * @return builder instance
*/ */
TagUpdate update(long id); TagUpdate update(long id);

View File

@@ -20,26 +20,23 @@ import org.eclipse.hawkbit.repository.model.Tag;
* Builder to create a new {@link Tag} entry. Defines all fields that can be set * Builder to create a new {@link Tag} entry. Defines all fields that can be set
* at creation time. Other fields are set by the repository automatically, e.g. * at creation time. Other fields are set by the repository automatically, e.g.
* {@link BaseEntity#getCreatedAt()}. * {@link BaseEntity#getCreatedAt()}.
*
*/ */
public interface TagCreate { public interface TagCreate {
/** /**
* @param name * @param name for {@link Tag#getName()}
* for {@link Tag#getName()}
* @return updated builder instance * @return updated builder instance
*/ */
TagCreate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name); TagCreate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name);
/** /**
* @param description * @param description for {@link Tag#getDescription()}
* for {@link Tag#getDescription()}
* @return updated builder instance * @return updated builder instance
*/ */
TagCreate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description); TagCreate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
/** /**
* @param colour * @param colour for {@link Tag#getColour()}
* for {@link Tag#getColour()}
* @return updated builder instance * @return updated builder instance
*/ */
TagCreate colour(@Size(max = Tag.COLOUR_MAX_SIZE) String colour); TagCreate colour(@Size(max = Tag.COLOUR_MAX_SIZE) String colour);

View File

@@ -18,26 +18,23 @@ import org.eclipse.hawkbit.repository.model.Tag;
/** /**
* Builder to update an existing {@link Tag} entry. Defines all fields that can * Builder to update an existing {@link Tag} entry. Defines all fields that can
* be updated. * be updated.
*
*/ */
public interface TagUpdate { public interface TagUpdate {
/** /**
* @param name * @param name for {@link Tag#getName()}
* for {@link Tag#getName()}
* @return updated builder instance * @return updated builder instance
*/ */
TagUpdate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name); TagUpdate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name);
/** /**
* @param description * @param description for {@link Tag#getDescription()}
* for {@link Tag#getDescription()}
* @return updated builder instance * @return updated builder instance
*/ */
TagUpdate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description); TagUpdate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
/** /**
* @param colour * @param colour for {@link Tag#getColour()}
* for {@link Tag#getColour()}
* @return updated builder instance * @return updated builder instance
*/ */
TagUpdate colour(@Size(max = Tag.COLOUR_MAX_SIZE) String colour); TagUpdate colour(@Size(max = Tag.COLOUR_MAX_SIZE) String colour);

View File

@@ -15,13 +15,11 @@ import org.eclipse.hawkbit.repository.model.Target;
/** /**
* Builder for {@link Target}. * Builder for {@link Target}.
*
*/ */
public interface TargetBuilder { public interface TargetBuilder {
/** /**
* @param controllerId * @param controllerId of the updatable entity
* of the updatable entity
* @return builder instance * @return builder instance
*/ */
TargetUpdate update(@NotEmpty String controllerId); TargetUpdate update(@NotEmpty String controllerId);

View File

@@ -21,70 +21,58 @@ import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
* Builder to create a new {@link Target} entry. Defines all fields that can be * Builder to create a new {@link Target} entry. Defines all fields that can be
* set at creation time. Other fields are set by the repository automatically, * set at creation time. Other fields are set by the repository automatically,
* e.g. {@link BaseEntity#getCreatedAt()}. * e.g. {@link BaseEntity#getCreatedAt()}.
*
*/ */
public interface TargetCreate { public interface TargetCreate {
/** /**
* @param controllerId * @param controllerId for {@link Target#getControllerId()}
* for {@link Target#getControllerId()}
* @return updated builder instance * @return updated builder instance
*/ */
TargetCreate controllerId(@Size(min = 1, max = Target.CONTROLLER_ID_MAX_SIZE) @NotNull String controllerId); TargetCreate controllerId(@Size(min = 1, max = Target.CONTROLLER_ID_MAX_SIZE) @NotNull String controllerId);
/** /**
* @param name * @param name for {@link Target#getName()} filled with
* for {@link Target#getName()} filled with * {@link #controllerId(String)} as default if not set explicitly
* {@link #controllerId(String)} as default if not set explicitly
* @return updated builder instance * @return updated builder instance
*/ */
TargetCreate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name); TargetCreate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name);
/** /**
* @param description * @param description for {@link Target#getDescription()}
* for {@link Target#getDescription()}
* @return updated builder instance * @return updated builder instance
*/ */
TargetCreate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description); TargetCreate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
/** /**
* @param targetTypeId * @param targetTypeId for {@link Target#getTargetType()}
* for {@link Target#getTargetType()}
* @return updated builder instance * @return updated builder instance
*/ */
TargetCreate targetType(Long targetTypeId); TargetCreate targetType(Long targetTypeId);
/** /**
* @param securityToken * @param securityToken for {@link Target#getSecurityToken()} is generated with a
* for {@link Target#getSecurityToken()} is generated with a * random sequence as default if not set explicitly
* random sequence as default if not set explicitly
* @return updated builder instance * @return updated builder instance
*/ */
TargetCreate securityToken(@Size(min = 1, max = Target.SECURITY_TOKEN_MAX_SIZE) @NotNull String securityToken); TargetCreate securityToken(@Size(min = 1, max = Target.SECURITY_TOKEN_MAX_SIZE) @NotNull String securityToken);
/** /**
* @param address * @param address for {@link Target#getAddress()}
* for {@link Target#getAddress()}
*
* @throws IllegalArgumentException
* If the given string violates RFC&nbsp;2396
*
* @return updated builder instance * @return updated builder instance
* @throws IllegalArgumentException If the given string violates RFC&nbsp;2396
*/ */
TargetCreate address(@Size(max = Target.ADDRESS_MAX_SIZE) String address); TargetCreate address(@Size(max = Target.ADDRESS_MAX_SIZE) String address);
/** /**
* @param lastTargetQuery * @param lastTargetQuery for {@link Target#getLastTargetQuery()}
* for {@link Target#getLastTargetQuery()}
* @return updated builder instance * @return updated builder instance
*/ */
TargetCreate lastTargetQuery(Long lastTargetQuery); TargetCreate lastTargetQuery(Long lastTargetQuery);
/** /**
* @param status * @param status for {@link Target#getUpdateStatus()} is
* for {@link Target#getUpdateStatus()} is * {@link TargetUpdateStatus#UNKNOWN} as default if not set
* {@link TargetUpdateStatus#UNKNOWN} as default if not set * explicitly
* explicitly
* @return updated builder instance * @return updated builder instance
*/ */
TargetCreate status(@NotNull TargetUpdateStatus status); TargetCreate status(@NotNull TargetUpdateStatus status);

View File

@@ -13,14 +13,13 @@ import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
/** /**
* Builder for {@link TargetFilterQuery}. * Builder for {@link TargetFilterQuery}.
*
*/ */
public interface TargetFilterQueryBuilder { public interface TargetFilterQueryBuilder {
/** /**
* Used to update a {@link TargetFilterQuery} * Used to update a {@link TargetFilterQuery}
* *
* @param id * @param id of the updatable entity
* of the updatable entity
* @return builder instance * @return builder instance
*/ */
TargetFilterQueryUpdate update(long id); TargetFilterQueryUpdate update(long id);
@@ -28,8 +27,7 @@ public interface TargetFilterQueryBuilder {
/** /**
* Used to update a the auto assignment of a {@link TargetFilterQuery} * Used to update a the auto assignment of a {@link TargetFilterQuery}
* *
* @param id * @param id of the updatable entity
* of the updatable entity
* @return builder instance * @return builder instance
*/ */
AutoAssignDistributionSetUpdate updateAutoAssign(long id); AutoAssignDistributionSetUpdate updateAutoAssign(long id);

View File

@@ -25,14 +25,13 @@ import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
* Builder to create a new {@link TargetFilterQuery} entry. Defines all fields * Builder to create a new {@link TargetFilterQuery} entry. Defines all fields
* that can be set at creation time. Other fields are set by the repository * that can be set at creation time. Other fields are set by the repository
* automatically, e.g. {@link BaseEntity#getCreatedAt()}. * automatically, e.g. {@link BaseEntity#getCreatedAt()}.
*
*/ */
public interface TargetFilterQueryCreate { public interface TargetFilterQueryCreate {
/** /**
* Set filter name * Set filter name
* *
* @param name * @param name of {@link TargetFilterQuery#getName()}
* of {@link TargetFilterQuery#getName()}
* @return updated builder instance * @return updated builder instance
*/ */
TargetFilterQueryCreate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name); TargetFilterQueryCreate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name);
@@ -40,8 +39,7 @@ public interface TargetFilterQueryCreate {
/** /**
* Set filter query * Set filter query
* *
* @param query * @param query of {@link TargetFilterQuery#getQuery()}
* of {@link TargetFilterQuery#getQuery()}
* @return updated builder instance * @return updated builder instance
*/ */
TargetFilterQueryCreate query(@Size(min = 1, max = TargetFilterQuery.QUERY_MAX_SIZE) @NotNull String query); TargetFilterQueryCreate query(@Size(min = 1, max = TargetFilterQuery.QUERY_MAX_SIZE) @NotNull String query);
@@ -49,8 +47,7 @@ public interface TargetFilterQueryCreate {
/** /**
* Set {@link DistributionSet} for auto assignment * Set {@link DistributionSet} for auto assignment
* *
* @param distributionSet * @param distributionSet for {@link TargetFilterQuery#getAutoAssignDistributionSet()}
* for {@link TargetFilterQuery#getAutoAssignDistributionSet()}
* @return updated builder instance * @return updated builder instance
*/ */
default TargetFilterQueryCreate autoAssignDistributionSet(final DistributionSet distributionSet) { default TargetFilterQueryCreate autoAssignDistributionSet(final DistributionSet distributionSet) {
@@ -60,8 +57,7 @@ public interface TargetFilterQueryCreate {
/** /**
* Set ID of {@link DistributionSet} for auto assignment * Set ID of {@link DistributionSet} for auto assignment
* *
* @param dsId * @param dsId for {@link TargetFilterQuery#getAutoAssignDistributionSet()}
* for {@link TargetFilterQuery#getAutoAssignDistributionSet()}
* @return updated builder instance * @return updated builder instance
*/ */
TargetFilterQueryCreate autoAssignDistributionSet(Long dsId); TargetFilterQueryCreate autoAssignDistributionSet(Long dsId);
@@ -69,8 +65,7 @@ public interface TargetFilterQueryCreate {
/** /**
* Set {@link ActionType} for auto assignment * Set {@link ActionType} for auto assignment
* *
* @param actionType * @param actionType for {@link TargetFilterQuery#getAutoAssignActionType()}
* for {@link TargetFilterQuery#getAutoAssignActionType()}
* @return updated builder instance * @return updated builder instance
*/ */
TargetFilterQueryCreate autoAssignActionType(ActionType actionType); TargetFilterQueryCreate autoAssignActionType(ActionType actionType);
@@ -78,8 +73,7 @@ public interface TargetFilterQueryCreate {
/** /**
* Set weight of {@link Action} created during auto assignment * Set weight of {@link Action} created during auto assignment
* *
* @param weight * @param weight weight of {@link Action} generated within auto assignment
* weight of {@link Action} generated within auto assignment
* @return updated builder instance * @return updated builder instance
*/ */
TargetFilterQueryCreate autoAssignWeight(Integer weight); TargetFilterQueryCreate autoAssignWeight(Integer weight);
@@ -88,9 +82,8 @@ public interface TargetFilterQueryCreate {
* Specify initial confirmation state of resulting {@link Action} in auto * Specify initial confirmation state of resulting {@link Action} in auto
* assignment * assignment
* *
* @param confirmationRequired * @param confirmationRequired if confirmation is required for configured auto assignment (considered
* if confirmation is required for configured auto assignment (considered * with confirmation flow active)
* with confirmation flow active)
* @return updated builder instance * @return updated builder instance
*/ */
TargetFilterQueryCreate confirmationRequired(boolean confirmationRequired); TargetFilterQueryCreate confirmationRequired(boolean confirmationRequired);

View File

@@ -17,19 +17,17 @@ import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
/** /**
* Builder to update an existing {@link TargetFilterQuery} entry. Defines all * Builder to update an existing {@link TargetFilterQuery} entry. Defines all
* fields that can be updated. * fields that can be updated.
*
*/ */
public interface TargetFilterQueryUpdate { public interface TargetFilterQueryUpdate {
/** /**
* @param name * @param name of {@link TargetFilterQuery#getName()}
* of {@link TargetFilterQuery#getName()}
* @return updated builder instance * @return updated builder instance
*/ */
TargetFilterQueryUpdate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) String name); TargetFilterQueryUpdate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) String name);
/** /**
* @param query * @param query of {@link TargetFilterQuery#getQuery()}
* of {@link TargetFilterQuery#getQuery()}
* @return updated builder instance * @return updated builder instance
*/ */
TargetFilterQueryUpdate query(@Size(min = 1, max = TargetFilterQuery.QUERY_MAX_SIZE) String query); TargetFilterQueryUpdate query(@Size(min = 1, max = TargetFilterQuery.QUERY_MAX_SIZE) String query);

View File

@@ -13,12 +13,11 @@ import org.eclipse.hawkbit.repository.model.TargetType;
/** /**
* Builder for {@link TargetType}. * Builder for {@link TargetType}.
*
*/ */
public interface TargetTypeBuilder { public interface TargetTypeBuilder {
/** /**
* @param id * @param id of the updatable entity
* of the updatable entity
* @return builder instance * @return builder instance
*/ */
TargetTypeUpdate update(long id); TargetTypeUpdate update(long id);

View File

@@ -9,64 +9,58 @@
*/ */
package org.eclipse.hawkbit.repository.builder; package org.eclipse.hawkbit.repository.builder;
import java.util.Collection;
import java.util.Collections;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import org.eclipse.hawkbit.repository.model.BaseEntity; import org.eclipse.hawkbit.repository.model.BaseEntity;
import org.eclipse.hawkbit.repository.model.DistributionSetType; import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.eclipse.hawkbit.repository.model.NamedEntity; import org.eclipse.hawkbit.repository.model.NamedEntity;
import org.eclipse.hawkbit.repository.model.TargetType; import org.eclipse.hawkbit.repository.model.TargetType;
import org.eclipse.hawkbit.repository.model.Type; import org.eclipse.hawkbit.repository.model.Type;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.util.Collection;
import java.util.Collections;
/** /**
* Builder to create a new {@link TargetType} entry. Defines all fields * Builder to create a new {@link TargetType} entry. Defines all fields
* that can be set at creation time. Other fields are set by the repository * that can be set at creation time. Other fields are set by the repository
* automatically, e.g. {@link BaseEntity#getCreatedAt()}. * automatically, e.g. {@link BaseEntity#getCreatedAt()}.
*
*/ */
public interface TargetTypeCreate { public interface TargetTypeCreate {
/** /**
* @param name * @param name for {@link TargetType#getName()}
* for {@link TargetType#getName()}
* @return updated builder instance * @return updated builder instance
*/ */
TargetTypeCreate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotEmpty String name); TargetTypeCreate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotEmpty String name);
/** /**
* @param description * @param description for {@link TargetType#getDescription()}
* for {@link TargetType#getDescription()}
* @return updated builder instance * @return updated builder instance
*/ */
TargetTypeCreate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description); TargetTypeCreate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
/** /**
* @param key * @param key for {@link TargetType#getName()}
* for {@link TargetType#getName()}
* @return updated builder instance * @return updated builder instance
*/ */
TargetTypeCreate key(@Size(min = 1, max = Type.KEY_MAX_SIZE) @NotEmpty String key); TargetTypeCreate key(@Size(min = 1, max = Type.KEY_MAX_SIZE) @NotEmpty String key);
/** /**
* @param colour * @param colour for {@link TargetType#getColour()}
* for {@link TargetType#getColour()}
* @return updated builder instance * @return updated builder instance
*/ */
TargetTypeCreate colour(@Size(max = Type.COLOUR_MAX_SIZE) String colour); TargetTypeCreate colour(@Size(max = Type.COLOUR_MAX_SIZE) String colour);
/** /**
* @param compatible * @param compatible for {@link TargetType#getCompatibleDistributionSetTypes()}
* for {@link TargetType#getCompatibleDistributionSetTypes()}
* @return updated builder instance * @return updated builder instance
*/ */
TargetTypeCreate compatible(@NotEmpty Collection<Long> compatible); TargetTypeCreate compatible(@NotEmpty Collection<Long> compatible);
/** /**
* @param compatible * @param compatible for {@link TargetType#getCompatibleDistributionSetTypes()}
* for {@link TargetType#getCompatibleDistributionSetTypes()}
* @return updated builder instance * @return updated builder instance
*/ */
default TargetTypeCreate compatible(@NotNull final Long compatible) { default TargetTypeCreate compatible(@NotNull final Long compatible) {
@@ -74,8 +68,7 @@ public interface TargetTypeCreate {
} }
/** /**
* @param compatible * @param compatible for {@link TargetType#getCompatibleDistributionSetTypes()}
* for {@link TargetType#getCompatibleDistributionSetTypes()}
* @return updated builder instance * @return updated builder instance
*/ */
default TargetTypeCreate compatible(@NotNull final DistributionSetType compatible) { default TargetTypeCreate compatible(@NotNull final DistributionSetType compatible) {

View File

@@ -9,34 +9,31 @@
*/ */
package org.eclipse.hawkbit.repository.builder; package org.eclipse.hawkbit.repository.builder;
import jakarta.validation.constraints.Size;
import org.eclipse.hawkbit.repository.model.NamedEntity; import org.eclipse.hawkbit.repository.model.NamedEntity;
import org.eclipse.hawkbit.repository.model.TargetType; import org.eclipse.hawkbit.repository.model.TargetType;
import jakarta.validation.constraints.Size;
/** /**
* Builder to update an existing {@link TargetType} entry. Defines all * Builder to update an existing {@link TargetType} entry. Defines all
* fields that can be updated. * fields that can be updated.
*
*/ */
public interface TargetTypeUpdate { public interface TargetTypeUpdate {
/** /**
* @param description * @param description for {@link TargetType#getDescription()}
* for {@link TargetType#getDescription()}
* @return updated builder instance * @return updated builder instance
*/ */
TargetTypeUpdate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description); TargetTypeUpdate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
/** /**
* @param colour * @param colour for {@link TargetType#getColour()}
* for {@link TargetType#getColour()}
* @return updated builder instance * @return updated builder instance
*/ */
TargetTypeUpdate colour(@Size(max = TargetType.COLOUR_MAX_SIZE) String colour); TargetTypeUpdate colour(@Size(max = TargetType.COLOUR_MAX_SIZE) String colour);
/** /**
* @param name * @param name Name
* Name
* @return updated builder instance * @return updated builder instance
*/ */
TargetTypeUpdate name(@Size(max = TargetType.NAME_MAX_SIZE) String name); TargetTypeUpdate name(@Size(max = TargetType.NAME_MAX_SIZE) String name);

View File

@@ -19,59 +19,48 @@ import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
/** /**
* Builder to update an existing {@link Target} entry. Defines all fields that * Builder to update an existing {@link Target} entry. Defines all fields that
* can be updated. * can be updated.
*
*/ */
public interface TargetUpdate { public interface TargetUpdate {
/** /**
* @param name * @param name for {@link Target#getName()}
* for {@link Target#getName()}
* @return updated builder instance * @return updated builder instance
*/ */
TargetUpdate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name); TargetUpdate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name);
/** /**
* @param description * @param description for {@link Target#getDescription()}
* for {@link Target#getDescription()}
* @return updated builder instance * @return updated builder instance
*/ */
TargetUpdate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description); TargetUpdate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
/** /**
* @param securityToken * @param securityToken for {@link Target#getSecurityToken()}
* for {@link Target#getSecurityToken()}
* @return updated builder instance * @return updated builder instance
*/ */
TargetUpdate securityToken(@Size(min = 1, max = Target.SECURITY_TOKEN_MAX_SIZE) @NotNull String securityToken); TargetUpdate securityToken(@Size(min = 1, max = Target.SECURITY_TOKEN_MAX_SIZE) @NotNull String securityToken);
/** /**
* @param targetTypeId * @param targetTypeId for {@link Target#getTargetType()}
* for {@link Target#getTargetType()}
* @return updated builder instance * @return updated builder instance
*/ */
TargetUpdate targetType(@NotNull Long targetTypeId); TargetUpdate targetType(@NotNull Long targetTypeId);
/** /**
* @param address * @param address for {@link Target#getAddress()}
* for {@link Target#getAddress()}
*
* @throws IllegalArgumentException
* If the given string violates RFC&nbsp;2396
*
* @return updated builder instance * @return updated builder instance
* @throws IllegalArgumentException If the given string violates RFC&nbsp;2396
*/ */
TargetUpdate address(@Size(max = Target.ADDRESS_MAX_SIZE) String address); TargetUpdate address(@Size(max = Target.ADDRESS_MAX_SIZE) String address);
/** /**
* @param lastTargetQuery * @param lastTargetQuery for {@link Target#getLastTargetQuery()}
* for {@link Target#getLastTargetQuery()}
* @return updated builder instance * @return updated builder instance
*/ */
TargetUpdate lastTargetQuery(Long lastTargetQuery); TargetUpdate lastTargetQuery(Long lastTargetQuery);
/** /**
* @param status * @param status for {@link Target#getUpdateStatus()}
* for {@link Target#getUpdateStatus()}
* @return updated builder instance * @return updated builder instance
*/ */
TargetUpdate status(@NotNull TargetUpdateStatus status); TargetUpdate status(@NotNull TargetUpdateStatus status);

View File

@@ -14,15 +14,12 @@ import org.springframework.context.ApplicationEvent;
/** /**
* ApplicationEventFilter for hawkBit internal {@link ApplicationEvent} * ApplicationEventFilter for hawkBit internal {@link ApplicationEvent}
* publishing. * publishing.
*
*/ */
@FunctionalInterface @FunctionalInterface
public interface ApplicationEventFilter { public interface ApplicationEventFilter {
/** /**
* * @param event to verify
* @param event
* to verify
* @return true if event should be filtered * @return true if event should be filtered
*/ */
boolean filter(final ApplicationEvent event); boolean filter(final ApplicationEvent event);

View File

@@ -11,10 +11,6 @@ package org.eclipse.hawkbit.repository.event;
/** /**
* Events to be published to refresh data on UI. * Events to be published to refresh data on UI.
*
*
*
*
*/ */
public enum CustomEvents { public enum CustomEvents {

View File

@@ -12,7 +12,6 @@ package org.eclipse.hawkbit.repository.event;
/** /**
* An event declaration which holds an revision for each event so consumers have * An event declaration which holds an revision for each event so consumers have
* the chance to know if they might already retrieved a newer event. * the chance to know if they might already retrieved a newer event.
*
*/ */
@FunctionalInterface @FunctionalInterface
public interface TenantAwareEvent { public interface TenantAwareEvent {

View File

@@ -9,16 +9,16 @@
*/ */
package org.eclipse.hawkbit.repository.event.remote; package org.eclipse.hawkbit.repository.event.remote;
import lombok.Data;
import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.ActionProperties;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import lombok.Data;
import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.ActionProperties;
/** /**
* Abstract class providing information about an assignment. * Abstract class providing information about an assignment.
*/ */

View File

@@ -30,12 +30,9 @@ public class DistributionSetDeletedEvent extends RemoteIdEvent implements Entity
/** /**
* Constructor. * Constructor.
* *
* @param tenant * @param tenant the tenant
* the tenant * @param entityId the entity id
* @param entityId * @param applicationId the origin application id
* the entity id
* @param applicationId
* the origin application id
*/ */
public DistributionSetDeletedEvent(final String tenant, final Long entityId, public DistributionSetDeletedEvent(final String tenant, final Long entityId,
final Class<? extends TenantAwareBaseEntity> entityClass, final String applicationId) { final Class<? extends TenantAwareBaseEntity> entityClass, final String applicationId) {

View File

@@ -30,14 +30,10 @@ public class DistributionSetTagDeletedEvent extends RemoteIdEvent implements Ent
/** /**
* Constructor for json serialization. * Constructor for json serialization.
* *
* @param tenant * @param tenant the tenant
* the tenant * @param entityId the entity id
* @param entityId * @param entityClass the entity class
* the entity id * @param applicationId the origin application id
* @param entityClass
* the entity class
* @param applicationId
* the origin application id
*/ */
public DistributionSetTagDeletedEvent(final String tenant, final Long entityId, public DistributionSetTagDeletedEvent(final String tenant, final Long entityId,

View File

@@ -14,7 +14,6 @@ import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity; import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
/** /**
*
* Defines the remote event of deleting a {@link DistributionSetType}. * Defines the remote event of deleting a {@link DistributionSetType}.
*/ */
public class DistributionSetTypeDeletedEvent extends RemoteIdEvent implements EntityDeletedEvent { public class DistributionSetTypeDeletedEvent extends RemoteIdEvent implements EntityDeletedEvent {
@@ -31,14 +30,10 @@ public class DistributionSetTypeDeletedEvent extends RemoteIdEvent implements En
/** /**
* Constructor for json serialization. * Constructor for json serialization.
* *
* @param tenant * @param tenant the tenant
* the tenant * @param entityId the entity id
* @param entityId * @param entityClass the entity class
* the entity id * @param applicationId the origin application id
* @param entityClass
* the entity class
* @param applicationId
* the origin application id
*/ */
public DistributionSetTypeDeletedEvent(final String tenant, final Long entityId, public DistributionSetTypeDeletedEvent(final String tenant, final Long entityId,
final Class<? extends TenantAwareBaseEntity> entityClass, final String applicationId) { final Class<? extends TenantAwareBaseEntity> entityClass, final String applicationId) {

View File

@@ -14,7 +14,6 @@ import org.eclipse.hawkbit.repository.model.ActionStatus;
/** /**
* TenantAwareEvent that contains an updated download progress for a given * TenantAwareEvent that contains an updated download progress for a given
* ActionStatus that was written for a download request. * ActionStatus that was written for a download request.
*
*/ */
public class DownloadProgressEvent extends RemoteTenantAwareEvent { public class DownloadProgressEvent extends RemoteTenantAwareEvent {
@@ -32,14 +31,10 @@ public class DownloadProgressEvent extends RemoteTenantAwareEvent {
/** /**
* Constructor. * Constructor.
* *
* @param tenant * @param tenant the tenant
* the tenant * @param actionStatusId of the {@link ActionStatus} the download belongs to
* @param actionStatusId * @param shippedBytesSinceLast the shippedBytesSinceLast
* of the {@link ActionStatus} the download belongs to * @param applicationId the application id.
* @param shippedBytesSinceLast
* the shippedBytesSinceLast
* @param applicationId
* the application id.
*/ */
public DownloadProgressEvent(final String tenant, final Long actionStatusId, final long shippedBytesSinceLast, public DownloadProgressEvent(final String tenant, final Long actionStatusId, final long shippedBytesSinceLast,
final String applicationId) { final String applicationId) {

View File

@@ -20,12 +20,9 @@ public interface EventEntityManager {
/** /**
* Find an entity by given id and return it. * Find an entity by given id and return it.
* *
* @param tenant * @param tenant the tenant
* the tenant * @param id the id
* @param id * @param entityType the entity type
* the id
* @param entityType
* the entity type
* @return the entity * @return the entity
*/ */
<E extends TenantAwareBaseEntity> E findEntity(String tenant, Long id, Class<E> entityType); <E extends TenantAwareBaseEntity> E findEntity(String tenant, Long id, Class<E> entityType);

View File

@@ -14,7 +14,6 @@ import org.springframework.beans.factory.annotation.Autowired;
/** /**
* A singleton bean which holds the event entity manager to have autowiring in * A singleton bean which holds the event entity manager to have autowiring in
* the events. * the events.
*
*/ */
public final class EventEntityManagerHolder { public final class EventEntityManagerHolder {

View File

@@ -9,12 +9,12 @@
*/ */
package org.eclipse.hawkbit.repository.event.remote; package org.eclipse.hawkbit.repository.event.remote;
import java.util.List;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.eclipse.hawkbit.repository.model.Action; import org.eclipse.hawkbit.repository.model.Action;
import java.util.List;
/** /**
* Generic deployment event for the Multi-Assignments feature. The event extends * Generic deployment event for the Multi-Assignments feature. The event extends
* the {@link MultiActionEvent} and holds a list of controller IDs to identify * the {@link MultiActionEvent} and holds a list of controller IDs to identify
@@ -30,12 +30,9 @@ public class MultiActionAssignEvent extends MultiActionEvent {
/** /**
* Constructor. * Constructor.
* *
* @param tenant * @param tenant tenant the event is scoped to
* tenant the event is scoped to * @param applicationId the application id
* @param applicationId * @param actions the actions of the deployment action
* the application id
* @param actions
* the actions of the deployment action
*/ */
public MultiActionAssignEvent(String tenant, String applicationId, List<Action> actions) { public MultiActionAssignEvent(String tenant, String applicationId, List<Action> actions) {
super(tenant, applicationId, actions); super(tenant, applicationId, actions);

View File

@@ -34,12 +34,9 @@ public class MultiActionCancelEvent extends MultiActionEvent {
/** /**
* Constructor. * Constructor.
* *
* @param tenant * @param tenant tenant the event is scoped to
* tenant the event is scoped to * @param applicationId the application id
* @param applicationId * @param actions the actions to be canceled
* the application id
* @param actions
* the actions to be canceled
*/ */
public MultiActionCancelEvent(String tenant, String applicationId, List<Action> actions) { public MultiActionCancelEvent(String tenant, String applicationId, List<Action> actions) {
super(tenant, applicationId, actions); super(tenant, applicationId, actions);

View File

@@ -43,12 +43,9 @@ public abstract class MultiActionEvent extends RemoteTenantAwareEvent implements
/** /**
* Constructor. * Constructor.
* *
* @param tenant * @param tenant tenant the event is scoped to
* tenant the event is scoped to * @param applicationId the application id
* @param applicationId * @param actions the actions involved
* the application id
* @param actions
* the actions involved
*/ */
protected MultiActionEvent(String tenant, String applicationId, List<Action> actions) { protected MultiActionEvent(String tenant, String applicationId, List<Action> actions) {
super(applicationId, tenant, applicationId); super(applicationId, tenant, applicationId);

View File

@@ -9,6 +9,9 @@
*/ */
package org.eclipse.hawkbit.repository.event.remote; package org.eclipse.hawkbit.repository.event.remote;
import java.io.Serial;
import java.util.Arrays;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.Getter; import lombok.Getter;
@@ -16,9 +19,6 @@ import lombok.NoArgsConstructor;
import lombok.ToString; import lombok.ToString;
import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity; import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
import java.io.Serial;
import java.util.Arrays;
/** /**
* An base definition class for an event which contains an id. * An base definition class for an event which contains an id.
*/ */
@@ -40,14 +40,10 @@ public class RemoteIdEvent extends RemoteTenantAwareEvent {
/** /**
* Constructor for json serialization. * Constructor for json serialization.
* *
* @param entityId * @param entityId the entity Id
* the entity Id * @param tenant the tenant
* @param tenant * @param entityClass the entity class
* the tenant * @param applicationId the origin application id
* @param entityClass
* the entity class
* @param applicationId
* the origin application id
*/ */
protected RemoteIdEvent(final Long entityId, final String tenant, protected RemoteIdEvent(final Long entityId, final String tenant,
final Class<? extends TenantAwareBaseEntity> entityClass, final String applicationId) { final Class<? extends TenantAwareBaseEntity> entityClass, final String applicationId) {

View File

@@ -9,16 +9,15 @@
*/ */
package org.eclipse.hawkbit.repository.event.remote; package org.eclipse.hawkbit.repository.event.remote;
import java.io.Serial;
import com.cronutils.utils.StringUtils;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.Getter; import lombok.Getter;
import lombok.ToString; import lombok.ToString;
import org.eclipse.hawkbit.repository.event.TenantAwareEvent; import org.eclipse.hawkbit.repository.event.TenantAwareEvent;
import org.springframework.cloud.bus.event.RemoteApplicationEvent; import org.springframework.cloud.bus.event.RemoteApplicationEvent;
import com.cronutils.utils.StringUtils;
import java.io.Serial;
/** /**
* A distributed tenant aware event. It's the base class of the other * A distributed tenant aware event. It's the base class of the other
* distributed events. All the necessary information of distributing events to * distributed events. All the necessary information of distributing events to
@@ -44,12 +43,9 @@ public class RemoteTenantAwareEvent extends RemoteApplicationEvent implements Te
/** /**
* Constructor. * Constructor.
* *
* @param source * @param source the for the remote event.
* the for the remote event. * @param tenant the tenant
* @param tenant * @param applicationId the applicationId
* the tenant
* @param applicationId
* the applicationId
*/ */
public RemoteTenantAwareEvent(final Object source, final String tenant, final String applicationId) { public RemoteTenantAwareEvent(final Object source, final String tenant, final String applicationId) {
// due to a bug in Spring Cloud, we cannot pass null for applicationId // due to a bug in Spring Cloud, we cannot pass null for applicationId

View File

@@ -14,7 +14,6 @@ import org.eclipse.hawkbit.repository.model.Rollout;
import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity; import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
/** /**
*
* Defines the remote event of deleting a {@link Rollout}. * Defines the remote event of deleting a {@link Rollout}.
*/ */
public class RolloutDeletedEvent extends RemoteIdEvent implements EntityDeletedEvent { public class RolloutDeletedEvent extends RemoteIdEvent implements EntityDeletedEvent {
@@ -31,14 +30,10 @@ public class RolloutDeletedEvent extends RemoteIdEvent implements EntityDeletedE
/** /**
* Constructor for json serialization. * Constructor for json serialization.
* *
* @param tenant * @param tenant the tenant
* the tenant * @param entityId the entity id
* @param entityId * @param entityClass the entity class
* the entity id * @param applicationId the origin application id
* @param entityClass
* the entity class
* @param applicationId
* the origin application id
*/ */
public RolloutDeletedEvent(final String tenant, final Long entityId, public RolloutDeletedEvent(final String tenant, final Long entityId,
final Class<? extends TenantAwareBaseEntity> entityClass, final String applicationId) { final Class<? extends TenantAwareBaseEntity> entityClass, final String applicationId) {

View File

@@ -14,7 +14,6 @@ import org.eclipse.hawkbit.repository.model.RolloutGroup;
import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity; import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
/** /**
*
* Defines the remote event of deleting a {@link RolloutGroup}. * Defines the remote event of deleting a {@link RolloutGroup}.
*/ */
public class RolloutGroupDeletedEvent extends RemoteIdEvent implements EntityDeletedEvent { public class RolloutGroupDeletedEvent extends RemoteIdEvent implements EntityDeletedEvent {
@@ -31,14 +30,10 @@ public class RolloutGroupDeletedEvent extends RemoteIdEvent implements EntityDel
/** /**
* Constructor for json serialization. * Constructor for json serialization.
* *
* @param tenant * @param tenant the tenant
* the tenant * @param entityId the entity id
* @param entityId * @param entityClass the entity class
* the entity id * @param applicationId the origin application id
* @param entityClass
* the entity class
* @param applicationId
* the origin application id
*/ */
public RolloutGroupDeletedEvent(final String tenant, final Long entityId, public RolloutGroupDeletedEvent(final String tenant, final Long entityId,
final Class<? extends TenantAwareBaseEntity> entityClass, final String applicationId) { final Class<? extends TenantAwareBaseEntity> entityClass, final String applicationId) {

View File

@@ -15,7 +15,6 @@ import lombok.Data;
import org.eclipse.hawkbit.repository.model.DistributionSet; import org.eclipse.hawkbit.repository.model.DistributionSet;
/** /**
*
* Event that is published when a rollout is stopped due to invalidation of a * Event that is published when a rollout is stopped due to invalidation of a
* {@link DistributionSet}. * {@link DistributionSet}.
*/ */
@@ -37,14 +36,10 @@ public class RolloutStoppedEvent extends RemoteTenantAwareEvent {
/** /**
* Constructor for json serialization. * Constructor for json serialization.
* *
* @param tenant * @param tenant the tenant
* the tenant * @param entityId the entity id
* @param entityId * @param entityClass the entity class
* the entity id * @param applicationId the origin application id
* @param entityClass
* the entity class
* @param applicationId
* the origin application id
*/ */
public RolloutStoppedEvent(final String tenant, final String applicationId, final long rolloutId, public RolloutStoppedEvent(final String tenant, final String applicationId, final long rolloutId,
final Collection<Long> rolloutGroupIds) { final Collection<Long> rolloutGroupIds) {

View File

@@ -14,7 +14,6 @@ import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity; import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
/** /**
*
* Defines the remote event of deleting a {@link SoftwareModule}. * Defines the remote event of deleting a {@link SoftwareModule}.
*/ */
public class SoftwareModuleDeletedEvent extends RemoteIdEvent implements EntityDeletedEvent { public class SoftwareModuleDeletedEvent extends RemoteIdEvent implements EntityDeletedEvent {
@@ -31,14 +30,10 @@ public class SoftwareModuleDeletedEvent extends RemoteIdEvent implements EntityD
/** /**
* Constructor for json serialization. * Constructor for json serialization.
* *
* @param tenant * @param tenant the tenant
* the tenant * @param entityId the entity id
* @param entityId * @param entityClass the entity class
* the entity id * @param applicationId the origin application id
* @param entityClass
* the entity class
* @param applicationId
* the origin application id
*/ */
public SoftwareModuleDeletedEvent(final String tenant, final Long entityId, public SoftwareModuleDeletedEvent(final String tenant, final Long entityId,
final Class<? extends TenantAwareBaseEntity> entityClass, final String applicationId) { final Class<? extends TenantAwareBaseEntity> entityClass, final String applicationId) {

View File

@@ -14,7 +14,6 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity; import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
/** /**
*
* Defines the remote event of deleting a {@link SoftwareModuleType}. * Defines the remote event of deleting a {@link SoftwareModuleType}.
*/ */
public class SoftwareModuleTypeDeletedEvent extends RemoteIdEvent implements EntityDeletedEvent { public class SoftwareModuleTypeDeletedEvent extends RemoteIdEvent implements EntityDeletedEvent {
@@ -31,14 +30,10 @@ public class SoftwareModuleTypeDeletedEvent extends RemoteIdEvent implements Ent
/** /**
* Constructor for json serialization. * Constructor for json serialization.
* *
* @param tenant * @param tenant the tenant
* the tenant * @param entityId the entity id
* @param entityId * @param entityClass the entity class
* the entity id * @param applicationId the origin application id
* @param entityClass
* the entity class
* @param applicationId
* the origin application id
*/ */
public SoftwareModuleTypeDeletedEvent(final String tenant, final Long entityId, public SoftwareModuleTypeDeletedEvent(final String tenant, final Long entityId,
final Class<? extends TenantAwareBaseEntity> entityClass, final String applicationId) { final Class<? extends TenantAwareBaseEntity> entityClass, final String applicationId) {

View File

@@ -38,16 +38,11 @@ public class TargetAssignDistributionSetEvent extends AbstractAssignmentEvent {
/** /**
* Constructor. * Constructor.
* *
* @param tenant * @param tenant of the event
* of the event * @param distributionSetId of the set that was assigned
* @param distributionSetId * @param a the actions and the targets
* of the set that was assigned * @param applicationId the application id.
* @param a * @param maintenanceWindowAvailable see {@link Action#isMaintenanceWindowAvailable()}
* the actions and the targets
* @param applicationId
* the application id.
* @param maintenanceWindowAvailable
* see {@link Action#isMaintenanceWindowAvailable()}
*/ */
public TargetAssignDistributionSetEvent(final String tenant, final long distributionSetId, final List<Action> a, public TargetAssignDistributionSetEvent(final String tenant, final long distributionSetId, final List<Action> a,
final String applicationId, final boolean maintenanceWindowAvailable) { final String applicationId, final boolean maintenanceWindowAvailable) {
@@ -62,10 +57,8 @@ public class TargetAssignDistributionSetEvent extends AbstractAssignmentEvent {
/** /**
* Constructor. * Constructor.
* *
* @param action * @param action the action created for this assignment
* the action created for this assignment * @param applicationId the application id
* @param applicationId
* the application id
*/ */
public TargetAssignDistributionSetEvent(final Action action, final String applicationId) { public TargetAssignDistributionSetEvent(final Action action, final String applicationId) {
this(action.getTenant(), action.getDistributionSet().getId(), Collections.singletonList(action), applicationId, this(action.getTenant(), action.getDistributionSet().getId(), Collections.singletonList(action), applicationId,

View File

@@ -9,14 +9,14 @@
*/ */
package org.eclipse.hawkbit.repository.event.remote; package org.eclipse.hawkbit.repository.event.remote;
import java.io.Serial;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.Getter; import lombok.Getter;
import lombok.ToString; import lombok.ToString;
import org.eclipse.hawkbit.repository.model.Target; import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity; import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
import java.io.Serial;
/** /**
* Defines the remote event of triggering attribute updates of a {@link Target}. * Defines the remote event of triggering attribute updates of a {@link Target}.
*/ */
@@ -41,18 +41,12 @@ public class TargetAttributesRequestedEvent extends RemoteIdEvent {
/** /**
* Constructor json serialization * Constructor json serialization
* *
* @param tenant * @param tenant the tenant
* the tenant * @param entityId the entity id
* @param entityId * @param controllerId the controllerId of the target
* the entity id * @param targetAddress the target address
* @param controllerId * @param entityClass the entity class
* the controllerId of the target * @param applicationId the origin application id
* @param targetAddress
* the target address
* @param entityClass
* the entity class
* @param applicationId
* the origin application id
*/ */
public TargetAttributesRequestedEvent(final String tenant, final Long entityId, final String controllerId, public TargetAttributesRequestedEvent(final String tenant, final Long entityId, final String controllerId,
final String targetAddress, final Class<? extends TenantAwareBaseEntity> entityClass, final String targetAddress, final Class<? extends TenantAwareBaseEntity> entityClass,

View File

@@ -9,6 +9,8 @@
*/ */
package org.eclipse.hawkbit.repository.event.remote; package org.eclipse.hawkbit.repository.event.remote;
import java.io.Serial;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.Getter; import lombok.Getter;
import lombok.ToString; import lombok.ToString;
@@ -16,8 +18,6 @@ import org.eclipse.hawkbit.repository.event.entity.EntityDeletedEvent;
import org.eclipse.hawkbit.repository.model.Target; import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity; import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
import java.io.Serial;
/** /**
* Defines the remote event of deleting a {@link Target}. * Defines the remote event of deleting a {@link Target}.
*/ */
@@ -40,19 +40,12 @@ public class TargetDeletedEvent extends RemoteIdEvent implements EntityDeletedEv
} }
/** /**
* * @param tenant the tenant
* @param tenant * @param entityId the entity id
* the tenant * @param controllerId the controllerId of the target
* @param entityId * @param targetAddress the target address
* the entity id * @param entityClass the entity class
* @param controllerId * @param applicationId the origin application id
* the controllerId of the target
* @param targetAddress
* the target address
* @param entityClass
* the entity class
* @param applicationId
* the origin application id
*/ */
public TargetDeletedEvent(final String tenant, final Long entityId, final String controllerId, public TargetDeletedEvent(final String tenant, final Long entityId, final String controllerId,
final String targetAddress, final Class<? extends TenantAwareBaseEntity> entityClass, final String targetAddress, final Class<? extends TenantAwareBaseEntity> entityClass,

View File

@@ -14,7 +14,6 @@ import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity; import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
/** /**
*
* Defines the remote event of deleting a {@link TargetFilterQuery}. * Defines the remote event of deleting a {@link TargetFilterQuery}.
*/ */
public class TargetFilterQueryDeletedEvent extends RemoteIdEvent implements EntityDeletedEvent { public class TargetFilterQueryDeletedEvent extends RemoteIdEvent implements EntityDeletedEvent {
@@ -29,15 +28,10 @@ public class TargetFilterQueryDeletedEvent extends RemoteIdEvent implements Enti
} }
/** /**
* * @param tenant the tenant
* @param tenant * @param entityId the entity id
* the tenant * @param entityClass the entity class
* @param entityId * @param applicationId the origin application id
* the entity id
* @param entityClass
* the entity class
* @param applicationId
* the origin application id
*/ */
public TargetFilterQueryDeletedEvent(final String tenant, final Long entityId, public TargetFilterQueryDeletedEvent(final String tenant, final Long entityId,
final Class<? extends TenantAwareBaseEntity> entityClass, final String applicationId) { final Class<? extends TenantAwareBaseEntity> entityClass, final String applicationId) {

View File

@@ -9,13 +9,13 @@
*/ */
package org.eclipse.hawkbit.repository.event.remote; package org.eclipse.hawkbit.repository.event.remote;
import java.io.Serial;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.Getter; import lombok.Getter;
import lombok.ToString; import lombok.ToString;
import org.eclipse.hawkbit.repository.model.Target; import org.eclipse.hawkbit.repository.model.Target;
import java.io.Serial;
/** /**
* Event is send in case a target polls either through DDI or DMF. * Event is send in case a target polls either through DDI or DMF.
*/ */

View File

@@ -15,7 +15,6 @@ import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
/** /**
* Defines the remote event of delete a {@link TargetTag}. * Defines the remote event of delete a {@link TargetTag}.
*
*/ */
public class TargetTagDeletedEvent extends RemoteIdEvent implements EntityDeletedEvent { public class TargetTagDeletedEvent extends RemoteIdEvent implements EntityDeletedEvent {
@@ -31,14 +30,10 @@ public class TargetTagDeletedEvent extends RemoteIdEvent implements EntityDelete
/** /**
* Constructor for json serialization. * Constructor for json serialization.
* *
* @param tenant * @param tenant the tenant
* the tenant * @param entityId the entity id
* @param entityId * @param entityClass the entity class
* the entity id * @param applicationId the origin application id
* @param entityClass
* the entity class
* @param applicationId
* the origin application id
*/ */
public TargetTagDeletedEvent(final String tenant, final Long entityId, public TargetTagDeletedEvent(final String tenant, final Long entityId,
final Class<? extends TenantAwareBaseEntity> entityClass, final String applicationId) { final Class<? extends TenantAwareBaseEntity> entityClass, final String applicationId) {

View File

@@ -14,7 +14,6 @@ import org.eclipse.hawkbit.repository.model.TargetType;
import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity; import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
/** /**
*
* Defines the remote event of deleting a {@link TargetType}. * Defines the remote event of deleting a {@link TargetType}.
*/ */
public class TargetTypeDeletedEvent extends RemoteIdEvent implements EntityDeletedEvent { public class TargetTypeDeletedEvent extends RemoteIdEvent implements EntityDeletedEvent {
@@ -31,14 +30,10 @@ public class TargetTypeDeletedEvent extends RemoteIdEvent implements EntityDelet
/** /**
* Constructor for json serialization. * Constructor for json serialization.
* *
* @param tenant * @param tenant the tenant
* the tenant * @param entityId the entity id
* @param entityId * @param entityClass the entity class
* the entity id * @param applicationId the origin application id
* @param entityClass
* the entity class
* @param applicationId
* the origin application id
*/ */
public TargetTypeDeletedEvent(final String tenant, final Long entityId, public TargetTypeDeletedEvent(final String tenant, final Long entityId,
final Class<? extends TenantAwareBaseEntity> entityClass, final String applicationId) { final Class<? extends TenantAwareBaseEntity> entityClass, final String applicationId) {

View File

@@ -9,6 +9,8 @@
*/ */
package org.eclipse.hawkbit.repository.event.remote; package org.eclipse.hawkbit.repository.event.remote;
import java.io.Serial;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.Getter; import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@@ -16,8 +18,6 @@ import lombok.ToString;
import org.eclipse.hawkbit.repository.event.entity.EntityDeletedEvent; import org.eclipse.hawkbit.repository.event.entity.EntityDeletedEvent;
import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity; import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
import java.io.Serial;
/** /**
* Defines the remote event of deleting a {@link org.eclipse.hawkbit.repository.model.TenantConfiguration}. * Defines the remote event of deleting a {@link org.eclipse.hawkbit.repository.model.TenantConfiguration}.
*/ */

Some files were not shown because too many files have changed in this diff Show More