public CmisObject ToCmis(object o, bool includeRelationships) { CmisObject cmisObject = new CmisObject(); MediaContent content = (MediaContent)o; cmisObject.Id = ObjectService.GetObjectId(content); cmisObject.Properties = new CmisProperties() { Items = content.Keys.Select(key => CmisPropertyHelper.CreateProperty(key, content[key])).ToArray() }; cmisObject.Properties.Items = cmisObject.Properties.Items.Concat(new CmisProperty[] { CmisPropertyHelper.CreateCmisPropertyCreatedBy(new [] { content.UserId }), CmisPropertyHelper.CreateCmisPropertyCreationDate(new [] { content.UtcCreationDate }), CmisPropertyHelper.CreateCmisPropertyLastModificationDate(new [] { content.UtcLastModificationDate }), CmisPropertyHelper.CreateCmisPropertyName(new [] { content.UserKey }), CmisPropertyHelper.CreateCmisPropertyObjectId(new [] { cmisObject.Id }), CmisPropertyHelper.CreateCmisPropertyBaseTypeId(new [] { "cmis:document" }), CmisPropertyHelper.CreateCmisPropertyObjectTypeId(new [] { content.FolderName }), }).ToArray(); if (includeRelationships) { var categories = Services.ServiceFactory.TextContentManager.QueryCategories(content.GetRepository(), content.FolderName, content.UUID); cmisObject.Relationship = categories.Select(it => it.Contents).SelectMany(it => it.Select(c => ObjectConvertor.ToCmis(c, includeRelationships))).ToArray(); } return(cmisObject); }
public object ToCms(CmisObject cmisObject) { MediaFolder textFolder = (MediaFolder)CmisFolderHelper.Parse(null, cmisObject.Id); textFolder.DisplayName = cmisObject.GetProperty("DisplayName").Value; textFolder.UserId = cmisObject.Properties.CreatedBy.SingleValue; textFolder.AllowedExtensions = ((CmisPropertyString)cmisObject.GetProperty("AllowedExtensions")).Value; return(textFolder); }
public object ToCms(CmisObject cmisObject) { TextContent content = new TextContent(); content.UUID = cmisObject.Id; if (cmisObject.Properties != null) { foreach (var property in cmisObject.Properties.Items) { content[property.LocalName] = CmisPropertyHelper.GetPropertyValue(property); } } return(content); }
public object ToCms(CmisObject cmisObject) { TextFolder textFolder = (TextFolder)CmisFolderHelper.Parse(null, cmisObject.Id); textFolder.DisplayName = cmisObject.GetProperty("DisplayName").Value; if (!string.IsNullOrEmpty(cmisObject.GetProperty("CategoryFolders").Value)) { textFolder.CategoryFolders = cmisObject.GetProperty("CategoryFolders").Value.Split(','); } textFolder.UserId = cmisObject.Properties.CreatedBy.SingleValue; textFolder.SchemaName = cmisObject.GetProperty("SchemaName").Value; return(textFolder); }
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); }
public static void deleteAndAssertObject(CmisObject targetObject, bool allVersions) { deleteAndAssertObject(targetObject.ObjectId, allVersions); }
/// <summary> /// Deletes Document or Folder object (<b>bjectCreator</b> instance) or Relationship object (<b>RelationshipObject</b> instance) /// </summary> /// <param name="targetObject"></param> /// <param name="messagePrefix"></param> protected void deleteObjectAndLogIfFailed(CmisObject targetObject, string messagePrefix) { try { if (targetObject is FileableObject) { deleteAndAssertObject(targetObject, true); } else { if (targetObject is RelationshipObject) { deleteAndAssertRelationship((RelationshipObject)targetObject); } else { logger.log("Invalid Object was specified for deletion. Object Type name: " + targetObject.GetType().Name); } } } catch (Exception e) { logger.log(messagePrefix + e.Message); } }