151 getListFromState

This commit is contained in:
2025-10-16 11:23:48 +03:00
parent e33a9700af
commit bec77bb20a
4 changed files with 951 additions and 5 deletions
+32 -1
View File
@@ -55,8 +55,10 @@ arguments.requestArguments.specificationId=usrCustomerInfo.specificationId; //In
<m:field>sop.man</m:field>
<m:field>sop.func</m:field>
<m:field>sop.nested_ref</m:field>
<m:field>sop.config</m:field>
<m:field>sop.config::text as config</m:field>
<m:field>sop.state_path</m:field>
<m:field>e.service_id</m:field>
<m:field>e.instance_uid</m:field>
</m:field_set>
from instance_operation_cfs_param iop
join svc_operation_cfs_param sop on (iop.svc_operation_cfs_param_id=sop.svc_operation_cfs_param_id)
@@ -86,6 +88,21 @@ arguments.requestArguments.specificationId=usrCustomerInfo.specificationId; //In
<cfelseif len(local.qCfsParam.nested_ref)>
<cfset var fNestedRef = generateClosure(local.qCfsParam.nested_ref, local.qCfsParam.config)/>
<cfset local.qCfsParam.nested_ref_data = fNestedRef() />
<cfelseif len(local.qCfsParam.state_path)>
<!--- для экономии читаем стейт только при необходимости --->
<cfquery name="local.qCurrentState">
select g.instance_state_uid, g.version, g.instance_data, g.is_test, g.instance_uid
from instance_state g
where g.instance_uid=<cfqueryparam cfsqltype="cf_sql_other" value=#local.qCfsParam.instance_uid#/>
order by g.version desc
limit 1
</cfquery>
<cfset var currentState = {}/>
<cftry>
<cfset currentState = deserializeJson(local.qCurrentState.instance_data)/>
<cfcatch type="ANY"></cfcatch>
</cftry>
<cfset local.qCfsParam.value_list = getListFromState(currentState, local.qCfsParam.state_path)/>
</cfif>
<cfif local.qCfsParam.data_type EQ "map">
@@ -404,6 +421,20 @@ arguments.requestArguments.specificationId=usrCustomerInfo.specificationId; //In
<cfreturn result/>
</cffunction>
<!--- duplicated in deck-tool --->
<cffunction name="getListFromState" returntype="string" hint="returns list">
<cfargument name="state" type="struct" required="true"/>
<cfargument name="path" type="string" required="true"/>
<cftry>
<cfreturn structKeyList(structGet("arguments.state.#arguments.path#"))/>
<cfcatch type="any">
<!--- можно ожидать ошибки, если по указанному пути расположена не структура --->
<cfreturn cfcatch.message/><!--- для упрощения диагностики --->
</cfcatch>
</cftry>
</cffunction>
</cfcomponent>