Remove unnecessary DB calls from UI
Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
@@ -63,7 +63,8 @@ public interface TargetManagement {
|
||||
*
|
||||
* @return number of found {@link Target}s.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Long countTargetByAssignedDistributionSet(@NotNull Long distId);
|
||||
|
||||
/**
|
||||
@@ -104,7 +105,8 @@ public interface TargetManagement {
|
||||
* to search for
|
||||
* @return number of found {@link Target}s.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Long countTargetByInstalledDistributionSet(@NotNull Long distId);
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,8 +11,6 @@ package org.eclipse.hawkbit.repository.model;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
|
||||
/**
|
||||
* A {@link DistributionSet} defines a meta package that combines a set of
|
||||
* {@link SoftwareModule}s which have to be or are provisioned to a
|
||||
@@ -36,12 +34,6 @@ public interface DistributionSet extends NamedVersionedEntity {
|
||||
*/
|
||||
boolean isDeleted();
|
||||
|
||||
/**
|
||||
* @return immutable {@link List} of {@link DistributionSetMetadata}
|
||||
* elements. See {@link DistributionSetManagement} to alter.
|
||||
*/
|
||||
List<DistributionSetMetadata> getMetadata();
|
||||
|
||||
/**
|
||||
* @return <code>true</code> if {@link DistributionSet} contains a mandatory
|
||||
* migration step, i.e. unfinished {@link Action}s will kept active
|
||||
@@ -49,21 +41,11 @@ public interface DistributionSet extends NamedVersionedEntity {
|
||||
*/
|
||||
boolean isRequiredMigrationStep();
|
||||
|
||||
/**
|
||||
* @return the assignedTargets
|
||||
*/
|
||||
List<Target> getAssignedTargets();
|
||||
|
||||
/**
|
||||
* @return the auto assign target filters
|
||||
*/
|
||||
List<TargetFilterQuery> getAutoAssignFilters();
|
||||
|
||||
/**
|
||||
* @return the installedTargets
|
||||
*/
|
||||
List<TargetInfo> getInstalledTargets();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return unmodifiableSet of {@link SoftwareModule}.
|
||||
|
||||
@@ -231,7 +231,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
}
|
||||
|
||||
private JpaDistributionSet findDistributionSetAndThrowExceptionIfNotFound(final Long setId) {
|
||||
final JpaDistributionSet set = (JpaDistributionSet) findDistributionSetByIdWithDetails(setId);
|
||||
final JpaDistributionSet set = (JpaDistributionSet) findDistributionSetById(setId);
|
||||
|
||||
if (set == null) {
|
||||
throw new EntityNotFoundException("Distribution set cannot be updated as it does not exixt" + setId);
|
||||
|
||||
@@ -34,7 +34,7 @@ public interface TargetTagRepository
|
||||
*/
|
||||
@Modifying
|
||||
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||
Long deleteByName(final String tagName);
|
||||
Long deleteByName(String tagName);
|
||||
|
||||
/**
|
||||
* find {@link TargetTag} by its name.
|
||||
@@ -43,7 +43,7 @@ public interface TargetTagRepository
|
||||
* to filter on
|
||||
* @return the {@link TargetTag} if found, otherwise null
|
||||
*/
|
||||
JpaTargetTag findByNameEquals(final String tagName);
|
||||
JpaTargetTag findByNameEquals(String tagName);
|
||||
|
||||
/**
|
||||
* Returns all instances of the type.
|
||||
|
||||
@@ -209,7 +209,6 @@ public class JpaDistributionSet extends AbstractJpaNamedVersionedEntity implemen
|
||||
return deleted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DistributionSetMetadata> getMetadata() {
|
||||
if (metadata == null) {
|
||||
return Collections.emptyList();
|
||||
@@ -241,29 +240,11 @@ public class JpaDistributionSet extends AbstractJpaNamedVersionedEntity implemen
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Target> getAssignedTargets() {
|
||||
if (assignedToTargets == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return Collections.unmodifiableList(assignedToTargets);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TargetFilterQuery> getAutoAssignFilters() {
|
||||
return autoAssignFilters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TargetInfo> getInstalledTargets() {
|
||||
if (installedAtTargets == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return Collections.unmodifiableList(installedAtTargets);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DistributionSet [getName()=" + getName() + ", getOptLockRevision()=" + getOptLockRevision()
|
||||
|
||||
@@ -176,14 +176,6 @@ public class JpaSoftwareModule extends AbstractJpaNamedVersionedEntity implement
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public List<SoftwareModuleMetadata> getMetadata() {
|
||||
if (metadata == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return Collections.unmodifiableList(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SoftwareModule [deleted=" + deleted + ", name=" + getName() + ", version=" + getVersion()
|
||||
|
||||
@@ -83,7 +83,6 @@ public final class DistributionSetSpecification {
|
||||
targetRoot.fetch(JpaDistributionSet_.modules, JoinType.LEFT);
|
||||
targetRoot.fetch(JpaDistributionSet_.tags, JoinType.LEFT);
|
||||
targetRoot.fetch(JpaDistributionSet_.type, JoinType.LEFT);
|
||||
targetRoot.fetch(JpaDistributionSet_.metadata, JoinType.LEFT);
|
||||
query.distinct(true);
|
||||
|
||||
return predicate;
|
||||
@@ -110,8 +109,8 @@ public final class DistributionSetSpecification {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Specification} for retrieving {@link DistributionSet}s by
|
||||
* "like name or like description or like version".
|
||||
* {@link Specification} for retrieving {@link DistributionSet}s by "like
|
||||
* name or like description or like version".
|
||||
*
|
||||
* @param subString
|
||||
* to be filtered on
|
||||
@@ -125,8 +124,8 @@ public final class DistributionSetSpecification {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Specification} for retrieving {@link DistributionSet}s by
|
||||
* "has at least one of the given tag names".
|
||||
* {@link Specification} for retrieving {@link DistributionSet}s by "has at
|
||||
* least one of the given tag names".
|
||||
*
|
||||
* @param tagNames
|
||||
* to be filtered on
|
||||
|
||||
Reference in New Issue
Block a user