package net.sourceforge.rtf.usecases.templateEngine;

import java.io.File;

import net.sourceforge.rtf.helper.RTFTemplateBuilder;
import net.sourceforge.rtf.template.IContext;
import net.sourceforge.rtf.usecases.AbstractTemplateEngineUseCase;
import net.sourceforge.rtf.usecases.util.UseCaseUtil;

public class TestEncodingWithVelocity extends AbstractTemplateEngineUseCase {

    public TestEncodingWithVelocity(String outDirectory) {
        super(outDirectory);
    }
    protected void putContext(IContext context) {
    	
    	String s = "\u049a\u044b\u0437\u043c\u0435\u0442\u0442\u0456 \u0430\u0442\u049b\u0430\u0440\u0443\u0448\u044b\u043d\u044b\u04a3 \u0442\u0456\u0440\u043a\u0435\u043b\u0443 \u043d\u04e9\u043c\u0456\u0440\u0456";
    	context.put("encodingValue", s);
    	
    	
    	//context.put("encodingValue", "Wildh\u00FCnherstra\u00DFe 5");
    	context.put("encodingValue", "\u049a");
    }

    
    
    public static void main(String[] args) throws Exception {
        String baseDirectory = UseCaseUtil.getBaseDirectory(args);
        String outDirectory = baseDirectory + "usecases/out/encoding";
        // Create out Directory
        File out = new File(outDirectory);
        out.mkdir();
        
        //String modelSource = baseDirectory + "usecases/models/encoding/charset_test.vm";
        String modelSource = baseDirectory + "usecases/models/encoding/encoding.rtf";
        
        TestEncodingWithVelocity usecase = new TestEncodingWithVelocity(outDirectory);
        usecase.setTemplateEngineType(RTFTemplateBuilder.VELOCITY_ENGINE);
        usecase.run(modelSource);
        
    }    

}
