예제 #1
0
        internal PowerShellResults <JsonDictionary <object> > GetProgress(string progressId, bool async)
        {
            string text = this.workflow ?? "GetProgress";

            if (!string.IsNullOrEmpty(this.schema) && this.IsWorkflowDefined(text))
            {
                return(this.ExecuteProgressWorkflow(text, progressId));
            }
            if (async)
            {
                DDIHelper.ProgressIdForGetListAsync = progressId;
                DDIParameters               ddiparameters     = new DDIParameters();
                AsyncGetListContext         registeredContext = AsyncServiceManager.GetRegisteredContext(progressId);
                Dictionary <string, object> dictionary;
                if (registeredContext != null && registeredContext.Parameters != null && registeredContext.Parameters.Parameters != null)
                {
                    dictionary = registeredContext.Parameters.Parameters.RawDictionary;
                }
                else
                {
                    dictionary = new Dictionary <string, object>();
                }
                if (registeredContext != null && !string.IsNullOrEmpty(registeredContext.WorkflowOutput))
                {
                    dictionary["workflowOutput"] = registeredContext.WorkflowOutput;
                }
                dictionary["ProgressId"] = progressId;
                ddiparameters.Parameters = new JsonDictionary <object>(dictionary);
                return(this.GetListCommon(ddiparameters, null, true));
            }
            return(AsyncServiceManager.GetProgress(progressId));
        }
예제 #2
0
 public static void FaultIfNull(this DDIParameters properties, string parameterName)
 {
     if (properties == null)
     {
         throw new FaultException(new ArgumentNullException(parameterName).Message);
     }
 }
예제 #3
0
        private PowerShellResults <JsonDictionary <object> > ExecuteProgressWorkflow(string executingWorkflowName, string progressId)
        {
            DDIParameters ddiparameters            = new DDIParameters();
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            dictionary["ProgressId"] = progressId;
            ddiparameters.Parameters = new JsonDictionary <object>(dictionary);
            return(this.Execute(executingWorkflowName, null, ddiparameters));
        }
예제 #4
0
        internal PowerShellResults RemoveObjects(Identity[] identities, DDIParameters parameters)
        {
            if (identities == null)
            {
                throw new FaultException(new ArgumentNullException("identities").Message);
            }
            this.ValidateIdentities(identities);
            string text = this.workflow ?? "RemoveObjects";

            return(new PowerShellResults(this.Execute(text, identities, parameters)));
        }
예제 #5
0
        private List <string> InitializeDDIParameters(WSDataHandler dataHandler, DDIParameters parameters)
        {
            List <string> list = new List <string>();

            if (parameters != null && parameters.Parameters != null)
            {
                Dictionary <string, object> dictionary = parameters.Parameters;
                foreach (string text in dictionary.Keys)
                {
                    if (dataHandler.Table.Columns.Contains(text))
                    {
                        dataHandler.InputValue(text, dictionary[text]);
                        list.Add(text);
                    }
                }
            }
            return(list);
        }
예제 #6
0
        private PowerShellResults <JsonDictionary <object> > GetListCommon(DDIParameters filter, SortOptions sort, bool forGetProgress)
        {
            string        workflowName  = this.workflow ?? "GetList";
            WSDataHandler wsdataHandler = new WSListDataHandler(this.schemaFilesInstallPath, this.schema, workflowName, filter, sort);

            this.RaiseWSDataHandlerCreatedEvent(wsdataHandler);
            this.SetWorkflowOutput(workflowName, wsdataHandler, filter);
            wsdataHandler.DataObjectStore.SetModifiedColumns(this.InitializeDDIParameters(wsdataHandler, filter));
            wsdataHandler.DataObjectStore.IsGetListWorkflow = true;
            if (filter != null && filter.Parameters != null && filter.Parameters.ContainsKey("ProgressId") && !forGetProgress)
            {
                wsdataHandler.DataObjectStore.AsyncType = ListAsyncType.GetListEndLoad;
                DDIHelper.ProgressIdForGetListAsync     = (string)filter.Parameters["ProgressId"];
            }
            else if (DDIHelper.IsGetListAsync)
            {
                wsdataHandler.DataObjectStore.AsyncType = ListAsyncType.GetListAsync;
            }
            else if (DDIHelper.IsGetListPreLoad)
            {
                wsdataHandler.DataObjectStore.AsyncType = ListAsyncType.GetListPreLoad;
            }
            PowerShellResults <JsonDictionary <object> > powerShellResults = wsdataHandler.Execute();

            if (powerShellResults.HasWarnings)
            {
                for (int i = 0; i < powerShellResults.Warnings.Length; i++)
                {
                    if (powerShellResults.Warnings[i] == Strings.WarningMoreResultsAvailable)
                    {
                        powerShellResults.Warnings[i] = ClientStrings.ListViewMoreResultsWarning;
                    }
                }
            }
            return(powerShellResults);
        }
