/*******************************************************************************
* Copyright (c) 2009, 2010 Innovation Gate GmbH.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Innovation Gate GmbH - initial API and implementation
******************************************************************************/
package de.innovationgate.eclipse.wgadesigner.models;
import java.util.HashSet;
import java.util.Set;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.Dom4JDriver;
public class DesignTemplateStore {
private Set<DesignTemplate> _templates;
public DesignTemplateStore(){
_templates = new HashSet<DesignTemplate>();
}
public Set<DesignTemplate> getTemplates() {
return _templates;
}
public void addTemplate(DesignTemplate template) {
_templates.add(template);
}
public void removeTemplate(DesignTemplate template){
_templates.remove(template);
}
public static String asXML(DesignTemplateStore ts){
return new XStream().toXML(ts);
}
public static DesignTemplateStore fromXML(String xml){
XStream xstream = new XStream(new Dom4JDriver());
return (DesignTemplateStore)xstream.fromXML(xml);
}
}