Continued on the model API extraction. Merged rest api split branch.
Signed-off-by: Kai Zimmermann <kai.zimmermann@bosch-si.com>
This commit is contained in:
@@ -8,8 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.eventbus.event;
|
package org.eclipse.hawkbit.eventbus.event;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.eventbus.event.AbstractEvent;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event declaration for the UI to notify the UI that a rollout has been
|
* Event declaration for the UI to notify the UI that a rollout has been
|
||||||
* changed.
|
* changed.
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
package org.eclipse.hawkbit.repository;
|
package org.eclipse.hawkbit.repository;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -275,4 +276,11 @@ public interface ControllerManagement {
|
|||||||
*/
|
*/
|
||||||
ActionStatus generateActionStatus();
|
ActionStatus generateActionStatus();
|
||||||
|
|
||||||
|
ActionStatus generateActionStatus(Action action, Status status, Long occurredAt, final String message);
|
||||||
|
|
||||||
|
ActionStatus generateActionStatus(Action action, final Status status, Long occurredAt,
|
||||||
|
final Collection<String> messages);
|
||||||
|
|
||||||
|
ActionStatus generateActionStatus(Action action, Status status, Long occurredAt);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -322,8 +322,10 @@ public interface DeploymentManagement {
|
|||||||
* @return the corresponding {@link Page} of {@link ActionStatus}
|
* @return the corresponding {@link Page} of {@link ActionStatus}
|
||||||
*/
|
*/
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||||
Page<ActionStatus> findActionStatusByAction(@NotNull Pageable pageReq, @NotNull Action action,
|
Page<ActionStatus> findActionStatusByAction(@NotNull Pageable pageReq, @NotNull Action action);
|
||||||
boolean withMessages);
|
|
||||||
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||||
|
Page<ActionStatus> findActionStatusByActionWithMessages(@NotNull Pageable pageReq, @NotNull Action action);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves all {@link Action}s of a specific target ordered by action ID.
|
* Retrieves all {@link Action}s of a specific target ordered by action ID.
|
||||||
@@ -445,4 +447,7 @@ public interface DeploymentManagement {
|
|||||||
* @return {@link Action} object
|
* @return {@link Action} object
|
||||||
*/
|
*/
|
||||||
Action generateAction();
|
Action generateAction();
|
||||||
|
|
||||||
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||||
|
Page<ActionStatus> findActionStatusAll(@NotNull Pageable pageable);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,6 +83,15 @@ public interface DistributionSetManagement {
|
|||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||||
Long countDistributionSetsAll();
|
Long countDistributionSetsAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Count all {@link DistributionSet}s in the repository that are not marked
|
||||||
|
* as deleted.
|
||||||
|
*
|
||||||
|
* @return number of {@link DistributionSet}s
|
||||||
|
*/
|
||||||
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||||
|
Long countDistributionSetsByType(@NotNull DistributionSetType type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return number of {@link DistributionSetType}s in the repository.
|
* @return number of {@link DistributionSetType}s in the repository.
|
||||||
*/
|
*/
|
||||||
@@ -261,20 +270,6 @@ public interface DistributionSetManagement {
|
|||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||||
DistributionSet findDistributionSetByNameAndVersion(@NotEmpty String distributionName, @NotEmpty String version);
|
DistributionSet findDistributionSetByNameAndVersion(@NotEmpty String distributionName, @NotEmpty String version);
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves {@link DistributionSet} List for overview purposes (no
|
|
||||||
* {@link SoftwareModule}s and {@link DistributionSetTag}s).
|
|
||||||
*
|
|
||||||
* Please use {@link #findDistributionSetListWithDetails(Iterable)} if
|
|
||||||
* details are required.
|
|
||||||
*
|
|
||||||
* @param dist
|
|
||||||
* List of {@link DistributionSet} IDs to be found
|
|
||||||
* @return the found {@link DistributionSet}s
|
|
||||||
*/
|
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
|
||||||
List<DistributionSet> findDistributionSetsAll(Collection<Long> dist);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* finds all meta data by the given distribution set id.
|
* finds all meta data by the given distribution set id.
|
||||||
*
|
*
|
||||||
@@ -305,6 +300,20 @@ public interface DistributionSetManagement {
|
|||||||
Page<DistributionSetMetadata> findDistributionSetMetadataByDistributionSetId(@NotNull Long distributionSetId,
|
Page<DistributionSetMetadata> findDistributionSetMetadataByDistributionSetId(@NotNull Long distributionSetId,
|
||||||
@NotNull String rsqlParam, @NotNull Pageable pageable);
|
@NotNull String rsqlParam, @NotNull Pageable pageable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves {@link DistributionSet} List for overview purposes (no
|
||||||
|
* {@link SoftwareModule}s and {@link DistributionSetTag}s).
|
||||||
|
*
|
||||||
|
* Please use {@link #findDistributionSetListWithDetails(Iterable)} if
|
||||||
|
* details are required.
|
||||||
|
*
|
||||||
|
* @param dist
|
||||||
|
* List of {@link DistributionSet} IDs to be found
|
||||||
|
* @return the found {@link DistributionSet}s
|
||||||
|
*/
|
||||||
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||||
|
List<DistributionSet> findDistributionSetsAll(Collection<Long> dist);
|
||||||
|
|
||||||
// TODO discuss: use enum instead of the true,false,null switch ?
|
// TODO discuss: use enum instead of the true,false,null switch ?
|
||||||
/**
|
/**
|
||||||
* finds all {@link DistributionSet}s.
|
* finds all {@link DistributionSet}s.
|
||||||
@@ -328,7 +337,8 @@ public interface DistributionSetManagement {
|
|||||||
* @return all found {@link DistributionSet}s
|
* @return all found {@link DistributionSet}s
|
||||||
*/
|
*/
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||||
Page<DistributionSet> findDistributionSetsAll(@NotNull Pageable pageReq, Boolean deleted, Boolean complete);
|
Page<DistributionSet> findDistributionSetsByDeletedAndOrCompleted(@NotNull Pageable pageReq, Boolean deleted,
|
||||||
|
Boolean complete);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* finds all {@link DistributionSet}s.
|
* finds all {@link DistributionSet}s.
|
||||||
@@ -445,6 +455,26 @@ public interface DistributionSetManagement {
|
|||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||||
DistributionSetMetadata findOne(@NotNull DsMetadataCompositeKey id);
|
DistributionSetMetadata findOne(@NotNull DsMetadataCompositeKey id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates an empty {@link DistributionSet} without persisting it.
|
||||||
|
*
|
||||||
|
* @return {@link DistributionSet} object
|
||||||
|
*/
|
||||||
|
DistributionSet generateDistributionSet();
|
||||||
|
|
||||||
|
DistributionSetMetadata generateDistributionSetMetadata();
|
||||||
|
|
||||||
|
DistributionSetMetadata generateDistributionSetMetadata(DistributionSet distributionSet, String key, String value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates an empty {@link DistributionSetType} without persisting it.
|
||||||
|
*
|
||||||
|
* @return {@link DistributionSetType} object
|
||||||
|
*/
|
||||||
|
DistributionSetType generateDistributionSetType();
|
||||||
|
|
||||||
|
DistributionSetType generateDistributionSetType(String key, String name, String description);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
@@ -567,17 +597,7 @@ public interface DistributionSetManagement {
|
|||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||||
DistributionSetType updateDistributionSetType(@NotNull DistributionSetType dsType);
|
DistributionSetType updateDistributionSetType(@NotNull DistributionSetType dsType);
|
||||||
|
|
||||||
/**
|
DistributionSet generateDistributionSet(String name, String version, String description, DistributionSetType type,
|
||||||
* Generates an empty {@link DistributionSetType} without persisting it.
|
Collection<SoftwareModule> moduleList);
|
||||||
*
|
|
||||||
* @return {@link DistributionSetType} object
|
|
||||||
*/
|
|
||||||
DistributionSetType generateDistributionSetType();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generates an empty {@link DistributionSet} without persisting it.
|
|
||||||
*
|
|
||||||
* @return {@link DistributionSet} object
|
|
||||||
*/
|
|
||||||
DistributionSet generateDistributionSet();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.jpa;
|
package org.eclipse.hawkbit.repository;
|
||||||
|
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Sort;
|
import org.springframework.data.domain.Sort;
|
||||||
@@ -14,13 +14,9 @@ import org.springframework.data.domain.Sort;
|
|||||||
/**
|
/**
|
||||||
* An implementation of the {@link PageRequest} which is offset based by means
|
* An implementation of the {@link PageRequest} which is offset based by means
|
||||||
* the offset is given and not the page number as in the original
|
* the offset is given and not the page number as in the original
|
||||||
* {@link PageRequest} implemntation where the offset is generated. Due that the
|
* {@link PageRequest} implementation where the offset is generated. Due that
|
||||||
* REST-API is working with {@code offset} and {@code limit} parameter we need
|
* the REST-API is working with {@code offset} and {@code limit} parameter we
|
||||||
* an offset based page request for JPA.
|
* need an offset based page request.
|
||||||
*
|
|
||||||
* @author Michael Hirsch
|
|
||||||
* @since 0.2.2
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public final class OffsetBasedPageRequest extends PageRequest {
|
public final class OffsetBasedPageRequest extends PageRequest {
|
||||||
|
|
||||||
@@ -33,12 +33,12 @@ public interface RolloutGroupManagement {
|
|||||||
*
|
*
|
||||||
* @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 page
|
* @param pageable
|
||||||
* the page request to sort and limit the result
|
* 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)
|
||||||
Page<RolloutGroup> findAllRolloutGroupsWithDetailedStatus(@NotNull Long rolloutId, @NotNull Pageable page);
|
Page<RolloutGroup> findAllRolloutGroupsWithDetailedStatus(@NotNull Long rolloutId, @NotNull Pageable pageable);
|
||||||
|
|
||||||
// TODO discuss: target read perm missing?
|
// TODO discuss: target read perm missing?
|
||||||
/**
|
/**
|
||||||
@@ -79,13 +79,13 @@ public interface RolloutGroupManagement {
|
|||||||
* @param specification
|
* @param specification
|
||||||
* the specification to filter the result set based on attributes
|
* the specification to filter the result set based on attributes
|
||||||
* of the {@link RolloutGroup}
|
* of the {@link RolloutGroup}
|
||||||
* @param page
|
* @param pageable
|
||||||
* the page request to sort and limit the result
|
* 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)
|
||||||
Page<RolloutGroup> findRolloutGroupsAll(@NotNull Rollout rollout, @NotNull String rsqlParam,
|
Page<RolloutGroup> findRolloutGroupsAll(@NotNull Rollout rollout, @NotNull String rsqlParam,
|
||||||
@NotNull Pageable page);
|
@NotNull Pageable pageable);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves a page of {@link RolloutGroup}s filtered by a given
|
* Retrieves a page of {@link RolloutGroup}s filtered by a given
|
||||||
@@ -93,12 +93,12 @@ public interface RolloutGroupManagement {
|
|||||||
*
|
*
|
||||||
* @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 page
|
* @param pageable
|
||||||
* the page request to sort and limit the result
|
* 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)
|
||||||
Page<RolloutGroup> findRolloutGroupsByRolloutId(@NotNull Long rolloutId, @NotNull Pageable page);
|
Page<RolloutGroup> findRolloutGroupsByRolloutId(@NotNull Long rolloutId, @NotNull Pageable pageable);
|
||||||
|
|
||||||
// TODO discuss: target read perm missing?
|
// TODO discuss: target read perm missing?
|
||||||
/**
|
/**
|
||||||
@@ -122,14 +122,14 @@ public interface RolloutGroupManagement {
|
|||||||
* rollout group
|
* rollout group
|
||||||
* @param specification
|
* @param specification
|
||||||
* the specification for filtering the targets of a rollout group
|
* the specification for filtering the targets of a rollout group
|
||||||
* @param page
|
* @param pageable
|
||||||
* the page request to sort and limit the result
|
* the page request to sort and limit the result
|
||||||
*
|
*
|
||||||
* @return Page<Target> list of targets of a rollout group
|
* @return Page<Target> list of targets of a rollout group
|
||||||
*/
|
*/
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
|
||||||
Page<Target> findRolloutGroupTargets(@NotNull RolloutGroup rolloutGroup, @NotNull String rsqlParam,
|
Page<Target> findRolloutGroupTargets(@NotNull RolloutGroup rolloutGroup, @NotNull String rsqlParam,
|
||||||
@NotNull Pageable page);
|
@NotNull Pageable pageable);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get count of targets in different status in rollout group.
|
* Get count of targets in different status in rollout group.
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ import javax.validation.constraints.NotNull;
|
|||||||
import org.eclipse.hawkbit.eventbus.event.RolloutGroupCreatedEvent;
|
import org.eclipse.hawkbit.eventbus.event.RolloutGroupCreatedEvent;
|
||||||
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
||||||
import org.eclipse.hawkbit.repository.exception.RolloutIllegalStateException;
|
import org.eclipse.hawkbit.repository.exception.RolloutIllegalStateException;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRollout.RolloutStatus;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup.RolloutGroupConditions;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup.RolloutGroupStatus;
|
|
||||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||||
|
import org.eclipse.hawkbit.repository.model.Rollout.RolloutStatus;
|
||||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||||
|
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupStatus;
|
||||||
|
import org.eclipse.hawkbit.repository.model.RolloutGroupConditions;
|
||||||
import org.hibernate.validator.constraints.NotEmpty;
|
import org.hibernate.validator.constraints.NotEmpty;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
@@ -149,36 +149,36 @@ public interface RolloutManagement {
|
|||||||
/**
|
/**
|
||||||
* Retrieves all rollouts.
|
* Retrieves all rollouts.
|
||||||
*
|
*
|
||||||
* @param page
|
* @param pageable
|
||||||
* the page request to sort and limit the result
|
* the page request to sort and limit the result
|
||||||
* @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)
|
||||||
Page<Rollout> findAll(@NotNull Pageable page);
|
Page<Rollout> findAll(@NotNull Pageable pageable);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get count of targets in different status in rollout.
|
* Get count of targets in different status in rollout.
|
||||||
*
|
*
|
||||||
* @param page
|
* @param pageable
|
||||||
* the page request to sort and limit the result
|
* the page request to sort and limit the result
|
||||||
* @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
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
|
||||||
Page<Rollout> findAllRolloutsWithDetailedStatus(@NotNull Pageable page);
|
Page<Rollout> findAllRolloutsWithDetailedStatus(@NotNull Pageable pageable);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves all rollouts found by the given specification.
|
* Retrieves all rollouts found by the given specification.
|
||||||
*
|
*
|
||||||
* @param specification
|
* @param specification
|
||||||
* the specification to filter rollouts
|
* the specification to filter rollouts
|
||||||
* @param page
|
* @param pageable
|
||||||
* the page request to sort and limit the result
|
* the page request to sort and limit the result
|
||||||
* @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)
|
||||||
Page<Rollout> findAllWithDetailedStatusByPredicate(@NotNull String rsqlParam, @NotNull Pageable page);
|
Page<Rollout> findAllWithDetailedStatusByPredicate(@NotNull String rsqlParam, @NotNull Pageable pageable);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds rollouts by given text in name or description.
|
* Finds rollouts by given text in name or description.
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ public interface SoftwareManagement {
|
|||||||
* in case the meta data does not exists for the given key
|
* in case the meta data does not exists for the given key
|
||||||
*/
|
*/
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||||
SoftwareModuleMetadata findSoftwareModuleMetadata(@NotNull SwMetadataCompositeKey id);
|
SoftwareModuleMetadata findSoftwareModuleMetadata(@NotNull SoftwareModule softwareModule, @NotEmpty String key);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* finds all meta data by the given software module id.
|
* finds all meta data by the given software module id.
|
||||||
@@ -409,7 +409,7 @@ public interface SoftwareManagement {
|
|||||||
* @return the found {@link SoftwareModuleType}s
|
* @return the found {@link SoftwareModuleType}s
|
||||||
*/
|
*/
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||||
Page<SoftwareModuleType> findSoftwareModuleTypesByPredicate(@NotNull String rsqlParam, @NotNull Pageable pageable);
|
Page<SoftwareModuleType> findSoftwareModuleTypesAll(@NotNull String rsqlParam, @NotNull Pageable pageable);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves software module including details (
|
* Retrieves software module including details (
|
||||||
@@ -478,4 +478,37 @@ public interface SoftwareManagement {
|
|||||||
* @return {@link SoftwareModule} object
|
* @return {@link SoftwareModule} object
|
||||||
*/
|
*/
|
||||||
SoftwareModule generateSoftwareModule();
|
SoftwareModule generateSoftwareModule();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a {@link SoftwareModule} without persisting it.
|
||||||
|
*
|
||||||
|
* @param type
|
||||||
|
* of the {@link SoftwareModule}
|
||||||
|
* @param name
|
||||||
|
* abstract name of the {@link SoftwareModule}
|
||||||
|
* @param version
|
||||||
|
* of the {@link SoftwareModule}
|
||||||
|
* @param description
|
||||||
|
* of the {@link SoftwareModule}
|
||||||
|
* @param vendor
|
||||||
|
* of the {@link SoftwareModule}
|
||||||
|
*
|
||||||
|
* @return {@link SoftwareModule} object
|
||||||
|
*/
|
||||||
|
SoftwareModule generateSoftwareModule(SoftwareModuleType type, String name, String version, String description,
|
||||||
|
String vendor);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates an empty {@link SoftwareModuleMetadata} pair without persisting
|
||||||
|
* it.
|
||||||
|
*
|
||||||
|
* @return {@link SoftwareModuleMetadata} object
|
||||||
|
*/
|
||||||
|
SoftwareModuleMetadata generateSoftwareModuleMetadata();
|
||||||
|
|
||||||
|
SoftwareModuleMetadata generateSoftwareModuleMetadata(SoftwareModule softwareModule, String key, String value);
|
||||||
|
|
||||||
|
SoftwareModuleType generateSoftwareModuleType(final String key, final String name, final String description,
|
||||||
|
final int maxAssignments);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,13 +148,13 @@ public interface TagManagement {
|
|||||||
/**
|
/**
|
||||||
* returns all {@link TargetTag}s.
|
* returns all {@link TargetTag}s.
|
||||||
*
|
*
|
||||||
* @param pageReq
|
* @param pageable
|
||||||
* page parameter
|
* page parameter
|
||||||
*
|
*
|
||||||
* @return all {@link TargetTag}s
|
* @return all {@link TargetTag}s
|
||||||
*/
|
*/
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||||
Page<TargetTag> findAllTargetTags(@NotNull Pageable pageReq);
|
Page<TargetTag> findAllTargetTags(@NotNull Pageable pageable);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves all target tags based on the given specification.
|
* Retrieves all target tags based on the given specification.
|
||||||
@@ -245,4 +245,12 @@ public interface TagManagement {
|
|||||||
*/
|
*/
|
||||||
DistributionSetTag generateDistributionSetTag();
|
DistributionSetTag generateDistributionSetTag();
|
||||||
|
|
||||||
|
TargetTag generateTargetTag(String name, String description, String colour);
|
||||||
|
|
||||||
|
TargetTag generateTargetTag(String name);
|
||||||
|
|
||||||
|
DistributionSetTag generateDistributionSetTag(String name, String description, String colour);
|
||||||
|
|
||||||
|
DistributionSetTag generateDistributionSetTag(String name);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -96,4 +96,10 @@ public interface TargetFilterQueryManagement {
|
|||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
||||||
TargetFilterQuery updateTargetFilterQuery(@NotNull TargetFilterQuery targetFilterQuery);
|
TargetFilterQuery updateTargetFilterQuery(@NotNull TargetFilterQuery targetFilterQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates an empty {@link TargetFilterQuery} without persisting it.
|
||||||
|
*
|
||||||
|
* @return {@link TargetFilterQuery} object
|
||||||
|
*/
|
||||||
|
TargetFilterQuery generateTargetFilterQuery();
|
||||||
}
|
}
|
||||||
@@ -10,7 +10,7 @@ package org.eclipse.hawkbit.repository.jpa;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaTenantAwareBaseEntity;
|
import org.eclipse.hawkbit.repository.jpa.model.AbstractJpaTenantAwareBaseEntity;
|
||||||
import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
|
import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
|
||||||
import org.springframework.data.jpa.repository.Modifying;
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
import org.springframework.data.repository.NoRepositoryBean;
|
import org.springframework.data.repository.NoRepositoryBean;
|
||||||
@@ -28,7 +28,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
*/
|
*/
|
||||||
@NoRepositoryBean
|
@NoRepositoryBean
|
||||||
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
public interface BaseEntityRepository<T extends JpaTenantAwareBaseEntity, I extends Serializable>
|
public interface BaseEntityRepository<T extends AbstractJpaTenantAwareBaseEntity, I extends Serializable>
|
||||||
extends PagingAndSortingRepository<T, I> {
|
extends PagingAndSortingRepository<T, I> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ package org.eclipse.hawkbit.repository.jpa;
|
|||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -286,7 +287,7 @@ public class JpaControllerManagement implements ControllerManagement {
|
|||||||
return actionRepository.save(mergedAction);
|
return actionRepository.save(mergedAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleErrorOnAction(final Action mergedAction, final Target mergedTarget) {
|
private void handleErrorOnAction(final JpaAction mergedAction, final Target mergedTarget) {
|
||||||
mergedAction.setActive(false);
|
mergedAction.setActive(false);
|
||||||
mergedAction.setStatus(Status.ERROR);
|
mergedAction.setStatus(Status.ERROR);
|
||||||
mergedTarget.setAssignedDistributionSet(null);
|
mergedTarget.setAssignedDistributionSet(null);
|
||||||
@@ -437,4 +438,28 @@ public class JpaControllerManagement implements ControllerManagement {
|
|||||||
public ActionStatus generateActionStatus() {
|
public ActionStatus generateActionStatus() {
|
||||||
return new JpaActionStatus();
|
return new JpaActionStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(propagation = Propagation.SUPPORTS)
|
||||||
|
public ActionStatus generateActionStatus(final Action action, final Status status, final Long occurredAt,
|
||||||
|
final String message) {
|
||||||
|
return new JpaActionStatus((JpaAction) action, status, occurredAt, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(propagation = Propagation.SUPPORTS)
|
||||||
|
public ActionStatus generateActionStatus(final Action action, final Status status, final Long occurredAt,
|
||||||
|
final Collection<String> messages) {
|
||||||
|
|
||||||
|
final ActionStatus result = new JpaActionStatus((JpaAction) action, status, occurredAt, null);
|
||||||
|
messages.forEach(result::addMessage);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(propagation = Propagation.SUPPORTS)
|
||||||
|
public ActionStatus generateActionStatus(final Action action, final Status status, final Long occurredAt) {
|
||||||
|
return new JpaActionStatus(action, status, occurredAt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -598,11 +598,11 @@ public class JpaDeploymentManagement implements DeploymentManagement {
|
|||||||
|
|
||||||
return convertAcPage(actionRepository.findAll((Specification<JpaAction>) (root, query, cb) -> cb
|
return convertAcPage(actionRepository.findAll((Specification<JpaAction>) (root, query, cb) -> cb
|
||||||
.and(specification.toPredicate(root, query, cb), cb.equal(root.get(JpaAction_.target), target)),
|
.and(specification.toPredicate(root, query, cb), cb.equal(root.get(JpaAction_.target), target)),
|
||||||
pageable));
|
pageable), pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Page<Action> convertAcPage(final Page<JpaAction> findAll) {
|
private static Page<Action> convertAcPage(final Page<JpaAction> findAll, final Pageable pageable) {
|
||||||
return new PageImpl<>(new ArrayList<>(findAll.getContent()));
|
return new PageImpl<>(new ArrayList<>(findAll.getContent()), pageable, findAll.getTotalElements());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -656,13 +656,13 @@ public class JpaDeploymentManagement implements DeploymentManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<ActionStatus> findActionStatusByAction(final Pageable pageReq, final Action action,
|
public Page<ActionStatus> findActionStatusByAction(final Pageable pageReq, final Action action) {
|
||||||
final boolean withMessages) {
|
return actionStatusRepository.findByAction(pageReq, (JpaAction) action);
|
||||||
if (withMessages) {
|
}
|
||||||
return actionStatusRepository.getByAction(pageReq, (JpaAction) action);
|
|
||||||
} else {
|
@Override
|
||||||
return actionStatusRepository.findByAction(pageReq, (JpaAction) action);
|
public Page<ActionStatus> findActionStatusByActionWithMessages(final Pageable pageReq, final Action action) {
|
||||||
}
|
return actionStatusRepository.getByAction(pageReq, (JpaAction) action);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -682,4 +682,13 @@ public class JpaDeploymentManagement implements DeploymentManagement {
|
|||||||
public Action generateAction() {
|
public Action generateAction() {
|
||||||
return new JpaAction();
|
return new JpaAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<ActionStatus> findActionStatusAll(final Pageable pageable) {
|
||||||
|
return convertAcSPage(actionStatusRepository.findAll(pageable), pageable);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Page<ActionStatus> convertAcSPage(final Page<JpaActionStatus> findAll, final Pageable pageable) {
|
||||||
|
return new PageImpl<>(new ArrayList<>(findAll.getContent()), pageable, findAll.getTotalElements());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -298,11 +298,12 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
|||||||
final DistributionSetFilter distributionSetFilter) {
|
final DistributionSetFilter distributionSetFilter) {
|
||||||
final List<Specification<JpaDistributionSet>> specList = buildDistributionSetSpecifications(
|
final List<Specification<JpaDistributionSet>> specList = buildDistributionSetSpecifications(
|
||||||
distributionSetFilter);
|
distributionSetFilter);
|
||||||
return convertDsPage(findByCriteriaAPI(pageable, specList));
|
return convertDsPage(findByCriteriaAPI(pageable, specList), pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Page<DistributionSet> convertDsPage(final Page<JpaDistributionSet> findAll) {
|
private static Page<DistributionSet> convertDsPage(final Page<JpaDistributionSet> findAll,
|
||||||
return new PageImpl<>(new ArrayList<>(findAll.getContent()));
|
final Pageable pageable) {
|
||||||
|
return new PageImpl<>(new ArrayList<>(findAll.getContent()), pageable, findAll.getTotalElements());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -323,8 +324,8 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<DistributionSet> findDistributionSetsAll(final Pageable pageReq, final Boolean deleted,
|
public Page<DistributionSet> findDistributionSetsByDeletedAndOrCompleted(final Pageable pageReq,
|
||||||
final Boolean complete) {
|
final Boolean deleted, final Boolean complete) {
|
||||||
final List<Specification<JpaDistributionSet>> specList = new ArrayList<>();
|
final List<Specification<JpaDistributionSet>> specList = new ArrayList<>();
|
||||||
|
|
||||||
if (deleted != null) {
|
if (deleted != null) {
|
||||||
@@ -337,7 +338,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
|||||||
specList.add(spec);
|
specList.add(spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
return convertDsPage(findByCriteriaAPI(pageReq, specList));
|
return convertDsPage(findByCriteriaAPI(pageReq, specList), pageReq);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -351,7 +352,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
|||||||
specList.add(DistributionSetSpecification.isDeleted(deleted));
|
specList.add(DistributionSetSpecification.isDeleted(deleted));
|
||||||
}
|
}
|
||||||
specList.add(spec);
|
specList.add(spec);
|
||||||
return convertDsPage(findByCriteriaAPI(pageReq, specList));
|
return convertDsPage(findByCriteriaAPI(pageReq, specList), pageReq);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -528,7 +529,8 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
|||||||
return convertMdPage(distributionSetMetadataRepository
|
return convertMdPage(distributionSetMetadataRepository
|
||||||
.findAll((Specification<JpaDistributionSetMetadata>) (root, query, cb) -> cb.equal(
|
.findAll((Specification<JpaDistributionSetMetadata>) (root, query, cb) -> cb.equal(
|
||||||
root.get(JpaDistributionSetMetadata_.distributionSet).get(JpaDistributionSet_.id),
|
root.get(JpaDistributionSetMetadata_.distributionSet).get(JpaDistributionSet_.id),
|
||||||
distributionSetId), pageable));
|
distributionSetId), pageable),
|
||||||
|
pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -543,11 +545,13 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
|||||||
.findAll((Specification<JpaDistributionSetMetadata>) (root, query, cb) -> cb.and(
|
.findAll((Specification<JpaDistributionSetMetadata>) (root, query, cb) -> cb.and(
|
||||||
cb.equal(root.get(JpaDistributionSetMetadata_.distributionSet)
|
cb.equal(root.get(JpaDistributionSetMetadata_.distributionSet)
|
||||||
.get(JpaDistributionSet_.id), distributionSetId),
|
.get(JpaDistributionSet_.id), distributionSetId),
|
||||||
spec.toPredicate(root, query, cb)), pageable));
|
spec.toPredicate(root, query, cb)), pageable),
|
||||||
|
pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Page<DistributionSetMetadata> convertMdPage(final Page<JpaDistributionSetMetadata> findAll) {
|
private static Page<DistributionSetMetadata> convertMdPage(final Page<JpaDistributionSetMetadata> findAll,
|
||||||
return new PageImpl<>(new ArrayList<>(findAll.getContent()));
|
final Pageable pageable) {
|
||||||
|
return new PageImpl<>(new ArrayList<>(findAll.getContent()), pageable, findAll.getTotalElements());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -745,4 +749,36 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
|||||||
public DistributionSet generateDistributionSet() {
|
public DistributionSet generateDistributionSet() {
|
||||||
return new JpaDistributionSet();
|
return new JpaDistributionSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(propagation = Propagation.SUPPORTS)
|
||||||
|
public DistributionSetMetadata generateDistributionSetMetadata() {
|
||||||
|
return new JpaDistributionSetMetadata();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(propagation = Propagation.SUPPORTS)
|
||||||
|
public DistributionSetMetadata generateDistributionSetMetadata(final DistributionSet distributionSet,
|
||||||
|
final String key, final String value) {
|
||||||
|
return new JpaDistributionSetMetadata(key, distributionSet, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(propagation = Propagation.SUPPORTS)
|
||||||
|
public DistributionSetType generateDistributionSetType(final String key, final String name,
|
||||||
|
final String description) {
|
||||||
|
return new JpaDistributionSetType(key, name, description);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(propagation = Propagation.SUPPORTS)
|
||||||
|
public DistributionSet generateDistributionSet(final String name, final String version, final String description,
|
||||||
|
final DistributionSetType type, final Collection<SoftwareModule> moduleList) {
|
||||||
|
return new JpaDistributionSet(name, version, description, type, moduleList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long countDistributionSetsByType(final DistributionSetType type) {
|
||||||
|
return distributionSetRepository.countByType((JpaDistributionSetType) type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ import org.eclipse.hawkbit.repository.RolloutGroupManagement;
|
|||||||
import org.eclipse.hawkbit.repository.TargetFields;
|
import org.eclipse.hawkbit.repository.TargetFields;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaAction;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaAction;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaAction_;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaAction_;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRollout.RolloutStatus;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup_;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup_;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaTarget;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaTarget;
|
||||||
@@ -35,6 +34,7 @@ import org.eclipse.hawkbit.repository.jpa.model.RolloutTargetGroup;
|
|||||||
import org.eclipse.hawkbit.repository.jpa.model.RolloutTargetGroup_;
|
import org.eclipse.hawkbit.repository.jpa.model.RolloutTargetGroup_;
|
||||||
import org.eclipse.hawkbit.repository.model.Action;
|
import org.eclipse.hawkbit.repository.model.Action;
|
||||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||||
|
import org.eclipse.hawkbit.repository.model.Rollout.RolloutStatus;
|
||||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetWithActionStatus;
|
import org.eclipse.hawkbit.repository.model.TargetWithActionStatus;
|
||||||
@@ -46,7 +46,6 @@ import org.springframework.data.domain.Page;
|
|||||||
import org.springframework.data.domain.PageImpl;
|
import org.springframework.data.domain.PageImpl;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.domain.Slice;
|
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Isolation;
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
@@ -80,20 +79,21 @@ public class JpaRolloutGroupManagement implements RolloutGroupManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<RolloutGroup> findRolloutGroupsByRolloutId(final Long rolloutId, final Pageable page) {
|
public Page<RolloutGroup> findRolloutGroupsByRolloutId(final Long rolloutId, final Pageable pageable) {
|
||||||
return convertPage(rolloutGroupRepository.findByRolloutId(rolloutId, page));
|
return convertPage(rolloutGroupRepository.findByRolloutId(rolloutId, pageable), pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Page<RolloutGroup> convertPage(final Slice<JpaRolloutGroup> findAll) {
|
private static Page<RolloutGroup> convertPage(final Page<JpaRolloutGroup> findAll, final Pageable pageable) {
|
||||||
return new PageImpl<>(new ArrayList<>(findAll.getContent()));
|
return new PageImpl<>(new ArrayList<>(findAll.getContent()), pageable, findAll.getTotalElements());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Page<Target> convertTPage(final Page<JpaTarget> findAll) {
|
private static Page<Target> convertTPage(final Page<JpaTarget> findAll, final Pageable pageable) {
|
||||||
return new PageImpl<>(new ArrayList<>(findAll.getContent()));
|
return new PageImpl<>(new ArrayList<>(findAll.getContent()), pageable, findAll.getTotalElements());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<RolloutGroup> findRolloutGroupsAll(final Rollout rollout, final String rsqlParam, final Pageable page) {
|
public Page<RolloutGroup> findRolloutGroupsAll(final Rollout rollout, final String rsqlParam,
|
||||||
|
final Pageable pageable) {
|
||||||
|
|
||||||
final Specification<JpaRolloutGroup> specification = RSQLUtility.parse(rsqlParam, RolloutGroupFields.class);
|
final Specification<JpaRolloutGroup> specification = RSQLUtility.parse(rsqlParam, RolloutGroupFields.class);
|
||||||
|
|
||||||
@@ -103,12 +103,13 @@ public class JpaRolloutGroupManagement implements RolloutGroupManagement {
|
|||||||
(root, query, criteriaBuilder) -> criteriaBuilder.and(
|
(root, query, criteriaBuilder) -> criteriaBuilder.and(
|
||||||
criteriaBuilder.equal(root.get(JpaRolloutGroup_.rollout), rollout),
|
criteriaBuilder.equal(root.get(JpaRolloutGroup_.rollout), rollout),
|
||||||
specification.toPredicate(root, query, criteriaBuilder)),
|
specification.toPredicate(root, query, criteriaBuilder)),
|
||||||
page));
|
pageable),
|
||||||
|
pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<RolloutGroup> findAllRolloutGroupsWithDetailedStatus(final Long rolloutId, final Pageable page) {
|
public Page<RolloutGroup> findAllRolloutGroupsWithDetailedStatus(final Long rolloutId, final Pageable pageable) {
|
||||||
final Page<JpaRolloutGroup> rolloutGroups = rolloutGroupRepository.findByRolloutId(rolloutId, page);
|
final Page<JpaRolloutGroup> rolloutGroups = rolloutGroupRepository.findByRolloutId(rolloutId, pageable);
|
||||||
final List<Long> rolloutGroupIds = rolloutGroups.getContent().stream().map(rollout -> rollout.getId())
|
final List<Long> rolloutGroupIds = rolloutGroups.getContent().stream().map(rollout -> rollout.getId())
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
final Map<Long, List<TotalTargetCountActionStatus>> allStatesForRollout = getStatusCountItemForRolloutGroup(
|
final Map<Long, List<TotalTargetCountActionStatus>> allStatesForRollout = getStatusCountItemForRolloutGroup(
|
||||||
@@ -120,7 +121,7 @@ public class JpaRolloutGroupManagement implements RolloutGroupManagement {
|
|||||||
rolloutGroup.setTotalTargetCountStatus(totalTargetCountStatus);
|
rolloutGroup.setTotalTargetCountStatus(totalTargetCountStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
return convertPage(rolloutGroups);
|
return convertPage(rolloutGroups, pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -145,7 +146,7 @@ public class JpaRolloutGroupManagement implements RolloutGroupManagement {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<Target> findRolloutGroupTargets(final RolloutGroup rolloutGroup, final String rsqlParam,
|
public Page<Target> findRolloutGroupTargets(final RolloutGroup rolloutGroup, final String rsqlParam,
|
||||||
final Pageable page) {
|
final Pageable pageable) {
|
||||||
|
|
||||||
final Specification<JpaTarget> rsqlSpecification = RSQLUtility.parse(rsqlParam, TargetFields.class);
|
final Specification<JpaTarget> rsqlSpecification = RSQLUtility.parse(rsqlParam, TargetFields.class);
|
||||||
|
|
||||||
@@ -153,7 +154,7 @@ public class JpaRolloutGroupManagement implements RolloutGroupManagement {
|
|||||||
final ListJoin<JpaTarget, RolloutTargetGroup> rolloutTargetJoin = root.join(JpaTarget_.rolloutTargetGroup);
|
final ListJoin<JpaTarget, RolloutTargetGroup> rolloutTargetJoin = root.join(JpaTarget_.rolloutTargetGroup);
|
||||||
return criteriaBuilder.and(rsqlSpecification.toPredicate(root, query, criteriaBuilder),
|
return criteriaBuilder.and(rsqlSpecification.toPredicate(root, query, criteriaBuilder),
|
||||||
criteriaBuilder.equal(rolloutTargetJoin.get(RolloutTargetGroup_.rolloutGroup), rolloutGroup));
|
criteriaBuilder.equal(rolloutTargetJoin.get(RolloutTargetGroup_.rolloutGroup), rolloutGroup));
|
||||||
}, page));
|
}, pageable), pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -20,24 +20,25 @@ import javax.persistence.EntityManager;
|
|||||||
|
|
||||||
import org.eclipse.hawkbit.cache.CacheWriteNotify;
|
import org.eclipse.hawkbit.cache.CacheWriteNotify;
|
||||||
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
||||||
|
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
||||||
import org.eclipse.hawkbit.repository.RolloutFields;
|
import org.eclipse.hawkbit.repository.RolloutFields;
|
||||||
import org.eclipse.hawkbit.repository.RolloutManagement;
|
import org.eclipse.hawkbit.repository.RolloutManagement;
|
||||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||||
import org.eclipse.hawkbit.repository.exception.RolloutIllegalStateException;
|
import org.eclipse.hawkbit.repository.exception.RolloutIllegalStateException;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRollout;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaRollout;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRollout.RolloutStatus;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup.RolloutGroupConditions;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup.RolloutGroupErrorCondition;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup.RolloutGroupStatus;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup.RolloutGroupSuccessCondition;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRollout_;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaRollout_;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.RolloutTargetGroup;
|
import org.eclipse.hawkbit.repository.jpa.model.RolloutTargetGroup;
|
||||||
import org.eclipse.hawkbit.repository.model.Action;
|
import org.eclipse.hawkbit.repository.model.Action;
|
||||||
import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||||
|
import org.eclipse.hawkbit.repository.model.Rollout.RolloutStatus;
|
||||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||||
|
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupErrorCondition;
|
||||||
|
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupStatus;
|
||||||
|
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupSuccessCondition;
|
||||||
|
import org.eclipse.hawkbit.repository.model.RolloutGroupConditions;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
import org.eclipse.hawkbit.repository.model.TotalTargetCountActionStatus;
|
import org.eclipse.hawkbit.repository.model.TotalTargetCountActionStatus;
|
||||||
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
||||||
@@ -137,22 +138,26 @@ public class JpaRolloutManagement implements RolloutManagement {
|
|||||||
private static final Set<String> startingRollouts = ConcurrentHashMap.newKeySet();
|
private static final Set<String> startingRollouts = ConcurrentHashMap.newKeySet();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<Rollout> findAll(final Pageable page) {
|
public Page<Rollout> findAll(final Pageable pageable) {
|
||||||
return convertPage(rolloutRepository.findAll(page));
|
return convertPage(rolloutRepository.findAll(pageable), pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Page<Rollout> convertPage(final Slice<JpaRollout> findAll) {
|
private static Page<Rollout> convertPage(final Page<JpaRollout> findAll, final Pageable pageable) {
|
||||||
return new PageImpl<>(new ArrayList<>(findAll.getContent()));
|
return new PageImpl<>(new ArrayList<>(findAll.getContent()), pageable, findAll.getTotalElements());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Slice<Rollout> convertPage(final Slice<JpaRollout> findAll, final Pageable pageable) {
|
||||||
|
return new PageImpl<>(new ArrayList<>(findAll.getContent()), pageable, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<Rollout> findAllWithDetailedStatusByPredicate(final String rsqlParam, final Pageable page) {
|
public Page<Rollout> findAllWithDetailedStatusByPredicate(final String rsqlParam, final Pageable pageable) {
|
||||||
|
|
||||||
final Specification<JpaRollout> specification = RSQLUtility.parse(rsqlParam, RolloutFields.class);
|
final Specification<JpaRollout> specification = RSQLUtility.parse(rsqlParam, RolloutFields.class);
|
||||||
|
|
||||||
final Page<JpaRollout> findAll = rolloutRepository.findAll(specification, page);
|
final Page<JpaRollout> findAll = rolloutRepository.findAll(specification, pageable);
|
||||||
setRolloutStatusDetails(findAll);
|
setRolloutStatusDetails(findAll);
|
||||||
return convertPage(findAll);
|
return convertPage(findAll, pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -570,7 +575,7 @@ public class JpaRolloutManagement implements RolloutManagement {
|
|||||||
final Specification<JpaRollout> specs = likeNameOrDescription(searchText);
|
final Specification<JpaRollout> specs = likeNameOrDescription(searchText);
|
||||||
final Slice<JpaRollout> findAll = criteriaNoCountDao.findAll(specs, pageable, JpaRollout.class);
|
final Slice<JpaRollout> findAll = criteriaNoCountDao.findAll(specs, pageable, JpaRollout.class);
|
||||||
setRolloutStatusDetails(findAll);
|
setRolloutStatusDetails(findAll);
|
||||||
return convertPage(findAll);
|
return convertPage(findAll, pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -604,10 +609,10 @@ public class JpaRolloutManagement implements RolloutManagement {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Page<Rollout> findAllRolloutsWithDetailedStatus(final Pageable page) {
|
public Page<Rollout> findAllRolloutsWithDetailedStatus(final Pageable pageable) {
|
||||||
final Page<JpaRollout> rollouts = rolloutRepository.findAll(page);
|
final Page<JpaRollout> rollouts = rolloutRepository.findAll(pageable);
|
||||||
setRolloutStatusDetails(rollouts);
|
setRolloutStatusDetails(rollouts);
|
||||||
return convertPage(rollouts);
|
return convertPage(rollouts, pageable);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -618,7 +623,7 @@ public class JpaRolloutManagement implements RolloutManagement {
|
|||||||
.getStatusCountByRolloutId(rolloutId);
|
.getStatusCountByRolloutId(rolloutId);
|
||||||
final TotalTargetCountStatus totalTargetCountStatus = new TotalTargetCountStatus(rolloutStatusCountItems,
|
final TotalTargetCountStatus totalTargetCountStatus = new TotalTargetCountStatus(rolloutStatusCountItems,
|
||||||
rollout.getTotalTargets());
|
rollout.getTotalTargets());
|
||||||
rollout.setTotalTargetCountStatus(totalTargetCountStatus);
|
((JpaRollout) rollout).setTotalTargetCountStatus(totalTargetCountStatus);
|
||||||
return rollout;
|
return rollout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -636,7 +641,7 @@ public class JpaRolloutManagement implements RolloutManagement {
|
|||||||
for (final Rollout rollout : rollouts) {
|
for (final Rollout rollout : rollouts) {
|
||||||
final TotalTargetCountStatus totalTargetCountStatus = new TotalTargetCountStatus(
|
final TotalTargetCountStatus totalTargetCountStatus = new TotalTargetCountStatus(
|
||||||
allStatesForRollout.get(rollout.getId()), rollout.getTotalTargets());
|
allStatesForRollout.get(rollout.getId()), rollout.getTotalTargets());
|
||||||
rollout.setTotalTargetCountStatus(totalTargetCountStatus);
|
((JpaRollout) rollout).setTotalTargetCountStatus(totalTargetCountStatus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -183,15 +183,21 @@ public class JpaSoftwareManagement implements SoftwareManagement {
|
|||||||
spec = SoftwareModuleSpecification.isDeletedFalse();
|
spec = SoftwareModuleSpecification.isDeletedFalse();
|
||||||
specList.add(spec);
|
specList.add(spec);
|
||||||
|
|
||||||
return convertSmPage(findSwModuleByCriteriaAPI(pageable, specList));
|
return convertSmPage(findSwModuleByCriteriaAPI(pageable, specList), pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Page<SoftwareModule> convertSmPage(final Slice<JpaSoftwareModule> findAll) {
|
private static Slice<SoftwareModule> convertSmPage(final Slice<JpaSoftwareModule> findAll,
|
||||||
return new PageImpl<>(new ArrayList<>(findAll.getContent()));
|
final Pageable pageable) {
|
||||||
|
return new PageImpl<>(new ArrayList<>(findAll.getContent()), pageable, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Page<SoftwareModuleMetadata> convertSmMdPage(final Slice<JpaSoftwareModuleMetadata> findAll) {
|
private static Page<SoftwareModule> convertSmPage(final Page<JpaSoftwareModule> findAll, final Pageable pageable) {
|
||||||
return new PageImpl<>(new ArrayList<>(findAll.getContent()));
|
return new PageImpl<>(new ArrayList<>(findAll.getContent()), pageable, findAll.getTotalElements());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Page<SoftwareModuleMetadata> convertSmMdPage(final Page<JpaSoftwareModuleMetadata> findAll,
|
||||||
|
final Pageable pageable) {
|
||||||
|
return new PageImpl<>(new ArrayList<>(findAll.getContent()), pageable, findAll.getTotalElements());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -288,7 +294,7 @@ public class JpaSoftwareManagement implements SoftwareManagement {
|
|||||||
|
|
||||||
specList.add(spec);
|
specList.add(spec);
|
||||||
|
|
||||||
return convertSmPage(findSwModuleByCriteriaAPI(pageable, specList));
|
return convertSmPage(findSwModuleByCriteriaAPI(pageable, specList), pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -311,20 +317,20 @@ public class JpaSoftwareManagement implements SoftwareManagement {
|
|||||||
public Page<SoftwareModule> findSoftwareModulesByPredicate(final String rsqlParam, final Pageable pageable) {
|
public Page<SoftwareModule> findSoftwareModulesByPredicate(final String rsqlParam, final Pageable pageable) {
|
||||||
final Specification<JpaSoftwareModule> spec = RSQLUtility.parse(rsqlParam, SoftwareModuleFields.class);
|
final Specification<JpaSoftwareModule> spec = RSQLUtility.parse(rsqlParam, SoftwareModuleFields.class);
|
||||||
|
|
||||||
return convertSmPage(softwareModuleRepository.findAll(spec, pageable));
|
return convertSmPage(softwareModuleRepository.findAll(spec, pageable), pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<SoftwareModuleType> findSoftwareModuleTypesByPredicate(final String rsqlParam,
|
public Page<SoftwareModuleType> findSoftwareModuleTypesAll(final String rsqlParam, final Pageable pageable) {
|
||||||
final Pageable pageable) {
|
|
||||||
|
|
||||||
final Specification<JpaSoftwareModuleType> spec = RSQLUtility.parse(rsqlParam, SoftwareModuleTypeFields.class);
|
final Specification<JpaSoftwareModuleType> spec = RSQLUtility.parse(rsqlParam, SoftwareModuleTypeFields.class);
|
||||||
|
|
||||||
return convertSmTPage(softwareModuleTypeRepository.findAll(spec, pageable));
|
return convertSmTPage(softwareModuleTypeRepository.findAll(spec, pageable), pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Page<SoftwareModuleType> convertSmTPage(final Slice<JpaSoftwareModuleType> findAll) {
|
private static Page<SoftwareModuleType> convertSmTPage(final Page<JpaSoftwareModuleType> findAll,
|
||||||
return new PageImpl<>(new ArrayList<>(findAll.getContent()));
|
final Pageable pageable) {
|
||||||
|
return new PageImpl<>(new ArrayList<>(findAll.getContent()), pageable, findAll.getTotalElements());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -361,7 +367,7 @@ public class JpaSoftwareManagement implements SoftwareManagement {
|
|||||||
|
|
||||||
specList.add(spec);
|
specList.add(spec);
|
||||||
|
|
||||||
return convertSmPage(findSwModuleByCriteriaAPI(pageable, specList));
|
return convertSmPage(findSwModuleByCriteriaAPI(pageable, specList), pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -614,11 +620,16 @@ public class JpaSoftwareManagement implements SoftwareManagement {
|
|||||||
cb.equal(root.get(JpaSoftwareModuleMetadata_.softwareModule)
|
cb.equal(root.get(JpaSoftwareModuleMetadata_.softwareModule)
|
||||||
.get(JpaSoftwareModule_.id), softwareModuleId),
|
.get(JpaSoftwareModule_.id), softwareModuleId),
|
||||||
spec.toPredicate(root, query, cb)),
|
spec.toPredicate(root, query, cb)),
|
||||||
pageable));
|
pageable),
|
||||||
|
pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SoftwareModuleMetadata findSoftwareModuleMetadata(final SwMetadataCompositeKey id) {
|
public SoftwareModuleMetadata findSoftwareModuleMetadata(final SoftwareModule softwareModule, final String key) {
|
||||||
|
return findSoftwareModuleMetadata(new SwMetadataCompositeKey(softwareModule, key));
|
||||||
|
}
|
||||||
|
|
||||||
|
private SoftwareModuleMetadata findSoftwareModuleMetadata(final SwMetadataCompositeKey id) {
|
||||||
final SoftwareModuleMetadata findOne = softwareModuleMetadataRepository.findOne(id);
|
final SoftwareModuleMetadata findOne = softwareModuleMetadataRepository.findOne(id);
|
||||||
if (findOne == null) {
|
if (findOne == null) {
|
||||||
throw new EntityNotFoundException("Metadata with key '" + id.getKey() + "' does not exist");
|
throw new EntityNotFoundException("Metadata with key '" + id.getKey() + "' does not exist");
|
||||||
@@ -664,4 +675,32 @@ public class JpaSoftwareManagement implements SoftwareManagement {
|
|||||||
return new JpaSoftwareModule();
|
return new JpaSoftwareModule();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(propagation = Propagation.SUPPORTS)
|
||||||
|
public SoftwareModule generateSoftwareModule(final SoftwareModuleType type, final String name, final String version,
|
||||||
|
final String description, final String vendor) {
|
||||||
|
|
||||||
|
return new JpaSoftwareModule(type, name, version, description, vendor);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(propagation = Propagation.SUPPORTS)
|
||||||
|
public SoftwareModuleMetadata generateSoftwareModuleMetadata() {
|
||||||
|
return new JpaSoftwareModuleMetadata();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(propagation = Propagation.SUPPORTS)
|
||||||
|
public SoftwareModuleMetadata generateSoftwareModuleMetadata(final SoftwareModule softwareModule, final String key,
|
||||||
|
final String value) {
|
||||||
|
return new JpaSoftwareModuleMetadata(key, softwareModule, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(propagation = Propagation.SUPPORTS)
|
||||||
|
public SoftwareModuleType generateSoftwareModuleType(final String key, final String name, final String description,
|
||||||
|
final int maxAssignments) {
|
||||||
|
return new JpaSoftwareModuleType(key, name, description, maxAssignments);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,15 +151,16 @@ public class JpaTagManagement implements TagManagement {
|
|||||||
public Page<TargetTag> findAllTargetTags(final String rsqlParam, final Pageable pageable) {
|
public Page<TargetTag> findAllTargetTags(final String rsqlParam, final Pageable pageable) {
|
||||||
|
|
||||||
final Specification<JpaTargetTag> spec = RSQLUtility.parse(rsqlParam, TagFields.class);
|
final Specification<JpaTargetTag> spec = RSQLUtility.parse(rsqlParam, TagFields.class);
|
||||||
return convertTPage(targetTagRepository.findAll(spec, pageable));
|
return convertTPage(targetTagRepository.findAll(spec, pageable), pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Page<TargetTag> convertTPage(final Page<JpaTargetTag> findAll) {
|
private static Page<TargetTag> convertTPage(final Page<JpaTargetTag> findAll, final Pageable pageable) {
|
||||||
return new PageImpl<>(new ArrayList<>(findAll.getContent()));
|
return new PageImpl<>(new ArrayList<>(findAll.getContent()), pageable, findAll.getTotalElements());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Page<DistributionSetTag> convertDsPage(final Page<JpaDistributionSetTag> findAll) {
|
private static Page<DistributionSetTag> convertDsPage(final Page<JpaDistributionSetTag> findAll,
|
||||||
return new PageImpl<>(new ArrayList<>(findAll.getContent()));
|
final Pageable pageable) {
|
||||||
|
return new PageImpl<>(new ArrayList<>(findAll.getContent()), pageable, findAll.getTotalElements());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -270,20 +271,20 @@ public class JpaTagManagement implements TagManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<TargetTag> findAllTargetTags(final Pageable pageReq) {
|
public Page<TargetTag> findAllTargetTags(final Pageable pageable) {
|
||||||
return convertTPage(targetTagRepository.findAll(pageReq));
|
return convertTPage(targetTagRepository.findAll(pageable), pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<DistributionSetTag> findAllDistributionSetTags(final Pageable pageReq) {
|
public Page<DistributionSetTag> findAllDistributionSetTags(final Pageable pageable) {
|
||||||
return convertDsPage(distributionSetTagRepository.findAll(pageReq));
|
return convertDsPage(distributionSetTagRepository.findAll(pageable), pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<DistributionSetTag> findAllDistributionSetTags(final String rsqlParam, final Pageable pageable) {
|
public Page<DistributionSetTag> findAllDistributionSetTags(final String rsqlParam, final Pageable pageable) {
|
||||||
final Specification<JpaDistributionSetTag> spec = RSQLUtility.parse(rsqlParam, TagFields.class);
|
final Specification<JpaDistributionSetTag> spec = RSQLUtility.parse(rsqlParam, TagFields.class);
|
||||||
|
|
||||||
return convertDsPage(distributionSetTagRepository.findAll(spec, pageable));
|
return convertDsPage(distributionSetTagRepository.findAll(spec, pageable), pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -298,4 +299,29 @@ public class JpaTagManagement implements TagManagement {
|
|||||||
return new JpaDistributionSetTag();
|
return new JpaDistributionSetTag();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(propagation = Propagation.SUPPORTS)
|
||||||
|
public TargetTag generateTargetTag(final String name, final String description, final String colour) {
|
||||||
|
return new JpaTargetTag(name, description, colour);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(propagation = Propagation.SUPPORTS)
|
||||||
|
public DistributionSetTag generateDistributionSetTag(final String name, final String description,
|
||||||
|
final String colour) {
|
||||||
|
return new JpaDistributionSetTag(name, description, colour);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(propagation = Propagation.SUPPORTS)
|
||||||
|
public TargetTag generateTargetTag(final String name) {
|
||||||
|
return new JpaTargetTag(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(propagation = Propagation.SUPPORTS)
|
||||||
|
public DistributionSetTag generateDistributionSetTag(final String name) {
|
||||||
|
return new JpaDistributionSetTag(name);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,11 +64,12 @@ public class JpaTargetFilterQueryManagement implements TargetFilterQueryManageme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<TargetFilterQuery> findAllTargetFilterQuery(final Pageable pageable) {
|
public Page<TargetFilterQuery> findAllTargetFilterQuery(final Pageable pageable) {
|
||||||
return convertPage(targetFilterQueryRepository.findAll(pageable));
|
return convertPage(targetFilterQueryRepository.findAll(pageable), pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Page<TargetFilterQuery> convertPage(final Page<JpaTargetFilterQuery> findAll) {
|
private static Page<TargetFilterQuery> convertPage(final Page<JpaTargetFilterQuery> findAll,
|
||||||
return new PageImpl<>(new ArrayList<>(findAll.getContent()));
|
final Pageable pageable) {
|
||||||
|
return new PageImpl<>(new ArrayList<>(findAll.getContent()), pageable, findAll.getTotalElements());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -77,7 +78,7 @@ public class JpaTargetFilterQueryManagement implements TargetFilterQueryManageme
|
|||||||
if (!Strings.isNullOrEmpty(name)) {
|
if (!Strings.isNullOrEmpty(name)) {
|
||||||
specList.add(TargetFilterQuerySpecification.likeName(name));
|
specList.add(TargetFilterQuerySpecification.likeName(name));
|
||||||
}
|
}
|
||||||
return convertPage(findTargetFilterQueryByCriteriaAPI(pageable, specList));
|
return convertPage(findTargetFilterQueryByCriteriaAPI(pageable, specList), pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Page<JpaTargetFilterQuery> findTargetFilterQueryByCriteriaAPI(final Pageable pageable,
|
private Page<JpaTargetFilterQuery> findTargetFilterQueryByCriteriaAPI(final Pageable pageable,
|
||||||
@@ -108,4 +109,9 @@ public class JpaTargetFilterQueryManagement implements TargetFilterQueryManageme
|
|||||||
return targetFilterQueryRepository.save((JpaTargetFilterQuery) targetFilterQuery);
|
return targetFilterQueryRepository.save((JpaTargetFilterQuery) targetFilterQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TargetFilterQuery generateTargetFilterQuery() {
|
||||||
|
return new JpaTargetFilterQuery();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ public class JpaTargetManagement implements TargetManagement {
|
|||||||
}
|
}
|
||||||
return cb.conjunction();
|
return cb.conjunction();
|
||||||
};
|
};
|
||||||
return convertPage(criteriaNoCountDao.findAll(spec, pageable, JpaTarget.class));
|
return convertPage(criteriaNoCountDao.findAll(spec, pageable, JpaTarget.class), pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -159,7 +159,7 @@ public class JpaTargetManagement implements TargetManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Page<Target> findTargetsBySpec(final Specification<JpaTarget> spec, final Pageable pageable) {
|
private Page<Target> findTargetsBySpec(final Specification<JpaTarget> spec, final Pageable pageable) {
|
||||||
return convertPage(targetRepository.findAll(spec, pageable));
|
return convertPage(targetRepository.findAll(spec, pageable), pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -222,17 +222,21 @@ public class JpaTargetManagement implements TargetManagement {
|
|||||||
|
|
||||||
final Specification<JpaTarget> spec = RSQLUtility.parse(rsqlParam, TargetFields.class);
|
final Specification<JpaTarget> spec = RSQLUtility.parse(rsqlParam, TargetFields.class);
|
||||||
|
|
||||||
return convertPage(targetRepository.findAll((Specification<JpaTarget>) (root, query, cb) -> cb.and(
|
return convertPage(
|
||||||
TargetSpecifications.hasAssignedDistributionSet(distributionSetID).toPredicate(root, query, cb),
|
targetRepository
|
||||||
spec.toPredicate(root, query, cb)), pageReq));
|
.findAll((Specification<JpaTarget>) (root, query,
|
||||||
|
cb) -> cb.and(TargetSpecifications.hasAssignedDistributionSet(distributionSetID)
|
||||||
|
.toPredicate(root, query, cb), spec.toPredicate(root, query, cb)),
|
||||||
|
pageReq),
|
||||||
|
pageReq);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Page<Target> convertPage(final Page<JpaTarget> findAll) {
|
private static Page<Target> convertPage(final Page<JpaTarget> findAll, final Pageable pageable) {
|
||||||
return new PageImpl<>(new ArrayList<>(findAll.getContent()));
|
return new PageImpl<>(new ArrayList<>(findAll.getContent()), pageable, findAll.getTotalElements());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Slice<Target> convertPage(final Slice<JpaTarget> findAll) {
|
private static Slice<Target> convertPage(final Slice<JpaTarget> findAll, final Pageable pageable) {
|
||||||
return new PageImpl<>(new ArrayList<>(findAll.getContent()));
|
return new PageImpl<>(new ArrayList<>(findAll.getContent()), pageable, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -246,9 +250,13 @@ public class JpaTargetManagement implements TargetManagement {
|
|||||||
|
|
||||||
final Specification<JpaTarget> spec = RSQLUtility.parse(rsqlParam, TargetFields.class);
|
final Specification<JpaTarget> spec = RSQLUtility.parse(rsqlParam, TargetFields.class);
|
||||||
|
|
||||||
return convertPage(targetRepository.findAll((Specification<JpaTarget>) (root, query, cb) -> cb.and(
|
return convertPage(
|
||||||
TargetSpecifications.hasInstalledDistributionSet(distributionSetId).toPredicate(root, query, cb),
|
targetRepository
|
||||||
spec.toPredicate(root, query, cb)), pageable));
|
.findAll((Specification<JpaTarget>) (root, query,
|
||||||
|
cb) -> cb.and(TargetSpecifications.hasInstalledDistributionSet(distributionSetId)
|
||||||
|
.toPredicate(root, query, cb), spec.toPredicate(root, query, cb)),
|
||||||
|
pageable),
|
||||||
|
pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -296,10 +304,11 @@ public class JpaTargetManagement implements TargetManagement {
|
|||||||
|
|
||||||
private Slice<Target> findByCriteriaAPI(final Pageable pageable, final List<Specification<JpaTarget>> specList) {
|
private Slice<Target> findByCriteriaAPI(final Pageable pageable, final List<Specification<JpaTarget>> specList) {
|
||||||
if (specList == null || specList.isEmpty()) {
|
if (specList == null || specList.isEmpty()) {
|
||||||
return convertPage(criteriaNoCountDao.findAll(pageable, JpaTarget.class));
|
return convertPage(criteriaNoCountDao.findAll(pageable, JpaTarget.class), pageable);
|
||||||
}
|
}
|
||||||
return convertPage(
|
return convertPage(
|
||||||
criteriaNoCountDao.findAll(SpecificationsBuilder.combineWithAnd(specList), pageable, JpaTarget.class));
|
criteriaNoCountDao.findAll(SpecificationsBuilder.combineWithAnd(specList), pageable, JpaTarget.class),
|
||||||
|
pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Long countByCriteriaAPI(final List<Specification<JpaTarget>> specList) {
|
private Long countByCriteriaAPI(final List<Specification<JpaTarget>> specList) {
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRollout;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaRollout;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup.RolloutGroupStatus;
|
|
||||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||||
|
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupStatus;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ package org.eclipse.hawkbit.repository.jpa;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRollout;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaRollout;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRollout.RolloutStatus;
|
|
||||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||||
|
import org.eclipse.hawkbit.repository.model.Rollout.RolloutStatus;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
|||||||
* {@link SoftwareModule}.
|
* {@link SoftwareModule}.
|
||||||
*/
|
*/
|
||||||
@MappedSuperclass
|
@MappedSuperclass
|
||||||
public abstract class JpaArtifact extends JpaTenantAwareBaseEntity implements Artifact {
|
public abstract class AbstractJpaArtifact extends AbstractJpaTenantAwareBaseEntity implements Artifact {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Column(name = "sha1_hash", length = 40, nullable = true)
|
@Column(name = "sha1_hash", length = 40, nullable = true)
|
||||||
@@ -34,7 +34,7 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
|||||||
@MappedSuperclass
|
@MappedSuperclass
|
||||||
@Access(AccessType.FIELD)
|
@Access(AccessType.FIELD)
|
||||||
@EntityListeners({ AuditingEntityListener.class, CacheFieldEntityListener.class, EntityPropertyChangeListener.class })
|
@EntityListeners({ AuditingEntityListener.class, CacheFieldEntityListener.class, EntityPropertyChangeListener.class })
|
||||||
public abstract class JpaBaseEntity implements BaseEntity {
|
public abstract class AbstractJpaBaseEntity implements BaseEntity {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@@ -54,7 +54,7 @@ public abstract class JpaBaseEntity implements BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* Default constructor needed for JPA entities.
|
* Default constructor needed for JPA entities.
|
||||||
*/
|
*/
|
||||||
public JpaBaseEntity() {
|
public AbstractJpaBaseEntity() {
|
||||||
// Default constructor needed for JPA entities.
|
// Default constructor needed for JPA entities.
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,7 +167,7 @@ public abstract class JpaBaseEntity implements BaseEntity {
|
|||||||
if (!(this.getClass().isInstance(obj))) {
|
if (!(this.getClass().isInstance(obj))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final JpaBaseEntity other = (JpaBaseEntity) obj;
|
final AbstractJpaBaseEntity other = (AbstractJpaBaseEntity) obj;
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
if (other.id != null) {
|
if (other.id != null) {
|
||||||
return false;
|
return false;
|
||||||
@@ -20,7 +20,7 @@ import org.eclipse.hawkbit.repository.model.MetaData;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@MappedSuperclass
|
@MappedSuperclass
|
||||||
public abstract class JpaMetaData implements MetaData {
|
public abstract class AbstractJpaMetaData implements MetaData {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@@ -31,13 +31,13 @@ public abstract class JpaMetaData implements MetaData {
|
|||||||
@Basic
|
@Basic
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
public JpaMetaData(final String key, final String value) {
|
public AbstractJpaMetaData(final String key, final String value) {
|
||||||
super();
|
super();
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JpaMetaData() {
|
public AbstractJpaMetaData() {
|
||||||
// Default constructor needed for JPA entities
|
// Default constructor needed for JPA entities
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ public abstract class JpaMetaData implements MetaData {
|
|||||||
if (!(this.getClass().isInstance(obj))) {
|
if (!(this.getClass().isInstance(obj))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final JpaMetaData other = (JpaMetaData) obj;
|
final AbstractJpaMetaData other = (AbstractJpaMetaData) obj;
|
||||||
if (key == null) {
|
if (key == null) {
|
||||||
if (other.key != null) {
|
if (other.key != null) {
|
||||||
return false;
|
return false;
|
||||||
@@ -19,7 +19,7 @@ import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
|
|||||||
* addition to their technical ID.
|
* addition to their technical ID.
|
||||||
*/
|
*/
|
||||||
@MappedSuperclass
|
@MappedSuperclass
|
||||||
public abstract class JpaNamedEntity extends JpaTenantAwareBaseEntity implements NamedEntity {
|
public abstract class AbstractJpaNamedEntity extends AbstractJpaTenantAwareBaseEntity implements NamedEntity {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Column(name = "name", nullable = false, length = 64)
|
@Column(name = "name", nullable = false, length = 64)
|
||||||
@@ -31,7 +31,7 @@ public abstract class JpaNamedEntity extends JpaTenantAwareBaseEntity implements
|
|||||||
/**
|
/**
|
||||||
* Default constructor.
|
* Default constructor.
|
||||||
*/
|
*/
|
||||||
public JpaNamedEntity() {
|
public AbstractJpaNamedEntity() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ public abstract class JpaNamedEntity extends JpaTenantAwareBaseEntity implements
|
|||||||
* @param description
|
* @param description
|
||||||
* of the {@link NamedEntity}
|
* of the {@link NamedEntity}
|
||||||
*/
|
*/
|
||||||
public JpaNamedEntity(final String name, final String description) {
|
public AbstractJpaNamedEntity(final String name, final String description) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
@@ -19,7 +19,7 @@ import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@MappedSuperclass
|
@MappedSuperclass
|
||||||
public abstract class JpaNamedVersionedEntity extends JpaNamedEntity implements NamedVersionedEntity {
|
public abstract class AbstractJpaNamedVersionedEntity extends AbstractJpaNamedEntity implements NamedVersionedEntity {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Column(name = "version", nullable = false, length = 64)
|
@Column(name = "version", nullable = false, length = 64)
|
||||||
@@ -34,12 +34,12 @@ public abstract class JpaNamedVersionedEntity extends JpaNamedEntity implements
|
|||||||
* of the entity
|
* of the entity
|
||||||
* @param description
|
* @param description
|
||||||
*/
|
*/
|
||||||
public JpaNamedVersionedEntity(final String name, final String version, final String description) {
|
public AbstractJpaNamedVersionedEntity(final String name, final String version, final String description) {
|
||||||
super(name, description);
|
super(name, description);
|
||||||
this.version = version;
|
this.version = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
JpaNamedVersionedEntity() {
|
AbstractJpaNamedVersionedEntity() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -19,13 +19,13 @@ import org.eclipse.hawkbit.repository.model.Tag;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@MappedSuperclass
|
@MappedSuperclass
|
||||||
public abstract class JpaTag extends JpaNamedEntity implements Tag {
|
public abstract class AbstractJpaTag extends AbstractJpaNamedEntity implements Tag {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Column(name = "colour", nullable = true, length = 16)
|
@Column(name = "colour", nullable = true, length = 16)
|
||||||
private String colour;
|
private String colour;
|
||||||
|
|
||||||
protected JpaTag() {
|
protected AbstractJpaTag() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ public abstract class JpaTag extends JpaNamedEntity implements Tag {
|
|||||||
* @param colour
|
* @param colour
|
||||||
* of tag in UI
|
* of tag in UI
|
||||||
*/
|
*/
|
||||||
public JpaTag(final String name, final String description, final String colour) {
|
public AbstractJpaTag(final String name, final String description, final String colour) {
|
||||||
super(name, description);
|
super(name, description);
|
||||||
this.colour = colour;
|
this.colour = colour;
|
||||||
}
|
}
|
||||||
@@ -27,7 +27,7 @@ import org.eclipse.persistence.annotations.TenantDiscriminatorColumn;
|
|||||||
@MappedSuperclass
|
@MappedSuperclass
|
||||||
@TenantDiscriminatorColumn(name = "tenant", length = 40)
|
@TenantDiscriminatorColumn(name = "tenant", length = 40)
|
||||||
@Multitenant(MultitenantType.SINGLE_TABLE)
|
@Multitenant(MultitenantType.SINGLE_TABLE)
|
||||||
public abstract class JpaTenantAwareBaseEntity extends JpaBaseEntity implements TenantAwareBaseEntity {
|
public abstract class AbstractJpaTenantAwareBaseEntity extends AbstractJpaBaseEntity implements TenantAwareBaseEntity {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Column(name = "tenant", nullable = false, insertable = false, updatable = false, length = 40)
|
@Column(name = "tenant", nullable = false, insertable = false, updatable = false, length = 40)
|
||||||
@@ -36,7 +36,7 @@ public abstract class JpaTenantAwareBaseEntity extends JpaBaseEntity implements
|
|||||||
/**
|
/**
|
||||||
* Default constructor needed for JPA entities.
|
* Default constructor needed for JPA entities.
|
||||||
*/
|
*/
|
||||||
public JpaTenantAwareBaseEntity() {
|
public AbstractJpaTenantAwareBaseEntity() {
|
||||||
// Default constructor needed for JPA entities.
|
// Default constructor needed for JPA entities.
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@ public abstract class JpaTenantAwareBaseEntity extends JpaBaseEntity implements
|
|||||||
if (!super.equals(obj)) {
|
if (!super.equals(obj)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final JpaTenantAwareBaseEntity other = (JpaTenantAwareBaseEntity) obj;
|
final AbstractJpaTenantAwareBaseEntity other = (AbstractJpaTenantAwareBaseEntity) obj;
|
||||||
if (tenant == null) {
|
if (tenant == null) {
|
||||||
if (other.tenant != null) {
|
if (other.tenant != null) {
|
||||||
return false;
|
return false;
|
||||||
@@ -36,21 +36,11 @@ import org.eclipse.hawkbit.repository.model.ActionStatus;
|
|||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
import org.eclipse.persistence.annotations.CascadeOnDelete;
|
import org.eclipse.persistence.annotations.CascadeOnDelete;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* JPA implementation of {@link Action}.
|
||||||
* Applicable transition changes of the {@link SoftwareModule}s state of a
|
|
||||||
* {@link Target}, e.g. install, uninstall, update and preparations for the
|
|
||||||
* transition change, i.e. download.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* Actions are managed by the SP server and applied to the targets by the
|
|
||||||
* client.
|
|
||||||
* <p>
|
|
||||||
*/
|
*/
|
||||||
@Table(name = "sp_action", indexes = { @Index(name = "sp_idx_action_01", columnList = "tenant,distribution_set"),
|
@Table(name = "sp_action", indexes = { @Index(name = "sp_idx_action_01", columnList = "tenant,distribution_set"),
|
||||||
@Index(name = "sp_idx_action_02", columnList = "tenant,target,active"),
|
@Index(name = "sp_idx_action_02", columnList = "tenant,target,active"),
|
||||||
@@ -59,12 +49,9 @@ import org.eclipse.persistence.annotations.CascadeOnDelete;
|
|||||||
@NamedEntityGraph(name = "Action.all", attributeNodes = { @NamedAttributeNode("distributionSet"),
|
@NamedEntityGraph(name = "Action.all", attributeNodes = { @NamedAttributeNode("distributionSet"),
|
||||||
@NamedAttributeNode(value = "target", subgraph = "target.ds") }, subgraphs = @NamedSubgraph(name = "target.ds", attributeNodes = @NamedAttributeNode("assignedDistributionSet"))) })
|
@NamedAttributeNode(value = "target", subgraph = "target.ds") }, subgraphs = @NamedSubgraph(name = "target.ds", attributeNodes = @NamedAttributeNode("assignedDistributionSet"))) })
|
||||||
@Entity
|
@Entity
|
||||||
public class JpaAction extends JpaTenantAwareBaseEntity implements Action {
|
public class JpaAction extends AbstractJpaTenantAwareBaseEntity implements Action {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
|
||||||
* the {@link DistributionSet} which should be installed by this action.
|
|
||||||
*/
|
|
||||||
@ManyToOne(fetch = FetchType.LAZY)
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
@JoinColumn(name = "distribution_set", foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_action_ds"))
|
@JoinColumn(name = "distribution_set", foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_action_ds"))
|
||||||
private JpaDistributionSet distributionSet;
|
private JpaDistributionSet distributionSet;
|
||||||
@@ -106,33 +93,16 @@ public class JpaAction extends JpaTenantAwareBaseEntity implements Action {
|
|||||||
@CacheField(key = CacheKeys.DOWNLOAD_PROGRESS_PERCENT)
|
@CacheField(key = CacheKeys.DOWNLOAD_PROGRESS_PERCENT)
|
||||||
private int downloadProgressPercent;
|
private int downloadProgressPercent;
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the distributionSet
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public DistributionSet getDistributionSet() {
|
public DistributionSet getDistributionSet() {
|
||||||
return distributionSet;
|
return distributionSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param distributionSet
|
|
||||||
* the distributionSet to set
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void setDistributionSet(final DistributionSet distributionSet) {
|
public void setDistributionSet(final DistributionSet distributionSet) {
|
||||||
this.distributionSet = (JpaDistributionSet) distributionSet;
|
this.distributionSet = (JpaDistributionSet) distributionSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return true when action is in state {@link Status#CANCELING} or
|
|
||||||
* {@link Status#CANCELED}, false otherwise
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean isCancelingOrCanceled() {
|
|
||||||
return status == Status.CANCELING || status == Status.CANCELED;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setActive(final boolean active) {
|
public void setActive(final boolean active) {
|
||||||
this.active = active;
|
this.active = active;
|
||||||
}
|
}
|
||||||
@@ -152,7 +122,6 @@ public class JpaAction extends JpaTenantAwareBaseEntity implements Action {
|
|||||||
return downloadProgressPercent;
|
return downloadProgressPercent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setDownloadProgressPercent(final int downloadProgressPercent) {
|
public void setDownloadProgressPercent(final int downloadProgressPercent) {
|
||||||
this.downloadProgressPercent = downloadProgressPercent;
|
this.downloadProgressPercent = downloadProgressPercent;
|
||||||
}
|
}
|
||||||
@@ -162,14 +131,10 @@ public class JpaAction extends JpaTenantAwareBaseEntity implements Action {
|
|||||||
return active;
|
return active;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setActionType(final ActionType actionType) {
|
public void setActionType(final ActionType actionType) {
|
||||||
this.actionType = actionType;
|
this.actionType = actionType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the actionType
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public ActionType getActionType() {
|
public ActionType getActionType() {
|
||||||
return actionType;
|
return actionType;
|
||||||
@@ -195,7 +160,6 @@ public class JpaAction extends JpaTenantAwareBaseEntity implements Action {
|
|||||||
return forcedTime;
|
return forcedTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setForcedTime(final long forcedTime) {
|
public void setForcedTime(final long forcedTime) {
|
||||||
this.forcedTime = forcedTime;
|
this.forcedTime = forcedTime;
|
||||||
}
|
}
|
||||||
@@ -205,7 +169,6 @@ public class JpaAction extends JpaTenantAwareBaseEntity implements Action {
|
|||||||
return rolloutGroup;
|
return rolloutGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setRolloutGroup(final RolloutGroup rolloutGroup) {
|
public void setRolloutGroup(final RolloutGroup rolloutGroup) {
|
||||||
this.rolloutGroup = (JpaRolloutGroup) rolloutGroup;
|
this.rolloutGroup = (JpaRolloutGroup) rolloutGroup;
|
||||||
}
|
}
|
||||||
@@ -215,57 +178,10 @@ public class JpaAction extends JpaTenantAwareBaseEntity implements Action {
|
|||||||
return rollout;
|
return rollout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setRollout(final Rollout rollout) {
|
public void setRollout(final Rollout rollout) {
|
||||||
this.rollout = (JpaRollout) rollout;
|
this.rollout = (JpaRollout) rollout;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* checks if the {@link #forcedTime} is hit by the given
|
|
||||||
* {@code hitTimeMillis}, by means if the given milliseconds are greater
|
|
||||||
* than the forcedTime.
|
|
||||||
*
|
|
||||||
* @param hitTimeMillis
|
|
||||||
* the milliseconds, mostly the
|
|
||||||
* {@link System#currentTimeMillis()}
|
|
||||||
* @return {@code true} if this {@link #type} is in
|
|
||||||
* {@link ActionType#TIMEFORCED} and the given {@code hitTimeMillis}
|
|
||||||
* is greater than the {@link #forcedTime} otherwise {@code false}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean isHitAutoForceTime(final long hitTimeMillis) {
|
|
||||||
if (actionType == ActionType.TIMEFORCED) {
|
|
||||||
return hitTimeMillis >= forcedTime;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return {@code true} if either the {@link #type} is
|
|
||||||
* {@link ActionType#FORCED} or {@link ActionType#TIMEFORCED} but
|
|
||||||
* then if the {@link #forcedTime} has been exceeded otherwise
|
|
||||||
* always {@code false}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean isForce() {
|
|
||||||
switch (actionType) {
|
|
||||||
case FORCED:
|
|
||||||
return true;
|
|
||||||
case TIMEFORCED:
|
|
||||||
return isHitAutoForceTime(System.currentTimeMillis());
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return true when action is forced, false otherwise
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean isForced() {
|
|
||||||
return actionType == ActionType.FORCED;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Action [distributionSet=" + distributionSet + ", getId()=" + getId() + "]";
|
return "Action [distributionSet=" + distributionSet + ", getId()=" + getId() + "]";
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ import com.google.common.base.Splitter;
|
|||||||
@Index(name = "sp_idx_action_status_prim", columnList = "tenant,id") })
|
@Index(name = "sp_idx_action_status_prim", columnList = "tenant,id") })
|
||||||
@NamedEntityGraph(name = "ActionStatus.withMessages", attributeNodes = { @NamedAttributeNode("messages") })
|
@NamedEntityGraph(name = "ActionStatus.withMessages", attributeNodes = { @NamedAttributeNode("messages") })
|
||||||
@Entity
|
@Entity
|
||||||
public class JpaActionStatus extends JpaTenantAwareBaseEntity implements ActionStatus {
|
public class JpaActionStatus extends AbstractJpaTenantAwareBaseEntity implements ActionStatus {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Column(name = "target_occurred_at")
|
@Column(name = "target_occurred_at")
|
||||||
@@ -88,14 +88,11 @@ public class JpaActionStatus extends JpaTenantAwareBaseEntity implements ActionS
|
|||||||
* @param messages
|
* @param messages
|
||||||
* the messages which should be added to this action status
|
* the messages which should be added to this action status
|
||||||
*/
|
*/
|
||||||
public JpaActionStatus(final JpaAction action, final Status status, final Long occurredAt,
|
public JpaActionStatus(final JpaAction action, final Status status, final Long occurredAt, final String message) {
|
||||||
final String... messages) {
|
|
||||||
this.action = action;
|
this.action = action;
|
||||||
this.status = status;
|
this.status = status;
|
||||||
this.occurredAt = occurredAt;
|
this.occurredAt = occurredAt;
|
||||||
for (final String msg : messages) {
|
addMessage(message);
|
||||||
addMessage(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -115,15 +112,11 @@ public class JpaActionStatus extends JpaTenantAwareBaseEntity implements ActionS
|
|||||||
this.occurredAt = occurredAt;
|
this.occurredAt = occurredAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds message including splitting in case it exceeds 512 length.
|
|
||||||
*
|
|
||||||
* @param message
|
|
||||||
* to add
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public final void addMessage(final String message) {
|
public final void addMessage(final String message) {
|
||||||
Splitter.fixedLength(512).split(message).forEach(messages::add);
|
if (message != null) {
|
||||||
|
Splitter.fixedLength(512).split(message).forEach(messages::add);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
package org.eclipse.hawkbit.repository.jpa.model;
|
package org.eclipse.hawkbit.repository.jpa.model;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -47,14 +48,7 @@ import org.eclipse.hawkbit.repository.model.TargetInfo;
|
|||||||
import org.eclipse.persistence.annotations.CascadeOnDelete;
|
import org.eclipse.persistence.annotations.CascadeOnDelete;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* Jpa implementation of {@link DistributionSet}.
|
||||||
* The {@link DistributionSet} is defined in the SP repository and contains at
|
|
||||||
* least an OS and an Agent Hub.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* A {@link Target} has exactly one target {@link DistributionSet} assigned.
|
|
||||||
* </p>
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@@ -65,11 +59,11 @@ import org.eclipse.persistence.annotations.CascadeOnDelete;
|
|||||||
@Index(name = "sp_idx_distribution_set_prim", columnList = "tenant,id") })
|
@Index(name = "sp_idx_distribution_set_prim", columnList = "tenant,id") })
|
||||||
@NamedEntityGraph(name = "DistributionSet.detail", attributeNodes = { @NamedAttributeNode("modules"),
|
@NamedEntityGraph(name = "DistributionSet.detail", attributeNodes = { @NamedAttributeNode("modules"),
|
||||||
@NamedAttributeNode("tags"), @NamedAttributeNode("type") })
|
@NamedAttributeNode("tags"), @NamedAttributeNode("type") })
|
||||||
public class JpaDistributionSet extends JpaNamedVersionedEntity implements DistributionSet {
|
public class JpaDistributionSet extends AbstractJpaNamedVersionedEntity implements DistributionSet {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Column(name = "required_migration_step")
|
@Column(name = "required_migration_step")
|
||||||
private boolean requiredMigrationStep = false;
|
private boolean requiredMigrationStep;
|
||||||
|
|
||||||
@ManyToMany(targetEntity = JpaSoftwareModule.class, fetch = FetchType.LAZY)
|
@ManyToMany(targetEntity = JpaSoftwareModule.class, fetch = FetchType.LAZY)
|
||||||
@JoinTable(name = "sp_ds_module", joinColumns = {
|
@JoinTable(name = "sp_ds_module", joinColumns = {
|
||||||
@@ -84,7 +78,7 @@ public class JpaDistributionSet extends JpaNamedVersionedEntity implements Distr
|
|||||||
private Set<DistributionSetTag> tags = new HashSet<>();
|
private Set<DistributionSetTag> tags = new HashSet<>();
|
||||||
|
|
||||||
@Column(name = "deleted")
|
@Column(name = "deleted")
|
||||||
private boolean deleted = false;
|
private boolean deleted;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "assignedDistributionSet", targetEntity = JpaTarget.class, fetch = FetchType.LAZY)
|
@OneToMany(mappedBy = "assignedDistributionSet", targetEntity = JpaTarget.class, fetch = FetchType.LAZY)
|
||||||
private List<Target> assignedToTargets;
|
private List<Target> assignedToTargets;
|
||||||
@@ -106,7 +100,7 @@ public class JpaDistributionSet extends JpaNamedVersionedEntity implements Distr
|
|||||||
private DistributionSetType type;
|
private DistributionSetType type;
|
||||||
|
|
||||||
@Column(name = "complete")
|
@Column(name = "complete")
|
||||||
private boolean complete = false;
|
private boolean complete;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor.
|
* Default constructor.
|
||||||
@@ -130,7 +124,7 @@ public class JpaDistributionSet extends JpaNamedVersionedEntity implements Distr
|
|||||||
* {@link SoftwareModule}s of the {@link DistributionSet}
|
* {@link SoftwareModule}s of the {@link DistributionSet}
|
||||||
*/
|
*/
|
||||||
public JpaDistributionSet(final String name, final String version, final String description,
|
public JpaDistributionSet(final String name, final String version, final String description,
|
||||||
final DistributionSetType type, final Iterable<SoftwareModule> moduleList) {
|
final DistributionSetType type, final Collection<SoftwareModule> moduleList) {
|
||||||
super(name, version, description);
|
super(name, version, description);
|
||||||
|
|
||||||
this.type = type;
|
this.type = type;
|
||||||
@@ -152,15 +146,11 @@ public class JpaDistributionSet extends JpaNamedVersionedEntity implements Distr
|
|||||||
return deleted;
|
return deleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return immutable list of meta data elements.
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public List<DistributionSetMetadata> getMetadata() {
|
public List<DistributionSetMetadata> getMetadata() {
|
||||||
return Collections.unmodifiableList(metadata);
|
return Collections.unmodifiableList(metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Action> getActions() {
|
public List<Action> getActions() {
|
||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
@@ -182,23 +172,16 @@ public class JpaDistributionSet extends JpaNamedVersionedEntity implements Distr
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public DistributionSet setTags(final Set<DistributionSetTag> tags) {
|
public DistributionSet setTags(final Set<DistributionSetTag> tags) {
|
||||||
this.tags = tags;
|
this.tags = tags;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the assignedTargets
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public List<Target> getAssignedTargets() {
|
public List<Target> getAssignedTargets() {
|
||||||
return assignedToTargets;
|
return assignedToTargets;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the installedTargets
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public List<TargetInfo> getInstalledTargets() {
|
public List<TargetInfo> getInstalledTargets() {
|
||||||
return installedAtTargets;
|
return installedAtTargets;
|
||||||
@@ -210,10 +193,6 @@ public class JpaDistributionSet extends JpaNamedVersionedEntity implements Distr
|
|||||||
+ ", getId()=" + getId() + "]";
|
+ ", getId()=" + getId() + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return unmodifiableSet of {@link SoftwareModule}.
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Set<SoftwareModule> getModules() {
|
public Set<SoftwareModule> getModules() {
|
||||||
return Collections.unmodifiableSet(modules);
|
return Collections.unmodifiableSet(modules);
|
||||||
@@ -224,12 +203,6 @@ public class JpaDistributionSet extends JpaNamedVersionedEntity implements Distr
|
|||||||
return new DistributionSetIdName(getId(), getName(), getVersion());
|
return new DistributionSetIdName(getId(), getName(), getVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param softwareModule
|
|
||||||
* @return <code>true</code> if the module was added and <code>false</code>
|
|
||||||
* if it already existed in the set
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean addModule(final SoftwareModule softwareModule) {
|
public boolean addModule(final SoftwareModule softwareModule) {
|
||||||
|
|
||||||
@@ -267,13 +240,6 @@ public class JpaDistributionSet extends JpaNamedVersionedEntity implements Distr
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Removed given {@link SoftwareModule} from this DS instance.
|
|
||||||
*
|
|
||||||
* @param softwareModule
|
|
||||||
* to remove
|
|
||||||
* @return <code>true</code> if element was found and removed
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean removeModule(final SoftwareModule softwareModule) {
|
public boolean removeModule(final SoftwareModule softwareModule) {
|
||||||
final Optional<SoftwareModule> found = modules.stream()
|
final Optional<SoftwareModule> found = modules.stream()
|
||||||
@@ -289,14 +255,6 @@ public class JpaDistributionSet extends JpaNamedVersionedEntity implements Distr
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Searches through modules for the given type.
|
|
||||||
*
|
|
||||||
* @param type
|
|
||||||
* to search for
|
|
||||||
* @return SoftwareModule of given type or <code>null</code> if not in the
|
|
||||||
* list.
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public SoftwareModule findFirstModuleByType(final SoftwareModuleType type) {
|
public SoftwareModule findFirstModuleByType(final SoftwareModuleType type) {
|
||||||
final Optional<SoftwareModule> result = modules.stream().filter(module -> module.getType().equals(type))
|
final Optional<SoftwareModule> result = modules.stream().filter(module -> module.getType().equals(type))
|
||||||
@@ -323,4 +281,5 @@ public class JpaDistributionSet extends JpaNamedVersionedEntity implements Distr
|
|||||||
public boolean isComplete() {
|
public boolean isComplete() {
|
||||||
return complete;
|
return complete;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import org.eclipse.hawkbit.repository.model.DistributionSetMetadata;
|
|||||||
@IdClass(DsMetadataCompositeKey.class)
|
@IdClass(DsMetadataCompositeKey.class)
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "sp_ds_metadata")
|
@Table(name = "sp_ds_metadata")
|
||||||
public class JpaDistributionSetMetadata extends JpaMetaData implements DistributionSetMetadata {
|
public class JpaDistributionSetMetadata extends AbstractJpaMetaData implements DistributionSetMetadata {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@@ -49,7 +49,6 @@ public class JpaDistributionSetMetadata extends JpaMetaData implements Distribut
|
|||||||
return new DsMetadataCompositeKey(distributionSet, getKey());
|
return new DsMetadataCompositeKey(distributionSet, getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setDistributionSet(final DistributionSet distributionSet) {
|
public void setDistributionSet(final DistributionSet distributionSet) {
|
||||||
this.distributionSet = (JpaDistributionSet) distributionSet;
|
this.distributionSet = (JpaDistributionSet) distributionSet;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
|||||||
@Table(name = "sp_distributionset_tag", indexes = {
|
@Table(name = "sp_distributionset_tag", indexes = {
|
||||||
@Index(name = "sp_idx_distribution_set_tag_prim", columnList = "tenant,id") }, uniqueConstraints = @UniqueConstraint(columnNames = {
|
@Index(name = "sp_idx_distribution_set_tag_prim", columnList = "tenant,id") }, uniqueConstraints = @UniqueConstraint(columnNames = {
|
||||||
"name", "tenant" }, name = "uk_ds_tag"))
|
"name", "tenant" }, name = "uk_ds_tag"))
|
||||||
public class JpaDistributionSetTag extends JpaTag implements DistributionSetTag {
|
public class JpaDistributionSetTag extends AbstractJpaTag implements DistributionSetTag {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@ManyToMany(mappedBy = "tags", targetEntity = JpaDistributionSet.class, fetch = FetchType.LAZY)
|
@ManyToMany(mappedBy = "tags", targetEntity = JpaDistributionSet.class, fetch = FetchType.LAZY)
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
|||||||
@Index(name = "sp_idx_distribution_set_type_prim", columnList = "tenant,id") }, uniqueConstraints = {
|
@Index(name = "sp_idx_distribution_set_type_prim", columnList = "tenant,id") }, uniqueConstraints = {
|
||||||
@UniqueConstraint(columnNames = { "name", "tenant" }, name = "uk_dst_name"),
|
@UniqueConstraint(columnNames = { "name", "tenant" }, name = "uk_dst_name"),
|
||||||
@UniqueConstraint(columnNames = { "type_key", "tenant" }, name = "uk_dst_key") })
|
@UniqueConstraint(columnNames = { "type_key", "tenant" }, name = "uk_dst_key") })
|
||||||
public class JpaDistributionSetType extends JpaNamedEntity implements DistributionSetType {
|
public class JpaDistributionSetType extends AbstractJpaNamedEntity implements DistributionSetType {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@OneToMany(targetEntity = DistributionSetTypeElement.class, cascade = {
|
@OneToMany(targetEntity = DistributionSetTypeElement.class, cascade = {
|
||||||
@@ -53,7 +53,7 @@ public class JpaDistributionSetType extends JpaNamedEntity implements Distributi
|
|||||||
private String colour;
|
private String colour;
|
||||||
|
|
||||||
@Column(name = "deleted")
|
@Column(name = "deleted")
|
||||||
private boolean deleted = false;
|
private boolean deleted;
|
||||||
|
|
||||||
public JpaDistributionSetType() {
|
public JpaDistributionSetType() {
|
||||||
// default public constructor for JPA
|
// default public constructor for JPA
|
||||||
@@ -91,19 +91,11 @@ public class JpaDistributionSetType extends JpaNamedEntity implements Distributi
|
|||||||
colour = color;
|
colour = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the deleted
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDeleted() {
|
public boolean isDeleted() {
|
||||||
return deleted;
|
return deleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param deleted
|
|
||||||
* the deleted to set
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void setDeleted(final boolean deleted) {
|
public void setDeleted(final boolean deleted) {
|
||||||
this.deleted = deleted;
|
this.deleted = deleted;
|
||||||
}
|
}
|
||||||
@@ -120,14 +112,6 @@ public class JpaDistributionSetType extends JpaNamedEntity implements Distributi
|
|||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if the given {@link SoftwareModuleType} is in this
|
|
||||||
* {@link DistributionSetType}.
|
|
||||||
*
|
|
||||||
* @param softwareModuleType
|
|
||||||
* search for
|
|
||||||
* @return <code>true</code> if found
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean containsModuleType(final SoftwareModuleType softwareModuleType) {
|
public boolean containsModuleType(final SoftwareModuleType softwareModuleType) {
|
||||||
for (final DistributionSetTypeElement distributionSetTypeElement : elements) {
|
for (final DistributionSetTypeElement distributionSetTypeElement : elements) {
|
||||||
@@ -139,15 +123,6 @@ public class JpaDistributionSetType extends JpaNamedEntity implements Distributi
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if the given {@link SoftwareModuleType} is in this
|
|
||||||
* {@link DistributionSetType} and defined as
|
|
||||||
* {@link DistributionSetTypeElement#isMandatory()}.
|
|
||||||
*
|
|
||||||
* @param softwareModuleType
|
|
||||||
* search for
|
|
||||||
* @return <code>true</code> if found
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean containsMandatoryModuleType(final SoftwareModuleType softwareModuleType) {
|
public boolean containsMandatoryModuleType(final SoftwareModuleType softwareModuleType) {
|
||||||
return elements.stream().filter(element -> element.isMandatory())
|
return elements.stream().filter(element -> element.isMandatory())
|
||||||
@@ -155,15 +130,6 @@ public class JpaDistributionSetType extends JpaNamedEntity implements Distributi
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if the given {@link SoftwareModuleType} is in this
|
|
||||||
* {@link DistributionSetType} and defined as
|
|
||||||
* {@link DistributionSetTypeElement#isMandatory()}.
|
|
||||||
*
|
|
||||||
* @param softwareModuleType
|
|
||||||
* search for by {@link SoftwareModuleType#getId()}
|
|
||||||
* @return <code>true</code> if found
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean containsMandatoryModuleType(final Long softwareModuleTypeId) {
|
public boolean containsMandatoryModuleType(final Long softwareModuleTypeId) {
|
||||||
return elements.stream().filter(element -> element.isMandatory())
|
return elements.stream().filter(element -> element.isMandatory())
|
||||||
@@ -171,15 +137,6 @@ public class JpaDistributionSetType extends JpaNamedEntity implements Distributi
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if the given {@link SoftwareModuleType} is in this
|
|
||||||
* {@link DistributionSetType} and NOT defined as
|
|
||||||
* {@link DistributionSetTypeElement#isMandatory()}.
|
|
||||||
*
|
|
||||||
* @param softwareModuleType
|
|
||||||
* search for
|
|
||||||
* @return <code>true</code> if found
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean containsOptionalModuleType(final SoftwareModuleType softwareModuleType) {
|
public boolean containsOptionalModuleType(final SoftwareModuleType softwareModuleType) {
|
||||||
return elements.stream().filter(element -> !element.isMandatory())
|
return elements.stream().filter(element -> !element.isMandatory())
|
||||||
@@ -187,15 +144,6 @@ public class JpaDistributionSetType extends JpaNamedEntity implements Distributi
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if the given {@link SoftwareModuleType} is in this
|
|
||||||
* {@link DistributionSetType} and NOT defined as
|
|
||||||
* {@link DistributionSetTypeElement#isMandatory()}.
|
|
||||||
*
|
|
||||||
* @param softwareModuleTypeId
|
|
||||||
* search by {@link SoftwareModuleType#getId()}
|
|
||||||
* @return <code>true</code> if found
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean containsOptionalModuleType(final Long softwareModuleTypeId) {
|
public boolean containsOptionalModuleType(final Long softwareModuleTypeId) {
|
||||||
return elements.stream().filter(element -> !element.isMandatory())
|
return elements.stream().filter(element -> !element.isMandatory())
|
||||||
@@ -203,27 +151,11 @@ public class JpaDistributionSetType extends JpaNamedEntity implements Distributi
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Compares the modules of this {@link DistributionSetType} and the given
|
|
||||||
* one.
|
|
||||||
*
|
|
||||||
* @param dsType
|
|
||||||
* to compare with
|
|
||||||
* @return <code>true</code> if the lists are identical.
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean areModuleEntriesIdentical(final DistributionSetType dsType) {
|
public boolean areModuleEntriesIdentical(final DistributionSetType dsType) {
|
||||||
return new HashSet<DistributionSetTypeElement>(((JpaDistributionSetType) dsType).elements).equals(elements);
|
return new HashSet<DistributionSetTypeElement>(((JpaDistributionSetType) dsType).elements).equals(elements);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds {@link SoftwareModuleType} that is optional for the
|
|
||||||
* {@link DistributionSet}.
|
|
||||||
*
|
|
||||||
* @param smType
|
|
||||||
* to add
|
|
||||||
* @return updated instance
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public DistributionSetType addOptionalModuleType(final SoftwareModuleType smType) {
|
public DistributionSetType addOptionalModuleType(final SoftwareModuleType smType) {
|
||||||
elements.add(new DistributionSetTypeElement(this, (JpaSoftwareModuleType) smType, false));
|
elements.add(new DistributionSetTypeElement(this, (JpaSoftwareModuleType) smType, false));
|
||||||
@@ -231,14 +163,6 @@ public class JpaDistributionSetType extends JpaNamedEntity implements Distributi
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds {@link SoftwareModuleType} that is mandatory for the
|
|
||||||
* {@link DistributionSet}.
|
|
||||||
*
|
|
||||||
* @param smType
|
|
||||||
* to add
|
|
||||||
* @return updated instance
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public DistributionSetType addMandatoryModuleType(final SoftwareModuleType smType) {
|
public DistributionSetType addMandatoryModuleType(final SoftwareModuleType smType) {
|
||||||
elements.add(new DistributionSetTypeElement(this, (JpaSoftwareModuleType) smType, true));
|
elements.add(new DistributionSetTypeElement(this, (JpaSoftwareModuleType) smType, true));
|
||||||
@@ -246,13 +170,6 @@ public class JpaDistributionSetType extends JpaNamedEntity implements Distributi
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes {@link SoftwareModuleType} from the list.
|
|
||||||
*
|
|
||||||
* @param smTypeId
|
|
||||||
* to remove
|
|
||||||
* @return updated instance
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public DistributionSetType removeModuleType(final Long smTypeId) {
|
public DistributionSetType removeModuleType(final Long smTypeId) {
|
||||||
// we search by id (standard equals compares also revison)
|
// we search by id (standard equals compares also revison)
|
||||||
@@ -276,12 +193,6 @@ public class JpaDistributionSetType extends JpaNamedEntity implements Distributi
|
|||||||
this.key = key;
|
this.key = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param distributionSet
|
|
||||||
* to check for completeness
|
|
||||||
* @return <code>true</code> if the all mandatory software module types are
|
|
||||||
* in the system.
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkComplete(final DistributionSet distributionSet) {
|
public boolean checkComplete(final DistributionSet distributionSet) {
|
||||||
return distributionSet.getModules().stream().map(module -> module.getType()).collect(Collectors.toList())
|
return distributionSet.getModules().stream().map(module -> module.getType()).collect(Collectors.toList())
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
|||||||
@Table(name = "sp_external_artifact", indexes = {
|
@Table(name = "sp_external_artifact", indexes = {
|
||||||
@Index(name = "sp_idx_external_artifact_prim", columnList = "id,tenant") })
|
@Index(name = "sp_idx_external_artifact_prim", columnList = "id,tenant") })
|
||||||
@Entity
|
@Entity
|
||||||
public class JpaExternalArtifact extends JpaArtifact implements ExternalArtifact {
|
public class JpaExternalArtifact extends AbstractJpaArtifact implements ExternalArtifact {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@@ -85,7 +85,6 @@ public class JpaExternalArtifact extends JpaArtifact implements ExternalArtifact
|
|||||||
return softwareModule;
|
return softwareModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final void setSoftwareModule(final SoftwareModule softwareModule) {
|
public final void setSoftwareModule(final SoftwareModule softwareModule) {
|
||||||
this.softwareModule = (JpaSoftwareModule) softwareModule;
|
this.softwareModule = (JpaSoftwareModule) softwareModule;
|
||||||
this.softwareModule.addArtifact(this);
|
this.softwareModule.addArtifact(this);
|
||||||
@@ -106,9 +105,8 @@ public class JpaExternalArtifact extends JpaArtifact implements ExternalArtifact
|
|||||||
return urlSuffix;
|
return urlSuffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void setExternalArtifactProvider(final JpaExternalArtifactProvider externalArtifactProvider) {
|
||||||
public void setExternalArtifactProvider(final ExternalArtifactProvider externalArtifactProvider) {
|
this.externalArtifactProvider = externalArtifactProvider;
|
||||||
this.externalArtifactProvider = (JpaExternalArtifactProvider) externalArtifactProvider;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -17,15 +17,13 @@ import org.eclipse.hawkbit.repository.model.ExternalArtifact;
|
|||||||
import org.eclipse.hawkbit.repository.model.ExternalArtifactProvider;
|
import org.eclipse.hawkbit.repository.model.ExternalArtifactProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* External repositories for artifact storage. The SP server provides URLs for
|
* JPA implementation of {@link ExternalArtifactProvider}.
|
||||||
* the targets to download from these external resources but does not access
|
|
||||||
* them itself.
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Table(name = "sp_external_provider", indexes = {
|
@Table(name = "sp_external_provider", indexes = {
|
||||||
@Index(name = "sp_idx_external_provider_prim", columnList = "tenant,id") })
|
@Index(name = "sp_idx_external_provider_prim", columnList = "tenant,id") })
|
||||||
@Entity
|
@Entity
|
||||||
public class JpaExternalArtifactProvider extends JpaNamedEntity implements ExternalArtifactProvider {
|
public class JpaExternalArtifactProvider extends AbstractJpaNamedEntity implements ExternalArtifactProvider {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Column(name = "base_url", length = 512, nullable = false)
|
@Column(name = "base_url", length = 512, nullable = false)
|
||||||
|
|||||||
@@ -26,18 +26,13 @@ import com.mongodb.gridfs.GridFS;
|
|||||||
import com.mongodb.gridfs.GridFSFile;
|
import com.mongodb.gridfs.GridFSFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tenant specific locally stored artifact representation that is used by
|
* JPA implementation of {@link LocalArtifact}.
|
||||||
* {@link SoftwareModule} . It contains all information that is provided by the
|
|
||||||
* user while all SP server generated information related to the artifact (hash,
|
|
||||||
* length) is stored directly with the binary itself.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Table(name = "sp_artifact", indexes = { @Index(name = "sp_idx_artifact_01", columnList = "tenant,software_module"),
|
@Table(name = "sp_artifact", indexes = { @Index(name = "sp_idx_artifact_01", columnList = "tenant,software_module"),
|
||||||
@Index(name = "sp_idx_artifact_prim", columnList = "tenant,id") })
|
@Index(name = "sp_idx_artifact_prim", columnList = "tenant,id") })
|
||||||
@Entity
|
@Entity
|
||||||
public class JpaLocalArtifact extends JpaArtifact implements LocalArtifact {
|
public class JpaLocalArtifact extends AbstractJpaArtifact implements LocalArtifact {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -101,7 +96,6 @@ public class JpaLocalArtifact extends JpaArtifact implements LocalArtifact {
|
|||||||
return softwareModule;
|
return softwareModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final void setSoftwareModule(final SoftwareModule softwareModule) {
|
public final void setSoftwareModule(final SoftwareModule softwareModule) {
|
||||||
this.softwareModule = (JpaSoftwareModule) softwareModule;
|
this.softwareModule = (JpaSoftwareModule) softwareModule;
|
||||||
this.softwareModule.addArtifact(this);
|
this.softwareModule.addArtifact(this);
|
||||||
|
|||||||
@@ -34,14 +34,14 @@ import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
|||||||
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Michael Hirsch
|
* JPA implementation of a {@link Rollout}.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "sp_rollout", indexes = {
|
@Table(name = "sp_rollout", indexes = {
|
||||||
@Index(name = "sp_idx_rollout_01", columnList = "tenant,name") }, uniqueConstraints = @UniqueConstraint(columnNames = {
|
@Index(name = "sp_idx_rollout_01", columnList = "tenant,name") }, uniqueConstraints = @UniqueConstraint(columnNames = {
|
||||||
"name", "tenant" }, name = "uk_rollout"))
|
"name", "tenant" }, name = "uk_rollout"))
|
||||||
public class JpaRollout extends JpaNamedEntity implements Rollout {
|
public class JpaRollout extends AbstractJpaNamedEntity implements Rollout {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ public class JpaRollout extends JpaNamedEntity implements Rollout {
|
|||||||
private RolloutStatus status = RolloutStatus.CREATING;
|
private RolloutStatus status = RolloutStatus.CREATING;
|
||||||
|
|
||||||
@Column(name = "last_check")
|
@Column(name = "last_check")
|
||||||
private long lastCheck = 0L;
|
private long lastCheck;
|
||||||
|
|
||||||
@Column(name = "action_type", nullable = false)
|
@Column(name = "action_type", nullable = false)
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
@@ -74,11 +74,11 @@ public class JpaRollout extends JpaNamedEntity implements Rollout {
|
|||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
@CacheField(key = CacheKeys.ROLLOUT_GROUP_TOTAL)
|
@CacheField(key = CacheKeys.ROLLOUT_GROUP_TOTAL)
|
||||||
private int rolloutGroupsTotal = 0;
|
private int rolloutGroupsTotal;
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
@CacheField(key = CacheKeys.ROLLOUT_GROUP_CREATED)
|
@CacheField(key = CacheKeys.ROLLOUT_GROUP_CREATED)
|
||||||
private int rolloutGroupsCreated = 0;
|
private int rolloutGroupsCreated;
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
private transient TotalTargetCountStatus totalTargetCountStatus;
|
private transient TotalTargetCountStatus totalTargetCountStatus;
|
||||||
@@ -98,7 +98,6 @@ public class JpaRollout extends JpaNamedEntity implements Rollout {
|
|||||||
return rolloutGroups;
|
return rolloutGroups;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setRolloutGroups(final List<RolloutGroup> rolloutGroups) {
|
public void setRolloutGroups(final List<RolloutGroup> rolloutGroups) {
|
||||||
this.rolloutGroups = rolloutGroups;
|
this.rolloutGroups = rolloutGroups;
|
||||||
}
|
}
|
||||||
@@ -118,17 +117,14 @@ public class JpaRollout extends JpaNamedEntity implements Rollout {
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setStatus(final RolloutStatus status) {
|
public void setStatus(final RolloutStatus status) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getLastCheck() {
|
public long getLastCheck() {
|
||||||
return lastCheck;
|
return lastCheck;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setLastCheck(final long lastCheck) {
|
public void setLastCheck(final long lastCheck) {
|
||||||
this.lastCheck = lastCheck;
|
this.lastCheck = lastCheck;
|
||||||
}
|
}
|
||||||
@@ -158,7 +154,6 @@ public class JpaRollout extends JpaNamedEntity implements Rollout {
|
|||||||
return totalTargets;
|
return totalTargets;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setTotalTargets(final long totalTargets) {
|
public void setTotalTargets(final long totalTargets) {
|
||||||
this.totalTargets = totalTargets;
|
this.totalTargets = totalTargets;
|
||||||
}
|
}
|
||||||
@@ -168,7 +163,6 @@ public class JpaRollout extends JpaNamedEntity implements Rollout {
|
|||||||
return rolloutGroupsTotal;
|
return rolloutGroupsTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setRolloutGroupsTotal(final int rolloutGroupsTotal) {
|
public void setRolloutGroupsTotal(final int rolloutGroupsTotal) {
|
||||||
this.rolloutGroupsTotal = rolloutGroupsTotal;
|
this.rolloutGroupsTotal = rolloutGroupsTotal;
|
||||||
}
|
}
|
||||||
@@ -178,7 +172,6 @@ public class JpaRollout extends JpaNamedEntity implements Rollout {
|
|||||||
return rolloutGroupsCreated;
|
return rolloutGroupsCreated;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setRolloutGroupsCreated(final int rolloutGroupsCreated) {
|
public void setRolloutGroupsCreated(final int rolloutGroupsCreated) {
|
||||||
this.rolloutGroupsCreated = rolloutGroupsCreated;
|
this.rolloutGroupsCreated = rolloutGroupsCreated;
|
||||||
}
|
}
|
||||||
@@ -191,7 +184,6 @@ public class JpaRollout extends JpaNamedEntity implements Rollout {
|
|||||||
return totalTargetCountStatus;
|
return totalTargetCountStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setTotalTargetCountStatus(final TotalTargetCountStatus totalTargetCountStatus) {
|
public void setTotalTargetCountStatus(final TotalTargetCountStatus totalTargetCountStatus) {
|
||||||
this.totalTargetCountStatus = totalTargetCountStatus;
|
this.totalTargetCountStatus = totalTargetCountStatus;
|
||||||
}
|
}
|
||||||
@@ -203,58 +195,4 @@ public class JpaRollout extends JpaNamedEntity implements Rollout {
|
|||||||
+ ", getName()=" + getName() + ", getId()=" + getId() + "]";
|
+ ", getName()=" + getName() + ", getId()=" + getId() + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* State machine for rollout.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public enum RolloutStatus {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rollouts is beeing created.
|
|
||||||
*/
|
|
||||||
CREATING,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rollout is ready to start.
|
|
||||||
*/
|
|
||||||
READY,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rollout is paused.
|
|
||||||
*/
|
|
||||||
PAUSED,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rollout is starting.
|
|
||||||
*/
|
|
||||||
STARTING,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rollout is stopped.
|
|
||||||
*/
|
|
||||||
STOPPED,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rollout is running.
|
|
||||||
*/
|
|
||||||
RUNNING,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rollout is finished.
|
|
||||||
*/
|
|
||||||
FINISHED,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rollout could not created due errors, might be database problem due
|
|
||||||
* asynchronous creating.
|
|
||||||
*/
|
|
||||||
ERROR_CREATING,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rollout could not started due errors, might be database problem due
|
|
||||||
* asynchronous starting.
|
|
||||||
*/
|
|
||||||
ERROR_STARTING;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,14 +32,12 @@ import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
|||||||
/**
|
/**
|
||||||
* JPA entity definition of persisting a group of an rollout.
|
* JPA entity definition of persisting a group of an rollout.
|
||||||
*
|
*
|
||||||
* @author Michael Hirsch
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "sp_rolloutgroup", indexes = {
|
@Table(name = "sp_rolloutgroup", indexes = {
|
||||||
@Index(name = "sp_idx_rolloutgroup_01", columnList = "tenant,name") }, uniqueConstraints = @UniqueConstraint(columnNames = {
|
@Index(name = "sp_idx_rolloutgroup_01", columnList = "tenant,name") }, uniqueConstraints = @UniqueConstraint(columnNames = {
|
||||||
"name", "rollout", "tenant" }, name = "uk_rolloutgroup"))
|
"name", "rollout", "tenant" }, name = "uk_rolloutgroup"))
|
||||||
public class JpaRolloutGroup extends JpaNamedEntity implements RolloutGroup {
|
public class JpaRolloutGroup extends AbstractJpaNamedEntity implements RolloutGroup {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@@ -61,25 +59,25 @@ public class JpaRolloutGroup extends JpaNamedEntity implements RolloutGroup {
|
|||||||
private RolloutGroupSuccessCondition successCondition = RolloutGroupSuccessCondition.THRESHOLD;
|
private RolloutGroupSuccessCondition successCondition = RolloutGroupSuccessCondition.THRESHOLD;
|
||||||
|
|
||||||
@Column(name = "success_condition_exp", length = 512, nullable = false)
|
@Column(name = "success_condition_exp", length = 512, nullable = false)
|
||||||
private String successConditionExp = null;
|
private String successConditionExp;
|
||||||
|
|
||||||
@Column(name = "success_action", nullable = false)
|
@Column(name = "success_action", nullable = false)
|
||||||
private RolloutGroupSuccessAction successAction = RolloutGroupSuccessAction.NEXTGROUP;
|
private RolloutGroupSuccessAction successAction = RolloutGroupSuccessAction.NEXTGROUP;
|
||||||
|
|
||||||
@Column(name = "success_action_exp", length = 512, nullable = false)
|
@Column(name = "success_action_exp", length = 512, nullable = false)
|
||||||
private String successActionExp = null;
|
private String successActionExp;
|
||||||
|
|
||||||
@Column(name = "error_condition")
|
@Column(name = "error_condition")
|
||||||
private RolloutGroupErrorCondition errorCondition = null;
|
private RolloutGroupErrorCondition errorCondition;
|
||||||
|
|
||||||
@Column(name = "error_condition_exp", length = 512)
|
@Column(name = "error_condition_exp", length = 512)
|
||||||
private String errorConditionExp = null;
|
private String errorConditionExp;
|
||||||
|
|
||||||
@Column(name = "error_action")
|
@Column(name = "error_action")
|
||||||
private RolloutGroupErrorAction errorAction = null;
|
private RolloutGroupErrorAction errorAction;
|
||||||
|
|
||||||
@Column(name = "error_action_exp", length = 512)
|
@Column(name = "error_action_exp", length = 512)
|
||||||
private String errorActionExp = null;
|
private String errorActionExp;
|
||||||
|
|
||||||
@Column(name = "total_targets")
|
@Column(name = "total_targets")
|
||||||
private long totalTargets;
|
private long totalTargets;
|
||||||
@@ -239,271 +237,4 @@ public class JpaRolloutGroup extends JpaNamedEntity implements RolloutGroup {
|
|||||||
+ ", getId()=" + getId() + "]";
|
+ ", getId()=" + getId() + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Rollout goup state machine.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public enum RolloutGroupStatus {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Ready to start the group.
|
|
||||||
*/
|
|
||||||
READY,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Group is scheduled and started sometime, e.g. trigger of group
|
|
||||||
* before.
|
|
||||||
*/
|
|
||||||
SCHEDULED,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Group is finished.
|
|
||||||
*/
|
|
||||||
FINISHED,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Group is finished and has errors.
|
|
||||||
*/
|
|
||||||
ERROR,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Group is running.
|
|
||||||
*/
|
|
||||||
RUNNING;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The condition to evaluate if an group is success state.
|
|
||||||
*/
|
|
||||||
public enum RolloutGroupSuccessCondition {
|
|
||||||
THRESHOLD("thresholdRolloutGroupSuccessCondition");
|
|
||||||
|
|
||||||
private final String beanName;
|
|
||||||
|
|
||||||
private RolloutGroupSuccessCondition(final String beanName) {
|
|
||||||
this.beanName = beanName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the beanName
|
|
||||||
*/
|
|
||||||
public String getBeanName() {
|
|
||||||
return beanName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The condition to evaluate if an group is in error state.
|
|
||||||
*/
|
|
||||||
public enum RolloutGroupErrorCondition {
|
|
||||||
THRESHOLD("thresholdRolloutGroupErrorCondition");
|
|
||||||
|
|
||||||
private final String beanName;
|
|
||||||
|
|
||||||
private RolloutGroupErrorCondition(final String beanName) {
|
|
||||||
this.beanName = beanName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the beanName
|
|
||||||
*/
|
|
||||||
public String getBeanName() {
|
|
||||||
return beanName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The actions executed when the {@link RolloutGroup#errorCondition} is hit.
|
|
||||||
*/
|
|
||||||
public enum RolloutGroupErrorAction {
|
|
||||||
PAUSE("pauseRolloutGroupAction");
|
|
||||||
|
|
||||||
private final String beanName;
|
|
||||||
|
|
||||||
private RolloutGroupErrorAction(final String beanName) {
|
|
||||||
this.beanName = beanName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the beanName
|
|
||||||
*/
|
|
||||||
public String getBeanName() {
|
|
||||||
return beanName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The actions executed when the {@link RolloutGroup#successCondition} is
|
|
||||||
* hit.
|
|
||||||
*/
|
|
||||||
public enum RolloutGroupSuccessAction {
|
|
||||||
NEXTGROUP("startNextRolloutGroupAction");
|
|
||||||
|
|
||||||
private final String beanName;
|
|
||||||
|
|
||||||
private RolloutGroupSuccessAction(final String beanName) {
|
|
||||||
this.beanName = beanName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the beanName
|
|
||||||
*/
|
|
||||||
public String getBeanName() {
|
|
||||||
return beanName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Object which holds all {@link RolloutGroup} conditions together which can
|
|
||||||
* easily built.
|
|
||||||
*/
|
|
||||||
public static class RolloutGroupConditions {
|
|
||||||
private RolloutGroupSuccessCondition successCondition = null;
|
|
||||||
private String successConditionExp = null;
|
|
||||||
private RolloutGroupSuccessAction successAction = null;
|
|
||||||
private String successActionExp = null;
|
|
||||||
private RolloutGroupErrorCondition errorCondition = null;
|
|
||||||
private String errorConditionExp = null;
|
|
||||||
private RolloutGroupErrorAction errorAction = null;
|
|
||||||
private String errorActionExp = null;
|
|
||||||
|
|
||||||
public RolloutGroupSuccessCondition getSuccessCondition() {
|
|
||||||
return successCondition;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSuccessCondition(final RolloutGroupSuccessCondition finishCondition) {
|
|
||||||
successCondition = finishCondition;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSuccessConditionExp() {
|
|
||||||
return successConditionExp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSuccessConditionExp(final String finishConditionExp) {
|
|
||||||
successConditionExp = finishConditionExp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RolloutGroupSuccessAction getSuccessAction() {
|
|
||||||
return successAction;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSuccessAction(final RolloutGroupSuccessAction successAction) {
|
|
||||||
this.successAction = successAction;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSuccessActionExp() {
|
|
||||||
return successActionExp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSuccessActionExp(final String successActionExp) {
|
|
||||||
this.successActionExp = successActionExp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RolloutGroupErrorCondition getErrorCondition() {
|
|
||||||
return errorCondition;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setErrorCondition(final RolloutGroupErrorCondition errorCondition) {
|
|
||||||
this.errorCondition = errorCondition;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getErrorConditionExp() {
|
|
||||||
return errorConditionExp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setErrorConditionExp(final String errorConditionExp) {
|
|
||||||
this.errorConditionExp = errorConditionExp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RolloutGroupErrorAction getErrorAction() {
|
|
||||||
return errorAction;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setErrorAction(final RolloutGroupErrorAction errorAction) {
|
|
||||||
this.errorAction = errorAction;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getErrorActionExp() {
|
|
||||||
return errorActionExp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setErrorActionExp(final String errorActionExp) {
|
|
||||||
this.errorActionExp = errorActionExp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Builder to build easily the {@link RolloutGroupConditions}.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public static class RolloutGroupConditionBuilder {
|
|
||||||
private final RolloutGroupConditions conditions = new RolloutGroupConditions();
|
|
||||||
|
|
||||||
public RolloutGroupConditions build() {
|
|
||||||
return conditions;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the finish condition and expression on the builder.
|
|
||||||
*
|
|
||||||
* @param condition
|
|
||||||
* the finish condition
|
|
||||||
* @param expression
|
|
||||||
* the finish expression
|
|
||||||
* @return the builder itself
|
|
||||||
*/
|
|
||||||
public RolloutGroupConditionBuilder successCondition(final RolloutGroupSuccessCondition condition,
|
|
||||||
final String expression) {
|
|
||||||
conditions.setSuccessCondition(condition);
|
|
||||||
conditions.setSuccessConditionExp(expression);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the success action and expression on the builder.
|
|
||||||
*
|
|
||||||
* @param action
|
|
||||||
* the success action
|
|
||||||
* @param expression
|
|
||||||
* the error expression
|
|
||||||
* @return the builder itself
|
|
||||||
*/
|
|
||||||
public RolloutGroupConditionBuilder successAction(final RolloutGroupSuccessAction action,
|
|
||||||
final String expression) {
|
|
||||||
conditions.setSuccessAction(action);
|
|
||||||
conditions.setSuccessActionExp(expression);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the error condition and expression on the builder.
|
|
||||||
*
|
|
||||||
* @param condition
|
|
||||||
* the error condition
|
|
||||||
* @param expression
|
|
||||||
* the error expression
|
|
||||||
* @return the builder itself
|
|
||||||
*/
|
|
||||||
public RolloutGroupConditionBuilder errorCondition(final RolloutGroupErrorCondition condition,
|
|
||||||
final String expression) {
|
|
||||||
conditions.setErrorCondition(condition);
|
|
||||||
conditions.setErrorConditionExp(expression);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the error action and expression on the builder.
|
|
||||||
*
|
|
||||||
* @param action
|
|
||||||
* the error action
|
|
||||||
* @param expression
|
|
||||||
* the error expression
|
|
||||||
* @return the builder itself
|
|
||||||
*/
|
|
||||||
public RolloutGroupConditionBuilder errorAction(final RolloutGroupErrorAction action, final String expression) {
|
|
||||||
conditions.setErrorAction(action);
|
|
||||||
conditions.setErrorActionExp(expression);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ import org.eclipse.persistence.annotations.CascadeOnDelete;
|
|||||||
@Index(name = "sp_idx_base_sw_module_02", columnList = "tenant,deleted,module_type"),
|
@Index(name = "sp_idx_base_sw_module_02", columnList = "tenant,deleted,module_type"),
|
||||||
@Index(name = "sp_idx_base_sw_module_prim", columnList = "tenant,id") })
|
@Index(name = "sp_idx_base_sw_module_prim", columnList = "tenant,id") })
|
||||||
@NamedEntityGraph(name = "SoftwareModule.artifacts", attributeNodes = { @NamedAttributeNode("artifacts") })
|
@NamedEntityGraph(name = "SoftwareModule.artifacts", attributeNodes = { @NamedAttributeNode("artifacts") })
|
||||||
public class JpaSoftwareModule extends JpaNamedVersionedEntity implements SoftwareModule {
|
public class JpaSoftwareModule extends AbstractJpaNamedVersionedEntity implements SoftwareModule {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@@ -61,7 +61,7 @@ public class JpaSoftwareModule extends JpaNamedVersionedEntity implements Softwa
|
|||||||
private final List<DistributionSet> assignedTo = new ArrayList<>();
|
private final List<DistributionSet> assignedTo = new ArrayList<>();
|
||||||
|
|
||||||
@Column(name = "deleted")
|
@Column(name = "deleted")
|
||||||
private boolean deleted = false;
|
private boolean deleted;
|
||||||
|
|
||||||
@Column(name = "vendor", nullable = true, length = 256)
|
@Column(name = "vendor", nullable = true, length = 256)
|
||||||
private String vendor;
|
private String vendor;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
|
|||||||
@IdClass(SwMetadataCompositeKey.class)
|
@IdClass(SwMetadataCompositeKey.class)
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "sp_sw_metadata")
|
@Table(name = "sp_sw_metadata")
|
||||||
public class JpaSoftwareModuleMetadata extends JpaMetaData implements SoftwareModuleMetadata {
|
public class JpaSoftwareModuleMetadata extends AbstractJpaMetaData implements SoftwareModuleMetadata {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
|
|||||||
@@ -26,12 +26,16 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
|||||||
@Index(name = "sp_idx_software_module_type_prim", columnList = "tenant,id") }, uniqueConstraints = {
|
@Index(name = "sp_idx_software_module_type_prim", columnList = "tenant,id") }, uniqueConstraints = {
|
||||||
@UniqueConstraint(columnNames = { "type_key", "tenant" }, name = "uk_smt_type_key"),
|
@UniqueConstraint(columnNames = { "type_key", "tenant" }, name = "uk_smt_type_key"),
|
||||||
@UniqueConstraint(columnNames = { "name", "tenant" }, name = "uk_smt_name") })
|
@UniqueConstraint(columnNames = { "name", "tenant" }, name = "uk_smt_name") })
|
||||||
public class JpaSoftwareModuleType extends JpaNamedEntity implements SoftwareModuleType {
|
public class JpaSoftwareModuleType extends AbstractJpaNamedEntity implements SoftwareModuleType {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Column(name = "type_key", nullable = false, length = 64)
|
@Column(name = "type_key", nullable = false, length = 64)
|
||||||
private String key;
|
private String key;
|
||||||
|
|
||||||
|
public void setMaxAssignments(final int maxAssignments) {
|
||||||
|
this.maxAssignments = maxAssignments;
|
||||||
|
}
|
||||||
|
|
||||||
@Column(name = "max_ds_assignments", nullable = false)
|
@Column(name = "max_ds_assignments", nullable = false)
|
||||||
private int maxAssignments;
|
private int maxAssignments;
|
||||||
|
|
||||||
@@ -39,7 +43,7 @@ public class JpaSoftwareModuleType extends JpaNamedEntity implements SoftwareMod
|
|||||||
private String colour;
|
private String colour;
|
||||||
|
|
||||||
@Column(name = "deleted")
|
@Column(name = "deleted")
|
||||||
private boolean deleted = false;
|
private boolean deleted;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
@@ -53,7 +57,8 @@ public class JpaSoftwareModuleType extends JpaNamedEntity implements SoftwareMod
|
|||||||
* @param maxAssignments
|
* @param maxAssignments
|
||||||
* assignments to a DS
|
* assignments to a DS
|
||||||
*/
|
*/
|
||||||
public JpaSoftwareModuleType(final String key, final String name, final String description, final int maxAssignments) {
|
public JpaSoftwareModuleType(final String key, final String name, final String description,
|
||||||
|
final int maxAssignments) {
|
||||||
this(key, name, description, maxAssignments, null);
|
this(key, name, description, maxAssignments, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,8 +76,8 @@ public class JpaSoftwareModuleType extends JpaNamedEntity implements SoftwareMod
|
|||||||
* @param colour
|
* @param colour
|
||||||
* of the type. It will be null by default
|
* of the type. It will be null by default
|
||||||
*/
|
*/
|
||||||
public JpaSoftwareModuleType(final String key, final String name, final String description, final int maxAssignments,
|
public JpaSoftwareModuleType(final String key, final String name, final String description,
|
||||||
final String colour) {
|
final int maxAssignments, final String colour) {
|
||||||
super();
|
super();
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.maxAssignments = maxAssignments;
|
this.maxAssignments = maxAssignments;
|
||||||
@@ -122,4 +127,9 @@ public class JpaSoftwareModuleType extends JpaNamedEntity implements SoftwareMod
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return "SoftwareModuleType [key=" + key + ", getName()=" + getName() + ", getId()=" + getId() + "]";
|
return "SoftwareModuleType [key=" + key + ", getName()=" + getName() + ", getId()=" + getId() + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setKey(final String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ import org.springframework.data.domain.Persistable;
|
|||||||
"controller_id", "tenant" }, name = "uk_tenant_controller_id"))
|
"controller_id", "tenant" }, name = "uk_tenant_controller_id"))
|
||||||
@NamedEntityGraph(name = "Target.detail", attributeNodes = { @NamedAttributeNode("tags"),
|
@NamedEntityGraph(name = "Target.detail", attributeNodes = { @NamedAttributeNode("tags"),
|
||||||
@NamedAttributeNode(value = "assignedDistributionSet"), @NamedAttributeNode(value = "targetInfo") })
|
@NamedAttributeNode(value = "assignedDistributionSet"), @NamedAttributeNode(value = "targetInfo") })
|
||||||
public class JpaTarget extends JpaNamedEntity implements Persistable<Long>, Target {
|
public class JpaTarget extends AbstractJpaNamedEntity implements Persistable<Long>, Target {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Column(name = "controller_id", length = 64)
|
@Column(name = "controller_id", length = 64)
|
||||||
@@ -82,7 +82,7 @@ public class JpaTarget extends JpaNamedEntity implements Persistable<Long>, Targ
|
|||||||
private String controllerId;
|
private String controllerId;
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
private boolean entityNew = false;
|
private boolean entityNew;
|
||||||
|
|
||||||
@ManyToMany(targetEntity = JpaTargetTag.class)
|
@ManyToMany(targetEntity = JpaTargetTag.class)
|
||||||
@JoinTable(name = "sp_target_target_tag", joinColumns = {
|
@JoinTable(name = "sp_target_target_tag", joinColumns = {
|
||||||
@@ -103,14 +103,14 @@ public class JpaTarget extends JpaNamedEntity implements Persistable<Long>, Targ
|
|||||||
@CascadeOnDelete
|
@CascadeOnDelete
|
||||||
@OneToOne(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, targetEntity = JpaTargetInfo.class)
|
@OneToOne(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, targetEntity = JpaTargetInfo.class)
|
||||||
@PrimaryKeyJoinColumn
|
@PrimaryKeyJoinColumn
|
||||||
private JpaTargetInfo targetInfo = null;
|
private JpaTargetInfo targetInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the security token of the target which allows if enabled to authenticate
|
* the security token of the target which allows if enabled to authenticate
|
||||||
* with this security token.
|
* with this security token.
|
||||||
*/
|
*/
|
||||||
@Column(name = "sec_token", insertable = true, updatable = true, nullable = false, length = 128)
|
@Column(name = "sec_token", insertable = true, updatable = true, nullable = false, length = 128)
|
||||||
private String securityToken = null;
|
private String securityToken;
|
||||||
|
|
||||||
@CascadeOnDelete
|
@CascadeOnDelete
|
||||||
@OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.REMOVE, CascadeType.PERSIST })
|
@OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.REMOVE, CascadeType.PERSIST })
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
|||||||
@Table(name = "sp_target_filter_query", indexes = {
|
@Table(name = "sp_target_filter_query", indexes = {
|
||||||
@Index(name = "sp_idx_target_filter_query_01", columnList = "tenant,name") }, uniqueConstraints = @UniqueConstraint(columnNames = {
|
@Index(name = "sp_idx_target_filter_query_01", columnList = "tenant,name") }, uniqueConstraints = @UniqueConstraint(columnNames = {
|
||||||
"name", "tenant" }, name = "uk_tenant_custom_filter_name"))
|
"name", "tenant" }, name = "uk_tenant_custom_filter_name"))
|
||||||
public class JpaTargetFilterQuery extends JpaTenantAwareBaseEntity implements TargetFilterQuery {
|
public class JpaTargetFilterQuery extends AbstractJpaTenantAwareBaseEntity implements TargetFilterQuery {
|
||||||
private static final long serialVersionUID = 7493966984413479089L;
|
private static final long serialVersionUID = 7493966984413479089L;
|
||||||
|
|
||||||
@Column(name = "name", length = 64)
|
@Column(name = "name", length = 64)
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import javax.persistence.Table;
|
|||||||
import javax.persistence.Transient;
|
import javax.persistence.Transient;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
|
import org.eclipse.hawkbit.repository.model.PollStatus;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetInfo;
|
import org.eclipse.hawkbit.repository.model.TargetInfo;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||||
@@ -71,7 +72,7 @@ public class JpaTargetInfo implements Persistable<Long>, TargetInfo {
|
|||||||
private Long targetId;
|
private Long targetId;
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
private boolean entityNew = false;
|
private boolean entityNew;
|
||||||
|
|
||||||
@CascadeOnDelete
|
@CascadeOnDelete
|
||||||
@OneToOne(cascade = { CascadeType.MERGE,
|
@OneToOne(cascade = { CascadeType.MERGE,
|
||||||
@@ -81,10 +82,10 @@ public class JpaTargetInfo implements Persistable<Long>, TargetInfo {
|
|||||||
private JpaTarget target;
|
private JpaTarget target;
|
||||||
|
|
||||||
@Column(name = "address", length = 512)
|
@Column(name = "address", length = 512)
|
||||||
private String address = null;
|
private String address;
|
||||||
|
|
||||||
@Column(name = "last_target_query")
|
@Column(name = "last_target_query")
|
||||||
private Long lastTargetQuery = null;
|
private Long lastTargetQuery;
|
||||||
|
|
||||||
@Column(name = "install_date")
|
@Column(name = "install_date")
|
||||||
private Long installationDate;
|
private Long installationDate;
|
||||||
@@ -216,6 +217,7 @@ public class JpaTargetInfo implements Persistable<Long>, TargetInfo {
|
|||||||
return controllerAttributes;
|
return controllerAttributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isRequestControllerAttributes() {
|
public boolean isRequestControllerAttributes() {
|
||||||
return requestControllerAttributes;
|
return requestControllerAttributes;
|
||||||
}
|
}
|
||||||
@@ -275,63 +277,6 @@ public class JpaTargetInfo implements Persistable<Long>, TargetInfo {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The poll time object which holds all the necessary information around the
|
|
||||||
* target poll time, e.g. the last poll time, the next poll time and the
|
|
||||||
* overdue poll time.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public static final class PollStatus {
|
|
||||||
private final LocalDateTime lastPollDate;
|
|
||||||
private final LocalDateTime nextPollDate;
|
|
||||||
private final LocalDateTime overdueDate;
|
|
||||||
private final LocalDateTime currentDate;
|
|
||||||
|
|
||||||
private PollStatus(final LocalDateTime lastPollDate, final LocalDateTime nextPollDate,
|
|
||||||
final LocalDateTime overdueDate, final LocalDateTime currentDate) {
|
|
||||||
this.lastPollDate = lastPollDate;
|
|
||||||
this.nextPollDate = nextPollDate;
|
|
||||||
this.overdueDate = overdueDate;
|
|
||||||
this.currentDate = currentDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* calculates if the target poll time is overdue and the target has not
|
|
||||||
* been polled in the configured poll time interval.
|
|
||||||
*
|
|
||||||
* @return {@code true} if the current time is after the poll time
|
|
||||||
* overdue date otherwise {@code false}.
|
|
||||||
*/
|
|
||||||
public boolean isOverdue() {
|
|
||||||
return currentDate.isAfter(overdueDate);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the lastPollDate
|
|
||||||
*/
|
|
||||||
public LocalDateTime getLastPollDate() {
|
|
||||||
return lastPollDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LocalDateTime getNextPollDate() {
|
|
||||||
return nextPollDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LocalDateTime getOverdueDate() {
|
|
||||||
return overdueDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LocalDateTime getCurrentDate() {
|
|
||||||
return currentDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "PollTime [lastPollDate=" + lastPollDate + ", nextPollDate=" + nextPollDate + ", overdueDate="
|
|
||||||
+ overdueDate + ", currentDate=" + currentDate + "]";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
final int prime = 31;
|
final int prime = 31;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import org.eclipse.hawkbit.repository.model.TargetTag;
|
|||||||
@Table(name = "sp_target_tag", indexes = {
|
@Table(name = "sp_target_tag", indexes = {
|
||||||
@Index(name = "sp_idx_target_tag_prim", columnList = "tenant,id") }, uniqueConstraints = @UniqueConstraint(columnNames = {
|
@Index(name = "sp_idx_target_tag_prim", columnList = "tenant,id") }, uniqueConstraints = @UniqueConstraint(columnNames = {
|
||||||
"name", "tenant" }, name = "uk_targ_tag"))
|
"name", "tenant" }, name = "uk_targ_tag"))
|
||||||
public class JpaTargetTag extends JpaTag implements TargetTag {
|
public class JpaTargetTag extends AbstractJpaTag implements TargetTag {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@ManyToMany(mappedBy = "tags", targetEntity = JpaTarget.class, fetch = FetchType.LAZY)
|
@ManyToMany(mappedBy = "tags", targetEntity = JpaTarget.class, fetch = FetchType.LAZY)
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import org.eclipse.hawkbit.repository.model.TenantConfiguration;
|
|||||||
@Entity
|
@Entity
|
||||||
@Table(name = "sp_tenant_configuration", uniqueConstraints = @UniqueConstraint(columnNames = { "conf_key",
|
@Table(name = "sp_tenant_configuration", uniqueConstraints = @UniqueConstraint(columnNames = { "conf_key",
|
||||||
"tenant" }, name = "uk_tenant_key"))
|
"tenant" }, name = "uk_tenant_key"))
|
||||||
public class JpaTenantConfiguration extends JpaTenantAwareBaseEntity implements TenantConfiguration {
|
public class JpaTenantConfiguration extends AbstractJpaTenantAwareBaseEntity implements TenantConfiguration {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Column(name = "conf_key", length = 128)
|
@Column(name = "conf_key", length = 128)
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ import org.eclipse.hawkbit.repository.model.TenantMetaData;
|
|||||||
@Index(name = "sp_idx_tenant_prim", columnList = "tenant,id") }, uniqueConstraints = {
|
@Index(name = "sp_idx_tenant_prim", columnList = "tenant,id") }, uniqueConstraints = {
|
||||||
@UniqueConstraint(columnNames = { "tenant" }, name = "uk_tenantmd_tenant") })
|
@UniqueConstraint(columnNames = { "tenant" }, name = "uk_tenantmd_tenant") })
|
||||||
@Entity
|
@Entity
|
||||||
public class JpaTenantMetaData extends JpaBaseEntity implements TenantMetaData {
|
public class JpaTenantMetaData extends AbstractJpaBaseEntity implements TenantMetaData {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Column(name = "tenant", nullable = false, length = 40)
|
@Column(name = "tenant", nullable = false, length = 40)
|
||||||
|
|||||||
@@ -50,4 +50,4 @@ public class RolloutTargetGroupId implements Serializable {
|
|||||||
public Long getTarget() {
|
public Long getTarget() {
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,13 +9,21 @@
|
|||||||
package org.eclipse.hawkbit.repository.model;
|
package org.eclipse.hawkbit.repository.model;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Operations to be executed by the target. Usually a software update. Other
|
||||||
|
* supported actions are the cancellation of a running update action or a
|
||||||
|
* refresh request for target attributes.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface Action extends TenantAwareBaseEntity {
|
public interface Action extends TenantAwareBaseEntity {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* indicating that target action has no force time {@link #hasForcedTime()}.
|
* indicating that target action has no force time which is only needed in
|
||||||
|
* case of {@link ActionType#TIMEFORCED}.
|
||||||
*/
|
*/
|
||||||
public static final long NO_FORCE_TIME = 0L;
|
long NO_FORCE_TIME = 0L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the distributionSet
|
* @return the distributionSet
|
||||||
@@ -29,74 +37,117 @@ public interface Action extends TenantAwareBaseEntity {
|
|||||||
void setDistributionSet(DistributionSet distributionSet);
|
void setDistributionSet(DistributionSet distributionSet);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true when action is in state {@link Status#CANCELING} or
|
* @return <code>true</code> when action is in state
|
||||||
* {@link Status#CANCELED}, false otherwise
|
* {@link Status#CANCELING} or {@link Status#CANCELED}, false
|
||||||
|
* otherwise
|
||||||
*/
|
*/
|
||||||
boolean isCancelingOrCanceled();
|
default boolean isCancelingOrCanceled() {
|
||||||
|
return Status.CANCELING.equals(getStatus()) || Status.CANCELED.equals(getStatus());
|
||||||
void setActive(boolean active);
|
}
|
||||||
|
|
||||||
Status getStatus();
|
|
||||||
|
|
||||||
void setStatus(Status status);
|
|
||||||
|
|
||||||
int getDownloadProgressPercent();
|
|
||||||
|
|
||||||
void setDownloadProgressPercent(int downloadProgressPercent);
|
|
||||||
|
|
||||||
boolean isActive();
|
|
||||||
|
|
||||||
void setActionType(ActionType actionType);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the actionType
|
* @return current {@link Status#DOWNLOAD} progress if known by the update
|
||||||
|
* server.
|
||||||
|
*/
|
||||||
|
int getDownloadProgressPercent();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return current {@link Status} of the {@link Action}.
|
||||||
|
*/
|
||||||
|
Status getStatus();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param status
|
||||||
|
* of the {@link Action}
|
||||||
|
*/
|
||||||
|
void setStatus(Status status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return <code>true</code> if {@link Action} is still running.
|
||||||
|
*/
|
||||||
|
boolean isActive();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the {@link ActionType}
|
||||||
*/
|
*/
|
||||||
ActionType getActionType();
|
ActionType getActionType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return list of {@link ActionStatus} entries.
|
||||||
|
*/
|
||||||
List<ActionStatus> getActionStatus();
|
List<ActionStatus> getActionStatus();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param target
|
||||||
|
* of this {@link Action}
|
||||||
|
*/
|
||||||
void setTarget(Target target);
|
void setTarget(Target target);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {@link Target} of this {@link Action}.
|
||||||
|
*/
|
||||||
Target getTarget();
|
Target getTarget();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return time in {@link TimeUnit#MILLISECONDS} after which
|
||||||
|
* {@link #isForced()} switches to <code>true</code> in case of
|
||||||
|
* {@link ActionType#TIMEFORCED}.
|
||||||
|
*/
|
||||||
long getForcedTime();
|
long getForcedTime();
|
||||||
|
|
||||||
void setForcedTime(long forcedTime);
|
/**
|
||||||
|
* @return rolloutGroup related to this {@link Action}.
|
||||||
|
*/
|
||||||
RolloutGroup getRolloutGroup();
|
RolloutGroup getRolloutGroup();
|
||||||
|
|
||||||
void setRolloutGroup(RolloutGroup rolloutGroup);
|
/**
|
||||||
|
* @return rollout related to this {@link Action}.
|
||||||
|
*/
|
||||||
Rollout getRollout();
|
Rollout getRollout();
|
||||||
|
|
||||||
void setRollout(Rollout rollout);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* checks if the {@link #forcedTime} is hit by the given
|
* checks if the {@link #getForcedTime()} is hit by the given
|
||||||
* {@code hitTimeMillis}, by means if the given milliseconds are greater
|
* {@code hitTimeMillis}, by means if the given milliseconds are greater
|
||||||
* than the forcedTime.
|
* than the forcedTime.
|
||||||
*
|
*
|
||||||
* @param hitTimeMillis
|
* @param hitTimeMillis
|
||||||
* the milliseconds, mostly the
|
* the milliseconds, mostly the
|
||||||
* {@link System#currentTimeMillis()}
|
* {@link System#currentTimeMillis()}
|
||||||
* @return {@code true} if this {@link #type} is in
|
* @return {@code true} if this {@link #getActionType()} is in
|
||||||
* {@link ActionType#TIMEFORCED} and the given {@code hitTimeMillis}
|
* {@link ActionType#TIMEFORCED} and the given {@code hitTimeMillis}
|
||||||
* is greater than the {@link #forcedTime} otherwise {@code false}
|
* is greater than the {@link #getForcedTime()} otherwise
|
||||||
|
* {@code false}
|
||||||
*/
|
*/
|
||||||
boolean isHitAutoForceTime(long hitTimeMillis);
|
default boolean isHitAutoForceTime(final long hitTimeMillis) {
|
||||||
|
if (ActionType.TIMEFORCED.equals(getActionType())) {
|
||||||
|
return hitTimeMillis >= getForcedTime();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {@code true} if either the {@link #type} is
|
* @return {@code true} if either the {@link #getActionType()} is
|
||||||
* {@link ActionType#FORCED} or {@link ActionType#TIMEFORCED} but
|
* {@link ActionType#FORCED} or {@link ActionType#TIMEFORCED} but
|
||||||
* then if the {@link #forcedTime} has been exceeded otherwise
|
* then if the {@link #getForcedTime()} has been exceeded otherwise
|
||||||
* always {@code false}
|
* always {@code false}
|
||||||
*/
|
*/
|
||||||
boolean isForce();
|
default boolean isForce() {
|
||||||
|
switch (getActionType()) {
|
||||||
|
case FORCED:
|
||||||
|
return true;
|
||||||
|
case TIMEFORCED:
|
||||||
|
return isHitAutoForceTime(System.currentTimeMillis());
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true when action is forced, false otherwise
|
* @return true when action is forced, false otherwise
|
||||||
*/
|
*/
|
||||||
boolean isForced();
|
default boolean isForced() {
|
||||||
|
return ActionType.FORCED.equals(getActionType());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action status as reported by the controller.
|
* Action status as reported by the controller.
|
||||||
@@ -159,7 +210,21 @@ public interface Action extends TenantAwareBaseEntity {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public enum ActionType {
|
public enum ActionType {
|
||||||
FORCED, SOFT, TIMEFORCED;
|
/**
|
||||||
}
|
* Forced action execution. Target is advised to executed immediately.
|
||||||
|
*/
|
||||||
|
FORCED,
|
||||||
|
|
||||||
}
|
/**
|
||||||
|
* Soft action execution. Target is advised to execute when it fits.
|
||||||
|
*/
|
||||||
|
SOFT,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link #SOFT} action execution until
|
||||||
|
* {@link Action#isHitAutoForceTime(long)} is reached, {@link #FORCED}
|
||||||
|
* after that.
|
||||||
|
*/
|
||||||
|
TIMEFORCED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -9,13 +9,30 @@
|
|||||||
package org.eclipse.hawkbit.repository.model;
|
package org.eclipse.hawkbit.repository.model;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.Action.Status;
|
import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Status information of an {@link Action} which can be provided by the
|
||||||
|
* {@link Target} or is added by the update server itself. This can be the start
|
||||||
|
* of the {@link Action} life cycle, the end and update notifications in
|
||||||
|
* between.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface ActionStatus extends TenantAwareBaseEntity {
|
public interface ActionStatus extends TenantAwareBaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return time in {@link TimeUnit#MILLISECONDS} when the status was
|
||||||
|
* reported.
|
||||||
|
*/
|
||||||
Long getOccurredAt();
|
Long getOccurredAt();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param occurredAt
|
||||||
|
* time in {@link TimeUnit#MILLISECONDS} when the status was
|
||||||
|
* reported.
|
||||||
|
*/
|
||||||
void setOccurredAt(Long occurredAt);
|
void setOccurredAt(Long occurredAt);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -26,14 +43,36 @@ public interface ActionStatus extends TenantAwareBaseEntity {
|
|||||||
*/
|
*/
|
||||||
void addMessage(String message);
|
void addMessage(String message);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return list of message entries that can be added to the
|
||||||
|
* {@link ActionStatus}.
|
||||||
|
*/
|
||||||
List<String> getMessages();
|
List<String> getMessages();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {@link Action} this {@link ActionStatus} belongs to.
|
||||||
|
*/
|
||||||
Action getAction();
|
Action getAction();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param action
|
||||||
|
* this {@link ActionStatus} belongs to.
|
||||||
|
*/
|
||||||
void setAction(Action action);
|
void setAction(Action action);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the {@link Status} of this {@link ActionStatus}. Caused
|
||||||
|
* potentially a transition change of the {@link #getAction()} if
|
||||||
|
* different from the previous {@link ActionStatus#getStatus()}.
|
||||||
|
*/
|
||||||
Status getStatus();
|
Status getStatus();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param status
|
||||||
|
* of this {@link ActionStatus}. May cause a transition change of
|
||||||
|
* the {@link #getAction()} if different from the previous
|
||||||
|
* {@link ActionStatus#getStatus()}.
|
||||||
|
*/
|
||||||
void setStatus(Status status);
|
void setStatus(Status status);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,8 +20,6 @@ import org.eclipse.hawkbit.repository.model.Action.Status;
|
|||||||
// TODO: create interface
|
// TODO: create interface
|
||||||
public class ActionWithStatusCount {
|
public class ActionWithStatusCount {
|
||||||
private final Long actionStatusCount;
|
private final Long actionStatusCount;
|
||||||
private final Long actionId;
|
|
||||||
private final ActionType actionType;
|
|
||||||
private final boolean actionActive;
|
private final boolean actionActive;
|
||||||
private final long actionForceTime;
|
private final long actionForceTime;
|
||||||
private final Status actionStatus;
|
private final Status actionStatus;
|
||||||
@@ -67,8 +65,6 @@ public class ActionWithStatusCount {
|
|||||||
final long forcedTime, final Status status, final Long actionCreatedAt, final Long actionLastModifiedAt,
|
final long forcedTime, final Status status, final Long actionCreatedAt, final Long actionLastModifiedAt,
|
||||||
final Long dsId, final String dsName, final String dsVersion, final Long actionStatusCount,
|
final Long dsId, final String dsName, final String dsVersion, final Long actionStatusCount,
|
||||||
final String rolloutName) {
|
final String rolloutName) {
|
||||||
this.actionId = actionId;
|
|
||||||
this.actionType = actionType;
|
|
||||||
actionActive = active;
|
actionActive = active;
|
||||||
actionForceTime = forcedTime;
|
actionForceTime = forcedTime;
|
||||||
actionStatus = status;
|
actionStatus = status;
|
||||||
@@ -92,26 +88,6 @@ public class ActionWithStatusCount {
|
|||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getActionId() {
|
|
||||||
return actionId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ActionType getActionType() {
|
|
||||||
return actionType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isActionActive() {
|
|
||||||
return actionActive;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getActionForceTime() {
|
|
||||||
return actionForceTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Status getActionStatus() {
|
|
||||||
return actionStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getActionCreatedAt() {
|
public Long getActionCreatedAt() {
|
||||||
return actionCreatedAt;
|
return actionCreatedAt;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,16 +8,35 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.model;
|
package org.eclipse.hawkbit.repository.model;
|
||||||
|
|
||||||
|
import com.google.common.io.BaseEncoding;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Binaries for a {@link SoftwareModule} Note: the decision which artifacts have
|
||||||
|
* to be downloaded are done on the device side. e.g. Full Package, Signatures,
|
||||||
|
* binary deltas
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface Artifact extends TenantAwareBaseEntity {
|
public interface Artifact extends TenantAwareBaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {@link SoftwareModule} this {@link Artifact} belongs to.
|
||||||
|
*/
|
||||||
SoftwareModule getSoftwareModule();
|
SoftwareModule getSoftwareModule();
|
||||||
|
|
||||||
void setSoftwareModule(SoftwareModule softwareModule);
|
/**
|
||||||
|
* @return MD5 hash of the artifact.
|
||||||
|
*/
|
||||||
String getMd5Hash();
|
String getMd5Hash();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return SHA-1 hash of the artifact in {@link BaseEncoding#base16()}
|
||||||
|
* format.
|
||||||
|
*/
|
||||||
String getSha1Hash();
|
String getSha1Hash();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return size of the artifact in bytes.
|
||||||
|
*/
|
||||||
Long getSize();
|
Long getSize();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -9,19 +9,41 @@
|
|||||||
package org.eclipse.hawkbit.repository.model;
|
package org.eclipse.hawkbit.repository.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.springframework.hateoas.Identifiable;
|
import org.springframework.hateoas.Identifiable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Core information of all entities.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface BaseEntity extends Serializable, Identifiable<Long> {
|
public interface BaseEntity extends Serializable, Identifiable<Long> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return time in {@link TimeUnit#MILLISECONDS} when the {@link BaseEntity}
|
||||||
|
* was created.
|
||||||
|
*/
|
||||||
Long getCreatedAt();
|
Long getCreatedAt();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return user that created the {@link BaseEntity}.
|
||||||
|
*/
|
||||||
String getCreatedBy();
|
String getCreatedBy();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return time in {@link TimeUnit#MILLISECONDS} when the {@link BaseEntity}
|
||||||
|
* was last time changed.
|
||||||
|
*/
|
||||||
Long getLastModifiedAt();
|
Long getLastModifiedAt();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return user that updated the {@link BaseEntity} last.
|
||||||
|
*/
|
||||||
String getLastModifiedBy();
|
String getLastModifiedBy();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return version of the {@link BaseEntity}.
|
||||||
|
*/
|
||||||
long getOptLockRevision();
|
long getOptLockRevision();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -11,27 +11,63 @@ package org.eclipse.hawkbit.repository.model;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A {@link DistributionSet} defines a meta package that combines a set of
|
||||||
|
* {@link SoftwareModule}s which have to be or are provisioned to a
|
||||||
|
* {@link Target}.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* A {@link Target} has exactly one target {@link DistributionSet} assigned.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface DistributionSet extends NamedVersionedEntity {
|
public interface DistributionSet extends NamedVersionedEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {@link Set} of assigned {@link DistributionSetTag}s.
|
||||||
|
*/
|
||||||
Set<DistributionSetTag> getTags();
|
Set<DistributionSetTag> getTags();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return <code>true</code> if the set is deleted and only kept for history
|
||||||
|
* purposes.
|
||||||
|
*/
|
||||||
boolean isDeleted();
|
boolean isDeleted();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return immutable list of meta data elements.
|
* @return immutable {@link List} of {@link DistributionSetMetadata}
|
||||||
|
* elements. See {@link DistributionSetManagement} to alter.
|
||||||
*/
|
*/
|
||||||
List<DistributionSetMetadata> getMetadata();
|
List<DistributionSetMetadata> getMetadata();
|
||||||
|
|
||||||
List<Action> getActions();
|
/**
|
||||||
|
* @return <code>true</code> if {@link DistributionSet} contains a mandatory
|
||||||
|
* migration step, i.e. unfinished {@link Action}s will kept active
|
||||||
|
* and not automatically canceled if overridden by a newer update.
|
||||||
|
*/
|
||||||
boolean isRequiredMigrationStep();
|
boolean isRequiredMigrationStep();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param deleted
|
||||||
|
* to <code>true</code> if {@link DistributionSet} is no longer
|
||||||
|
* be usage but kept for history purposes.
|
||||||
|
* @return updated {@link DistributionSet}
|
||||||
|
*/
|
||||||
DistributionSet setDeleted(boolean deleted);
|
DistributionSet setDeleted(boolean deleted);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isRequiredMigrationStep
|
||||||
|
* to <code>true</code> if {@link DistributionSet} contains a
|
||||||
|
* mandatory migration step, i.e. unfinished {@link Action}s will
|
||||||
|
* kept active and not automatically canceled if overridden by a
|
||||||
|
* newer update.
|
||||||
|
*
|
||||||
|
* @return updated {@link DistributionSet}
|
||||||
|
*/
|
||||||
DistributionSet setRequiredMigrationStep(boolean isRequiredMigrationStep);
|
DistributionSet setRequiredMigrationStep(boolean isRequiredMigrationStep);
|
||||||
|
|
||||||
DistributionSet setTags(Set<DistributionSetTag> tags);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the assignedTargets
|
* @return the assignedTargets
|
||||||
*/
|
*/
|
||||||
@@ -48,6 +84,9 @@ public interface DistributionSet extends NamedVersionedEntity {
|
|||||||
*/
|
*/
|
||||||
Set<SoftwareModule> getModules();
|
Set<SoftwareModule> getModules();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {@link DistributionSetIdName} view.
|
||||||
|
*/
|
||||||
DistributionSetIdName getDistributionSetIdName();
|
DistributionSetIdName getDistributionSetIdName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -77,10 +116,22 @@ public interface DistributionSet extends NamedVersionedEntity {
|
|||||||
*/
|
*/
|
||||||
SoftwareModule findFirstModuleByType(SoftwareModuleType type);
|
SoftwareModule findFirstModuleByType(SoftwareModuleType type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return type of the {@link DistributionSet}.
|
||||||
|
*/
|
||||||
DistributionSetType getType();
|
DistributionSetType getType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param type
|
||||||
|
* of the {@link DistributionSet}.
|
||||||
|
*/
|
||||||
void setType(DistributionSetType type);
|
void setType(DistributionSetType type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return <code>true</code> if all defined
|
||||||
|
* {@link DistributionSetType#getMandatoryModuleTypes()} of
|
||||||
|
* {@link #getType()} are present in this {@link DistributionSet}.
|
||||||
|
*/
|
||||||
boolean isComplete();
|
boolean isComplete();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -8,10 +8,15 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.model;
|
package org.eclipse.hawkbit.repository.model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link MetaData} of a {@link DistributionSet}.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface DistributionSetMetadata extends MetaData {
|
public interface DistributionSetMetadata extends MetaData {
|
||||||
|
|
||||||
void setDistributionSet(DistributionSet distributionSet);
|
/**
|
||||||
|
* @return {@link DistributionSet} of this {@link MetaData} entry.
|
||||||
|
*/
|
||||||
DistributionSet getDistributionSet();
|
DistributionSet getDistributionSet();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -10,8 +10,16 @@ package org.eclipse.hawkbit.repository.model;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link Tag} of a {@link DistributionSet}.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface DistributionSetTag extends Tag {
|
public interface DistributionSetTag extends Tag {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {@link List} of {@link DistributionSet}s this {@link Tag} is
|
||||||
|
* assigned to.
|
||||||
|
*/
|
||||||
List<DistributionSet> getAssignedToDistributionSet();
|
List<DistributionSet> getAssignedToDistributionSet();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -12,21 +12,33 @@ import java.util.Set;
|
|||||||
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.DistributionSetTypeElement;
|
import org.eclipse.hawkbit.repository.jpa.model.DistributionSetTypeElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A {@link DistributionSetType} is an abstract definition for
|
||||||
|
* {@link DistributionSet} that defines what {@link SoftwareModule}s can be
|
||||||
|
* added (optional) to {@link DistributionSet} of that type or have to added
|
||||||
|
* (mandatory) in order to be considered complete. Only complete DS can be
|
||||||
|
* assigned to a {@link Target}.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface DistributionSetType extends NamedEntity {
|
public interface DistributionSetType extends NamedEntity {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the deleted
|
* @return <code>true</code> if the type is deleted and only kept for
|
||||||
|
* history purposes.
|
||||||
*/
|
*/
|
||||||
boolean isDeleted();
|
boolean isDeleted();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param deleted
|
* @return set of {@link SoftwareModuleType}s that need to be in a
|
||||||
* the deleted to set
|
* {@link DistributionSet} of this type to be
|
||||||
|
* {@link DistributionSet#isComplete()}.
|
||||||
*/
|
*/
|
||||||
void setDeleted(boolean deleted);
|
|
||||||
|
|
||||||
Set<SoftwareModuleType> getMandatoryModuleTypes();
|
Set<SoftwareModuleType> getMandatoryModuleTypes();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return set of optional {@link SoftwareModuleType}s that can be in a
|
||||||
|
* {@link DistributionSet} of this type.
|
||||||
|
*/
|
||||||
Set<SoftwareModuleType> getOptionalModuleTypes();
|
Set<SoftwareModuleType> getOptionalModuleTypes();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,7 +67,7 @@ public interface DistributionSetType extends NamedEntity {
|
|||||||
* {@link DistributionSetType} and defined as
|
* {@link DistributionSetType} and defined as
|
||||||
* {@link DistributionSetTypeElement#isMandatory()}.
|
* {@link DistributionSetTypeElement#isMandatory()}.
|
||||||
*
|
*
|
||||||
* @param softwareModuleType
|
* @param softwareModuleTypeId
|
||||||
* search for by {@link SoftwareModuleType#getId()}
|
* search for by {@link SoftwareModuleType#getId()}
|
||||||
* @return <code>true</code> if found
|
* @return <code>true</code> if found
|
||||||
*/
|
*/
|
||||||
@@ -122,8 +134,15 @@ public interface DistributionSetType extends NamedEntity {
|
|||||||
*/
|
*/
|
||||||
DistributionSetType removeModuleType(Long smTypeId);
|
DistributionSetType removeModuleType(Long smTypeId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return business key of this {@link DistributionSetType}.
|
||||||
|
*/
|
||||||
String getKey();
|
String getKey();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param key
|
||||||
|
* of this {@link DistributionSetType}.
|
||||||
|
*/
|
||||||
void setKey(String key);
|
void setKey(String key);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -134,8 +153,15 @@ public interface DistributionSetType extends NamedEntity {
|
|||||||
*/
|
*/
|
||||||
boolean checkComplete(DistributionSet distributionSet);
|
boolean checkComplete(DistributionSet distributionSet);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return get color code to by used in management UI views.
|
||||||
|
*/
|
||||||
String getColour();
|
String getColour();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param colour
|
||||||
|
* code to by used in management UI views.
|
||||||
|
*/
|
||||||
void setColour(final String colour);
|
void setColour(final String colour);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -8,16 +8,30 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.model;
|
package org.eclipse.hawkbit.repository.model;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* External artifact representation with all the necessary information to
|
||||||
|
* generate an artifact {@link URL} at runtime.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface ExternalArtifact extends Artifact {
|
public interface ExternalArtifact extends Artifact {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {@link ExternalArtifactProvider} of this {@link Artifact}.
|
||||||
|
*/
|
||||||
ExternalArtifactProvider getExternalArtifactProvider();
|
ExternalArtifactProvider getExternalArtifactProvider();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return generated download {@link URL}.
|
||||||
|
*/
|
||||||
String getUrl();
|
String getUrl();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return suffix for {@link URL} generation.
|
||||||
|
*/
|
||||||
String getUrlSuffix();
|
String getUrlSuffix();
|
||||||
|
|
||||||
void setExternalArtifactProvider(ExternalArtifactProvider externalArtifactProvider);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param urlSuffix
|
* @param urlSuffix
|
||||||
* the urlSuffix to set
|
* the urlSuffix to set
|
||||||
|
|||||||
@@ -8,14 +8,34 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.model;
|
package org.eclipse.hawkbit.repository.model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* External repositories for artifact storage. The update server provides URLs
|
||||||
|
* for the targets to download from these external resources but does not access
|
||||||
|
* them itself.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface ExternalArtifactProvider extends NamedEntity {
|
public interface ExternalArtifactProvider extends NamedEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return prefix for url generation
|
||||||
|
*/
|
||||||
String getBasePath();
|
String getBasePath();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return default for {@link ExternalArtifact#getUrlSuffix()}.
|
||||||
|
*/
|
||||||
String getDefaultSuffix();
|
String getDefaultSuffix();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param basePath
|
||||||
|
* prefix for url generation
|
||||||
|
*/
|
||||||
void setBasePath(String basePath);
|
void setBasePath(String basePath);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param defaultSuffix
|
||||||
|
* for {@link ExternalArtifact#getUrlSuffix()}.
|
||||||
|
*/
|
||||||
void setDefaultSuffix(String defaultSuffix);
|
void setDefaultSuffix(String defaultSuffix);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,21 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.model;
|
package org.eclipse.hawkbit.repository.model;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.artifact.repository.ArtifactRepository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tenant specific locally stored artifact representation that is used by
|
||||||
|
* {@link SoftwareModule}s . It contains all information that is provided by the
|
||||||
|
* user while all update server generated information related to the artifact
|
||||||
|
* (hash, length) is stored directly with the binary itself in the
|
||||||
|
* {@link ArtifactRepository}.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface LocalArtifact extends Artifact {
|
public interface LocalArtifact extends Artifact {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the filename that was provided during upload.
|
||||||
|
*/
|
||||||
String getFilename();
|
String getFilename();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,14 +10,30 @@ package org.eclipse.hawkbit.repository.model;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Meta data for entities, a (key/value) store.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface MetaData extends Serializable {
|
public interface MetaData extends Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the key
|
||||||
|
*/
|
||||||
String getKey();
|
String getKey();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param key
|
||||||
|
*/
|
||||||
void setKey(String key);
|
void setKey(String key);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the value
|
||||||
|
*/
|
||||||
String getValue();
|
String getValue();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param value
|
||||||
|
*/
|
||||||
void setValue(String value);
|
void setValue(String value);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -8,14 +8,32 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.model;
|
package org.eclipse.hawkbit.repository.model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Entities that have a name and description.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface NamedEntity extends TenantAwareBaseEntity {
|
public interface NamedEntity extends TenantAwareBaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the description of the entity.
|
||||||
|
*/
|
||||||
String getDescription();
|
String getDescription();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the name of the entity.
|
||||||
|
*/
|
||||||
String getName();
|
String getName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description
|
||||||
|
* of the entity.
|
||||||
|
*/
|
||||||
void setDescription(String description);
|
void setDescription(String description);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param name
|
||||||
|
* of the entity.
|
||||||
|
*/
|
||||||
void setName(String name);
|
void setName(String name);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,10 +8,21 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.model;
|
package org.eclipse.hawkbit.repository.model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Entities that have a name and a description.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface NamedVersionedEntity extends NamedEntity {
|
public interface NamedVersionedEntity extends NamedEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the version of entity.
|
||||||
|
*/
|
||||||
String getVersion();
|
String getVersion();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param version
|
||||||
|
* of the entity.
|
||||||
|
*/
|
||||||
void setVersion(String version);
|
void setVersion(String version);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -10,31 +10,53 @@ package org.eclipse.hawkbit.repository.model;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRollout.RolloutStatus;
|
|
||||||
import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Software update operations in large scale IoT scenarios with hundred of
|
||||||
|
* thousands of devices require special handling.
|
||||||
|
*
|
||||||
|
* That includes secure handling of large volumes of devices at rollout creation
|
||||||
|
* time. Monitoring of the rollout progress. Emergency rollout shutdown in case
|
||||||
|
* of problems on to many devices and reporting capabilities for a complete
|
||||||
|
* understanding of the rollout progress at each point in time.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface Rollout extends NamedEntity {
|
public interface Rollout extends NamedEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {@link DistributionSet} that is rolled out
|
||||||
|
*/
|
||||||
DistributionSet getDistributionSet();
|
DistributionSet getDistributionSet();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param distributionSet
|
||||||
|
* that is rolled out
|
||||||
|
*/
|
||||||
void setDistributionSet(DistributionSet distributionSet);
|
void setDistributionSet(DistributionSet distributionSet);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return list of deployment groups of the rollout.
|
||||||
|
*/
|
||||||
List<RolloutGroup> getRolloutGroups();
|
List<RolloutGroup> getRolloutGroups();
|
||||||
|
|
||||||
void setRolloutGroups(List<RolloutGroup> rolloutGroups);
|
/**
|
||||||
|
* @return rsql query that identifies the targets that are part of this
|
||||||
|
* rollout.
|
||||||
|
*/
|
||||||
String getTargetFilterQuery();
|
String getTargetFilterQuery();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param targetFilterQuery
|
||||||
|
* that identifies the targets that are part of this rollout.
|
||||||
|
*/
|
||||||
void setTargetFilterQuery(String targetFilterQuery);
|
void setTargetFilterQuery(String targetFilterQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return status of the rollout
|
||||||
|
*/
|
||||||
RolloutStatus getStatus();
|
RolloutStatus getStatus();
|
||||||
|
|
||||||
void setStatus(RolloutStatus status);
|
|
||||||
|
|
||||||
long getLastCheck();
|
|
||||||
|
|
||||||
void setLastCheck(long lastCheck);
|
|
||||||
|
|
||||||
ActionType getActionType();
|
ActionType getActionType();
|
||||||
|
|
||||||
void setActionType(ActionType actionType);
|
void setActionType(ActionType actionType);
|
||||||
@@ -45,18 +67,65 @@ public interface Rollout extends NamedEntity {
|
|||||||
|
|
||||||
long getTotalTargets();
|
long getTotalTargets();
|
||||||
|
|
||||||
void setTotalTargets(long totalTargets);
|
|
||||||
|
|
||||||
int getRolloutGroupsTotal();
|
int getRolloutGroupsTotal();
|
||||||
|
|
||||||
void setRolloutGroupsTotal(int rolloutGroupsTotal);
|
|
||||||
|
|
||||||
int getRolloutGroupsCreated();
|
int getRolloutGroupsCreated();
|
||||||
|
|
||||||
void setRolloutGroupsCreated(int rolloutGroupsCreated);
|
|
||||||
|
|
||||||
TotalTargetCountStatus getTotalTargetCountStatus();
|
TotalTargetCountStatus getTotalTargetCountStatus();
|
||||||
|
|
||||||
void setTotalTargetCountStatus(TotalTargetCountStatus totalTargetCountStatus);
|
/**
|
||||||
|
*
|
||||||
|
* State machine for rollout.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public enum RolloutStatus {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rollouts is being created.
|
||||||
|
*/
|
||||||
|
CREATING,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rollout is ready to start.
|
||||||
|
*/
|
||||||
|
READY,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rollout is paused.
|
||||||
|
*/
|
||||||
|
PAUSED,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rollout is starting.
|
||||||
|
*/
|
||||||
|
STARTING,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rollout is stopped.
|
||||||
|
*/
|
||||||
|
STOPPED,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rollout is running.
|
||||||
|
*/
|
||||||
|
RUNNING,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rollout is finished.
|
||||||
|
*/
|
||||||
|
FINISHED,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rollout could not be created due to errors, might be a database
|
||||||
|
* problem during asynchronous creating.
|
||||||
|
*/
|
||||||
|
ERROR_CREATING,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rollout could not be started due to errors, might be database problem
|
||||||
|
* during asynchronous starting.
|
||||||
|
*/
|
||||||
|
ERROR_STARTING;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -8,12 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.model;
|
package org.eclipse.hawkbit.repository.model;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup.RolloutGroupErrorAction;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup.RolloutGroupErrorCondition;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup.RolloutGroupStatus;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup.RolloutGroupSuccessAction;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup.RolloutGroupSuccessCondition;
|
|
||||||
|
|
||||||
public interface RolloutGroup extends NamedEntity {
|
public interface RolloutGroup extends NamedEntity {
|
||||||
|
|
||||||
Rollout getRollout();
|
Rollout getRollout();
|
||||||
@@ -75,4 +69,117 @@ public interface RolloutGroup extends NamedEntity {
|
|||||||
*/
|
*/
|
||||||
void setTotalTargetCountStatus(TotalTargetCountStatus totalTargetCountStatus);
|
void setTotalTargetCountStatus(TotalTargetCountStatus totalTargetCountStatus);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rollout goup state machine.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public enum RolloutGroupStatus {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ready to start the group.
|
||||||
|
*/
|
||||||
|
READY,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Group is scheduled and started sometime, e.g. trigger of group
|
||||||
|
* before.
|
||||||
|
*/
|
||||||
|
SCHEDULED,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Group is finished.
|
||||||
|
*/
|
||||||
|
FINISHED,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Group is finished and has errors.
|
||||||
|
*/
|
||||||
|
ERROR,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Group is running.
|
||||||
|
*/
|
||||||
|
RUNNING;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The condition to evaluate if an group is success state.
|
||||||
|
*/
|
||||||
|
public enum RolloutGroupSuccessCondition {
|
||||||
|
THRESHOLD("thresholdRolloutGroupSuccessCondition");
|
||||||
|
|
||||||
|
private final String beanName;
|
||||||
|
|
||||||
|
private RolloutGroupSuccessCondition(final String beanName) {
|
||||||
|
this.beanName = beanName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the beanName
|
||||||
|
*/
|
||||||
|
public String getBeanName() {
|
||||||
|
return beanName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The condition to evaluate if an group is in error state.
|
||||||
|
*/
|
||||||
|
public enum RolloutGroupErrorCondition {
|
||||||
|
THRESHOLD("thresholdRolloutGroupErrorCondition");
|
||||||
|
|
||||||
|
private final String beanName;
|
||||||
|
|
||||||
|
private RolloutGroupErrorCondition(final String beanName) {
|
||||||
|
this.beanName = beanName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the beanName
|
||||||
|
*/
|
||||||
|
public String getBeanName() {
|
||||||
|
return beanName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The actions executed when the {@link RolloutGroup#errorCondition} is hit.
|
||||||
|
*/
|
||||||
|
public enum RolloutGroupErrorAction {
|
||||||
|
PAUSE("pauseRolloutGroupAction");
|
||||||
|
|
||||||
|
private final String beanName;
|
||||||
|
|
||||||
|
private RolloutGroupErrorAction(final String beanName) {
|
||||||
|
this.beanName = beanName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the beanName
|
||||||
|
*/
|
||||||
|
public String getBeanName() {
|
||||||
|
return beanName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The actions executed when the {@link RolloutGroup#successCondition} is
|
||||||
|
* hit.
|
||||||
|
*/
|
||||||
|
public enum RolloutGroupSuccessAction {
|
||||||
|
NEXTGROUP("startNextRolloutGroupAction");
|
||||||
|
|
||||||
|
private final String beanName;
|
||||||
|
|
||||||
|
private RolloutGroupSuccessAction(final String beanName) {
|
||||||
|
this.beanName = beanName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the beanName
|
||||||
|
*/
|
||||||
|
public String getBeanName() {
|
||||||
|
return beanName;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -12,8 +12,12 @@ public interface SoftwareModuleType extends NamedEntity {
|
|||||||
|
|
||||||
String getKey();
|
String getKey();
|
||||||
|
|
||||||
|
void setKey(String key);
|
||||||
|
|
||||||
int getMaxAssignments();
|
int getMaxAssignments();
|
||||||
|
|
||||||
|
void setMaxAssignments(int maxAssignments);
|
||||||
|
|
||||||
boolean isDeleted();
|
boolean isDeleted();
|
||||||
|
|
||||||
void setDeleted(boolean deleted);
|
void setDeleted(boolean deleted);
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ import java.io.Serializable;
|
|||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaTargetInfo.PollStatus;
|
|
||||||
|
|
||||||
public interface TargetInfo extends Serializable {
|
public interface TargetInfo extends Serializable {
|
||||||
|
|
||||||
Long getId();
|
Long getId();
|
||||||
@@ -43,4 +41,6 @@ public interface TargetInfo extends Serializable {
|
|||||||
*/
|
*/
|
||||||
PollStatus getPollStatus();
|
PollStatus getPollStatus();
|
||||||
|
|
||||||
|
boolean isRequestControllerAttributes();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -11,9 +11,9 @@ package org.eclipse.hawkbit.rollout.condition;
|
|||||||
import org.eclipse.hawkbit.repository.RolloutManagement;
|
import org.eclipse.hawkbit.repository.RolloutManagement;
|
||||||
import org.eclipse.hawkbit.repository.jpa.RolloutGroupRepository;
|
import org.eclipse.hawkbit.repository.jpa.RolloutGroupRepository;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup.RolloutGroupStatus;
|
|
||||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||||
|
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupStatus;
|
||||||
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ import java.util.List;
|
|||||||
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
||||||
import org.eclipse.hawkbit.repository.jpa.RolloutGroupRepository;
|
import org.eclipse.hawkbit.repository.jpa.RolloutGroupRepository;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup.RolloutGroupStatus;
|
|
||||||
import org.eclipse.hawkbit.repository.model.Action;
|
import org.eclipse.hawkbit.repository.model.Action;
|
||||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||||
|
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupStatus;
|
||||||
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
|||||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||||
import org.eclipse.hawkbit.repository.jpa.ActionRepository;
|
import org.eclipse.hawkbit.repository.jpa.ActionRepository;
|
||||||
|
import org.eclipse.hawkbit.repository.jpa.model.AbstractJpaArtifact;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaActionStatus;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaActionStatus;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaArtifact;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSet;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSetTag;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSetTag;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSetType;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSetType;
|
||||||
@@ -76,7 +76,7 @@ public class TestDataUtil {
|
|||||||
// load also lazy stuff
|
// load also lazy stuff
|
||||||
set = distributionSetManagement.findDistributionSetByIdWithDetails(set.getId());
|
set = distributionSetManagement.findDistributionSetByIdWithDetails(set.getId());
|
||||||
|
|
||||||
assertThat(distributionSetManagement.findDistributionSetsAll(pageReq, false, true)).hasSize(1);
|
assertThat(distributionSetManagement.findDistributionSetsByDeletedAndOrCompleted(pageReq, false, true)).hasSize(1);
|
||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,12 +232,12 @@ public class TestDataUtil {
|
|||||||
return generateDistributionSet(suffix, "v1.0", softwareManagement, distributionSetManagement, false);
|
return generateDistributionSet(suffix, "v1.0", softwareManagement, distributionSetManagement, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<JpaArtifact> generateArtifacts(final ArtifactManagement artifactManagement,
|
public static List<AbstractJpaArtifact> generateArtifacts(final ArtifactManagement artifactManagement,
|
||||||
final Long moduleId) {
|
final Long moduleId) {
|
||||||
final List<JpaArtifact> artifacts = new ArrayList<>();
|
final List<AbstractJpaArtifact> artifacts = new ArrayList<>();
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
final InputStream stubInputStream = IOUtils.toInputStream("some test data" + i);
|
final InputStream stubInputStream = IOUtils.toInputStream("some test data" + i);
|
||||||
artifacts.add((JpaArtifact) artifactManagement.createLocalArtifact(stubInputStream, moduleId,
|
artifacts.add((AbstractJpaArtifact) artifactManagement.createLocalArtifact(stubInputStream, moduleId,
|
||||||
"filename" + i, false));
|
"filename" + i, false));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ package org.eclipse.hawkbit.repository;
|
|||||||
import static org.fest.assertions.api.Assertions.assertThat;
|
import static org.fest.assertions.api.Assertions.assertThat;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaAction;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaAction;
|
||||||
import org.eclipse.hawkbit.repository.model.Action;
|
|
||||||
import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
@@ -27,11 +26,11 @@ public class ActionTest {
|
|||||||
@Description("Ensures that timeforced moded switch from soft to forces after defined timeframe.")
|
@Description("Ensures that timeforced moded switch from soft to forces after defined timeframe.")
|
||||||
public void timeforcedHitNewHasCodeIsGenerated() throws InterruptedException {
|
public void timeforcedHitNewHasCodeIsGenerated() throws InterruptedException {
|
||||||
|
|
||||||
final boolean active = true;
|
final boolean active;
|
||||||
// current time + 1 seconds
|
// current time + 1 seconds
|
||||||
final long sleepTime = 1000;
|
final long sleepTime = 1000;
|
||||||
final long timeForceTimeAt = System.currentTimeMillis() + sleepTime;
|
final long timeForceTimeAt = System.currentTimeMillis() + sleepTime;
|
||||||
final Action timeforcedAction = new JpaAction();
|
final JpaAction timeforcedAction = new JpaAction();
|
||||||
timeforcedAction.setActionType(ActionType.TIMEFORCED);
|
timeforcedAction.setActionType(ActionType.TIMEFORCED);
|
||||||
timeforcedAction.setForcedTime(timeForceTimeAt);
|
timeforcedAction.setForcedTime(timeForceTimeAt);
|
||||||
assertThat(timeforcedAction.isForce()).isFalse();
|
assertThat(timeforcedAction.isForce()).isFalse();
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public class ControllerManagementTest extends AbstractIntegrationTest {
|
|||||||
.isEqualTo(TargetUpdateStatus.IN_SYNC);
|
.isEqualTo(TargetUpdateStatus.IN_SYNC);
|
||||||
|
|
||||||
assertThat(actionStatusRepository.findAll(pageReq).getNumberOfElements()).isEqualTo(3);
|
assertThat(actionStatusRepository.findAll(pageReq).getNumberOfElements()).isEqualTo(3);
|
||||||
assertThat(deploymentManagement.findActionStatusByAction(pageReq, savedAction, false).getNumberOfElements())
|
assertThat(deploymentManagement.findActionStatusByAction(pageReq, savedAction).getNumberOfElements())
|
||||||
.isEqualTo(3);
|
.isEqualTo(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -511,8 +511,8 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
|
|
||||||
final List<Long> deployedTargetIDs = deploymentResult.getDeployedTargetIDs();
|
final List<Long> deployedTargetIDs = deploymentResult.getDeployedTargetIDs();
|
||||||
final List<Long> undeployedTargetIDs = deploymentResult.getUndeployedTargetIDs();
|
final List<Long> undeployedTargetIDs = deploymentResult.getUndeployedTargetIDs();
|
||||||
final List<Target> savedNakedTargets = deploymentResult.getUndeployedTargets();
|
final Collection<JpaTarget> savedNakedTargets = (Collection) deploymentResult.getUndeployedTargets();
|
||||||
final List<Target> savedDeployedTargets = deploymentResult.getDeployedTargets();
|
final Collection<JpaTarget> savedDeployedTargets = (Collection) deploymentResult.getDeployedTargets();
|
||||||
|
|
||||||
// retrieving all Actions created by the assignDistributionSet call
|
// retrieving all Actions created by the assignDistributionSet call
|
||||||
final Page<JpaAction> page = actionRepository.findAll(pageReq);
|
final Page<JpaAction> page = actionRepository.findAll(pageReq);
|
||||||
@@ -540,11 +540,9 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
// test the content of different lists
|
// test the content of different lists
|
||||||
assertThat(allFoundTargets).as("content of founded target is wrong").containsAll(deployedTargetsFromDB)
|
assertThat(allFoundTargets).as("content of founded target is wrong").containsAll(deployedTargetsFromDB)
|
||||||
.containsAll(undeployedTargetsFromDB);
|
.containsAll(undeployedTargetsFromDB);
|
||||||
assertThat(deployedTargetsFromDB).as("content of deployed target is wrong")
|
assertThat(deployedTargetsFromDB).as("content of deployed target is wrong").containsAll(savedDeployedTargets)
|
||||||
.containsAll((Iterable<? extends JpaTarget>) savedDeployedTargets)
|
|
||||||
.doesNotContain(Iterables.toArray(undeployedTargetsFromDB, JpaTarget.class));
|
.doesNotContain(Iterables.toArray(undeployedTargetsFromDB, JpaTarget.class));
|
||||||
assertThat(undeployedTargetsFromDB).as("content of undeployed target is wrong")
|
assertThat(undeployedTargetsFromDB).as("content of undeployed target is wrong").containsAll(savedNakedTargets)
|
||||||
.containsAll((Iterable<? extends JpaTarget>) savedNakedTargets)
|
|
||||||
.doesNotContain(Iterables.toArray(deployedTargetsFromDB, JpaTarget.class));
|
.doesNotContain(Iterables.toArray(deployedTargetsFromDB, JpaTarget.class));
|
||||||
|
|
||||||
// For each of the 4 targets 1 distribution sets gets assigned
|
// For each of the 4 targets 1 distribution sets gets assigned
|
||||||
@@ -675,10 +673,11 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// verify that deleted attribute is used correctly
|
// verify that deleted attribute is used correctly
|
||||||
List<DistributionSet> allFoundDS = distributionSetManagement.findDistributionSetsAll(pageReq, false, true)
|
List<DistributionSet> allFoundDS = distributionSetManagement
|
||||||
.getContent();
|
.findDistributionSetsByDeletedAndOrCompleted(pageReq, false, true).getContent();
|
||||||
assertThat(allFoundDS.size()).as("no ds should be founded").isEqualTo(0);
|
assertThat(allFoundDS.size()).as("no ds should be founded").isEqualTo(0);
|
||||||
allFoundDS = distributionSetManagement.findDistributionSetsAll(pageRequest, true, true).getContent();
|
allFoundDS = distributionSetManagement.findDistributionSetsByDeletedAndOrCompleted(pageRequest, true, true)
|
||||||
|
.getContent();
|
||||||
assertThat(allFoundDS).as("wrong size of founded ds").hasSize(noOfDistributionSets);
|
assertThat(allFoundDS).as("wrong size of founded ds").hasSize(noOfDistributionSets);
|
||||||
|
|
||||||
for (final DistributionSet ds : deploymentResult.getDistributionSets()) {
|
for (final DistributionSet ds : deploymentResult.getDistributionSets()) {
|
||||||
@@ -692,9 +691,11 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
// has been installed
|
// has been installed
|
||||||
// successfully and no activeAction is referring to created distribution
|
// successfully and no activeAction is referring to created distribution
|
||||||
// sets
|
// sets
|
||||||
allFoundDS = distributionSetManagement.findDistributionSetsAll(pageRequest, false, true).getContent();
|
allFoundDS = distributionSetManagement.findDistributionSetsByDeletedAndOrCompleted(pageRequest, false, true)
|
||||||
|
.getContent();
|
||||||
assertThat(allFoundDS.size()).as("no ds should be founded").isEqualTo(0);
|
assertThat(allFoundDS.size()).as("no ds should be founded").isEqualTo(0);
|
||||||
allFoundDS = distributionSetManagement.findDistributionSetsAll(pageRequest, true, true).getContent();
|
allFoundDS = distributionSetManagement.findDistributionSetsByDeletedAndOrCompleted(pageRequest, true, true)
|
||||||
|
.getContent();
|
||||||
assertThat(allFoundDS).as("size of founded ds is wrong").hasSize(noOfDistributionSets);
|
assertThat(allFoundDS).as("size of founded ds is wrong").hasSize(noOfDistributionSets);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -404,7 +404,7 @@ public class DistributionSetManagementTest extends AbstractIntegrationTest {
|
|||||||
// modifying the meta data value
|
// modifying the meta data value
|
||||||
dsMetadata.setValue(knownUpdateValue);
|
dsMetadata.setValue(knownUpdateValue);
|
||||||
dsMetadata.setKey(knownKey);
|
dsMetadata.setKey(knownKey);
|
||||||
dsMetadata.setDistributionSet(changedLockRevisionDS);
|
((JpaDistributionSetMetadata) dsMetadata).setDistributionSet(changedLockRevisionDS);
|
||||||
|
|
||||||
Thread.sleep(100);
|
Thread.sleep(100);
|
||||||
|
|
||||||
@@ -728,7 +728,8 @@ public class DistributionSetManagementTest extends AbstractIntegrationTest {
|
|||||||
public void findDistributionSetsWithoutLazy() {
|
public void findDistributionSetsWithoutLazy() {
|
||||||
TestDataUtil.generateDistributionSets(20, softwareManagement, distributionSetManagement);
|
TestDataUtil.generateDistributionSets(20, softwareManagement, distributionSetManagement);
|
||||||
|
|
||||||
assertThat(distributionSetManagement.findDistributionSetsAll(pageReq, false, true)).hasSize(20);
|
assertThat(distributionSetManagement.findDistributionSetsByDeletedAndOrCompleted(pageReq, false, true))
|
||||||
|
.hasSize(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -747,8 +748,9 @@ public class DistributionSetManagementTest extends AbstractIntegrationTest {
|
|||||||
distributionSetManagement.deleteDistributionSet(ds1.getId());
|
distributionSetManagement.deleteDistributionSet(ds1.getId());
|
||||||
// not assigned so not marked as deleted but fully deleted
|
// not assigned so not marked as deleted but fully deleted
|
||||||
assertThat(distributionSetRepository.findAll()).hasSize(1);
|
assertThat(distributionSetRepository.findAll()).hasSize(1);
|
||||||
assertThat(distributionSetManagement.findDistributionSetsAll(pageReq, Boolean.FALSE, Boolean.TRUE)
|
assertThat(distributionSetManagement
|
||||||
.getTotalElements()).isEqualTo(1);
|
.findDistributionSetsByDeletedAndOrCompleted(pageReq, Boolean.FALSE, Boolean.TRUE).getTotalElements())
|
||||||
|
.isEqualTo(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -816,8 +818,9 @@ public class DistributionSetManagementTest extends AbstractIntegrationTest {
|
|||||||
|
|
||||||
// not assigned so not marked as deleted
|
// not assigned so not marked as deleted
|
||||||
assertThat(distributionSetRepository.findAll()).hasSize(3);
|
assertThat(distributionSetRepository.findAll()).hasSize(3);
|
||||||
assertThat(distributionSetManagement.findDistributionSetsAll(pageReq, Boolean.FALSE, Boolean.TRUE)
|
assertThat(distributionSetManagement
|
||||||
.getTotalElements()).isEqualTo(2);
|
.findDistributionSetsByDeletedAndOrCompleted(pageReq, Boolean.FALSE, Boolean.TRUE).getTotalElements())
|
||||||
|
.isEqualTo(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Target sendUpdateActionStatusToTarget(final Status status, final Action updActA, final Target t,
|
private Target sendUpdateActionStatusToTarget(final Status status, final Action updActA, final Target t,
|
||||||
|
|||||||
@@ -18,23 +18,22 @@ import java.util.concurrent.Callable;
|
|||||||
|
|
||||||
import org.eclipse.hawkbit.AbstractIntegrationTest;
|
import org.eclipse.hawkbit.AbstractIntegrationTest;
|
||||||
import org.eclipse.hawkbit.TestDataUtil;
|
import org.eclipse.hawkbit.TestDataUtil;
|
||||||
import org.eclipse.hawkbit.repository.jpa.OffsetBasedPageRequest;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaAction;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaAction;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaActionStatus;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaActionStatus;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRollout;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaRollout;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRollout.RolloutStatus;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup.RolloutGroupConditions;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup.RolloutGroupErrorAction;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup.RolloutGroupErrorCondition;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup.RolloutGroupStatus;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup.RolloutGroupSuccessCondition;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaSoftwareModule;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaSoftwareModule;
|
||||||
import org.eclipse.hawkbit.repository.model.Action;
|
import org.eclipse.hawkbit.repository.model.Action;
|
||||||
import org.eclipse.hawkbit.repository.model.Action.Status;
|
import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||||
|
import org.eclipse.hawkbit.repository.model.Rollout.RolloutStatus;
|
||||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||||
|
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupErrorAction;
|
||||||
|
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupErrorCondition;
|
||||||
|
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupStatus;
|
||||||
|
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupSuccessCondition;
|
||||||
|
import org.eclipse.hawkbit.repository.model.RolloutGroupConditionBuilder;
|
||||||
|
import org.eclipse.hawkbit.repository.model.RolloutGroupConditions;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||||
@@ -876,7 +875,7 @@ public class RolloutManagementTest extends AbstractIntegrationTest {
|
|||||||
softwareManagement, distributionSetManagement);
|
softwareManagement, distributionSetManagement);
|
||||||
targetManagement.createTargets(
|
targetManagement.createTargets(
|
||||||
TestDataUtil.buildTargetFixtures(amountTargetsForRollout, targetPrefixName + "-", targetPrefixName));
|
TestDataUtil.buildTargetFixtures(amountTargetsForRollout, targetPrefixName + "-", targetPrefixName));
|
||||||
final RolloutGroupConditions conditions = new JpaRolloutGroup.RolloutGroupConditionBuilder()
|
final RolloutGroupConditions conditions = new RolloutGroupConditionBuilder()
|
||||||
.successCondition(RolloutGroupSuccessCondition.THRESHOLD, successCondition)
|
.successCondition(RolloutGroupSuccessCondition.THRESHOLD, successCondition)
|
||||||
.errorCondition(RolloutGroupErrorCondition.THRESHOLD, errorCondition)
|
.errorCondition(RolloutGroupErrorCondition.THRESHOLD, errorCondition)
|
||||||
.errorAction(RolloutGroupErrorAction.PAUSE, null).build();
|
.errorAction(RolloutGroupErrorAction.PAUSE, null).build();
|
||||||
@@ -963,7 +962,7 @@ public class RolloutManagementTest extends AbstractIntegrationTest {
|
|||||||
private Rollout createRolloutByVariables(final String rolloutName, final String rolloutDescription,
|
private Rollout createRolloutByVariables(final String rolloutName, final String rolloutDescription,
|
||||||
final int groupSize, final String filterQuery, final DistributionSet distributionSet,
|
final int groupSize, final String filterQuery, final DistributionSet distributionSet,
|
||||||
final String successCondition, final String errorCondition) {
|
final String successCondition, final String errorCondition) {
|
||||||
final RolloutGroupConditions conditions = new JpaRolloutGroup.RolloutGroupConditionBuilder()
|
final RolloutGroupConditions conditions = new RolloutGroupConditionBuilder()
|
||||||
.successCondition(RolloutGroupSuccessCondition.THRESHOLD, successCondition)
|
.successCondition(RolloutGroupSuccessCondition.THRESHOLD, successCondition)
|
||||||
.errorCondition(RolloutGroupErrorCondition.THRESHOLD, errorCondition)
|
.errorCondition(RolloutGroupErrorCondition.THRESHOLD, errorCondition)
|
||||||
.errorAction(RolloutGroupErrorAction.PAUSE, null).build();
|
.errorAction(RolloutGroupErrorAction.PAUSE, null).build();
|
||||||
|
|||||||
@@ -961,7 +961,7 @@ public class SoftwareManagementTest extends AbstractIntegrationTestWithMongoDB {
|
|||||||
.getSoftwareModule();
|
.getSoftwareModule();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
softwareManagement.findSoftwareModuleMetadata(new SwMetadataCompositeKey(ah, "doesnotexist"));
|
softwareManagement.findSoftwareModuleMetadata(ah, "doesnotexist");
|
||||||
fail("should not have worked as module metadata with that key does not exist");
|
fail("should not have worked as module metadata with that key does not exist");
|
||||||
} catch (final EntityNotFoundException e) {
|
} catch (final EntityNotFoundException e) {
|
||||||
|
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ import org.eclipse.hawkbit.AbstractIntegrationTest;
|
|||||||
import org.eclipse.hawkbit.TestDataUtil;
|
import org.eclipse.hawkbit.TestDataUtil;
|
||||||
import org.eclipse.hawkbit.repository.RolloutGroupFields;
|
import org.eclipse.hawkbit.repository.RolloutGroupFields;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRollout;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaRollout;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup.RolloutGroupConditionBuilder;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup.RolloutGroupSuccessCondition;
|
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||||
|
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupSuccessCondition;
|
||||||
|
import org.eclipse.hawkbit.repository.model.RolloutGroupConditionBuilder;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class RSQLSoftwareModuleTypeFieldsTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void assertRSQLQuery(final String rsqlParam, final long excpectedEntity) {
|
private void assertRSQLQuery(final String rsqlParam, final long excpectedEntity) {
|
||||||
final Page<SoftwareModuleType> find = softwareManagement.findSoftwareModuleTypesByPredicate(rsqlParam,
|
final Page<SoftwareModuleType> find = softwareManagement.findSoftwareModuleTypesAll(rsqlParam,
|
||||||
new PageRequest(0, 100));
|
new PageRequest(0, 100));
|
||||||
final long countAll = find.getTotalElements();
|
final long countAll = find.getTotalElements();
|
||||||
assertThat(find).isNotNull();
|
assertThat(find).isNotNull();
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ public class MultiTenancyEntityTest extends AbstractIntegrationTest {
|
|||||||
|
|
||||||
private Page<DistributionSet> findDistributionSetForTenant(final String tenant) throws Exception {
|
private Page<DistributionSet> findDistributionSetForTenant(final String tenant) throws Exception {
|
||||||
return securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", tenant),
|
return securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", tenant),
|
||||||
() -> distributionSetManagement.findDistributionSetsAll(pageReq, false, false));
|
() -> distributionSetManagement.findDistributionSetsByDeletedAndOrCompleted(pageReq, false, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import java.util.stream.Collectors;
|
|||||||
import org.apache.commons.lang3.RandomStringUtils;
|
import org.apache.commons.lang3.RandomStringUtils;
|
||||||
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.RolloutGroup.RolloutGroupConditions;
|
import org.eclipse.hawkbit.repository.model.RolloutGroupConditions;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
||||||
import org.eclipse.hawkbit.repository.jpa.OffsetBasedPageRequest;
|
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
||||||
|
import org.eclipse.hawkbit.repository.jpa.model.JpaLocalArtifact;
|
||||||
import org.eclipse.hawkbit.repository.model.LocalArtifact;
|
import org.eclipse.hawkbit.repository.model.LocalArtifact;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
@@ -72,7 +73,7 @@ public class ArtifactBeanQuery extends AbstractBeanQuery<LocalArtifact> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected LocalArtifact constructBean() {
|
protected LocalArtifact constructBean() {
|
||||||
return new LocalArtifact();
|
return new JpaLocalArtifact();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
||||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||||
import org.eclipse.hawkbit.repository.jpa.OffsetBasedPageRequest;
|
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||||
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
|
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ package org.eclipse.hawkbit.ui.artifacts.smtable;
|
|||||||
|
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaSoftwareModule;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -19,7 +19,7 @@ import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ProxyBaseSoftwareModuleItem extends SoftwareModule {
|
public class ProxyBaseSoftwareModuleItem extends JpaSoftwareModule {
|
||||||
|
|
||||||
private static final long serialVersionUID = -1555306616599140635L;
|
private static final long serialVersionUID = -1555306616599140635L;
|
||||||
|
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ public class SoftwareModuleAddUpdateWindow implements Serializable {
|
|||||||
mainLayout.addComponent(hLayout);
|
mainLayout.addComponent(hLayout);
|
||||||
mainLayout.setComponentAlignment(hLayout, Alignment.MIDDLE_LEFT);
|
mainLayout.setComponentAlignment(hLayout, Alignment.MIDDLE_LEFT);
|
||||||
mainLayout.addComponents(nameTextField, versionTextField, vendorTextField, descTextArea, buttonsLayout);
|
mainLayout.addComponents(nameTextField, versionTextField, vendorTextField, descTextArea, buttonsLayout);
|
||||||
|
|
||||||
/* add main layout to the window */
|
/* add main layout to the window */
|
||||||
window = SPUIComponentProvider.getWindow(i18n.get("upload.caption.add.new.swmodule"), null,
|
window = SPUIComponentProvider.getWindow(i18n.get("upload.caption.add.new.swmodule"), null,
|
||||||
SPUIDefinitions.CREATE_UPDATE_WINDOW);
|
SPUIDefinitions.CREATE_UPDATE_WINDOW);
|
||||||
@@ -277,8 +277,8 @@ public class SoftwareModuleAddUpdateWindow implements Serializable {
|
|||||||
uiNotifcation.displayValidationError(
|
uiNotifcation.displayValidationError(
|
||||||
i18n.get("message.duplicate.softwaremodule", new Object[] { name, version }));
|
i18n.get("message.duplicate.softwaremodule", new Object[] { name, version }));
|
||||||
} else {
|
} else {
|
||||||
final SoftwareModule newBaseSoftwareModule = HawkbitCommonUtil.addNewBaseSoftware(name, version, vendor,
|
final SoftwareModule newBaseSoftwareModule = HawkbitCommonUtil.addNewBaseSoftware(softwareManagement,
|
||||||
softwareManagement.findSoftwareModuleTypeByName(type), description);
|
name, version, vendor, softwareManagement.findSoftwareModuleTypeByName(type), description);
|
||||||
if (newBaseSoftwareModule != null) {
|
if (newBaseSoftwareModule != null) {
|
||||||
/* display success message */
|
/* display success message */
|
||||||
uiNotifcation.displaySuccess(i18n.get("message.save.success", new Object[] {
|
uiNotifcation.displaySuccess(i18n.get("message.save.success", new Object[] {
|
||||||
|
|||||||
@@ -625,8 +625,10 @@ public class CreateUpdateSoftwareTypeLayout extends CustomComponent implements C
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (null != typeNameValue && null != typeKeyValue) {
|
if (null != typeNameValue && null != typeKeyValue) {
|
||||||
SoftwareModuleType newSWType = new SoftwareModuleType(typeKeyValue, typeNameValue, typeDescValue,
|
SoftwareModuleType newSWType = swTypeManagementService.generateSoftwareModuleType(typeKeyValue,
|
||||||
assignNumber, colorPicked);
|
typeNameValue, typeDescValue, assignNumber);
|
||||||
|
newSWType.setColour(colorPicked);
|
||||||
|
|
||||||
if (null != typeDescValue) {
|
if (null != typeDescValue) {
|
||||||
newSWType.setDescription(typeDescValue);
|
newSWType.setDescription(typeDescValue);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||||
import org.eclipse.hawkbit.repository.jpa.OffsetBasedPageRequest;
|
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
|
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
|
||||||
@@ -57,8 +57,9 @@ public class DistributionSetTypeBeanQuery extends AbstractBeanQuery<Distribution
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected DistributionSetType constructBean() {
|
protected DistributionSetType constructBean() {
|
||||||
|
final DistributionSetType result = distributionSetManagement.generateDistributionSetType("", "", "");
|
||||||
return new DistributionSetType("", "", "", "");
|
result.setColour("");
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ package org.eclipse.hawkbit.ui.common;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
||||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||||
import org.eclipse.hawkbit.repository.jpa.OffsetBasedPageRequest;
|
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
|
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
|
||||||
@@ -47,7 +47,7 @@ public class SoftwareModuleTypeBeanQuery extends AbstractBeanQuery<SoftwareModul
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SoftwareModuleType constructBean() {
|
protected SoftwareModuleType constructBean() {
|
||||||
return new SoftwareModuleType();
|
return softwareManagement.generateSoftwareModuleType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.components;
|
package org.eclipse.hawkbit.ui.components;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -15,7 +16,7 @@ import org.eclipse.hawkbit.repository.model.DistributionSet;
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ProxyDistribution extends DistributionSet {
|
public class ProxyDistribution extends JpaDistributionSet {
|
||||||
|
|
||||||
private static final long serialVersionUID = -8891449133620645310L;
|
private static final long serialVersionUID = -8891449133620645310L;
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.ui.components;
|
|||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.repository.jpa.model.JpaTarget;
|
||||||
import org.eclipse.hawkbit.repository.model.Action.Status;
|
import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
@@ -25,7 +26,7 @@ import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ProxyTarget extends Target {
|
public class ProxyTarget extends JpaTarget {
|
||||||
private static final long serialVersionUID = -8891449133620645310L;
|
private static final long serialVersionUID = -8891449133620645310L;
|
||||||
private String controllerId;
|
private String controllerId;
|
||||||
private URI address = null;
|
private URI address = null;
|
||||||
@@ -262,7 +263,7 @@ public class ProxyTarget extends Target {
|
|||||||
* @param assignedDistributionSet
|
* @param assignedDistributionSet
|
||||||
* the assignedDistributionSet to set
|
* the assignedDistributionSet to set
|
||||||
*/
|
*/
|
||||||
public void setAssignedDistributionSet(DistributionSet assignedDistributionSet) {
|
public void setAssignedDistributionSet(final DistributionSet assignedDistributionSet) {
|
||||||
this.assignedDistributionSet = assignedDistributionSet;
|
this.assignedDistributionSet = assignedDistributionSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,14 +8,14 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.components;
|
package org.eclipse.hawkbit.ui.components;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaTargetFilterQuery;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ProxyTargetFilter extends TargetFilterQuery {
|
public class ProxyTargetFilter extends JpaTargetFilterQuery {
|
||||||
|
|
||||||
private static final long serialVersionUID = 6622060929679084419L;
|
private static final long serialVersionUID = 6622060929679084419L;
|
||||||
|
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ public class CreateUpdateDistSetTypeLayout extends CustomComponent implements Co
|
|||||||
|
|
||||||
mainLayout.addComponent(fieldLayout);
|
mainLayout.addComponent(fieldLayout);
|
||||||
mainLayout.addComponent(twinTableLayout);
|
mainLayout.addComponent(twinTableLayout);
|
||||||
|
|
||||||
colorLayout = new HorizontalLayout();
|
colorLayout = new HorizontalLayout();
|
||||||
sliderLayout = new VerticalLayout();
|
sliderLayout = new VerticalLayout();
|
||||||
final HorizontalLayout chooseColorLayout = new HorizontalLayout();
|
final HorizontalLayout chooseColorLayout = new HorizontalLayout();
|
||||||
@@ -654,7 +654,8 @@ public class CreateUpdateDistSetTypeLayout extends CustomComponent implements Co
|
|||||||
final String typeDescValue = HawkbitCommonUtil.trimAndNullIfEmpty(typeDesc.getValue());
|
final String typeDescValue = HawkbitCommonUtil.trimAndNullIfEmpty(typeDesc.getValue());
|
||||||
final List<Long> itemIds = (List<Long>) selectedTable.getItemIds();
|
final List<Long> itemIds = (List<Long>) selectedTable.getItemIds();
|
||||||
if (null != typeNameValue && null != typeKeyValue && null != itemIds && !itemIds.isEmpty()) {
|
if (null != typeNameValue && null != typeKeyValue && null != itemIds && !itemIds.isEmpty()) {
|
||||||
DistributionSetType newDistType = new DistributionSetType(typeKeyValue, typeNameValue, typeDescValue);
|
DistributionSetType newDistType = distributionSetManagement.generateDistributionSetType(typeKeyValue,
|
||||||
|
typeNameValue, typeDescValue);
|
||||||
for (final Long id : itemIds) {
|
for (final Long id : itemIds) {
|
||||||
final Item item = selectedTable.getItem(id);
|
final Item item = selectedTable.getItem(id);
|
||||||
final String distTypeName = (String) item.getItemProperty(DIST_TYPE_NAME).getValue();
|
final String distTypeName = (String) item.getItemProperty(DIST_TYPE_NAME).getValue();
|
||||||
@@ -704,7 +705,8 @@ public class CreateUpdateDistSetTypeLayout extends CustomComponent implements Co
|
|||||||
updateDistSetType.setKey(typeKeyValue);
|
updateDistSetType.setKey(typeKeyValue);
|
||||||
updateDistSetType.setDescription(null != typeDescValue ? typeDescValue : null);
|
updateDistSetType.setDescription(null != typeDescValue ? typeDescValue : null);
|
||||||
|
|
||||||
if (distributionSetRepository.countByType(existingType) <= 0 && null != itemIds && !itemIds.isEmpty()) {
|
if (distributionSetManagement.countDistributionSetsByType(existingType) <= 0 && null != itemIds
|
||||||
|
&& !itemIds.isEmpty()) {
|
||||||
for (final Long id : itemIds) {
|
for (final Long id : itemIds) {
|
||||||
final Item item = selectedTable.getItem(id);
|
final Item item = selectedTable.getItem(id);
|
||||||
final CheckBox mandatoryCheckBox = (CheckBox) item.getItemProperty(DIST_TYPE_MANDATORY).getValue();
|
final CheckBox mandatoryCheckBox = (CheckBox) item.getItemProperty(DIST_TYPE_MANDATORY).getValue();
|
||||||
@@ -1040,7 +1042,7 @@ public class CreateUpdateDistSetTypeLayout extends CustomComponent implements Co
|
|||||||
typeDesc.setValue(selectedTypeTag.getDescription());
|
typeDesc.setValue(selectedTypeTag.getDescription());
|
||||||
typeKey.setValue(selectedTypeTag.getKey());
|
typeKey.setValue(selectedTypeTag.getKey());
|
||||||
|
|
||||||
if (distributionSetRepository.countByType(selectedTypeTag) <= 0) {
|
if (distributionSetManagement.countDistributionSetsByType(selectedTypeTag) <= 0) {
|
||||||
distTypeSelectLayout.setEnabled(true);
|
distTypeSelectLayout.setEnabled(true);
|
||||||
selectedTable.setEnabled(true);
|
selectedTable.setEnabled(true);
|
||||||
saveDistSetType.setEnabled(true);
|
saveDistSetType.setEnabled(true);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import java.util.Map;
|
|||||||
import org.eclipse.hawkbit.repository.DistributionSetFilter;
|
import org.eclipse.hawkbit.repository.DistributionSetFilter;
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetFilter.DistributionSetFilterBuilder;
|
import org.eclipse.hawkbit.repository.DistributionSetFilter.DistributionSetFilterBuilder;
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||||
import org.eclipse.hawkbit.repository.jpa.OffsetBasedPageRequest;
|
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
||||||
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.ui.common.UserDetailsFormatter;
|
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
|
||||||
@@ -96,7 +96,7 @@ public class ManageDistBeanQuery extends AbstractBeanQuery<ProxyDistribution> {
|
|||||||
} else if (Strings.isNullOrEmpty(searchText)) {
|
} else if (Strings.isNullOrEmpty(searchText)) {
|
||||||
// if no search filters available
|
// if no search filters available
|
||||||
distBeans = getDistributionSetManagement()
|
distBeans = getDistributionSetManagement()
|
||||||
.findDistributionSetsAll(new OffsetBasedPageRequest(startIndex, count, sort), false, null);
|
.findDistributionSetsByDeletedAndOrCompleted(new OffsetBasedPageRequest(startIndex, count, sort), false, null);
|
||||||
} else {
|
} else {
|
||||||
final DistributionSetFilter distributionSetFilter = new DistributionSetFilterBuilder().setIsDeleted(false)
|
final DistributionSetFilter distributionSetFilter = new DistributionSetFilterBuilder().setIsDeleted(false)
|
||||||
.setSearchText(searchText).setSelectDSWithNoTag(Boolean.FALSE).setType(distributionSetType).build();
|
.setSearchText(searchText).setSelectDSWithNoTag(Boolean.FALSE).setType(distributionSetType).build();
|
||||||
@@ -133,7 +133,7 @@ public class ManageDistBeanQuery extends AbstractBeanQuery<ProxyDistribution> {
|
|||||||
if (Strings.isNullOrEmpty(searchText) && null == distributionSetType) {
|
if (Strings.isNullOrEmpty(searchText) && null == distributionSetType) {
|
||||||
// if no search filters available
|
// if no search filters available
|
||||||
firstPageDistributionSets = getDistributionSetManagement()
|
firstPageDistributionSets = getDistributionSetManagement()
|
||||||
.findDistributionSetsAll(new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), false, null);
|
.findDistributionSetsByDeletedAndOrCompleted(new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), false, null);
|
||||||
} else {
|
} else {
|
||||||
final DistributionSetFilter distributionSetFilter = new DistributionSetFilterBuilder().setIsDeleted(false)
|
final DistributionSetFilter distributionSetFilter = new DistributionSetFilterBuilder().setIsDeleted(false)
|
||||||
.setSearchText(searchText).setSelectDSWithNoTag(Boolean.FALSE).setType(distributionSetType).build();
|
.setSearchText(searchText).setSelectDSWithNoTag(Boolean.FALSE).setType(distributionSetType).build();
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
||||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||||
import org.eclipse.hawkbit.repository.jpa.OffsetBasedPageRequest;
|
|
||||||
import org.eclipse.hawkbit.repository.model.CustomSoftwareModule;
|
import org.eclipse.hawkbit.repository.model.CustomSoftwareModule;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||||
|
|||||||
@@ -503,7 +503,7 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void createTargetFilterQuery() {
|
private void createTargetFilterQuery() {
|
||||||
final TargetFilterQuery targetFilterQuery = new TargetFilterQuery();
|
final TargetFilterQuery targetFilterQuery = targetFilterQueryManagement.generateTargetFilterQuery();
|
||||||
targetFilterQuery.setName(nameTextField.getValue());
|
targetFilterQuery.setName(nameTextField.getValue());
|
||||||
targetFilterQuery.setQuery(queryTextField.getValue());
|
targetFilterQuery.setQuery(queryTextField.getValue());
|
||||||
targetFilterQueryManagement.createTargetFilterQuery(targetFilterQuery);
|
targetFilterQueryManagement.createTargetFilterQuery(targetFilterQuery);
|
||||||
|
|||||||
@@ -268,29 +268,29 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
|||||||
|
|
||||||
final Action action = actionWithStatusCount.getAction();
|
final Action action = actionWithStatusCount.getAction();
|
||||||
|
|
||||||
final Item item = hierarchicalContainer.addItem(actionWithStatusCount.getActionId());
|
final Item item = hierarchicalContainer.addItem(actionWithStatusCount.getAction().getId());
|
||||||
|
|
||||||
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_STATUS_HIDDEN)
|
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_STATUS_HIDDEN)
|
||||||
.setValue(actionWithStatusCount.getActionStatus());
|
.setValue(actionWithStatusCount.getAction().getStatus());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* add action id.
|
* add action id.
|
||||||
*/
|
*/
|
||||||
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ACTION_ID)
|
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ACTION_ID)
|
||||||
.setValue(actionWithStatusCount.getActionId().toString());
|
.setValue(actionWithStatusCount.getAction().getId().toString());
|
||||||
/*
|
/*
|
||||||
* add active/inactive status to the item which will be used in
|
* add active/inactive status to the item which will be used in
|
||||||
* Column generator to generate respective icon
|
* Column generator to generate respective icon
|
||||||
*/
|
*/
|
||||||
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ACTIVE_HIDDEN).setValue(
|
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ACTIVE_HIDDEN).setValue(
|
||||||
actionWithStatusCount.isActionActive() ? SPUIDefinitions.ACTIVE : SPUIDefinitions.IN_ACTIVE);
|
actionWithStatusCount.getAction().isActive() ? SPUIDefinitions.ACTIVE : SPUIDefinitions.IN_ACTIVE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* add action Id to the item which will be used for fetching child
|
* add action Id to the item which will be used for fetching child
|
||||||
* items ( previous action status ) during expand
|
* items ( previous action status ) during expand
|
||||||
*/
|
*/
|
||||||
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ACTION_ID_HIDDEN)
|
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ACTION_ID_HIDDEN)
|
||||||
.setValue(actionWithStatusCount.getActionId());
|
.setValue(actionWithStatusCount.getAction().getId());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* add distribution name to the item which will be displayed in the
|
* add distribution name to the item which will be displayed in the
|
||||||
@@ -301,7 +301,7 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
|||||||
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_FORCED).setValue(action);
|
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_FORCED).setValue(action);
|
||||||
|
|
||||||
/* Default no child */
|
/* Default no child */
|
||||||
((Hierarchical) hierarchicalContainer).setChildrenAllowed(actionWithStatusCount.getActionId(), false);
|
((Hierarchical) hierarchicalContainer).setChildrenAllowed(actionWithStatusCount.getAction().getId(), false);
|
||||||
|
|
||||||
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DATETIME)
|
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DATETIME)
|
||||||
.setValue(SPDateTimeUtil.getFormattedDate((actionWithStatusCount.getActionLastModifiedAt() != null)
|
.setValue(SPDateTimeUtil.getFormattedDate((actionWithStatusCount.getActionLastModifiedAt() != null)
|
||||||
@@ -312,7 +312,7 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
|||||||
.setValue(actionWithStatusCount.getRolloutName());
|
.setValue(actionWithStatusCount.getRolloutName());
|
||||||
|
|
||||||
if (actionWithStatusCount.getActionStatusCount() > 0) {
|
if (actionWithStatusCount.getActionStatusCount() > 0) {
|
||||||
((Hierarchical) hierarchicalContainer).setChildrenAllowed(actionWithStatusCount.getActionId(), true);
|
((Hierarchical) hierarchicalContainer).setChildrenAllowed(actionWithStatusCount.getAction().getId(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -422,8 +422,12 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
|||||||
.findActionWithDetails(actionId);
|
.findActionWithDetails(actionId);
|
||||||
final Pageable pageReq = new PageRequest(0, 1000,
|
final Pageable pageReq = new PageRequest(0, 1000,
|
||||||
new Sort(Direction.DESC, ActionStatusFields.ID.getFieldName()));
|
new Sort(Direction.DESC, ActionStatusFields.ID.getFieldName()));
|
||||||
final Page<ActionStatus> actionStatusList = deploymentManagement.findActionStatusByAction(pageReq, action,
|
final Page<ActionStatus> actionStatusList;
|
||||||
managementUIState.isActionHistoryMaximized());
|
if (managementUIState.isActionHistoryMaximized()) {
|
||||||
|
actionStatusList = deploymentManagement.findActionStatusByActionWithMessages(pageReq, action);
|
||||||
|
} else {
|
||||||
|
actionStatusList = deploymentManagement.findActionStatusByAction(pageReq, action);
|
||||||
|
}
|
||||||
final List<ActionStatus> content = actionStatusList.getContent();
|
final List<ActionStatus> content = actionStatusList.getContent();
|
||||||
/*
|
/*
|
||||||
* Since the recent action status and messages are already
|
* Since the recent action status and messages are already
|
||||||
|
|||||||
@@ -297,7 +297,7 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
|
|||||||
if (mandatoryCheck(name, version, distSetTypeName) && duplicateCheck(name, version)) {
|
if (mandatoryCheck(name, version, distSetTypeName) && duplicateCheck(name, version)) {
|
||||||
final String desc = HawkbitCommonUtil.trimAndNullIfEmpty(descTextArea.getValue());
|
final String desc = HawkbitCommonUtil.trimAndNullIfEmpty(descTextArea.getValue());
|
||||||
final boolean isMigStepReq = reqMigStepCheckbox.getValue();
|
final boolean isMigStepReq = reqMigStepCheckbox.getValue();
|
||||||
DistributionSet newDist = new DistributionSet();
|
DistributionSet newDist = distributionSetManagement.generateDistributionSet();
|
||||||
|
|
||||||
setDistributionValues(newDist, name, version, distSetTypeName, desc, isMigStepReq);
|
setDistributionValues(newDist, name, version, distSetTypeName, desc, isMigStepReq);
|
||||||
newDist = distributionSetManagement.createDistributionSet(newDist);
|
newDist = distributionSetManagement.createDistributionSet(newDist);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import java.util.Map;
|
|||||||
import org.eclipse.hawkbit.repository.DistributionSetFilter;
|
import org.eclipse.hawkbit.repository.DistributionSetFilter;
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetFilter.DistributionSetFilterBuilder;
|
import org.eclipse.hawkbit.repository.DistributionSetFilter.DistributionSetFilterBuilder;
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||||
import org.eclipse.hawkbit.repository.jpa.OffsetBasedPageRequest;
|
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
|
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
|
||||||
import org.eclipse.hawkbit.ui.components.ProxyDistribution;
|
import org.eclipse.hawkbit.ui.components.ProxyDistribution;
|
||||||
@@ -111,7 +111,7 @@ public class DistributionBeanQuery extends AbstractBeanQuery<ProxyDistribution>
|
|||||||
} else if (distributionTags.isEmpty() && Strings.isNullOrEmpty(searchText) && !noTagClicked) {
|
} else if (distributionTags.isEmpty() && Strings.isNullOrEmpty(searchText) && !noTagClicked) {
|
||||||
// if no search filters available
|
// if no search filters available
|
||||||
distBeans = getDistributionSetManagement()
|
distBeans = getDistributionSetManagement()
|
||||||
.findDistributionSetsAll(new OffsetBasedPageRequest(startIndex, count, sort), false, true);
|
.findDistributionSetsByDeletedAndOrCompleted(new OffsetBasedPageRequest(startIndex, count, sort), false, true);
|
||||||
} else {
|
} else {
|
||||||
final DistributionSetFilter distributionSetFilter = new DistributionSetFilterBuilder().setIsDeleted(false)
|
final DistributionSetFilter distributionSetFilter = new DistributionSetFilterBuilder().setIsDeleted(false)
|
||||||
.setIsComplete(true).setSearchText(searchText).setSelectDSWithNoTag(noTagClicked)
|
.setIsComplete(true).setSearchText(searchText).setSelectDSWithNoTag(noTagClicked)
|
||||||
@@ -153,7 +153,7 @@ public class DistributionBeanQuery extends AbstractBeanQuery<ProxyDistribution>
|
|||||||
} else if (distributionTags.isEmpty() && Strings.isNullOrEmpty(searchText) && !noTagClicked) {
|
} else if (distributionTags.isEmpty() && Strings.isNullOrEmpty(searchText) && !noTagClicked) {
|
||||||
// if no search filters available
|
// if no search filters available
|
||||||
firstPageDistributionSets = getDistributionSetManagement()
|
firstPageDistributionSets = getDistributionSetManagement()
|
||||||
.findDistributionSetsAll(new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), false, true);
|
.findDistributionSetsByDeletedAndOrCompleted(new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), false, true);
|
||||||
} else {
|
} else {
|
||||||
final DistributionSetFilter distributionSetFilter = new DistributionSetFilterBuilder().setIsDeleted(false)
|
final DistributionSetFilter distributionSetFilter = new DistributionSetFilterBuilder().setIsDeleted(false)
|
||||||
.setIsComplete(true).setSearchText(searchText).setSelectDSWithNoTag(noTagClicked)
|
.setIsComplete(true).setSearchText(searchText).setSelectDSWithNoTag(noTagClicked)
|
||||||
|
|||||||
@@ -98,14 +98,13 @@ public class CreateUpdateDistributionTagLayoutWindow extends CreateUpdateTagLayo
|
|||||||
final String tagDescValue = HawkbitCommonUtil.trimAndNullIfEmpty(tagDesc.getValue());
|
final String tagDescValue = HawkbitCommonUtil.trimAndNullIfEmpty(tagDesc.getValue());
|
||||||
|
|
||||||
if (null != tagNameValue) {
|
if (null != tagNameValue) {
|
||||||
DistributionSetTag newDistTag = new DistributionSetTag(tagNameValue);
|
DistributionSetTag newDistTag = tagManagement.generateDistributionSetTag(tagNameValue, tagDescValue,
|
||||||
if (null != tagDescValue) {
|
new Color(0, 146, 58).getCSS());
|
||||||
newDistTag.setDescription(tagDescValue);
|
|
||||||
}
|
|
||||||
newDistTag.setColour(new Color(0, 146, 58).getCSS());
|
|
||||||
if (colorPicked != null) {
|
if (colorPicked != null) {
|
||||||
newDistTag.setColour(colorPicked);
|
newDistTag.setColour(colorPicked);
|
||||||
}
|
}
|
||||||
|
|
||||||
newDistTag = tagManagement.createDistributionSetTag(newDistTag);
|
newDistTag = tagManagement.createDistributionSetTag(newDistTag);
|
||||||
uiNotification.displaySuccess(i18n.get("message.save.success", new Object[] { newDistTag.getName() }));
|
uiNotification.displaySuccess(i18n.get("message.save.success", new Object[] { newDistTag.getName() }));
|
||||||
resetDistTagValues();
|
resetDistTagValues();
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user