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 package org.apache.chemistry.opencmis.jcr.impl;
20
21 import org.apache.chemistry.opencmis.commons.PropertyIds;
22
23 /**
24 * Provides mappings to standard jcr properties for documents.
25 */
26 public class DefaultDocumentIdentifierMap extends DefaultIdentifierMapBase {
27
28 private final boolean isVersionable;
29
30 public DefaultDocumentIdentifierMap(boolean isVersionable) {
31 super("nt:file");
32 this.isVersionable = isVersionable;
33 cmis2Jcr.put(PropertyIds.CREATED_BY, "jcr:content/@jcr:createdBy");
34 cmis2Jcr.put(PropertyIds.CREATION_DATE, "jcr:content/@jcr:created");
35 cmis2Jcr.put(PropertyIds.LAST_MODIFIED_BY, "jcr:content/@jcr:lastModifiedBy");
36 cmis2Jcr.put(PropertyIds.LAST_MODIFICATION_DATE, "jcr:content/@jcr:lastModified");
37 cmis2Jcr.put(PropertyIds.CONTENT_STREAM_MIME_TYPE, "jcr:content/@jcr:mimeType");
38 cmis2Jcr.put(PropertyIds.CONTENT_STREAM_FILE_NAME, "fn:name()");
39 // xxx not supported: IS_IMMUTABLE, IS_LATEST_VERSION, IS_MAJOR_VERSION, IS_LATEST_MAJOR_VERSION,
40 // VERSION_LABEL, VERSION_SERIES_ID, IS_VERSION_SERIES_CHECKED_OUT, VERSION_SERIES_CHECKED_OUT_ID
41 // VERSION_SERIES_CHECKED_OUT_BY, CHECKIN_COMMENT, CONTENT_STREAM_ID, CONTENT_STREAM_LENGTH
42 }
43
44 @Override
45 public String jcrTypeCondition() {
46 return (isVersionable ? "" : "not") +
47 "(@jcr:mixinTypes = 'mix:simpleVersionable')";
48 }
49 }