Javadoc, sonar issue, package cycles.

Signed-off-by: Kai Zimmermann <kai.zimmermann@bosch-si.com>
This commit is contained in:
Kai Zimmermann
2016-05-27 15:25:08 +02:00
parent e6ff96dc5a
commit 53156cb16f
89 changed files with 548 additions and 213 deletions

View File

@@ -17,6 +17,7 @@ import javax.servlet.http.HttpServletRequest;
import org.eclipse.hawkbit.artifact.repository.model.DbArtifact; import org.eclipse.hawkbit.artifact.repository.model.DbArtifact;
import org.eclipse.hawkbit.ddi.dl.rest.api.DdiDlArtifactStoreControllerRestApi; import org.eclipse.hawkbit.ddi.dl.rest.api.DdiDlArtifactStoreControllerRestApi;
import org.eclipse.hawkbit.repository.ArtifactManagement; import org.eclipse.hawkbit.repository.ArtifactManagement;
import org.eclipse.hawkbit.repository.Constants;
import org.eclipse.hawkbit.repository.ControllerManagement; import org.eclipse.hawkbit.repository.ControllerManagement;
import org.eclipse.hawkbit.repository.jpa.cache.CacheWriteNotify; import org.eclipse.hawkbit.repository.jpa.cache.CacheWriteNotify;
import org.eclipse.hawkbit.repository.model.Action; import org.eclipse.hawkbit.repository.model.Action;
@@ -144,11 +145,11 @@ public class DdiArtifactStoreController implements DdiDlArtifactStoreControllerR
actionStatus.setStatus(Status.DOWNLOAD); actionStatus.setStatus(Status.DOWNLOAD);
if (range != null) { if (range != null) {
actionStatus.addMessage(ControllerManagement.SERVER_MESSAGE_PREFIX + "Target downloads range " + range actionStatus.addMessage(Constants.SERVER_MESSAGE_PREFIX + "Target downloads range " + range
+ " of: " + request.getRequestURI()); + " of: " + request.getRequestURI());
} else { } else {
actionStatus.addMessage( actionStatus.addMessage(
ControllerManagement.SERVER_MESSAGE_PREFIX + "Target downloads: " + request.getRequestURI()); Constants.SERVER_MESSAGE_PREFIX + "Target downloads: " + request.getRequestURI());
} }
controllerManagement.addInformationalActionStatus(actionStatus); controllerManagement.addInformationalActionStatus(actionStatus);
return action; return action;

View File

