View Javadoc

1   /*
2    * This file is a part of CAST project.
3    * (c) Copyright 2007, AGH University of Science & Technology
4    * https://caribou.iisg.agh.edu.pl/trac/cast
5    *
6    * Licensed under the Eclipse Public License, Version 1.0 (the "License").
7    * You may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    * http://www.eclipse.org/legal/epl-v10.html
10   */
11  /*
12   * File: XMLProjectContainer.java
13   * Created: 2007-00-00
14   * Author: kpietak
15   * $Id: XMLProjectContainer.java 3020 2009-07-17 14:41:19Z kpietak $
16   */
17  
18  package pl.edu.agh.cast.backward.resources.xml;
19  
20  import java.util.List;
21  
22  import pl.edu.agh.cast.backward.resources.IProjectContainer;
23  import pl.edu.agh.cast.model.visual.backward.IDiagram;
24  
25  import com.thoughtworks.xstream.annotations.XStreamAlias;
26  import com.thoughtworks.xstream.annotations.XStreamImplicit;
27  
28  /**
29   * Helper for XML exporter/importer, used to embed list of {@link IDiagram} objects and project name.
30   *
31   * XStream cannot manipulate tag name of single instance of Collection and uses default name (eg. <linked-list>).
32   *
33   * @author AGH CAST Team
34   */
35  @XStreamAlias("diagrams")
36  public class XMLProjectContainer implements IProjectContainer {
37  
38  	/**
39  	 * Project name.
40  	 */
41  	@XStreamAlias("name")
42  	private String projectName;
43  
44  	/**
45  	 * List of project diagrams.
46  	 */
47  	@XStreamImplicit(itemFieldName = "diagram")
48  	private List<IDiagram> diagrams;
49  
50  	/**
51  	 * Creates new XML project container.
52  	 *
53  	 * @param projectName
54  	 *            project name
55  	 * @param diagrams
56  	 *            list of project diagrams
57  	 */
58  	public XMLProjectContainer(String projectName, List<IDiagram> diagrams) {
59  		this.projectName = projectName;
60  		this.diagrams = diagrams;
61  	}
62  
63  	public List<IDiagram> getDiagrams() {
64  		return diagrams;
65  	}
66  
67  	public String getProjectName() {
68  		return projectName;
69  	}
70  
71  	public void setProjectName(String name) {
72  		this.projectName = name;
73  	}
74  
75  	public void setDiagrams(List<IDiagram> diagrams) {
76  		this.diagrams = diagrams;
77  	}
78  
79  }