Skip To Content

Configuration

Summary

The Configuration object provides access to the configuration elements in the Workflow Manager database.

Discussion

The Configuration object provides access to the configuration elements in the Workflow Manager database.

Method Overview

MethodExplanation
getActivityTypes ()

Returns all activity types in the Workflow Manager database as a list of ActivityType objects.

getHoldTypes ()

Returns all the hold types in the Workflow Manager 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 database filtered by applied job filters.

getMaps ()

Returns a list of the names of maps in the Workflow Manager database.

getNotificationTypes ()

Returns a list of all the notification types in the Workflow Manager database.

getPriorities ()

Returns a list of priorities in the Workflow Manager 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 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 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 database.

retrieveMap (map_name, destination_location)

Retrieves a map from the Workflow Manager database to a specified folder.

storeMap (map_name, source_location, {storage_type}, {overwrite})

Stores a map in the Workflow Manager database. Only .mxd can be stored in the Workflow Manager database.

Methods

getActivityTypes ()
Return Value
Data TypeExplanation
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 arcpy.wmx

#Establish a connection to a Workflow database
conn = arcpy.wmx.Connect(r'c:\test\Workflow.jtc')

#Get the activity types in Workflow database
activityTypes = conn.config.getActivityTypes()
getHoldTypes ()
Return Value
Data TypeExplanation
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 database.

import arcpy

#Establish a connection to a Workflow database
conn = arcpy.wmx.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})
ParameterExplanationData 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 TypeExplanation
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 = arcpy.wmx.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.

import arcpy

#Establish a connection to a Workflow database
conn = arcpy.wmx.Connect(r'c:\test\Workflow.jtc')

#Get the Job Type description 
desc = conn.config.getJobTypeDescription(job_type_name="Extended Example")

#Get the Extended Properties dictionary for the Job Type
ext_prop = desc.extendedProperties

#Define new values to use for Extended Property's Name and Address
ext_prop_dict = {'NAME' : 'John Smith', 'ADDRESS' : '106 Everdale Drive' }

#Set the new values in the appropriate Extended Property table
ext_prop['TestDB.ExtendedTable'] = ext_prop_dict

#Apply the ext_prop dictionary back to the Job Type's desc object
desc.extendedProperties = ext_prop

#Create a Job using the new Job Type description
job = conn.createJob(job_type_description = desc)

#Get the Job's properties
job_props = job.getExtendedPropertyTable('TestDB.ExtendedTable')

#Print the new extended property Name value for the Job
print(str(job_props['NAME']))

The following script gets the job type description and updates two linked table values prior to job creation.

import arcpy

#Establish a connection to a Workflow database
conn = arcpy.wmx.Connect(r'c:\test\Workflow.jtc')

#Get the Job Type description 
desc = conn.config.getJobTypeDescription(job_type_name="Linked Example")

#Get the Extended Properties dictionary for the Job Type
ext_prop = desc.extendedProperties

#Define new values to use for Linked Properties
Table_1 = {'PLAN_NUMBER': '2', 'PARCEL_NUMBER': 568}
Table_2 = {'PLAN_NUMBER': '3', 'PARCEL_NUMBER': 569}

#Set the new tables for Linked Propertes as a list
linked_prop_list = [Table_1, Table_2]

#Set the new values in the appropriate Extended Property table
ext_prop['TestDB.LinkedTable'] = linked_prop_list

#Apply the ext_prop dictionary back to the Job Type's desc object
desc.extendedProperties = ext_prop

#Create a Job using the new Job Type description
job = conn.createJob(job_type_description = desc)

#Get the Job's properties
job_props = job.getExtendedPropertyTable('TestDB.LinkedTable')

#Print the first Parcel Number from the Linked table, value of 568
print(str(job_props[0]['PARCEL_NUMBER']))
getJobTypes ()
Return Value
Data TypeExplanation
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 database.

The job type in the Workflow Manager database is a template for the jobs to be created.

The following script gets and lists all the job types in the Workflow Manager database filtered by applied job filters.

import arcpy

#Establish a connection to a Workflow database
conn = arcpy.wmx.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 TypeExplanation
String

A list of the names of maps in the Workflow Manager database.

The maps in the Workflow Manager 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 database.

import arcpy
import arcpy.wmx

