예제 #1
0
        /// <summary>
        /// Pre validates the given set of values.
        /// This is where you populate derived parameters based on input, among other things.
        /// </summary>
        /// <param name="paramValues"></param>
        /// <param name="pEnvMgr"></param>
        public override void UpdateParameters(IArray paramValues, IGPEnvironmentManager pEnvMgr)
        {
            try
            {
                UpdateParametersCommon(paramValues, pEnvMgr);
            }
            catch (WmxDefaultDbNotSetException)
            {
                // If the default DB wasn't set, stop executing
                return;
            }
            catch (NullReferenceException)
            {
                // If one of the parameters was null, stop executing
                return;
            }

            // Build a hash of the parameters for ease of access
            WmauParameterMap paramMap = new WmauParameterMap(paramValues);

            IGPParameter3     snName           = paramMap.GetParam(C_PARAM_SPATIAL_NOTIFICATION);
            IGPParameterEdit3 snNameEdit       = paramMap.GetParamEdit(C_PARAM_SPATIAL_NOTIFICATION);
            IGPParameter3     useJobAoi        = paramMap.GetParam(C_PARAM_USE_JOB_AOI);
            IGPParameterEdit3 alternateAoiEdit = paramMap.GetParamEdit(C_PARAM_ALTERNATE_AOI);

            // Apply a domain to the list of spatial notifications, if possible
            if (snName.Domain == null || (snName.Domain as IGPCodedValueDomain).CodeCount <= 0)
            {
                snNameEdit.Domain = Common.WmauGpDomainBuilder.BuildChangeRulesDomain(this.WmxDatabase);
            }

            // Enable/disable the alternate AOI parameter based on the status of the
            // "use job AOI" parameter
            alternateAoiEdit.Enabled = !(useJobAoi.Value as IGPBoolean).Value;
        }
예제 #2
0
        /// <summary>
        /// Post validates the given set of values.
        /// This is where you flag parameters with warnings and error messages, among other things.
        /// </summary>
        /// <param name="paramValues"></param>
        /// <param name="pEnvMgr"></param>
        /// <param name="msgs"></param>
        public override void UpdateMessages(IArray paramValues, IGPEnvironmentManager pEnvMgr, IGPMessages msgs)
        {
            // Call the base class function first
            try
            {
                UpdateMessagesCommon(paramValues, pEnvMgr, msgs);
            }
            catch (WmxDefaultDbNotSetException)
            {
                // If the default DB wasn't set, stop executing
                return;
            }

            // Build a hash of which parameter is at which index, for ease of access
            WmauParameterMap paramMap = new WmauParameterMap(paramValues);

            IGPParameter3 snName        = paramMap.GetParam(C_PARAM_SPATIAL_NOTIFICATION);
            IGPParameter3 dataWorkspace = paramMap.GetParam(C_PARAM_DATA_WORKSPACE);

            // Ensure that there is at least one existing spatial notification in the database
            if (snName.Domain == null || (snName.Domain as IGPCodedValueDomain).CodeCount <= 0)
            {
                WmauError error = new WmauError(WmauErrorCodes.C_NO_SPATIAL_NOTIFICATIONS_FOUND);
                msgs.ReplaceError(paramMap.GetIndex(C_PARAM_SPATIAL_NOTIFICATION), error.ErrorCodeAsInt, error.Message);
            }

            // Ensure that there is at least one data workspace defined in the database
            if (dataWorkspace.Domain == null || (dataWorkspace.Domain as IGPCodedValueDomain).CodeCount <= 0)
            {
                WmauError error = new WmauError(WmauErrorCodes.C_NO_WORKSPACES_DEFINED_ERROR);
                msgs.ReplaceError(paramMap.GetIndex(C_PARAM_DATA_WORKSPACE), error.ErrorCodeAsInt, error.Message);
            }
        }
        /// <summary>
        /// Post validates the given set of values.
        /// This is where you flag parameters with warnings and error messages, among other things.
        /// </summary>
        /// <param name="paramValues"></param>
        /// <param name="pEnvMgr"></param>
        /// <param name="msgs"></param>
        public override void UpdateMessages(IArray paramValues, IGPEnvironmentManager pEnvMgr, IGPMessages msgs)
        {
            try
            {
                UpdateMessagesCommon(paramValues, pEnvMgr, msgs);
            }
            catch (WmxDefaultDbNotSetException)
            {
                // If the default DB wasn't set, stop executing
                return;
            }

            // Build a hash of which parameter is at which index for ease of access
            WmauParameterMap paramMap          = new WmauParameterMap(paramValues);
            IGPParameter3    dataWorkspaceName = paramMap.GetParam(C_PARAM_DATA_WORKSPACE);
            IGPParameter3    parentVersion     = paramMap.GetParam(C_PARAM_PARENT_VERSION);

            // If there's no domain on the parent version parameter, then something went
            // awry
            if (parentVersion.Domain == null)
            {
                WmauError error = new WmauError(WmauErrorCodes.C_VERSION_LOOKUP_ERROR);
                msgs.ReplaceError(paramMap.GetIndex(C_PARAM_PARENT_VERSION), error.ErrorCodeAsInt, error.Message);
            }

            // Store away the latest value of the data workspace
            m_dataWorkspaceName = dataWorkspaceName.Value.GetAsText();
        }
