/*
 * Copyright
 *   2007 axYus - www.axyus.com
 *   2007 C.Marchand - christophe.marchand@axyus.com
 *
 * This file is part of XEMELIOS.
 *
 * XEMELIOS is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * XEMELIOS is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with XEMELIOS; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */



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

import fr.gouv.finances.dgfip.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);
        }
    }

}
