Example #1
0
        //public ContainerBase AdamOfField { get; set; }
        public FolderOfField(AdamAppContext <TFolderId, TFileId> adamContext, Guid entityGuid, string fieldName)
            : base(adamContext)
        {
            var adamOfField = new AdamOfField <TFolderId, TFileId>(AdamContext, entityGuid, fieldName);

            if (!AdamContext.Exists(adamOfField.Root))
            {
                return;
            }

            var f = AdamContext.Folder(adamOfField.Root);

            if (f == null)
            {
                return;
            }

            Path     = f.Path;
            Modified = f.Modified;
            SysId    = f.SysId;
            Created  = f.Created;
            Modified = f.Modified;

            // IAdamItem interface properties
            Name = f.Name;
            Url  = f.Url;
        }
Example #2
0
        private static File DnnToAdam(AdamAppContext appContext, IFileInfo f)
        => new File(appContext)
        {
            FullName  = f.FileName,
            Extension = f.Extension,
            Size      = f.Size,
            Id        = f.FileId,
            Folder    = f.Folder,
            FolderId  = f.FolderId,

            Path = f.RelativePath,

            Created = f.CreatedOnDate,
            Name    = System.IO.Path.GetFileNameWithoutExtension(f.FileName)

                      // commented out stuff is from DNN
                      // but it will probably never be cross-platform
                      //UniqueId = f.UniqueId,
                      //VersionGuid = f.VersionGuid,
                      //PortalId = f.PortalId,
                      //Width = f.Width,
                      //Height = f.Height,
                      //ContentType = f.ContentType,
                      //StorageLocation = f.StorageLocation,
                      //IsCached = f.IsCached,
                      //SHA1Hash = f.SHA1Hash,
        };
Example #3
0
        /// <summary>
        /// Get the first metadata entity of an item - or return a fake one instead
        /// </summary>
        internal static IDynamicEntity GetFirstOrFake(AdamAppContext appContext, int id, bool isFolder)
        {
            var meta = GetFirstMetadata(appContext.AppRuntime, id, isFolder)
                       ?? Build.FakeEntity(Eav.Constants.TransientAppId);

            return(new DynamicEntity(meta, new[] { Thread.CurrentThread.CurrentCulture.Name }, appContext.CompatibilityLevel, appContext.BlockBuilder));
        }
Example #4
0
        private Folder DnnToAdam(AdamAppContext appContext, IFolderInfo f)
        => new Folder(appContext, this)
        {
            Path = f.FolderPath,
            Id   = f.FolderID,

            Name     = f.DisplayName,
            Created  = f.CreatedOnDate,
            Modified = f.LastUpdated,

            // commented out stuff is from DNN
            // but it will probably never be cross-platform
            //DisplayName = f.DisplayName,
            //DisplayPath = f.DisplayPath,            //PortalID = f.PortalID,
            //MappedPath = f.MappedPath,
            //StorageLocation = f.StorageLocation,
            //IsProtected = f.IsProtected,
            //IsCached = f.IsCached,
            //FolderMappingID = f.FolderMappingID,
            //IsVersioned = f.IsVersioned,
            //KeyID = (f as FolderInfo)?.KeyID ?? 0,
            //ParentID = f.ParentID,
            //UniqueId = f.UniqueId,
            //VersionGuid = f.VersionGuid,
            //WorkflowID = f.WorkflowID,
        };
Example #5
0
        private List <Folder> GetFolders(IFolderInfo fldObj, AdamAppContext appContext = null)
        {
            var firstList = _folderManager.GetFolders(fldObj);
            var folders   = firstList?.Select(f => DnnToAdam(appContext, f)).ToList()
                            ?? new List <Folder>();

            return(folders);
        }
Example #6
0
        public List <File> GetFiles(int folderId, AdamAppContext appContext)
        {
            var fldObj    = _folderManager.GetFolder(folderId);
            var firstList = _folderManager.GetFiles(fldObj);

            var files = firstList?.Select(f => DnnToAdam(appContext, f)).ToList()
                        ?? new List <File>();

            return(files);
        }
Example #7
0
        private Folder DnnToAdam(AdamAppContext appContext, IFolderInfo f)
        => new Folder(appContext, this)
        {
            Path = f.FolderPath,
            Id   = f.FolderID,

            Name     = f.DisplayName,
            Created  = f.CreatedOnDate,
            Modified = f.LastUpdated,
            // note: there are more properties in the DNN data, but we don't use it,
            // because it will probably never be cross-platform
        };
