Line data Source code
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 _OBJECT_TYPE_HXX_
29 : #define _OBJECT_TYPE_HXX_
30 :
31 : #include <boost/shared_ptr.hpp>
32 : #include <libxml/tree.h>
33 :
34 : #include <string>
35 : #include <vector>
36 :
37 : #include "exception.hxx"
38 : #include "property-type.hxx"
39 :
40 : namespace libcmis
41 : {
42 : /** Class representing a CMIS object type definition.
43 : */
44 : class ObjectType
45 : {
46 : public:
47 :
48 : enum ContentStreamAllowed
49 : {
50 : NotAllowed,
51 : Allowed,
52 : Required
53 : };
54 :
55 : protected:
56 : time_t m_refreshTimestamp;
57 :
58 : std::string m_id;
59 : std::string m_localName;
60 : std::string m_localNamespace;
61 : std::string m_displayName;
62 : std::string m_queryName;
63 : std::string m_description;
64 :
65 : std::string m_parentTypeId;
66 : std::string m_baseTypeId;
67 :
68 : bool m_creatable;
69 : bool m_fileable;
70 : bool m_queryable;
71 : bool m_fulltextIndexed;
72 : bool m_includedInSupertypeQuery;
73 : bool m_controllablePolicy;
74 : bool m_controllableAcl;
75 : bool m_versionable;
76 : libcmis::ObjectType::ContentStreamAllowed m_contentStreamAllowed;
77 :
78 : std::map< std::string, libcmis::PropertyTypePtr > m_propertiesTypes;
79 :
80 : ObjectType( );
81 : void initializeFromNode( xmlNodePtr node );
82 :
83 : public:
84 :
85 : ObjectType( xmlNodePtr node );
86 : ObjectType( const ObjectType& copy );
87 0 : virtual ~ObjectType() { }
88 :
89 : ObjectType& operator=( const ObjectType& copy );
90 :
91 : /** Reload the data from the server.
92 :
93 : \attention
94 : This method needs to be implemented in subclasses or it will
95 : do nothing
96 : */
97 : virtual void refresh( ) throw ( Exception );
98 : virtual time_t getRefreshTimestamp( ) { return m_refreshTimestamp; }
99 :
100 0 : std::string getId( ) { return m_id; }
101 : std::string getLocalName( ) { return m_localName; }
102 : std::string getLocalNamespace( ) { return m_localNamespace; }
103 : std::string getDisplayName( ) { return m_displayName; }
104 : std::string getQueryName( ) { return m_queryName; }
105 : std::string getDescription( ) { return m_description; }
106 :
107 : virtual boost::shared_ptr< ObjectType > getParentType( ) throw ( Exception );
108 : virtual boost::shared_ptr< ObjectType > getBaseType( ) throw ( Exception );
109 : virtual std::vector< boost::shared_ptr< ObjectType > > getChildren( ) throw ( Exception );
110 :
111 : bool isCreatable( ) { return m_creatable; }
112 : bool isFileable( ) { return m_fileable; }
113 : bool isQueryable( ) { return m_queryable; }
114 : bool isFulltextIndexed( ) { return m_fulltextIndexed; }
115 : bool isIncludedInSupertypeQuery( ) { return m_includedInSupertypeQuery; }
116 : bool isControllablePolicy( ) { return m_controllablePolicy; }
117 : bool isControllableACL( ) { return m_controllableAcl; }
118 0 : bool isVersionable( ) { return m_versionable; }
119 : ContentStreamAllowed getContentStreamAllowed( ) { return m_contentStreamAllowed; }
120 :
121 0 : std::map< std::string, PropertyTypePtr >& getPropertiesTypes( ) { return m_propertiesTypes; }
122 :
123 : virtual std::string toString( );
124 : };
125 :
126 : typedef ::boost::shared_ptr< ObjectType > ObjectTypePtr;
127 : }
128 :
129 : #endif
|