Code Search for Developers
 
 
  

ImportPriceListTest.java from riverock at Krugle


Show ImportPriceListTest.java syntax highlighted

/*
 * org.riverock.commerce - Commerce application
 *
 * Copyright (C) 2006, Riverock Software, All Rights Reserved.
 *
 * Riverock - The Open-source Java Development Community
 * http://www.riverock.org
 *
 *
 * This program 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.
 *
 * This library 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 this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */
package org.riverock.commerce.price;

import java.io.FileInputStream;
import java.util.List;

import org.riverock.commerce.schema.import_price.PricesType;
import org.riverock.commerce.schema.import_price.PriceListType;
import org.riverock.commerce.schema.import_price.PriceListItemType;
import org.riverock.commerce.tools.HibernateUtilsTest;
import org.riverock.common.tools.XmlTools;
import org.riverock.common.collections.TreeUtils;

/**
 * @author Sergei Maslyukov
 *         Date: 11.12.2006
 *         Time: 22:33:07
 *         <p/>
 *         $Id$
 */
public class ImportPriceListTest {
    public static void main(String[] args) throws Exception {
        HibernateUtilsTest.prepareSession();

        PricesType prices = XmlTools.getObjectFromXml(PricesType.class, new FileInputStream(args[0]));
        for (PriceListType price : prices.getPriceList()) {

            List<PriceListItemType> items = (List) TreeUtils.rebuildTree((List)price.getItem());
            items = (List)TreeUtils.toPlainList((List) ImportPriceList.deleteUselessItem(items));
            price.setItem(items);
        }

        ImportPriceList.process(prices, 16L);
    }
}




See more files for this project here

riverock

Main project of riverock is Webmill portal. Webmill is CMS portal with build-in XML/XSLT transformation of content of portlet, JSR-168, JSF and other things.

Project homepage: http://sourceforge.net/projects/riverock
Programming language(s): Java,JSP,SQL,XML
License: other

  ImportPriceListTest.java