描述
Configuration 对象提供对 Workflow Manager (Classic) 数据库中配置元素的访问权限。
讨论
Configuration 对象提供对 Workflow Manager (Classic) 数据库中配置元素的访问权限。
方法概述
方法 | 说明 |
getActivityTypes () | 将 Workflow Manager (Classic) 数据库中的所有活动类型以 ActivityType 对象列表的形式返回。 |
getHoldTypes () | 将 Workflow Manager (Classic) 数据库中的所有保存类型以 HoldType 对象列表的形式返回。 |
getJobTypeDescription ({job_type_id}, {job_type_name}) | 使用作业类型 id 或作业类型名称,返回可在创建作业之前进行自定义的作业类型属性。 |
getJobTypes () | 返回 Workflow Manager (Classic) 数据库中由应用的作业过滤器过滤的所有作业类型的列表。 |
getMaps () | 返回 Workflow Manager (Classic) 数据库中地图的名称列表。 |
getNotificationTypes () | 返回 Workflow Manager (Classic) 数据库中的所有通知类型列表。 |
getPriorities () | 返回 Workflow Manager (Classic) 数据库中优先级的列表。 |
getPrivileges ({username}) | 返回分配给用户的权限列表。如果未给定任何参数,则将返回当前用户的权限。 |
getStatusTypes () | 将 Workflow Manager (Classic) 数据库中的所有状态类型以 StatusType 对象列表的形式返回。 |
getUserGroups ({username}) | 返回 Workflow Manager (Classic) 数据库中的用户所在组的名称列表。如果未给定任何参数,则将返回当前用户所在的用户组。 |
getUsers () | 返回 Workflow Manager (Classic) 数据库中所有用户的用户名列表。 |
retrieveMap (map_name, destination_location) | 从 Workflow Manager (Classic) 数据库的指定文件夹中检索地图。 |
storeMap (map_name, source_location, {storage_type}, {overwrite}) | 将地图存储在 Workflow Manager (Classic) 数据库中。Workflow Manager (Classic) 数据库中仅可存储 .mxd。 |
方法
getActivityTypes ()
返回值
数据类型 | 说明 |
ActivityType | 以 ActivityType 对象列表的形式返回的活动类型列表。 |
活动类型是在作业的生命周期内记录在历史中的活动的模板。
以下示例返回该数据库中的活动类型。
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 ()
返回值
数据类型 | 说明 |
HoldType | 以 HoldType 对象列表的形式返回的保存类型列表。 |
保留类型是一种保存内容(可用于暂停作业,暂停时间无限制)模板。
以下示例会返回 Workflow Manager (Classic) 数据库中保存类型的列表。
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})
参数 | 说明 | 数据类型 |
job_type_id | 将返回属性的作业类型的 ID。 | Integer |
job_type_name | 将返回属性的作业类型的名称。 | String |
返回值
数据类型 | 说明 |
JobTypeDescription | 可进行自定义并分配给正在创建的新作业的作业类型的属性以 JobTypeDescription 对象的形式返回。 |
可在创建作业之前自定义作业类型描述以设置作业属性。
以下脚本使用作业类型 id 和作业类型名称获取作业类型描述。
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)
以下脚本可在作业创建之前获取作业类型描述并更新两个扩展属性表值。
# 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)
以下脚本可在作业创建之前获取作业类型描述并更新两个链接表值。
# 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 ()
返回值
数据类型 | 说明 |
JobType | 将作业类型以 JobType 对象列表的形式返回。返回的作业类型由应用的作业过滤器在 Workflow Manager (Classic) 数据库中进行过滤。 |
Workflow Manager (Classic) 数据库中的作业类型是待创建作业的模板。
以下脚本获取并列出 Workflow Manager (Classic) 数据库中由应用的作业过滤器过滤的所有作业类型。
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 ()
返回值
数据类型 | 说明 |
String | Workflow Manager (Classic) 数据库中地图的名称列表。 |
Workflow Manager (Classic) 数据库中的地图用作作业地图和作业 AOI 地图的模板。
以下脚本列出了 Workflow Manager (Classic) 数据库中地图的名称。
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 ()
返回值
数据类型 | 说明 |
String | Workflow Manager (Classic) 数据库中的所有通知类型名称列表。 |
通知类型是在作业的生命周期内发送的作业通知模板。
以下示例返回 Workflow Manager (Classic) 数据库中的通知类型。
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 ()
返回值
数据类型 | 说明 |
Priority | Workflow Manager (Classic) 数据库中优先级的列表。元组由 Workflow Manager (Classic) 数据库中每个优先级的 id、名称和描述构成。 |
优先级可为作为作业的一部分来完成的工作分配重要性级别。
以下脚本列出了 Workflow Manager (Classic) 数据库中每个优先级的 id、名称和描述。
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})
参数 | 说明 | 数据类型 |
username | 将返回权限的用户的用户名。 (默认值为 currentuser) | String |
返回值
数据类型 | 说明 |
String | 分配给用户的权限的列表。如果未给定任何参数,则将返回当前用户的权限。 |
这些权限限制或允许用户使用应用程序功能。
以下脚本会返回分配给当前 windows 用户的权限的列表。如果用户拥有 CreateJob 权限,则会创建一个作业。该脚本的第二部分会返回分配给具体给定用户的权限的列表。
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 ()
返回值
数据类型 | 说明 |
StatusType | 以 StatusType 对象列表的形式返回的状态类型列表。 |
状态类型是用于描述作业在执行期间所经历的状态的模板。
以下示例会返回 Workflow Manager (Classic) 数据库中状态类型的列表。
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})
参数 | 说明 | 数据类型 |
username | 将返回用户组的用户的用户名。 (默认值为 currentuser) | String |
返回值
数据类型 | 说明 |
String | Workflow Manager (Classic) 数据库中用户组的名称列表。 |
可利用用户组组织用户,并为用户分配权限。
以下脚本会返回 Workflow Manager (Classic) 数据库中针对当前 windows 用户和指定用户所在用户组的名称列表。
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 ()
返回值
数据类型 | 说明 |
String | Workflow Manager (Classic) 数据库中所有用户的用户名列表。 |
可利用用户来分配工作、记录作业历史信息以及授予应用程序访问权限。
以下脚本列出了数据库中的所有用户。
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)
参数 | 说明 | 数据类型 |
map_name | 要从 Workflow Manager (Classic) 数据库中检索的地图的名称。 | String |
destination_location | 将要保存所检索到的地图的文件夹位置和待使用名称。 | String |
该地图可用于提供编辑所需的底图,并将用户定向到将完成作业的大部分工作的地方。
storeMap (map_name, source_location, {storage_type}, {overwrite})
参数 | 说明 | 数据类型 |
map_name | 用于将地图存储于 Workflow Manager (Classic) 数据库的名称。 | String |
source_location | 地图所在的文件夹位置,其中带有地图名称。 | String |
storage_type | 地图的存储类型。如没有给定值,则地图默认存储于 Workflow Manager (Classic) 数据库中。
(默认值为 embedded) | String |
overwrite | 如果此地图存在于 Workflow Manager (Classic) 数据库中,则覆盖该地图。如果未提供给定值,则不覆盖现有地图。
(默认值为 false) | String |
该地图可用于提供编辑所需的底图,并将用户定向到将完成作业的大部分工作的地方。
以下脚本可将地图保存在 Workflow Manager (Classic) 数据库中,并将另一地图的位置保存为链接地图。
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")