Final commit incl. encrypted logs and data

This commit is contained in:
GEXCE
2017-11-28 16:09:40 +01:00
parent 846c16df8e
commit 88ad66867b
7 changed files with 66 additions and 13 deletions
Binary file not shown.
@@ -2,4 +2,4 @@
logging.level.com.bayer=DEBUG
#logging.level.com.bayer.edam.migration.interceptors=INFO
logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss} %-5level- %msg%n
logging.file=application_2017-11-28_PROD_search.log
logging.file=application_2017-11-28_PROD_fix.log
@@ -99,6 +99,7 @@ public class MamMigrationSelective implements CommandLineRunner {
private int entryCounter = 0;
private int skippedCounter = 0;
private long lastLogin = 0;
private int searchCount = 0;
private static DecimalFormat decimalFormat = new DecimalFormat("#,##0.#");
private SimpleDateFormat isoDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'");
@@ -126,10 +127,10 @@ public class MamMigrationSelective implements CommandLineRunner {
// XXX ----------------------------------------------------------------
// Option 1: Process all available entries
entrySelection = new ArrayList<Long>(entryMap.keySet());
// entrySelection = new ArrayList<Long>(entryMap.keySet());
// Option 2: Process a fixed set of entry IDs
// entrySelection = Arrays.asList(34703L, 34702L, 34701L, 34700L, 34699L, 34698L, 33626L, 33623L, 33621L, 33620L, 32781L, 31114L);
entrySelection = Arrays.asList(55803L, 55802L);
// Option 3: Read entry IDs from file
// entrySelection = new ArrayList<Long>();
@@ -557,15 +558,14 @@ public class MamMigrationSelective implements CommandLineRunner {
// Create record
HttpEntity<UploadRecord> httpEntity = new HttpEntity<UploadRecord>(record, adamHeaders);
try {
URI location = restTemplate.postForLocation(Definitions.adamHost + "/records", httpEntity, UploadRecord.class);
log.info("RESULT Entry " + entry.id + " migrated to record " + location);
uploadFilesForEntry(entry, location);
log.info("FINAL " + entry.id + fieldSeparator + location.toString() + fieldSeparator + entryJson);
// XXX
// URI location = restTemplate.postForLocation(Definitions.adamHost + "/records", httpEntity, UploadRecord.class);
// log.info("RESULT Entry " + entry.id + " migrated to record " + location);
//
// uploadFilesForEntry(entry, location);
// log.info("FINAL " + entry.id + fieldSeparator + location.toString() + fieldSeparator + entryJson);
searchForRecord(entry, entryJson);
// searchForRecord(entry, entryJson);
} catch (HttpClientErrorException hcee) {
log.error("RESULT Could not create record for entry " + entry.id + ", Exception: " + hcee.getMessage() + ", "
@@ -585,7 +585,7 @@ public class MamMigrationSelective implements CommandLineRunner {
*/
private void searchForRecord(Entry entry, String entryJson) throws URISyntaxException, IOException, ZipException {
adamSearchHeaders.set("Filter", "classification.name=Migration-MAM-KW47 " + entry.id);
log.debug("Searching for: classification.name=Migration-MAM-KW47 " + entry.id);
log.debug("Searching for: 'classification.name=Migration-MAM-KW47 " + entry.id + "' (" + ++searchCount + ")");
// search the already existing record
SearchRecordResult searchResult = restTemplate.exchange(Definitions.adamHost + "/records", HttpMethod.GET, new HttpEntity<String>("", adamSearchHeaders), SearchRecordResult.class).getBody();
@@ -623,7 +623,7 @@ public class MamMigrationSelective implements CommandLineRunner {
i++;
}
if (fileVersion.fileName.equals(expectedFile.getName())) {
if (fileVersion != null && fileVersion.fileName.equals(expectedFile.getName())) {
log.info("Found expected file for " + location.toString() + ": " + fileVersion.fileName + ", " + fileVersion.fileSize);
}
else {
@@ -0,0 +1,9 @@
package com.bayer.edam.migration.adam;
import java.util.List;
public class FileList {
public List<ReadFile> items;
}
@@ -0,0 +1,23 @@
package com.bayer.edam.migration.adam;
import java.util.Date;
import java.util.List;
public class FileVersions {
public static class FileVersion {
public String id;
public String fileName;
public Date fileCreatedOn;
public Date fileModifiedOn;
public long fileSize;
public String fileExtension;
public String comment;
public long crc32;
public Date createdOn;
}
public List<FileVersion> items;
}
@@ -0,0 +1,10 @@
package com.bayer.edam.migration.adam;
import java.util.Date;
public class ReadFile {
public String id;
public Date createdOn;
}
@@ -0,0 +1,11 @@
package com.bayer.edam.migration.adam;
import java.util.List;
public class SearchRecordResult {
public int page;
public int totalCount;
public List<ReadRecord> items;
}