Migration to Spring Boot 2.7.10 (#1320)
* Initial commit * Fix compile breaks * Fix hibernate config * Fix hibernate config * Fix failing tests * Improve logging * Improve logging * Fix Sonar issues * Remove BusProperties * Add BusProperties bean back in * Fix JPA workaround * Fix CVE-2021-22044 * Fix test failures * Fix PR review findings * Fix CVEs * Remove H2 version downgrade, fix schema migration, enable legacy mode * Downgrade Vaadin back to 8.14.3 * Fix EventPublisherHolder * Fix RemoteTenantAwareEvent * Fixed EventPublisherAutoConfiguration * New version of spring-hateoas requires links to be expanded (Mgmt API) * New version of spring-hateoas requires links to be expanded (Mgmt API) * Fix PR review findings * Fix PR review findings * Fix PR review findings * Update README.md * MariaDB Java Client downgrade to maintain compatibility with AWS Aurora * Temporarily disable RSQL test that depends on DB collation type * Upgrade to boot 2.7.10 * Upgrade snakeyaml to 1.33 * Upgrade Spring Security OAuth2 to version 5.7.7 * Remove obsolete exclusion of junit-vintage-engine * Upgrade jackson-bom to 2.14.2
This commit is contained in:
@@ -119,7 +119,7 @@ public final class MgmtDistributionSetMapper {
|
||||
response.setRequiredMigrationStep(distributionSet.isRequiredMigrationStep());
|
||||
|
||||
response.add(linkTo(methodOn(MgmtDistributionSetRestApi.class).getDistributionSet(response.getDsId()))
|
||||
.withSelfRel());
|
||||
.withSelfRel().expand());
|
||||
|
||||
return response;
|
||||
}
|
||||
@@ -128,14 +128,15 @@ public final class MgmtDistributionSetMapper {
|
||||
response.add(linkTo(methodOn(MgmtDistributionSetRestApi.class).getAssignedSoftwareModules(response.getDsId(),
|
||||
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET_VALUE,
|
||||
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE, null))
|
||||
.withRel(MgmtRestConstants.DISTRIBUTIONSET_V1_MODULE));
|
||||
.withRel(MgmtRestConstants.DISTRIBUTIONSET_V1_MODULE).expand());
|
||||
|
||||
response.add(linkTo(methodOn(MgmtDistributionSetTypeRestApi.class)
|
||||
.getDistributionSetType(distributionSet.getType().getId())).withRel("type"));
|
||||
.getDistributionSetType(distributionSet.getType().getId())).withRel("type").expand());
|
||||
|
||||
response.add(linkTo(methodOn(MgmtDistributionSetRestApi.class).getMetadata(response.getDsId(),
|
||||
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET_VALUE,
|
||||
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE, null, null)).withRel("metadata"));
|
||||
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE, null, null)).withRel("metadata")
|
||||
.expand());
|
||||
}
|
||||
|
||||
static MgmtTargetAssignmentResponseBody toResponse(final DistributionSetAssignmentResult dsAssignmentResult) {
|
||||
|
||||
@@ -86,7 +86,7 @@ final class MgmtDistributionSetTypeMapper {
|
||||
result.setColour(type.getColour());
|
||||
|
||||
result.add(linkTo(methodOn(MgmtDistributionSetTypeRestApi.class).getDistributionSetType(result.getModuleId()))
|
||||
.withSelfRel());
|
||||
.withSelfRel().expand());
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -94,10 +94,10 @@ final class MgmtDistributionSetTypeMapper {
|
||||
static void addLinks(final MgmtDistributionSetType result) {
|
||||
|
||||
result.add(linkTo(methodOn(MgmtDistributionSetTypeRestApi.class).getMandatoryModules(result.getModuleId()))
|
||||
.withRel(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_MANDATORY_MODULES));
|
||||
.withRel(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_MANDATORY_MODULES).expand());
|
||||
|
||||
result.add(linkTo(methodOn(MgmtDistributionSetTypeRestApi.class).getOptionalModules(result.getModuleId()))
|
||||
.withRel(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_OPTIONAL_MODULES));
|
||||
.withRel(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_OPTIONAL_MODULES).expand());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -95,22 +95,26 @@ final class MgmtRolloutMapper {
|
||||
body.setTotalGroups(rollout.getRolloutGroupsCreated());
|
||||
body.setStartAt(rollout.getStartAt());
|
||||
|
||||
body.add(linkTo(methodOn(MgmtRolloutRestApi.class).start(rollout.getId())).withRel("start"));
|
||||
body.add(linkTo(methodOn(MgmtRolloutRestApi.class).pause(rollout.getId())).withRel("pause"));
|
||||
body.add(linkTo(methodOn(MgmtRolloutRestApi.class).resume(rollout.getId())).withRel("resume"));
|
||||
body.add(linkTo(methodOn(MgmtRolloutRestApi.class).triggerNextGroup(rollout.getId())).withRel("triggerNextGroup"));
|
||||
body.add(linkTo(methodOn(MgmtRolloutRestApi.class).approve(rollout.getId(), null)).withRel("approve"));
|
||||
body.add(linkTo(methodOn(MgmtRolloutRestApi.class).deny(rollout.getId(), null)).withRel("deny"));
|
||||
body.add(linkTo(methodOn(MgmtRolloutRestApi.class).start(rollout.getId())).withRel("start").expand());
|
||||
body.add(linkTo(methodOn(MgmtRolloutRestApi.class).pause(rollout.getId())).withRel("pause").expand());
|
||||
body.add(linkTo(methodOn(MgmtRolloutRestApi.class).resume(rollout.getId())).withRel("resume").expand());
|
||||
body.add(linkTo(methodOn(MgmtRolloutRestApi.class).triggerNextGroup(rollout.getId()))
|
||||
.withRel("triggerNextGroup").expand());
|
||||
body.add(linkTo(methodOn(MgmtRolloutRestApi.class).approve(rollout.getId(), null)).withRel("approve")
|
||||
.expand());
|
||||
body.add(linkTo(methodOn(MgmtRolloutRestApi.class).deny(rollout.getId(), null)).withRel("deny").expand());
|
||||
body.add(linkTo(methodOn(MgmtRolloutRestApi.class).getRolloutGroups(rollout.getId(),
|
||||
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET_VALUE,
|
||||
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE, null, null)).withRel("groups"));
|
||||
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE, null, null)).withRel("groups")
|
||||
.expand());
|
||||
|
||||
final DistributionSet distributionSet = rollout.getDistributionSet();
|
||||
body.add(linkTo(methodOn(MgmtDistributionSetRestApi.class).getDistributionSet(distributionSet.getId()))
|
||||
.withRel("distributionset").withName(distributionSet.getName() + ":" + distributionSet.getVersion()));
|
||||
.withRel("distributionset").withName(distributionSet.getName() + ":" + distributionSet.getVersion())
|
||||
.expand());
|
||||
}
|
||||
|
||||
body.add(linkTo(methodOn(MgmtRolloutRestApi.class).getRollout(rollout.getId())).withSelfRel());
|
||||
body.add(linkTo(methodOn(MgmtRolloutRestApi.class).getRollout(rollout.getId())).withSelfRel().expand());
|
||||
return body;
|
||||
}
|
||||
|
||||
|
||||
@@ -112,23 +112,23 @@ public final class MgmtSoftwareModuleMapper {
|
||||
response.setEncrypted(softwareModule.isEncrypted());
|
||||
|
||||
response.add(linkTo(methodOn(MgmtSoftwareModuleRestApi.class).getSoftwareModule(response.getModuleId()))
|
||||
.withSelfRel());
|
||||
.withSelfRel().expand());
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
static void addLinks(final SoftwareModule softwareModule, final MgmtSoftwareModule response) {
|
||||
response.add(linkTo(methodOn(MgmtSoftwareModuleRestApi.class).getArtifacts(response.getModuleId()))
|
||||
.withRel(MgmtRestConstants.SOFTWAREMODULE_V1_ARTIFACT));
|
||||
.withRel(MgmtRestConstants.SOFTWAREMODULE_V1_ARTIFACT).expand());
|
||||
|
||||
response.add(linkTo(
|
||||
methodOn(MgmtSoftwareModuleTypeRestApi.class).getSoftwareModuleType(softwareModule.getType().getId()))
|
||||
.withRel(MgmtRestConstants.SOFTWAREMODULE_V1_TYPE));
|
||||
.withRel(MgmtRestConstants.SOFTWAREMODULE_V1_TYPE).expand());
|
||||
|
||||
response.add(linkTo(methodOn(MgmtSoftwareModuleResource.class).getMetadata(response.getModuleId(),
|
||||
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET_VALUE,
|
||||
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE, null, null)).withRel("metadata")
|
||||
.expand());
|
||||
.expand().expand());
|
||||
}
|
||||
|
||||
static MgmtArtifact toResponse(final Artifact artifact) {
|
||||
@@ -143,7 +143,7 @@ public final class MgmtSoftwareModuleMapper {
|
||||
MgmtRestModelMapper.mapBaseToBase(artifactRest, artifact);
|
||||
|
||||
artifactRest.add(linkTo(methodOn(MgmtSoftwareModuleRestApi.class)
|
||||
.getArtifact(artifact.getSoftwareModule().getId(), artifact.getId())).withSelfRel());
|
||||
.getArtifact(artifact.getSoftwareModule().getId(), artifact.getId())).withSelfRel().expand());
|
||||
|
||||
return artifactRest;
|
||||
}
|
||||
@@ -151,7 +151,8 @@ public final class MgmtSoftwareModuleMapper {
|
||||
static void addLinks(final Artifact artifact, final MgmtArtifact response) {
|
||||
|
||||
response.add(linkTo(methodOn(MgmtDownloadArtifactResource.class)
|
||||
.downloadArtifact(artifact.getSoftwareModule().getId(), artifact.getId())).withRel("download"));
|
||||
.downloadArtifact(artifact.getSoftwareModule().getId(), artifact.getId())).withRel("download")
|
||||
.expand());
|
||||
}
|
||||
|
||||
static List<MgmtArtifact> artifactsToResponse(final Collection<Artifact> artifacts) {
|
||||
|
||||
@@ -72,7 +72,7 @@ final class MgmtSoftwareModuleTypeMapper {
|
||||
result.setColour(type.getColour());
|
||||
|
||||
result.add(linkTo(methodOn(MgmtSoftwareModuleTypeRestApi.class).getSoftwareModuleType(result.getModuleId()))
|
||||
.withSelfRel());
|
||||
.withSelfRel().expand());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,8 @@ final class MgmtTagMapper {
|
||||
|
||||
mapTag(response, targetTag);
|
||||
|
||||
response.add(linkTo(methodOn(MgmtTargetTagRestApi.class).getTargetTag(targetTag.getId())).withSelfRel());
|
||||
response.add(
|
||||
linkTo(methodOn(MgmtTargetTagRestApi.class).getTargetTag(targetTag.getId())).withSelfRel().expand());
|
||||
|
||||
return response;
|
||||
}
|
||||
@@ -68,8 +69,8 @@ final class MgmtTagMapper {
|
||||
static void addLinks(final TargetTag targetTag, final MgmtTag response) {
|
||||
response.add(linkTo(methodOn(MgmtTargetTagRestApi.class).getAssignedTargets(targetTag.getId(),
|
||||
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET_VALUE,
|
||||
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE, null, null))
|
||||
.withRel("assignedTargets"));
|
||||
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE, null, null)).withRel("assignedTargets")
|
||||
.expand());
|
||||
|
||||
}
|
||||
|
||||
@@ -97,7 +98,7 @@ final class MgmtTagMapper {
|
||||
|
||||
response.add(
|
||||
linkTo(methodOn(MgmtDistributionSetTagRestApi.class).getDistributionSetTag(distributionSetTag.getId()))
|
||||
.withSelfRel());
|
||||
.withSelfRel().expand());
|
||||
|
||||
return response;
|
||||
}
|
||||
@@ -106,7 +107,7 @@ final class MgmtTagMapper {
|
||||
response.add(linkTo(methodOn(MgmtDistributionSetTagRestApi.class).getAssignedDistributionSets(
|
||||
distributionSetTag.getId(), MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET_VALUE,
|
||||
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE, null, null))
|
||||
.withRel("assignedDistributionSets"));
|
||||
.withRel("assignedDistributionSets").expand());
|
||||
}
|
||||
|
||||
static List<TagCreate> mapTagFromRequest(final EntityFactory entityFactory,
|
||||
|
||||
@@ -68,14 +68,15 @@ public final class MgmtTargetFilterQueryMapper {
|
||||
}
|
||||
}
|
||||
|
||||
targetRest.add(linkTo(methodOn(MgmtTargetFilterQueryRestApi.class).getFilter(filter.getId())).withSelfRel());
|
||||
targetRest.add(
|
||||
linkTo(methodOn(MgmtTargetFilterQueryRestApi.class).getFilter(filter.getId())).withSelfRel().expand());
|
||||
|
||||
return targetRest;
|
||||
}
|
||||
|
||||
static void addLinks(final MgmtTargetFilterQuery targetRest) {
|
||||
targetRest.add(linkTo(methodOn(MgmtTargetFilterQueryRestApi.class)
|
||||
.postAssignedDistributionSet(targetRest.getFilterId(), null)).withRel("autoAssignDS"));
|
||||
.postAssignedDistributionSet(targetRest.getFilterId(), null)).withRel("autoAssignDS").expand());
|
||||
}
|
||||
|
||||
static TargetFilterQueryCreate fromRequest(final EntityFactory entityFactory,
|
||||
|
||||
@@ -72,25 +72,26 @@ public final class MgmtTargetMapper {
|
||||
*/
|
||||
public static void addTargetLinks(final MgmtTarget response) {
|
||||
response.add(linkTo(methodOn(MgmtTargetRestApi.class).getAssignedDistributionSet(response.getControllerId()))
|
||||
.withRel(MgmtRestConstants.TARGET_V1_ASSIGNED_DISTRIBUTION_SET));
|
||||
.withRel(MgmtRestConstants.TARGET_V1_ASSIGNED_DISTRIBUTION_SET).expand());
|
||||
response.add(linkTo(methodOn(MgmtTargetRestApi.class).getInstalledDistributionSet(response.getControllerId()))
|
||||
.withRel(MgmtRestConstants.TARGET_V1_INSTALLED_DISTRIBUTION_SET));
|
||||
.withRel(MgmtRestConstants.TARGET_V1_INSTALLED_DISTRIBUTION_SET).expand());
|
||||
response.add(linkTo(methodOn(MgmtTargetRestApi.class).getAttributes(response.getControllerId()))
|
||||
.withRel(MgmtRestConstants.TARGET_V1_ATTRIBUTES));
|
||||
.withRel(MgmtRestConstants.TARGET_V1_ATTRIBUTES).expand());
|
||||
response.add(linkTo(methodOn(MgmtTargetRestApi.class).getActionHistory(response.getControllerId(), 0,
|
||||
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE,
|
||||
ActionFields.ID.getFieldName() + ":" + SortDirection.DESC, null))
|
||||
.withRel(MgmtRestConstants.TARGET_V1_ACTIONS).expand());
|
||||
response.add(linkTo(methodOn(MgmtTargetRestApi.class).getMetadata(response.getControllerId(),
|
||||
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET_VALUE,
|
||||
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE, null, null)).withRel("metadata"));
|
||||
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE, null, null)).withRel("metadata")
|
||||
.expand());
|
||||
if (response.getTargetType() != null) {
|
||||
response.add(linkTo(methodOn(MgmtTargetTypeRestApi.class).getTargetType(response.getTargetType()))
|
||||
.withRel(MgmtRestConstants.TARGET_V1_ASSIGNED_TARGET_TYPE));
|
||||
.withRel(MgmtRestConstants.TARGET_V1_ASSIGNED_TARGET_TYPE).expand());
|
||||
}
|
||||
if (response.getAutoConfirmActive() != null) {
|
||||
response.add(linkTo(methodOn(MgmtTargetRestApi.class).getAutoConfirmStatus(response.getControllerId()))
|
||||
.withRel(MgmtRestConstants.TARGET_V1_AUTO_CONFIRM));
|
||||
.withRel(MgmtRestConstants.TARGET_V1_AUTO_CONFIRM).expand());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,11 +103,11 @@ public final class MgmtTargetMapper {
|
||||
response.setInitiator(status.getInitiator());
|
||||
response.setRemark(status.getRemark());
|
||||
response.add(linkTo(methodOn(MgmtTargetRestApi.class).deactivateAutoConfirm(target.getControllerId()))
|
||||
.withRel(MgmtRestConstants.TARGET_V1_DEACTIVATE_AUTO_CONFIRM));
|
||||
.withRel(MgmtRestConstants.TARGET_V1_DEACTIVATE_AUTO_CONFIRM).expand());
|
||||
} else {
|
||||
response = MgmtTargetAutoConfirm.disabled();
|
||||
response.add(linkTo(methodOn(MgmtTargetRestApi.class).activateAutoConfirm(target.getControllerId(), null))
|
||||
.withRel(MgmtRestConstants.TARGET_V1_ACTIVATE_AUTO_CONFIRM));
|
||||
.withRel(MgmtRestConstants.TARGET_V1_ACTIVATE_AUTO_CONFIRM).expand());
|
||||
}
|
||||
return response;
|
||||
}
|
||||
@@ -192,7 +193,8 @@ public final class MgmtTargetMapper {
|
||||
targetRest.setAutoConfirmActive(target.getAutoConfirmationStatus() != null);
|
||||
}
|
||||
|
||||
targetRest.add(linkTo(methodOn(MgmtTargetRestApi.class).getTarget(target.getControllerId())).withSelfRel());
|
||||
targetRest.add(
|
||||
linkTo(methodOn(MgmtTargetRestApi.class).getTarget(target.getControllerId())).withSelfRel().expand());
|
||||
|
||||
return targetRest;
|
||||
}
|
||||
@@ -260,7 +262,7 @@ public final class MgmtTargetMapper {
|
||||
action.getLastActionStatusCode().ifPresent(statusCode -> {
|
||||
result.setLastStatusCode(statusCode);
|
||||
});
|
||||
|
||||
|
||||
final Rollout rollout = action.getRollout();
|
||||
if (rollout != null) {
|
||||
result.setRollout(rollout.getId());
|
||||
@@ -279,7 +281,8 @@ public final class MgmtTargetMapper {
|
||||
|
||||
MgmtRestModelMapper.mapBaseToBase(result, action);
|
||||
|
||||
result.add(linkTo(methodOn(MgmtTargetRestApi.class).getAction(targetId, action.getId())).withSelfRel());
|
||||
result.add(
|
||||
linkTo(methodOn(MgmtTargetRestApi.class).getAction(targetId, action.getId())).withSelfRel().expand());
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -289,25 +292,26 @@ public final class MgmtTargetMapper {
|
||||
|
||||
if (action.isCancelingOrCanceled()) {
|
||||
result.add(linkTo(methodOn(MgmtTargetRestApi.class).getAction(controllerId, action.getId()))
|
||||
.withRel(MgmtRestConstants.TARGET_V1_CANCELED_ACTION));
|
||||
.withRel(MgmtRestConstants.TARGET_V1_CANCELED_ACTION).expand());
|
||||
}
|
||||
|
||||
result.add(linkTo(methodOn(MgmtTargetRestApi.class).getTarget(controllerId)).withRel("target")
|
||||
.withName(action.getTarget().getName()));
|
||||
.withName(action.getTarget().getName()).expand());
|
||||
|
||||
final DistributionSet distributionSet = action.getDistributionSet();
|
||||
result.add(linkTo(methodOn(MgmtDistributionSetRestApi.class).getDistributionSet(distributionSet.getId()))
|
||||
.withRel("distributionset").withName(distributionSet.getName() + ":" + distributionSet.getVersion()));
|
||||
.withRel("distributionset").withName(distributionSet.getName() + ":" + distributionSet.getVersion())
|
||||
.expand());
|
||||
|
||||
result.add(linkTo(methodOn(MgmtTargetRestApi.class).getActionStatusList(controllerId, action.getId(), 0,
|
||||
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE,
|
||||
ActionStatusFields.ID.getFieldName() + ":" + SortDirection.DESC))
|
||||
.withRel(MgmtRestConstants.TARGET_V1_ACTION_STATUS));
|
||||
.withRel(MgmtRestConstants.TARGET_V1_ACTION_STATUS).expand());
|
||||
|
||||
final Rollout rollout = action.getRollout();
|
||||
if (rollout != null) {
|
||||
result.add(linkTo(methodOn(MgmtRolloutRestApi.class).getRollout(rollout.getId()))
|
||||
.withRel(MgmtRestConstants.TARGET_V1_ROLLOUT).withName(rollout.getName()));
|
||||
.withRel(MgmtRestConstants.TARGET_V1_ROLLOUT).withName(rollout.getName()).expand());
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
||||
|
||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -24,9 +27,6 @@ import org.eclipse.hawkbit.repository.builder.TargetTypeCreate;
|
||||
import org.eclipse.hawkbit.repository.model.TargetType;
|
||||
import org.eclipse.hawkbit.rest.data.ResponseList;
|
||||
|
||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
||||
|
||||
/**
|
||||
* A mapper which maps repository model to RESTful model representation and
|
||||
* back.
|
||||
@@ -43,13 +43,15 @@ public final class MgmtTargetTypeMapper {
|
||||
if (targetTypesRest == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return targetTypesRest.stream().map(targetRest -> fromRequest(entityFactory, targetRest)).collect(Collectors.toList());
|
||||
return targetTypesRest.stream().map(targetRest -> fromRequest(entityFactory, targetRest))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private static TargetTypeCreate fromRequest(final EntityFactory entityFactory,
|
||||
final MgmtTargetTypeRequestBodyPost targetTypesRest) {
|
||||
return entityFactory.targetType().create().name(targetTypesRest.getName()).description(targetTypesRest.getDescription())
|
||||
.colour(targetTypesRest.getColour()).compatible(getDistributionSets(targetTypesRest));
|
||||
return entityFactory.targetType().create().name(targetTypesRest.getName())
|
||||
.description(targetTypesRest.getDescription()).colour(targetTypesRest.getColour())
|
||||
.compatible(getDistributionSets(targetTypesRest));
|
||||
}
|
||||
|
||||
private static Collection<Long> getDistributionSets(final MgmtTargetTypeRequestBodyPost targetTypesRest) {
|
||||
@@ -70,12 +72,13 @@ public final class MgmtTargetTypeMapper {
|
||||
MgmtRestModelMapper.mapNamedToNamed(result, type);
|
||||
result.setTypeId(type.getId());
|
||||
result.setColour(type.getColour());
|
||||
result.add(linkTo(methodOn(MgmtTargetTypeRestApi.class).getTargetType(result.getTypeId())).withSelfRel());
|
||||
result.add(
|
||||
linkTo(methodOn(MgmtTargetTypeRestApi.class).getTargetType(result.getTypeId())).withSelfRel().expand());
|
||||
return result;
|
||||
}
|
||||
|
||||
static void addLinks(final MgmtTargetType result) {
|
||||
result.add(linkTo(methodOn(MgmtTargetTypeRestApi.class).getCompatibleDistributionSets(result.getTypeId()))
|
||||
.withRel(MgmtRestConstants.TARGETTYPE_V1_DS_TYPES));
|
||||
.withRel(MgmtRestConstants.TARGETTYPE_V1_DS_TYPES).expand());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,8 +50,8 @@ public final class MgmtTenantManagementMapper {
|
||||
restConfValue.setLastModifiedAt(repoConfValue.getLastModifiedAt());
|
||||
restConfValue.setLastModifiedBy(repoConfValue.getLastModifiedBy());
|
||||
|
||||
restConfValue.add(
|
||||
linkTo(methodOn(MgmtTenantManagementResource.class).getTenantConfigurationValue(key)).withSelfRel());
|
||||
restConfValue.add(linkTo(methodOn(MgmtTenantManagementResource.class).getTenantConfigurationValue(key))
|
||||
.withSelfRel().expand());
|
||||
|
||||
return restConfValue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user