예제 #4
0
        /// <summary>
        /// Post validates the given set of values.
        /// This is where you flag parameters with warnings and error messages, among other things.
        /// </summary>
        /// <param name="paramValues"></param>
        /// <param name="pEnvMgr"></param>
        /// <param name="msgs"></param>
        public override void UpdateMessages(IArray paramValues, IGPEnvironmentManager pEnvMgr, IGPMessages msgs)
        {
            // Call the base class function first
            try
            {
                UpdateMessagesCommon(paramValues, pEnvMgr, msgs);
            }
            catch (WmxDefaultDbNotSetException)
            {
                // If the default DB wasn't set, stop executing
                return;
            }

            // Build a hash of which parameter is at which index, for ease of access
            WmauParameterMap paramMap = new WmauParameterMap(paramValues);

            IGPParameter3     snName     = paramMap.GetParam(C_PARAM_SPATIAL_NOTIFICATION);
            IGPParameter3     altAoi     = paramMap.GetParam(C_PARAM_ALTERNATE_AOI);
            IGPParameterEdit3 altAoiEdit = paramMap.GetParamEdit(C_PARAM_ALTERNATE_AOI);

            // Ensure that there is at least one existing spatial notification in the database
            if (snName.Domain == null || (snName.Domain as IGPCodedValueDomain).CodeCount <= 0)
            {
                WmauError error = new WmauError(WmauErrorCodes.C_NO_SPATIAL_NOTIFICATIONS_FOUND);
                msgs.ReplaceError(paramMap.GetIndex(C_PARAM_SPATIAL_NOTIFICATION), error.ErrorCodeAsInt, error.Message);
            }

            // Check the AOI; ensure that there is exactly one feature selected
            if (altAoi.Value != null && !altAoi.Value.GetAsText().Equals(string.Empty))
            {
                try
                {
                    ILayer            aoiLayer  = m_gpUtilities.DecodeLayer(altAoi.Value);
                    IFeatureLayer     featLayer = aoiLayer as IFeatureLayer;
                    IFeatureSelection featSel   = aoiLayer as IFeatureSelection;
                    ISelectionSet     selSet    = featSel.SelectionSet as ISelectionSet;

                    if (featLayer.FeatureClass.ShapeType != esriGeometryType.esriGeometryPolygon)
                    {
                        WmauError error = new WmauError(WmauErrorCodes.C_AOI_NOT_POLYGON_ERROR);
                        msgs.ReplaceWarning(paramMap.GetIndex(C_PARAM_ALTERNATE_AOI), error.Message);
                    }
                    else if (selSet.Count != 1)
                    {
                        WmauError error = new WmauError(WmauErrorCodes.C_EXPECTED_ONE_SELECTED_FEATURE_ERROR);
                        msgs.ReplaceWarning(paramMap.GetIndex(C_PARAM_ALTERNATE_AOI), error.Message);
                    }
                }
                catch (System.Runtime.InteropServices.COMException comEx)
                {
                    WmauError error = new WmauError(WmauErrorCodes.C_AOI_INPUT_ERROR);
                    msgs.ReplaceError(paramMap.GetIndex(C_PARAM_ALTERNATE_AOI), error.ErrorCodeAsInt, error.Message + "; " + comEx.Message);
                }
            }
        }
        /// <summary>
        /// Updates the internal values used by this tool based on the parameters from an input array
        /// </summary>
        /// <param name="paramValues"></param>
        protected override void ExtractParameters(IArray paramValues)
        {
            // Get the values for any parameters common to all GP tools
            ExtractParametersCommon(paramValues);

            WmauParameterMap paramMap = new WmauParameterMap(paramValues);
            IGPParameter3    param    = null;

            // Ensure that the various parameter values are all restored to their
            // defaults because of how this function works
            ResetVariables();

            // Update the internal values of whatever parameters we're maintaining
            param            = paramMap.GetParam(C_PARAM_PREVIEW_CHANGES);
            m_previewChanges = (param.Value as IGPBoolean).Value;

            param = paramMap.GetParam(C_PARAM_CHECKLIST);
            IGPValue      paramValue      = m_gpUtilities.UnpackGPValue(param);
            IGPMultiValue paramMultiValue = paramValue as IGPMultiValue;

            for (int i = 0; i < paramMultiValue.Count; i++)
            {
                IGPValue check  = paramMultiValue.get_Value(i);
                string   strVal = check.GetAsText();
                if (strVal.Equals(C_OPT_CLEAN_WORKFLOWS))
                {
                    m_cleanWorkflows = true;
                }
                else if (strVal.Equals(C_OPT_CLEAN_STEP_TYPES))
                {
                    m_cleanStepTypes = true;
                }
                else if (strVal.Equals(C_OPT_CLEAN_STATUS_TYPES))
                {
                    m_cleanStatusTypes = true;
                }
                else if (strVal.Equals(C_OPT_CLEAN_PRIORITIES))
                {
                    m_cleanPriorities = true;
                }
                else if (strVal.Equals(C_OPT_CLEAN_TA_WORKBOOKS))
                {
                    m_cleanTaWorkbooks = true;
                }
                else if (strVal.Equals(C_OPT_CLEAN_USERS))
                {
                    m_cleanUsers = true;
                }
                else if (strVal.Equals(C_OPT_CLEAN_MAP_DOCS))
                {
                    m_cleanMapDocs = true;
                }
            }
        }
        /// <summary>
        /// Required by IGPFunction2 interface; this function is called when the GP tool is ready to be executed.
        /// </summary>
        /// <param name="paramValues"></param>
        /// <param name="trackCancel"></param>
        /// <param name="envMgr"></param>
        /// <param name="msgs"></param>
        public override void Execute(IArray paramValues, ITrackCancel trackCancel, IGPEnvironmentManager envMgr, IGPMessages msgs)
        {
            // Do some common error-checking
            base.Execute(paramValues, trackCancel, envMgr, msgs);

            try
            {
                WmauParameterMap paramMap = new WmauParameterMap(paramValues);

                // Retrieve the parameter in which the list of workbook names will be stored
                IGPParameter3     param       = paramMap.GetParam(C_PARAM_JOB_ID_LIST);
                IGPParameterEdit3 paramEdit   = paramMap.GetParamEdit(C_PARAM_JOB_ID_LIST);
                IGPParameter3     filterParam = paramMap.GetParam(C_PARAM_SQL_QUERY_FILTER);

                // Get the multivalue object into which the output will be stored
                IGPMultiValue outputValues = new GPMultiValueClass();
                outputValues.MemberDataType = param.DataType;
                for (int i = 0; i < outputValues.Count; i++)
                {
                    outputValues.Remove(i);
                }

                // Get the list of job IDs and add them all to the multivalue
                SortedList <int, string> jobs = this.ListJobsInDatabase(filterParam.Value.GetAsText());
                msgs.AddMessage("Jobs matching query:");
                foreach (KeyValuePair <int, string> item in jobs)
                {
                    IGPLong value = new GPLongClass();
                    value.Value = item.Key;
                    outputValues.AddValue(value as IGPValue);
                    msgs.AddMessage("  " + value.Value.ToString() + " (" + item.Value + ")");
                }

                paramEdit.Value = (IGPValue)outputValues;

                msgs.AddMessage(Properties.Resources.MSG_DONE);
            }
            catch (WmauException wmEx)
            {
                try
                {
                    msgs.AddError(wmEx.ErrorCodeAsInt, wmEx.Message);
                }
                catch
                {
                    // Catch anything else that possibly happens
                }
            }
            catch (Exception ex)
            {
                WmauError error = new WmauError(WmauErrorCodes.C_UNSPECIFIED_ERROR);
                msgs.AddError(error.ErrorCodeAsInt, error.Message + "; " + ex.Message);
            }
        }
        /// <summary>
        /// Updates the internal values used by this tool based on the parameters from an input array
        /// </summary>
        /// <param name="paramValues"></param>
        protected override void ExtractParameters(IArray paramValues)
        {
            // Get the values for any parameters common to all GP tools
            ExtractParametersCommon(paramValues);

            WmauParameterMap paramMap = new WmauParameterMap(paramValues);
            IGPParameter3    param    = null;

            param         = paramMap.GetParam(C_PARAM_JXL_FILE_PATH);
            m_jxlFilePath = param.Value.GetAsText();

            param         = paramMap.GetParam(C_PARAM_PRETTY_PRINT);
            m_prettyPrint = (param.Value as IGPBoolean).Value;
        }
        /// <summary>
        /// Updates the internal values used by this tool based on the parameters from an input array
        /// </summary>
        /// <param name="paramValues"></param>
        protected override void ExtractParameters(IArray paramValues)
        {
            // Get the values for any parameters common to all GP tools
            ExtractParametersCommon(paramValues);

            WmauParameterMap paramMap = new WmauParameterMap(paramValues);
            IGPParameter3    param    = null;

            // Update the internal values of whatever parameters we're maintaining
            param    = paramMap.GetParam(C_PARAM_NAME);
            m_snName = param.Value.GetAsText();

            param     = paramMap.GetParam(C_PARAM_SUBJECT);
            m_subject = param.Value.GetAsText();

            param     = paramMap.GetParam(C_PARAM_MESSAGE);
            m_message = param.Value.GetAsText();

            param         = paramMap.GetParam(C_PARAM_SUBSCRIBERS);
            m_subscribers = param.Value.GetAsText();

            param         = paramMap.GetParam(C_PARAM_SENDER_EMAIL);
            m_senderEmail = param.Value.GetAsText();

            param        = paramMap.GetParam(C_PARAM_SENDER_NAME);
            m_senderName = param.Value.GetAsText();

            param           = paramMap.GetParam(C_PARAM_DESCRIPTION);
            m_snDescription = param.Value.GetAsText();

            param       = paramMap.GetParam(C_PARAM_SUMMARIZE);
            m_summarize = bool.Parse(param.Value.GetAsText());
        }
        /// <summary>
        /// Updates the internal values used by this tool based on the parameters from an input array
        /// </summary>
        /// <param name="paramValues"></param>
        protected override void ExtractParameters(IArray paramValues)
        {
            // Get the values for any parameters common to all GP tools
            ExtractParametersCommon(paramValues);

            WmauParameterMap paramMap = new WmauParameterMap(paramValues);
            IGPParameter3    param    = null;

            // Update the internal values of whatever parameters we're maintaining
            param           = paramMap.GetParam(C_PARAM_EXCEL_FILE_PATH);
            m_excelFilePath = param.Value.GetAsText();

            param           = paramMap.GetParam(C_PARAM_ERROR_BEHAVIOR);
            m_errorBehavior = param.Value.GetAsText();
        }