예제 #7
0
        public PowerShellResults <JsonDictionary <object> > SetObject(Identity identity, DDIParameters properties)
        {
            DDIServiceHelper ddiserviceHelper = this.CreateDDIServiceHelper();

            return(ddiserviceHelper.SetObject(identity, properties));
        }
예제 #8
0
        public PowerShellResults <JsonDictionary <object> > GetList(DDIParameters filter, SortOptions sort)
        {
            DDIServiceHelper ddiserviceHelper = this.CreateDDIServiceHelper();

            return(ddiserviceHelper.GetList(filter, sort));
        }
예제 #9
0
        public PowerShellResults <JsonDictionary <object> > MultiObjectExecute(Identity[] identities, DDIParameters parameters)
        {
            DDIServiceHelper ddiserviceHelper = this.CreateDDIServiceHelper();

            return(ddiserviceHelper.MultiObjectExecute(identities, parameters));
        }
예제 #10
0
 public WSListDataHandler(string schemaFilesInstallPath, string resourceName, string workflowName, DDIParameters parameters, SortOptions sortOptions) : base(schemaFilesInstallPath, resourceName, workflowName, parameters)
 {
     this.sortOptions = sortOptions;
 }
예제 #11
0
 public WSDataHandler(string schemaFilesInstallPath, string resourceName, string workflowName, DDIParameters parameters = null) : base(schemaFilesInstallPath, resourceName)
 {
     this.Construct(workflowName);
     this.parameters = parameters;
 }
예제 #12
0
 internal PowerShellResults <JsonDictionary <object> > GetList(DDIParameters filter, SortOptions sort)
 {
     return(this.GetListCommon(filter, sort, false));
 }
예제 #13
0
        private PowerShellResults <JsonDictionary <object> > Execute(string workflow, Identity[] identities, DDIParameters properties)
        {
            WSDataHandler wsdataHandler = new WSSingleObjectDataHandler(this.schemaFilesInstallPath, this.schema, workflow);

            this.RaiseWSDataHandlerCreatedEvent(wsdataHandler);
            if (identities != null)
            {
                wsdataHandler.InputIdentity(identities);
            }
            wsdataHandler.OutputVariableWorkflow = "GetList";
            wsdataHandler.DataObjectStore.SetModifiedColumns(this.InitializeDDIParameters(wsdataHandler, properties));
            return(wsdataHandler.Execute());
        }
예제 #14
0
 internal PowerShellResults <JsonDictionary <object> > SingleObjectExecute(Identity identity, DDIParameters properties)
 {
     return(this.Execute(this.workflow, (identity == null) ? null : new Identity[]
     {
         identity
     }, properties));
 }
예제 #15
0
 internal PowerShellResults <JsonDictionary <object> > MultiObjectExecute(Identity[] identities, DDIParameters parameters)
 {
     this.ValidateIdentities(identities);
     return(this.Execute(this.workflow, identities, parameters));
 }
예제 #16
0
        public PowerShellResults <JsonDictionary <object> > NewObject(DDIParameters properties)
        {
            DDIServiceHelper ddiserviceHelper = this.CreateDDIServiceHelper();

            return(ddiserviceHelper.NewObject(properties));
        }
예제 #17
0
        public PowerShellResults RemoveObjects(Identity[] identities, DDIParameters parameters)
        {
            DDIServiceHelper ddiserviceHelper = this.CreateDDIServiceHelper();

            return(ddiserviceHelper.RemoveObjects(identities, parameters));
        }
예제 #18
0
        private void SetWorkflowOutput(string workflowName, WSDataHandler dataHandler, DDIParameters filter)
        {
            Workflow workFlow = dataHandler.GetWorkFlow(workflowName);
            string   text     = null;

            if (filter != null && filter.Parameters != null)
            {
                Dictionary <string, object> dictionary = filter.Parameters;
                if (dictionary.ContainsKey("workflowOutput"))
                {
                    text = (string)dictionary["workflowOutput"];
                }
                else if (dictionary.ContainsKey("AdditionalCustomOutputs"))
                {
                    text = workFlow.Output + ',' + dictionary["AdditionalCustomOutputs"];
                }
            }
            if (!string.IsNullOrWhiteSpace(text) && workFlow != null)
            {
                workFlow.Output = text;
            }
        }
예제 #19
0
        internal PowerShellResults <JsonDictionary <object> > SetObject(Identity identity, DDIParameters properties)
        {
            properties.FaultIfNull("properties");
            string text = this.workflow ?? "SetObject";

            return(this.Execute(text, (identity == null) ? null : new Identity[]
            {
                identity
            }, properties));
        }
예제 #20
0
        internal PowerShellResults <JsonDictionary <object> > NewObject(DDIParameters properties)
        {
            string text = this.workflow ?? "NewObject";

            return(this.Execute(text, null, properties));
        }