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: VisualDataSetDescriptor.java
13   * Created: 2009-05-19
14   * Author: tmilos
15   * $Id: VisualDataSetDescriptor.java 3558 2009-11-10 16:21:57Z tmilos $
16   */
17  
18  package pl.edu.agh.cast.data.model.visual;
19  
20  import java.util.Date;
21  import java.util.UUID;
22  
23  import pl.edu.agh.cast.data.model.DataSetDescriptor;
24  import pl.edu.agh.cast.data.model.Type;
25  import pl.edu.agh.cast.data.model.presentation.PresentationDataSetDescriptor;
26  
27  /**
28   * Enhanced descriptor of a domain data set (see {@link IVisualDataSet}).
29   *
30   * @author AGH CAST Team
31   */
32  public final class VisualDataSetDescriptor extends DataSetDescriptor {
33  
34  	/**
35  	 * Serial version UID.
36  	 */
37      private static final long serialVersionUID = -7229963240037929886L;
38  
39      private PresentationDataSetDescriptor presentationDescriptor;
40  
41  	/**
42  	 * Default constructor.
43  	 *
44  	 * <p>
45  	 * Usage of this constructor is discouraged, since it does not provide any integrity control. If, however, this
46  	 * constructor is used, the {@link #isValid()} method should be called in order to check the integrity.
47  	 */
48  	public VisualDataSetDescriptor() {
49  	}
50  
51  	/**
52  	 * Initializes descriptor with type.
53  	 *
54  	 * <p>
55  	 * The ID has to be set manually - until then the data set descriptor is <strong>invalid</strong>.
56  	 *
57  	 * @param type
58  	 *            the data set type
59  	 */
60  	public VisualDataSetDescriptor(Type type) {
61  		super(type);
62  	}
63  
64  	/**
65  	 * Constructor for descriptors of new data sets.
66  	 *
67  	 * <p>
68  	 * The new descriptor has a random ID and current creation date.
69  	 *
70  	 * @param type
71  	 *            the data set type
72  	 * @param name
73  	 *            the data set name
74  	 */
75  	public VisualDataSetDescriptor(Type type, String name) {
76  		super(type, name);
77  	}
78  
79  	/**
80  	 * Constructor.
81  	 *
82  	 * @param id
83  	 *            the data set ID
84  	 * @param type
85  	 *            the data set type
86  	 * @param name
87  	 *            the data set name
88  	 * @param creationDate
89  	 *            the data set creation date
90  	 */
91  	public VisualDataSetDescriptor(UUID id, Type type, String name, Date creationDate) {
92  		this(id, type, name, creationDate, null);
93  	}
94  
95  	/**
96  	 * Constructor.
97  	 *
98  	 * @param id
99  	 *            the data set ID
100 	 * @param type
101 	 *            the data set type
102 	 * @param name
103 	 *            the data set name
104 	 * @param creationDate
105 	 *            the data set creation date
106 	 * @param descriptor
107 	 *            presentation data set descriptor
108 	 */
109 	public VisualDataSetDescriptor(UUID id, Type type, String name, Date creationDate,
110 	        PresentationDataSetDescriptor descriptor) {
111 		super(type, id, name, creationDate);
112 		setPresentationDataSetDescriptor(descriptor);
113 	}
114 
115 	/**
116 	 * Gets the descriptor of presentation data set wrapped by visual data set described by this descriptor.
117 	 *
118 	 * @return presentation data set descriptor
119 	 *
120 	 * @see PresentationDataSetDescriptor
121 	 */
122 	public PresentationDataSetDescriptor getPresentationDataSetDescriptor() {
123 		return this.presentationDescriptor;
124 	}
125 
126 	/**
127 	 * Sets the descriptor of presentation data set wrapped by visual data set described by this descriptor.
128 	 *
129 	 * @param descriptor
130 	 *            presentation data set descriptor
131 	 *
132 	 * @see PresentationDataSetDescriptor
133 	 */
134 	public void setPresentationDataSetDescriptor(PresentationDataSetDescriptor descriptor) {
135 		this.presentationDescriptor = descriptor;
136 	}
137 
138 }