예제 #10
0
        /// <summary>
        /// Updates the internal values used by this tool based on the parameters from an input array
        /// </summary>
        /// <param name="paramValues"></param>
        protected override void ExtractParameters(IArray paramValues)
        {
            // Get the values for any parameters common to all GP tools
            ExtractParametersCommon(paramValues);

            WmauParameterMap paramMap = new WmauParameterMap(paramValues);
            IGPParameter3    param    = null;

            // Update the internal values of whatever parameters we're maintaining
            param   = paramMap.GetParam(C_PARAM_JOB_ID);
            m_jobId = int.Parse(param.Value.GetAsText());

            param = paramMap.GetParam(C_PARAM_NOTIFICATION_NAME);
            m_notificationName = param.Value.GetAsText();
        }
        /// <summary>
        /// Updates the internal values used by this tool based on the parameters from an input array
        /// </summary>
        /// <param name="paramValues"></param>
        protected override void ExtractParameters(IArray paramValues)
        {
            // Get the values for any parameters common to all GP tools
            ExtractParametersCommon(paramValues);

            WmauParameterMap paramMap = new WmauParameterMap(paramValues);
            IGPParameter3    param    = null;

            // Update the internal values of whatever parameters we're maintaining
            param         = paramMap.GetParam(C_PARAM_XML_FILE_PATH);
            m_xmlFilePath = param.Value.GetAsText();

            param        = paramMap.GetParam(C_PARAM_SOURCE_NAME);
            m_sourceName = param.Value.GetAsText();
        }
