001 /** 002 * Copyright 2005-2011 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.kuali.rice.kew.xml; 017 018 import java.io.InputStream; 019 020 import org.jdom.Element; 021 import org.kuali.rice.core.api.impex.ExportDataSet; 022 import org.kuali.rice.core.api.exception.RiceRuntimeException; 023 import org.kuali.rice.core.framework.impex.xml.XmlExporter; 024 import org.kuali.rice.core.framework.impex.xml.XmlLoader; 025 import org.kuali.rice.kew.xml.export.GroupXmlExporter; 026 027 public class GroupXmlServiceImpl implements XmlLoader, XmlExporter{ 028 029 public void loadXml(InputStream inputStream, String principalId) { 030 GroupXmlParser parser = new GroupXmlParser(); 031 try { 032 parser.parseGroups(inputStream); 033 } catch (Exception e) { 034 throw new RiceRuntimeException("Error loading xml file", e); 035 } 036 } 037 038 @Override 039 public boolean supportPrettyPrint() { 040 return true; 041 } 042 043 /** 044 * This overridden method ... 045 * 046 * @see org.kuali.rice.core.framework.impex.xml.XmlExporter#export(org.kuali.rice.core.api.impex.ExportDataSet) 047 */ 048 public Element export(ExportDataSet dataSet) { 049 GroupXmlExporter exporter = new GroupXmlExporter(); 050 return exporter.export(dataSet); 051 } 052 053 054 }