1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.exoplatform.ecm.webui.component.explorer.versions;
18
19 import java.util.Calendar;
20
21 import org.exoplatform.ecm.webui.component.explorer.UIDocumentWorkspace;
22 import org.exoplatform.services.wcm.core.NodeLocation;
23 import org.exoplatform.webui.config.annotation.ComponentConfig;
24 import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
25 import org.exoplatform.webui.form.UIForm;
26
27
28
29
30
31
32
33 @ComponentConfig(
34 lifecycle = UIFormLifecycle.class,
35 template = "app:/groovy/webui/component/explorer/versions/UINodeInfo.gtmpl"
36 )
37 public class UINodeInfo extends UIForm {
38
39 private NodeLocation node_ ;
40 private String versionCreatedDate_ ;
41
42 public UINodeInfo() {
43
44 }
45
46 public void update() throws Exception {
47 UIVersionInfo uiVersionInfo = getAncestorOfType(UIDocumentWorkspace.class).getChild(UIVersionInfo.class);
48 node_ = NodeLocation.getNodeLocationByNode(uiVersionInfo.getCurrentNode());
49 Calendar createdTime = uiVersionInfo.getCurrentVersionNode().getCreatedTime();
50 if (createdTime != null) {
51 versionCreatedDate_ = createdTime.getTime().toString();
52 }
53 }
54
55 public String getNodeType() throws Exception {
56 return NodeLocation.getNodeByLocation(node_).getPrimaryNodeType().getName();
57 }
58
59 public String getNodeName() throws Exception {
60 return NodeLocation.getNodeByLocation(node_).getName();
61 }
62
63 public String getVersionName() throws Exception {
64 return getAncestorOfType(UIDocumentWorkspace.class).getChild(UIVersionInfo.class) .getCurrentVersionNode().getName();
65 }
66
67 public String getVersionLabels() throws Exception{
68 UIVersionInfo uiVersionInfo = getAncestorOfType(UIDocumentWorkspace.class).getChild(UIVersionInfo.class) ;
69 String[] labels = uiVersionInfo.getVersionLabels(uiVersionInfo.getCurrentVersionNode());
70 StringBuilder label = new StringBuilder() ;
71 if(labels.length == 0 ) return "N/A" ;
72 for(String temp : labels) {
73 label.append(temp).append(" ") ;
74 }
75 return label.toString() ;
76 }
77
78 public String getVersionCreatedDate() throws Exception {
79 return versionCreatedDate_;
80 }
81 }