예제 #12
0
        /// <summary>
        /// Pre validates the given set of values.
        /// This is where you populate derived parameters based on input, among other things.
        /// </summary>
        /// <param name="paramValues"></param>
        /// <param name="pEnvMgr"></param>
        public override void UpdateParameters(IArray paramValues, IGPEnvironmentManager pEnvMgr)
        {
            try
            {
                UpdateParametersCommon(paramValues, pEnvMgr);
            }
            catch (WmxDefaultDbNotSetException)
            {
                // If the default DB wasn't set, stop executing
                return;
            }
            catch (NullReferenceException)
            {
                // If one of the parameters was null, stop executing
                return;
            }

            // Build a hash of which parameter is at which index for ease of access
            WmauParameterMap paramMap = new WmauParameterMap(paramValues);

            IGPParameter3     userParam     = paramMap.GetParam(C_PARAM_USER_NAME);
            IGPParameterEdit3 userParamEdit = paramMap.GetParamEdit(C_PARAM_USER_NAME);

            // Add a domain to the users parameter
            if (userParam.Domain == null || (userParam.Domain as IGPCodedValueDomain).CodeCount <= 0)
            {
                userParamEdit.Domain = Common.WmauGpDomainBuilder.BuildUsersDomain(this.WmxDatabase, new string[] { C_OPT_ALL_USERS });
            }
        }
예제 #13
0
        /// <summary>
        /// Required by IGPFunction2 interface; this function is called when the GP tool is ready to be executed.
        /// </summary>
        /// <param name="paramValues"></param>
        /// <param name="trackCancel"></param>
        /// <param name="envMgr"></param>
        /// <param name="msgs"></param>
        public override void Execute(IArray paramValues, ITrackCancel trackCancel, IGPEnvironmentManager envMgr, IGPMessages msgs)
        {
            // Do some common error-checking
            base.Execute(paramValues, trackCancel, envMgr, msgs);

            try
            {
                // Ensure that the current user has admin access to the current Workflow Manager DB
                if (!CurrentUserIsWmxAdministrator())
                {
                    throw new WmauException(WmauErrorCodes.C_USER_NOT_ADMIN_ERROR);
                }

                // Retrieve the parameter in which the list of MXDs will be stored
                WmauParameterMap  paramMap  = new WmauParameterMap(paramValues);
                IGPParameter3     param     = paramMap.GetParam(C_PARAM_MAP_DOCUMENT_LIST);
                IGPParameterEdit3 paramEdit = paramMap.GetParamEdit(C_PARAM_MAP_DOCUMENT_LIST);

                // Set up the multi-value objects
                IGPMultiValue mvValue = new GPMultiValueClass();
                mvValue.MemberDataType = param.DataType;

                // Get the list of MXD names and add them all to the multivalue
                SortedList <string, string> mapDocuments = this.ListMapDocumentsInDatabase();
                foreach (string mapDocName in mapDocuments.Keys)
                {
                    IGPString strVal = new GPStringClass();
                    strVal.Value = mapDocName;
                    mvValue.AddValue(strVal as IGPValue);
                    msgs.AddMessage("Map Document: " + mapDocName);
                }

                paramEdit.Value = (IGPValue)mvValue;

                msgs.AddMessage(Properties.Resources.MSG_DONE);
            }
            catch (WmauException wmEx)
            {
                try
                {
                    msgs.AddError(wmEx.ErrorCodeAsInt, wmEx.Message);
                }
                catch
                {
                    // Catch anything else that possibly happens
                }
            }
            catch (Exception ex)
            {
                try
                {
                    WmauError error = new WmauError(WmauErrorCodes.C_UNSPECIFIED_ERROR);
                    msgs.AddError(error.ErrorCodeAsInt, error.Message + "; " + ex.Message);
                }
                catch
                {
                    // Catch anything else that possibly happens
                }
            }
        }
        /// <summary>
        /// Pre validates the given set of values.
        /// This is where you populate derived parameters based on input, among other things.
        /// </summary>
        /// <param name="paramValues"></param>
        /// <param name="pEnvMgr"></param>
        public override void UpdateParameters(IArray paramValues, IGPEnvironmentManager pEnvMgr)
        {
            try
            {
                UpdateParametersCommon(paramValues, pEnvMgr);
            }
            catch (WmxDefaultDbNotSetException)
            {
                // If the default DB wasn't set, stop executing
                return;
            }
            catch (NullReferenceException)
            {
                // If one of the parameters was null, stop executing
                return;
            }

            // Get the parameters as a map for easier access
            WmauParameterMap  paramMap  = new WmauParameterMap(paramValues);
            IGPParameter3     jobId     = paramMap.GetParam(C_PARAM_JOB_ID);
            IGPParameterEdit3 jobIdEdit = paramMap.GetParamEdit(C_PARAM_JOB_ID);

            // Set the domains for any parameters that need them

            // Set the job ID domain if it hasn't already been populated
            if (jobId.Domain == null)
            {
                jobIdEdit.Domain = Common.WmauGpDomainBuilder.BuildNonClosedJobIdDomain(this.WmxDatabase);
            }
        }
        /// <summary>
        /// Pre validates the given set of values.
        /// This is where you populate derived parameters based on input, among other things.
        /// </summary>
        /// <param name="paramValues"></param>
        /// <param name="pEnvMgr"></param>
        public override void UpdateParameters(IArray paramValues, IGPEnvironmentManager pEnvMgr)
        {
            try
            {
                UpdateParametersCommon(paramValues, pEnvMgr);
            }
            catch (WmxDefaultDbNotSetException)
            {
                // If the default DB wasn't set, stop executing
                return;
            }
            catch (NullReferenceException)
            {
                // If one of the parameters was null, stop executing
                return;
            }

            // Retrieve the parameter for the jobs to delete and add a domain to it
            //
            // NOTE: Add the domain in this function because the Workflow Manager
            // connection/extension/etc. is not necessarily available when ParameterInfo
            // is first accessed.
            WmauParameterMap  paramMap  = new WmauParameterMap(paramValues);
            IGPParameter3     param     = paramMap.GetParam(C_PARAM_JOB_TO_DELETE);
            IGPParameterEdit3 paramEdit = paramMap.GetParamEdit(C_PARAM_JOB_TO_DELETE);

            if (param.Domain == null)
            {
                // If there isn't a domain on this parameter yet, that means that it
                // still needs to be populated.  In that case, do so at this time.
                paramEdit.Domain = Common.WmauGpDomainBuilder.BuildJobIdDomain(this.WmxDatabase);
            }
        }
