Exemplo n.º 1
0
        public ImportResultContract ProcessSession(string sessionId, long?projectId, int userId, string uploadMessage,
                                                   ProjectTypeContract projectType, FulltextStoreTypeContract storeType,
                                                   IList <PermissionFromAuthContract> autoImportPermissions)
        {
            if (!m_activeSessionManager.ContainsSessionId(sessionId))
            {
                return(new ImportResultContract {
                    Success = false
                });
            }

            ResourceSessionDirector director = m_activeSessionManager.GetDirectorBySessionId(sessionId);

            director.SetSessionInfoValue(SessionInfo.Message, uploadMessage);
            director.SetSessionInfoValue(SessionInfo.CreateTime, DateTime.UtcNow);
            director.SetSessionInfoValue(SessionInfo.ProjectId, projectId);
            director.SetSessionInfoValue(SessionInfo.UserId, userId);
            director.SetSessionInfoValue(SessionInfo.AutoImportPermissions, autoImportPermissions);
            director.SetSessionInfoValue(SessionInfo.ProjectType, projectType);
            director.SetSessionInfoValue(SessionInfo.StoreType, storeType);
            bool result = m_resourceProcessorManager.ProcessSessionResources(director);
            ImportResultContract importResult = new ImportResultContract(
                director.GetSessionInfoValue <long>(SessionInfo.ProjectId),
                result
                );

            m_activeSessionManager.FinalizeSession(sessionId);
            return(importResult);
        }
Exemplo n.º 2
0
        public bool ProcessSession(string sessionId, string uploadMessage)
        {
            lock (m_lock)
            {
                if (!m_resourceDirectors.ContainsKey(sessionId))
                {
                    return(false);
                }
            }
            ResourceSessionDirector director = GetDirectorBySessionId(sessionId);

            director.SetSessionInfoValue(SessionInfo.Message, uploadMessage);
            director.SetSessionInfoValue(SessionInfo.CreateTime, DateTime.UtcNow);
            bool result = m_resourceProcessorManager.ProcessSessionResources(director);

            FinalizeSession(sessionId);
            return(result);
        }