SystemManagement getTenantMetadata - fetch details, added method getTenantMetadataWithoutDetails (#2194)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -82,6 +82,15 @@ public interface SystemManagement {
|
||||
+ SpringEvalExpressions.IS_CONTROLLER)
|
||||
TenantMetaData getTenantMetadata();
|
||||
|
||||
/**
|
||||
* @return {@link TenantMetaData} of {@link TenantAware#getCurrentTenant()} without details ({@link TenantMetaData#getDefaultDsType()})
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.HAS_AUTH_READ_TARGET + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION_READ + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.IS_CONTROLLER)
|
||||
TenantMetaData getTenantMetadataWithoutDetails();
|
||||
|
||||
/**
|
||||
* Returns {@link TenantMetaData} of given and current tenant. Creates for
|
||||
* new tenants also two {@link SoftwareModuleType} (os and app) and
|
||||
|
||||
@@ -12,30 +12,31 @@ package org.eclipse.hawkbit.repository.model;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* A {@link DistributionSetType} is an abstract definition for
|
||||
* {@link DistributionSet} that defines what {@link SoftwareModule}s can be
|
||||
* added (optional) to {@link DistributionSet} of that type or have to added
|
||||
* (mandatory) in order to be considered complete. Only complete DS can be
|
||||
* assigned to a {@link Target}.
|
||||
* A {@link DistributionSetType} is an abstract definition for {@link DistributionSet} that defines what {@link SoftwareModule}s can be
|
||||
* added (optional) to {@link DistributionSet} of that type or have to added (mandatory) in order to be considered complete. Only complete DS
|
||||
* can be assigned to a {@link Target}.
|
||||
*/
|
||||
public interface DistributionSetType extends Type {
|
||||
|
||||
/**
|
||||
* @return immutable set of {@link SoftwareModuleType}s that need to be in a
|
||||
* {@link DistributionSet} of this type to be
|
||||
* @return immutable set of {@link SoftwareModuleType}s that need to be in a {@link DistributionSet} of this type to be
|
||||
* {@link DistributionSet#isComplete()}.
|
||||
*/
|
||||
Set<SoftwareModuleType> getMandatoryModuleTypes();
|
||||
|
||||
/**
|
||||
* @return immutable set of optional {@link SoftwareModuleType}s that can be
|
||||
* in a {@link DistributionSet} of this type.
|
||||
* @return immutable set of optional {@link SoftwareModuleType}s that can be in a {@link DistributionSet} of this type.
|
||||
*/
|
||||
Set<SoftwareModuleType> getOptionalModuleTypes();
|
||||
|
||||
/**
|
||||
* Checks if the given {@link SoftwareModuleType} is in this
|
||||
* {@link DistributionSetType}.
|
||||
* @param distributionSet to check for completeness
|
||||
* @return <code>true</code> if the all mandatory software module types are in the system.
|
||||
*/
|
||||
boolean checkComplete(DistributionSet distributionSet);
|
||||
|
||||
/**
|
||||
* Checks if the given {@link SoftwareModuleType} is in this {@link DistributionSetType}.
|
||||
*
|
||||
* @param softwareModuleType search for
|
||||
* @return <code>true</code> if found
|
||||
@@ -45,64 +46,22 @@ public interface DistributionSetType extends Type {
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given {@link SoftwareModuleType} is in this
|
||||
* {@link DistributionSetType}.
|
||||
*
|
||||
* @param softwareModuleTypeId search for by {@link SoftwareModuleType#getId()}
|
||||
* @return <code>true</code> if found
|
||||
*/
|
||||
default boolean containsModuleType(final Long softwareModuleTypeId) {
|
||||
return containsMandatoryModuleType(softwareModuleTypeId) || containsOptionalModuleType(softwareModuleTypeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given {@link SoftwareModuleType} is in
|
||||
* {@link #getMandatoryModuleTypes()}.
|
||||
* Checks if the given {@link SoftwareModuleType} is in {@link #getMandatoryModuleTypes()}.
|
||||
*
|
||||
* @param softwareModuleType search for
|
||||
* @return <code>true</code> if found
|
||||
*/
|
||||
default boolean containsMandatoryModuleType(final SoftwareModuleType softwareModuleType) {
|
||||
return containsMandatoryModuleType(softwareModuleType.getId());
|
||||
return getMandatoryModuleTypes().stream().anyMatch(element -> element.getId().equals(softwareModuleType.getId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given {@link SoftwareModuleType} is in
|
||||
* {@link #getMandatoryModuleTypes()}.
|
||||
*
|
||||
* @param softwareModuleTypeId search for by {@link SoftwareModuleType#getId()}
|
||||
* @return <code>true</code> if found
|
||||
*/
|
||||
default boolean containsMandatoryModuleType(final Long softwareModuleTypeId) {
|
||||
return getMandatoryModuleTypes().stream().anyMatch(element -> element.getId().equals(softwareModuleTypeId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given {@link SoftwareModuleType} is in
|
||||
* {@link #getOptionalModuleTypes()}.
|
||||
* Checks if the given {@link SoftwareModuleType} is in {@link #getOptionalModuleTypes()}.
|
||||
*
|
||||
* @param softwareModuleType search for
|
||||
* @return <code>true</code> if found
|
||||
*/
|
||||
default boolean containsOptionalModuleType(final SoftwareModuleType softwareModuleType) {
|
||||
return containsOptionalModuleType(softwareModuleType.getId());
|
||||
return getOptionalModuleTypes().stream().anyMatch(element -> element.getId().equals(softwareModuleType.getId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given {@link SoftwareModuleType} is in
|
||||
* {@link #getOptionalModuleTypes()}.
|
||||
*
|
||||
* @param softwareModuleTypeId search by {@link SoftwareModuleType#getId()}
|
||||
* @return <code>true</code> if found
|
||||
*/
|
||||
default boolean containsOptionalModuleType(final Long softwareModuleTypeId) {
|
||||
return getOptionalModuleTypes().stream().anyMatch(element -> element.getId().equals(softwareModuleTypeId));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param distributionSet to check for completeness
|
||||
* @return <code>true</code> if the all mandatory software module types are
|
||||
* in the system.
|
||||
*/
|
||||
boolean checkComplete(DistributionSet distributionSet);
|
||||
}
|
||||
Reference in New Issue
Block a user