예제 #16
0
        /// <summary>
        /// Pre validates the given set of values.
        /// This is where you populate derived parameters based on input, among other things.
        /// </summary>
        /// <param name="paramValues"></param>
        /// <param name="pEnvMgr"></param>
        public override void UpdateParameters(IArray paramValues, IGPEnvironmentManager pEnvMgr)
        {
            try
            {
                UpdateParametersCommon(paramValues, pEnvMgr);
            }
            catch (WmxDefaultDbNotSetException)
            {
                // If the default DB wasn't set, stop executing
                return;
            }
            catch (NullReferenceException)
            {
                // If one of the parameters was null, stop executing
                return;
            }

            // Build a hash of the parameters for ease of access
            WmauParameterMap paramMap = new WmauParameterMap(paramValues);

            IGPParameter3     dataWorkspace     = paramMap.GetParam(C_PARAM_DATA_WORKSPACE);
            IGPParameterEdit3 dataWorkspaceEdit = paramMap.GetParamEdit(C_PARAM_DATA_WORKSPACE);

            // Apply a domain to the data workspace list, if necessary
            if (dataWorkspace.Domain == null || (dataWorkspace.Domain as IGPCodedValueDomain).CodeCount <= 0)
            {
                dataWorkspaceEdit.Domain = Common.WmauGpDomainBuilder.BuildWorkspaceDomain(this.WmxDatabase);
            }
        }
예제 #17
0
        /// <summary>
        /// Helper function for the "UpdateParameters" interface; meant to be called directly by
        /// child classes who override "UpdateParameters", rather than calling "UpdateParameters"
        /// itself.
        /// </summary>
        /// <param name="paramValues">The IArray of parameters passed into UpdateParameters</param>
        /// <param name="pEnvMgr">The GP environment manager object</param>
        protected void UpdateParametersCommon(IArray paramValues, IGPEnvironmentManager pEnvMgr)
        {
            WmauParameterMap paramMap = new WmauParameterMap(paramValues);
            IGPParameter3    param    = null;

            // Update the internal values of whatever parameters the parent class
            // is maintaining
            param = paramMap.GetParam(C_PARAM_WMX_DATABASE_ALIAS);
            string newDbAlias = param.Value.GetAsText();

            // If the WMX database has changed, update it.
            if (!newDbAlias.Equals(m_wmxDbAlias))
            {
                ChangeWmxDatabase(newDbAlias, paramMap);
            }

            // Ensure that the default Workflow Manager database is set.
            if (!IsWorkflowManagerDatabaseSet())
            {
                throw new WmxDefaultDbNotSetException();
            }
            if (paramValues == null || pEnvMgr == null)
            {
                throw new NullReferenceException();
            }
        }
