001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.repository.cmis;
016    
017    import com.liferay.portal.kernel.repository.cmis.Session;
018    
019    import java.util.Set;
020    
021    import org.apache.chemistry.opencmis.client.api.OperationContext;
022    import org.apache.chemistry.opencmis.client.runtime.OperationContextImpl;
023    import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
024    
025    /**
026     * @author Alexander Chow
027     */
028    public class SessionImpl implements Session {
029    
030            public SessionImpl(
031                    org.apache.chemistry.opencmis.client.api.Session session) {
032    
033                    _session = session;
034            }
035    
036            public org.apache.chemistry.opencmis.client.api.Session getSession() {
037                    return _session;
038            }
039    
040            public void setDefaultContext(
041                    Set<String> filter, boolean includeAcls,
042                    boolean includeAllowableActions, boolean includePolicies,
043                    String includeRelationships, Set<String> renditionFilter,
044                    boolean includePathSegments, String orderBy, boolean cacheEnabled,
045                    int maxItemsPerPage) {
046    
047                    IncludeRelationships includeRelationshipsObj = null;
048    
049                    if (includeRelationships != null) {
050                            includeRelationshipsObj = IncludeRelationships.fromValue(
051                                    includeRelationships);
052                    }
053    
054                    OperationContext operationContext = new OperationContextImpl(
055                            filter, includeAcls, includeAllowableActions, includePolicies,
056                            includeRelationshipsObj, renditionFilter, includePathSegments,
057                            orderBy, cacheEnabled, maxItemsPerPage);
058    
059                    _session.setDefaultContext(operationContext);
060            }
061    
062            private org.apache.chemistry.opencmis.client.api.Session _session;
063    
064    }