Example #8
0
        /// <summary>
        /// Get the first metadata entity of an item - or return a fake one instead
        /// </summary>
        internal IDynamicEntity GetFirstOrFake(AdamAppContext appContext, MetadataFor mdId)
        {
            var meta = GetFirstMetadata(appContext.AppRuntime, mdId)
                       ?? Build.FakeEntity(Eav.Constants.TransientAppId);
            var dynEnt = new DynamicEntity(meta,
                                           (appContext.AppContext?.Site).SafeLanguagePriorityCodes(),
                                           appContext.CompatibilityLevel,
                                           null)
            {
                ServiceProviderOrNull = _serviceProvider
            };

            return(dynEnt);
        }
Example #9
0
        public List <File> GetFiles(int folderId, AdamAppContext appContext)
        {
            var fldObj = _folderManager.GetFolder(folderId);

            // sometimes the folder doesn't exist for whatever reason
            if (fldObj == null)
            {
                return(new List <File>());
            }

            // try to find the files
            var firstList = _folderManager.GetFiles(fldObj);
            var files     = firstList?.Select(f => DnnToAdam(appContext, f)).ToList()
                            ?? new List <File>();

            return(files);
        }
Example #10
0
        private static File DnnToAdam(AdamAppContext appContext, IFileInfo f)
        => new File(appContext)
        {
            FullName  = f.FileName,
            Extension = f.Extension,
            Size      = f.Size,
            Id        = f.FileId,
            Folder    = f.Folder,
            FolderId  = f.FolderId,

            Path = f.RelativePath,

            Created = f.CreatedOnDate,
            Name    = System.IO.Path.GetFileNameWithoutExtension(f.FileName)
                      // note: there are more properties in the DNN data, but we don't use it,
                      // because it will probably never be cross-platform
        };
Example #11
0
        public FolderOfField(IEnvironmentFileSystem enfFileSystem, AdamAppContext appContext, Guid entityGuid, string fieldName) : base(appContext, enfFileSystem)
        {
            Container = new ContainerOfField(AppContext, entityGuid, fieldName);

            if (!Exists)
            {
                return;
            }

            // ReSharper disable once PatternAlwaysOfType
            if (!(AppContext.Folder(Container.Root) is Eav.Apps.Assets.Folder f))
            {
                return;
            }

            Path     = f.Path;
            Modified = f.Modified;
            Id       = f.Id;
            Created  = f.Created;
            Modified = f.Modified;

            // IAdamItem interface properties
            Name = f.Name;
        }
Example #12
0
 public ContainerOfField(AdamAppContext appContext, Guid eGuid, string fName) : base(appContext)
 {
     _entityGuid = eGuid;
     _fieldName  = fName;
 }
Example #13
0
 public Folder(AdamAppContext <TFolderId, TFileId> adamContext)
 {
     AdamContext = adamContext;
 }
Example #14
0
 public File(AdamAppContext appContext)
 {
     AppContext = appContext;
 }
Example #15
0
 public Folder(AdamAppContext appContext, IEnvironmentFileSystem fileSystem)
 {
     AppContext  = appContext;
     _fileSystem = fileSystem;
 }
Example #16
0
 public Export(AdamAppContext adm)
 {
     _root  = adm.RootFolder;
     _envFs = adm.EnvironmentFs;
 }
Example #17
0
 public Export(AdamAppContext <TFolderId, TFileId> adm)
 {
     _root  = adm.RootFolder;
     _envFs = adm.AdamFs;
 }
Example #18
0
 public AdamOfField(AdamAppContext <TFolderId, TFileId> appContext, Guid eGuid, string fName) : base(appContext)
 {
     _entityGuid = eGuid;
     _fieldName  = fName;
 }
Example #19
0
 public File(AdamAppContext adamContext)
 {
     AdamContext = adamContext;
 }
Example #20
0
        /// <summary>
        /// Get the first metadata entity of an item - or return a fake one instead
        /// </summary>
        internal static DynamicEntity GetFirstOrFake(AdamAppContext appContext, int id, bool isFolder)
        {
            var meta = GetFirstMetadata(appContext.App, id, isFolder) ?? CreateFakeMetadata();

            return(new DynamicEntity(meta, new[] { Thread.CurrentThread.CurrentCulture.Name }, appContext.SxcInstance));
        }
Example #21
0
 public Eav.Apps.Assets.Folder Get(int tenantId, string path, AdamAppContext appContext)
 => DnnToAdam(appContext, _folderManager.GetFolder(tenantId, path));
Example #22
0
 public List <Folder> GetFolders(int folderId, AdamAppContext appContext)
 => GetFolders(GetFolder(folderId), appContext);
Example #23
0
 public static int GetMetadataId(AdamAppContext appContext, int id, bool isFolder)
 => GetFirstMetadata(appContext.App, id, isFolder)?.EntityId ?? 0;
Example #24
0
 protected ContainerBase(AdamAppContext appContext)
 {
     AppContext = appContext;
 }