Project

General

Profile

1
package eu.dnetlib.functionality.modular.ui.index.models;
2

    
3
/**
4
 * The Class IndexInfo.
5
 */
6
public class IndexInfo {
7

    
8
	/** The Constant SEPARATOR. */
9
	private static final String SEPARATOR = ":-:";
10

    
11
	/** The id. */
12
	private String id;
13

    
14
	/** The forma. */
15
	private String format;
16

    
17
	/** The layout. */
18
	private String layout;
19

    
20
	/** The interpretation. */
21
	private String interpretation;
22

    
23
	/** The backend id. */
24
	private String backendId;
25

    
26
	private int size;
27

    
28
	/**
29
	 * The Constructor.
30
	 */
31
	public IndexInfo() {
32

    
33
	}
34

    
35
	/**
36
	 * The Constructor.
37
	 *
38
	 * @param id
39
	 *            the id
40
	 * @param forma
41
	 *            the forma
42
	 * @param layout
43
	 *            the layout
44
	 * @param interpretation
45
	 *            the interpretation
46
	 * @param backendId
47
	 *            the backend id
48
	 */
49
	public IndexInfo(final String id, final String forma, final String layout, final String interpretation, final String backendId) {
50
		super();
51
		this.id = id;
52
		this.format = forma;
53
		this.layout = layout;
54
		this.interpretation = interpretation;
55
		this.backendId = backendId;
56
	}
57

    
58
	/**
59
	 * Gets the id.
60
	 *
61
	 * @return the id
62
	 */
63
	public String getId() {
64
		return id;
65
	}
66

    
67
	/**
68
	 * Sets the id.
69
	 *
70
	 * @param id
71
	 *            the id
72
	 */
73
	public void setId(final String id) {
74
		this.id = id;
75
	}
76

    
77
	/**
78
	 * Gets the forma.
79
	 *
80
	 * @return the forma
81
	 */
82
	public String getFormat() {
83
		return format;
84
	}
85

    
86
	/**
87
	 * Sets the forma.
88
	 *
89
	 * @param forma
90
	 *            the forma
91
	 */
92
	public void setFormat(final String format) {
93
		this.format = format;
94
	}
95

    
96
	/**
97
	 * Gets the layout.
98
	 *
99
	 * @return the layout
100
	 */
101
	public String getLayout() {
102
		return layout;
103
	}
104

    
105
	/**
106
	 * Sets the layout.
107
	 *
108
	 * @param layout
109
	 *            the layout
110
	 */
111
	public void setLayout(final String layout) {
112
		this.layout = layout;
113
	}
114

    
115
	/**
116
	 * Gets the interpretation.
117
	 *
118
	 * @return the interpretation
119
	 */
120
	public String getInterpretation() {
121
		return interpretation;
122
	}
123

    
124
	/**
125
	 * Sets the interpretation.
126
	 *
127
	 * @param interpretation
128
	 *            the interpretation
129
	 */
130
	public void setInterpretation(final String interpretation) {
131
		this.interpretation = interpretation;
132
	}
133

    
134
	/**
135
	 * Gets the backend id.
136
	 *
137
	 * @return the backend id
138
	 */
139
	public String getBackendId() {
140
		return backendId;
141
	}
142

    
143
	/**
144
	 * Sets the backend id.
145
	 *
146
	 * @param backendId
147
	 *            the backend id
148
	 */
149
	public void setBackendId(final String backendId) {
150
		this.backendId = backendId;
151
	}
152

    
153
	public int getSize() {
154
		return size;
155
	}
156

    
157
	public void setSize(final int size) {
158
		this.size = size;
159
	}
160

    
161
	/**
162
	 * New instance from string. the string must have the form format:-:layout:-:interpretation:-:id:-:backendid:-:size
163
	 *
164
	 * @param serialized
165
	 *            the serialized
166
	 * @return the index info
167
	 */
168
	public static IndexInfo newInstanceFromString(final String serialized) {
169
		String[] values = serialized.split(SEPARATOR);
170
		if ((values == null) || (values.length != 6)) return null;
171
		IndexInfo tmp = new IndexInfo();
172
		tmp.format = values[0];
173
		tmp.layout = values[1];
174
		tmp.interpretation = values[2];
175
		tmp.id = values[3];
176
		tmp.backendId = values[4];
177
		tmp.size = Integer.parseInt(values[5]);
178
		return tmp;
179

    
180
	}
181
}
(1-1/2)