Search in sources :

Example 6 with ActivityState

use of com.evolveum.midpoint.repo.common.activity.run.state.ActivityState in project midpoint by Evolveum.

the class DistributedReportExportActivityHandler method createEmptyAggregatedDataObject.

private void createEmptyAggregatedDataObject(EmbeddedActivity<DistributedReportExportWorkDefinition, DistributedReportExportActivityHandler> activity, RunningTask runningTask, OperationResult result) throws CommonException {
    ActivityState activityState = ActivityState.getActivityStateUpwards(activity.getPath().allExceptLast(), runningTask, ReportExportWorkStateType.COMPLEX_TYPE, commonTaskBeans, result);
    if (activityState.getWorkStateReferenceRealValue(F_REPORT_DATA_REF) != null) {
        return;
    }
    ReportType report = objectResolver.resolve(activity.getWorkDefinition().getReportRef(), ReportType.class, null, "resolve report ref", runningTask, result);
    ReportDataType reportData = new ReportDataType(commonTaskBeans.prismContext).name(SaveReportFileSupport.getNameOfExportedReportData(report, getType(report)));
    String oid = commonTaskBeans.repositoryService.addObject(reportData.asPrismObject(), null, result);
    activityState.setWorkStateItemRealValues(F_REPORT_DATA_REF, createObjectRef(oid, ObjectTypes.REPORT_DATA));
    activityState.flushPendingTaskModifications(result);
    LOGGER.info("Created empty report data object {}", reportData);
}
Also used : ActivityState(com.evolveum.midpoint.repo.common.activity.run.state.ActivityState)

Aggregations

ActivityState (com.evolveum.midpoint.repo.common.activity.run.state.ActivityState)6 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)2 NotNull (org.jetbrains.annotations.NotNull)2 ActivityRunException (com.evolveum.midpoint.repo.common.activity.run.ActivityRunException)1 Task (com.evolveum.midpoint.task.api.Task)1 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)1 ArrayList (java.util.ArrayList)1