public override Response Execute()
        {
            var response = new Response()
            {
                Success = true, Message = ""
            };

            try
            {
                var artifactQueries     = new ArtifactQueries();
                var sqlQueryHelper      = new Helpers.SQL.SqlQueryHelper();
                var workspaceArtifactId = Helper.GetActiveCaseID();
                var svcManager          = Helper.GetServicesManager();
                var identityCurrentUser = ExecutionIdentity.CurrentUser;
                var tempTableName       = TempTableNameWithParentArtifactsToDelete;
                var logger    = GetLoggerAsync().Result;
                var dbContext = Helper.GetDBContext(workspaceArtifactId);

                var importJob = new ImportJob(svcManager, sqlQueryHelper, artifactQueries, workspaceArtifactId, identityCurrentUser, dbContext, tempTableName, logger);
                response = importJob.ExecutePreCascadeDelete().Result;
            }
            catch (Exception ex)
            {
                response.Success   = false;
                response.Exception = new SystemException("Pre Cascade Delete Failure: " + ex.Message);
            }

            return(response);
        }
        public override Response Execute()
        {
            var response = new Response()
            {
                Success = true, Message = ""
            };

            try
            {
                var artifactQueries     = new ArtifactQueries();
                var workspaceArtifactId = Helper.GetActiveCaseID();
                var svcManager          = Helper.GetServicesManager();
                var identityCurrentUser = ExecutionIdentity.CurrentUser;
                var activeArtifactId    = ActiveArtifact.ArtifactID;
                var logger = GetLoggerAsync().Result;

                var importJob = new ImportJob(svcManager, artifactQueries, workspaceArtifactId, identityCurrentUser, activeArtifactId, logger);
                response = importJob.ExecutePreDelete().Result;
            }
            catch (Exception ex)
            {
                response.Success   = false;
                response.Exception = new SystemException("Pre Delete Failure: " + ex.Message);
            }

            return(response);
        }
Ejemplo n.º 3
0
        public override Response Execute()
        {
            var response = new Response()
            {
                Message = string.Empty, Success = true
            };

            if (Utility.UserIsAdmin(Helper, Helper.GetAuthenticationManager().UserInfo.ArtifactID, ArtifactQueries))
            {
                var layoutArtifactIdByGuid = GetArtifactIdByGuid(Constant.Guids.Layouts.ImportUtilityJob.ImportUtilityJobLayout);
                var layoutArtifactId       = ActiveLayout.ArtifactID;

                //check if this is the Import Job layout
                if (layoutArtifactId == layoutArtifactIdByGuid)
                {
                    var svcManager          = Helper.GetServicesManager();
                    var artifactQueries     = new ArtifactQueries();
                    var sqlQueryHelper      = new Helpers.SQL.SqlQueryHelper();
                    var eddsDbContext       = Helper.GetDBContext(-1);
                    var workspaceArtifactId = Helper.GetActiveCaseID();
                    var activeArtifact      = ActiveArtifact;
                    var identityCurrentUser = ExecutionIdentity.CurrentUser;
                    var logger    = GetLoggerAsync().Result;
                    var importJob = new ImportJob(svcManager, artifactQueries, eddsDbContext, sqlQueryHelper, workspaceArtifactId, identityCurrentUser, activeArtifact, logger);

                    response = importJob.ExecutePreSave(ActiveArtifact.IsNew, GetArtifactIdByGuid(Constant.Guids.Field.ImportUtilityJob.Status)).Result;
                }
            }
            else
            {
                response.Success = false;
                response.Message = "Only System Administrators are allowed to Create Import Jobs";
            }

            return(response);
        }