예제 #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);
        }
예제 #2
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 }) })
             }
         }
     });
 }