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

Mutations

39

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.1