<commit_before>/**
 * Copyright (C) 2014 Stratio (http://stratio.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.stratio.ingestion.morphline.checkpointfilter.type;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;

import org.kitesdk.morphline.api.Record;

/**
 * Created by eambrosio on 14/01/15.
 */
public class DateCheckpointType implements CheckpointType {

    private static final String CONF_DATE_PATTERN = "datePattern";
    private static final String ISO_8601_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ssXXX";
    private static final String CONF_CHECKPOINT_VALUE = "checkpointValue";

    @Override
    public String buildCheckpoint(Object fieldValue, Map<String, String> context) {
        //        Record newRecord = new Record();
        //        newRecord.put(context.get("field"), new SimpleDateFormat(getDatePattern(context)).format(fieldValue));
        //        newRecord.put("checkpoint", "true");
        //        return newRecord;
        return new SimpleDateFormat(getDatePattern(context)).format(fieldValue);<commit_msg>fix: change property name to retrieve dateformat<commit_after>/**
 * Copyright (C) 2014 Stratio (http://stratio.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.stratio.ingestion.morphline.checkpointfilter.type;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;

import org.kitesdk.morphline.api.Record;

/**
 * Created by eambrosio on 14/01/15.
 */
public class DateCheckpointType implements CheckpointType {

    private static final String CONF_DATE_PATTERN = "format";
    private static final String ISO_8601_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ssXXX";

    @Override
    public String buildCheckpoint(Object fieldValue, Map<String, String> context) {
        //        Record newRecord = new Record();
        //        newRecord.put(context.get("field"), new SimpleDateFormat(getDatePattern(context)).format(fieldValue));
        //        newRecord.put("checkpoint", "true");
        //        return newRecord;
        return new SimpleDateFormat(getDatePattern(context)).format(fieldValue);
{'fraction_non_alphanumeric': 0.09731232622798888, 'fraction_numerical': 0.011121408711770158, 'mean_word_length': 3.7478005865102637, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5223486', 'n_tokens_mistral': 905, 'n_tokens_neox': 870, 'n_words': 291}