Lottery upload
This commit is contained in:
@@ -2,4 +2,4 @@
|
|||||||
logging.level.com.bayer=DEBUG
|
logging.level.com.bayer=DEBUG
|
||||||
#logging.level.com.bayer.edam.migration.interceptors=INFO
|
#logging.level.com.bayer.edam.migration.interceptors=INFO
|
||||||
logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss} %-5level- %msg%n
|
logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss} %-5level- %msg%n
|
||||||
logging.file=entrylist_2017-11-09.log
|
logging.file=application_2017-11-09_QA.log
|
||||||
|
|||||||
@@ -0,0 +1,166 @@
|
|||||||
|
00071725
|
||||||
|
00071263
|
||||||
|
00071048
|
||||||
|
00070778
|
||||||
|
00070746
|
||||||
|
00070745
|
||||||
|
00070440
|
||||||
|
00070361
|
||||||
|
00070340
|
||||||
|
00070288
|
||||||
|
00070161
|
||||||
|
00070142
|
||||||
|
00063924
|
||||||
|
00063201
|
||||||
|
00057641
|
||||||
|
00056942
|
||||||
|
00044946
|
||||||
|
00032198
|
||||||
|
00035197
|
||||||
|
00033494
|
||||||
|
00061180
|
||||||
|
00033723
|
||||||
|
00071362
|
||||||
|
00032896
|
||||||
|
00031042
|
||||||
|
00028565
|
||||||
|
00039300
|
||||||
|
00053100
|
||||||
|
00034774
|
||||||
|
00036124
|
||||||
|
00045245
|
||||||
|
00052063
|
||||||
|
00036032
|
||||||
|
00042181
|
||||||
|
00046441
|
||||||
|
00029240
|
||||||
|
00037305
|
||||||
|
00044955
|
||||||
|
00071136
|
||||||
|
00033886
|
||||||
|
00032721
|
||||||
|
00042050
|
||||||
|
00030567
|
||||||
|
00032708
|
||||||
|
00027378
|
||||||
|
00043880
|
||||||
|
00036696
|
||||||
|
00053782
|
||||||
|
00049170
|
||||||
|
00035119
|
||||||
|
00070508
|
||||||
|
00030548
|
||||||
|
00032109
|
||||||
|
00027864
|
||||||
|
00071207
|
||||||
|
00071290
|
||||||
|
00032082
|
||||||
|
00028880
|
||||||
|
00034794
|
||||||
|
00055234
|
||||||
|
00061400
|
||||||
|
00035802
|
||||||
|
00027327
|
||||||
|
00027140
|
||||||
|
00046040
|
||||||
|
00048113
|
||||||
|
00071100
|
||||||
|
00046479
|
||||||
|
00030887
|
||||||
|
00056968
|
||||||
|
00034144
|
||||||
|
00057192
|
||||||
|
00037723
|
||||||
|
00042148
|
||||||
|
00033492
|
||||||
|
00037791
|
||||||
|
00036141
|
||||||
|
00039045
|
||||||
|
00030676
|
||||||
|
00037771
|
||||||
|
00027465
|
||||||
|
00034204
|
||||||
|
00041875
|
||||||
|
00028553
|
||||||
|
00062220
|
||||||
|
00036073
|
||||||
|
00041224
|
||||||
|
00034061
|
||||||
|
00035902
|
||||||
|
00030374
|
||||||
|
00037598
|
||||||
|
00045294
|
||||||
|
00045547
|
||||||
|
00035879
|
||||||
|
00045346
|
||||||
|
00027593
|
||||||
|
00041478
|
||||||
|
00035793
|
||||||
|
00071317
|
||||||
|
00057290
|
||||||
|
00060762
|
||||||
|
00037390
|
||||||
|
00040240
|
||||||
|
00028592
|
||||||
|
00028182
|
||||||
|
00032949
|
||||||
|
00051060
|
||||||
|
00035221
|
||||||
|
00071832
|
||||||
|
00042461
|
||||||
|
00036792
|
||||||
|
00042040
|
||||||
|
00042072
|
||||||
|
00038987
|
||||||
|
00030383
|
||||||
|
00030571
|
||||||
|
00045233
|
||||||
|
00059700
|
||||||
|
00036942
|
||||||
|
00028314
|
||||||
|
00063620
|
||||||
|
00028545
|
||||||
|
00029028
|
||||||
|
00043920
|
||||||
|
00046061
|
||||||
|
00029732
|
||||||
|
00070742
|
||||||
|
00039067
|
||||||
|
00031123
|
||||||
|
00071537
|
||||||
|
00057503
|
||||||
|
00030955
|
||||||
|
00060540
|
||||||
|
00041242
|
||||||
|
00030160
|
||||||
|
00028367
|
||||||
|
00042353
|
||||||
|
00034705
|
||||||
|
00044741
|
||||||
|
00027631
|
||||||
|
00058544
|
||||||
|
00027149
|
||||||
|
00045090
|
||||||
|
00058537
|
||||||
|
00034777
|
||||||
|
00054560
|
||||||
|
00028622
|
||||||
|
00042489
|
||||||
|
00027662
|
||||||
|
00027546
|
||||||
|
00028560
|
||||||
|
00028491
|
||||||
|
00044939
|
||||||
|
00070639
|
||||||
|
00045011
|
||||||
|
00029640
|
||||||
|
00047103
|
||||||
|
00041135
|
||||||
|
00028018
|
||||||
|
00032347
|
||||||
|
00035759
|
||||||
|
00028884
|
||||||
|
00041227
|
||||||
|
00029097
|
||||||
|
00059929
|
||||||
|
00042303
|
||||||
@@ -72,6 +72,10 @@ public class MamMigrationSelective implements CommandLineRunner {
|
|||||||
static final String categoryJson = "resources/2017-10-19_categories.json";
|
static final String categoryJson = "resources/2017-10-19_categories.json";
|
||||||
static final String categoryMapping = "resources/Media_Assistant_Categories_131017_EDITED_without_archive.csv";
|
static final String categoryMapping = "resources/Media_Assistant_Categories_131017_EDITED_without_archive.csv";
|
||||||
|
|
||||||
|
// XXX
|
||||||
|
// static final String entryListPath = "resources/entrylist_2017-10-25.txt";
|
||||||
|
static final String entryListPath = "resources/lottery.txt";
|
||||||
|
|
||||||
@Value("${mam.auth}")
|
@Value("${mam.auth}")
|
||||||
private String mamAuth;
|
private String mamAuth;
|
||||||
|
|
||||||
@@ -99,7 +103,7 @@ public class MamMigrationSelective implements CommandLineRunner {
|
|||||||
public void run(String... strings) throws Exception {
|
public void run(String... strings) throws Exception {
|
||||||
|
|
||||||
// XXX
|
// XXX
|
||||||
// readEntryIDsFromFile();
|
readEntryIDsFromFile();
|
||||||
|
|
||||||
log.info("Read categories");
|
log.info("Read categories");
|
||||||
mamCategoryTree = new CategoryTree(categoryJson, categoryMapping);
|
mamCategoryTree = new CategoryTree(categoryJson, categoryMapping);
|
||||||
@@ -683,7 +687,7 @@ public class MamMigrationSelective implements CommandLineRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void readEntryIDsFromFile() throws IOException {
|
private void readEntryIDsFromFile() throws IOException {
|
||||||
File entryIdListFile = new File("resources/entrylist_2017-10-25.txt");
|
File entryIdListFile = new File(entryListPath);
|
||||||
log.debug("Reading entry IDs from " + entryIdListFile.getAbsolutePath());
|
log.debug("Reading entry IDs from " + entryIdListFile.getAbsolutePath());
|
||||||
List<String> entryIdList = FileUtils.readLines(entryIdListFile, Charset.forName("utf-8"));
|
List<String> entryIdList = FileUtils.readLines(entryIdListFile, Charset.forName("utf-8"));
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package com.bayer.edam.migration.attic;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import com.bayer.edam.migration.EntryDownloader;
|
||||||
|
|
||||||
|
public class Lottery {
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(Lottery.class);
|
||||||
|
|
||||||
|
private static final String idFile = "C:\\Users\\gexce\\git\\mam-migration\\AH MAM Migration\\resources\\entrylist_2017-10-25.txt";
|
||||||
|
private static final File outputFile = new File("lottery.txt");
|
||||||
|
|
||||||
|
private static final String[] entrySelection = new String[] {"00071725", "00071263", "00071048", "00070778", "00070746", "00070745", "00070440", "00070361", "00070340",
|
||||||
|
"00070288", "00070161", "00070142", "00063924", "00063201", "00057641", "00056942"};
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
try {
|
||||||
|
List<String> lines = FileUtils.readLines(new File(idFile), "UTF-8");
|
||||||
|
List<Integer> drawn = new ArrayList<Integer>();
|
||||||
|
Random generator = new Random();
|
||||||
|
|
||||||
|
for (int i = 0; i < entrySelection.length; i++) {
|
||||||
|
Integer id = Integer.parseInt(entrySelection[i]);
|
||||||
|
drawn.add(id);
|
||||||
|
FileUtils.writeStringToFile(outputFile, entrySelection[i] + "\n", Charset.forName("utf-8"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("Start draw");
|
||||||
|
for (int i = 0; i < 150; i++) {
|
||||||
|
int ticket;
|
||||||
|
do {
|
||||||
|
ticket = generator.nextInt(lines.size());
|
||||||
|
} while (drawn.contains(ticket));
|
||||||
|
|
||||||
|
drawn.add(ticket);
|
||||||
|
if (lines.get(ticket).length() > 0)
|
||||||
|
FileUtils.writeStringToFile(outputFile, lines.get(ticket) + "\n", Charset.forName("utf-8"), true);
|
||||||
|
log.info(i + "...");
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user