/*
 * UriTransformer.java
 *
 * Created on 3 d�cembre 2007, 11:38
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */


package fr.gouv.finances.cp.xemelios.pesv2;

import fr.gouv.finances.cp.xemelios.utils.AbstractUriTransformer;
import java.util.Hashtable;

/**
 *
 * @author chm
 */
public class UriTransformer extends AbstractUriTransformer {
    
    /** Creates a new instance of UriTransformer */
    public UriTransformer() {
    }

    public void transformUriParam(String paramName, String paramValue, Hashtable<String, Object> xslParams) {
        if("path".equals(paramName)) {
            // path is [@added:primary-key='2006-01-1000']
            String sTmp = paramValue.substring(1,paramValue.length()-2);
            String[] vals = sTmp.split("=");
            if("@added:primary-key".equals(vals[0])) {
                if(vals.length > 1) {
                    String pk = vals[1].substring(1,vals[1].length());
                    xslParams.put("primaryKey",pk);
                }
                return;
            }
            System.err.println("error processing "+paramName+"="+paramValue);
        }
    }

}
