embulk-input-adebis 0.0.1.pre3 → 0.0.1.pre4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/classpath/embulk-input-adebis-0.0.1.pre1.jar +0 -0
- data/src/main/java/org/embulk/input/adebis/operation/AbstractOperation.java +1 -1
- data/src/main/java/org/embulk/input/adebis/operation/Ad.java +14 -15
- data/src/main/java/org/embulk/input/adebis/operation/AdConversionAttribute.java +1 -1
- data/src/main/java/org/embulk/input/adebis/operation/AdGroup1.java +7 -8
- data/src/main/java/org/embulk/input/adebis/operation/AdGroup2.java +7 -8
- data/src/main/java/org/embulk/input/adebis/operation/Media.java +7 -8
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f471449ae7accd3e36ecfdce2ccfc1f68214e7ac
|
|
4
|
+
data.tar.gz: b6fbee0d48f0bb78cb7db50d338c3059ff721489
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f4206be4fa2cc69f9242a9c56692cf1e924996f258576beccfe0829c56d703f1b03e0e297c804df4de29025c231c1d81895e995f1116e071503d728bf197de5e
|
|
7
|
+
data.tar.gz: be79906b08ad011c59ddfd1f1c46f1fd22762ea783604ffa72245149ec8f8a4d8be903e34113b506da71f01838fe1b5f0f4c2981f39e74bd68b94c7517126309
|
|
Binary file
|
|
@@ -21,7 +21,7 @@ public abstract class AbstractOperation implements Operation {
|
|
|
21
21
|
static protected DateTimeFormatter adebisDateFormat = DateTimeFormatter.ofPattern("uuuu/MM/dd").withResolverStyle(ResolverStyle.STRICT);
|
|
22
22
|
static protected DateTimeFormatter adebisDateTimeFormat = DateTimeFormatter.ofPattern("uuuu/MM/dd HH:mm:ss").withResolverStyle(ResolverStyle.STRICT);
|
|
23
23
|
static protected DateTimeFormatter embulkDateTimeFormat = DateTimeFormatter.ofPattern("uuuu-MM-dd HH:mm:ss").withResolverStyle(ResolverStyle.STRICT);
|
|
24
|
-
static protected boolean isDebug =
|
|
24
|
+
static protected boolean isDebug = false;
|
|
25
25
|
|
|
26
26
|
public interface Condition extends Task {
|
|
27
27
|
@Config("start_date")
|
|
@@ -38,8 +38,6 @@ import java.util.Arrays;
|
|
|
38
38
|
import java.util.List;
|
|
39
39
|
|
|
40
40
|
public class Ad extends AbstractOperation {
|
|
41
|
-
public int lastRecordId = 0;
|
|
42
|
-
|
|
43
41
|
/*
|
|
44
42
|
//HACK 20190614 AbstractOperationに移したけど良いんだろうか?
|
|
45
43
|
public interface Condition extends Task {
|
|
@@ -98,6 +96,9 @@ public class Ad extends AbstractOperation {
|
|
|
98
96
|
*/
|
|
99
97
|
|
|
100
98
|
public void run(PageBuilder pageBuilder) {
|
|
99
|
+
long lastRecordId = 0;
|
|
100
|
+
long currentRecordId = 0;
|
|
101
|
+
|
|
101
102
|
Schema schema = pageBuilder.getSchema();
|
|
102
103
|
AdManagementService adManagementService;
|
|
103
104
|
try {
|
|
@@ -124,7 +125,7 @@ public class Ad extends AbstractOperation {
|
|
|
124
125
|
}
|
|
125
126
|
|
|
126
127
|
if(getLastRecordId().isPresent()) {
|
|
127
|
-
lastRecordId =
|
|
128
|
+
lastRecordId = Long.parseLong(getLastRecordId().get());
|
|
128
129
|
}
|
|
129
130
|
|
|
130
131
|
//if(lastRecordTime.isAfter(startDate.atStartOfDay())) {
|
|
@@ -168,22 +169,15 @@ public class Ad extends AbstractOperation {
|
|
|
168
169
|
else break;
|
|
169
170
|
for (jp.ne.ebis.extreme.ws.entity.xsd.Ad record : results) {
|
|
170
171
|
Boolean isExcluded = false;
|
|
171
|
-
|
|
172
|
-
if ( ! record.
|
|
172
|
+
currentRecordId = record.getCreated();
|
|
173
|
+
if ( ! record.isCreatedSpecified()) {
|
|
173
174
|
break;
|
|
174
175
|
}
|
|
175
|
-
if (lastRecordId
|
|
176
|
-
lastRecordId = currentRecordId;
|
|
177
|
-
} else {
|
|
176
|
+
if (lastRecordId >= currentRecordId) {
|
|
178
177
|
continue;
|
|
179
178
|
}
|
|
180
179
|
for (Column c : schema.getColumns()) {
|
|
181
180
|
switch (c.getName()) {
|
|
182
|
-
case "createdAt":
|
|
183
|
-
long unixtime = System.currentTimeMillis() / 1000L;
|
|
184
|
-
org.embulk.spi.time.Timestamp timestamp = org.embulk.spi.time.Timestamp.ofEpochSecond(unixtime);
|
|
185
|
-
pageBuilder.setTimestamp(c, timestamp);
|
|
186
|
-
break;
|
|
187
181
|
case "adId":
|
|
188
182
|
if (record.isAdIdSpecified()) pageBuilder.setString(c, record.getAdId());
|
|
189
183
|
else pageBuilder.setNull(c);
|
|
@@ -288,6 +282,11 @@ public class Ad extends AbstractOperation {
|
|
|
288
282
|
if (record.isParentAdIdSpecified()) pageBuilder.setString(c, record.getParentAdId());
|
|
289
283
|
else pageBuilder.setNull(c);
|
|
290
284
|
break;
|
|
285
|
+
case "createdAt":
|
|
286
|
+
long unixtime = System.currentTimeMillis() / 1000L;
|
|
287
|
+
org.embulk.spi.time.Timestamp timestamp = org.embulk.spi.time.Timestamp.ofEpochSecond(unixtime);
|
|
288
|
+
pageBuilder.setTimestamp(c, timestamp);
|
|
289
|
+
break;
|
|
291
290
|
default:
|
|
292
291
|
break;
|
|
293
292
|
}
|
|
@@ -301,12 +300,11 @@ public class Ad extends AbstractOperation {
|
|
|
301
300
|
}
|
|
302
301
|
|
|
303
302
|
setLastRecordTime(Optional.of(newestRecordTime.format(embulkDateTimeFormat)));
|
|
304
|
-
setLastRecordId(Optional.of(String.valueOf(
|
|
303
|
+
setLastRecordId(Optional.of(String.valueOf(currentRecordId)));
|
|
305
304
|
}
|
|
306
305
|
|
|
307
306
|
public Schema buildSchema() {
|
|
308
307
|
return Schema.builder()
|
|
309
|
-
.add("createdAt" , Types.TIMESTAMP)
|
|
310
308
|
.add("adId" , Types.STRING)
|
|
311
309
|
.add("adGroup1Id" , Types.LONG)
|
|
312
310
|
.add("adGroup2Id" , Types.LONG)
|
|
@@ -326,6 +324,7 @@ public class Ad extends AbstractOperation {
|
|
|
326
324
|
.add("details" , Types.STRING)
|
|
327
325
|
.add("urlData" , Types.STRING)
|
|
328
326
|
.add("parentAdId" , Types.STRING)
|
|
327
|
+
.add("createdAt" , Types.TIMESTAMP)
|
|
329
328
|
.build();
|
|
330
329
|
}
|
|
331
330
|
|
|
@@ -255,7 +255,6 @@ public class AdConversionAttribute extends AbstractOperation {
|
|
|
255
255
|
|
|
256
256
|
public Schema buildSchema() {
|
|
257
257
|
return Schema.builder()
|
|
258
|
-
.add("createdAt", Types.TIMESTAMP)
|
|
259
258
|
.add("amount", Types.LONG)
|
|
260
259
|
.add("conversionDate", Types.TIMESTAMP)
|
|
261
260
|
.add("conversionId", Types.LONG)
|
|
@@ -280,6 +279,7 @@ public class AdConversionAttribute extends AbstractOperation {
|
|
|
280
279
|
.add("other5", Types.STRING)
|
|
281
280
|
.add("terminalType", Types.LONG)
|
|
282
281
|
.add("userId", Types.STRING)
|
|
282
|
+
.add("createdAt", Types.TIMESTAMP)
|
|
283
283
|
.build();
|
|
284
284
|
}
|
|
285
285
|
}
|
|
@@ -25,13 +25,14 @@ import java.time.LocalDateTime;
|
|
|
25
25
|
import java.util.Date;
|
|
26
26
|
|
|
27
27
|
public class AdGroup1 extends AbstractOperation {
|
|
28
|
-
public int lastRecordId = 0;
|
|
29
|
-
|
|
30
28
|
public interface Condition extends Task {
|
|
31
29
|
//リクエストパラメータ無し
|
|
32
30
|
}
|
|
33
31
|
|
|
34
32
|
public void run(PageBuilder pageBuilder) {
|
|
33
|
+
int lastRecordId = 0;
|
|
34
|
+
int currentRecordId = 0;
|
|
35
|
+
|
|
35
36
|
Schema schema = pageBuilder.getSchema();
|
|
36
37
|
AdGroup1ManagementService adGroup1ManagementService;
|
|
37
38
|
try {
|
|
@@ -87,13 +88,11 @@ public class AdGroup1 extends AbstractOperation {
|
|
|
87
88
|
jp.ne.ebis.extreme.ws.entity.xsd.AdGroup1[] results = response.get_return();
|
|
88
89
|
for (jp.ne.ebis.extreme.ws.entity.xsd.AdGroup1 record : results) {
|
|
89
90
|
Boolean isExcluded = false;
|
|
90
|
-
|
|
91
|
+
currentRecordId = record.getAdGroup1Id();
|
|
91
92
|
if ( ! record.isAdGroup1IdSpecified()) {
|
|
92
93
|
break;
|
|
93
94
|
}
|
|
94
|
-
if (lastRecordId
|
|
95
|
-
lastRecordId = currentRecordId;
|
|
96
|
-
} else {
|
|
95
|
+
if (lastRecordId >= currentRecordId) {
|
|
97
96
|
continue;
|
|
98
97
|
}
|
|
99
98
|
for (Column c : schema.getColumns()) {
|
|
@@ -123,14 +122,14 @@ public class AdGroup1 extends AbstractOperation {
|
|
|
123
122
|
}
|
|
124
123
|
|
|
125
124
|
setLastRecordTime(Optional.of(newestRecordTime.format(embulkDateTimeFormat)));
|
|
126
|
-
setLastRecordId(Optional.of(String.valueOf(
|
|
125
|
+
setLastRecordId(Optional.of(String.valueOf(currentRecordId)));
|
|
127
126
|
}
|
|
128
127
|
|
|
129
128
|
public Schema buildSchema() {
|
|
130
129
|
return Schema.builder()
|
|
131
|
-
.add("createdAt" , Types.TIMESTAMP)
|
|
132
130
|
.add("adGroup1Id" , Types.LONG)
|
|
133
131
|
.add("adGroup1Name", Types.STRING)
|
|
132
|
+
.add("createdAt" , Types.TIMESTAMP)
|
|
134
133
|
.build();
|
|
135
134
|
}
|
|
136
135
|
}
|
|
@@ -25,13 +25,14 @@ import java.time.LocalDateTime;
|
|
|
25
25
|
import java.util.Date;
|
|
26
26
|
|
|
27
27
|
public class AdGroup2 extends AbstractOperation {
|
|
28
|
-
public int lastRecordId = 0;
|
|
29
|
-
|
|
30
28
|
public interface Condition extends Task {
|
|
31
29
|
//リクエストパラメータ無し
|
|
32
30
|
}
|
|
33
31
|
|
|
34
32
|
public void run(PageBuilder pageBuilder) {
|
|
33
|
+
int lastRecordId = 0;
|
|
34
|
+
int currentRecordId = 0;
|
|
35
|
+
|
|
35
36
|
Schema schema = pageBuilder.getSchema();
|
|
36
37
|
AdGroup2ManagementService adGroup2ManagementService;
|
|
37
38
|
try {
|
|
@@ -87,13 +88,11 @@ public class AdGroup2 extends AbstractOperation {
|
|
|
87
88
|
jp.ne.ebis.extreme.ws.entity.xsd.AdGroup2[] results = response.get_return();
|
|
88
89
|
for (jp.ne.ebis.extreme.ws.entity.xsd.AdGroup2 record : results) {
|
|
89
90
|
Boolean isExcluded = false;
|
|
90
|
-
|
|
91
|
+
currentRecordId = record.getAdGroup2Id();
|
|
91
92
|
if ( ! record.isAdGroup2IdSpecified()) {
|
|
92
93
|
break;
|
|
93
94
|
}
|
|
94
|
-
if (lastRecordId
|
|
95
|
-
lastRecordId = currentRecordId;
|
|
96
|
-
} else {
|
|
95
|
+
if (lastRecordId >= currentRecordId) {
|
|
97
96
|
continue;
|
|
98
97
|
}
|
|
99
98
|
for (Column c : schema.getColumns()) {
|
|
@@ -123,14 +122,14 @@ public class AdGroup2 extends AbstractOperation {
|
|
|
123
122
|
}
|
|
124
123
|
|
|
125
124
|
setLastRecordTime(Optional.of(newestRecordTime.format(embulkDateTimeFormat)));
|
|
126
|
-
setLastRecordId(Optional.of(String.valueOf(
|
|
125
|
+
setLastRecordId(Optional.of(String.valueOf(currentRecordId)));
|
|
127
126
|
}
|
|
128
127
|
|
|
129
128
|
public Schema buildSchema() {
|
|
130
129
|
return Schema.builder()
|
|
131
|
-
.add("createdAt" , Types.TIMESTAMP)
|
|
132
130
|
.add("adGroup2Id" , Types.LONG)
|
|
133
131
|
.add("adGroup2Name", Types.STRING)
|
|
132
|
+
.add("createdAt" , Types.TIMESTAMP)
|
|
134
133
|
.build();
|
|
135
134
|
}
|
|
136
135
|
}
|
|
@@ -24,13 +24,14 @@ import java.time.LocalDateTime;
|
|
|
24
24
|
import java.util.Date;
|
|
25
25
|
|
|
26
26
|
public class Media extends AbstractOperation {
|
|
27
|
-
public int lastRecordId = 0;
|
|
28
|
-
|
|
29
27
|
public interface Condition extends Task {
|
|
30
28
|
//リクエストパラメータ無し
|
|
31
29
|
}
|
|
32
30
|
|
|
33
31
|
public void run(PageBuilder pageBuilder) {
|
|
32
|
+
int lastRecordId = 0;
|
|
33
|
+
int currentRecordId = 0;
|
|
34
|
+
|
|
34
35
|
Schema schema = pageBuilder.getSchema();
|
|
35
36
|
MediaManagementService mediaManagementService;
|
|
36
37
|
try {
|
|
@@ -86,13 +87,11 @@ public class Media extends AbstractOperation {
|
|
|
86
87
|
jp.ne.ebis.extreme.ws.entity.xsd.Media[] results = response.get_return();
|
|
87
88
|
for (jp.ne.ebis.extreme.ws.entity.xsd.Media record : results) {
|
|
88
89
|
Boolean isExcluded = false;
|
|
89
|
-
|
|
90
|
+
currentRecordId = record.getMediaId();
|
|
90
91
|
if ( ! record.isMediaIdSpecified()) {
|
|
91
92
|
break;
|
|
92
93
|
}
|
|
93
|
-
if (lastRecordId
|
|
94
|
-
lastRecordId = currentRecordId;
|
|
95
|
-
} else {
|
|
94
|
+
if (lastRecordId >= currentRecordId) {
|
|
96
95
|
continue;
|
|
97
96
|
}
|
|
98
97
|
for (Column c : schema.getColumns()) {
|
|
@@ -122,14 +121,14 @@ public class Media extends AbstractOperation {
|
|
|
122
121
|
}
|
|
123
122
|
|
|
124
123
|
setLastRecordTime(Optional.of(newestRecordTime.format(embulkDateTimeFormat)));
|
|
125
|
-
setLastRecordId(Optional.of(String.valueOf(
|
|
124
|
+
setLastRecordId(Optional.of(String.valueOf(currentRecordId)));
|
|
126
125
|
}
|
|
127
126
|
|
|
128
127
|
public Schema buildSchema() {
|
|
129
128
|
return Schema.builder()
|
|
130
|
-
.add("createdAt", Types.TIMESTAMP)
|
|
131
129
|
.add("mediaId" , Types.LONG)
|
|
132
130
|
.add("mediaName", Types.STRING)
|
|
131
|
+
.add("createdAt", Types.TIMESTAMP)
|
|
133
132
|
.build();
|
|
134
133
|
}
|
|
135
134
|
}
|