-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGroup.java
More file actions
52 lines (46 loc) · 1.24 KB
/
Group.java
File metadata and controls
52 lines (46 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import org.apache.commons.lang.builder.ToStringBuilder;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
public class Group {
private String name;
private String id;
private Integer size;
enum GroupType { FILTERED_GROUP, UPLOADED_GROUP } ;
private GroupType type;
public Group(Node node) throws Exception{
Element groupElem = (Element) node;
id = groupElem.getAttribute("id");
String tp = groupElem.getAttribute("type");
if (tp.equals("UploadedGroup")){
type = GroupType.UPLOADED_GROUP;
}
else if (tp.equals("FilteredGroup")){
type = GroupType.FILTERED_GROUP;
}
name = MobileCommons.getValueFromChildNodeByNodeName(groupElem, "name");
size = Integer.parseInt(MobileCommons.getValueFromChildNodeByNodeName(groupElem, "size"));
}
public String getName(){
return name;
}
public String getId(){
return id;
}
public Integer getSize(){
return size;
}
public GroupType getType(){
return type;
}
public String getTypeString(){
return type.toString();
}
public String toString() {
return new ToStringBuilder(this).
append("name", name).
append("id", id).
append("size", size).
append("type", type.toString()).
toString();
}
}