/** * Checks if the given {@link SoftwareModuleType} is in this * {@link DistributionSetType}. * * @param softwareModuleType * search for * @return <code>true</code> if found */ default boolean containsModuleType(final SoftwareModuleType softwareModuleType) { return containsMandatoryModuleType(softwareModuleType) || containsOptionalModuleType(softwareModuleType); }
/** * 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()); }
@Override public ResponseEntity<MgmtSoftwareModuleType> getMandatoryModule( @PathVariable("distributionSetTypeId") final Long distributionSetTypeId, @PathVariable("softwareModuleTypeId") final Long softwareModuleTypeId) { final DistributionSetType foundType = findDistributionSetTypeWithExceptionIfNotFound(distributionSetTypeId); final SoftwareModuleType foundSmType = findSoftwareModuleTypeWithExceptionIfNotFound(softwareModuleTypeId); if (!foundType.containsMandatoryModuleType(foundSmType)) { throw new SoftwareModuleTypeNotInDistributionSetTypeException(softwareModuleTypeId, distributionSetTypeId); } return ResponseEntity.ok(MgmtSoftwareModuleTypeMapper.toResponse(foundSmType)); }