embulk-output-kintone 0.3.3 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +11 -4
- data/build.gradle +11 -0
- data/classpath/{embulk-output-kintone-0.3.3.jar → embulk-output-kintone-0.3.6.jar} +0 -0
- data/src/main/java/org/embulk/output/kintone/KintoneColumnOption.java +12 -15
- data/src/main/java/org/embulk/output/kintone/KintoneColumnVisitor.java +186 -211
- data/src/main/java/org/embulk/output/kintone/KintoneMode.java +19 -21
- data/src/main/java/org/embulk/output/kintone/KintoneOutputPlugin.java +41 -54
- data/src/main/java/org/embulk/output/kintone/KintonePageOutput.java +277 -284
- data/src/main/java/org/embulk/output/kintone/PluginTask.java +34 -37
- data/src/test/java/org/embulk/output/kintone/TestKintoneOutputPlugin.java +1 -3
- metadata +3 -3
@@ -1,5 +1,6 @@
|
|
1
1
|
package org.embulk.output.kintone;
|
2
2
|
|
3
|
+
import java.util.List;
|
3
4
|
import org.embulk.config.ConfigDiff;
|
4
5
|
import org.embulk.config.ConfigException;
|
5
6
|
import org.embulk.config.ConfigSource;
|
@@ -10,60 +11,46 @@ import org.embulk.spi.OutputPlugin;
|
|
10
11
|
import org.embulk.spi.Schema;
|
11
12
|
import org.embulk.spi.TransactionalPageOutput;
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
public
|
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
|
-
KintoneMode mode = KintoneMode.getKintoneModeByValue(task.getMode());
|
50
|
-
switch (mode) {
|
51
|
-
case INSERT:
|
52
|
-
if (task.getUpdateKeyName().isPresent()) {
|
53
|
-
throw new ConfigException("when mode is insert, require no update_key.");
|
54
|
-
}
|
55
|
-
break;
|
56
|
-
case UPDATE:
|
57
|
-
case UPSERT:
|
58
|
-
if (!task.getUpdateKeyName().isPresent()) {
|
59
|
-
throw new ConfigException("when mode is update or upsert, require update_key.");
|
60
|
-
}
|
61
|
-
break;
|
62
|
-
default:
|
63
|
-
throw new ConfigException(String.format(
|
64
|
-
"Unknown mode '%s'",
|
65
|
-
task.getMode()));
|
14
|
+
public class KintoneOutputPlugin implements OutputPlugin {
|
15
|
+
@Override
|
16
|
+
public ConfigDiff transaction(
|
17
|
+
ConfigSource config, Schema schema, int taskCount, OutputPlugin.Control control) {
|
18
|
+
PluginTask task = config.loadConfig(PluginTask.class);
|
19
|
+
|
20
|
+
control.run(task.dump());
|
21
|
+
return Exec.newConfigDiff();
|
22
|
+
}
|
23
|
+
|
24
|
+
@Override
|
25
|
+
public ConfigDiff resume(
|
26
|
+
TaskSource taskSource, Schema schema, int taskCount, OutputPlugin.Control control) {
|
27
|
+
throw new UnsupportedOperationException("kintone output plugin does not support resuming");
|
28
|
+
}
|
29
|
+
|
30
|
+
@Override
|
31
|
+
public void cleanup(
|
32
|
+
TaskSource taskSource, Schema schema, int taskCount, List<TaskReport> successTaskReports) {}
|
33
|
+
|
34
|
+
@Override
|
35
|
+
public TransactionalPageOutput open(TaskSource taskSource, Schema schema, int taskIndex) {
|
36
|
+
PluginTask task = taskSource.loadTask(PluginTask.class);
|
37
|
+
|
38
|
+
KintoneMode mode = KintoneMode.getKintoneModeByValue(task.getMode());
|
39
|
+
switch (mode) {
|
40
|
+
case INSERT:
|
41
|
+
if (task.getUpdateKeyName().isPresent()) {
|
42
|
+
throw new ConfigException("when mode is insert, require no update_key.");
|
43
|
+
}
|
44
|
+
break;
|
45
|
+
case UPDATE:
|
46
|
+
case UPSERT:
|
47
|
+
if (!task.getUpdateKeyName().isPresent()) {
|
48
|
+
throw new ConfigException("when mode is update or upsert, require update_key.");
|
66
49
|
}
|
67
|
-
|
50
|
+
break;
|
51
|
+
default:
|
52
|
+
throw new ConfigException(String.format("Unknown mode '%s'", task.getMode()));
|
68
53
|
}
|
54
|
+
return new KintonePageOutput(task, schema);
|
55
|
+
}
|
69
56
|
}
|