@@ -29,6 +29,7 @@ import org.eclipse.hawkbit.ddi.json.model.DdiDeploymentBase;
import org.eclipse.hawkbit.ddi.json.model.DdiResult.FinalResult; import org.eclipse.hawkbit.ddi.json.model.DdiResult.FinalResult;
import org.eclipse.hawkbit.ddi.rest.api.DdiRootControllerRestApi; import org.eclipse.hawkbit.ddi.rest.api.DdiRootControllerRestApi;
import org.eclipse.hawkbit.repository.ArtifactManagement; import org.eclipse.hawkbit.repository.ArtifactManagement;
import org.eclipse.hawkbit.repository.Constants;
import org.eclipse.hawkbit.repository.ControllerManagement; import org.eclipse.hawkbit.repository.ControllerManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement; import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException; import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
@@ -180,11 +181,11 @@ public class DdiRootController implements DdiRootControllerRestApi {
statusMessage.setStatus(Status.DOWNLOAD); statusMessage.setStatus(Status.DOWNLOAD);
if (range != null) { if (range != null) {
statusMessage.addMessage(ControllerManagement.SERVER_MESSAGE_PREFIX + "Target downloads range " + range statusMessage.addMessage(Constants.SERVER_MESSAGE_PREFIX + "Target downloads range " + range
+ " of: " + request.getRequestURI()); + " of: " + request.getRequestURI());
} else { } else {
statusMessage.addMessage( statusMessage.addMessage(
ControllerManagement.SERVER_MESSAGE_PREFIX + "Target downloads " + request.getRequestURI()); Constants.SERVER_MESSAGE_PREFIX + "Target downloads " + request.getRequestURI());
} }
controllerManagement.addInformationalActionStatus(statusMessage); controllerManagement.addInformationalActionStatus(statusMessage);
return action; return action;
@@ -247,7 +248,7 @@ public class DdiRootController implements DdiRootControllerRestApi {
LOG.debug("Found an active UpdateAction for target {}. returning deyploment: {}", targetid, base); LOG.debug("Found an active UpdateAction for target {}. returning deyploment: {}", targetid, base);
controllerManagement.registerRetrieved(action, ControllerManagement.SERVER_MESSAGE_PREFIX controllerManagement.registerRetrieved(action, Constants.SERVER_MESSAGE_PREFIX
+ "Target retrieved update action and should start now the download."); + "Target retrieved update action and should start now the download.");
return new ResponseEntity<>(base, HttpStatus.OK); return new ResponseEntity<>(base, HttpStatus.OK);
@@ -302,13 +303,13 @@ public class DdiRootController implements DdiRootControllerRestApi {
LOG.debug("Controller confirmed cancel (actionid: {}, targetid: {}) as we got {} report.", actionid, LOG.debug("Controller confirmed cancel (actionid: {}, targetid: {}) as we got {} report.", actionid,
targetid, feedback.getStatus().getExecution()); targetid, feedback.getStatus().getExecution());
actionStatus.setStatus(Status.CANCELED); actionStatus.setStatus(Status.CANCELED);
actionStatus.addMessage(ControllerManagement.SERVER_MESSAGE_PREFIX + "Target confirmed cancelation."); actionStatus.addMessage(Constants.SERVER_MESSAGE_PREFIX + "Target confirmed cancelation.");
break; break;
case REJECTED: case REJECTED:
LOG.info("Controller reported internal error (actionid: {}, targetid: {}) as we got {} report.", actionid, LOG.info("Controller reported internal error (actionid: {}, targetid: {}) as we got {} report.", actionid,
targetid, feedback.getStatus().getExecution()); targetid, feedback.getStatus().getExecution());
actionStatus.setStatus(Status.WARNING); actionStatus.setStatus(Status.WARNING);
actionStatus.addMessage(ControllerManagement.SERVER_MESSAGE_PREFIX + "Target REJECTED update."); actionStatus.addMessage(Constants.SERVER_MESSAGE_PREFIX + "Target REJECTED update.");
break; break;
case CLOSED: case CLOSED:
handleClosedUpdateStatus(feedback, targetid, actionid, actionStatus); handleClosedUpdateStatus(feedback, targetid, actionid, actionStatus);
@@ -336,7 +337,7 @@ public class DdiRootController implements DdiRootControllerRestApi {
targetid, feedback.getStatus().getExecution()); targetid, feedback.getStatus().getExecution());
actionStatus.setStatus(Status.RUNNING); actionStatus.setStatus(Status.RUNNING);
actionStatus.addMessage( actionStatus.addMessage(
ControllerManagement.SERVER_MESSAGE_PREFIX + "Target reported " + feedback.getStatus().getExecution()); Constants.SERVER_MESSAGE_PREFIX + "Target reported " + feedback.getStatus().getExecution());
} }
private static void handleClosedUpdateStatus(final DdiActionFeedback feedback, final String targetid, private static void handleClosedUpdateStatus(final DdiActionFeedback feedback, final String targetid,
@@ -345,10 +346,10 @@ public class DdiRootController implements DdiRootControllerRestApi {
feedback.getStatus().getExecution()); feedback.getStatus().getExecution());
if (feedback.getStatus().getResult().getFinished() == FinalResult.FAILURE) { if (feedback.getStatus().getResult().getFinished() == FinalResult.FAILURE) {
actionStatus.setStatus(Status.ERROR); actionStatus.setStatus(Status.ERROR);
actionStatus.addMessage(ControllerManagement.SERVER_MESSAGE_PREFIX + "Target reported CLOSED with ERROR!"); actionStatus.addMessage(Constants.SERVER_MESSAGE_PREFIX + "Target reported CLOSED with ERROR!");
} else { } else {
actionStatus.setStatus(Status.FINISHED); actionStatus.setStatus(Status.FINISHED);
actionStatus.addMessage(ControllerManagement.SERVER_MESSAGE_PREFIX + "Target reported CLOSED with OK!"); actionStatus.addMessage(Constants.SERVER_MESSAGE_PREFIX + "Target reported CLOSED with OK!");
} }
} }
@@ -386,7 +387,7 @@ public class DdiRootController implements DdiRootControllerRestApi {
LOG.debug("Found an active CancelAction for target {}. returning cancel: {}", targetid, cancel); LOG.debug("Found an active CancelAction for target {}. returning cancel: {}", targetid, cancel);
controllerManagement.registerRetrieved(action, ControllerManagement.SERVER_MESSAGE_PREFIX controllerManagement.registerRetrieved(action, Constants.SERVER_MESSAGE_PREFIX
+ "Target retrieved cancel action and should start now the cancelation."); + "Target retrieved cancel action and should start now the cancelation.");
return new ResponseEntity<>(cancel, HttpStatus.OK); return new ResponseEntity<>(cancel, HttpStatus.OK);

View File

@@ -31,6 +31,7 @@ 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.Action.Status; import org.eclipse.hawkbit.repository.model.Action.Status;
import org.eclipse.hawkbit.repository.model.ActionStatus; import org.eclipse.hawkbit.repository.model.ActionStatus;
import org.eclipse.hawkbit.repository.model.Constants;
import org.eclipse.hawkbit.repository.model.DistributionSet; import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.LocalArtifact; import org.eclipse.hawkbit.repository.model.LocalArtifact;
import org.eclipse.hawkbit.repository.model.Target; import org.eclipse.hawkbit.repository.model.Target;
@@ -117,7 +118,7 @@ public class DdiDeploymentBaseTest extends AbstractRestIntegrationTestWithMongoD
assertThat(actionStatusRepository.findAll()).isEmpty(); assertThat(actionStatusRepository.findAll()).isEmpty();
List<Target> saved = deploymentManagement.assignDistributionSet(ds.getId(), ActionType.FORCED, List<Target> saved = deploymentManagement.assignDistributionSet(ds.getId(), ActionType.FORCED,
Action.NO_FORCE_TIME, savedTarget.getControllerId()).getAssignedEntity(); Constants.NO_FORCE_TIME, savedTarget.getControllerId()).getAssignedEntity();
assertThat(deploymentManagement.findActiveActionsByTarget(savedTarget)).hasSize(1); assertThat(deploymentManagement.findActiveActionsByTarget(savedTarget)).hasSize(1);
final Action action = deploymentManagement.findActiveActionsByTarget(savedTarget).get(0); final Action action = deploymentManagement.findActiveActionsByTarget(savedTarget).get(0);
@@ -256,7 +257,7 @@ public class DdiDeploymentBaseTest extends AbstractRestIntegrationTestWithMongoD
assertThat(actionStatusRepository.findAll()).isEmpty(); assertThat(actionStatusRepository.findAll()).isEmpty();
List<Target> saved = deploymentManagement List<Target> saved = deploymentManagement
.assignDistributionSet(ds.getId(), ActionType.SOFT, Action.NO_FORCE_TIME, savedTarget.getControllerId()) .assignDistributionSet(ds.getId(), ActionType.SOFT, Constants.NO_FORCE_TIME, savedTarget.getControllerId())
.getAssignedEntity(); .getAssignedEntity();
assertThat(deploymentManagement.findActiveActionsByTarget(savedTarget)).hasSize(1); assertThat(deploymentManagement.findActiveActionsByTarget(savedTarget)).hasSize(1);

View File

@@ -32,12 +32,12 @@ import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
import org.eclipse.hawkbit.repository.SoftwareManagement; import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SystemManagement; import org.eclipse.hawkbit.repository.SystemManagement;
import org.eclipse.hawkbit.repository.TargetManagement; import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.TargetWithActionType;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException; import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.model.DistributionSet; import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetMetadata; import org.eclipse.hawkbit.repository.model.DistributionSetMetadata;
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.TargetWithActionType;
import org.eclipse.hawkbit.tenancy.TenantAware; import org.eclipse.hawkbit.tenancy.TenantAware;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

View File

@@ -36,5 +36,10 @@
<groupId>org.springframework.hateoas</groupId> <groupId>org.springframework.hateoas</groupId>
<artifactId>spring-hateoas</artifactId> <artifactId>spring-hateoas</artifactId>
</dependency> </dependency>
</dependencies> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
</project> </project>

View File

@@ -0,0 +1,31 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.repository;
import org.eclipse.hawkbit.repository.model.ActionStatus;
import org.eclipse.hawkbit.repository.model.Target;
/**
* Repository constants.
*
*/
public final class Constants {
/**
* Prefix that the server puts in front of
* {@link ActionStatus#getMessages()} is the comments was generated by it
* and not be thy {@link Target}.
*/
public static final String SERVER_MESSAGE_PREFIX = "Update Server: ";
private Constants() {
// Utility class.
}
}

View File

@@ -12,6 +12,7 @@ import java.net.URI;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
@@ -40,8 +41,6 @@ import org.springframework.security.access.prepost.PreAuthorize;
*/ */
public interface ControllerManagement { public interface ControllerManagement {
String SERVER_MESSAGE_PREFIX = "Update Server: ";
/** /**
* Adds an {@link ActionStatus} for a cancel {@link Action} including * Adds an {@link ActionStatus} for a cancel {@link Action} including
* potential state changes for the target and the {@link Action} itself. * potential state changes for the target and the {@link Action} itself.
@@ -270,17 +269,60 @@ public interface ControllerManagement {
URI address); URI address);
/** /**
* Generates an empty {@link ActionStatus} without persisting it. * Generates an empty {@link ActionStatus} object without persisting it.
* *
* @return {@link ActionStatus} object * @return {@link ActionStatus} object
*/ */
ActionStatus generateActionStatus(); ActionStatus generateActionStatus();
/**
* Generates an {@link ActionStatus} object without persisting it.
*
* @param action
* the {@link ActionStatus} belongs to.
* @param status
* as reflected by this {@link ActionStatus}.
* @param occurredAt
* time in {@link TimeUnit#MILLISECONDS} GMT when the status
* change happened.
* @param message
* optional comment
*
* @return {@link ActionStatus} object
*/
ActionStatus generateActionStatus(Action action, Status status, Long occurredAt, final String message); ActionStatus generateActionStatus(Action action, Status status, Long occurredAt, final String message);
/**
* Generates an {@link ActionStatus} object without persisting it.
*
* @param action
* the {@link ActionStatus} belongs to.
* @param status
* as reflected by this {@link ActionStatus}.
* @param occurredAt
* time in {@link TimeUnit#MILLISECONDS} GMT when the status
* change happened.
* @param messages
* optional comments
*
* @return {@link ActionStatus} object
*/
ActionStatus generateActionStatus(Action action, final Status status, Long occurredAt, ActionStatus generateActionStatus(Action action, final Status status, Long occurredAt,
final Collection<String> messages); final Collection<String> messages);
/**
* Generates an {@link ActionStatus} object without persisting it.
*
* @param action
* the {@link ActionStatus} belongs to.
* @param status
* as reflected by this {@link ActionStatus}.
* @param occurredAt
* time in {@link TimeUnit#MILLISECONDS} GMT when the status
* change happened.
*
* @return {@link ActionStatus} object
*/
ActionStatus generateActionStatus(Action action, Status status, Long occurredAt); ActionStatus generateActionStatus(Action action, Status status, Long occurredAt);
} }

View File

@@ -16,8 +16,11 @@ import javax.validation.constraints.NotNull;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions; import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
import org.eclipse.hawkbit.repository.exception.CancelActionNotAllowedException; import org.eclipse.hawkbit.repository.exception.CancelActionNotAllowedException;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException; import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.exception.RSQLParameterSyntaxException;
import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException;
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.Action.Status;
import org.eclipse.hawkbit.repository.model.ActionStatus; import org.eclipse.hawkbit.repository.model.ActionStatus;
import org.eclipse.hawkbit.repository.model.ActionWithStatusCount; import org.eclipse.hawkbit.repository.model.ActionWithStatusCount;
import org.eclipse.hawkbit.repository.model.DistributionSet; import org.eclipse.hawkbit.repository.model.DistributionSet;
@@ -26,6 +29,7 @@ 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.SoftwareModuleType; import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.repository.model.Target; import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetWithActionType;
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;
@@ -147,17 +151,17 @@ public interface DeploymentManagement {
/** /**
* Cancels given {@link Action} for given {@link Target}. The method will * Cancels given {@link Action} for given {@link Target}. The method will
* immediately add a {@link ActionStatus.Status#CANCELED} status to the * immediately add a {@link Status#CANCELED} status to the action. However,
* action. However, it might be possible that the controller will continue * it might be possible that the controller will continue to work on the
* to work on the cancellation. * cancellation.
* *
* @param action * @param action
* to be canceled * to be canceled
* @param target * @param target
* for which the action needs cancellation * for which the action needs cancellation
* *
* @return generated {@link CancelAction} or <code>null</code> if not in * @return generated {@link Action} or <code>null</code> if not active on
* {@link Target#getActiveActions()}. * given {@link Target}.
* @throws CancelActionNotAllowedException * @throws CancelActionNotAllowedException
* in case the given action is not active or is already a cancel * in case the given action is not active or is already a cancel
* action * action
@@ -173,6 +177,12 @@ public interface DeploymentManagement {
* @param target * @param target
* the target associated to the actions to count * the target associated to the actions to count
* @return the count value of found actions associated to the target * @return the count value of found actions associated to the target
*
* @throws RSQLParameterUnsupportedFieldException
* if a field in the RSQL string is used but not provided by the
* given {@code fieldNameProvider}
* @throws RSQLParameterSyntaxException
* if the RSQL syntax is wrong
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Long countActionsByTarget(@NotNull String rsqlParam, @NotNull Target target); Long countActionsByTarget(@NotNull String rsqlParam, @NotNull Target target);
@@ -276,6 +286,12 @@ public interface DeploymentManagement {
* the page request * the page request
* @return a slice of actions assigned to the specific target and the * @return a slice of actions assigned to the specific target and the
* specification * specification
*
* @throws RSQLParameterUnsupportedFieldException
* if a field in the RSQL string is used but not provided by the
* given {@code fieldNameProvider}
* @throws RSQLParameterSyntaxException
* if the RSQL syntax is wrong
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Slice<Action> findActionsByTarget(@NotNull String rsqlParam, @NotNull Target target, @NotNull Pageable pageable); Slice<Action> findActionsByTarget(@NotNull String rsqlParam, @NotNull Target target, @NotNull Pageable pageable);
@@ -404,8 +420,8 @@ public interface DeploymentManagement {
* @param target * @param target
* for which the action needs cancellation * for which the action needs cancellation
* *
* @return generated {@link CancelAction} or <code>null</code> if not in * @return generated {@link Action} or <code>null</code> if not active on
* {@link Target#getActiveActions()}. * {@link Target}.
* @throws CancelActionNotAllowedException * @throws CancelActionNotAllowedException
* in case the given action is not active * in case the given action is not active
*/ */
@@ -413,14 +429,14 @@ public interface DeploymentManagement {
Action forceQuitAction(@NotNull Action action); Action forceQuitAction(@NotNull Action action);
/** /**
* Updates a {@link TargetAction} and forces the {@link TargetAction} if * Updates a {@link Action} and forces the {@link Action} if it's not
* it's not already forced. * already forced.
* *
* @param targetId * @param targetId
* the ID of the target * the ID of the target
* @param actionId * @param actionId
* the ID of the action * the ID of the action
* @return the updated or the found {@link TargetAction} * @return the updated or the found {@link Action}
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
Action forceTargetAction(@NotNull Long actionId); Action forceTargetAction(@NotNull Long actionId);
@@ -444,6 +460,13 @@ public interface DeploymentManagement {
*/ */
Action generateAction(); Action generateAction();
/**
* All {@link ActionStatus} entries in the repository.
*
* @param pageable
* the pagination parameter
* @return {@link Page} of {@link ActionStatus} entries
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Page<ActionStatus> findActionStatusAll(@NotNull Pageable pageable); Page<ActionStatus> findActionStatusAll(@NotNull Pageable pageable);
} }

View File

@@ -15,13 +15,15 @@ import java.util.Set;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions; import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
import org.eclipse.hawkbit.repository.DistributionSetFilter.DistributionSetFilterBuilder;
import org.eclipse.hawkbit.repository.exception.DistributionSetCreationFailedMissingMandatoryModuleException; import org.eclipse.hawkbit.repository.exception.DistributionSetCreationFailedMissingMandatoryModuleException;
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException; import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException; import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.exception.EntityReadOnlyException; import org.eclipse.hawkbit.repository.exception.EntityReadOnlyException;
import org.eclipse.hawkbit.repository.exception.RSQLParameterSyntaxException;
import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException;
import org.eclipse.hawkbit.repository.model.Action; import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.DistributionSet; import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetFilter;
import org.eclipse.hawkbit.repository.model.DistributionSetMetadata; import org.eclipse.hawkbit.repository.model.DistributionSetMetadata;
import org.eclipse.hawkbit.repository.model.DistributionSetTag; import org.eclipse.hawkbit.repository.model.DistributionSetTag;
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult; import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult;
@@ -30,6 +32,7 @@ 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.Tag; import org.eclipse.hawkbit.repository.model.Tag;
import org.eclipse.hawkbit.repository.model.Target; import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.DistributionSetFilter.DistributionSetFilterBuilder;
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;
@@ -292,6 +295,12 @@ public interface DistributionSetManagement {
* the page request to page the result * the page request to page the result
* @return a paged result of all meta data entries for a given distribution * @return a paged result of all meta data entries for a given distribution
* set id * set id
*
* @throws RSQLParameterUnsupportedFieldException
* if a field in the RSQL string is used but not provided by the
* given {@code fieldNameProvider}
* @throws RSQLParameterSyntaxException
* if the RSQL syntax is wrong
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Page<DistributionSetMetadata> findDistributionSetMetadataByDistributionSetId(@NotNull Long distributionSetId, Page<DistributionSetMetadata> findDistributionSetMetadataByDistributionSetId(@NotNull Long distributionSetId,
@@ -350,6 +359,12 @@ public interface DistributionSetManagement {
* {@link DistributionSet#isDeleted()} == FALSE are returned. * {@link DistributionSet#isDeleted()} == FALSE are returned.
* <code>null</code> if both are to be returned * <code>null</code> if both are to be returned
* @return all found {@link DistributionSet}s * @return all found {@link DistributionSet}s
*
* @throws RSQLParameterUnsupportedFieldException
* if a field in the RSQL string is used but not provided by the
* given {@code fieldNameProvider}
* @throws RSQLParameterSyntaxException
* if the RSQL syntax is wrong
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Page<DistributionSet> findDistributionSetsAll(@NotNull String rsqlParam, @NotNull Pageable pageReq, Page<DistributionSet> findDistributionSetsAll(@NotNull String rsqlParam, @NotNull Pageable pageReq,
@@ -435,6 +450,12 @@ public interface DistributionSetManagement {
* parameter for paging * parameter for paging
* *
* @return the found {@link SoftwareModuleType}s * @return the found {@link SoftwareModuleType}s
*
* @throws RSQLParameterUnsupportedFieldException
* if a field in the RSQL string is used but not provided by the
* given {@code fieldNameProvider}
* @throws RSQLParameterSyntaxException
* if the RSQL syntax is wrong
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Page<DistributionSetType> findDistributionSetTypesAll(@NotNull String rsqlParam, @NotNull Pageable pageable); Page<DistributionSetType> findDistributionSetTypesAll(@NotNull String rsqlParam, @NotNull Pageable pageable);

View File

@@ -18,6 +18,7 @@ import java.util.List;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions; import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
import org.eclipse.hawkbit.repository.model.TargetInfo;
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus; import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
import org.eclipse.hawkbit.repository.report.model.DataReportSeries; import org.eclipse.hawkbit.repository.report.model.DataReportSeries;
import org.eclipse.hawkbit.repository.report.model.InnerOuterDataReportSeries; import org.eclipse.hawkbit.repository.report.model.InnerOuterDataReportSeries;
@@ -182,7 +183,7 @@ public interface ReportManagement {
/** /**
* Generates a report as a {@link ListReportSeries} targets polled based on * Generates a report as a {@link ListReportSeries} targets polled based on
* the {@link TargetStatus#getLastTargetQuery()} within an hour, day, week, * the {@link TargetInfo#getLastTargetQuery()} within an hour, day, week,
* month, year, more than a year, never. * month, year, more than a year, never.
* *
* The order of the numbers within the {@link DataReportSeries} is the order * The order of the numbers within the {@link DataReportSeries} is the order

View File

@@ -11,6 +11,8 @@ package org.eclipse.hawkbit.repository;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions; import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
import org.eclipse.hawkbit.repository.exception.RSQLParameterSyntaxException;
import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException;
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.Target; import org.eclipse.hawkbit.repository.model.Target;
@@ -70,16 +72,22 @@ public interface RolloutGroupManagement {
/** /**
* Retrieves a page of {@link RolloutGroup}s filtered by a given * Retrieves a page of {@link RolloutGroup}s filtered by a given
* {@link Rollout} and the given {@link Specification}. * {@link Rollout} and the an rsql filter.
* *
* @param rolloutId * @param rollout
* the ID of the rollout to filter the {@link RolloutGroup}s * the rollout to filter the {@link RolloutGroup}s
* @param specification * @param rsqlParam
* 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 pageable * @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
*
* @throws RSQLParameterUnsupportedFieldException
* if a field in the RSQL string is used but not provided by the
* given {@code fieldNameProvider}
* @throws RSQLParameterSyntaxException
* if the RSQL syntax is wrong
*/ */
@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,
@@ -116,12 +124,18 @@ public interface RolloutGroupManagement {
* *
* @param rolloutGroup * @param rolloutGroup
* rollout group * rollout group
* @param specification * @param rsqlParam
* the specification for filtering the targets of a rollout group * the specification for filtering the targets of a rollout group
* @param pageable * @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
*
* @throws RSQLParameterUnsupportedFieldException
* if a field in the RSQL string is used but not provided by the
* given {@code fieldNameProvider}
* @throws RSQLParameterSyntaxException
* if the RSQL syntax is wrong
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ_AND_TARGET_READ) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ_AND_TARGET_READ)
Page<Target> findRolloutGroupTargets(@NotNull RolloutGroup rolloutGroup, @NotNull String rsqlParam, Page<Target> findRolloutGroupTargets(@NotNull RolloutGroup rolloutGroup, @NotNull String rsqlParam,

View File

@@ -12,6 +12,8 @@ import javax.validation.constraints.NotNull;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions; import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
import org.eclipse.hawkbit.repository.eventbus.event.RolloutGroupCreatedEvent; import org.eclipse.hawkbit.repository.eventbus.event.RolloutGroupCreatedEvent;
import org.eclipse.hawkbit.repository.exception.RSQLParameterSyntaxException;
import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException;
import org.eclipse.hawkbit.repository.exception.RolloutIllegalStateException; import org.eclipse.hawkbit.repository.exception.RolloutIllegalStateException;
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.Rollout.RolloutStatus;
@@ -171,11 +173,17 @@ public interface RolloutManagement {
/** /**
* Retrieves all rollouts found by the given specification. * Retrieves all rollouts found by the given specification.
* *
* @param specification * @param rsqlParam
* the specification to filter rollouts * the specification to filter rollouts
* @param pageable * @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
*
* @throws RSQLParameterUnsupportedFieldException
* if a field in the RSQL string is used but not provided by the
* given {@code fieldNameProvider}
* @throws RSQLParameterSyntaxException
* if the RSQL syntax is wrong
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
Page<Rollout> findAllWithDetailedStatusByPredicate(@NotNull String rsqlParam, @NotNull Pageable pageable); Page<Rollout> findAllWithDetailedStatusByPredicate(@NotNull String rsqlParam, @NotNull Pageable pageable);

View File

@@ -16,6 +16,8 @@ import javax.validation.constraints.NotNull;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions; import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException; import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException; import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.exception.RSQLParameterSyntaxException;
import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException;
import org.eclipse.hawkbit.repository.model.AssignedSoftwareModule; import org.eclipse.hawkbit.repository.model.AssignedSoftwareModule;
import org.eclipse.hawkbit.repository.model.DistributionSet; import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.SoftwareModule; import org.eclipse.hawkbit.repository.model.SoftwareModule;
@@ -284,6 +286,12 @@ public interface SoftwareManagement {
* the page request to page the result * the page request to page the result
* @return a paged result of all meta data entries for a given software * @return a paged result of all meta data entries for a given software
* module id * module id
*
* @throws RSQLParameterUnsupportedFieldException
* if a field in the RSQL string is used but not provided by the
* given {@code fieldNameProvider}
* @throws RSQLParameterSyntaxException
* if the RSQL syntax is wrong
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Page<SoftwareModuleMetadata> findSoftwareModuleMetadataBySoftwareModuleId(@NotNull Long softwareModuleId, Page<SoftwareModuleMetadata> findSoftwareModuleMetadataBySoftwareModuleId(@NotNull Long softwareModuleId,
@@ -342,6 +350,12 @@ public interface SoftwareManagement {
* @param pageable * @param pageable
* pagination parameter * pagination parameter
* @return the found {@link SoftwareModule}s * @return the found {@link SoftwareModule}s
*
* @throws RSQLParameterUnsupportedFieldException
* if a field in the RSQL string is used but not provided by the
* given {@code fieldNameProvider}
* @throws RSQLParameterSyntaxException
* if the RSQL syntax is wrong
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Page<SoftwareModule> findSoftwareModulesByPredicate(@NotNull String rsqlParam, @NotNull Pageable pageable); Page<SoftwareModule> findSoftwareModulesByPredicate(@NotNull String rsqlParam, @NotNull Pageable pageable);
@@ -405,6 +419,12 @@ public interface SoftwareManagement {
* @param pageable * @param pageable
* pagination parameter * pagination parameter
* @return the found {@link SoftwareModuleType}s * @return the found {@link SoftwareModuleType}s
*
* @throws RSQLParameterUnsupportedFieldException
* if a field in the RSQL string is used but not provided by the
* given {@code fieldNameProvider}
* @throws RSQLParameterSyntaxException
* if the RSQL syntax is wrong
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Page<SoftwareModuleType> findSoftwareModuleTypesAll(@NotNull String rsqlParam, @NotNull Pageable pageable); Page<SoftwareModuleType> findSoftwareModuleTypesAll(@NotNull String rsqlParam, @NotNull Pageable pageable);

View File

@@ -15,6 +15,8 @@ import javax.validation.constraints.NotNull;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions; import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException; import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
import org.eclipse.hawkbit.repository.exception.RSQLParameterSyntaxException;
import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException;
import org.eclipse.hawkbit.repository.model.DistributionSet; import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetTag; import org.eclipse.hawkbit.repository.model.DistributionSetTag;
import org.eclipse.hawkbit.repository.model.Tag; import org.eclipse.hawkbit.repository.model.Tag;
@@ -135,6 +137,12 @@ public interface TagManagement {
* @param pageable * @param pageable
* pagination parameter * pagination parameter
* @return the found {@link DistributionSetTag}s, never {@code null} * @return the found {@link DistributionSetTag}s, never {@code null}
*
* @throws RSQLParameterUnsupportedFieldException
* if a field in the RSQL string is used but not provided by the
* given {@code fieldNameProvider}
* @throws RSQLParameterSyntaxException
* if the RSQL syntax is wrong
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Page<DistributionSetTag> findAllDistributionSetTags(@NotNull String rsqlParam, @NotNull Pageable pageable); Page<DistributionSetTag> findAllDistributionSetTags(@NotNull String rsqlParam, @NotNull Pageable pageable);
@@ -164,6 +172,12 @@ public interface TagManagement {
* @param pageable * @param pageable
* pagination parameter * pagination parameter
* @return the found {@link Target}s, never {@code null} * @return the found {@link Target}s, never {@code null}
*
* @throws RSQLParameterUnsupportedFieldException
* if a field in the RSQL string is used but not provided by the
* given {@code fieldNameProvider}
* @throws RSQLParameterSyntaxException
* if the RSQL syntax is wrong
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Page<TargetTag> findAllTargetTags(@NotNull String rsqlParam, @NotNull Pageable pageable); Page<TargetTag> findAllTargetTags(@NotNull String rsqlParam, @NotNull Pageable pageable);

View File

@@ -16,6 +16,8 @@ import javax.validation.constraints.NotNull;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions; import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException; import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
import org.eclipse.hawkbit.repository.exception.RSQLParameterSyntaxException;
import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException;
import org.eclipse.hawkbit.repository.model.DistributionSet; import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.Tag; import org.eclipse.hawkbit.repository.model.Tag;
import org.eclipse.hawkbit.repository.model.Target; import org.eclipse.hawkbit.repository.model.Target;
@@ -281,11 +283,17 @@ public interface TargetManagement {
* *
* @param distributionSetID * @param distributionSetID
* the ID of the {@link DistributionSet} * the ID of the {@link DistributionSet}
* @param spec * @param rsqlParam
* the specification to filter the result set * the specification to filter the result set
* @param pageReq * @param pageReq
* page parameter * page parameter
* @return the found {@link Target}s, never {@code null} * @return the found {@link Target}s, never {@code null}
* @throws RSQLParameterUnsupportedFieldException
* if a field in the RSQL string is used but not provided by the
* given {@code fieldNameProvider}
* @throws RSQLParameterSyntaxException
* if the RSQL syntax is wrong
*
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_READ_TARGET)
Page<Target> findTargetByAssignedDistributionSet(@NotNull Long distributionSetID, @NotNull String rsqlParam, Page<Target> findTargetByAssignedDistributionSet(@NotNull Long distributionSetID, @NotNull String rsqlParam,
@@ -381,11 +389,17 @@ public interface TargetManagement {
* *
* @param distributionSetId * @param distributionSetId
* the ID of the {@link DistributionSet} * the ID of the {@link DistributionSet}
* @param spec * @param rsqlParam
* the specification to filter the result * the specification to filter the result
* @param pageable * @param pageable
* page parameter * page parameter
* @return the found {@link Target}s, never {@code null} * @return the found {@link Target}s, never {@code null}
*
* @throws RSQLParameterUnsupportedFieldException
* if a field in the RSQL string is used but not provided by the
* given {@code fieldNameProvider}
* @throws RSQLParameterSyntaxException
* if the RSQL syntax is wrong
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_READ_TARGET)
Page<Target> findTargetByInstalledDistributionSet(@NotNull Long distributionSetId, @NotNull String rsqlParam, Page<Target> findTargetByInstalledDistributionSet(@NotNull Long distributionSetId, @NotNull String rsqlParam,
@@ -531,7 +545,7 @@ public interface TargetManagement {
TargetTagAssignmentResult toggleTagAssignment(@NotEmpty Collection<String> targetIds, @NotEmpty String tagName); TargetTagAssignmentResult toggleTagAssignment(@NotEmpty Collection<String> targetIds, @NotEmpty String tagName);
/** /**
* {@link Entity} based method call for * {@link Target} based method call for
* {@link #toggleTagAssignment(Collection, String)}. * {@link #toggleTagAssignment(Collection, String)}.
* *
* @param targets * @param targets

View File

@@ -19,12 +19,6 @@ import java.util.concurrent.TimeUnit;
*/ */
public interface Action extends TenantAwareBaseEntity { public interface Action extends TenantAwareBaseEntity {
/**
* indicating that target action has no force time which is only needed in
* case of {@link ActionType#TIMEFORCED}.
*/
long NO_FORCE_TIME = 0L;
/** /**
* @return the distributionSet * @return the distributionSet
*/ */

View File

@@ -12,6 +12,9 @@ import java.util.List;
/** /**
* Generic assignment result bean. * Generic assignment result bean.
*
* @param <T>
* type of the assigned and unassigned {@link BaseEntity}s.
* *
*/ */
public class AssignmentResult<T extends BaseEntity> { public class AssignmentResult<T extends BaseEntity> {

View File

@@ -0,0 +1,27 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.repository.model;
/**
* Repository model constants.
*
*/
public final class Constants {
/**
* indicating that target action has no force time which is only needed in
* case of {@link Action.ActionType#TIMEFORCED}.
*/
public static final Long NO_FORCE_TIME = 0L;
private Constants() {
// Utility class.
}
}

View File

@@ -84,11 +84,6 @@ public interface DistributionSet extends NamedVersionedEntity {
*/ */
Set<SoftwareModule> getModules(); Set<SoftwareModule> getModules();
/**
* @return {@link DistributionSetIdName} view.
*/
DistributionSetIdName getDistributionSetIdName();
/** /**
* @param softwareModule * @param softwareModule
* @return <code>true</code> if the module was added and <code>false</code> * @return <code>true</code> if the module was added and <code>false</code>

View File

@@ -6,12 +6,10 @@
* 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; package org.eclipse.hawkbit.repository.model;
import java.util.Collection; import java.util.Collection;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
/** /**
* Holds distribution set filter parameters. * Holds distribution set filter parameters.
*/ */

View File

@@ -47,51 +47,59 @@ public interface DistributionSetType extends NamedEntity {
* search for * search for
* @return <code>true</code> if found * @return <code>true</code> if found
*/ */
boolean containsModuleType(SoftwareModuleType softwareModuleType); default boolean containsModuleType(final SoftwareModuleType softwareModuleType) {
return containsMandatoryModuleType(softwareModuleType) || containsOptionalModuleType(softwareModuleType);
}
/** /**
* Checks if the given {@link SoftwareModuleType} is in this * Checks if the given {@link SoftwareModuleType} is in
* {@link DistributionSetType} and defined as * {@link #getMandatoryModuleTypes()}.
* {@link DistributionSetTypeElement#isMandatory()}.
* *
* @param softwareModuleType * @param softwareModuleType
* search for * search for
* @return <code>true</code> if found * @return <code>true</code> if found
*/ */
boolean containsMandatoryModuleType(SoftwareModuleType softwareModuleType); default boolean containsMandatoryModuleType(final SoftwareModuleType softwareModuleType) {
return containsMandatoryModuleType(softwareModuleType.getId());
}
/** /**
* Checks if the given {@link SoftwareModuleType} is in this * Checks if the given {@link SoftwareModuleType} is in
* {@link DistributionSetType} and defined as * {@link #getMandatoryModuleTypes()}.
* {@link DistributionSetTypeElement#isMandatory()}.
* *
* @param softwareModuleTypeId * @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
*/ */
boolean containsMandatoryModuleType(Long softwareModuleTypeId); default boolean containsMandatoryModuleType(final Long softwareModuleTypeId) {
return getMandatoryModuleTypes().stream().filter(element -> element.getId().equals(softwareModuleTypeId))
.findFirst().isPresent();
}
/** /**
* Checks if the given {@link SoftwareModuleType} is in this * Checks if the given {@link SoftwareModuleType} is in
* {@link DistributionSetType} and NOT defined as * {@link #getOptionalModuleTypes()}.
* {@link DistributionSetTypeElement#isMandatory()}.
* *
* @param softwareModuleType * @param softwareModuleType
* search for * search for
* @return <code>true</code> if found * @return <code>true</code> if found
*/ */
boolean containsOptionalModuleType(SoftwareModuleType softwareModuleType); default boolean containsOptionalModuleType(final SoftwareModuleType softwareModuleType) {
return containsOptionalModuleType(softwareModuleType.getId());
}
/** /**
* Checks if the given {@link SoftwareModuleType} is in this * Checks if the given {@link SoftwareModuleType} is in
* {@link DistributionSetType} and NOT defined as * {@link #getOptionalModuleTypes()}.
* {@link DistributionSetTypeElement#isMandatory()}.
* *
* @param softwareModuleTypeId * @param softwareModuleTypeId
* search by {@link SoftwareModuleType#getId()} * search by {@link SoftwareModuleType#getId()}
* @return <code>true</code> if found * @return <code>true</code> if found
*/ */
boolean containsOptionalModuleType(Long softwareModuleTypeId); default boolean containsOptionalModuleType(final Long softwareModuleTypeId) {
return getOptionalModuleTypes().stream().filter(element -> element.getId().equals(softwareModuleTypeId))
.findFirst().isPresent();
}
/** /**
* Compares the modules of this {@link DistributionSetType} and the given * Compares the modules of this {@link DistributionSetType} and the given

View File

@@ -8,10 +8,21 @@
*/ */
package org.eclipse.hawkbit.repository.model; package org.eclipse.hawkbit.repository.model;
/**
* {@link MetaData} element of a {@link SoftwareModule}.
*
*/
public interface SoftwareModuleMetadata extends MetaData { public interface SoftwareModuleMetadata extends MetaData {
/**
* @return {@link SoftwareModule} this entry belongs to.
*/
SoftwareModule getSoftwareModule(); SoftwareModule getSoftwareModule();
/**
* @param softwareModule
* this entry belongs to.
*/
void setSoftwareModule(SoftwareModule softwareModule); void setSoftwareModule(SoftwareModule softwareModule);
} }

View File

@@ -8,10 +8,20 @@
*/ */
package org.eclipse.hawkbit.repository.model; package org.eclipse.hawkbit.repository.model;
/**
* {@link Tag} entry.
*
*/
public interface Tag extends NamedEntity { public interface Tag extends NamedEntity {
/**
* @return colour code of the tag used in Management UI.
*/
String getColour(); String getColour();
/**
* @param colour
*/
void setColour(String colour); void setColour(String colour);
} }

View File

@@ -8,14 +8,52 @@
*/ */
package org.eclipse.hawkbit.repository.model; package org.eclipse.hawkbit.repository.model;
/**
* Managed filter entity.
*
* Supported operators.
* <ul>
* <li>Equal to : ==</li>
* <li>Not equal to : !=</li>
* <li>Less than : =lt= or <</li>
* <li>Less than or equal to : =le= or <=</li>
* <li>Greater than operator : =gt= or ></li>
* <li>Greater than or equal to : =ge= or >=</li>
* </ul>
* Examples of RSQL expressions in both FIQL-like and alternative notation:
* <ul>
* <li>version==2.0.0</li>
* <li>name==targetId1;description==plugAndPlay</li>
* <li>name==targetId1 and description==plugAndPlay</li>
* <li>name==targetId1;description==plugAndPlay</li>
* <li>name==targetId1 and description==plugAndPlay</li>
* <li>name==targetId1,description==plugAndPlay,updateStatus==UNKNOWN</li>
* <li>name==targetId1 or description==plugAndPlay or updateStatus==UNKNOWN</li>
* </ul>
*
*/
public interface TargetFilterQuery extends TenantAwareBaseEntity { public interface TargetFilterQuery extends TenantAwareBaseEntity {
/**
* @return name of the {@link TargetFilterQuery}.
*/
String getName(); String getName();
/**
* @param name
* of the {@link TargetFilterQuery}.
*/
void setName(String name); void setName(String name);
/**
* @return RSQL query
*/
String getQuery(); String getQuery();
/**
* @param query
* in RSQL notation.
*/
void setQuery(String query); void setQuery(String query);
} }

View File

@@ -10,27 +10,48 @@ package org.eclipse.hawkbit.repository.model;
import java.io.Serializable; import java.io.Serializable;
import java.net.URI; import java.net.URI;
import java.text.AttributedCharacterIterator;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit;
public interface TargetInfo extends Serializable { public interface TargetInfo extends Serializable {
Long getId();
/** /**
* @return the ipAddress * @return the address under whioch the target can be reached
*/ */
URI getAddress(); URI getAddress();
/**
* @return {@link Target} this info element belongs to.
*/
Target getTarget(); Target getTarget();
/**
* @return time in {@link TimeUnit#MILLISECONDS} GMT when the {@link Target}
* polled the server the last time.
*/
Long getLastTargetQuery(); Long getLastTargetQuery();
/**
* @return {@link AttributedCharacterIterator} that have been provided by
* the {@link Target} itself, e.g. hardware revision, serial number,
* mac address etc.
*/
Map<String, String> getControllerAttributes(); Map<String, String> getControllerAttributes();
/**
* @return time in {@link TimeUnit#MILLISECONDS} GMT when
* {@link #getInstalledDistributionSet()} was applied.
*/
Long getInstallationDate(); Long getInstallationDate();
/**
* @return current status of the {@link Target}.
*/
TargetUpdateStatus getUpdateStatus(); TargetUpdateStatus getUpdateStatus();
/**
* @return currently installed {@link DistributionSet}.
*/
DistributionSet getInstalledDistributionSet(); DistributionSet getInstalledDistributionSet();
/** /**
@@ -41,6 +62,10 @@ public interface TargetInfo extends Serializable {
*/ */
PollStatus getPollStatus(); PollStatus getPollStatus();
/**
* @return <code>true</code> if the {@link Target} has not jet provided
* {@link #getControllerAttributes()}.
*/
boolean isRequestControllerAttributes(); boolean isRequestControllerAttributes();
} }

View File

@@ -10,8 +10,15 @@ package org.eclipse.hawkbit.repository.model;
import java.util.List; import java.util.List;
/**
* Target tag element.
*
*/
public interface TargetTag extends Tag { public interface TargetTag extends Tag {
/**
* @return {@link List} of targets assigned to this {@link Tag}.
*/
List<Target> getAssignedToTargets(); List<Target> getAssignedToTargets();
} }

View File

@@ -6,11 +6,9 @@
* 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; package org.eclipse.hawkbit.repository.model;
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.Target;
/** /**
* A custom view on {@link Target} with {@link ActionType}. * A custom view on {@link Target} with {@link ActionType}.
@@ -53,7 +51,7 @@ public class TargetWithActionType {
if (actionType == ActionType.TIMEFORCED) { if (actionType == ActionType.TIMEFORCED) {
return forceTime; return forceTime;
} }
return Action.NO_FORCE_TIME; return Constants.NO_FORCE_TIME;
} }
/** /**

View File

@@ -8,14 +8,33 @@
*/ */
package org.eclipse.hawkbit.repository.model; package org.eclipse.hawkbit.repository.model;
/**
* Unstructured tenant configuration elements. Can be used to store arbitrary
* tenant configuration elements.
*
*/
public interface TenantConfiguration extends TenantAwareBaseEntity { public interface TenantConfiguration extends TenantAwareBaseEntity {
/**
* @return key of the entry
*/
String getKey(); String getKey();
/**
* @param key
* of the entry
*/
void setKey(String key); void setKey(String key);
/**
* @return value of the entry
*/
String getValue(); String getValue();
/**
* @param value
* of the entry
*/
void setValue(String value); void setValue(String value);
} }

View File

@@ -20,6 +20,7 @@ import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root; import javax.persistence.criteria.Root;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import org.eclipse.hawkbit.repository.Constants;
import org.eclipse.hawkbit.repository.ControllerManagement; import org.eclipse.hawkbit.repository.ControllerManagement;
import org.eclipse.hawkbit.repository.TargetManagement; import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.TenantConfigurationManagement; import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
@@ -214,17 +215,13 @@ public class JpaControllerManagement implements ControllerManagement {
break; break;
case CANCELED: case CANCELED:
case FINISHED: case FINISHED:
// in case of successful cancellation we also report the success at handleFinishedCancelation(actionStatus, action);
// the canceled action itself.
actionStatus.addMessage(
ControllerManagement.SERVER_MESSAGE_PREFIX + "Cancellation completion is finished sucessfully.");
DeploymentHelper.successCancellation(action, actionRepository, targetManagement, targetInfoRepository,
entityManager);
break; break;
case RETRIEVED: case RETRIEVED:
actionStatus.addMessage(ControllerManagement.SERVER_MESSAGE_PREFIX + "Cancellation request retrieved."); actionStatus.addMessage(Constants.SERVER_MESSAGE_PREFIX + "Cancellation request retrieved.");
break; break;
default: default:
// do nothing
} }
actionRepository.save(action); actionRepository.save(action);
actionStatusRepository.save((JpaActionStatus) actionStatus); actionStatusRepository.save((JpaActionStatus) actionStatus);
@@ -232,6 +229,14 @@ public class JpaControllerManagement implements ControllerManagement {
return action; return action;
} }
private void handleFinishedCancelation(final ActionStatus actionStatus, final JpaAction action) {
// in case of successful cancellation we also report the success at
// the canceled action itself.
actionStatus.addMessage(Constants.SERVER_MESSAGE_PREFIX + "Cancellation completion is finished sucessfully.");
DeploymentHelper.successCancellation(action, actionRepository, targetManagement, targetInfoRepository,
entityManager);
}
@Override @Override
@Modifying @Modifying
@Transactional(isolation = Isolation.READ_UNCOMMITTED) @Transactional(isolation = Isolation.READ_UNCOMMITTED)

View File

@@ -33,7 +33,6 @@ import org.eclipse.hawkbit.repository.ActionFields;
import org.eclipse.hawkbit.repository.DeploymentManagement; import org.eclipse.hawkbit.repository.DeploymentManagement;
import org.eclipse.hawkbit.repository.DistributionSetAssignmentResult; import org.eclipse.hawkbit.repository.DistributionSetAssignmentResult;
import org.eclipse.hawkbit.repository.TargetManagement; import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.TargetWithActionType;
import org.eclipse.hawkbit.repository.eventbus.event.TargetAssignDistributionSetEvent; import org.eclipse.hawkbit.repository.eventbus.event.TargetAssignDistributionSetEvent;
import org.eclipse.hawkbit.repository.eventbus.event.TargetInfoUpdateEvent; import org.eclipse.hawkbit.repository.eventbus.event.TargetInfoUpdateEvent;
import org.eclipse.hawkbit.repository.exception.CancelActionNotAllowedException; import org.eclipse.hawkbit.repository.exception.CancelActionNotAllowedException;
@@ -69,6 +68,7 @@ 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;
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus; import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
import org.eclipse.hawkbit.repository.model.TargetWithActionType;
import org.eclipse.hawkbit.security.SystemSecurityContext; import org.eclipse.hawkbit.security.SystemSecurityContext;
import org.hibernate.validator.constraints.NotEmpty; import org.hibernate.validator.constraints.NotEmpty;
import org.slf4j.Logger; import org.slf4j.Logger;
@@ -146,7 +146,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
return assignDistributionSetByTargetId((JpaDistributionSet) pset, return assignDistributionSetByTargetId((JpaDistributionSet) pset,
targets.stream().map(target -> target.getControllerId()).collect(Collectors.toList()), targets.stream().map(target -> target.getControllerId()).collect(Collectors.toList()),
ActionType.FORCED, Action.NO_FORCE_TIME); ActionType.FORCED, org.eclipse.hawkbit.repository.model.Constants.NO_FORCE_TIME);
} }
@@ -155,7 +155,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
@Transactional(isolation = Isolation.READ_COMMITTED) @Transactional(isolation = Isolation.READ_COMMITTED)
@CacheEvict(value = { "distributionUsageAssigned" }, allEntries = true) @CacheEvict(value = { "distributionUsageAssigned" }, allEntries = true)
public DistributionSetAssignmentResult assignDistributionSet(final Long dsID, final String... targetIDs) { public DistributionSetAssignmentResult assignDistributionSet(final Long dsID, final String... targetIDs) {
return assignDistributionSet(dsID, ActionType.FORCED, Action.NO_FORCE_TIME, targetIDs); return assignDistributionSet(dsID, ActionType.FORCED, org.eclipse.hawkbit.repository.model.Constants.NO_FORCE_TIME, targetIDs);
} }
@Override @Override

View File

@@ -23,8 +23,6 @@ import java.util.stream.Collectors;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import org.eclipse.hawkbit.repository.DistributionSetFields; import org.eclipse.hawkbit.repository.DistributionSetFields;
import org.eclipse.hawkbit.repository.DistributionSetFilter;
import org.eclipse.hawkbit.repository.DistributionSetFilter.DistributionSetFilterBuilder;
import org.eclipse.hawkbit.repository.DistributionSetManagement; import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetMetadataFields; import org.eclipse.hawkbit.repository.DistributionSetMetadataFields;
import org.eclipse.hawkbit.repository.DistributionSetTypeFields; import org.eclipse.hawkbit.repository.DistributionSetTypeFields;
@@ -49,6 +47,8 @@ import org.eclipse.hawkbit.repository.jpa.specifications.DistributionSetTypeSpec
import org.eclipse.hawkbit.repository.jpa.specifications.SpecificationsBuilder; import org.eclipse.hawkbit.repository.jpa.specifications.SpecificationsBuilder;
import org.eclipse.hawkbit.repository.model.Action; import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.DistributionSet; import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetFilter;
import org.eclipse.hawkbit.repository.model.DistributionSetFilter.DistributionSetFilterBuilder;
import org.eclipse.hawkbit.repository.model.DistributionSetMetadata; import org.eclipse.hawkbit.repository.model.DistributionSetMetadata;
import org.eclipse.hawkbit.repository.model.DistributionSetTag; import org.eclipse.hawkbit.repository.model.DistributionSetTag;
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult; import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult;
@@ -497,7 +497,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
} }
metadata.forEach(m -> entityManager.merge((JpaDistributionSet) m.getDistributionSet()).setLastModifiedAt(0L)); metadata.forEach(m -> entityManager.merge((JpaDistributionSet) m.getDistributionSet()).setLastModifiedAt(0L));
return new ArrayList<DistributionSetMetadata>( return new ArrayList<>(
(Collection<? extends DistributionSetMetadata>) distributionSetMetadataRepository.save(metadata)); (Collection<? extends DistributionSetMetadata>) distributionSetMetadataRepository.save(metadata));
} }

View File

@@ -23,7 +23,6 @@ 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.TargetWithActionType;
import org.eclipse.hawkbit.repository.exception.RolloutIllegalStateException; import org.eclipse.hawkbit.repository.exception.RolloutIllegalStateException;
import org.eclipse.hawkbit.repository.jpa.cache.CacheWriteNotify; import org.eclipse.hawkbit.repository.jpa.cache.CacheWriteNotify;
import org.eclipse.hawkbit.repository.jpa.model.JpaRollout; import org.eclipse.hawkbit.repository.jpa.model.JpaRollout;
@@ -44,6 +43,7 @@ import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupStatus;
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupSuccessCondition; import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupSuccessCondition;
import org.eclipse.hawkbit.repository.model.RolloutGroupConditions; 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.TargetWithActionType;
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;
import org.slf4j.Logger; import org.slf4j.Logger;

View File

@@ -14,7 +14,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import org.eclipse.hawkbit.repository.jpa.eventbus.CacheFieldEntityListener; import org.eclipse.hawkbit.repository.jpa.model.CacheFieldEntityListener;
import org.springframework.cache.CacheManager; import org.springframework.cache.CacheManager;
import org.springframework.data.annotation.Transient; import org.springframework.data.annotation.Transient;

View File

@@ -8,7 +8,7 @@
*/ */
package org.eclipse.hawkbit.repository.jpa.cache; package org.eclipse.hawkbit.repository.jpa.cache;
import org.eclipse.hawkbit.repository.jpa.eventbus.CacheFieldEntityListener; import org.eclipse.hawkbit.repository.jpa.model.CacheFieldEntityListener;
/** /**
* Constants for cache keys used in multiple classes. * Constants for cache keys used in multiple classes.

View File

@@ -36,10 +36,8 @@ import com.google.common.eventbus.Subscribe;
* interested in all fine grained events, e.g. UI code. The UI code is not * interested in all fine grained events, e.g. UI code. The UI code is not
* interested in handling the flood of events, so collecting the events and * interested in handling the flood of events, so collecting the events and
* merge them to one event together and post them in a fixed interval is easier * merge them to one event together and post them in a fixed interval is easier
* to consume e.g. for push notifcations on UI. * to consume e.g. for push notifications on UI.
* *
* @author Michael Hirsch
*
*/ */
@EventSubscriber @EventSubscriber
public class EventMerger { public class EventMerger {

View File

@@ -19,6 +19,9 @@ import org.eclipse.hawkbit.repository.model.SoftwareModule;
* {@link SoftwareModule}. * {@link SoftwareModule}.
*/ */
@MappedSuperclass @MappedSuperclass
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for
// sub entities
@SuppressWarnings("squid:S2160")
public abstract class AbstractJpaArtifact extends AbstractJpaTenantAwareBaseEntity implements Artifact { public abstract class AbstractJpaArtifact extends AbstractJpaTenantAwareBaseEntity implements Artifact {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@@ -18,8 +18,6 @@ import javax.persistence.Id;
import javax.persistence.MappedSuperclass; import javax.persistence.MappedSuperclass;
import javax.persistence.Version; import javax.persistence.Version;
import org.eclipse.hawkbit.repository.jpa.eventbus.CacheFieldEntityListener;
import org.eclipse.hawkbit.repository.jpa.eventbus.EntityPropertyChangeListener;
import org.eclipse.hawkbit.repository.model.BaseEntity; import org.eclipse.hawkbit.repository.model.BaseEntity;
import org.springframework.data.annotation.CreatedBy; import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.CreatedDate;
@@ -156,8 +154,7 @@ public abstract class AbstractJpaBaseEntity implements BaseEntity {
* @see java.lang.Object#equals(java.lang.Object) * @see java.lang.Object#equals(java.lang.Object)
*/ */
@Override @Override
public boolean equals(final Object obj) { // NOSONAR - as this is generated public boolean equals(final Object obj) {
// code
if (this == obj) { if (this == obj) {
return true; return true;
} }

View File

@@ -19,6 +19,9 @@ import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
* addition to their technical ID. * addition to their technical ID.
*/ */
@MappedSuperclass @MappedSuperclass
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for
// sub entities
@SuppressWarnings("squid:S2160")
public abstract class AbstractJpaNamedEntity extends AbstractJpaTenantAwareBaseEntity implements NamedEntity { public abstract class AbstractJpaNamedEntity extends AbstractJpaTenantAwareBaseEntity implements NamedEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@@ -19,6 +19,9 @@ import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
* *
*/ */
@MappedSuperclass @MappedSuperclass
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for
// sub entities
@SuppressWarnings("squid:S2160")
public abstract class AbstractJpaNamedVersionedEntity extends AbstractJpaNamedEntity implements NamedVersionedEntity { public abstract class AbstractJpaNamedVersionedEntity extends AbstractJpaNamedEntity implements NamedVersionedEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@@ -19,6 +19,9 @@ import org.eclipse.hawkbit.repository.model.Tag;
* *
*/ */
@MappedSuperclass @MappedSuperclass
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for
// sub entities
@SuppressWarnings("squid:S2160")
public abstract class AbstractJpaTag extends AbstractJpaNamedEntity implements Tag { public abstract class AbstractJpaTag extends AbstractJpaNamedEntity implements Tag {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@@ -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.eventbus; package org.eclipse.hawkbit.repository.jpa.model;
import java.io.Serializable; import java.io.Serializable;
import java.lang.reflect.Field; import java.lang.reflect.Field;

View File

@@ -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.eventbus; package org.eclipse.hawkbit.repository.jpa.model;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;

View File

@@ -49,6 +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
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for
// sub entities
@SuppressWarnings("squid:S2160")
public class JpaAction extends AbstractJpaTenantAwareBaseEntity implements Action { public class JpaAction extends AbstractJpaTenantAwareBaseEntity implements Action {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@@ -40,6 +40,9 @@ 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
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for
// sub entities
@SuppressWarnings("squid:S2160")
public class JpaActionStatus extends AbstractJpaTenantAwareBaseEntity implements ActionStatus { public class JpaActionStatus extends AbstractJpaTenantAwareBaseEntity implements ActionStatus {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@@ -37,7 +37,6 @@ import org.eclipse.hawkbit.repository.exception.DistributionSetTypeUndefinedExce
import org.eclipse.hawkbit.repository.exception.UnsupportedSoftwareModuleForThisDistributionSetException; import org.eclipse.hawkbit.repository.exception.UnsupportedSoftwareModuleForThisDistributionSetException;
import org.eclipse.hawkbit.repository.model.Action; import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.DistributionSet; import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
import org.eclipse.hawkbit.repository.model.DistributionSetMetadata; import org.eclipse.hawkbit.repository.model.DistributionSetMetadata;
import org.eclipse.hawkbit.repository.model.DistributionSetTag; import org.eclipse.hawkbit.repository.model.DistributionSetTag;
import org.eclipse.hawkbit.repository.model.DistributionSetType; import org.eclipse.hawkbit.repository.model.DistributionSetType;
@@ -59,6 +58,9 @@ 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") })
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for
// sub entities
@SuppressWarnings("squid:S2160")
public class JpaDistributionSet extends AbstractJpaNamedVersionedEntity implements DistributionSet { public class JpaDistributionSet extends AbstractJpaNamedVersionedEntity implements DistributionSet {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@@ -198,11 +200,6 @@ public class JpaDistributionSet extends AbstractJpaNamedVersionedEntity implemen
return Collections.unmodifiableSet(modules); return Collections.unmodifiableSet(modules);
} }
@Override
public DistributionSetIdName getDistributionSetIdName() {
return new DistributionSetIdName(getId(), getName(), getVersion());
}
@Override @Override
public boolean addModule(final SoftwareModule softwareModule) { public boolean addModule(final SoftwareModule softwareModule) {

View File

@@ -38,6 +38,9 @@ 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") })
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for
// sub entities
@SuppressWarnings("squid:S2160")
public class JpaDistributionSetType extends AbstractJpaNamedEntity implements DistributionSetType { public class JpaDistributionSetType extends AbstractJpaNamedEntity implements DistributionSetType {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@@ -112,45 +115,6 @@ public class JpaDistributionSetType extends AbstractJpaNamedEntity implements Di
.collect(Collectors.toSet()); .collect(Collectors.toSet());
} }
@Override
public boolean containsModuleType(final SoftwareModuleType softwareModuleType) {
for (final DistributionSetTypeElement distributionSetTypeElement : elements) {
if (distributionSetTypeElement.getSmType().equals(softwareModuleType)) {
return true;
}
}
return false;
}
@Override
public boolean containsMandatoryModuleType(final SoftwareModuleType softwareModuleType) {
return elements.stream().filter(element -> element.isMandatory())
.filter(element -> element.getSmType().equals(softwareModuleType)).findFirst().isPresent();
}
@Override
public boolean containsMandatoryModuleType(final Long softwareModuleTypeId) {
return elements.stream().filter(element -> element.isMandatory())
.filter(element -> element.getSmType().getId().equals(softwareModuleTypeId)).findFirst().isPresent();
}
@Override
public boolean containsOptionalModuleType(final SoftwareModuleType softwareModuleType) {
return elements.stream().filter(element -> !element.isMandatory())
.filter(element -> element.getSmType().equals(softwareModuleType)).findFirst().isPresent();
}
@Override
public boolean containsOptionalModuleType(final Long softwareModuleTypeId) {
return elements.stream().filter(element -> !element.isMandatory())
.filter(element -> element.getSmType().getId().equals(softwareModuleTypeId)).findFirst().isPresent();
}
@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);

View File

@@ -33,6 +33,9 @@ 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
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for
// sub entities
@SuppressWarnings("squid:S2160")
public class JpaExternalArtifact extends AbstractJpaArtifact implements ExternalArtifact { public class JpaExternalArtifact extends AbstractJpaArtifact implements ExternalArtifact {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@@ -23,6 +23,9 @@ import org.eclipse.hawkbit.repository.model.ExternalArtifactProvider;
@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
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for
// sub entities
@SuppressWarnings("squid:S2160")
public class JpaExternalArtifactProvider extends AbstractJpaNamedEntity implements ExternalArtifactProvider { public class JpaExternalArtifactProvider extends AbstractJpaNamedEntity implements ExternalArtifactProvider {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@@ -32,6 +32,9 @@ import com.mongodb.gridfs.GridFSFile;
@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
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for
// sub entities
@SuppressWarnings("squid:S2160")
public class JpaLocalArtifact extends AbstractJpaArtifact implements LocalArtifact { public class JpaLocalArtifact extends AbstractJpaArtifact implements LocalArtifact {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@@ -41,6 +41,9 @@ import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
@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"))
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for
// sub entities
@SuppressWarnings("squid:S2160")
public class JpaRollout extends AbstractJpaNamedEntity implements Rollout { public class JpaRollout extends AbstractJpaNamedEntity implements Rollout {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@@ -37,6 +37,9 @@ import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
@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"))
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for
// sub entities
@SuppressWarnings("squid:S2160")
public class JpaRolloutGroup extends AbstractJpaNamedEntity implements RolloutGroup { public class JpaRolloutGroup extends AbstractJpaNamedEntity implements RolloutGroup {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@@ -50,6 +50,9 @@ 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") })
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for
// sub entities
@SuppressWarnings("squid:S2160")
public class JpaSoftwareModule extends AbstractJpaNamedVersionedEntity implements SoftwareModule { public class JpaSoftwareModule extends AbstractJpaNamedVersionedEntity implements SoftwareModule {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@@ -26,6 +26,9 @@ 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") })
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for
// sub entities
@SuppressWarnings("squid:S2160")
public class JpaSoftwareModuleType extends AbstractJpaNamedEntity implements SoftwareModuleType { public class JpaSoftwareModuleType extends AbstractJpaNamedEntity implements SoftwareModuleType {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@@ -61,6 +61,9 @@ 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") })
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for
// sub entities
@SuppressWarnings("squid:S2160")
public class JpaTarget extends AbstractJpaNamedEntity 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;

View File

@@ -24,6 +24,9 @@ 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"))
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for
// sub entities
@SuppressWarnings("squid:S2160")
public class JpaTargetFilterQuery extends AbstractJpaTenantAwareBaseEntity implements TargetFilterQuery { public class JpaTargetFilterQuery extends AbstractJpaTenantAwareBaseEntity implements TargetFilterQuery {
private static final long serialVersionUID = 7493966984413479089L; private static final long serialVersionUID = 7493966984413479089L;

View File

@@ -23,6 +23,9 @@ 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"))
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for
// sub entities
@SuppressWarnings("squid:S2160")
public class JpaTenantConfiguration extends AbstractJpaTenantAwareBaseEntity implements TenantConfiguration { public class JpaTenantConfiguration extends AbstractJpaTenantAwareBaseEntity implements TenantConfiguration {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@@ -36,6 +36,9 @@ 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
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for
// sub entities
@SuppressWarnings("squid:S2160")
public class JpaTenantMetaData extends AbstractJpaBaseEntity implements TenantMetaData { public class JpaTenantMetaData extends AbstractJpaBaseEntity implements TenantMetaData {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@@ -84,24 +87,4 @@ public class JpaTenantMetaData extends AbstractJpaBaseEntity implements TenantMe
public void setTenant(final String tenant) { public void setTenant(final String tenant) {
this.tenant = tenant; this.tenant = tenant;
} }
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + this.getClass().getName().hashCode();
return result;
}
@Override
public boolean equals(final Object obj) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof TenantMetaData)) {
return false;
}
return true;
}
} }

View File

@@ -8,8 +8,8 @@
*/ */
package org.eclipse.hawkbit.repository.jpa.model.helper; package org.eclipse.hawkbit.repository.jpa.model.helper;
import org.eclipse.hawkbit.repository.jpa.eventbus.EntityPropertyChangeListener;
import org.eclipse.hawkbit.repository.jpa.executor.AfterTransactionCommitExecutor; import org.eclipse.hawkbit.repository.jpa.executor.AfterTransactionCommitExecutor;
import org.eclipse.hawkbit.repository.jpa.model.EntityPropertyChangeListener;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
/** /**

View File

@@ -8,7 +8,7 @@
*/ */
package org.eclipse.hawkbit.repository.jpa.model.helper; package org.eclipse.hawkbit.repository.jpa.model.helper;
import org.eclipse.hawkbit.repository.jpa.eventbus.CacheFieldEntityListener; import org.eclipse.hawkbit.repository.jpa.model.CacheFieldEntityListener;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.CacheManager; import org.springframework.cache.CacheManager;

View File

@@ -8,7 +8,7 @@
*/ */
package org.eclipse.hawkbit.repository.jpa.model.helper; package org.eclipse.hawkbit.repository.jpa.model.helper;
import org.eclipse.hawkbit.repository.jpa.eventbus.CacheFieldEntityListener; import org.eclipse.hawkbit.repository.jpa.model.CacheFieldEntityListener;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.google.common.eventbus.EventBus; import com.google.common.eventbus.EventBus;

View File

@@ -6,10 +6,13 @@
* 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; package org.eclipse.hawkbit.repository.jpa.rollout;
import java.util.List; import java.util.List;
import org.eclipse.hawkbit.repository.RolloutManagement;
import org.eclipse.hawkbit.repository.RolloutProperties;
import org.eclipse.hawkbit.repository.SystemManagement;
import org.eclipse.hawkbit.security.SystemSecurityContext; import org.eclipse.hawkbit.security.SystemSecurityContext;
import org.eclipse.hawkbit.tenancy.TenantAware; import org.eclipse.hawkbit.tenancy.TenantAware;
import org.slf4j.Logger; import org.slf4j.Logger;

View File

@@ -857,8 +857,9 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
final DistributionSet ds = TestDataUtil.generateDistributionSet("a", softwareManagement, final DistributionSet ds = TestDataUtil.generateDistributionSet("a", softwareManagement,
distributionSetManagement); distributionSetManagement);
// assign ds to create an action // assign ds to create an action
final DistributionSetAssignmentResult assignDistributionSet = deploymentManagement final DistributionSetAssignmentResult assignDistributionSet = deploymentManagement.assignDistributionSet(
.assignDistributionSet(ds.getId(), ActionType.SOFT, Action.NO_FORCE_TIME, target.getControllerId()); ds.getId(), ActionType.SOFT, org.eclipse.hawkbit.repository.model.Constants.NO_FORCE_TIME,
target.getControllerId());
final Action action = deploymentManagement.findActionWithDetails(assignDistributionSet.getActions().get(0)); final Action action = deploymentManagement.findActionWithDetails(assignDistributionSet.getActions().get(0));
// verify preparation // verify preparation
Action findAction = deploymentManagement.findAction(action.getId()); Action findAction = deploymentManagement.findAction(action.getId());
@@ -880,8 +881,9 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
final DistributionSet ds = TestDataUtil.generateDistributionSet("a", softwareManagement, final DistributionSet ds = TestDataUtil.generateDistributionSet("a", softwareManagement,
distributionSetManagement); distributionSetManagement);
// assign ds to create an action // assign ds to create an action
final DistributionSetAssignmentResult assignDistributionSet = deploymentManagement final DistributionSetAssignmentResult assignDistributionSet = deploymentManagement.assignDistributionSet(
.assignDistributionSet(ds.getId(), ActionType.FORCED, Action.NO_FORCE_TIME, target.getControllerId()); ds.getId(), ActionType.FORCED, org.eclipse.hawkbit.repository.model.Constants.NO_FORCE_TIME,
target.getControllerId());
final Action action = deploymentManagement.findActionWithDetails(assignDistributionSet.getActions().get(0)); final Action action = deploymentManagement.findActionWithDetails(assignDistributionSet.getActions().get(0));
// verify perparation // verify perparation
Action findAction = deploymentManagement.findAction(action.getId()); Action findAction = deploymentManagement.findAction(action.getId());
@@ -1060,8 +1062,7 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
public List<TargetAssignDistributionSetEvent> getEvents(final long timeout, final TimeUnit unit) public List<TargetAssignDistributionSetEvent> getEvents(final long timeout, final TimeUnit unit)
throws InterruptedException { throws InterruptedException {
latch.await(timeout, unit); latch.await(timeout, unit);
final List<TargetAssignDistributionSetEvent> handledEvents = new LinkedList<TargetAssignDistributionSetEvent>( final List<TargetAssignDistributionSetEvent> handledEvents = new LinkedList<>(events);
events);
assertThat(handledEvents).as("Did not receive the expected amount of events (" + expectedNumberOfEvents assertThat(handledEvents).as("Did not receive the expected amount of events (" + expectedNumberOfEvents
+ ") within timeout. Received events are " + handledEvents).hasSize(expectedNumberOfEvents); + ") within timeout. Received events are " + handledEvents).hasSize(expectedNumberOfEvents);

View File

@@ -16,7 +16,6 @@ import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import org.eclipse.hawkbit.repository.DistributionSetFilter.DistributionSetFilterBuilder;
import org.eclipse.hawkbit.repository.DistributionSetManagement; import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.exception.DistributionSetTypeUndefinedException; import org.eclipse.hawkbit.repository.exception.DistributionSetTypeUndefinedException;
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException; import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
@@ -32,6 +31,7 @@ import org.eclipse.hawkbit.repository.jpa.model.JpaSoftwareModule;
import org.eclipse.hawkbit.repository.jpa.model.JpaTarget; import org.eclipse.hawkbit.repository.jpa.model.JpaTarget;
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.DistributionSetFilter.DistributionSetFilterBuilder;
import org.eclipse.hawkbit.repository.model.ActionStatus; 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.DistributionSetMetadata; import org.eclipse.hawkbit.repository.model.DistributionSetMetadata;

View File

@@ -18,7 +18,6 @@ import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.eclipse.hawkbit.repository.DistributionSetFilter.DistributionSetFilterBuilder;
import org.eclipse.hawkbit.repository.TagManagement; import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException; import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSetTag; import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSetTag;
@@ -30,6 +29,7 @@ import org.eclipse.hawkbit.repository.model.Tag;
import org.eclipse.hawkbit.repository.model.Target; import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetTag; import org.eclipse.hawkbit.repository.model.TargetTag;
import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult; import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult;
import org.eclipse.hawkbit.repository.model.DistributionSetFilter.DistributionSetFilterBuilder;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

View File

@@ -16,6 +16,7 @@ import static org.mockito.Mockito.when;
import org.eclipse.hawkbit.repository.jpa.cache.CacheField; import org.eclipse.hawkbit.repository.jpa.cache.CacheField;
import org.eclipse.hawkbit.repository.jpa.cache.CacheKeys; import org.eclipse.hawkbit.repository.jpa.cache.CacheKeys;
import org.eclipse.hawkbit.repository.jpa.model.CacheFieldEntityListener;
import org.eclipse.hawkbit.repository.jpa.model.helper.CacheManagerHolder; import org.eclipse.hawkbit.repository.jpa.model.helper.CacheManagerHolder;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;

View File

@@ -6,10 +6,12 @@
* 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.model; package org.eclipse.hawkbit.ui.common;
import java.io.Serializable; import java.io.Serializable;
import org.eclipse.hawkbit.repository.model.DistributionSet;
/** /**
* *
* *
@@ -21,6 +23,12 @@ public class DistributionSetIdName implements Serializable {
private final String name; private final String name;
private final String version; private final String version;
public static DistributionSetIdName generate(final DistributionSet distributionSet) {
return new DistributionSetIdName(distributionSet.getId(), distributionSet.getName(),
distributionSet.getVersion());
}
/** /**
* @param id * @param id
* the {@link DistributionSet#getId()} * the {@link DistributionSet#getId()}

View File

@@ -16,6 +16,7 @@ import org.eclipse.hawkbit.repository.exception.EntityLockedException;
import org.eclipse.hawkbit.repository.model.DistributionSet; import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.SoftwareModule; import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType; import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType; import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider; import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder; import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
@@ -214,7 +215,7 @@ public class SoftwareModuleDetailsTable extends Table {
.getItem(event.getButton().getId()).getItemProperty(SOFT_MODULE).getValue(), alreadyAssignedSwModules); .getItem(event.getButton().getId()).getItemProperty(SOFT_MODULE).getValue(), alreadyAssignedSwModules);
final DistributionSet newDistributionSet = distributionSetManagement.unassignSoftwareModule(distributionSet, final DistributionSet newDistributionSet = distributionSetManagement.unassignSoftwareModule(distributionSet,
unAssignedSw); unAssignedSw);
manageDistUIState.setLastSelectedEntity(newDistributionSet.getDistributionSetIdName()); manageDistUIState.setLastSelectedEntity(DistributionSetIdName.generate(newDistributionSet));
eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.SELECTED_ENTITY, newDistributionSet)); eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.SELECTED_ENTITY, newDistributionSet));
eventBus.publish(this, DistributionsUIEvent.ORDER_BY_DISTRIBUTION); eventBus.publish(this, DistributionsUIEvent.ORDER_BY_DISTRIBUTION);
uiNotification.displaySuccess(i18n.get("message.sw.unassigned", unAssignedSw.getName())); uiNotification.displaySuccess(i18n.get("message.sw.unassigned", unAssignedSw.getName()));

View File

@@ -16,11 +16,11 @@ import java.util.Set;
import org.eclipse.hawkbit.repository.DistributionSetManagement; import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement; import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.DistributionSet; import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
import org.eclipse.hawkbit.repository.model.SoftwareModule; import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.SoftwareModuleIdName; import org.eclipse.hawkbit.repository.model.SoftwareModuleIdName;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent; import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent.SoftwareModuleEventType; import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent.SoftwareModuleEventType;
import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
import org.eclipse.hawkbit.ui.common.detailslayout.AbstractNamedVersionedEntityTableDetailsLayout; import org.eclipse.hawkbit.ui.common.detailslayout.AbstractNamedVersionedEntityTableDetailsLayout;
import org.eclipse.hawkbit.ui.common.detailslayout.SoftwareModuleDetailsTable; import org.eclipse.hawkbit.ui.common.detailslayout.SoftwareModuleDetailsTable;
import org.eclipse.hawkbit.ui.common.tagdetails.DistributionTagToken; import org.eclipse.hawkbit.ui.common.tagdetails.DistributionTagToken;

View File

@@ -22,11 +22,11 @@ import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SpPermissionChecker; import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.TargetManagement; import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.model.DistributionSet; import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
import org.eclipse.hawkbit.repository.model.SoftwareModule; import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.SoftwareModuleIdName; import org.eclipse.hawkbit.repository.model.SoftwareModuleIdName;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent; import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent.SoftwareModuleEventType; import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent.SoftwareModuleEventType;
import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
import org.eclipse.hawkbit.ui.common.table.AbstractNamedVersionTable; import org.eclipse.hawkbit.ui.common.table.AbstractNamedVersionTable;
import org.eclipse.hawkbit.ui.common.table.AbstractTable; import org.eclipse.hawkbit.ui.common.table.AbstractTable;
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType; import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
@@ -453,7 +453,7 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
if (manageDistUIState.getSelectedDistributions().isPresent()) { if (manageDistUIState.getSelectedDistributions().isPresent()) {
manageDistUIState.getSelectedDistributions().get().stream().forEach(this::unselect); manageDistUIState.getSelectedDistributions().get().stream().forEach(this::unselect);
} }
select(baseEntity.getDistributionSetIdName()); select(DistributionSetIdName.generate(baseEntity));
return item; return item;
} }

View File

@@ -14,12 +14,12 @@ 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.DistributionSetFilter;
import org.eclipse.hawkbit.repository.DistributionSetFilter.DistributionSetFilterBuilder;
import org.eclipse.hawkbit.repository.DistributionSetManagement; import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.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.DistributionSetFilter;
import org.eclipse.hawkbit.repository.model.DistributionSetType; import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.eclipse.hawkbit.repository.model.DistributionSetFilter.DistributionSetFilterBuilder;
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;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil; import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;

View File

@@ -8,7 +8,7 @@
*/ */
package org.eclipse.hawkbit.ui.distributions.event; package org.eclipse.hawkbit.ui.distributions.event;
import org.eclipse.hawkbit.repository.model.DistributionSetIdName; import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
/** /**
* Event fired on discard of software module assignment. * Event fired on discard of software module assignment.

View File

@@ -16,9 +16,9 @@ import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import org.eclipse.hawkbit.repository.SystemManagement; import org.eclipse.hawkbit.repository.SystemManagement;
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
import org.eclipse.hawkbit.repository.model.DistributionSetType; import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.eclipse.hawkbit.repository.model.SoftwareModuleIdName; import org.eclipse.hawkbit.repository.model.SoftwareModuleIdName;
import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
import org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout; import org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout;
import org.eclipse.hawkbit.ui.common.table.AbstractTable; import org.eclipse.hawkbit.ui.common.table.AbstractTable;
import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent; import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;

View File

@@ -19,9 +19,9 @@ import java.util.stream.Collectors;
import org.eclipse.hawkbit.repository.DistributionSetManagement; import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement; import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.DistributionSet; import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
import org.eclipse.hawkbit.repository.model.SoftwareModule; import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.SoftwareModuleIdName; import org.eclipse.hawkbit.repository.model.SoftwareModuleIdName;
import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
import org.eclipse.hawkbit.ui.common.confirmwindow.layout.AbstractConfirmationWindowLayout; import org.eclipse.hawkbit.ui.common.confirmwindow.layout.AbstractConfirmationWindowLayout;
import org.eclipse.hawkbit.ui.common.confirmwindow.layout.ConfirmationTab; import org.eclipse.hawkbit.ui.common.confirmwindow.layout.ConfirmationTab;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider; import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;

View File

@@ -16,8 +16,8 @@ import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.Set; import java.util.Set;
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
import org.eclipse.hawkbit.repository.model.SoftwareModuleIdName; import org.eclipse.hawkbit.repository.model.SoftwareModuleIdName;
import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
import org.eclipse.hawkbit.ui.common.ManagmentEntityState; import org.eclipse.hawkbit.ui.common.ManagmentEntityState;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;

View File

@@ -13,11 +13,11 @@ import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.eclipse.hawkbit.repository.DistributionSetFilter;
import org.eclipse.hawkbit.repository.DistributionSetFilter.DistributionSetFilterBuilder;
import org.eclipse.hawkbit.repository.DistributionSetManagement; import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.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.DistributionSetFilter;
import org.eclipse.hawkbit.repository.model.DistributionSetFilter.DistributionSetFilterBuilder;
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;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil; import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;

View File

@@ -21,10 +21,10 @@ import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.SpPermissionChecker; import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.TargetManagement; import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.model.DistributionSet; import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult; import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult;
import org.eclipse.hawkbit.repository.model.Target; import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetIdName; import org.eclipse.hawkbit.repository.model.TargetIdName;
import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
import org.eclipse.hawkbit.ui.common.table.AbstractNamedVersionTable; import org.eclipse.hawkbit.ui.common.table.AbstractNamedVersionTable;
import org.eclipse.hawkbit.ui.common.table.AbstractTable; import org.eclipse.hawkbit.ui.common.table.AbstractTable;
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType; import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;

View File

@@ -14,8 +14,8 @@ import java.util.stream.Collectors;
import org.eclipse.hawkbit.repository.DistributionSetManagement; import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.SpPermissionChecker; import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult; import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult;
import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
import org.eclipse.hawkbit.ui.common.table.AbstractTable; import org.eclipse.hawkbit.ui.common.table.AbstractTable;
import org.eclipse.hawkbit.ui.management.state.DistributionTableFilters; import org.eclipse.hawkbit.ui.management.state.DistributionTableFilters;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil; import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;

View File

@@ -14,9 +14,9 @@ import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy; import javax.annotation.PreDestroy;
import org.eclipse.hawkbit.repository.TargetManagement; import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
import org.eclipse.hawkbit.repository.model.TargetFilterQuery; import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus; import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent; import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
import org.eclipse.hawkbit.ui.management.event.PinUnpinEvent; import org.eclipse.hawkbit.ui.management.event.PinUnpinEvent;
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent; import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;

View File

@@ -11,8 +11,8 @@ package org.eclipse.hawkbit.ui.management.footer;
import java.util.Set; import java.util.Set;
import org.eclipse.hawkbit.repository.TagManagement; import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
import org.eclipse.hawkbit.repository.model.TargetIdName; import org.eclipse.hawkbit.repository.model.TargetIdName;
import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
import org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout; import org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout;
import org.eclipse.hawkbit.ui.common.table.AbstractTable; import org.eclipse.hawkbit.ui.common.table.AbstractTable;
import org.eclipse.hawkbit.ui.management.event.BulkUploadPopupEvent; import org.eclipse.hawkbit.ui.management.event.BulkUploadPopupEvent;

View File

@@ -23,10 +23,10 @@ import org.eclipse.hawkbit.repository.DeploymentManagement;
import org.eclipse.hawkbit.repository.DistributionSetAssignmentResult; import org.eclipse.hawkbit.repository.DistributionSetAssignmentResult;
import org.eclipse.hawkbit.repository.DistributionSetManagement; import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.TargetManagement; import org.eclipse.hawkbit.repository.TargetManagement;
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.DistributionSetIdName; import org.eclipse.hawkbit.repository.model.Constants;
import org.eclipse.hawkbit.repository.model.TargetIdName; import org.eclipse.hawkbit.repository.model.TargetIdName;
import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
import org.eclipse.hawkbit.ui.common.confirmwindow.layout.AbstractConfirmationWindowLayout; import org.eclipse.hawkbit.ui.common.confirmwindow.layout.AbstractConfirmationWindowLayout;
import org.eclipse.hawkbit.ui.common.confirmwindow.layout.ConfirmationTab; import org.eclipse.hawkbit.ui.common.confirmwindow.layout.ConfirmationTab;
import org.eclipse.hawkbit.ui.management.event.PinUnpinEvent; import org.eclipse.hawkbit.ui.management.event.PinUnpinEvent;
@@ -148,7 +148,7 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
final long forcedTimeStamp = (((ActionTypeOptionGroupLayout.ActionTypeOption) actionTypeOptionGroupLayout final long forcedTimeStamp = (((ActionTypeOptionGroupLayout.ActionTypeOption) actionTypeOptionGroupLayout
.getActionTypeOptionGroup().getValue()) == ActionTypeOption.AUTO_FORCED) .getActionTypeOptionGroup().getValue()) == ActionTypeOption.AUTO_FORCED)
? actionTypeOptionGroupLayout.getForcedTimeDateField().getValue().getTime() ? actionTypeOptionGroupLayout.getForcedTimeDateField().getValue().getTime()
: Action.NO_FORCE_TIME; : Constants.NO_FORCE_TIME;
final Map<Long, ArrayList<TargetIdName>> saveAssignedList = new HashMap<>(); final Map<Long, ArrayList<TargetIdName>> saveAssignedList = new HashMap<>();

View File

@@ -17,8 +17,8 @@ import java.util.Optional;
import java.util.Set; import java.util.Set;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
import org.eclipse.hawkbit.repository.model.TargetIdName; import org.eclipse.hawkbit.repository.model.TargetIdName;
import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
import org.eclipse.hawkbit.ui.common.ManagmentEntityState; import org.eclipse.hawkbit.ui.common.ManagmentEntityState;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;

View File

@@ -12,7 +12,7 @@ import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.eclipse.hawkbit.repository.model.DistributionSetIdName; import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
/** /**
* Hold details for target bulk upload window. * Hold details for target bulk upload window.

View File

@@ -13,9 +13,9 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
import org.eclipse.hawkbit.repository.model.TargetFilterQuery; import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus; import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
import com.vaadin.spring.annotation.SpringComponent; import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.VaadinSessionScope; import com.vaadin.spring.annotation.VaadinSessionScope;

View File

@@ -29,8 +29,8 @@ import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.TagManagement; import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.TargetManagement; import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.model.Action.ActionType; import org.eclipse.hawkbit.repository.model.Action.ActionType;
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
import org.eclipse.hawkbit.repository.model.Target; import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
import org.eclipse.hawkbit.ui.common.tagdetails.AbstractTagToken.TagData; import org.eclipse.hawkbit.ui.common.tagdetails.AbstractTagToken.TagData;
import org.eclipse.hawkbit.ui.management.event.BulkUploadValidationMessageEvent; import org.eclipse.hawkbit.ui.management.event.BulkUploadValidationMessageEvent;
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent; import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;

View File

@@ -17,8 +17,8 @@ import javax.annotation.PreDestroy;
import org.eclipse.hawkbit.repository.DeploymentManagement; import org.eclipse.hawkbit.repository.DeploymentManagement;
import org.eclipse.hawkbit.repository.TargetManagement; import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
import org.eclipse.hawkbit.ui.UiProperties; import org.eclipse.hawkbit.ui.UiProperties;
import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider; import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder; import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
import org.eclipse.hawkbit.ui.management.dstable.DistributionBeanQuery; import org.eclipse.hawkbit.ui.management.dstable.DistributionBeanQuery;

View File

@@ -24,13 +24,13 @@ import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.TargetManagement; import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.eventbus.event.TargetCreatedEvent; import org.eclipse.hawkbit.repository.eventbus.event.TargetCreatedEvent;
import org.eclipse.hawkbit.repository.eventbus.event.TargetInfoUpdateEvent; import org.eclipse.hawkbit.repository.eventbus.event.TargetInfoUpdateEvent;
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
import org.eclipse.hawkbit.repository.model.Target; import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetFilterQuery; import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
import org.eclipse.hawkbit.repository.model.TargetIdName; import org.eclipse.hawkbit.repository.model.TargetIdName;
import org.eclipse.hawkbit.repository.model.TargetInfo; import org.eclipse.hawkbit.repository.model.TargetInfo;
import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult; import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult;
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus; import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
import org.eclipse.hawkbit.ui.common.ManagmentEntityState; import org.eclipse.hawkbit.ui.common.ManagmentEntityState;
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter; import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
import org.eclipse.hawkbit.ui.common.table.AbstractTable; import org.eclipse.hawkbit.ui.common.table.AbstractTable;

View File

@@ -10,7 +10,7 @@ package org.eclipse.hawkbit.ui.management.targettable;
import java.util.Set; import java.util.Set;
import org.eclipse.hawkbit.repository.model.DistributionSetIdName; import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
import org.eclipse.hawkbit.ui.common.table.AbstractTable; import org.eclipse.hawkbit.ui.common.table.AbstractTable;
import org.eclipse.hawkbit.ui.common.table.AbstractTableHeader; import org.eclipse.hawkbit.ui.common.table.AbstractTableHeader;
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType; import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;

View File

@@ -15,9 +15,8 @@ import java.util.List;
import org.eclipse.hawkbit.repository.DistributionSetManagement; import org.eclipse.hawkbit.repository.DistributionSetManagement;
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.model.Action;
import org.eclipse.hawkbit.repository.model.Action.ActionType; import org.eclipse.hawkbit.repository.model.Action.ActionType;
import org.eclipse.hawkbit.repository.model.DistributionSetIdName; import org.eclipse.hawkbit.repository.model.Constants;
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.Rollout.RolloutStatus;
import org.eclipse.hawkbit.repository.model.RolloutGroup; import org.eclipse.hawkbit.repository.model.RolloutGroup;
@@ -28,6 +27,7 @@ import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupSuccessCond
import org.eclipse.hawkbit.repository.model.RolloutGroupConditionBuilder; import org.eclipse.hawkbit.repository.model.RolloutGroupConditionBuilder;
import org.eclipse.hawkbit.repository.model.RolloutGroupConditions; import org.eclipse.hawkbit.repository.model.RolloutGroupConditions;
import org.eclipse.hawkbit.ui.UiProperties; import org.eclipse.hawkbit.ui.UiProperties;
import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider; import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder; import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
import org.eclipse.hawkbit.ui.filtermanagement.TargetFilterBeanQuery; import org.eclipse.hawkbit.ui.filtermanagement.TargetFilterBeanQuery;
@@ -461,7 +461,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
return (((ActionTypeOptionGroupLayout.ActionTypeOption) actionTypeOptionGroupLayout.getActionTypeOptionGroup() return (((ActionTypeOptionGroupLayout.ActionTypeOption) actionTypeOptionGroupLayout.getActionTypeOptionGroup()
.getValue()) == ActionTypeOption.AUTO_FORCED) .getValue()) == ActionTypeOption.AUTO_FORCED)
? actionTypeOptionGroupLayout.getForcedTimeDateField().getValue().getTime() ? actionTypeOptionGroupLayout.getForcedTimeDateField().getValue().getTime()
: Action.NO_FORCE_TIME; : Constants.NO_FORCE_TIME;
} }
private ActionType getActionType() { private ActionType getActionType() {
@@ -752,7 +752,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
rolloutForEdit = rolloutManagement.findRolloutById(rolloutId); rolloutForEdit = rolloutManagement.findRolloutById(rolloutId);
rolloutName.setValue(rolloutForEdit.getName()); rolloutName.setValue(rolloutForEdit.getName());
description.setValue(rolloutForEdit.getDescription()); description.setValue(rolloutForEdit.getDescription());
distributionSet.setValue(rolloutForEdit.getDistributionSet().getDistributionSetIdName()); distributionSet.setValue(DistributionSetIdName.generate(rolloutForEdit.getDistributionSet()));
final List<RolloutGroup> rolloutGroups = rolloutForEdit.getRolloutGroups(); final List<RolloutGroup> rolloutGroups = rolloutForEdit.getRolloutGroups();
setThresoldValues(rolloutGroups); setThresoldValues(rolloutGroups);
setActionType(rolloutForEdit); setActionType(rolloutForEdit);

View File

@@ -14,10 +14,10 @@ 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.DistributionSetFilter;
import org.eclipse.hawkbit.repository.DistributionSetFilter.DistributionSetFilterBuilder;
import org.eclipse.hawkbit.repository.DistributionSetManagement; import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.model.DistributionSet; import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetFilter;
import org.eclipse.hawkbit.repository.model.DistributionSetFilter.DistributionSetFilterBuilder;
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;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil; import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;