001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
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            @Override
041            public void setDefaultContext(
042                    Set<String> filter, boolean includeAcls,
043                    boolean includeAllowableActions, boolean includePolicies,
044                    String includeRelationships, Set<String> renditionFilter,
045                    boolean includePathSegments, String orderBy, boolean cacheEnabled,
046                    int maxItemsPerPage) {
047    
048                    IncludeRelationships includeRelationshipsObj = null;
049    
050                    if (includeRelationships != null) {
051                            includeRelationshipsObj = IncludeRelationships.fromValue(
052                                    includeRelationships);
053                    }
054    
055                    OperationContext operationContext = new OperationContextImpl(
056                            filter, includeAcls, includeAllowableActions, includePolicies,
057                            includeRelationshipsObj, renditionFilter, includePathSegments,
058                            orderBy, cacheEnabled, maxItemsPerPage);
059    
060                    _session.setDefaultContext(operationContext);
061            }
062    
063            private org.apache.chemistry.opencmis.client.api.Session _session;
064    
065    }