예제 #18
0
        /// <summary>
        /// Pre validates the given set of values.
        /// This is where you populate derived parameters based on input, among other things.
        /// </summary>
        /// <param name="paramValues"></param>
        /// <param name="pEnvMgr"></param>
        public override void UpdateParameters(IArray paramValues, IGPEnvironmentManager pEnvMgr)
        {
            try
            {
                UpdateParametersCommon(paramValues, pEnvMgr);
            }
            catch (WmxDefaultDbNotSetException)
            {
                // If the default DB wasn't set, stop executing
                return;
            }
            catch (NullReferenceException)
            {
                // If one of the parameters was null, stop executing
                return;
            }

            WmauParameterMap paramMap = new WmauParameterMap(paramValues);

            // Retrieve the parameter for source name and add a domain to it
            IGPParameter3     param     = paramMap.GetParam(C_PARAM_MXD_NAME);
            IGPParameterEdit3 paramEdit = paramMap.GetParamEdit(C_PARAM_MXD_NAME);

            if (param.Domain == null)
            {
                // If there isn't a domain on this parameter yet, that means that it has
                // not yet had a list of possible MXDs populated.  In that case, do
                // so at this time.
                paramEdit.Domain = Common.WmauGpDomainBuilder.BuildMapDocumentDomain(this.WmxDatabase);
            }
        }
예제 #19
0
        /// <summary>
        /// Pre validates the given set of values.
        /// This is where you populate derived parameters based on input, among other things.
        /// </summary>
        /// <param name="paramValues"></param>
        /// <param name="pEnvMgr"></param>
        public override void UpdateParameters(IArray paramValues, IGPEnvironmentManager pEnvMgr)
        {
            try
            {
                UpdateParametersCommon(paramValues, pEnvMgr);
            }
            catch (WmxDefaultDbNotSetException)
            {
                // If the default DB wasn't set, stop executing
                return;
            }
            catch (NullReferenceException)
            {
                // If one of the parameters was null, stop executing
                return;
            }

            // Build a hash of which parameter is at which index for ease of access
            WmauParameterMap paramMap = new WmauParameterMap(paramValues);

            IGPParameter3     notificationParam     = paramMap.GetParam(C_PARAM_EMAIL_NOTIFIER);
            IGPParameterEdit3 notificationParamEdit = paramMap.GetParamEdit(C_PARAM_EMAIL_NOTIFIER);

            // Add a domain to the notification parameter
            if (notificationParam.Domain == null || (notificationParam.Domain as IGPCodedValueDomain).CodeCount <= 0)
            {
                notificationParamEdit.Domain = Common.WmauGpDomainBuilder.BuildEmailNotificationDomain(this.WmxDatabase);
            }
        }
        /// <summary>
        /// Required by IGPFunction2 interface; this function is called when the GP tool is ready to be executed.
        /// </summary>
        /// <param name="paramValues"></param>
        /// <param name="trackCancel"></param>
        /// <param name="envMgr"></param>
        /// <param name="msgs"></param>
        public override void Execute(IArray paramValues, ITrackCancel trackCancel, IGPEnvironmentManager envMgr, IGPMessages msgs)
        {
            // Do some common error-checking
            base.Execute(paramValues, trackCancel, envMgr, msgs);

            try
            {
                WmauParameterMap   paramMap  = new WmauParameterMap(paramValues);
                IJTXConfiguration3 configMgr = this.WmxDatabase.ConfigurationManager as IJTXConfiguration3;

                // Determine which query the user has selected
                SortedList <string, IJTXJobQuery> queryMap = new SortedList <string, IJTXJobQuery>();
                AddQueriesFromContainer(configMgr.GetPublicQueryContainer(), string.Empty, queryMap);
                if (!queryMap.Keys.Contains(m_queryName))
                {
                    throw new WmauException(WmauErrorCodes.C_UNKNOWN_QUERY_ERROR);
                }

                // Run the selected job query
                IJTXJobQuery tempQuery = queryMap[m_queryName];

                // TODO: Change this to use ".Evaluate()" once it's fixed
                List <int> jobIds = ParseJobIdsFromXml(tempQuery.EvaluateXML());
                jobIds.Sort();

                // Store the job IDs from the query into the output GP param
                IGPMultiValue outputValues = new GPMultiValueClass();
                outputValues.MemberDataType = paramMap.GetParam(C_PARAM_OUT_JOB_ID_LIST).DataType;
                for (int i = 0; i < jobIds.Count; i++)
                {
                    IGPLong jobIdVal = new GPLongClass();
                    jobIdVal.Value = jobIds[i];
                    outputValues.AddValue(jobIdVal as IGPValue);
                    msgs.AddMessage("Found job: " + jobIds[i]);
                }

                paramMap.GetParamEdit(C_PARAM_OUT_JOB_ID_LIST).Value = (IGPValue)outputValues;

                msgs.AddMessage(Properties.Resources.MSG_DONE);
            }
            catch (WmauException wmEx)
            {
                try
                {
                    msgs.AddError(wmEx.ErrorCodeAsInt, wmEx.Message);
                }
                catch
                {
                    // Catch anything else that possibly happens
                }
            }
            catch (Exception ex)
            {
                WmauError error = new WmauError(WmauErrorCodes.C_UNSPECIFIED_ERROR);
                msgs.AddError(error.ErrorCodeAsInt, error.Message + "; " + ex.Message);
            }
        }
        /// <summary>
        /// Updates the internal values used by this tool based on the parameters from an input array
        /// </summary>
        /// <param name="paramValues"></param>
        protected override void ExtractParameters(IArray paramValues)
        {
            // Get the values for any parameters common to all GP tools
            ExtractParametersCommon(paramValues);

            WmauParameterMap paramMap = new WmauParameterMap(paramValues);
            IGPParameter3    param    = null;

            // Update the internal values of whatever parameters we're maintaining
            param           = paramMap.GetParam(C_PARAM_PRIVILEGE_NAME);
            m_privilegeName = param.Value.GetAsText();

            param       = paramMap.GetParam(C_PARAM_GROUP_NAME);
            m_groupName = param.Value.GetAsText();

            param             = paramMap.GetParam(C_PARAM_PRIVILEGE_ACTION);
            m_privilegeAction = param.Value.GetAsText();
        }
        /// <summary>
        /// Updates the internal values used by this tool based on the parameters from an input array
        /// </summary>
        /// <param name="paramValues"></param>
        protected override void ExtractParameters(IArray paramValues)
        {
            // Get the values for any parameters common to all GP tools
            ExtractParametersCommon(paramValues);

            WmauParameterMap paramMap = new WmauParameterMap(paramValues);
            IGPParameter3    param    = null;

            // Update the internal values of whatever parameters we're maintaining
            param         = paramMap.GetParam(C_PARAM_JOB_TYPE);
            m_jobTypeName = param.Value.GetAsText();

            param = paramMap.GetParam(C_PARAM_DATA_WORKSPACE);
            m_dataWorkspaceName = param.Value.GetAsText();

            param           = paramMap.GetParam(C_PARAM_PARENT_VERSION);
            m_parentVersion = param.Value.GetAsText();
        }
