CommentProcessor.java

1
package pro.verron.officestamper.api;
2
3
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
4
import org.docx4j.wml.P;
5
import org.docx4j.wml.R;
6
import org.springframework.lang.Nullable;
7
8
/**
9
 * CommentProcessor is an interface that defines the methods for processing comments in a .docx template.
10
 */
11
public interface CommentProcessor {
12
13
14
    /**
15
     * This method is called after all comments in the .docx template have been passed to the comment processor.
16
     * All manipulations of the .docx document SHOULD BE done in this method.
17
     * If certain manipulations are already done
18
     * within the custom methods of a comment processor,
19
     * the ongoing iteration over the paragraphs in the document
20
     * may be disturbed.
21
     * <p>
22
     * This method replaces the previous {@link #commitChanges(WordprocessingMLPackage)} and called with a DocxPart
23
     * as the parameter.
24
     *
25
     * @param docxPart The DocxPart that can be manipulated by using the DOCX4J api.
26
     */
27
    default void commitChanges(DocxPart docxPart) {
28 1 1. commitChanges : removed call to pro/verron/officestamper/api/CommentProcessor::commitChanges → NO_COVERAGE
        commitChanges(docxPart.document());
29
    }
30
31
    /**
32
     * This method is called after all comments in the .docx template have been passed to the comment processor.
33
     * All manipulations of the .docx document SHOULD BE done in this method.
34
     * If certain manipulations are already done
35
     * within the custom methods of a comment processor,
36
     * the ongoing iteration over the paragraphs in the document
37
     * may be disturbed.
38
     * <p>
39
     * This method replaces the previous {@link #commitChanges(DocxPart)} and called with a DocxPart
40
     * as the parameter.
41
     *
42
     * @param document The document that can be manipulated by using the DOCX4J api.
43
     *
44
     * @deprecated replaced by {@link #commitChanges(DocxPart)}
45
     */
46
    @Deprecated(since = "2.3", forRemoval = true) default void commitChanges(WordprocessingMLPackage document) {
47
        throw new OfficeStamperException("Should not be called since deprecation, only legacy implementations have a "
48
                                         + "reason to keep implementing this");
49
    }
50
51
    /**
52
     * Passes the paragraph that is currently being processed (i.e., the paragraph that is commented in the
53
     * .docx template). This method is always called BEFORE the custom
54
     * methods of the custom comment processor interface
55
     * are called.
56
     *
57
     * @param paragraph coordinates of the currently processed paragraph within the template.
58
     */
59
    void setParagraph(P paragraph);
60
61
    /**
62
     * Passes the run that is currently being processed (i.e., the run that is commented in the
63
     * .docx template). This method is always called BEFORE the custom
64
     * methods of the custom comment processor interface
65
     * are called.
66
     *
67
     * @param run coordinates of the currently processed run within the template.
68
     */
69
    void setCurrentRun(@Nullable R run);
70
71
    /**
72
     * Passes the comment range wrapper that is currently being processed
73
     * (i.e., the start and end of comment that in the .docx template).
74
     * This method is always called BEFORE the custom methods of the custom comment
75
     * processor interface are called.
76
     *
77
     * @param comment of the currently processed comment within the template.
78
     */
79
    void setCurrentCommentWrapper(Comment comment);
80
81
    /**
82
     * Resets all states in the comment processor so that it can be re-used in another stamping process.
83
     */
84
    void reset();
85
}

Mutations

28

1.1
Location : commitChanges
Killed by : none
removed call to pro/verron/officestamper/api/CommentProcessor::commitChanges → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.17.0