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) 2014 Mihai Varga <mihai.mv13@gmail.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 
29 #include "sharepoint-object-type.hxx"
30 
SharePointObjectType(const std::string & id)31 SharePointObjectType::SharePointObjectType( const std::string& id ): ObjectType( )
32 {
33     m_id = id;
34     m_localName = "SharePoint Object Type";
35     m_localNamespace = "SharePoint Object Type";
36     m_displayName = "SharePoint Object Type";
37     m_queryName = "SharePoint Object Type";
38     m_description = "SharePoint Object Type";
39     m_parentTypeId = id;
40     m_baseTypeId = id;
41     m_creatable = true;
42     m_versionable = true;
43     m_fulltextIndexed = true;
44 
45     libcmis::PropertyTypePtr idType(new libcmis::PropertyType( ) );
46     idType->setId( "cmis:objectTypeId" );
47     idType->setType( libcmis::PropertyType::String );
48     m_propertiesTypes[ idType->getId( ) ] = idType;
49 
50     // create PropertyTypes which are updatable.
51 
52     // name
53     libcmis::PropertyTypePtr nameType( new libcmis::PropertyType( ) );
54     nameType->setId( "cmis:name" );
55     nameType->setType( libcmis::PropertyType::String );
56     nameType->setUpdatable( true );
57     m_propertiesTypes[ nameType->getId( ) ] = nameType;
58 
59     // streamFileName
60     libcmis::PropertyTypePtr streamFileNameType( new libcmis::PropertyType( ) );
61     streamFileNameType->setId( "cmis:contentStreamFileName" );
62     streamFileNameType->setType( libcmis::PropertyType::String );
63     streamFileNameType->setUpdatable( true );
64     m_propertiesTypes[ streamFileNameType->getId( ) ] = streamFileNameType;
65 
66     // modifiedDate
67     libcmis::PropertyTypePtr modifiedDateType( new libcmis::PropertyType( ) );
68     modifiedDateType->setId( "cmis:lastModificationDate" );
69     modifiedDateType->setType( libcmis::PropertyType::DateTime );
70     modifiedDateType->setUpdatable( false );
71     m_propertiesTypes[ modifiedDateType->getId( ) ] = modifiedDateType;
72 
73     // creationDate
74     libcmis::PropertyTypePtr creationDateType( new libcmis::PropertyType( ) );
75     creationDateType->setId( "cmis:creationDate" );
76     creationDateType->setType( libcmis::PropertyType::DateTime );
77     creationDateType->setUpdatable( false );
78     m_propertiesTypes[ creationDateType->getId( ) ] = creationDateType;
79 
80     // size
81     libcmis::PropertyTypePtr contentStreamLength( new libcmis::PropertyType( ) );
82     contentStreamLength->setId( "cmis:contentStreamLength" );
83     contentStreamLength->setType( libcmis::PropertyType::Integer );
84     contentStreamLength->setUpdatable( false );
85     m_propertiesTypes[ contentStreamLength->getId( ) ] = contentStreamLength;
86 
87     // checkinComment
88     libcmis::PropertyTypePtr checkinComment( new libcmis::PropertyType( ) );
89     checkinComment->setId( "cmis:checkinComment" );
90     checkinComment->setType( libcmis::PropertyType::String );
91     checkinComment->setUpdatable( false );
92     m_propertiesTypes[ checkinComment->getId( ) ] = checkinComment;
93 }
94 
getParentType()95 libcmis::ObjectTypePtr SharePointObjectType::getParentType( )
96 {
97     libcmis::ObjectTypePtr parentTypePtr( new SharePointObjectType( m_parentTypeId ) );
98     return parentTypePtr;
99 }
100 
getBaseType()101 libcmis::ObjectTypePtr SharePointObjectType::getBaseType( )
102 {
103     libcmis::ObjectTypePtr baseTypePtr( new SharePointObjectType( m_baseTypeId ) );
104     return baseTypePtr;
105 }
106