043 cfs param check before running operation
This commit is contained in:
+1
-1
@@ -51,7 +51,7 @@
|
|||||||
|
|
||||||
//variables.framework.docs={};
|
//variables.framework.docs={};
|
||||||
variables.framework.docs.APIName="Deck API";
|
variables.framework.docs.APIName="Deck API";
|
||||||
variables.framework.docs.APIVersion="0.042";//новый номер
|
variables.framework.docs.APIVersion="0.043";
|
||||||
|
|
||||||
variables.framework.globalHeaders = structNew();
|
variables.framework.globalHeaders = structNew();
|
||||||
variables.framework.globalHeaders["Access-Control-Expose-Headers"] = "Location";
|
variables.framework.globalHeaders["Access-Control-Expose-Headers"] = "Location";
|
||||||
|
|||||||
@@ -22,7 +22,16 @@
|
|||||||
<!---NOT NULL fields--->
|
<!---NOT NULL fields--->
|
||||||
<cfset this.helper.keyExistsAndValid(arguments, "instanceOperationUid", "guid")/>
|
<cfset this.helper.keyExistsAndValid(arguments, "instanceOperationUid", "guid")/>
|
||||||
|
|
||||||
<!--- Check operation status --->
|
<cfquery name="local.qSvcOperation" result="local.result">
|
||||||
|
select io.operation, s.svc_id, so.svc_operation_id
|
||||||
|
from instance_operation io
|
||||||
|
join instance e on (io.instance_uid=e.instance_uid)
|
||||||
|
join svc s on (e.service_id=s.svc_id)
|
||||||
|
join svc_operation so on (s.svc_id=so.svc_id AND io.operation=so.operation)
|
||||||
|
where io.instance_operation_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.instanceOperationUid#" null=#!isValid('guid',arguments.instanceOperationUid)#/>
|
||||||
|
</cfquery>
|
||||||
|
|
||||||
|
<!--- Check operation status, do not start already started (*** consider timeout and cancelling timed out operations here) --->
|
||||||
<cfquery name="local.qCheckStarted" result="local.result">
|
<cfquery name="local.qCheckStarted" result="local.result">
|
||||||
select io.dt_submit, io.dt_finish, io.submit_result
|
select io.dt_submit, io.dt_finish, io.submit_result
|
||||||
from instance_operation io
|
from instance_operation io
|
||||||
@@ -33,6 +42,27 @@
|
|||||||
<cfelseif left(local.qCheckStarted.submit_result,1) EQ "2" AND len(local.qCheckStarted.dt_finish) EQ 0><!--- 201 etc --->
|
<cfelseif left(local.qCheckStarted.submit_result,1) EQ "2" AND len(local.qCheckStarted.dt_finish) EQ 0><!--- 201 etc --->
|
||||||
<cfreturn representationOf(this.helper.formatMessage("Operation already started", "Parameter creation disabled for started operation")).withStatus(422)/>
|
<cfreturn representationOf(this.helper.formatMessage("Operation already started", "Parameter creation disabled for started operation")).withStatus(422)/>
|
||||||
</cfif>
|
</cfif>
|
||||||
|
<!--- Check CFS parameters at least for existence
|
||||||
|
(*** would be better to check RFS but now CFS params are primary, RFS even mostly do not have is_required flag set) --->
|
||||||
|
<!--- *** !!! тут возможна ошибка из-за нечеткого понимания: даже в отсутствие обязательного CFS параметра RFS параметр может быть сгенерирован, например, из дефолта. То есть данный вариант проверки - неполный и ущербный, впоследствии может неожиданно перестать работать --->
|
||||||
|
|
||||||
|
<cfquery name="local.qCheckCfsParams" result="local.result">
|
||||||
|
select sop.svc_operation_cfs_param_id, sop.svc_operation_cfs_param, sop.is_required,
|
||||||
|
iop.instance_operation_cfs_param_uid::text as instance_operation_cfs_param_uid, iop.param_value
|
||||||
|
from svc_operation_cfs_param sop
|
||||||
|
left outer join instance_operation_cfs_param iop on (sop.svc_operation_cfs_param_id=iop.svc_operation_cfs_param_id AND iop.instance_operation_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.instanceOperationUid#" null=#!isValid('guid',arguments.instanceOperationUid)#/>)
|
||||||
|
where sop.svc_operation_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#local.qSvcOperation.svc_operation_id#"/>
|
||||||
|
</cfquery><!--- <cfdump var=#local.qCheckCfsParams#/><cfabort/> --->
|
||||||
|
<cfset local.cfsParamChecker = CreateObject("component", "instance_operation_cfs_param_ls")/>
|
||||||
|
<!--- we could check existence of required parameters right in the query,
|
||||||
|
but for possible value chech and verbosity do it in the loop --->
|
||||||
|
<cfloop query=#local.qCheckCfsParams#>
|
||||||
|
<cfif (local.qCheckCfsParams.is_required GT 0 AND NOT len(local.qCheckCfsParams.instance_operation_cfs_param_uid) GT 0)>
|
||||||
|
<cfreturn representationOf(this.helper.formatMessage("required CFS parameter #local.qCheckCfsParams.svc_operation_cfs_param# (#local.qCheckCfsParams.svc_operation_cfs_param_id#) is missing", "Missing required CFS parameter")).withStatus(409)/>
|
||||||
|
<cfelse>
|
||||||
|
<cfset local.cfsParamChecker.checkParam(local.qCheckCfsParams.svc_operation_cfs_param_id, qCheckCfsParams.param_value, qCheckCfsParams.instance_operation_cfs_param_uid)/>
|
||||||
|
</cfif>
|
||||||
|
</cfloop><!--- <cfdump var=#local.qCheckCfsParams#/><cfabort/> --->
|
||||||
|
|
||||||
<cfset generateRfsParams(arguments.instanceOperationUid, arguments.usrId)/>
|
<cfset generateRfsParams(arguments.instanceOperationUid, arguments.usrId)/>
|
||||||
<cfset submitJob(arguments.instanceOperationUid)/>
|
<cfset submitJob(arguments.instanceOperationUid)/>
|
||||||
|
|||||||
Reference in New Issue
Block a user