Example #1
0
        public static List <POCO.SakaiSiteEntity> GetSites(DataConfig providerConfig, POCO.System system, POCO.SakaiSite site)
        {
            List <Filter> filters  = new List <Filter>();
            Filter        pkFilter = new Filter("PartitionKey", Utils.CleanTableKey(system.PartitionKey), "eq");

            filters.Add(pkFilter);
            Filter rkFilter = new Filter("RowKey", Utils.CleanTableKey(site.SITE_ID), "eq");

            filters.Add(rkFilter);

            return(SakaiSite.GetSites(providerConfig, filters));
        }
Example #2
0
        public static string AddSite(DataConfig providerConfig, POCO.System system, POCO.SakaiSite sourceSite)
        {
            POCO.SakaiSiteEntity siteEntity = new SakaiSiteEntity(Utils.CleanTableKey(system.PartitionKey), Utils.CleanTableKey(sourceSite.SITE_ID));
            siteEntity.CPStatus          = string.Empty;
            siteEntity.ItemCount         = 0;
            siteEntity.Name              = sourceSite.TITLE;
            siteEntity.ServerRelativeUrl = sourceSite.SITE_ID;
            siteEntity.TimeCreated       = sourceSite.CREATEDON.ToUniversalTime();
            siteEntity.TimeLastModified  = sourceSite.MODIFIEDON.ToUniversalTime();

            return(SakaiSite.AddSite(providerConfig, siteEntity));
        }
Example #3
0
        public static string AddFile(DataConfig providerConfig, POCO.System system, POCO.SakaiSite sourceSite, POCO.SakaiContentResource sourceDocument)
        {
            // Set the PartitionKey and RowKey
            string sakaiUIDocument = "/" + sourceSite.SITE_ID + sourceDocument.RESOURCE_ID;
            string pkey            = Utils.CleanTableKey(sakaiUIDocument);
            string rkey            = Utils.CleanTableKey(sourceDocument.TimeLastModified.ToString(Utils.ISODateFormat));

            // Get the file name from the file path
            string fileName = sourceDocument.RESOURCE_ID.Substring(sourceDocument.RESOURCE_ID.LastIndexOf("/") + 1);

            POCO.SakaiFile sakaifile = new SakaiFile(pkey, rkey);
            //sakaifile.BatchGuid = string.Empty;
            sakaifile.BatchStatus       = string.Empty;
            sakaifile.CPFolderStatus    = string.Empty;
            sakaifile.CreationTime      = sourceDocument.TimeCreated;
            sakaifile.ItemCount         = 0;
            sakaifile.ItemUri           = sakaiUIDocument;
            sakaifile.LastModifiedTime  = sourceDocument.TimeLastModified;
            sakaifile.Name              = fileName;
            sakaifile.ServerRelativeUrl = sourceDocument.FILE_PATH;
            sakaifile.SizeInBytes       = sourceDocument.FILE_SIZE;
            sakaifile.SourceFileName    = fileName;
            sakaifile.SourceRelativeUrl = sakaiUIDocument;
            sakaifile.UniqueId          = sourceDocument.RESOURCE_UUID;
            sakaifile.Version           = 0;

            //POCO.SakaiDocumentEntity docEntity = new SakaiDocumentEntity(Utils.CleanTableKey(sourceSite.SITE_ID), Utils.CleanTableKey(sourceDocument.FILE_PATH));
            //docEntity.CPStatus = string.Empty;
            //docEntity.UniqueId = sourceDocument.RESOURCE_ID;
            //docEntity.ItemCount = 0;
            //docEntity.Name = fileName;
            //docEntity.ServerRelativeUrl = sourceDocument.FILE_PATH;
            //docEntity.TimeCreated = sourceDocument.TimeCreated;
            //docEntity.TimeLastModified = sourceDocument.TimeLastModified;
            //docEntity.Title = fileName;

            return(SakaiSite.AddFile(providerConfig, sakaifile));
        }