JpaSoftwareModule#metadata made map (#2412)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -32,7 +32,6 @@ import org.eclipse.hawkbit.repository.exception.UnsupportedSoftwareModuleForThis
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetFilter;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||
import org.eclipse.hawkbit.repository.model.MetaData;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.Statistic;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -126,12 +125,11 @@ public interface DistributionSetManagement extends RepositoryManagement<Distribu
|
||||
/**
|
||||
* Creates a map of distribution set meta-data entries.
|
||||
*
|
||||
* @param id if the {@link DistributionSet} the metadata has to be created for
|
||||
* @param id if the {@link DistributionSet} the meta-data has to be created for
|
||||
* @param metadata the meta-data entries to create or update
|
||||
* @throws EntityNotFoundException if given set does not exist
|
||||
* @throws EntityAlreadyExistsException 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}
|
||||
* @throws AssignmentQuotaExceededException if the maximum number of meta-data entries is exceeded for the addressed {@link DistributionSet}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
void createMetadata(long id, @NotEmpty Map<String, String> metadata);
|
||||
|
||||
@@ -22,7 +22,6 @@ import org.eclipse.hawkbit.repository.builder.TargetBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.TargetFilterQueryBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.TargetTypeBuilder;
|
||||
import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||
import org.eclipse.hawkbit.repository.model.MetaData;
|
||||
|
||||
/**
|
||||
* central {@link BaseEntity} generation service. Objects are created but not
|
||||
|
||||
@@ -26,8 +26,6 @@ import org.eclipse.hawkbit.repository.builder.SoftwareModuleUpdate;
|
||||
import org.eclipse.hawkbit.repository.exception.AssignmentQuotaExceededException;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||
import org.eclipse.hawkbit.repository.exception.RSQLParameterSyntaxException;
|
||||
import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
|
||||
@@ -53,7 +51,39 @@ public interface SoftwareModuleManagement extends RepositoryManagement<SoftwareM
|
||||
* {@link SoftwareModule}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
List<SoftwareModuleMetadata> putMetaData(@NotNull @Valid Collection<SoftwareModuleMetadataCreate> metadata);
|
||||
void createMetadata(@NotNull @Valid Collection<SoftwareModuleMetadataCreate> metadata);
|
||||
|
||||
/**
|
||||
* Finds all meta-data by the given software module id.
|
||||
*
|
||||
* @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 module id
|
||||
* @throws EntityNotFoundException if software module with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
List<SoftwareModuleMetadata> getMetadata(long id);
|
||||
|
||||
/**
|
||||
* Finds all meta-data by the given software module id and key.
|
||||
*
|
||||
* @param id the software module id to retrieve the meta-data from
|
||||
* @param key the meta-data key to retrieve
|
||||
* @return a paged result of all meta-data entries for a given software module id
|
||||
* @throws EntityNotFoundException if software module with given ID does not exist ot the
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
SoftwareModuleMetadata getMetadata(long id, String key);
|
||||
|
||||
/**
|
||||
* Finds all meta-data by the given software module id where {@link SoftwareModuleMetadata#isTargetVisible()}.
|
||||
*
|
||||
* @param pageable the page request to page the result
|
||||
* @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 module id
|
||||
* @throws EntityNotFoundException if software module with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<SoftwareModuleMetadata> findMetaDataBySoftwareModuleIdAndTargetVisible(@NotNull Pageable pageable, long id);
|
||||
|
||||
/**
|
||||
* Creates or updates a single software module meta-data entry.
|
||||
@@ -66,7 +96,7 @@ public interface SoftwareModuleManagement extends RepositoryManagement<SoftwareM
|
||||
* entries is exceeded for the addressed {@link SoftwareModule}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
SoftwareModuleMetadata updateMetaData(@NotNull @Valid SoftwareModuleMetadataCreate metadata);
|
||||
SoftwareModuleMetadata updateMetadata(@NotNull @Valid SoftwareModuleMetadataCreate metadata);
|
||||
|
||||
/**
|
||||
* Updates a distribution set meta-data value if corresponding entry exists.
|
||||
@@ -76,17 +106,18 @@ public interface SoftwareModuleManagement extends RepositoryManagement<SoftwareM
|
||||
* @throws EntityNotFoundException in case the meta-data entry does not exist and cannot be updated
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
SoftwareModuleMetadata updateMetaData(@NotNull @Valid SoftwareModuleMetadataUpdate update);
|
||||
SoftwareModuleMetadata updateMetadata(@NotNull @Valid SoftwareModuleMetadataUpdate update);
|
||||
|
||||
/**
|
||||
* Deletes a software module meta-data entry.
|
||||
*
|
||||
* @param id where meta-data has to be deleted
|
||||
* @param key of the meta-data element
|
||||
* @throws EntityNotFoundException of module or metadata entry does not exist
|
||||
* @throws EntityNotFoundException if software module with given ID does not exist or the key is not found
|
||||
* @return true if really deleted, false if not
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
void deleteMetaData(long id, @NotEmpty String key);
|
||||
void deleteMetadata(long id, @NotEmpty String key);
|
||||
|
||||
/**
|
||||
* Locks a software module.
|
||||
@@ -144,54 +175,6 @@ public interface SoftwareModuleManagement extends RepositoryManagement<SoftwareM
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Optional<SoftwareModule> findByNameAndVersionAndType(@NotEmpty String name, @NotEmpty String version, long typeId);
|
||||
|
||||
/**
|
||||
* Finds a single software module meta-data by its id.
|
||||
*
|
||||
* @param id where meta-data has to be found
|
||||
* @param key of the meta-data element
|
||||
* @return the found SoftwareModuleMetadata or {@code null} if not exits
|
||||
* @throws EntityNotFoundException is module with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Optional<SoftwareModuleMetadata> findMetaDataBySoftwareModuleId(long id, @NotEmpty String key);
|
||||
|
||||
/**
|
||||
* Finds all meta-data by the given software module id.
|
||||
*
|
||||
* @param pageable the page request to page the result
|
||||
* @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 module id
|
||||
* @throws EntityNotFoundException if software module with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<SoftwareModuleMetadata> findMetaDataBySoftwareModuleId(@NotNull Pageable pageable, long id);
|
||||
|
||||
/**
|
||||
* Finds all meta-data by the given software module id where {@link SoftwareModuleMetadata#isTargetVisible()}.
|
||||
*
|
||||
* @param pageable the page request to page the result
|
||||
* @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 module id
|
||||
* @throws EntityNotFoundException if software module with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<SoftwareModuleMetadata> findMetaDataBySoftwareModuleIdAndTargetVisible(@NotNull Pageable pageable, long id);
|
||||
|
||||
/**
|
||||
* Finds all meta-data by the given software module id.
|
||||
*
|
||||
* @param id the software module id to retrieve the meta-data from
|
||||
* @param rsqlParam filter definition in RSQL syntax
|
||||
* @param pageable the page request to page the result
|
||||
* @return a paged result of all meta-data entries for a given software module id
|
||||
* @throws RSQLParameterUnsupportedFieldException if a field in the RSQL string is used but not provided by the given
|
||||
* {@code fieldNameProvider}
|
||||
* @throws RSQLParameterSyntaxException if the RSQL syntax is wrong
|
||||
* @throws EntityNotFoundException if software module with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<SoftwareModuleMetadata> findMetaDataByRsql(long id, @NotNull String rsqlParam, @NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
* Retrieves the {@link SoftwareModule}s by their {@link SoftwareModuleType}
|
||||
*
|
||||
@@ -215,14 +198,4 @@ public interface SoftwareModuleManagement extends RepositoryManagement<SoftwareM
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
long countByAssignedTo(long distributionSetId);
|
||||
|
||||
/**
|
||||
* Counts all meta-data by the given software module id.
|
||||
*
|
||||
* @param id the software module id to retrieve the meta-data count from
|
||||
* @return count of all meta-data entries for a given software module id
|
||||
* @throws EntityNotFoundException if software module with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
long countMetaDataBySoftwareModuleId(long id);
|
||||
}
|
||||
@@ -31,7 +31,6 @@ import org.eclipse.hawkbit.repository.exception.RSQLParameterSyntaxException;
|
||||
import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||
import org.eclipse.hawkbit.repository.model.MetaData;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
||||
@@ -521,15 +520,12 @@ public interface TargetManagement {
|
||||
@NotNull String controllerId, long distributionSetId, @NotNull String targetFilterQuery);
|
||||
|
||||
/**
|
||||
* Initiates {@link TargetType} assignment to given {@link Target}s. If some
|
||||
* targets in the list have the {@link TargetType} not yet assigned, they will
|
||||
* get assigned. If all targets are already of that type, there will be no
|
||||
* un-assignment.
|
||||
* Initiates {@link TargetType} assignment to given {@link Target}s. If some targets in the list have the {@link TargetType}
|
||||
* not yet assigned, they will get assigned. If all targets are already of that type, there will be no un-assignment.
|
||||
*
|
||||
* @param controllerIds to set the type to
|
||||
* @param typeId to assign targets to
|
||||
* @return {@link TargetTypeAssignmentResult} with all metadata of the
|
||||
* assignment outcome.
|
||||
* @return {@link TargetTypeAssignmentResult} with all meta-data of the assignment outcome.
|
||||
* @throws EntityNotFoundException if target type with given id does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
||||
@@ -539,7 +535,7 @@ public interface TargetManagement {
|
||||
* Initiates {@link TargetType} un-assignment to given {@link Target}s. The type of the targets will be set to {@code null}
|
||||
*
|
||||
* @param controllerIds to remove the type from
|
||||
* @return {@link TargetTypeAssignmentResult} with all metadata of the assignment outcome.
|
||||
* @return {@link TargetTypeAssignmentResult} with all meta-data of the assignment outcome.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
||||
TargetTypeAssignmentResult unassignType(@NotEmpty Collection<String> controllerIds);
|
||||
@@ -701,11 +697,11 @@ public interface TargetManagement {
|
||||
/**
|
||||
* Creates a list of target meta-data entries.
|
||||
*
|
||||
* @param controllerId {@link Target} controller id the metadata has to be created for
|
||||
* @param controllerId {@link Target} controller id the meta-data has to be created for
|
||||
* @param metadata the meta-data entries to create or update
|
||||
* @throws EntityNotFoundException if given target does not exist
|
||||
* @throws EntityAlreadyExistsException 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}
|
||||
* @throws EntityAlreadyExistsException in case one of the metad-ata entry already exists for the specific key
|
||||
* @throws AssignmentQuotaExceededException if the maximum number of meta-data entries is exceeded for the addressed {@link Target}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
void createMetadata(@NotEmpty String controllerId, @NotEmpty Map<String, String> metadata);
|
||||
@@ -714,7 +710,7 @@ public interface TargetManagement {
|
||||
* Finds a single target meta-data by its id.
|
||||
*
|
||||
* @param controllerId of the {@link Target}
|
||||
* @return the found target metadata
|
||||
* @return the found target meta-data
|
||||
* @throws EntityNotFoundException if target with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
@@ -723,10 +719,10 @@ public interface TargetManagement {
|
||||
/**
|
||||
* Updates a target meta-data value if corresponding entry exists.
|
||||
*
|
||||
* @param controllerId {@link Target} controller id of the metadata entry to be updated
|
||||
* @param controllerId {@link Target} controller id of the meta-data entry to be updated
|
||||
* @param key meta data-entry key to be updated
|
||||
* @param value meta data-entry to be new value
|
||||
* @throws EntityNotFoundException in case the metadata entry does not exist and cannot be updated
|
||||
* @throws EntityNotFoundException in case the meta-data entry does not exist and cannot be updated
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
void updateMetadata(@NotEmpty String controllerId, @NotNull String key, @NotNull String value);
|
||||
@@ -734,7 +730,7 @@ public interface TargetManagement {
|
||||
/**
|
||||
* Deletes a target meta data entry.
|
||||
*
|
||||
* @param controllerId where metadata has to be deleted
|
||||
* @param controllerId where meta-data has to be deleted
|
||||
* @param key of the meta data element
|
||||
* @throws EntityNotFoundException if given target does not exist
|
||||
*/
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.MetaData;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
|
||||
|
||||
@@ -19,14 +18,14 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
|
||||
public interface SoftwareModuleMetadataBuilder {
|
||||
|
||||
/**
|
||||
* @param softwareModuleId of the {@link SoftwareModule} the {@link MetaData} belongs to
|
||||
* @param key of {@link MetaData#getKey()}
|
||||
* @param softwareModuleId of the {@link SoftwareModule} the {@link SoftwareModuleMetadata} belongs to
|
||||
* @param key of {@link SoftwareModuleMetadata#getKey()}
|
||||
* @return builder instance
|
||||
*/
|
||||
SoftwareModuleMetadataUpdate update(long softwareModuleId, String key);
|
||||
|
||||
/**
|
||||
* @param softwareModuleId of the {@link SoftwareModule} the {@link MetaData} belongs to
|
||||
* @param softwareModuleId of the {@link SoftwareModule} the {@link SoftwareModuleMetadata} belongs to
|
||||
* @return builder instance
|
||||
*/
|
||||
SoftwareModuleMetadataCreate create(long softwareModuleId);
|
||||
|
||||
@@ -13,7 +13,7 @@ import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||
import org.eclipse.hawkbit.repository.model.MetaData;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
|
||||
|
||||
/**
|
||||
@@ -24,16 +24,16 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
|
||||
public interface SoftwareModuleMetadataCreate {
|
||||
|
||||
/**
|
||||
* @param key for {@link MetaData#getKey()}
|
||||
* @param key for {@link SoftwareModuleMetadata#getKey()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
SoftwareModuleMetadataCreate key(@Size(min = 1, max = MetaData.KEY_MAX_SIZE) @NotNull String key);
|
||||
SoftwareModuleMetadataCreate key(@Size(min = 1, max =SoftwareModule.METADATA_KEY_MAX_SIZE) @NotNull String key);
|
||||
|
||||
/**
|
||||
* @param value for {@link MetaData#getValue()}
|
||||
* @param value for {@link SoftwareModuleMetadata#getValue()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
SoftwareModuleMetadataCreate value(@Size(max = MetaData.VALUE_MAX_SIZE) String value);
|
||||
SoftwareModuleMetadataCreate value(@Size(max = SoftwareModule.METADATA_VALUE_MAX_SIZE) String value);
|
||||
|
||||
/**
|
||||
* @param visible for {@link SoftwareModuleMetadata#isTargetVisible()}
|
||||
|
||||
@@ -12,7 +12,7 @@ package org.eclipse.hawkbit.repository.builder;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.MetaData;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
|
||||
|
||||
/**
|
||||
@@ -22,10 +22,10 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
|
||||
public interface SoftwareModuleMetadataUpdate {
|
||||
|
||||
/**
|
||||
* @param value for {@link MetaData#getValue()}
|
||||
* @param value for {@link SoftwareModuleMetadata#getValue()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
SoftwareModuleMetadataUpdate value(@Size(min = 1, max = MetaData.VALUE_MAX_SIZE) @NotNull String value);
|
||||
SoftwareModuleMetadataUpdate value(@Size(min = 1, max = SoftwareModule.METADATA_VALUE_MAX_SIZE) @NotNull String value);
|
||||
|
||||
/**
|
||||
* @param visible for {@link SoftwareModuleMetadata#isTargetVisible()}
|
||||
|
||||
@@ -18,7 +18,6 @@ import lombok.Getter;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||
import org.eclipse.hawkbit.repository.model.MetaData;
|
||||
|
||||
/**
|
||||
* the {@link EntityNotFoundException} is thrown when a entity queried but not found.
|
||||
@@ -76,9 +75,7 @@ public class EntityNotFoundException extends AbstractServerRtException {
|
||||
* @param entityId of the {@link BaseEntity}
|
||||
*/
|
||||
public EntityNotFoundException(final String type, final Object entityId) {
|
||||
super(type + " with given identifier {" + entityId + "} does not exist.",
|
||||
THIS_ERROR,
|
||||
Map.of(TYPE, type, ENTITY_ID, entityId));
|
||||
super(type + " with given identifier {" + entityId + "} does not exist.", THIS_ERROR, Map.of(TYPE, type, ENTITY_ID, entityId));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,30 +88,6 @@ public class EntityNotFoundException extends AbstractServerRtException {
|
||||
this(type.getSimpleName(), entityId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor for {@link MetaData} not found.
|
||||
*
|
||||
* @param type of the entity that was not found
|
||||
* @param entityId of the {@link BaseEntity} the {@link MetaData} was for
|
||||
* @param key for the {@link MetaData} entry
|
||||
*/
|
||||
public EntityNotFoundException(final Class<? extends MetaData> type, final Long entityId, final String key) {
|
||||
this(type, String.valueOf(entityId), key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor for {@link MetaData} not found.
|
||||
*
|
||||
* @param type of the entity that was not found
|
||||
* @param entityId of the {@link BaseEntity} the {@link MetaData} was for
|
||||
* @param key for the {@link MetaData} entry
|
||||
*/
|
||||
public EntityNotFoundException(final Class<? extends MetaData> type, final String entityId, final String key) {
|
||||
super(type.getSimpleName() + " for given entity {" + toEntityString(entityId) + "} and with key {" + key + "} does not exist.",
|
||||
THIS_ERROR,
|
||||
Map.of(TYPE, type.getSimpleName(), ENTITY_ID, entityId, KEY, key));
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor for a list of {@link BaseEntity}s not found.
|
||||
*
|
||||
@@ -122,10 +95,14 @@ public class EntityNotFoundException extends AbstractServerRtException {
|
||||
* @param expected collection of the {@link BaseEntity#getId()}s
|
||||
* @param found collection of the {@link BaseEntity#getId()}s
|
||||
*/
|
||||
public EntityNotFoundException(final Class<? extends BaseEntity> type, final Collection<?> expected,
|
||||
final Collection<?> found) {
|
||||
super(type.getSimpleName() + "s with given identifiers {" + toEntityString(expected.stream().filter(id -> !found.contains(id))
|
||||
.map(String::valueOf).collect(Collectors.joining(","))) + "} do not exist.",
|
||||
public EntityNotFoundException(final Class<? extends BaseEntity> type, final Collection<?> expected, final Collection<?> found) {
|
||||
super(
|
||||
String.format("%ss with given identifiers {%s} do not exist.",
|
||||
type.getSimpleName(),
|
||||
toEntityString(expected.stream()
|
||||
.filter(id -> !found.contains(id))
|
||||
.map(String::valueOf)
|
||||
.collect(Collectors.joining(",")))),
|
||||
THIS_ERROR,
|
||||
Map.of(TYPE, type.getSimpleName(), ENTITY_ID, expected.stream().filter(id -> !found.contains(id)).map(String::valueOf)));
|
||||
}
|
||||
|
||||
@@ -26,12 +26,12 @@ public interface DistributionSet extends NamedVersionedEntity {
|
||||
/**
|
||||
* Maximum length of metadata key.
|
||||
*/
|
||||
int METADATA_KEY_SIZE = 128;
|
||||
int METADATA_MAX_KEY_SIZE = 128;
|
||||
|
||||
/**
|
||||
* Maximum length of metadata value.
|
||||
*/
|
||||
int METADATA_VALUE_SIZE = 4000;
|
||||
int METADATA_MAX_VALUE_SIZE = 4000;
|
||||
|
||||
/**
|
||||
* @return type of the {@link DistributionSet}.
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Meta data for entities, a (key/value) store.
|
||||
*/
|
||||
public interface MetaData extends Serializable {
|
||||
|
||||
/**
|
||||
* Maximum length of metadata key.
|
||||
*/
|
||||
int KEY_MAX_SIZE = 128;
|
||||
|
||||
/**
|
||||
* Maximum length of metadata value.
|
||||
*/
|
||||
int VALUE_MAX_SIZE = 4000;
|
||||
|
||||
/**
|
||||
* @return {@link BaseEntity#getId()} the metadata is related to
|
||||
*/
|
||||
Long getEntityId();
|
||||
|
||||
/**
|
||||
* @return the key
|
||||
*/
|
||||
String getKey();
|
||||
|
||||
/**
|
||||
* @return the value
|
||||
*/
|
||||
String getValue();
|
||||
|
||||
}
|
||||
@@ -22,6 +22,16 @@ public interface SoftwareModule extends NamedVersionedEntity {
|
||||
*/
|
||||
int VENDOR_MAX_SIZE = 256;
|
||||
|
||||
/**
|
||||
* Maximum length of metadata key.
|
||||
*/
|
||||
int METADATA_KEY_MAX_SIZE = 128;
|
||||
|
||||
/**
|
||||
* Maximum length of metadata value.
|
||||
*/
|
||||
int METADATA_VALUE_MAX_SIZE = 4000;
|
||||
|
||||
/**
|
||||
* @return the type of the software module
|
||||
*/
|
||||
|
||||
@@ -9,24 +9,26 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* {@link MetaData} element of a {@link SoftwareModule}.
|
||||
* Metadata element of a {@link SoftwareModule}. The software module metadata is not only (key, value) pair (like the metadata of
|
||||
* targets and distribution sets), but also contains the information if the metadata is visible for targets as part of {@link Action}.
|
||||
*/
|
||||
public interface SoftwareModuleMetadata extends MetaData {
|
||||
public interface SoftwareModuleMetadata extends Serializable {
|
||||
|
||||
/**
|
||||
* @return {@link SoftwareModule} this entry belongs to.
|
||||
* @return the key
|
||||
*/
|
||||
SoftwareModule getSoftwareModule();
|
||||
|
||||
@Override
|
||||
default Long getEntityId() {
|
||||
return getSoftwareModule().getId();
|
||||
}
|
||||
String getKey();
|
||||
|
||||
/**
|
||||
* @return <code>true</code> if element is visible for targets as part of
|
||||
* {@link Action}.
|
||||
* @return the value
|
||||
*/
|
||||
String getValue();
|
||||
|
||||
/**
|
||||
* @return <code>true</code> if element is visible for targets as part of {@link Action}.
|
||||
*/
|
||||
boolean isTargetVisible();
|
||||
}
|
||||
|
||||
@@ -40,22 +40,22 @@ public interface Target extends NamedEntity {
|
||||
/**
|
||||
* Maximum length of key of controller attribute
|
||||
*/
|
||||
int CONTROLLER_ATTRIBUTE_KEY_SIZE = 128;
|
||||
int CONTROLLER_ATTRIBUTE_MAX_KEY_SIZE = 128;
|
||||
|
||||
/**
|
||||
* Maximum length of value of controller attribute
|
||||
*/
|
||||
int CONTROLLER_ATTRIBUTE_VALUE_SIZE = 128;
|
||||
int CONTROLLER_ATTRIBUTE_MAX_VALUE_SIZE = 128;
|
||||
|
||||
/**
|
||||
* Maximum length of metadata key.
|
||||
*/
|
||||
int CONTROLLER_METADATA_KEY_SIZE = 128;
|
||||
int METADATA_MAX_KEY_SIZE = 128;
|
||||
|
||||
/**
|
||||
* Maximum length of metadata value.
|
||||
*/
|
||||
int CONTROLLER_METADATA_VALUE_SIZE = 4000;
|
||||
int METADATA_MAX_VALUE_SIZE = 4000;
|
||||
|
||||
/**
|
||||
* @return business identifier of the {@link Target}
|
||||
|
||||
Reference in New Issue
Block a user