use of org.eclipse.sw360.rest.resourceserver.core.HalResource in project sw360portal by sw360.
the class RestControllerHelper method addEmbeddedAttachments.
private void addEmbeddedAttachments(HalResource halResource, Set<Attachment> attachments) {
for (Attachment attachment : attachments) {
Attachment embeddedAttachment = convertToEmbeddedAttachment(attachment);
HalResource<Attachment> halAttachmentResource = new HalResource<>(embeddedAttachment);
Link attachmentLink = linkTo(AttachmentController.class).slash("api/attachments/" + attachment.getAttachmentContentId()).withSelfRel();
halAttachmentResource.add(attachmentLink);
halResource.addEmbeddedResource("sw360:attachments", halAttachmentResource);
}
}
use of org.eclipse.sw360.rest.resourceserver.core.HalResource in project sw360portal by sw360.
the class RestControllerHelper method addEmbeddedReleases.
public void addEmbeddedReleases(HalResource halResource, Set<String> releases, Sw360ReleaseService sw360ReleaseService, User user) throws TException {
for (String releaseId : releases) {
final Release release = sw360ReleaseService.getReleaseForUserById(releaseId, user);
addEmbeddedRelease(halResource, release);
}
}
use of org.eclipse.sw360.rest.resourceserver.core.HalResource in project sw360portal by sw360.
the class RestControllerHelper method addEmbeddedModerators.
public void addEmbeddedModerators(HalResource halResource, Set<String> moderators) {
for (String moderatorEmail : moderators) {
User user = new User();
user.setEmail(moderatorEmail);
addEmbeddedUser(halResource, user, "sw360:moderators");
}
}
use of org.eclipse.sw360.rest.resourceserver.core.HalResource in project sw360portal by sw360.
the class RestControllerHelper method addEmbeddedRelease.
public void addEmbeddedRelease(HalResource halResource, Release release) {
Release embeddedRelease = convertToEmbeddedRelease(release);
HalResource<Release> halRelease = new HalResource<>(embeddedRelease);
Link releaseLink = linkTo(ReleaseController.class).slash("api/releases/" + release.getId()).withSelfRel();
halRelease.add(releaseLink);
halResource.addEmbeddedResource("sw360:releases", halRelease);
}
use of org.eclipse.sw360.rest.resourceserver.core.HalResource in project sw360portal by sw360.
the class RestControllerHelper method addEmbeddedProject.
public void addEmbeddedProject(HalResource<Project> halProject, Set<String> projectIds, Sw360ProjectService sw360ProjectService, User user) throws TException {
for (String projectId : projectIds) {
final Project project = sw360ProjectService.getProjectForUserById(projectId, user);
addEmbeddedProject(halProject, project);
}
}
Aggregations