This project has retired. For details please refer to its Attic page.
JcrUnversionedDocument xref

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  
20  package org.apache.chemistry.opencmis.jcr;
21  
22  import org.apache.chemistry.opencmis.commons.enums.Action;
23  import org.apache.chemistry.opencmis.jcr.impl.DefaultUnversionedDocumentTypeHandler;
24  import org.apache.chemistry.opencmis.jcr.type.JcrTypeHandlerManager;
25  
26  import javax.jcr.Node;
27  import javax.jcr.RepositoryException;
28  import java.util.Set;
29  
30  /**
31   * Instances of this class represent a non versionable cmis:document backed by an underlying JCR <code>Node</code>. 
32   */
33  public class JcrUnversionedDocument extends JcrDocument {
34      
35      public JcrUnversionedDocument(Node node, JcrTypeManager typeManager, PathManager pathManager, JcrTypeHandlerManager typeHandlerManager) {
36          super(node, typeManager, pathManager, typeHandlerManager);
37      }
38  
39      //------------------------------------------< protected >--- 
40  
41      @Override
42      protected Node getContextNode() throws RepositoryException {
43          return getNode().getNode(Node.JCR_CONTENT);
44      }
45  
46      @Override
47      protected Set<Action> compileAllowableActions(Set<Action> aas) {
48          Set<Action> result = super.compileAllowableActions(aas);
49          setAction(result, Action.CAN_GET_ALL_VERSIONS, false);
50          setAction(result, Action.CAN_CHECK_OUT, false);
51          setAction(result, Action.CAN_CANCEL_CHECK_OUT, false);
52          setAction(result, Action.CAN_CHECK_IN, false);
53          return result;
54      }
55  
56      @Override
57      protected String getTypeIdInternal() {
58          return DefaultUnversionedDocumentTypeHandler.DOCUMENT_UNVERSIONED_TYPE_ID;
59      }
60  
61      @Override
62      protected boolean isLatestVersion() {
63          return true;
64      }
65  
66      @Override
67      protected boolean isMajorVersion() {
68          return true;
69      }
70  
71      @Override
72      protected boolean isLatestMajorVersion() {
73          return true;
74      }
75  
76      @Override
77      protected String getVersionLabel() {
78          return "0.0";
79      }
80  
81      @Override
82      protected boolean isCheckedOut() {
83          return false;
84      }
85  
86      @Override
87      protected String getCheckedOutId() {
88          return null;   
89      }
90  
91      @Override
92      protected String getCheckedOutBy() throws RepositoryException {
93          return null;
94      }
95  
96      @Override
97      protected String getCheckInComment() {
98          return "";   
99      }
100 
101 
102 }