Complete field constraint documentation in repository API (#565)

* Document constraints in builders.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Completed constraint documentation in repository API

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Fix typo.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
Kai Zimmermann
2017-08-02 13:10:28 +02:00
committed by GitHub
parent e2ca4cf840
commit 4dc0093d8b
38 changed files with 339 additions and 97 deletions

View File

@@ -13,6 +13,7 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.validation.ConstraintViolationException;
import javax.validation.constraints.NotNull;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
@@ -55,6 +56,9 @@ public interface ControllerManagement {
* 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)
@@ -74,6 +78,9 @@ public interface ControllerManagement {
* 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)
ActionStatus addInformationalActionStatus(@NotNull ActionStatusCreate create);
@@ -91,9 +98,11 @@ public interface ControllerManagement {
* @throws QuotaExceededException
* if more than the allowed number of status entries or messages
* per entry are inserted
*
* @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)
Action addUpdateActionStatus(@NotNull ActionStatusCreate create);

View File

@@ -12,6 +12,7 @@ import java.util.Collection;
import java.util.List;
import java.util.Optional;
import javax.validation.ConstraintViolationException;
import javax.validation.constraints.NotNull;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
@@ -111,6 +112,9 @@ public interface DistributionSetManagement {
* @throws DistributionSetCreationFailedMissingMandatoryModuleException
* is {@link DistributionSet} does not contain mandatory
* {@link SoftwareModule}s.
* @throws ConstraintViolationException
* if fields are not filled as specified. Check
* {@link DistributionSetCreate} for field constraints.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
DistributionSet createDistributionSet(@NotNull DistributionSetCreate create);
@@ -148,6 +152,9 @@ public interface DistributionSetManagement {
* @throws DistributionSetCreationFailedMissingMandatoryModuleException
* is {@link DistributionSet} does not contain mandatory
* {@link SoftwareModule}s.
* @throws ConstraintViolationException
* if fields are not filled as specified. Check
* {@link DistributionSetCreate} for field constraints.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
List<DistributionSet> createDistributionSets(@NotNull Collection<DistributionSetCreate> creates);
@@ -529,6 +536,9 @@ public interface DistributionSetManagement {
* @throws EntityReadOnlyException
* if user tries to change requiredMigrationStep or type on a DS
* that is already assigned to targets
* @throws ConstraintViolationException
* if fields are not filled as specified. Check
* {@link DistributionSetUpdate} for field constraints.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
DistributionSet updateDistributionSet(@NotNull DistributionSetUpdate update);

View File

@@ -12,6 +12,7 @@ import java.util.Collection;
import java.util.List;
import java.util.Optional;
import javax.validation.ConstraintViolationException;
import javax.validation.constraints.NotNull;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
@@ -46,6 +47,9 @@ public interface DistributionSetTypeManagement {
* if a provided linked entity does not exists (
* {@link DistributionSetType#getMandatoryModuleTypes()} or
* {@link DistributionSetType#getOptionalModuleTypes()}
* @throws ConstraintViolationException
* if fields are not filled as specified. Check
* {@link DistributionSetTypeCreate} for field constraints.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
DistributionSetType createDistributionSetType(@NotNull DistributionSetTypeCreate create);
@@ -61,6 +65,9 @@ public interface DistributionSetTypeManagement {
* if a provided linked entity does not exists (
* {@link DistributionSetType#getMandatoryModuleTypes()} or
* {@link DistributionSetType#getOptionalModuleTypes()}
* @throws ConstraintViolationException
* if fields are not filled as specified. Check
* {@link DistributionSetTypeCreate} for field constraints.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
List<DistributionSetType> createDistributionSetTypes(@NotNull Collection<DistributionSetTypeCreate> creates);
@@ -161,6 +168,9 @@ public interface DistributionSetTypeManagement {
* if the {@link DistributionSetType} is already in use by a
* {@link DistributionSet} and user tries to change list of
* {@link SoftwareModuleType}s
* @throws ConstraintViolationException
* if fields are not filled as specified. Check
* {@link DistributionSetTypeUpdate} for field constraints.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
DistributionSetType updateDistributionSetType(@NotNull DistributionSetTypeUpdate update);

View File

@@ -121,7 +121,7 @@ public interface RolloutManagement {
* @throws EntityNotFoundException
* if given {@link DistributionSet} does not exist
* @throws ConstraintViolationException
* if rollout or group parameters are invalid
* if rollout or group parameters are invalid.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_WRITE)
Rollout createRollout(@NotNull RolloutCreate create, int amountGroup, @NotNull RolloutGroupConditions conditions);
@@ -174,6 +174,9 @@ public interface RolloutManagement {
* @return the validation information
* @throws RolloutIllegalStateException
* thrown when no targets are targeted by the rollout
* @throws ConstraintViolationException
* if fields are not filled as specified. Check
* {@link RolloutGroupCreate} for field constraints.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ_AND_TARGET_READ)
ListenableFuture<RolloutGroupsValidation> validateTargetsInGroups(List<RolloutGroupCreate> groups,

View File

@@ -12,6 +12,7 @@ import java.util.Collection;
import java.util.List;
import java.util.Optional;
import javax.validation.ConstraintViolationException;
import javax.validation.constraints.NotNull;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
@@ -71,11 +72,14 @@ public interface SoftwareModuleManagement {
* @param creates
* {@link SoftwareModule}s to create
* @return SoftwareModule
*
* @throws EntityAlreadyExistsException
* if a given entity already exists
*
* @throws EntityNotFoundException
* of given software module type does not exist
* @throws ConstraintViolationException
* if fields are not filled as specified. Check
* {@link SoftwareModuleCreate} for field constraints.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
List<SoftwareModule> createSoftwareModule(@NotNull Collection<SoftwareModuleCreate> creates);
@@ -85,11 +89,14 @@ public interface SoftwareModuleManagement {
* @param create
* SoftwareModule to create
* @return SoftwareModule
*
* @throws EntityAlreadyExistsException
* if a given entity already exists
*
* @throws EntityNotFoundException
* of given software module type does not exist
* @throws ConstraintViolationException
* if fields are not filled as specified. Check
* {@link SoftwareModuleCreate} for field constraints.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
SoftwareModule createSoftwareModule(@NotNull SoftwareModuleCreate create);
@@ -407,7 +414,10 @@ public interface SoftwareModuleManagement {
* @return the saved Entity.
*
* @throws EntityNotFoundException
* if fiven {@link SoftwareModule} does not exist
* if given {@link SoftwareModule} does not exist
* @throws ConstraintViolationException
* if fields are not filled as specified. Check
* {@link SoftwareModuleUpdate} for field constraints.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
SoftwareModule updateSoftwareModule(@NotNull SoftwareModuleUpdate update);

View File

@@ -12,6 +12,7 @@ import java.util.Collection;
import java.util.List;
import java.util.Optional;
import javax.validation.ConstraintViolationException;
import javax.validation.constraints.NotNull;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
@@ -44,6 +45,10 @@ public interface SoftwareModuleTypeManagement {
* @param creates
* to create
* @return created Entity
*
* @throws ConstraintViolationException
* if fields are not filled as specified. Check
* {@link SoftwareModuleTypeCreate} for field constraints.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
List<SoftwareModuleType> createSoftwareModuleType(@NotNull Collection<SoftwareModuleTypeCreate> creates);
@@ -54,6 +59,10 @@ public interface SoftwareModuleTypeManagement {
* @param create
* to create
* @return created Entity
*
* @throws ConstraintViolationException
* if fields are not filled as specified. Check
* {@link SoftwareModuleTypeCreate} for field constraints.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
SoftwareModuleType createSoftwareModuleType(@NotNull SoftwareModuleTypeCreate create);
@@ -137,6 +146,9 @@ public interface SoftwareModuleTypeManagement {
* @throws EntityNotFoundException
* in case the {@link SoftwareModuleType} does not exists and
* cannot be updated
* @throws ConstraintViolationException
* if fields are not filled as specified. Check
* {@link SoftwareModuleTypeUpdate} for field constraints.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
SoftwareModuleType updateSoftwareModuleType(@NotNull SoftwareModuleTypeUpdate update);

View File

@@ -12,6 +12,7 @@ import java.util.Collection;
import java.util.List;
import java.util.Optional;
import javax.validation.ConstraintViolationException;
import javax.validation.constraints.NotNull;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
@@ -51,8 +52,12 @@ public interface TagManagement {
* @param create
* to be created.
* @return the new {@link DistributionSet}
*
* @throws EntityAlreadyExistsException
* if distributionSetTag already exists
* @throws ConstraintViolationException
* if fields are not filled as specified. Check
* {@link TagCreate} for field constraints.
*
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
@@ -64,8 +69,12 @@ public interface TagManagement {
* @param creates
* to be created
* @return the new {@link DistributionSetTag}
*
* @throws EntityAlreadyExistsException
* if a given entity already exists
* @throws ConstraintViolationException
* if fields are not filled as specified. Check
* {@link TagCreate} for field constraints.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
List<DistributionSetTag> createDistributionSetTags(@NotNull Collection<TagCreate> creates);
@@ -80,6 +89,9 @@ public interface TagManagement {
*
* @throws EntityAlreadyExistsException
* if given object already exists
* @throws ConstraintViolationException
* if fields are not filled as specified. Check
* {@link TagCreate} for field constraints.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
TargetTag createTargetTag(@NotNull TagCreate create);
@@ -93,6 +105,9 @@ public interface TagManagement {
*
* @throws EntityAlreadyExistsException
* if given object has already an ID.
* @throws ConstraintViolationException
* if fields are not filled as specified. Check
* {@link TagCreate} for field constraints.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
List<TargetTag> createTargetTags(@NotNull Collection<TagCreate> creates);
@@ -261,6 +276,9 @@ public interface TagManagement {
* @throws EntityNotFoundException
* in case the {@link DistributionSetTag} does not exists and
* cannot be updated
* @throws ConstraintViolationException
* if fields are not filled as specified. Check
* {@link TagUpdate} for field constraints.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
DistributionSetTag updateDistributionSetTag(@NotNull TagUpdate update);
@@ -275,6 +293,9 @@ public interface TagManagement {
* @throws EntityNotFoundException
* in case the {@link TargetTag} does not exists and cannot be
* updated
* @throws ConstraintViolationException
* if fields are not filled as specified. Check
* {@link TagUpdate} for field constraints.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
TargetTag updateTargetTag(@NotNull TagUpdate update);

View File

@@ -10,6 +10,7 @@ package org.eclipse.hawkbit.repository;
import java.util.Optional;
import javax.validation.ConstraintViolationException;
import javax.validation.constraints.NotNull;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
@@ -35,6 +36,9 @@ public interface TargetFilterQueryManagement {
* @param create
* to create
* @return the created {@link TargetFilterQuery}
* @throws ConstraintViolationException
* if fields are not filled as specified. Check
* {@link TargetFilterQueryCreate} for field constraints.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
TargetFilterQuery createTargetFilterQuery(@NotNull TargetFilterQueryCreate create);
@@ -188,6 +192,9 @@ public interface TargetFilterQueryManagement {
* @throws EntityNotFoundException
* if either {@link TargetFilterQuery} and/or autoAssignDs are
* provided but not found
* @throws ConstraintViolationException
* if fields are not filled as specified. Check
* {@link TargetFilterQueryUpdate} for field constraints.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
TargetFilterQuery updateTargetFilterQuery(@NotNull TargetFilterQueryUpdate update);

View File

@@ -11,10 +11,14 @@ package org.eclipse.hawkbit.repository.builder;
import java.util.Collection;
import java.util.Optional;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.eclipse.hawkbit.repository.model.BaseEntity;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.hibernate.validator.constraints.NotEmpty;
import org.eclipse.hawkbit.repository.model.NamedEntity;
import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
/**
* Builder to create a new {@link DistributionSet} entry. Defines all fields
@@ -29,28 +33,28 @@ public interface DistributionSetCreate {
* for {@link DistributionSet#getName()}
* @return updated builder instance
*/
DistributionSetCreate name(@NotEmpty String name);
DistributionSetCreate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name);
/**
* @param version
* for {@link DistributionSet#getVersion()}
* @return updated builder instance
*/
DistributionSetCreate version(@NotEmpty String version);
DistributionSetCreate version(@Size(min = 1, max = NamedVersionedEntity.VERSION_MAX_SIZE) @NotNull String version);
/**
* @param description
* for {@link DistributionSet#getDescription()}
* @return updated builder instance
*/
DistributionSetCreate description(String description);
DistributionSetCreate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
/**
* @param typeKey
* for {@link DistributionSet#getType()}
* @return updated builder instance
*/
DistributionSetCreate type(@NotEmpty String typeKey);
DistributionSetCreate type(@Size(min = 1, max = DistributionSetType.KEY_MAX_SIZE) @NotNull String typeKey);
/**
* @param type

View File

@@ -12,10 +12,13 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.Optional;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.eclipse.hawkbit.repository.model.BaseEntity;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.eclipse.hawkbit.repository.model.NamedEntity;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.hibernate.validator.constraints.NotEmpty;
/**
* Builder to create a new {@link DistributionSetType} entry. Defines all fields
@@ -30,28 +33,28 @@ public interface DistributionSetTypeCreate {
* for {@link DistributionSetType#getKey()}
* @return updated builder instance
*/
DistributionSetTypeCreate key(@NotEmpty String key);
DistributionSetTypeCreate key(@Size(min = 1, max = DistributionSetType.KEY_MAX_SIZE) @NotNull String key);
/**
* @param name
* for {@link DistributionSetType#getName()}
* @return updated builder instance
*/
DistributionSetTypeCreate name(@NotEmpty String name);
DistributionSetTypeCreate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name);
/**
* @param description
* for {@link DistributionSetType#getDescription()}
* @return updated builder instance
*/
DistributionSetTypeCreate description(String description);
DistributionSetTypeCreate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
/**
* @param colour
* for {@link DistributionSetType#getColour()}
* @return updated builder instance
*/
DistributionSetTypeCreate colour(String colour);
DistributionSetTypeCreate colour(@Size(max = DistributionSetType.COLOUR_MAX_SIZE) String colour);
/**
* @param mandatory

View File

@@ -10,7 +10,10 @@ package org.eclipse.hawkbit.repository.builder;
import java.util.Collection;
import javax.validation.constraints.Size;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.eclipse.hawkbit.repository.model.NamedEntity;
/**
* Builder to update an existing {@link DistributionSetType} entry. Defines all
@@ -24,14 +27,14 @@ public interface DistributionSetTypeUpdate {
* for {@link DistributionSetType#getDescription()}
* @return updated builder instance
*/
DistributionSetTypeUpdate description(String description);
DistributionSetTypeUpdate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
/**
* @param colour
* for {@link DistributionSetType#getColour()}
* @return updated builder instance
*/
DistributionSetTypeUpdate colour(String colour);
DistributionSetTypeUpdate colour(@Size(max = DistributionSetType.COLOUR_MAX_SIZE) String colour);
/**
* @param mandatory

View File

@@ -10,9 +10,13 @@ package org.eclipse.hawkbit.repository.builder;
import java.util.Optional;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.hibernate.validator.constraints.NotEmpty;
import org.eclipse.hawkbit.repository.model.NamedEntity;
import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
/**
* Builder to update an existing {@link DistributionSet} entry. Defines all
@@ -25,28 +29,28 @@ public interface DistributionSetUpdate {
* for {@link DistributionSet#getName()}
* @return updated builder instance
*/
DistributionSetUpdate name(@NotEmpty String name);
DistributionSetUpdate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name);
/**
* @param version
* for {@link DistributionSet#getVersion()}
* @return updated builder instance
*/
DistributionSetUpdate version(@NotEmpty String version);
DistributionSetUpdate version(@Size(min = 1, max = NamedVersionedEntity.VERSION_MAX_SIZE) @NotNull String version);
/**
* @param description
* for {@link DistributionSet#getDescription()}
* @return updated builder instance
*/
DistributionSetUpdate description(String description);
DistributionSetUpdate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
/**
* @param typeKey
* for {@link DistributionSet#getType()}
* @return updated builder instance
*/
DistributionSetUpdate type(@NotEmpty String typeKey);
DistributionSetUpdate type(@Size(min = 1, max = DistributionSetType.KEY_MAX_SIZE) @NotNull String typeKey);
/**
* @param type

View File

@@ -11,12 +11,14 @@ package org.eclipse.hawkbit.repository.builder;
import java.util.Optional;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.eclipse.hawkbit.repository.model.Action.ActionType;
import org.eclipse.hawkbit.repository.model.BaseEntity;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.NamedEntity;
import org.eclipse.hawkbit.repository.model.Rollout;
import org.hibernate.validator.constraints.NotEmpty;
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
/**
* Builder to create a new {@link Rollout} entry. Defines all fields that can be
@@ -30,14 +32,14 @@ public interface RolloutCreate {
* for {@link Rollout#getName()}
* @return updated builder instance
*/
RolloutCreate name(@NotEmpty String name);
RolloutCreate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name);
/**
* @param description
* for {@link Rollout#getDescription()}
* @return updated builder instance
*/
RolloutCreate description(String description);
RolloutCreate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
/**
* @param set
@@ -60,7 +62,8 @@ public interface RolloutCreate {
* for {@link Rollout#getTargetFilterQuery()}
* @return updated builder instance
*/
RolloutCreate targetFilterQuery(@NotEmpty String targetFilterQuery);
RolloutCreate targetFilterQuery(
@Size(min = 1, max = TargetFilterQuery.QUERY_MAX_SIZE) @NotNull String targetFilterQuery);
/**
* @param actionType

View File

@@ -8,12 +8,16 @@
*/
package org.eclipse.hawkbit.repository.builder;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.eclipse.hawkbit.repository.model.BaseEntity;
import org.eclipse.hawkbit.repository.model.NamedEntity;
import org.eclipse.hawkbit.repository.model.Rollout;
import org.eclipse.hawkbit.repository.model.RolloutGroup;
import org.eclipse.hawkbit.repository.model.RolloutGroupConditionBuilder;
import org.eclipse.hawkbit.repository.model.RolloutGroupConditions;
import org.hibernate.validator.constraints.NotEmpty;
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
/**
* Builder to create a new {@link RolloutGroup} entry. Defines all fields that
@@ -27,21 +31,22 @@ public interface RolloutGroupCreate {
* for {@link Rollout#getName()}
* @return updated builder instance
*/
RolloutGroupCreate name(@NotEmpty String name);
RolloutGroupCreate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name);
/**
* @param description
* for {@link Rollout#getDescription()}
* @return updated builder instance
*/
RolloutGroupCreate description(String description);
RolloutGroupCreate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
/**
* @param targetFilterQuery
* for {@link Rollout#getTargetFilterQuery()}
* @return updated builder instance
*/
RolloutGroupCreate targetFilterQuery(@NotEmpty String targetFilterQuery);
RolloutGroupCreate targetFilterQuery(
@Size(min = 1, max = TargetFilterQuery.QUERY_MAX_SIZE) @NotNull String targetFilterQuery);
/**
* @param targetPercentage

View File

@@ -9,10 +9,11 @@
package org.eclipse.hawkbit.repository.builder;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.NamedEntity;
import org.eclipse.hawkbit.repository.model.Rollout;
import org.hibernate.validator.constraints.NotEmpty;
/**
* Builder to update an existing {@link Rollout} entry. Defines all fields that
@@ -25,14 +26,14 @@ public interface RolloutUpdate {
* for {@link Rollout#getName()}
* @return updated builder instance
*/
RolloutUpdate name(@NotEmpty String name);
RolloutUpdate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name);
/**
* @param description
* for {@link Rollout#getDescription()}
* @return updated builder instance
*/
RolloutUpdate description(String description);
RolloutUpdate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
/**
* @param setId

View File

@@ -10,10 +10,14 @@ package org.eclipse.hawkbit.repository.builder;
import java.util.Optional;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.eclipse.hawkbit.repository.model.BaseEntity;
import org.eclipse.hawkbit.repository.model.NamedEntity;
import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.hibernate.validator.constraints.NotEmpty;
/**
* Builder to create a new {@link SoftwareModule} entry. Defines all fields that
@@ -27,35 +31,35 @@ public interface SoftwareModuleCreate {
* for {@link SoftwareModule#getName()}
* @return updated builder instance
*/
SoftwareModuleCreate name(@NotEmpty String name);
SoftwareModuleCreate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name);
/**
* @param version
* for {@link SoftwareModule#getVersion()}
* @return updated builder instance
*/
SoftwareModuleCreate version(@NotEmpty String version);
SoftwareModuleCreate version(@Size(min = 1, max = NamedVersionedEntity.VERSION_MAX_SIZE) @NotNull String version);
/**
* @param description
* for {@link SoftwareModule#getDescription()}
* @return updated builder instance
*/
SoftwareModuleCreate description(String description);
SoftwareModuleCreate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
/**
* @param vendor
* for {@link SoftwareModule#getVendor()}
* @return updated builder instance
*/
SoftwareModuleCreate vendor(String vendor);
SoftwareModuleCreate vendor(@Size(max = SoftwareModule.VENDOR_MAX_SIZE) String vendor);
/**
* @param typeKey
* for {@link SoftwareModule#getType()}
* @return updated builder instance
*/
SoftwareModuleCreate type(@NotEmpty String typeKey);
SoftwareModuleCreate type(@Size(min = 1, max = SoftwareModuleType.KEY_MAX_SIZE) @NotNull String typeKey);
/**
* @param type

View File

@@ -8,9 +8,12 @@
*/
package org.eclipse.hawkbit.repository.builder;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.eclipse.hawkbit.repository.model.BaseEntity;
import org.eclipse.hawkbit.repository.model.NamedEntity;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.hibernate.validator.constraints.NotEmpty;
/**
* Builder to create a new {@link SoftwareModuleType} entry. Defines all fields
@@ -24,28 +27,28 @@ public interface SoftwareModuleTypeCreate {
* for {@link SoftwareModuleType#getKey()}
* @return updated builder instance
*/
SoftwareModuleTypeCreate key(@NotEmpty String key);
SoftwareModuleTypeCreate key(@Size(min = 1, max = SoftwareModuleType.KEY_MAX_SIZE) @NotNull String key);
/**
* @param name
* for {@link SoftwareModuleType#getName()}
* @return updated builder instance
*/
SoftwareModuleTypeCreate name(@NotEmpty String name);
SoftwareModuleTypeCreate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name);
/**
* @param description
* for {@link SoftwareModuleType#getDescription()}
* @return updated builder instance
*/
SoftwareModuleTypeCreate description(String description);
SoftwareModuleTypeCreate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
/**
* @param colour
* for {@link SoftwareModuleType#getColour()}
* @return updated builder instance
*/
SoftwareModuleTypeCreate colour(String colour);
SoftwareModuleTypeCreate colour(@Size(max = SoftwareModuleType.COLOUR_MAX_SIZE) String colour);
/**
* @param maxAssignments

View File

@@ -8,6 +8,9 @@
*/
package org.eclipse.hawkbit.repository.builder;
import javax.validation.constraints.Size;
import org.eclipse.hawkbit.repository.model.NamedEntity;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
/**
@@ -21,12 +24,12 @@ public interface SoftwareModuleTypeUpdate {
* for {@link SoftwareModuleType#getDescription()}
* @return updated builder instance
*/
SoftwareModuleTypeUpdate description(String description);
SoftwareModuleTypeUpdate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
/**
* @param colour
* for {@link SoftwareModuleType#getColour()}
* @return updated builder instance
*/
SoftwareModuleTypeUpdate colour(String colour);
SoftwareModuleTypeUpdate colour(@Size(max = SoftwareModuleType.COLOUR_MAX_SIZE) String colour);
}

View File

@@ -8,6 +8,9 @@
*/
package org.eclipse.hawkbit.repository.builder;
import javax.validation.constraints.Size;
import org.eclipse.hawkbit.repository.model.NamedEntity;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
/**
@@ -22,12 +25,12 @@ public interface SoftwareModuleUpdate {
* for {@link SoftwareModule#getDescription()}
* @return updated builder instance
*/
SoftwareModuleUpdate description(String description);
SoftwareModuleUpdate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
/**
* @param vendor
* for {@link SoftwareModule#getVendor()}
* @return updated builder instance
*/
SoftwareModuleUpdate vendor(String vendor);
SoftwareModuleUpdate vendor(@Size(max = SoftwareModule.VENDOR_MAX_SIZE) String vendor);
}

View File

@@ -8,9 +8,12 @@
*/
package org.eclipse.hawkbit.repository.builder;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.eclipse.hawkbit.repository.model.BaseEntity;
import org.eclipse.hawkbit.repository.model.NamedEntity;
import org.eclipse.hawkbit.repository.model.Tag;
import org.hibernate.validator.constraints.NotEmpty;
/**
* Builder to create a new {@link Tag} entry. Defines all fields that can be set
@@ -24,21 +27,21 @@ public interface TagCreate {
* for {@link Tag#getName()}
* @return updated builder instance
*/
TagCreate name(@NotEmpty String name);
TagCreate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name);
/**
* @param description
* for {@link Tag#getDescription()}
* @return updated builder instance
*/
TagCreate description(String description);
TagCreate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
/**
* @param colour
* for {@link Tag#getColour()}
* @return updated builder instance
*/
TagCreate colour(String colour);
TagCreate colour(@Size(max = Tag.COLOUR_MAX_SIZE) String colour);
/**
* @return peek on current state of {@link Tag} in the builder

View File

@@ -8,8 +8,11 @@
*/
package org.eclipse.hawkbit.repository.builder;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.eclipse.hawkbit.repository.model.NamedEntity;
import org.eclipse.hawkbit.repository.model.Tag;
import org.hibernate.validator.constraints.NotEmpty;
/**
* Builder to update an existing {@link Tag} entry. Defines all fields that can
@@ -22,20 +25,20 @@ public interface TagUpdate {
* for {@link Tag#getName()}
* @return updated builder instance
*/
TagUpdate name(@NotEmpty String name);
TagUpdate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name);
/**
* @param description
* for {@link Tag#getDescription()}
* @return updated builder instance
*/
TagUpdate description(String description);
TagUpdate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
/**
* @param colour
* for {@link Tag#getColour()}
* @return updated builder instance
*/
TagUpdate colour(String colour);
TagUpdate colour(@Size(max = Tag.COLOUR_MAX_SIZE) String colour);
}

View File

@@ -10,10 +10,13 @@ package org.eclipse.hawkbit.repository.builder;
import java.util.Optional;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.eclipse.hawkbit.repository.model.BaseEntity;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.NamedEntity;
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
import org.hibernate.validator.constraints.NotEmpty;
/**
* Builder to create a new {@link TargetFilterQuery} entry. Defines all fields
@@ -27,14 +30,14 @@ public interface TargetFilterQueryCreate {
* of {@link TargetFilterQuery#getName()}
* @return updated builder instance
*/
TargetFilterQueryCreate name(@NotEmpty String name);
TargetFilterQueryCreate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name);
/**
* @param query
* of {@link TargetFilterQuery#getQuery()}
* @return updated builder instance
*/
TargetFilterQueryCreate query(@NotEmpty String query);
TargetFilterQueryCreate query(@Size(min = 1, max = TargetFilterQuery.QUERY_MAX_SIZE) @NotNull String query);
/**
* @param set

View File

@@ -8,8 +8,10 @@
*/
package org.eclipse.hawkbit.repository.builder;
import javax.validation.constraints.Size;
import org.eclipse.hawkbit.repository.model.NamedEntity;
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
import org.hibernate.validator.constraints.NotEmpty;
/**
* Builder to update an existing {@link TargetFilterQuery} entry. Defines all
@@ -22,13 +24,13 @@ public interface TargetFilterQueryUpdate {
* of {@link TargetFilterQuery#getName()}
* @return updated builder instance
*/
TargetFilterQueryUpdate name(@NotEmpty String name);
TargetFilterQueryUpdate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) String name);
/**
* @param query
* of {@link TargetFilterQuery#getQuery()}
* @return updated builder instance
*/
TargetFilterQueryUpdate query(@NotEmpty String query);
TargetFilterQueryUpdate query(@Size(min = 1, max = TargetFilterQuery.QUERY_MAX_SIZE) String query);
}

View File

@@ -19,6 +19,15 @@ import java.util.Set;
*
*/
public interface DistributionSetType extends NamedEntity {
/**
* Maximum length of key.
*/
int KEY_MAX_SIZE = 64;
/**
* Maximum length of colour in Management UI.
*/
int COLOUR_MAX_SIZE = 16;
/**
* @return <code>true</code> if the type is deleted and only kept for

View File

@@ -8,9 +8,6 @@
*/
package org.eclipse.hawkbit.repository.model;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/**
* Entities that have a name and description.
*
@@ -19,23 +16,20 @@ public interface NamedEntity extends TenantAwareBaseEntity {
/**
* Maximum length of name.
*/
public static final int NAME_MAX_SIZE = 64;
int NAME_MAX_SIZE = 64;
/**
* Maximum length of description.
*/
public static final int DESCRIPTION_MAX_SIZE = 512;
int DESCRIPTION_MAX_SIZE = 512;
/**
* @return the description of the entity.
*/
@Size(max = DESCRIPTION_MAX_SIZE)
String getDescription();
/**
* @return the name of the entity.
*/
@Size(min = 1, max = NAME_MAX_SIZE)
@NotNull
String getName();
}

View File

@@ -13,6 +13,11 @@ package org.eclipse.hawkbit.repository.model;
*
*/
public interface NamedVersionedEntity extends NamedEntity {
/**
* Maximum length of version.
*/
int VERSION_MAX_SIZE = 64;
/**
* @return the version of entity.
*/

View File

@@ -16,6 +16,10 @@ import java.util.Optional;
*
*/
public interface SoftwareModule extends NamedVersionedEntity {
/**
* Maximum length of software vendor.
*/
int VENDOR_MAX_SIZE = 256;
/**
* @param artifactId

View File

@@ -15,6 +15,15 @@ package org.eclipse.hawkbit.repository.model;
*
*/
public interface SoftwareModuleType extends NamedEntity {
/**
* Maximum length of key.
*/
int KEY_MAX_SIZE = 64;
/**
* Maximum length of colour in Management UI.
*/
int COLOUR_MAX_SIZE = 16;
/**
* @return business key of this {@link SoftwareModuleType}.

View File

@@ -13,6 +13,10 @@ package org.eclipse.hawkbit.repository.model;
*
*/
public interface Tag extends NamedEntity {
/**
* Maximum length of colour in Management UI.
*/
int COLOUR_MAX_SIZE = 16;
/**
* @return colour code of the tag used in Management UI.

View File

@@ -23,17 +23,17 @@ public interface Target extends NamedEntity {
/**
* Maximum length of controllerId.
*/
public static final int CONTROLLER_ID_MAX_SIZE = 64;
int CONTROLLER_ID_MAX_SIZE = 64;
/**
* Maximum length of securityToken.
*/
public static final int SECURITY_TOKEN_MAX_SIZE = 128;
int SECURITY_TOKEN_MAX_SIZE = 128;
/**
* Maximum length of address.
*/
public static final int ADDRESS_MAX_SIZE = 512;
int ADDRESS_MAX_SIZE = 512;
/**
* @return business identifier of the {@link Target}

View File

@@ -33,6 +33,10 @@ package org.eclipse.hawkbit.repository.model;
*
*/
public interface TargetFilterQuery extends TenantAwareBaseEntity {
/**
* Maximum length of query filter string.
*/
int QUERY_MAX_SIZE = 1024;
/**
* @return name of the {@link TargetFilterQuery}.