<commit_before>package info.elexis.server.core.p2.jaxrs;

import java.util.ArrayList;
import java.util.List;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import org.eclipse.equinox.p2.operations.Update;
import org.osgi.service.component.annotations.Component;

import info.elexis.server.core.p2.internal.ProvisioningHelper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@Api(tags = { "p2" })
@Path("/p2")
@Component(service = UpdateResource.class, immediate = true)
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public class UpdateResource {

	@GET
	@Path("updates/check")
	@ApiOperation(nickname = "checkUpdates", value = "check for available updates")
	public Response checkUpdates() {
		List<String> resultList = new ArrayList<>();
		Update[] possibleUpdates = ProvisioningHelper.getPossibleUpdates();
		if (possibleUpdates != null) {
			for (Update update : possibleUpdates) {
				resultList.add(update.toString());
			}
		}
		return Response.ok(resultList).build();
	}

}<commit_msg>[15349] Add base update post rest operation<commit_after>package info.elexis.server.core.p2.jaxrs;

import java.util.ArrayList;
import java.util.List;

import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
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.equinox.p2.operations.Update;
import org.osgi.service.component.annotations.Component;

import info.elexis.server.core.p2.internal.ProvisioningHelper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@Api(tags = { "p2" })
@Path("p2")
@Component(service = UpdateResource.class, immediate = true)
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public class UpdateResource {

	@GET
	@Path("updates")
	@ApiOperation(nickname = "checkUpdate", value = "check for available updates")
	public Response checkUpdates() {
		List<String> resultList = new ArrayList<>();
		Update[] possibleUpdates = ProvisioningHelper.getPossibleUpdates();
		if (possibleUpdates != null) {
			for (Update update : possibleUpdates) {
				resultList.add(update.toString());
			}
		}
		return Response.ok(resultList).build();
	}
	
	@POST
	@Path("updates")
	@ApiOperation(nickname = "executeUpdate", value = "check for available updates")
	public Response executeUpdates() {
		IStatus updateAllFeatures = ProvisioningHelper.updateAllFeatures();
		if(updateAllFeatures.isOK()) {
			return Response.ok().build();
		}
		return Response.ok().build();
	}

}
{'fraction_non_alphanumeric': 0.13562453806356245, 'fraction_numerical': 0.005543237250554324, 'mean_word_length': 5.4299287410926365, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '378029', 'n_tokens_mistral': 912, 'n_tokens_neox': 874, 'n_words': 166}