예제 #23
0
        /// <summary>
        /// Updates the internal values used by this tool based on the parameters from an input array
        /// </summary>
        /// <param name="paramValues"></param>
        protected override void ExtractParameters(IArray paramValues)
        {
            // Get the values for any parameters common to all GP tools
            ExtractParametersCommon(paramValues);

            WmauParameterMap paramMap = new WmauParameterMap(paramValues);
            IGPParameter3    param    = null;

            // Update the internal values of whatever parameters we're maintaining
            param         = paramMap.GetParam(C_PARAM_XML_FILE_PATH);
            m_xmlFilePath = param.Value.GetAsText();

            param        = paramMap.GetParam(C_PARAM_TARGET_NAME);
            m_targetName = param.Value.GetAsText();

            param = paramMap.GetParam(C_PARAM_OVERWRITE_EXISTING);
            m_overwriteExisting = bool.Parse(param.Value.GetAsText());
        }
        /// <summary>
        /// Updates the internal values used by this tool based on the parameters from an input array
        /// </summary>
        /// <param name="paramValues"></param>
        protected override void ExtractParameters(IArray paramValues)
        {
            // Get the values for any parameters common to all GP tools
            ExtractParametersCommon(paramValues);

            WmauParameterMap paramMap = new WmauParameterMap(paramValues);
            IGPParameter3    param    = null;

            // Update the internal values of whatever parameters we're maintaining
            param   = paramMap.GetParam(C_PARAM_JOB_ID);
            m_jobId = int.Parse(param.Value.GetAsText());

            param            = paramMap.GetParam(C_PARAM_ATTACHMENT);
            m_attachmentPath = param.Value.GetAsText();

            param            = paramMap.GetParam(C_PARAM_ATTACHMENT_TYPE);
            m_attachmentType = param.Value.GetAsText();
        }
        /// <summary>
        /// Updates the internal values used by this tool based on the parameters from an input array
        /// </summary>
        /// <param name="paramValues"></param>
        protected override void ExtractParameters(IArray paramValues)
        {
            // Get the values for any parameters common to all GP tools
            ExtractParametersCommon(paramValues);

            WmauParameterMap paramMap = new WmauParameterMap(paramValues);
            IGPParameter3    param    = null;

            // Update the internal values of whatever parameters we're maintaining
            param       = paramMap.GetParam(C_PARAM_USER_GROUP);
            m_userGroup = param.Value.GetAsText();

            param        = paramMap.GetParam(C_PARAM_GROUP_GROUP);
            m_groupGroup = param.Value.GetAsText();

            param = paramMap.GetParam(C_PARAM_PRESERVE_CURRENT_USER);
            m_preserveCurrentUser = (param.Value as IGPBoolean).Value;
        }
예제 #26
0
        /// <summary>
        /// Pre validates the given set of values.
        /// This is where you populate derived parameters based on input, among other things.
        /// </summary>
        /// <param name="paramValues"></param>
        /// <param name="pEnvMgr"></param>
        public override void UpdateParameters(IArray paramValues, IGPEnvironmentManager pEnvMgr)
        {
            try
            {
                UpdateParametersCommon(paramValues, pEnvMgr);
            }
            catch (WmxDefaultDbNotSetException)
            {
                // If the default DB wasn't set, stop executing
                return;
            }
            catch (NullReferenceException)
            {
                // If one of the parameters was null, stop executing
                return;
            }

            // Build a hash of the parameters for ease of access
            WmauParameterMap paramMap = new WmauParameterMap(paramValues);

            IGPParameter3     snName            = paramMap.GetParam(C_PARAM_SPATIAL_NOTIFICATION);
            IGPParameterEdit3 snNameEdit        = paramMap.GetParamEdit(C_PARAM_SPATIAL_NOTIFICATION);
            IGPParameter3     dataWorkspace     = paramMap.GetParam(C_PARAM_DATA_WORKSPACE);
            IGPParameterEdit3 dataWorkspaceEdit = paramMap.GetParamEdit(C_PARAM_DATA_WORKSPACE);
            IGPParameter3     monitorAllColumns = paramMap.GetParam(C_PARAM_MONITOR_ALL_COLUMNS);
            IGPParameterEdit3 selectColumns     = paramMap.GetParamEdit(C_PARAM_COLUMNS);

            // Apply a domain to the list of spatial notifications, if possible
            if (snName.Domain == null || (snName.Domain as IGPCodedValueDomain).CodeCount <= 0)
            {
                snNameEdit.Domain = Common.WmauGpDomainBuilder.BuildChangeRulesDomain(this.WmxDatabase);
            }

            // Apply a domain to the data workspace list, if possible
            if (dataWorkspace.Domain == null || (dataWorkspace.Domain as IGPCodedValueDomain).CodeCount <= 0)
            {
                dataWorkspaceEdit.Domain = Common.WmauGpDomainBuilder.BuildWorkspaceDomain(this.WmxDatabase);
            }

            // Enable/disable the column param based on the "monitor all columns" param
            selectColumns.Enabled = !(monitorAllColumns.Value as IGPBoolean).Value;
        }
