Summary
The Configuration object provides access to the configuration elements in the Workflow Manager (Classic) database.
Discussion
The Configuration object provides access to the configuration elements in the Workflow Manager (Classic) database.
Method Overview
Method | Explanation |
getActivityTypes () | Returns all activity types in the Workflow Manager (Classic) database as a list of ActivityType objects. |
getHoldTypes () | Returns all the hold types in the Workflow Manager (Classic) database, as a list of HoldType objects. |
getJobTypeDescription ({job_type_id}, {job_type_name}) | Returns the job type properties that can be customized before creating a job, using either the job type id or job type name. |
getJobTypes () | Returns a list of all job types in the Workflow Manager (Classic) database filtered by applied job filters. |
getMaps () | Returns a list of the names of maps in the Workflow Manager (Classic) database. |
getNotificationTypes () | Returns a list of all the notification types in the Workflow Manager (Classic) database. |
getPriorities () | Returns a list of priorities in the Workflow Manager (Classic) database. |
getPrivileges ({username}) | Returns a list of privileges assigned to a user. If no argument is given, the privileges for the current user are returned. |
getStatusTypes () | Returns all status types in the Workflow Manager (Classic) database as a list of StatusType objects. |
getUserGroups ({username}) | Returns a list of the name of user groups a user belongs to in the Workflow Manager (Classic) database. If no argument is given, the user groups the current user belongs to are returned. |
getUsers () | Returns a list of user names of all the users in the Workflow Manager (Classic) database. |
retrieveMap (map_name, destination_location) | Retrieves a map from the Workflow Manager (Classic) database to a specified folder. |
storeMap (map_name, source_location, {storage_type}, {overwrite}) | Stores a map in the Workflow Manager (Classic) database. Only .mxd can be stored in the Workflow Manager (Classic) database. |
Methods
getActivityTypes ()
Return Value
Data Type | Explanation |
ActivityType | A list of activity types returned as a list of ActivityType objects. |
The activity types are templates for the activity logged in history during the life cycle of a job.
The following example returns the activity types in the database.
import arcpy
import arcpywmx
# Establish a connection to a Workflow database
conn = arcpywmx.Connect(r'c:\test\Workflow.jtc')
# Get the activity types in Workflow database
activityTypes = conn.config.getActivityTypes()
getHoldTypes ()
Return Value
Data Type | Explanation |
HoldType | The list of hold types returned as a list of HoldType objects. |
The hold types are a template for the holds used to suspend the job activity for an indefinite amount of time.
The following example returns a list of hold types in the Workflow Manager (Classic) database.
import arcpy
import arcpywmx
# Establish a connection to a Workflow database
conn = arcpywmx.Connect(r'c:\test\Workflow.jtc')
# Get list of Hold types in Workflow database
holdTypes = conn.config.getHoldTypes()
getJobTypeDescription ({job_type_id}, {job_type_name})
Parameter | Explanation | Data Type |
job_type_id | The ID of the job type whose properties will be returned. | Integer |
job_type_name | The name of the job type whose properties will be returned. | String |
Return Value
Data Type | Explanation |
JobTypeDescription | The properties of the job type that can be customized and assigned to a new job being created, returned as the JobTypeDescription object. |
The job type description can be customized to set the job properties before its creation.
The following script gets the job type description using the job type id, job type name.
import arcpy
# Establish a connection to a Workflow database
conn = arcpywmx.Connect(r'c:\test\Workflow.jtc')
# Get the Job Type description of type Data Edits
desc = conn.config.getJobTypeDescription(job_type_name="Data Edits")
# Get the Job Type description of type 5
desc2 = conn.config.getJobTypeDescription(job_type_id=5)
The following script gets the job type description and updates two extended property table values prior to job creation.
# coding: utf-8
import arcpy
import arcpy_wmx
conn = arcpy_wmx.Connect()
# Get the job type description dictionary
MyDesc = conn.config.getJobTypeDescription(job_type_id = 401)
MyDesc
# Output of MyDesc {'auto_execute_on_create': False, 'start_date': datetime.datetime(2015, 5, 18, 12, 0), 'priority': 0, 'parent_job_name': None, 'extended_properties': {'WMXTest.DBO.extendedtest1_1': None, 'WMXTest.DBO.good_ext': None, 'WMXTest.DBO.extendedtest1': None}, 'job_type_name': 'Work Order', 'owned_by': 'will7692', 'prefix': None, 'aoi': None, 'version_name': None, 'due_date': datetime.datetime(2015, 2, 24, 12, 0), 'assigned_type': 'Unassigned', 'job_name': None, 'created_by': None, 'description': None, 'parent_version_name': None, 'parent_job_id': 0, 'suffix': None, 'assigned_to': None, 'data_workspace_id': None, 'auto_commit_workflow': True}
# Get the extended_properties dictionary
ext_prop = MyDesc['extended_properties']
ext_prop
# Output of ext_prop showing the extended property tables available as a dictionary{'WMXTest.DBO.extendedtest1_1': None, 'WMXTest.DBO.good_ext': None, 'WMXTest.DBO.extendedtest1': None}
# Defining variables of new values, for linked properties those are lists.
ext_prop_dict = {'prop_name_1' : 'prop_value_1', 'prop_name_2' : 'prop_value_2' }
linked_prop_list = [ext_prop_dict, ext_prop_dict]
# Setting them in ext_prop
ext_prop['WMXTest.DBO.extendedtest1_1'] = ext_prop_dict
ext_prop['WMXTest.DBO.good_ext'] = linked_prop_list
ext_prop
# {'WMXTest.DBO.extendedtest1_1': {'prop_name_2': 'prop_value_2', 'prop_name_1': 'prop_value_1'}, 'WMXTest.DBO.good_ext': [{'prop_name_2': 'prop_value_2', 'prop_name_1': 'prop_value_1'}, {'prop_name_2': 'prop_value_2', 'prop_name_1': 'prop_value_1'}], 'WMXTest.DBO.extendedtest1': None}
#Applying the ext_prop dictionary back the MyDesc dictionary
MyDesc['extended_properties'] = ext_prop
MyDesc
# New output of MyDesc {'auto_execute_on_create': False, 'start_date': datetime.datetime(2015, 5, 18, 12, 0), 'priority': 0, 'parent_job_name': None, 'extended_properties': {'WMXTest.DBO.extendedtest1_1': {'prop_name_2': 'prop_value_2', 'prop_name_1': 'prop_value_1'}, 'WMXTest.DBO.good_ext': [{'prop_name_2': 'prop_value_2', 'prop_name_1': 'prop_value_1'}, {'prop_name_2': 'prop_value_2', 'prop_name_1': 'prop_value_1'}], 'WMXTest.DBO.extendedtest1': None}, 'job_type_name': 'Work Order', 'owned_by': 'will7692', 'prefix': None, 'aoi': None, 'version_name': None, 'due_date': datetime.datetime(2015, 2, 24, 12, 0), 'assigned_type': 'Unassigned', 'job_name': None, 'created_by': None, 'description': None, 'parent_version_name': None, 'parent_job_id': 0, 'suffix': None, 'assigned_to': None, 'data_workspace_id': None, 'auto_commit_workflow': True}
# Create a job using the new job description
job = conn.createJob(job_type_description = MyDesc)
The following script gets the job type description and updates two linked table values prior to job creation.
# coding: utf-8
import arcpy
import arcpy_wmx
conn = arcpy_wmx.Connect()
# Get the job type description dictionary
MyDesc = conn.config.getJobTypeDescription(job_type_id = 401)
MyDesc
# Output of MyDesc {'auto_execute_on_create': False, 'start_date': datetime.datetime(2015, 5, 18, 12, 0), 'priority': 0, 'parent_job_name': None, 'extended_properties': {'WMXTest.DBO.extendedtest1_1': None, 'WMXTest.DBO.good_ext': None, 'WMXTest.DBO.extendedtest1': None}, 'job_type_name': 'Work Order', 'owned_by': 'will7692', 'prefix': None, 'aoi': None, 'version_name': None, 'due_date': datetime.datetime(2015, 2, 24, 12, 0), 'assigned_type': 'Unassigned', 'job_name': None, 'created_by': None, 'description': None, 'parent_version_name': None, 'parent_job_id': 0, 'suffix': None, 'assigned_to': None, 'data_workspace_id': None, 'auto_commit_workflow': True}
# Get the extended_properties dictionary
ext_prop = MyDesc['extended_properties']
ext_prop
# Output of ext_prop showing the extended property tables available as a dictionary{'WMXTest.DBO.extendedtest1_1': None, 'WMXTest.DBO.good_ext': None, 'WMXTest.DBO.extendedtest1': None}
# Defining variables of new values, for linked properties those are lists.
ext_prop_dict = {'prop_name_1' : 'prop_value_1', 'prop_name_2' : 'prop_value_2' }
linked_prop_list = [ext_prop_dict, ext_prop_dict]
# Setting them in ext_prop
ext_prop['WMXTest.DBO.extendedtest1_1'] = ext_prop_dict
ext_prop['WMXTest.DBO.good_ext'] = linked_prop_list
ext_prop
# {'WMXTest.DBO.extendedtest1_1': {'prop_name_2': 'prop_value_2', 'prop_name_1': 'prop_value_1'}, 'WMXTest.DBO.good_ext': [{'prop_name_2': 'prop_value_2', 'prop_name_1': 'prop_value_1'}, {'prop_name_2': 'prop_value_2', 'prop_name_1': 'prop_value_1'}], 'WMXTest.DBO.extendedtest1': None}
# Applying the ext_prop dictionary back the MyDesc dictionary
MyDesc['extended_properties'] = ext_prop
MyDesc
# New output of MyDesc {'auto_execute_on_create': False, 'start_date': datetime.datetime(2015, 5, 18, 12, 0), 'priority': 0, 'parent_job_name': None, 'extended_properties': {'WMXTest.DBO.extendedtest1_1': {'prop_name_2': 'prop_value_2', 'prop_name_1': 'prop_value_1'}, 'WMXTest.DBO.good_ext': [{'prop_name_2': 'prop_value_2', 'prop_name_1': 'prop_value_1'}, {'prop_name_2': 'prop_value_2', 'prop_name_1': 'prop_value_1'}], 'WMXTest.DBO.extendedtest1': None}, 'job_type_name': 'Work Order', 'owned_by': 'will7692', 'prefix': None, 'aoi': None, 'version_name': None, 'due_date': datetime.datetime(2015, 2, 24, 12, 0), 'assigned_type': 'Unassigned', 'job_name': None, 'created_by': None, 'description': None, 'parent_version_name': None, 'parent_job_id': 0, 'suffix': None, 'assigned_to': None, 'data_workspace_id': None, 'auto_commit_workflow': True}
# Create a job using the new job description
job = conn.createJob(job_type_description = MyDesc)
getJobTypes ()
Return Value
Data Type | Explanation |
JobType | Returns the job types as a list of JobType objects. The job types returned are filtered by applied job filters in the Workflow Manager (Classic) database. |
The job type in the Workflow Manager (Classic) database is a template for the jobs to be created.
The following script gets and lists all the job types in the Workflow Manager (Classic) database filtered by applied job filters.
import arcpy
import arcpywmx
# Establish a connection to a Workflow database
conn = arcpywmx.Connect(r'c:\test\Workflow.jtc')
# List all job type names in the Workflow Manager database filtered by applied job filters.
conn.config.getJobTypes()
getMaps ()
Return Value
Data Type | Explanation |
String | A list of the names of maps in the Workflow Manager (Classic) database. |
The maps in the Workflow Manager (Classic) database are used as the template for the job map and job AOI map.
The following script lists the names of maps in the Workflow Manager (Classic) database.
import arcpy
import arcpywmx
# Establish a connection to a Workflow database
conn = arcpywmx.Connect(r'c:\test\Workflow.jtc')
# List name of all maps in the Workflow Manager database
conn.config.getMaps()
getNotificationTypes ()
Return Value
Data Type | Explanation |
String | A list of all the notification type names in the Workflow Manager (Classic) database. |
The notification types are the templates for the job notifications sent during the life cycle of a job.
The following example returns the notification types in the Workflow Manager (Classic) database.
import arcpy
import arcpywmx
# Establish a connection to a Workflow database
conn = arcpywmx.Connect(r'c:\test\Workflow.jtc')
# Get the activity types in Workflow database
activityTypes = conn.config.getNotificationTypes()
getPriorities ()
Return Value
Data Type | Explanation |
Priority | The list of priorities in the Workflow Manager (Classic) database. The tuple consists of the id, name, and description of each priority in the Workflow Manager (Classic) database. |
The priority assigns a level of importance to the work to be completed as part of the job.
The following script lists the id, name, and description of each priority in the Workflow Manager (Classic) database.
import arcpy
import arcpywmx
# Establish a connection to a Workflow database
conn = arcpywmx.Connect(r'c:\test\Workflow.jtc')
# List all priorities in the Workflow Manager database
conn.config.getPriorities()
getPrivileges ({username})
Parameter | Explanation | Data Type |
username | The username of the user whose privileges will be returned. (The default value is currentuser) | String |
Return Value
Data Type | Explanation |
String | The list of privileges assigned to a user. If no argument is given, the privileges for the current user are returned. |
The privileges restrict or allow application functionality to users.
The following script returns a list of privileges assigned to the current windows user. If the user has CreateJob privilege a job is created. The second part of the script returns a list of privileges assigned to a specific given user.
import arcpy
import arcpywmx
# Establish a connection to a Workflow database
conn = arcpywmx.Connect(r'c:\test\Workflow.jtc')
# List all privileges the current windows user has in the Workflow Manager database
user_privileges = conn.config.getPrivileges()
# If the user has CreateJob privilege, then create a job and print the name
createJob_privilege = 'CreateJob'
if createJob_privilege in user_privileges:
job = conn.createJob(job_type_name="Data Edits")
print("Job " + job.name + " created")
# Print alphabetically sorted list of privileges
print(sorted(privileges))
# List all privileges a specific user has in the Workflow Manager database
user_privileges = conn.config.getPrivileges('jrobinson')
getStatusTypes ()
Return Value
Data Type | Explanation |
StatusType | A list of status types returned as a list of StatusType objects. |
The status types are templates used to describe the states that a job moves through during its execution.
The following example returns a list of status types in the Workflow Manager (Classic) database.
import arcpy
import arcpy.wmx
# Establish a connection to a Workflow database
conn = arcpy.wmx.Connect(r'c:\test\Workflow.jtc')
# Get the status types in Workflow database
statusTypes = conn.config.getStatusTypes()
getUserGroups ({username})
Parameter | Explanation | Data Type |
username | The username of the user whose user groups will be returned. (The default value is currentuser) | String |
Return Value
Data Type | Explanation |
String | The list of the name of user groups in the Workflow Manager (Classic) database. |
The user groups are utilized to organize users and assign privileges to the users.
The following script returns the list of the name of user groups in the Workflow Manager (Classic) database for the current windows user and the specified user.
import arcpy
import arcpywmx
# Establish a connection to a Workflow database
conn = arcpywmx.Connect(r'c:\test\Workflow.jtc')
# List all user group names in the Workflow Manager database the current windows user belongs to
conn.config.getUserGroups()
# List all user group names in the Workflow Manager database the specified user belongs to
conn.config.getUserGroups(username='jrobinson')
getUsers ()
Return Value
Data Type | Explanation |
String | A list of user names of all the users in the Workflow Manager (Classic) database. |
The users are utilized to assign work, log history in the job, and authorize access to the application.
The following script lists all the users in the database.
import arcpy
import arcpywmx
# Establish a connection to a Workflow database
conn = arcpywmx.Connect(r'c:\test\Workflow.jtc')
# List username for all the users in the Workflow Manager database
conn.config.getUsers()
retrieveMap (map_name, destination_location)
Parameter | Explanation | Data Type |
map_name | The name of the map to be retrieved from the Workflow Manager (Classic) database. | String |
destination_location | The folder location where the retrieved map will be saved and the name to be used. | String |
The maps are utilized to provide a basemap for editing and orient the user where most of the work for the job will be accomplished.
storeMap (map_name, source_location, {storage_type}, {overwrite})
Parameter | Explanation | Data Type |
map_name | The name used to store the map in the Workflow Manager (Classic) database. | String |
source_location | The folder location where the map exists, with the name of the map. | String |
storage_type | The storage type of the map. If no value is given, the map is stored in the Workflow Manager (Classic) database by default.
(The default value is embedded) | String |
overwrite | Overwrite the map if it exists in the Workflow Manager (Classic) database. If no value is provided, the existing map is not overwritten.
(The default value is false) | String |
The maps are utilized to provide a basemap for editing and orient the user where most of the work for the job will be accomplished.
The following script saves a map in the Workflow Manager (Classic) database and saves the location of another as a linked map.
import arcpy
import arcpywmx
# Establish a connection to a Workflow database
conn = arcpywmx.Connect(r'c:\test\Workflow.jtc')
# Store an embedded map with name South California Roads and overwrite existing map
conn.config.storeMap(map_name="South California Roads", source_location="C:\Test\South California Roads.mxd", storage_type="embedded", overwrite="true")
# Store a linked map
conn.config.storeMap(map_name="Parcels", source_location="C:\Test\Parcel_data.mxd", storage_type="linked")