刘光辉
3 小时以前 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
60
package jnpf.elnService;
 
import jnpf.elnEntity.runtime.ElnRecordFieldValueEntity;
import jnpf.elnEntity.template.ElnTemplateBindingEntity;
 
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
 
public interface ElnCrossTemplateSnapshotResolver {
    Map<String, ElnRecordFieldValueEntity> resolve(String tenantId, String targetTestWorkItemId,
                                                    List<ElnTemplateBindingEntity> targetBindings);
 
    /**
     * Re-resolves persisted cross-template targets by their immutable binding identity.
     * This keeps explicit synchronization independent from the currently editable template.
     */
    default Map<String, ElnRecordFieldValueEntity> resolveByBindingIds(String tenantId,
            String targetTestWorkItemId, Set<String> targetBindingIds) {
        return Collections.emptyMap();
    }
 
    /**
     * Re-resolves persisted cross-template snapshots without changing them.
     * A caller can use every returned issue to block a state transition while
     * preserving the original snapshot as audit evidence.
     */
    default List<SnapshotIssue> validatePersistedSnapshots(String tenantId, String targetTestWorkItemId,
            List<ElnRecordFieldValueEntity> targetValues) {
        return Collections.emptyList();
    }
 
    final class SnapshotIssue {
        private final String code;
        private final String message;
        private final String targetBindingId;
        private final String targetFieldCode;
        private final String sourceTemplateCode;
 
        public SnapshotIssue(String code, String message, String targetBindingId,
                String targetFieldCode, String sourceTemplateCode) {
            this.code = code;
            this.message = message;
            this.targetBindingId = targetBindingId;
            this.targetFieldCode = targetFieldCode;
            this.sourceTemplateCode = sourceTemplateCode;
        }
 
        public String getCode() { return code; }
        public String getMessage() { return message; }
        public String getTargetBindingId() { return targetBindingId; }
        public String getTargetFieldCode() { return targetFieldCode; }
        public String getSourceTemplateCode() { return sourceTemplateCode; }
    }
 
    static ElnCrossTemplateSnapshotResolver none() {
        return (tenantId, testWorkItemId, bindings) -> Collections.emptyMap();
    }
}