CMDBuild Forum

Determinazione utente che esegue il processo

Salve,

 

avrei bisogno di capire come determinare l'utente che stà eseguento un processo, ovvero la funzione che posso utilizzare per determinarlo.

Es. accedo al sistema con l'utente test

nel processo dopo aver richiesto alcune informazioni in input ho necessità di conoscere la username dell'utente in questione, nel mio caso test per alcune elaborazioni successive.

 

da una lettura del manuale dovrei in qualche modo usare _CurrentUser ma non ho capito bene come

 

Grazie

 

Donato

Salve

 

ho provato, approfondendo lo studio della documentazione ad utilizzare il seguente approccio, nel task del wf ho inserito le istruzioni seguenti:

 

username=cmdb.queryClass("User")

    .with("Id",_CurrentUser.getId())

   .fetch();

Utente=username.get(0).get("Username");

 

ottengo il seguente errore

 

2014-07-31 09:03:52,682: Process [key=222_Package_test2_Process_test2,mgrname=Package_test2#1#Process_test2] is created

2014-07-31 09:03:52,807: process 'Process_test2' started

2014-07-31 09:03:52,807: sending notification for start of process 'Process_test2'

2014-07-31 09:03:52,853: Process [key=222_Package_test2_Process_test2,mgrname=Package_test2#1#Process_test2] is starting...

2014-07-31 09:03:52,853: Process[key=222_Package_test2_Process_test2,mgrname=Package_test2#1#Process_test2] - Activity[Process Id=222_Package_test2_Process_test2, Id=177_222_Package_test2_Process_test2_Process_test2_act1, ba=null, ActDefId=Process_test2_act1] is created

2014-07-31 09:03:52,853: activity 'Process_test2_act1' started

2014-07-31 09:03:52,853: activity 'Process_test2_act1' closed

2014-07-31 09:03:52,853: Process[key=222_Package_test2_Process_test2,mgrname=Package_test2#1#Process_test2] - Activity[Process Id=222_Package_test2_Process_test2, Id=177_222_Package_test2_Process_test2_Process_test2_act1, ba=null, ActDefId=Process_test2_act1] is completed.

2014-07-31 09:03:52,853: Process[key=222_Package_test2_Process_test2,mgrname=Package_test2#1#Process_test2] - Activity[Process Id=222_Package_test2_Process_test2, Id=178_222_Package_test2_Process_test2_Process_test2_act3, ba=null, ActDefId=Process_test2_act3] is created

2014-07-31 09:03:52,853: activity 'Process_test2_act3' started

2014-07-31 09:03:52,853: sending notification for activity 'Process_test2_act3'

2014-07-31 09:03:52,853: sending notification for update of process 'Process_test2'

2014-07-31 09:03:54,133: activity 'Process_test2_act3' closed

2014-07-31 09:03:54,133: sending notification for activity 'Process_test2_act3'

2014-07-31 09:03:54,133: sending notification for update of process 'Process_test2'

2014-07-31 09:03:54,289: Process[key=222_Package_test2_Process_test2,mgrname=Package_test2#1#Process_test2] - Activity[Process Id=222_Package_test2_Process_test2, Id=178_222_Package_test2_Process_test2_Process_test2_act3, ba=null, ActDefId=Process_test2_act3] is completed.

2014-07-31 09:03:54,289: Process[key=222_Package_test2_Process_test2,mgrname=Package_test2#1#Process_test2] - Activity[Process Id=222_Package_test2_Process_test2, Id=179_222_Package_test2_Process_test2_Process_test2_act2, ba=null, ActDefId=Process_test2_act2] is created

2014-07-31 09:03:54,289: activity 'Process_test2_act2' started

2014-07-31 09:03:54,289: Activity[Process Id=222_Package_test2_Process_test2, Id=179_222_Package_test2_Process_test2_Process_test2_act2, ba=null, ActDefId=Process_test2_act2] - Executing script [type=text/java,value=username=cmdb.queryClass("User")

.with("Id",_CurrentUser.getId())

.fetch();

Utente=username.get(0).get("Username");]

2014-07-31 09:03:54,289: loading workflow api 'org.cmdbuild.workflow.api.SoapSharkWorkflowApiFactory'

2014-07-31 09:03:54,289: loading class 'org.cmdbuild.workflow.api.SoapSharkWorkflowApiFactory' that should be a 'org.cmdbuild.workflow.api.SharkWorkflowApiFactory'

2014-07-31 09:03:54,991: loading mail api 'org.cmdbuild.common.api.mail.javax.mail.JavaxMailBasedMailApiFactory'

2014-07-31 09:03:54,991: loading class 'org.cmdbuild.common.api.mail.javax.mail.JavaxMailBasedMailApiFactory' that should be a 'org.cmdbuild.common.api.mail.MailApiFactory'

2014-07-31 09:03:55,646: BshToolAgent - application username=cmdb.queryClass("User")

.with("Id",_CurrentUser.getId())

.fetch();

Utente=username.get(0).get("Username"); terminated incorrectly: Sourced file: eval stream : Method Invocation fetch : at Line: 3 : in file: eval stream : .fetch ( )

 

Target exception: javax.xml.ws.soap.SOAPFaultException: Fault occurred while processing.

 

2014-07-31 09:03:55,646: cannot execute tool agent - application  terminated incorrectly

Sourced file: eval stream : Method Invocation fetch : at Line: 3 : in file: eval stream : .fetch ( )

 

Target exception: javax.xml.ws.soap.SOAPFaultException: Fault occurred while processing.

Salve,

 

a seguito di ulteriori test ho risolto la mia esigenza utilizzando

 

utente=_CurrentUser.getDescription();

 

 

Donato