aboutsummaryrefslogtreecommitdiffstats
path: root/document/src/main/java/com/yahoo/vespaxmlparser/FeedOperation.java
blob: f67a0d70e2688d5f63a52c86c32d68a53089b40d (plain) (blame)
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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespaxmlparser;

import com.yahoo.document.DocumentRemove;
import com.yahoo.document.DocumentPut;
import com.yahoo.document.DocumentUpdate;
import com.yahoo.document.TestAndSetCondition;

public class FeedOperation {

    public enum Type {DOCUMENT, REMOVE, UPDATE, INVALID}

    public static final FeedOperation INVALID = new FeedOperation(Type.INVALID);

    private Type type;
    protected FeedOperation(Type type) {
        this.type = type;
    }
    public final Type getType() { return type; }
    protected final void setType(Type type) {
        this.type = type;
    }

    public DocumentPut getDocumentPut() { return null; }
    public DocumentUpdate getDocumentUpdate() { return null; }
    public DocumentRemove getDocumentRemove() { return null; }

    public TestAndSetCondition getCondition() {
        return TestAndSetCondition.NOT_PRESENT_CONDITION;
    }
    @Override
    public String toString() {
        return "Operation{" +
                "type=" + getType() +
                ", doc=" + getDocumentPut() +
                ", remove=" + getDocumentRemove() +
                ", docUpdate=" + getDocumentUpdate() +
                " testandset=" + getCondition() +
                '}';
    }

}