1
2
3
4
5
6
7
8 package net.sf.tacos.services.impl;
9
10 import java.util.ArrayList;
11 import java.util.Arrays;
12 import java.util.List;
13
14 import net.sf.tacos.services.PageInfo;
15
16 import org.apache.commons.lang.builder.ToStringBuilder;
17 import org.apache.commons.lang.builder.ToStringStyle;
18
19
20
21
22
23
24 public class PageInfoImpl implements PageInfo {
25
26 private String name;
27 private String path;
28 private String desc;
29 private String perm;
30 private PageInfo parent;
31 private List children;
32 private boolean isNavigable;
33
34
35
36
37
38
39
40
41
42 public PageInfoImpl(String name, String desc,
43 String perm, List children, boolean isNavigable) {
44 this.name = name;
45 this.desc = desc;
46 this.perm = perm;
47 this.children = children;
48 this.isNavigable = isNavigable;
49 }
50
51
52
53
54 public String getDesc() {
55 return desc;
56 }
57
58
59
60
61 public String getName() {
62 return name;
63 }
64
65
66
67
68 public String getPermission() {
69 return perm;
70 }
71
72
73
74
75 public PageInfo getParent() {
76 return parent;
77 }
78
79
80
81
82
83 public void setParent(PageInfo parent) {
84 this.parent = parent;
85 }
86
87
88
89
90
91 public void addChild(PageInfo child)
92 {
93 children.add(child);
94 }
95
96
97
98
99
100 public boolean isNavigable() { return isNavigable; }
101
102
103
104
105
106 public List getChildrenNames() {
107 if (children == null) return Arrays.asList(new Object[0]);
108 List list = new ArrayList(children.size());
109 for(int i = 0; i < children.size(); i++)
110 list.add(((PageInfo)children.get(i)).getName());
111 return list;
112 }
113
114
115
116
117 public String toString() {
118 return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
119 .append("name", this.name)
120 .append("desc", this.desc)
121 .append("perm", this.perm)
122 .append("parent", (this.parent != null ? parent.getName() : "none"))
123 .append("isNavigable", this.isNavigable)
124 .toString();
125 }
126 }