#Establish a connection to a Workflow database
conn = arcpy.wmx.Connect(r'c:\test\Workflow.jtc')

#List name of all maps in the Workflow Manager database
conn.getMaps()
getNotificationTypes ()
Return Value
Data TypeExplanation
String

A list of all the notification type names in the Workflow Manager 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 database.

import arcpy

#Establish a connection to a Workflow database
conn = arcpy.wmx.Connect(r'c:\test\Workflow.jtc')

#Get the activity types in Workflow database 
activityTypes = conn.config.getNotificationTypes()
getPriorities ()
Return Value
Data TypeExplanation
Priority

The list of priorities in the Workflow Manager database. The tuple consists of the id, name, and description of each priority in the Workflow Manager 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 database.

import arcpy

#Establish a connection to a Workflow database
conn = arcpy.wmx.Connect(r'c:\test\Workflow.jtc')

#List all priorities in the Workflow Manager database
conn.config.getPriorities()
getPrivileges ({username})
ParameterExplanationData Type
username

The username of the user whose privileges will be returned.

(The default value is currentuser)

String
Return Value
Data TypeExplanation
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

#Establish a connection to a Workflow database
conn = arcpy.wmx.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 TypeExplanation
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 database.

import arcpy

#Establish a connection to a Workflow database
conn = arcpy.wmx.Connect(r'c:\test\Workflow.jtc')

#Get the status types in the Workflow database
statusTypes = conn.config.getStatusTypes()
getUserGroups ({username})
ParameterExplanationData Type
username

The username of the user whose user groups will be returned.

(The default value is currentuser)

String
Return Value
Data TypeExplanation
String

The list of the name of user groups in the Workflow Manager 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 database for the current windows user and the specified user.

import arcpy

#Establish a connection to a Workflow database
conn = arcpy.wmx.Connect(r'c:\test\Workflow.jtc')

#List all user group names in the Workflow Manager database the current windows user belongs to
conn.getUserGroups()

#List all user group names in the Workflow Manager database the specified user belongs to
conn.getUserGroups(username='jrobinson')
getUsers ()
Return Value
Data TypeExplanation
String

A list of user names of all the users in the Workflow Manager 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

#Establish a connection to a Workflow database
conn = arcpy.wmx.Connect(r'c:\test\Workflow.jtc')

#List username for all the users in the Workflow Manager database
conn.getUsers()
retrieveMap (map_name, destination_location)
ParameterExplanationData Type
map_name

The name of the map to be retrieved from the Workflow Manager 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.

The following script retrieves an existing map from the Workflow Manager database to the location specified and saves it with the provided name.

import arcpy

#Establish a connection to a Workflow database
conn = arcpy.wmx.Connect(r'c:\test\Workflow.jtc')

maplist = conn.config.getMaps()

#Retrieve a map named Parcel Data from the Workflow Manager database
for maps in mapList:
    if (maps=='Parcel Data'):
        conn.retrieveMap(map_name='Parcel Data',destination_location=r'C:\test\Parcel Data.mxd')

The following script retrieves an existing map from the Workflow Manager database to the location specified and saves it with the provided name.

import arcpy
import arcpywmx

#Establish a connection to a Workflow database
conn = arcpywmx.Connect(r'c:\test\Workflow.jtc')

#Retrieve a map named Parcel Data from the Workflow Manager database
for maps in mapList:
    if (maps=='Parcel Data'):
        conn.config.retrieveMap(map_name='Parcel Data',destination_location=r'C:\test\Parcel Data.mxd')
storeMap (map_name, source_location, {storage_type}, {overwrite})
ParameterExplanationData Type
map_name

The name used to store the map in the Workflow Manager 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 database by default.

  • EMBEDDEDThe map is stored in the Workflow Manager database.
  • LINKEDThe link to the map location is stored in the Workflow Manager database.

(The default value is embedded)

String
overwrite

Overwrite the map if it exists in the Workflow Manager database. If no value is provided, the existing map is not overwritten.

  • TrueThe map is stored in the Workflow Manager database.
  • FalseThe link to the map is stored in the Workflow Manager database.

(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 database and saves the location of another as a linked map.

import arcpy

#Establish a connection to a Workflow database
conn = arcpy.wmx.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")