Commit c8af31d0 authored by Marco Descher's avatar Marco Descher 🏔

[15349] Implement REST update exec

parent 2bf8e1e0
Pipeline #10466 passed with stages
in 2 minutes and 20 seconds
......@@ -11,12 +11,15 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.p2.operations.Update;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import info.elexis.server.core.p2.IProvisioner;
import info.elexis.server.core.p2.internal.RepoInfo;
import info.elexis.server.core.rest.ResponseStatusUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -42,8 +45,9 @@ public class P2Resource {
@Path("updates")
@ApiOperation(nickname = "executeUpdate", value = "check for available updates")
public Response executeUpdates() {
RepoInfo repositoryInfo = provisioner.getRepositoryInfo();
return Response.ok(repositoryInfo).build();
Collection<Update> availableUpdates = provisioner.getAvailableUpdates();
IStatus status = provisioner.update(availableUpdates, new NullProgressMonitor());
return ResponseStatusUtil.convert(status);
}
@GET
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment