<commit_before>/*
 * Copyright  1999-2004 The Apache Software Foundation
 *
 *  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.
 *
 */

/* $Id: NewBlogEntryCreator.java,v 1.6 2004/05/11 07:38:44 gregor Exp $  */

package org.apache.lenya.cms.authoring;

import org.apache.log4j.Category;

import org.apache.avalon.framework.configuration.Configuration;

import org.w3c.dom.Document;

import org.apache.lenya.ac.Identity;
import org.apache.lenya.xml.DOMUtil;

import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Map;
import java.util.Date;

public class NewBlogEntryCreator extends DefaultBranchCreator {
    private static Category log = Category.getInstance(NewBlogEntryCreator.class);

    private String year;
    private String month;
    private String day;
    private Date date;

    /**
     *
     */
    public void init(Configuration conf) {
        super.init(conf);

        DateFormat fmtyyyy = new SimpleDateFormat("yyyy");
        DateFormat fmtMM = new SimpleDateFormat("MM");
        DateFormat fmtdd = new SimpleDateFormat("dd");
        date = new Date();

        year = fmtyyyy.format(date);
        month = fmtMM.format(date);
        day = fmtdd.format(date);

        log.error(".init(): Initialize Creator: " + year + "/" + month + "/" + day);
    }

    /**
     *
     */
    protected String getChildFileName(File parentDir, String childId, String language) {
        String newFilename = parentDir + File.separator + "entries" + File.separator + year + File.separator + month + "/" + day + "/" + childId + "/index.xml";
        log.error(".getChildFileName(): " + newFilename);
        return newFilename;
    }

    /**
     *
     */
    protected void transformXML(Document doc, String childId, short childType, String childName, Map parameters) throws Exception {
        log.error(".transformXML(): " + childId);
        DOMUtil du = new DOMUtil();

        // Replace id<commit_msg>BAD practice to log standard messages with log.error.<commit_after>/*
 * Copyright  1999-2004 The Apache Software Foundation
 *
 *  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.
 *
 */

/* $Id$  */

package org.apache.lenya.cms.authoring;

import org.apache.log4j.Category;

import org.apache.avalon.framework.configuration.Configuration;

import org.w3c.dom.Document;

import org.apache.lenya.ac.Identity;
import org.apache.lenya.xml.DOMUtil;

import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Map;
import java.util.Date;

public class NewBlogEntryCreator extends DefaultBranchCreator {
    private static Category log = Category.getInstance(NewBlogEntryCreator.class);

    private String year;
    private String month;
    private String day;
    private Date date;

    /**
     *
     */
    public void init(Configuration conf) {
        super.init(conf);

        DateFormat fmtyyyy = new SimpleDateFormat("yyyy");
        DateFormat fmtMM = new SimpleDateFormat("MM");
        DateFormat fmtdd = new SimpleDateFormat("dd");
        date = new Date();

        year = fmtyyyy.format(date);
        month = fmtMM.format(date);
        day = fmtdd.format(date);

        log.error(".init(): Initialize Creator: " + year + "/" + month + "/" + day);
    }

    /**
     *
     */
    protected String getChildFileName(File parentDir, String childId, String language) {
        String newFilename = parentDir + File.separator + "entries" + File.separator + year + File.separator + month + "/" + day + "/" + childId + "/index.xml";
        log.error(".getChildFileName(): " + newFilename);
        return newFilename;
    }

    /**
     *
     */
    protected void transformXML(Document doc, String childId, short childType, String childName, Map parameters) throws Exception {
        log.debug(".transformXML(): " + childId);
        DOMUtil du = new DOMUtil();

        // Replace id
{'fraction_non_alphanumeric': 0.10786250493875939, 'fraction_numerical': 0.00869221651521138, 'mean_word_length': 3.079774375503626, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, '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': '2566618', 'n_tokens_mistral': 1467, 'n_tokens_neox': 1406, 'n_words': 436}