/** * 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 #getOptionalModuleTypes()}. * * @param softwareModuleType * search for * @return <code>true</code> if found */ default boolean containsOptionalModuleType(final SoftwareModuleType softwareModuleType) { return containsOptionalModuleType(softwareModuleType.getId()); }
@Override public ResponseEntity<MgmtSoftwareModuleType> getOptionalModule( @PathVariable("distributionSetTypeId") final Long distributionSetTypeId, @PathVariable("softwareModuleTypeId") final Long softwareModuleTypeId) { final DistributionSetType foundType = findDistributionSetTypeWithExceptionIfNotFound(distributionSetTypeId); final SoftwareModuleType foundSmType = findSoftwareModuleTypeWithExceptionIfNotFound(softwareModuleTypeId); if (!foundType.containsOptionalModuleType(foundSmType)) { throw new SoftwareModuleTypeNotInDistributionSetTypeException(softwareModuleTypeId, distributionSetTypeId); } return ResponseEntity.ok(MgmtSoftwareModuleTypeMapper.toResponse(foundSmType)); }