Add statistics for Distribution Set (#1388)

* Add Statistics for Rollouts and Actions count by Status for a Distribution Set

Signed-off-by: Denislav Prinov <denislav.prinov@bosch.com>

* remove unused imports

Signed-off-by: Denislav Prinov <denislav.prinov@bosch.com>

* Refactoring and additional statistics for auto assignments

Signed-off-by: Denislav Prinov <denislav.prinov@bosch.com>

* Fixed review findings and added tests

Signed-off-by: Denislav Prinov <denislav.prinov@bosch.com>

* Added tests for the Management API

Signed-off-by: Denislav Prinov <denislav.prinov@bosch.com>

* Remove unused imports

Signed-off-by: Denislav Prinov <denislav.prinov@bosch.com>

* refactoring

Signed-off-by: Denislav Prinov <denislav.prinov@bosch.com>

---------

Signed-off-by: Denislav Prinov <denislav.prinov@bosch.com>
This commit is contained in:
Denislav Prinov
2023-07-11 08:58:52 +03:00
committed by GitHub
parent 2fe73ee40c
commit 3402808ee9
11 changed files with 505 additions and 2 deletions

View File

@@ -34,6 +34,7 @@ import org.eclipse.hawkbit.repository.model.DistributionSetTag;
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult;
import org.eclipse.hawkbit.repository.model.MetaData;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.Statistic;
import org.eclipse.hawkbit.repository.model.Tag;
import org.eclipse.hawkbit.repository.model.Target;
import org.springframework.data.domain.Page;
@@ -517,6 +518,45 @@ public interface DistributionSetManagement
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
long countByTypeId(long typeId);
/**
* Count all {@link org.eclipse.hawkbit.repository.model.Rollout}s by status for
* Distribution Set.
*
* @param dsId
* to look for
*
* @return List of Statistics for {@link org.eclipse.hawkbit.repository.model.Rollout}s status counts
*
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
List<Statistic> countRolloutsByStatusForDistributionSet(@NotNull Long dsId);
/**
* Count all {@link org.eclipse.hawkbit.repository.model.Action}s by status for
* Distribution Set.
*
* @param dsId
* to look for
*
* @return List of Statistics for {@link org.eclipse.hawkbit.repository.model.Action}s status counts
*
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
List<Statistic> countActionsByStatusForDistributionSet(@NotNull Long dsId);
/**
* Count all {@link org.eclipse.hawkbit.repository.builder.AutoAssignDistributionSetUpdate}s
* for Distribution Set.
*
* @param dsId
* to look for
*
* @return number of {@link org.eclipse.hawkbit.repository.builder.AutoAssignDistributionSetUpdate}s
*
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Long countAutoAssignmentsForDistributionSet(@NotNull Long dsId);
/**
* Sets the specified {@link DistributionSet} as invalidated.
*

View File

@@ -0,0 +1,25 @@
/**
* Copyright (c) 2023 Bosch.IO 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;
public interface Statistic {
/**
*
* @return the key of the Statistic entity.
*/
Object getName();
/**
*
* @return the value of the Statistic entity.
*/
Object getData();
}