[midPoint] Get OwnerName in reportQuery

Pavol Mederly mederly at evolveum.com
Thu Oct 24 08:52:19 UTC 2019


Hello Peter,

there's no point in trying to look up the task in the repository - it's 
transient, so no OID, no repo.

I'm a bit surprised that it has no owner.

Anyway, you could also try

com.evolveum.midpoint.security.api.SecurityUtil.getPrincipal().getUser() 
or .getUsername()

Best regards,

Pavol Mederly
Software developer
evolveum.com

On 24.10.2019 10:11, Peter Holes wrote:
> Hi Pavol,
>
> thanks for your quick response. I try your recommendation, but I
> didn't get taskOwner or any relevant task details as I expected.
>
> What I try:
> 1.) This works: ModelExpressionThreadLocalHolder?.getCurrentTask()
> this return taskObject
> <com.evolveum.midpoint.task.quartzimpl.TaskQuartzImpl at 44809005
> DEFAULT_BINDING_TYPE=TIGHT lastOperationStatsUpdateTimestamp=null
> operationStatsUpdateInterval=3000 taskPrism=task:null(null)
> requestee=null environmentalPerformanceInformation=com.evolveum.midpoint.schema.statistics.EnvironmentalPerformanceInformation at 1ddb9810
> synchronizationInformation=null iterativeTaskInformation=null
> actionsExecutedInformation=null lightweightAsynchronousSubtasks=[]
> parentForLightweightAsynchronousTask=null
> taskResult=R(com.evolveum.midpoint.report.api.ReportService.searchObjects()
> UNKNOWN null) canRun=true
> taskManager=com.evolveum.midpoint.task.quartzimpl.TaskManagerQuartzImpl at 264c96e6
> repositoryService=com.evolveum.midpoint.repo.sql.SqlRepositoryServiceImpl at 1baba58
> lightweightTaskHandler=null lightweightHandlerFuture=null
> lightweightHandlerExecuting=false recreateQuartzTrigger=false
> pendingModifications=[]>
>
> 2.) When I try to get any taskDetails like taskOwner, taskOID or
> taskName everything was null.
> I was able to get taskIdentifier which is not the same like
> taskIdentifier generated in GUI - why?
> When I try to found task by taskIdentifier, task doesn't exists.
> I try the same scenario on 3.7.2 / 3.9, same same result.
>
> Here is my debug code snippet:
> ##
> task = ModelExpressionThreadLocalHolder?.getCurrentTask();
> query = QueryBuilder.queryFor(TaskType.class,midpoint.getPrismContext()).item(TaskType.F_TASK_IDENTIFIER).eq(task.getTaskIdentifier()).build();
> task2 = midpoint.searchObjects(TaskType.class, query);
> log.info('############## taskObj:{}', task.dump());
> log.info('############## taskOwner:{}', task.getOwner());
> log.info('############## taskID:{}', task.getTaskIdentifier());
> log.info('############## taskQuery.size:{}', task2.size());
> ##
>
> Any idea how to get the "initiatorName" in reportQuery differently
> than from task.
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> http://lists.evolveum.com/mailman/listinfo/midpoint


More information about the midPoint mailing list