刘光辉
8 小时以前 06f314545ac3514d7ce28939920866ae8188d31c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package jnpf.bizcommon.onlyoffice.service.impl;
 
import lombok.Builder;
 
import java.util.Map;
import java.util.function.BooleanSupplier;
 
@Builder
public class OnlyOfficeSceneBuildPlan {
 
    @FunctionalInterface
    public interface PluginContextCustomizer {
        void customize(String pluginCode, String pluginGuid, Map<String, Object> context, boolean writable);
    }
 
    private final BooleanSupplier editAdmission;
    /** Server-verified lease forbids untracked full editing. */
    private final boolean reviewOnly;
    public boolean reviewOnly() { return reviewOnly; }
    /** 仅由已授权的场景构造器设置;允许会话身份与物理来源分离。 */
    private final String sourceFileId;
    /** 上传编辑专属权限;null 表示其他场景,保持原兼容行为。 */
    private final Boolean uploadFileAllowDownload;
    private final boolean uploadQianpiyeAnnotatorEnabled;
 
    public Boolean uploadFileAllowDownload() { return uploadFileAllowDownload; }
    public boolean uploadQianpiyeAnnotatorEnabled() { return uploadQianpiyeAnnotatorEnabled; }
 
    public String sourceFileId() { return sourceFileId; }
    private final boolean allowSameUserLockReopen;
    private final boolean hideCommentsWhenWritable;
    private final String pluginHiddenInReadOnly;
    private final boolean keepHiddenPluginForLocate;
    private final PluginContextCustomizer pluginContextCustomizer;
 
    public boolean canEdit() {
        return editAdmission != null && editAdmission.getAsBoolean();
    }
 
    public boolean allowSameUserLockReopen() {
        return allowSameUserLockReopen;
    }
 
    public boolean hideCommentsWhenWritable() {
        return hideCommentsWhenWritable;
    }
 
    public boolean keepPluginInReadOnly(String pluginCode, boolean locatingControl) {
        return pluginHiddenInReadOnly == null || !pluginHiddenInReadOnly.equals(pluginCode)
                || keepHiddenPluginForLocate && locatingControl;
    }
 
    public void customizePluginContext(String pluginCode, String pluginGuid,
            Map<String, Object> context, boolean writable) {
        if (pluginContextCustomizer != null) {
            pluginContextCustomizer.customize(pluginCode, pluginGuid, context, writable);
        }
    }
}