package focusedCrawler.memex.cdr;

import java.util.Date;
import java.util.Map;
import java.util.List;
import java.util.HashMap;
import java.util.Map.Entry;

import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.StringJoiner;


public class CDR31MediaObject {

    private String objOriginalUrl;
    private String objStoredUrl;
    private String contentType;
    private Date timestampCrawl;
    private Map<String, String> responseHeaders;

    public void setObjOriginalUrl(String objOriginalUrl) {
        this.objOriginalUrl = objOriginalUrl;
    }

    public void setContentType(String contentType) {
        this.contentType = contentType;
    }

    public void setObjStoredUrl(String objStoredUrl) {
        this.objStoredUrl = objStoredUrl;
    }

    public void setTimestampCrawl(Date timestampCrawl) {
        this.timestampCrawl = timestampCrawl;
    }   

    public void setResponseHeaders(Map<String, List<String>> responseHeaders) {
        this.responseHeaders = new HashMap<>();
        for (Entry<String, List<String>> header : responseHeaders.entrySet()) {
            if (header.getValue() != null) {
                StringJoiner joiner = new StringJoiner(",");
                for (String value : header.getValue()) {
                    joiner.add(value);
                }
                this.responseHeaders.put(header.getKey(), joiner.toString());
            }
        }
    }

    @JsonProperty("obj_original_url")
    public String getObjOriginalUrl() {
        return this.objOriginalUrl;
    }

    @JsonProperty("obj_stored_url")
    public String getObjStoredUrl() {
        return this.objStoredUrl;
    }

    @JsonProperty("content_type")
    public String getContentType() {
        return this.contentType;
    }

    @JsonProperty("timestamp_crawl")
    public Date getTimestampCrawl() {
        return this.timestampCrawl;
    }

    @JsonProperty("response_headers")
    public Map<String, String> getResponseHeaders() {
        return this.responseHeaders;
    }

}

@@ -147,24 +147,76 @@
 Map.Entry;%0A%0A
+import com.fasterxml.jackson.annotation.JsonFormat;%0A
 import com.f
@@ -1812,32 +1812,119 @@
 entType;%0A    %7D%0A%0A
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = %22yyyy-MM-dd'T'HH:mm:ss'Z'%22)%0A
     @JsonPropert

Fix date format of CDRv3.1 media object