1 /* libcmis
2  * Version: MPL 1.1 / GPLv2+ / LGPLv2+
3  *
4  * The contents of this file are subject to the Mozilla Public License Version
5  * 1.1 (the "License"); you may not use this file except in compliance with
6  * the License or as specified alternatively below. You may obtain a copy of
7  * the License at http://www.mozilla.org/MPL/
8  *
9  * Software distributed under the License is distributed on an "AS IS" basis,
10  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11  * for the specific language governing rights and limitations under the
12  * License.
13  *
14  * Major Contributor(s):
15  * Copyright (C) 2011 SUSE <cbosdonnat@suse.com>
16  *
17  *
18  * All Rights Reserved.
19  *
20  * For minor contributions see the git repository.
21  *
22  * Alternatively, the contents of this file may be used under the terms of
23  * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
24  * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
25  * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
26  * instead of those above.
27  */
28 #ifndef _WS_OBJECTSERVICE_HXX_
29 #define _WS_OBJECTSERVICE_HXX_
30 
31 #include <istream>
32 #include <string>
33 #include <vector>
34 
35 #include <libcmis/document.hxx>
36 #include <libcmis/folder.hxx>
37 #include <libcmis/object.hxx>
38 
39 #include "base-session.hxx"
40 #include "ws-soap.hxx"
41 
42 class WSSession;
43 
44 class ObjectService
45 {
46     private:
47         WSSession* m_session;
48         std::string m_url;
49 
50     public:
51 
52         ObjectService( WSSession* session );
53         ObjectService( const ObjectService& copy );
54         ~ObjectService( );
55 
56         ObjectService& operator=( const ObjectService& copy );
57 
58         libcmis::ObjectPtr getObject( std::string repoId, std::string id );
59 
60         libcmis::ObjectPtr getObjectByPath( std::string repoId, std::string path );
61 
62         std::vector< libcmis::RenditionPtr > getRenditions(
63                 std::string repoId, std::string objectId, std::string filter );
64 
65         libcmis::ObjectPtr updateProperties(
66                 std::string repoId,
67                 std::string objectId,
68                 const std::map< std::string, libcmis::PropertyPtr > & properties,
69                 std::string changeToken );
70 
71         void deleteObject( std::string repoId, std::string id, bool allVersions );
72 
73         std::vector< std::string > deleteTree( std::string repoId, std::string folderId, bool allVersions,
74                 libcmis::UnfileObjects::Type unfile, bool continueOnFailure );
75 
76         void move( std::string repoId, std::string objectId, std::string destId, std::string srcId );
77 
78         boost::shared_ptr< std::istream > getContentStream( std::string repoId, std::string objectId );
79 
80         void setContentStream( std::string repoId, std::string objectId, bool overwrite, std::string changeToken,
81                 boost::shared_ptr< std::ostream > stream, std::string contentType, std::string fileName );
82 
83         libcmis::FolderPtr createFolder( std::string repoId, const std::map< std::string, libcmis::PropertyPtr >& properties,
84                 std::string folderId );
85 
86         libcmis::DocumentPtr createDocument( std::string repoId, const std::map< std::string, libcmis::PropertyPtr >& properties,
87                 std::string folderId, boost::shared_ptr< std::ostream > stream, std::string contentType,
88                 std::string fileName );
89 
90     private:
91 
92         ObjectService( );
93 };
94 
95 #endif
96