예제 #1
0
        public override BaseActionType[] GetActions(AbstractUserContext userContext, EntityActionType[] types)
        {
            List <BaseActionType> all = new List <BaseActionType>();

            all.Add(new EditEntityAction(typeof(JiraSettings), "Edit", "Edit"));
            return(all.ToArray());
        }
예제 #2
0
 public override BaseActionType[] GetActions(AbstractUserContext userContext, EntityActionType[] types)
 {
     return(new BaseActionType[]
     {
         new EditEntityAction(GetType(), "Edit Event", null),
     });
 }
예제 #3
0
 public override BaseActionType[] GetActions(AbstractUserContext userContext, EntityActionType[] types)
 {
     return(new BaseActionType[] { new EditEntityAction(typeof(DocusignSettings), "Edit", "")
                                   {
                                       IsDefaultGridAction = true
                                   } });
 }
예제 #4
0
        //[ORMField]
        //public FileDataReference[] UploadFile { get; set; }


        //[ORMField]
        //public FileDataReference[] DownloadFile { get; set; }

        public override BaseActionType[] GetActions(AbstractUserContext userContext, EntityActionType[] types)
        {
            List <BaseActionType> results = new List <BaseActionType>(base.GetActions(userContext, types));

            results.Add(new EditObjectAction(typeof(PythonSettings), "Edit", null, "Edit", () => { return(this); }, SaveChanges));

            return(results.ToArray());
        }
 //Method to spawn off a specified number of threads to run a specified flow a specified number of executions
 //userContext is the user who triggered whatever is calling this method.
 //executions is the number of times to execute the specified flow.
 //numberOfThreads is the number of threads to spawn for executions.
 //flowId is the flow to execute
 private static void SetExecutionsValue(AbstractUserContext userContext, int executions, int numberOfThreads, string flowId)
 {
     for (int i = 0; i < numberOfThreads; i++)
     {
         FlowExecutionThread flowExecutionThread = new FlowExecutionThread(executions, userContext, flowId);
         Thread thread = new Thread(new ThreadStart(flowExecutionThread.StartFlowExecution));
         thread.Start();
     }
 }
        public string GetStatus(AbstractUserContext userContext, string externalEntityInvocationId)
        {
            ORM <ExternalInvocationEntity> externalInvocationEntityOrm = new ORM <ExternalInvocationEntity>();
            ExternalInvocationEntity       externalInvocationEntity    = externalInvocationEntityOrm.Fetch(externalEntityInvocationId);

            Log.Warn("Get Status Operation Successfully Invoked");

            return(externalInvocationEntity.Status);
        }
 public override BaseActionType[] GetActions(AbstractUserContext userContext, EntityActionType[] types)
 {
     return(new BaseActionType[]
     {
         new EditEntityAction(GetType(), "Edit", null)
         {
             IsDefaultGridAction = true
         },
         new ConfirmAction("Refresh Entity Lists", null, "Refresh Entity Lists", "Refresh all entity lists now?", RefreshEntityLists)
     });
 }
예제 #8
0
 private void CreateLoanRule(AbstractUserContext usercontext, string entityid, string answer)
 {
     CreateElementRegistrationHelper.Create(
         new ElementContextInfo(
             entityid,
             ElementType.Rule,
             null,
             typeof(LoanRuleBehavior).FullName,
             null,
             answer), null, true
         );
 }
        public override BaseActionType[] GetActions(AbstractUserContext userContext, EntityActionType[] types)
        {
            List <BaseActionType> actions = new List <BaseActionType>(base.GetActions(userContext, types));

            actions.Add(new EditObjectAction(typeof(AzureAppInsightsSettings), "Edit Settings", null, "Edit Azure Insights", this,
                                             () =>
            {
                MetricsForAzureAppInsights.SetInstrumentationKey(ModuleSettingsAccessor <AzureAppInsightsSettings> .Instance.InstrumentationKey);
                ModuleSettingsAccessor <AzureAppInsightsSettings> .SaveSettings();
            }));
            return(actions.ToArray());
        }
 private void CreateApplicantFlow(AbstractUserContext usercontext, string entityid, string answer)
 {
     CreateElementRegistrationHelper.Create(
         new ElementContextInfo(
             entityid,
             ElementType.Flow,
             null,
             typeof(ApplicantFlowBehavior).FullName,
             null,
             answer), null, true
         );
 }
