This project has retired. For details please refer to its
Attic page.
JcrPrivateWorkingCopy xref
1/*2 * Licensed to the Apache Software Foundation (ASF) under one3 * or more contributor license agreements. See the NOTICE file4 * distributed with this work for additional information5 * regarding copyright ownership. The ASF licenses this file6 * to you under the Apache License, Version 2.0 (the7 * "License"); you may not use this file except in compliance8 * with the License. You may obtain a copy of the License at9 *10 * http://www.apache.org/licenses/LICENSE-2.011 *12 * Unless required by applicable law or agreed to in writing,13 * software distributed under the License is distributed on an14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY15 * KIND, either express or implied. See the License for the16 * specific language governing permissions and limitations17 * under the License.18 */1920package org.apache.chemistry.opencmis.jcr;
2122import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
23import org.apache.chemistry.opencmis.jcr.type.JcrTypeHandlerManager;
24import org.apache.commons.logging.Log;
25import org.apache.commons.logging.LogFactory;
2627import javax.jcr.Node;
28import javax.jcr.RepositoryException;
2930/**31 * Instances of this class represent a private working copy of a cmis:document backed by an underlying32 * JCR <code>Node</code>.33 */34publicclassJcrPrivateWorkingCopyextendsJcrVersionBase {
35privatestaticfinal Log log = LogFactory.getLog(JcrPrivateWorkingCopy.class);
3637/**38 * Name of a private working copy39 */40publicstaticfinal String PWC_NAME = "pwc";
4142publicJcrPrivateWorkingCopy(Node node, JcrTypeManager typeManager, PathManager pathManager,
43JcrTypeHandlerManager typeHandlerManager) {
4445super(node, typeManager, pathManager, typeHandlerManager);
46 }
4748/**49 * @return <code>true</code> iff <code>versionName</code> is the name of private working copy.50 * @see JcrPrivateWorkingCopy#PWC_NAME51 */52publicstaticboolean denotesPwc(String versionName) {
53return PWC_NAME.equals(versionName);
54 }
5556/**57 * @param objectId58 * @return <code>true</code> iff <code>objectId</code> is the id of a private working copy.59 * @see JcrPrivateWorkingCopy#PWC_NAME60 */61publicstaticboolean isPwc(String objectId) {
62return objectId.endsWith('/' + PWC_NAME);
63 }
6465//------------------------------------------< protected >---6667 @Override
68protected Node getContextNode() {
69try {
70return getNode().getNode(Node.JCR_CONTENT);
71 }
72catch (RepositoryException e) {
73 log.debug(e.getMessage(), e);
74thrownew CmisObjectNotFoundException(e.getMessage(), e);
75 }
76 }
7778 @Override
79protected String getPwcId() throws RepositoryException {
80return getObjectId();
81 }
8283 @Override
84protected String getObjectId() throws RepositoryException {
85return getVersionSeriesId() + '/' + PWC_NAME;
86 }
8788 @Override
89protected String getVersionLabel() throws RepositoryException {
90return PWC_NAME;
91 }
9293 @Override
94protectedboolean isLatestVersion() throws RepositoryException {
95return false;
96 }
9798 @Override
99protectedboolean isMajorVersion() throws RepositoryException {
100return false;
101 }
102103 @Override
104protectedboolean isLatestMajorVersion() throws RepositoryException {
105return false;
106 }
107108 @Override
109protected String getCheckInComment() {
110return"";
111 }
112113 }