protected void doRun()

in src/main/java/org/apache/sling/servlets/post/impl/operations/CheckinOperation.java [43:75]


    protected void doRun(
            SlingJakartaHttpServletRequest request, JakartaPostResponse response, List<Modification> changes)
            throws PersistenceException {
        try {
            Iterator<Resource> res = getApplyToResources(request);
            if (res == null) {

                Resource resource = request.getResource();
                Node node = resource.adaptTo(Node.class);
                if (node == null) {
                    response.setStatus(
                            HttpServletResponse.SC_NOT_FOUND, "Missing source " + resource + " for checkout");
                    return;
                }

                node.getSession().getWorkspace().getVersionManager().checkin(node.getPath());
                changes.add(Modification.onCheckin(resource.getPath()));

            } else {

                while (res.hasNext()) {
                    Resource resource = res.next();
                    Node node = resource.adaptTo(Node.class);
                    if (node != null) {
                        node.getSession().getWorkspace().getVersionManager().checkin(node.getPath());
                        changes.add(Modification.onCheckin(resource.getPath()));
                    }
                }
            }
        } catch (final RepositoryException re) {
            throw new PersistenceException(re.getMessage(), re);
        }
    }