예제 #11
0
        public override BaseActionType[] GetActions(AbstractUserContext userContext, EntityActionType[] types)
        {
            List <BaseActionType> actions = new List <BaseActionType>(base.GetActions(userContext, types) ?? new BaseActionType[0]);

            actions.Add(new EditObjectAction(typeof(CRM2011Entity), "Edit", "", "", () => this, (usercontext, obj) => { ((CRM2011Entity)obj).Store(); }));
            actions.Add(
                new YesNoAction("Regenerate Code", "Regenerate Code",
                                new InvokeServiceMethod(RegenerateDataStructureOfSelectedEntity),
                                "",
                                string.Format("Are you sure you want to regenerate code of {0} entity?", crmEntityName))
                );
            return(actions.ToArray());
        }
        public void Complete(AbstractUserContext userContext, string externalEntityInvocationId)
        {
            ORM <ExternalInvocationEntity> externalInvocationEntityOrm = new ORM <ExternalInvocationEntity>();
            ExternalInvocationEntity       externalInvocationEntity    = externalInvocationEntityOrm.Fetch(externalEntityInvocationId);

            // Get the flow engine for the flow we'd like to complete
            FlowEngine engine = FlowEngine.GetEngine(externalInvocationEntity.FlowTrackingId);

            // Call Done to tell the Engine the Step is complete
            engine.Done(externalInvocationEntity.FlowTrackingId, externalInvocationEntity.StepTrackingId, new ResultData("Done"));

            // Mark the Entity Invocation Completed
            externalInvocationEntity.Status = "Completed";

            // Store the entity
            externalInvocationEntityOrm.Store(externalInvocationEntity);

            Log.Warn("Complete Operation Successfully Invoked");
        }
예제 #13
0
        public static void SetExecutionsValue(AbstractUserContext userContext, int executions, int numberOfThreads, string flowId, string unitTestName)
        {
            //PerformanceTestingSettings Settings = ModuleSettingsAccessor<PerformanceTestingSettings>.GetSettings();
            Log Log = new Log("Performance Testing");
            //Stopwatch TotalStopWatch = new Stopwatch();
            //TotalStopWatch.Start();
            int TotalFlowRuns = numberOfThreads * executions;

            Log.Error("Starting " + TotalFlowRuns + " Flow Runs for " + unitTestName);
            for (int i = 0; i < numberOfThreads; i++)
            {
                FlowExecutionThread flowExecutionThread = new FlowExecutionThread(executions, userContext, flowId);
                Thread thread = new Thread(new ThreadStart(flowExecutionThread.StartFlowExecution));
                thread.Start();
            }
            //TotalStopWatch.Stop();

            //Log.Error("Kicked Off " + TotalFlowRuns + " Flow Runs In " + TotalStopWatch.Elapsed.TotalSeconds);
            //Log.Error("Flow Run " + flowExecutionId + " took: " + innerStopWatch.Elapsed.TotalMilliseconds +
            //          " milliseconds.");
        }
예제 #14
0
        public void ListFlowToolboxSteps(string csvOutputPath, string csvFileName)
        {
            AbstractUserContext userContext   = UserContextHolder.GetCurrent();
            FlowEngine          currentEngine = FlowEngine.CurrentEngine;
            string flowId = currentEngine.CurrentTrackingData.FlowId;

            FlowEditSession flowEditSession = FlowEditService.Instance.OpenFlowForEditing(userContext, flowId);

            string[] toolboxCategories =
                FlowEditService.Instance.GetToolboxCategories(userContext, flowEditSession.FlowSessionId, new string[] {});

            List <string> stepInfos = new List <string>();

            foreach (string category in toolboxCategories)
            {
                stepInfos.AddRange(GetStepsInSubCategory(userContext, flowEditSession.FlowSessionId, new [] { category }));
            }

            string filePath = Path.Combine(csvOutputPath, csvFileName);

            File.WriteAllLines(filePath, stepInfos);
        }
        public override BaseActionType[] GetActions(AbstractUserContext userContext, EntityActionType[] types)
        {
            Account userAccount = userContext.GetAccount();

            FolderPermission permission = FolderService.Instance.GetAccountEffectivePermission(
                new SystemUserContext(), this.EntityFolderID, userAccount.AccountID);

            bool canAdministrate = FolderPermission.CanAdministrate == (FolderPermission.CanAdministrate & permission) ||
                                   userAccount.GetUserRights <PortalAdministratorModuleRight>() != null ||
                                   userAccount.IsAdministrator();

            if (canAdministrate)
            {
                return new BaseActionType[]
                       {
                           new EditEntityAction(GetType(), "Edit", null),
                       }
            }
            ;

            return(new BaseActionType[0]);
        }
    }
