1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.chemistry.opencmis.jcr;
21
22 import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
23 import org.apache.chemistry.opencmis.jcr.type.JcrTypeHandlerManager;
24 import org.apache.commons.logging.Log;
25 import org.apache.commons.logging.LogFactory;
26
27 import javax.jcr.Node;
28 import javax.jcr.RepositoryException;
29
30
31
32
33
34 public class JcrPrivateWorkingCopy extends JcrVersionBase {
35 private static final Log log = LogFactory.getLog(JcrPrivateWorkingCopy.class);
36
37
38
39
40 public static final String PWC_NAME = "pwc";
41
42 public JcrPrivateWorkingCopy(Node node, JcrTypeManager typeManager, PathManager pathManager,
43 JcrTypeHandlerManager typeHandlerManager) {
44
45 super(node, typeManager, pathManager, typeHandlerManager);
46 }
47
48
49
50
51
52 public static boolean denotesPwc(String versionName) {
53 return PWC_NAME.equals(versionName);
54 }
55
56
57
58
59
60
61 public static boolean isPwc(String objectId) {
62 return objectId.endsWith('/' + PWC_NAME);
63 }
64
65
66
67 @Override
68 protected Node getContextNode() {
69 try {
70 return getNode().getNode(Node.JCR_CONTENT);
71 }
72 catch (RepositoryException e) {
73 log.debug(e.getMessage(), e);
74 throw new CmisObjectNotFoundException(e.getMessage(), e);
75 }
76 }
77
78 @Override
79 protected String getPwcId() throws RepositoryException {
80 return getObjectId();
81 }
82
83 @Override
84 protected String getObjectId() throws RepositoryException {
85 return getVersionSeriesId() + '/' + PWC_NAME;
86 }
87
88 @Override
89 protected String getVersionLabel() throws RepositoryException {
90 return PWC_NAME;
91 }
92
93 @Override
94 protected boolean isLatestVersion() throws RepositoryException {
95 return false;
96 }
97
98 @Override
99 protected boolean isMajorVersion() throws RepositoryException {
100 return false;
101 }
102
103 @Override
104 protected boolean isLatestMajorVersion() throws RepositoryException {
105 return false;
106 }
107
108 @Override
109 protected String getCheckInComment() {
110 return "";
111 }
112
113 }