예제 #27
0
        /// <summary>
        /// Required by IGPFunction2 interface; this function is called when the GP tool is ready to be executed.
        /// </summary>
        /// <param name="paramValues"></param>
        /// <param name="trackCancel"></param>
        /// <param name="envMgr"></param>
        /// <param name="msgs"></param>
        public override void Execute(IArray paramValues, ITrackCancel trackCancel, IGPEnvironmentManager envMgr, IGPMessages msgs)
        {
            // Do some common error-checking
            base.Execute(paramValues, trackCancel, envMgr, msgs);

            try
            {
                // Retrieve the parameter in which the list of workbook names will be stored
                WmauParameterMap  paramMap  = new WmauParameterMap(paramValues);
                IGPParameter3     param     = paramMap.GetParam(C_PARAM_TAM_WORKBOOK_LIST);
                IGPParameterEdit3 paramEdit = paramMap.GetParamEdit(C_PARAM_TAM_WORKBOOK_LIST);

                // Set up the multi-value objects
                IGPMultiValue mvValue = new GPMultiValueClass();
                mvValue.MemberDataType = param.DataType;

                // Get the list of TA workbook names and add them all to the multivalue
                SortedList <string, string> tamWorkbooks = this.ListTamWorkbooksInDatabase();
                foreach (string workbookAlias in tamWorkbooks.Keys)
                {
                    IGPString strVal = new GPStringClass();
                    strVal.Value = workbookAlias;
                    mvValue.AddValue(strVal as IGPValue);
                    msgs.AddMessage("Workbook: " + workbookAlias);
                }

                paramEdit.Value = (IGPValue)mvValue;

                msgs.AddMessage(Properties.Resources.MSG_DONE);
            }
            catch (WmauException wmEx)
            {
                try
                {
                    msgs.AddError(wmEx.ErrorCodeAsInt, wmEx.Message);
                }
                catch
                {
                    // Catch anything else that possibly happens
                }
            }
            catch (Exception ex)
            {
                try
                {
                    WmauError error = new WmauError(WmauErrorCodes.C_UNSPECIFIED_ERROR);
                    msgs.AddError(error.ErrorCodeAsInt, error.Message + "; " + ex.Message);
                }
                catch
                {
                    // Catch anything else that possibly happens
                }
            }
        }
        /// <summary>
        /// Updates the internal values used by this tool based on the parameters from an input array
        /// </summary>
        /// <param name="paramValues"></param>
        protected override void ExtractParameters(IArray paramValues)
        {
            // Get the values for any parameters common to all GP tools
            ExtractParametersCommon(paramValues);

            WmauParameterMap paramMap = new WmauParameterMap(paramValues);
            IGPParameter3    param    = null;

            // Update the internal values of whatever parameters we're maintaining
            param         = paramMap.GetParam(C_PARAM_JOB_TO_DELETE);
            m_jobToDelete = int.Parse(param.Value.GetAsText());
        }
예제 #29
0
        /// <summary>
        /// Updates the internal values used by this tool based on the parameters from an input array
        /// </summary>
        /// <param name="paramValues"></param>
        protected override void ExtractParameters(IArray paramValues)
        {
            // Get the values for any parameters common to all GP tools
            ExtractParametersCommon(paramValues);

            WmauParameterMap paramMap = new WmauParameterMap(paramValues);
            IGPParameter3    param    = null;

            // Update the internal values of whatever parameters we're maintaining
            param     = paramMap.GetParam(C_PARAM_MXD_NAME);
            m_mxdName = param.Value.GetAsText();
        }
예제 #30
0
        /// <summary>
        /// Updates the internal values used by this tool based on the parameters from an input array
        /// </summary>
        /// <param name="paramValues"></param>
        protected override void ExtractParameters(IArray paramValues)
        {
            // Get the values for any parameters common to all GP tools
            ExtractParametersCommon(paramValues);

            WmauParameterMap paramMap = new WmauParameterMap(paramValues);
            IGPParameter3    param    = null;

            // Update the internal values of whatever parameters we're maintaining
            param    = paramMap.GetParam(C_PARAM_NAME);
            m_snName = param.Value.GetAsText();

            param           = paramMap.GetParam(C_PARAM_EMAIL_NOTIFIER);
            m_emailNotifier = param.Value.GetAsText();

            param           = paramMap.GetParam(C_PARAM_DESCRIPTION);
            m_snDescription = param.Value.GetAsText();

            param       = paramMap.GetParam(C_PARAM_SUMMARIZE);
            m_summarize = bool.Parse(param.Value.GetAsText());
        }