예제 #16
0
        private List <string> GetStepsInSubCategory(AbstractUserContext userContext, string flowSessionId, string[] nodes)
        {
            List <string> stepInfos = new List <string>();

            FlowStepToolboxInformation[] flowStepToolboxInformation = FlowEditService.Instance.GetToolboxStepsInformation(userContext, flowSessionId, nodes);
            foreach (FlowStepToolboxInformation toolboxInformation in flowStepToolboxInformation)
            {
                string categoryString = "";
                for (int i = 0; i < nodes.Length; i++)
                {
                    if (i == nodes.Length - 1)
                    {
                        categoryString += $"{nodes[i]}";
                        continue;
                    }

                    categoryString += $"{nodes[i]}/";
                }

                stepInfos.Add($"{categoryString},{toolboxInformation.Label}");
            }


            string[] toolboxCategories = FlowEditService.Instance.GetToolboxCategories(userContext, flowSessionId, nodes);
            foreach (string toolboxCategory in toolboxCategories)
            {
                if (!string.Equals(toolboxCategory, "[Root Folder]") &&
                    !string.Equals(toolboxCategory, "[Current Folder]") &&
                    !string.Equals(toolboxCategory, ".Net Libraries") &&
                    !string.Equals(toolboxCategory, "User Defined Types"))
                {
                    stepInfos.AddRange(GetStepsInSubCategory(userContext, flowSessionId, nodes.Add(toolboxCategory)));
                }
            }

            return(stepInfos);
        }
        //Method to create a flow with the implemented behavior using Element Registration Helper
        //entityId is the ID of the folder being acted on
        //answer is the text provided by the user who triggered the GetStringAction and will become the name of the rule
        private void CreateRestrictedFlow(AbstractUserContext userContext, string entityID, string answer)
        {
            //Create the flow with the implemented flow behavior
            ElementContextInfo info = new ElementContextInfo(entityID, ElementType.Flow, null,
                                                             typeof(RestrictedStepsFlowBehavior).FullName, null, answer);

            string createdElementRegistrationId = null;

            if (info.ShowIntent)
            {
                FlowInputDataDescription[] inputs = (info.ShowData) ? info.FlowInputs : null;
                string flowExecutionsInFolderId   = (info.ShowTracking && info.SetupReportingOnFlowExecution) ? info.StoreFlowExecutionsInFolderId : null;
                string flowRunIdPrefix            = (info.ShowTracking && info.SetupReportingOnFlowExecution) ? info.Prefix : null;

                // we are going to create based on intent
                createdElementRegistrationId =
                    ConfigurationStorageService.Instance.CreateFlowWithExtraSettings(UserContextHolder.GetCurrent(),
                                                                                     info.FolderId, info.Name, inputs, flowExecutionsInFolderId, flowRunIdPrefix);
            }
            else
            if (info.BasedOn == CreateElementBasedOn.Template && !string.IsNullOrEmpty(info.TemplateId))
            {
                createdElementRegistrationId =
                    ConfigurationStorageService.Instance.CreateFlowFromTemplate(UserContextHolder.GetCurrent(), info.FolderId, info.Name, info.TemplateId);
            }
            else
            if (info.BasedOn == CreateElementBasedOn.Behavior && !string.IsNullOrWhiteSpace(info.BehaviorType))
            {
                createdElementRegistrationId =
                    ConfigurationStorageService.Instance.CreateFlowFromTemplateAndBehaviorType(UserContextHolder.GetCurrent(), info.FolderId, info.Name, null, info.BehaviorType);
            }

            if (string.IsNullOrEmpty(createdElementRegistrationId))
            {
                ConfigurationStorageService.Instance.CreateFlow(UserContextHolder.GetCurrent(), info.FolderId, info.Name);
            }
        }
