205 getStringFromStruct
This commit is contained in:
+1
-1
@@ -57,7 +57,7 @@
|
||||
|
||||
//variables.framework.docs={};
|
||||
variables.framework.docs.APIName="svc-api";
|
||||
variables.framework.docs.APIVersion="0.204"; /*$ git config --global --unset user.password*/
|
||||
variables.framework.docs.APIVersion="0.205"; /*$ git config --global --unset user.password*/
|
||||
|
||||
variables.framework.globalHeaders = structNew();
|
||||
variables.framework.globalHeaders["Access-Control-Expose-Headers"] = "Location";
|
||||
|
||||
@@ -285,7 +285,7 @@ arguments.requestArguments.specificationId=usrCustomerInfo.specificationId; //In
|
||||
</cfif>
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="getValueFromStruct" returntype="string" hint="returns scalar">
|
||||
<!--- <cffunction name="getValueFromStruct" returntype="string" hint="returns scalar">
|
||||
<cfargument name="struct" type="struct" required="true"/>
|
||||
<cfargument name="path" type="string" required="true"/>
|
||||
|
||||
@@ -296,7 +296,33 @@ arguments.requestArguments.specificationId=usrCustomerInfo.specificationId; //In
|
||||
<cfreturn cfcatch.message/><!--- халява, для упрощения диагностики --->
|
||||
</cfcatch>
|
||||
</cftry>
|
||||
</cffunction> --->
|
||||
|
||||
<cffunction name="getValueFromStruct" returntype="any">
|
||||
<cfargument name="struct" type="struct" required="true"/>
|
||||
<cfargument name="path" type="string" required="true"/>
|
||||
|
||||
<cftry>
|
||||
<cfreturn structGet("arguments.struct.#arguments.path#")/>
|
||||
<cfcatch type="any">
|
||||
<!--- можно ожидать ошибки, если по указанному пути расположена не структура --->
|
||||
<cfreturn cfcatch.message/><!--- халява, для упрощения диагностики --->
|
||||
</cfcatch>
|
||||
</cftry>
|
||||
</cffunction>
|
||||
|
||||
|
||||
<cffunction name="getStringFromStruct" returntype="string" hint="returns scalar">
|
||||
<cfargument name="struct" type="struct" required="true"/>
|
||||
<cfargument name="path" type="string" required="true"/>
|
||||
|
||||
<cfset var value = getValueFromStruct(arguments.struct,arguments.path)/>
|
||||
<cfif isStruct(value) OR isArray(value)>
|
||||
<cfreturn serializeJson(value)/>
|
||||
</cfif>
|
||||
<cfreturn toString(value)/>
|
||||
</cffunction>
|
||||
|
||||
|
||||
<cffunction name="getKeyListFromStruct" returntype="string" hint="returns list">
|
||||
<cfargument name="struct" type="struct" required="true"/>
|
||||
@@ -311,6 +337,7 @@ arguments.requestArguments.specificationId=usrCustomerInfo.specificationId; //In
|
||||
</cfcatch>
|
||||
</cftry>
|
||||
</cffunction>
|
||||
|
||||
|
||||
<cffunction name="getArrayAsListFromStruct" returntype="string" hint="returns list">
|
||||
<cfargument name="struct" type="struct" required="true"/>
|
||||
@@ -325,6 +352,7 @@ arguments.requestArguments.specificationId=usrCustomerInfo.specificationId; //In
|
||||
</cfcatch>
|
||||
</cftry>
|
||||
</cffunction>
|
||||
|
||||
|
||||
<cffunction name="getInstanceState" returntype="struct">
|
||||
<cfargument name="instanceUid" type="guid" required="true"/>
|
||||
@@ -349,30 +377,31 @@ arguments.requestArguments.specificationId=usrCustomerInfo.specificationId; //In
|
||||
</cfif>
|
||||
<cfreturn {}/>
|
||||
</cffunction>
|
||||
|
||||
|
||||
<cffunction name="getResourceRealmConfig" returntype="struct">
|
||||
<cfargument name="resourceRealm" type="string" default=#getResourceRealm()#/><!--- платформа может быть определена для родительского инстанса где то в иерархии --->
|
||||
<cffunction name="getResourceRealmConfig" returntype="struct">
|
||||
<cfargument name="resourceRealm" type="string" default=#getResourceRealm()#/><!--- платформа может быть определена для родительского инстанса где то в иерархии --->
|
||||
|
||||
<cfset var local={}/>
|
||||
<cfquery name="local.qResourceRealm" datasource="cmdb">
|
||||
select r.resource_realm_id, r.properties
|
||||
from resource_realm r
|
||||
where r.resource_realm=<cfqueryparam cfsqltype="cf_sql_varchar" value=#arguments.resourceRealm#/>
|
||||
</cfquery>
|
||||
<!--- <cfdump var=#arguments#/>
|
||||
<cfdump var=#local.qResourceRealm#/> --->
|
||||
<cftry>
|
||||
<cfset var structConfig = deserializeJson(local.qResourceRealm.properties)/>
|
||||
<cfcatch type="ANY">
|
||||
<cfreturn {"error":"error parsing resource realm properties"}/>
|
||||
<!--- вообще-то такого быть не должно: свойства хранятся в поле jsonb --->
|
||||
</cfcatch>
|
||||
</cftry>
|
||||
<cfif len(structConfig)>
|
||||
<cfreturn structConfig/>
|
||||
</cfif>
|
||||
<cfreturn {}/>
|
||||
</cffunction>
|
||||
<cfset var local={}/>
|
||||
<cfquery name="local.qResourceRealm" datasource="cmdb">
|
||||
select r.resource_realm_id, r.properties
|
||||
from resource_realm r
|
||||
where r.resource_realm=<cfqueryparam cfsqltype="cf_sql_varchar" value=#arguments.resourceRealm#/>
|
||||
</cfquery>
|
||||
<!--- <cfdump var=#arguments#/>
|
||||
<cfdump var=#local.qResourceRealm#/> --->
|
||||
<cftry>
|
||||
<cfset var structConfig = deserializeJson(local.qResourceRealm.properties)/>
|
||||
<cfcatch type="ANY">
|
||||
<cfreturn {"error":"error parsing resource realm properties"}/>
|
||||
<!--- вообще-то такого быть не должно: свойства хранятся в поле jsonb --->
|
||||
</cfcatch>
|
||||
</cftry>
|
||||
<cfif len(structConfig)>
|
||||
<cfreturn structConfig/>
|
||||
</cfif>
|
||||
<cfreturn {}/>
|
||||
</cffunction>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -110,6 +110,7 @@
|
||||
</m:field_set>
|
||||
from svc_operation_cfs_param p
|
||||
where p.svc_operation_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.svcOperationId#" null=#!isValid('integer',arguments.svcOperationId)#/>
|
||||
AND p.is_actual
|
||||
order by p.sort, p.svc_operation_cfs_param_id
|
||||
</cfquery>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user