Esempio n. 1
0
        public CmisObject ToCmis(object o, bool includeRelationships)
        {
            var        textFolder = (TextFolder)o;
            CmisObject cmisObject = new CmisObject();

            cmisObject.Id         = ObjectService.GetObjectId(textFolder);
            cmisObject.Properties = new CmisProperties()
            {
                Items = new CmisProperty[] {
                    CmisPropertyHelper.CreateCmisPropertyAllowedChildObjectTypeIds(null),
                    CmisPropertyHelper.CreateCmisPropertyBaseTypeId(new string[] { "cmis:folder" }),
                    CmisPropertyHelper.CreateCmisPropertyCreatedBy(new string[] { textFolder.UserId }),
                    CmisPropertyHelper.CreateCmisPropertyCreationDate(new DateTime[] { textFolder.UtcCreationDate == DateTime.MinValue? DateTime.UtcNow:textFolder.UtcCreationDate }),
                    CmisPropertyHelper.CreateCmisPropertyLastModificationDate(new DateTime[] { DateTime.UtcNow }),
                    CmisPropertyHelper.CreateCmisPropertyLastModifiedBy(new string[] { textFolder.UserId }),
                    CmisPropertyHelper.CreateCmisPropertyName(new string[] { textFolder.Name }),
                    CmisPropertyHelper.CreateCmisPropertyObjectId(new string[] { cmisObject.Id }),
                    CmisPropertyHelper.CreateCmisPropertyBaseTypeId(new string[] { "cmis:folder" }),
                    CmisPropertyHelper.CreateCmisPropertyObjectTypeId(new string[] { textFolder.SchemaName }),
                    CmisPropertyHelper.CreateCmisPropertyParentId(new string[] { textFolder.Parent == null?CmisFolderHelper.RootFolderName:textFolder.Parent.FullName }),
                    CmisPropertyHelper.CreateCmisPropertyPath(new string[] { string.Join("/", textFolder.NamePath.ToArray()) }),
                    new CmisPropertyString()
                    {
                        DisplayName          = "Display Name",
                        LocalName            = "DispalyName",
                        PropertyDefinitionId = "DisplayName",
                        Value = new string[] { textFolder.DisplayName }
                    },
                    new CmisPropertyString()
                    {
                        DisplayName          = "Schema Name",
                        LocalName            = "SchemaName",
                        PropertyDefinitionId = "SchemaName",
                        Value = new string[] { textFolder.SchemaName }
                    },
                    new CmisPropertyString()
                    {
                        DisplayName          = "Category Folders",
                        LocalName            = "CategoryFolders",
                        PropertyDefinitionId = "CategoryFolders",
                        Value = new string[] { textFolder.CategoryFolders == null?"":string.Join(",", textFolder.CategoryFolders.ToArray()) }
                    }
                }
            };
            return(cmisObject);
        }
Esempio n. 2
0
        //public static T ToCms<T>(CmisObject cmisObject)
        //{
        //    return (T)(convertors[typeof(T)].ToCms(cmisObject));
        //}

        public static CmisObject EmptyCmisObject()
        {
            return(new CmisObject()
            {
                Properties = new CmisProperties()
                {
                    Items = new CmisProperty[] {
                        CmisPropertyHelper.CreateCmisPropertyAllowedChildObjectTypeIds(null),
                        CmisPropertyHelper.CreateCmisPropertyBaseTypeId(new string[] { "cmis:empty" }),
                        CmisPropertyHelper.CreateCmisPropertyCreatedBy(new string[] { "" }),
                        CmisPropertyHelper.CreateCmisPropertyCreationDate(new DateTime[] { DateTime.UtcNow }),
                        CmisPropertyHelper.CreateCmisPropertyLastModificationDate(new DateTime[] { DateTime.UtcNow }),
                        CmisPropertyHelper.CreateCmisPropertyLastModifiedBy(new string[] { "" }),
                        CmisPropertyHelper.CreateCmisPropertyName(new string[] { "" }),
                        CmisPropertyHelper.CreateCmisPropertyObjectId(new string[] { "" }),
                        CmisPropertyHelper.CreateCmisPropertyBaseTypeId(new string[] { "cmis:empty" }),
                        CmisPropertyHelper.CreateCmisPropertyObjectTypeId(new string[] { "" })
                    }
                }
            });
        }
Esempio n. 3
0
 public static CmisObject CreateSystemFolderObject(string systemFolder, string rootFolder)
 {
     return(new CmisObject()
     {
         Id = systemFolder,
         Properties = new CmisProperties()
         {
             Items = new CmisProperty[] {
                 CmisPropertyHelper.CreateCmisPropertyBaseTypeId(new string[] { "cmis:folder" }),
                 CmisPropertyHelper.CreateCmisPropertyCreatedBy(new string[] { "system" }),
                 CmisPropertyHelper.CreateCmisPropertyCreationDate(new DateTime[] { DateTime.UtcNow }),
                 CmisPropertyHelper.CreateCmisPropertyLastModificationDate(new DateTime[] { DateTime.UtcNow }),
                 CmisPropertyHelper.CreateCmisPropertyLastModifiedBy(new string[] { "system" }),
                 CmisPropertyHelper.CreateCmisPropertyName(new string[] { systemFolder }),
                 CmisPropertyHelper.CreateCmisPropertyObjectId(new string[] { systemFolder }),
                 CmisPropertyHelper.CreateCmisPropertyBaseTypeId(new string[] { "cmis:folder" }),
                 CmisPropertyHelper.CreateCmisPropertyObjectTypeId(new string[] { "" }),
                 CmisPropertyHelper.CreateCmisPropertyParentId(new string[] { rootFolder }),
                 CmisPropertyHelper.CreateCmisPropertyPath(new string[] { string.Join("/", new [] { rootFolder, systemFolder }) })
             }
         }
     });
 }