1 | package clarin.cmdi.componentregistry.frontend; |
---|
2 | |
---|
3 | import clarin.cmdi.componentregistry.ComponentStatus; |
---|
4 | import java.io.Serializable; |
---|
5 | |
---|
6 | import clarin.cmdi.componentregistry.MDMarshaller; |
---|
7 | import clarin.cmdi.componentregistry.model.AbstractDescription; |
---|
8 | |
---|
9 | public class CMDItemInfo implements Serializable { |
---|
10 | |
---|
11 | private static final long serialVersionUID = 1L; |
---|
12 | |
---|
13 | private String description; |
---|
14 | private String content; |
---|
15 | private String name; |
---|
16 | private boolean forceUpdate = false; |
---|
17 | |
---|
18 | private DisplayDataNode displayNode; |
---|
19 | |
---|
20 | private boolean deletable = false; |
---|
21 | private boolean undeletable = false; |
---|
22 | |
---|
23 | private boolean editable = false; |
---|
24 | |
---|
25 | public void setDescription(String descriptionText) { |
---|
26 | this.description = descriptionText; |
---|
27 | } |
---|
28 | |
---|
29 | public String getDescription() { |
---|
30 | return description; |
---|
31 | } |
---|
32 | |
---|
33 | public void setName(String name) { |
---|
34 | this.name = name; |
---|
35 | } |
---|
36 | |
---|
37 | public String getName() { |
---|
38 | if (displayNode != null) { |
---|
39 | name = displayNode.toString(); |
---|
40 | } |
---|
41 | return name; |
---|
42 | } |
---|
43 | |
---|
44 | public DisplayDataNode getDataNode() { |
---|
45 | return displayNode; |
---|
46 | } |
---|
47 | |
---|
48 | public void setDataNode(DisplayDataNode dataNode) { |
---|
49 | this.displayNode = dataNode; |
---|
50 | setUndeletable(false); |
---|
51 | setDeletable(false); |
---|
52 | setEditable(false); |
---|
53 | setDescription(""); |
---|
54 | setContent(""); |
---|
55 | if (dataNode != null) { |
---|
56 | AbstractDescription desc = dataNode.getDescription(); |
---|
57 | if (desc != null) { |
---|
58 | String content = MDMarshaller.marshalToString(desc); |
---|
59 | setDescription(content); |
---|
60 | setEditable(true); |
---|
61 | if (dataNode.isDeleted()) { |
---|
62 | setUndeletable(true); |
---|
63 | } else { |
---|
64 | setDeletable(true); |
---|
65 | } |
---|
66 | } |
---|
67 | } |
---|
68 | |
---|
69 | } |
---|
70 | |
---|
71 | public void setDeletable(boolean deletable) { |
---|
72 | this.deletable = deletable; |
---|
73 | } |
---|
74 | |
---|
75 | public boolean isDeletable() { |
---|
76 | return deletable; |
---|
77 | } |
---|
78 | |
---|
79 | public void setUndeletable(boolean undeletable) { |
---|
80 | this.undeletable = undeletable; |
---|
81 | } |
---|
82 | |
---|
83 | public boolean isUndeletable() { |
---|
84 | return undeletable; |
---|
85 | } |
---|
86 | |
---|
87 | public boolean isEditable() { |
---|
88 | return editable; |
---|
89 | } |
---|
90 | |
---|
91 | public void setEditable(boolean editable) { |
---|
92 | this.editable = editable; |
---|
93 | } |
---|
94 | |
---|
95 | |
---|
96 | public ComponentStatus getStatus() { |
---|
97 | return displayNode.getStatus(); |
---|
98 | } |
---|
99 | |
---|
100 | public void setForceUpdate(boolean forceUpdate) { |
---|
101 | this.forceUpdate = forceUpdate; |
---|
102 | } |
---|
103 | |
---|
104 | public boolean isForceUpdate() { |
---|
105 | return forceUpdate; |
---|
106 | } |
---|
107 | |
---|
108 | public void setContent(String content) { |
---|
109 | this.content = content; |
---|
110 | } |
---|
111 | |
---|
112 | public String getContent() { |
---|
113 | return content; |
---|
114 | } |
---|
115 | |
---|
116 | } |
---|