예제 #18
0
        private void RegenerateDataStructureOfSelectedEntity(AbstractUserContext userContext, string entityId)
        {
            try
            {
                ORM <CRM2011Entity> crmEntityORM = new ORM <CRM2011Entity>();
                CRM2011Entity       crmEntity    = crmEntityORM.Fetch(entityId);
                if (crmEntity != null)
                {
                    log.Info(string.Format("started regenerating data structure of {0} entity", crmEntity.CRMEntityName));
                    ORM <SimpleFlowStructure> simpleFlowStructureORM = new ORM <SimpleFlowStructure>();
                    SimpleFlowStructure       simpleFlowStructure    = simpleFlowStructureORM.Fetch(new WhereCondition[]
                    {
                        new FieldWhereCondition("data_type_name", QueryMatchType.Equals, crmEntity.CRMEntityName),
                        new FieldWhereCondition("data_type_name_space", QueryMatchType.Equals, crmEntity.GetCrmEntityNamespace())
                    }).FirstOrDefault();
                    if (simpleFlowStructure != null)
                    {
                        IOrganizationService serviceProxy = GetCRMClientServiceProxy();
                        if (serviceProxy == null)
                        {
                            throw new BusinessRuleException("Unable to found CRM service client proxy");
                        }

                        simpleFlowStructure.Children = null;
                        AddOrUpdateCRMEntityWithDataStructure(serviceProxy, crmEntity.CRMEntityName, simpleFlowStructure);
                        // Make sure the updated CRMEntityFields are stored:
                        crmEntityORM.Store(this, true, false);
                    }
                    log.Info(string.Format("completed regenerating data structure of {0} entity", crmEntity.CRMEntityName));
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw ex;
            }
        }
예제 #19
0
        private void AddServer(AbstractUserContext usercontext, object addServerObject)
        {
            AddOPCServer addServer = (AddOPCServer)addServerObject;

            if (string.IsNullOrEmpty(addServer.Name))
            {
                throw new Exception("Name is required");
            }
            if (string.IsNullOrEmpty(addServer.Url))
            {
                throw new Exception("URL is required");
            }
            if (string.IsNullOrEmpty(addServer.AgentId))
            {
                throw new Exception("Agent is required");
            }

            Folder[] serverFolders = FolderService.Instance.GetSubFolders(usercontext, addServer.FolderId);
            foreach (Folder serverFolder in serverFolders)
            {
                OPCServerFolderBehaviorData extData = serverFolder.ExtensionData as OPCServerFolderBehaviorData;
                if (extData?.Url == addServer.Url)
                {
                    throw new Exception($"A server ({serverFolder.EntityName}) already exists with this URL ({addServer.Url}).");
                }
            }

            Folder f = new Folder(addServer.Name, addServer.FolderId);

            f.FolderBehaviorType = typeof(OPCServerFolderBehavior).FullName;
            f.ExtensionData      = new OPCServerFolderBehaviorData {
                Url = addServer.Url, AgentId = addServer.AgentId
            };
            f.Store();
            f.ExtensionData.Store();
        }
예제 #20
0
 //Constructor to initialize the private variables
 public FlowExecutionThread(int executions, AbstractUserContext userContext, string flowId)
 {
     this._executions  = executions;
     this._userContext = userContext;
     this._flowId      = flowId;
 }
예제 #21
0
        private void AddCRMEntity(AbstractUserContext usercontext, object obj)
        {
            CRM2011Entity field = (CRM2011Entity)obj;

            new DynamicORM().Store(field);
        }
 //Wrapper method to call a method on action execution that requires more than the standard action parameters
 //See above for Parameters
 private static void SetExecutionsValueNonBatch64(AbstractUserContext userContext, string entityId, int answer)
 {
     SetExecutionsValue(userContext, answer, 64, "803f56bd-51a7-11ea-8232-a72eeb3fabdb");
 }
예제 #23
0
 private void SaveChanges(AbstractUserContext userContext, object obj)
 {
     new DynamicORM().Store((IORMEntity)obj);
 }
 //Wrapper method to call a method on action execution that requires more than the standard action parameters
 //See above for Parameters
 private static void SetExecutionsValueBatch64(AbstractUserContext userContext, string entityId, int answer)
 {
     SetExecutionsValue(userContext, answer, 64, "f0a5627e-5338-11ea-8232-a72eeb3fabdb");
 }
예제 #25
0
        //Wrapper method to call a method on action execution that requires more than the standard action parameters
        //Parameters:
        //User Context - The User Context of the User who executed the Action
        //Entity ID - The Entity ID of the Folder the Action Lives on
        //Answer - The integer input in the action input field

        public void RunTest(AbstractUserContext userContext, _Mapper answer)
        {
            //PerformanceTestingSettings Settings = ModuleSettingsAccessor<PerformanceTestingSettings>.GetSettings();

            SetExecutionsValue(userContext, answer.executions, answer.numberOfThreads, answer.flowId, answer.UnitTestName);
        }