2
2
* License information at https://github.com/Caltech-IPAC/firefly/blob/master/License.txt
3
3
*/
4
4
5
- /*
6
- * License information at https://github.com/Caltech-IPAC/firefly/blob/master/License.txt
7
- */
8
-
9
5
package edu .caltech .ipac .firefly .data ;
10
6
11
-
12
7
import edu .caltech .ipac .firefly .visualize .RequestType ;
13
8
import edu .caltech .ipac .firefly .visualize .WebPlotRequest ;
14
-
15
9
import java .io .Serializable ;
16
10
import java .util .HashMap ;
17
11
import java .util .Map ;
@@ -26,66 +20,100 @@ public class RelatedData implements Serializable {
26
20
27
21
private String dataType = "" ; // image or table
28
22
private String desc ;
23
+ /** related dataKey should be a unique string for a fits file */
24
+ private String dataKey ;
29
25
private Map <String ,String > searchParams = new HashMap <>();
30
26
private Map <String ,String > availableMask = new HashMap <>();
31
27
32
28
33
29
private RelatedData () {}
34
30
35
- public static RelatedData makeMaskRelatedData (String fileName , Map <String ,String > availableMask , int extensionNumber ) {
36
- RelatedData d = new RelatedData ();
37
- d .dataType = IMAGE_MASK ;
38
- d .availableMask = availableMask ;
39
-
40
- d .desc = "Mask" ;
41
- d .searchParams .put (WebPlotRequest .FILE , fileName );
42
- d .searchParams .put (WebPlotRequest .PLOT_AS_MASK , "true" );
43
- d .searchParams .put (WebPlotRequest .TYPE , RequestType .FILE +"" );
44
- d .searchParams .put (WebPlotRequest .MULTI_IMAGE_IDX , extensionNumber +"" );
45
-
46
- return d ;
31
+ /**
32
+ * Factory method to create mask related data
33
+ * @param fileName - fits file name on the server
34
+ * @param availableMask - a map with the key to be the bits number (as a string) and the value to be a description
35
+ * @param extensionNumber - extension number of the fits file
36
+ * @param dataKey - should be a unique string for a fits file
37
+ * @return RelatedData
38
+ */
39
+ public static RelatedData makeMaskRelatedData (String fileName , Map <String ,String > availableMask , int extensionNumber , String dataKey ) {
40
+ Map <String ,String > searchParams = new HashMap <>();
41
+ searchParams .put (WebPlotRequest .FILE , fileName );
42
+ searchParams .put (WebPlotRequest .PLOT_AS_MASK , "true" );
43
+ searchParams .put (WebPlotRequest .TYPE , RequestType .FILE +"" );
44
+ searchParams .put (WebPlotRequest .MULTI_IMAGE_IDX , extensionNumber +"" );
45
+ return makeMaskRelatedData (searchParams , availableMask , dataKey );
47
46
}
48
47
49
-
50
- public static RelatedData makeMaskRelatedData (Map <String ,String > searchParams , Map <String ,String > availableMask ) {
48
+ /**
49
+ * Factory method to create mask related data
50
+ * @param searchParams- parameters used to make a WebPlotRequest search
51
+ * @param availableMask - a map with the key to be the bits number (as a string) and the value to be a description
52
+ * @param dataKey - should be a unique string for a fits file
53
+ * @return RelatedData
54
+ */
55
+ public static RelatedData makeMaskRelatedData (Map <String ,String > searchParams , Map <String ,String > availableMask , String dataKey ) {
51
56
RelatedData d = new RelatedData ();
52
57
d .dataType = IMAGE_MASK ;
53
58
d .availableMask = availableMask ;
54
59
55
60
d .desc = "Mask" ;
61
+ d .dataKey = dataKey ;
56
62
d .searchParams = searchParams ;
57
63
return d ;
58
64
}
59
65
60
- public static RelatedData makeImageOverlayRelatedData (String fileName , String desc , int extensionNumber ) {
61
- RelatedData d = new RelatedData ();
62
- d .dataType = IMAGE_OVERLAY ;
63
- d .desc = desc ;
64
-
65
- d .searchParams .put (WebPlotRequest .FILE , fileName );
66
- d .searchParams .put (WebPlotRequest .TYPE , RequestType .FILE +"" );
67
- d .searchParams .put (WebPlotRequest .MULTI_IMAGE_IDX , extensionNumber +"" );
68
- return d ;
66
+ /**
67
+ * Factory method to create image overlay related data
68
+ * @param fileName - name of the fits file
69
+ * @param dataKey - should be a unique string for a fits file
70
+ * @param desc - description of the data
71
+ * @param extensionNumber - extenions number in the fits file
72
+ * @return RelatedData
73
+ */
74
+ public static RelatedData makeImageOverlayRelatedData (String fileName , String dataKey , String desc , int extensionNumber ) {
75
+ Map <String ,String > searchParams = new HashMap <>();
76
+ searchParams .put (WebPlotRequest .FILE , fileName );
77
+ searchParams .put (WebPlotRequest .TYPE , RequestType .FILE +"" );
78
+ searchParams .put (WebPlotRequest .MULTI_IMAGE_IDX , extensionNumber +"" );
79
+ return makeImageOverlayRelatedData (searchParams ,dataKey ,desc );
69
80
}
70
81
71
- public static RelatedData makeImageOverlayRelatedData (Map <String ,String > searchParams , String desc ) {
82
+ /**
83
+ * Factory method to create image overlay related data
84
+ * @param searchParams - parameters used to make a WebPlotRequest search
85
+ * @param dataKey - should be a unique string for a fits file
86
+ * @param desc - description of the data
87
+ * @return RelatedData
88
+ */
89
+ public static RelatedData makeImageOverlayRelatedData (Map <String ,String > searchParams , String dataKey , String desc ) {
72
90
RelatedData d = new RelatedData ();
73
91
d .dataType = IMAGE_OVERLAY ;
74
92
d .desc = desc ;
93
+ d .dataKey = dataKey ;
75
94
d .searchParams = searchParams ;
76
95
return d ;
77
96
}
78
97
79
- public static RelatedData makeTabularRelatedData (Map <String ,String > searchParams , String desc ) {
98
+ /**
99
+ * Factory method to create tabular related data
100
+ * @param searchParams - parameters us to make a table file type server request
101
+ * @param dataKey - should be a unique string for a fits file
102
+ * @param desc - description of the data
103
+ * @return RelatedData
104
+ */
105
+ public static RelatedData makeTabularRelatedData (Map <String ,String > searchParams , String dataKey , String desc ) {
80
106
RelatedData d = new RelatedData ();
81
107
d .dataType = TABLE ;
82
108
d .searchParams = searchParams ;
109
+ d .dataKey = dataKey ;
83
110
d .desc = desc ;
84
111
return d ;
85
112
}
86
113
87
114
88
115
public String getDataType () { return dataType ;}
116
+ public String getDataKey () { return dataKey ;}
89
117
public Map <String ,String > getAvailableMask () { return availableMask ;}
90
118
public String getDesc () { return desc ;}
91
119
public Map <String ,String > getSearchParams () { return searchParams ;}
0 commit comments