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.query;
21
22 /**
23 * The methods of this class map CMIS identifiers to JCR identifiers. Each implementation
24 * of this interface is bound to a specific CMIS object type. That is, it implements the
25 * identifier maps for that object type.
26 */
27 public interface IdentifierMap {
28
29 /**
30 * Map a column name in the CMIS query to the corresponding relative JCR path.
31 * The path must be relative to the context node.
32 *
33 * @param name column name
34 * @return relative JCR path
35 */
36 String jcrPathFromCol(String name);
37
38 /**
39 * JCR type name corresponding to the CMIS type bound to this instance.
40 * @see #jcrTypeCondition()
41 *
42 * @return name of the JCR type
43 */
44 String jcrTypeName();
45
46 /**
47 * Create and additional condition in order for the query to only return nodes
48 * of the right type. This condition and-ed to the condition determined by the
49 * CMIS query's where clause.
50 * <p/>
51 * A CMIS query for non versionable documents should for example result in the
52 * following XPath query:
53 * <p/>
54 * <pre>
55 * element(*, nt:file)[not(@jcr:mixinTypes = 'mix:simpleVersionable')]
56 * </pre>
57 * Here the element test is covered by {@link #jcrTypeName()}
58 * while the predicate is covered by this method.
59 *
60 * @see #jcrTypeName()
61 *
62 * @return Additional condition or <code>null</code> if none.
63 */
64 String jcrTypeCondition();
65 }