use of com.evolveum.prism.xml.ns._public.types_3.ObjectType in project midpoint by Evolveum.
the class PageAdminObjectDetails method saveOrPreviewPerformed.
public void saveOrPreviewPerformed(AjaxRequestTarget target, OperationResult result, boolean previewOnly) {
boolean isAnythingChanged = processDeputyAssignments();
ObjectWrapper<O> objectWrapper = getObjectWrapper();
LOGGER.debug("Saving object {}", objectWrapper);
// todo: improve, delta variable is quickfix for MID-1006
// redirecting to user list page everytime user is created in repository
// during user add in gui,
// and we're not taking care about account/assignment create errors
// (error message is still displayed)
delta = null;
Task task = createSimpleTask(OPERATION_SEND_TO_SUBMIT);
ModelExecuteOptions options = getExecuteChangesOptions();
LOGGER.debug("Using execute options {}.", new Object[] { options });
try {
reviveModels();
delta = objectWrapper.getObjectDelta();
if (objectWrapper.getOldDelta() != null) {
delta = ObjectDelta.summarize(objectWrapper.getOldDelta(), delta);
}
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("User delta computed from form:\n{}", new Object[] { delta.debugDump(3) });
}
} catch (Exception ex) {
result.recordFatalError(getString("pageUser.message.cantCreateUser"), ex);
LoggingUtils.logUnexpectedException(LOGGER, "Create user failed", ex);
showResult(result);
return;
}
switch(objectWrapper.getStatus()) {
case ADDING:
try {
PrismObject<O> objectToAdd = delta.getObjectToAdd();
WebComponentUtil.encryptCredentials(objectToAdd, true, getMidpointApplication());
prepareObjectForAdd(objectToAdd);
getPrismContext().adopt(objectToAdd, getCompileTimeClass());
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Delta before add user:\n{}", new Object[] { delta.debugDump(3) });
}
if (!delta.isEmpty()) {
delta.revive(getPrismContext());
final Collection<ObjectDelta<? extends ObjectType>> deltas = WebComponentUtil.createDeltaCollection(delta);
final Collection<SimpleValidationError> validationErrors = performCustomValidation(objectToAdd, deltas);
if (checkValidationErrors(target, validationErrors)) {
return;
}
progressReporter.executeChanges(deltas, previewOnly, options, task, result, target);
} else {
result.recordSuccess();
}
} catch (Exception ex) {
result.recordFatalError(getString("pageFocus.message.cantCreateFocus"), ex);
LoggingUtils.logUnexpectedException(LOGGER, "Create user failed", ex);
showResult(result);
}
break;
case MODIFYING:
try {
WebComponentUtil.encryptCredentials(delta, true, getMidpointApplication());
prepareObjectDeltaForModify(delta);
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Delta before modify user:\n{}", new Object[] { delta.debugDump(3) });
}
Collection<ObjectDelta<? extends ObjectType>> deltas = new ArrayList<>();
if (!delta.isEmpty()) {
delta.revive(getPrismContext());
deltas.add(delta);
}
List<ObjectDelta<? extends ObjectType>> additionalDeltas = getAdditionalModifyDeltas(result);
if (additionalDeltas != null) {
for (ObjectDelta additionalDelta : additionalDeltas) {
if (!additionalDelta.isEmpty()) {
additionalDelta.revive(getPrismContext());
deltas.add(additionalDelta);
}
}
}
if (delta.isEmpty() && ModelExecuteOptions.isReconcile(options)) {
ObjectDelta emptyDelta = ObjectDelta.createEmptyModifyDelta(getCompileTimeClass(), objectWrapper.getObject().getOid(), getPrismContext());
deltas.add(emptyDelta);
Collection<SimpleValidationError> validationErrors = performCustomValidation(null, deltas);
if (checkValidationErrors(target, validationErrors)) {
return;
}
progressReporter.executeChanges(deltas, previewOnly, options, task, result, target);
} else if (!deltas.isEmpty()) {
Collection<SimpleValidationError> validationErrors = performCustomValidation(null, deltas);
if (checkValidationErrors(target, validationErrors)) {
return;
}
progressReporter.executeChanges(deltas, previewOnly, options, task, result, target);
} else {
// from previous attempts (useful only if we would call finishProcessing at the end, but that's not the case now)
progressReporter.clearProgressPanel();
if (!previewOnly) {
if (!isAnythingChanged) {
result.recordWarning(getString("PageAdminObjectDetails.noChangesSave"));
showResult(result);
}
redirectBack();
} else {
warn(getString("PageAdminObjectDetails.noChangesPreview"));
target.add(getFeedbackPanel());
}
}
} catch (Exception ex) {
if (!executeForceDelete(objectWrapper, task, options, result)) {
result.recordFatalError(getString("pageUser.message.cantUpdateUser"), ex);
LoggingUtils.logUnexpectedException(LOGGER, getString("pageUser.message.cantUpdateUser"), ex);
} else {
result.recomputeStatus();
}
showResult(result);
}
break;
// support for add/delete containers (e.g. delete credentials)
default:
error(getString("pageAdminFocus.message.unsupportedState", objectWrapper.getStatus()));
}
// result.recomputeStatus();
//
// if (!result.isInProgress()) {
// LOGGER.trace("Result NOT in progress, calling finishProcessing");
// finishProcessing(target, result, false);
// }
LOGGER.trace("returning from saveOrPreviewPerformed");
}
use of com.evolveum.prism.xml.ns._public.types_3.ObjectType in project midpoint by Evolveum.
the class ExpressionVariableEditorDialog method createObjectReferenceListDeprecated.
private List<ObjectReferenceType> createObjectReferenceListDeprecated() {
objectMap.clear();
OperationResult result = new OperationResult(OPERATION_LOAD_REPOSITORY_OBJECTS);
Task task = getPageBase().createSimpleTask(OPERATION_LOAD_REPOSITORY_OBJECTS);
List<PrismObject<ObjectType>> objects = null;
List<ObjectReferenceType> references = new ArrayList<>();
try {
objects = getPageBase().getModelService().searchObjects(ObjectType.class, new ObjectQuery(), null, task, result);
result.recomputeStatus();
} catch (CommonException | RuntimeException e) {
result.recordFatalError("Couldn't load objects from repository.", e);
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't load objects from repository", e);
}
if (objects != null) {
ObjectReferenceType ref;
for (PrismObject<ObjectType> obj : objects) {
objectMap.put(obj.getOid(), WebComponentUtil.getName(obj));
ref = new ObjectReferenceType();
ref.setOid(obj.getOid());
references.add(ref);
}
}
return references;
}
use of com.evolveum.prism.xml.ns._public.types_3.ObjectType in project midpoint by Evolveum.
the class WorkItemPanel method initLayout.
protected void initLayout(Form mainForm, PageBase pageBase) {
WebMarkupContainer additionalInfoColumn = new WebMarkupContainer(ID_ADDITIONAL_INFO_COLUMN);
WebMarkupContainer historyContainer = new WebMarkupContainer(ID_HISTORY_CONTAINER);
historyContainer.add(new ItemApprovalHistoryPanel(ID_HISTORY, new PropertyModel<>(getModel(), WorkItemDto.F_WORKFLOW_CONTEXT), UserProfileStorage.TableId.PAGE_WORK_ITEM_HISTORY_PANEL, (int) pageBase.getItemsPerPage(UserProfileStorage.TableId.PAGE_WORK_ITEM_HISTORY_PANEL)));
final VisibleEnableBehaviour historyContainerVisible = new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return getModelObject().hasHistory();
}
};
historyContainer.add(historyContainerVisible);
historyContainer.add(WebComponentUtil.createHelp(ID_HISTORY_HELP));
additionalInfoColumn.add(historyContainer);
WebMarkupContainer relatedWorkItemsContainer = new WebMarkupContainer(ID_RELATED_WORK_ITEMS_CONTAINER);
final IModel<List<WorkItemDto>> relatedWorkItemsModel = new PropertyModel<>(getModel(), WorkItemDto.F_OTHER_WORK_ITEMS);
final ISortableDataProvider<WorkItemDto, String> relatedWorkItemsProvider = new ListDataProvider<>(this, relatedWorkItemsModel);
relatedWorkItemsContainer.add(new WorkItemsPanel(ID_RELATED_WORK_ITEMS, relatedWorkItemsProvider, null, 10, WorkItemsPanel.View.ITEMS_FOR_PROCESS));
final VisibleEnableBehaviour relatedWorkItemsContainerVisible = new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return !relatedWorkItemsModel.getObject().isEmpty();
}
};
relatedWorkItemsContainer.add(relatedWorkItemsContainerVisible);
relatedWorkItemsContainer.add(WebComponentUtil.createHelp(ID_RELATED_WORK_ITEMS_HELP));
additionalInfoColumn.add(relatedWorkItemsContainer);
final WebMarkupContainer relatedWorkflowRequestsContainer = new WebMarkupContainer(ID_RELATED_REQUESTS_CONTAINER);
final IModel<List<ProcessInstanceDto>> relatedWorkflowRequestsModel = new PropertyModel<>(getModel(), WorkItemDto.F_RELATED_WORKFLOW_REQUESTS);
final ISortableDataProvider<ProcessInstanceDto, String> relatedWorkflowRequestsProvider = new ListDataProvider<>(this, relatedWorkflowRequestsModel);
relatedWorkflowRequestsContainer.add(new ProcessInstancesPanel(ID_RELATED_REQUESTS, relatedWorkflowRequestsProvider, null, 10, ProcessInstancesPanel.View.TASKS_FOR_PROCESS, new PropertyModel<>(getModel(), WorkItemDto.F_PROCESS_INSTANCE_ID)));
final VisibleEnableBehaviour relatedWorkflowRequestsContainerVisible = new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return !relatedWorkflowRequestsModel.getObject().isEmpty();
}
};
relatedWorkflowRequestsContainer.add(relatedWorkflowRequestsContainerVisible);
relatedWorkflowRequestsContainer.add(WebComponentUtil.createHelp(ID_RELATED_REQUESTS_HELP));
additionalInfoColumn.add(relatedWorkflowRequestsContainer);
final VisibleEnableBehaviour additionalInfoColumnVisible = new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return historyContainerVisible.isVisible() || relatedWorkItemsContainerVisible.isVisible() || relatedWorkflowRequestsContainerVisible.isVisible();
}
};
additionalInfoColumn.add(additionalInfoColumnVisible);
add(additionalInfoColumn);
WebMarkupContainer primaryInfoColumn = new WebMarkupContainer(ID_PRIMARY_INFO_COLUMN);
// primaryInfoColumn.add(new Label(ID_REQUESTED_BY, new PropertyModel(getModel(), WorkItemDto.F_REQUESTER_NAME)));
// primaryInfoColumn.add(new Label(ID_REQUESTED_BY_FULL_NAME, new PropertyModel(getModel(), WorkItemDto.F_REQUESTER_FULL_NAME)));
// primaryInfoColumn.add(new Label(ID_REQUESTED_ON, new PropertyModel(getModel(), WorkItemDto.F_STARTED_FORMATTED_FULL)));
primaryInfoColumn.add(new Label(ID_WORK_ITEM_CREATED_ON, new PropertyModel(getModel(), WorkItemDto.F_CREATED_FORMATTED_FULL)));
primaryInfoColumn.add(new Label(ID_WORK_ITEM_DEADLINE, new PropertyModel(getModel(), WorkItemDto.F_DEADLINE_FORMATTED_FULL)));
primaryInfoColumn.add(new Label(ID_ORIGINALLY_ALLOCATED_TO, new PropertyModel(getModel(), WorkItemDto.F_ORIGINAL_ASSIGNEE_FULL)));
primaryInfoColumn.add(new Label(ID_CURRENTLY_ALLOCATED_TO, new PropertyModel(getModel(), WorkItemDto.F_CURRENT_ASSIGNEES_FULL)));
primaryInfoColumn.add(new Label(ID_CANDIDATES, new PropertyModel(getModel(), WorkItemDto.F_CANDIDATES)));
WebMarkupContainer stageInfoContainer = new WebMarkupContainer(ID_STAGE_INFO_CONTAINER);
primaryInfoColumn.add(stageInfoContainer);
stageInfoContainer.add(new Label(ID_STAGE_INFO, new PropertyModel<String>(getModel(), WorkItemDto.F_STAGE_INFO)));
stageInfoContainer.add(new VisibleBehaviour(() -> getModelObject().getStageInfo() != null));
WebMarkupContainer escalationLevelInfoContainer = new WebMarkupContainer(ID_ESCALATION_LEVEL_INFO_CONTAINER);
primaryInfoColumn.add(escalationLevelInfoContainer);
escalationLevelInfoContainer.add(new Label(ID_ESCALATION_LEVEL_INFO, new PropertyModel<String>(getModel(), WorkItemDto.F_ESCALATION_LEVEL_INFO)));
escalationLevelInfoContainer.add(new VisibleBehaviour(() -> getModelObject().getEscalationLevelInfo() != null));
WebMarkupContainer requesterCommentContainer = new WebMarkupContainer(ID_REQUESTER_COMMENT_CONTAINER);
requesterCommentContainer.setOutputMarkupId(true);
primaryInfoColumn.add(requesterCommentContainer);
requesterCommentContainer.add(new Label(ID_REQUESTER_COMMENT_MESSAGE, new PropertyModel<String>(getModel(), WorkItemDto.F_REQUESTER_COMMENT)));
//primaryInfoColumn.add(new ScenePanel(ID_DELTAS_TO_BE_APPROVED, new PropertyModel<SceneDto>(getModel(), WorkItemDto.F_DELTAS)));
primaryInfoColumn.add(new TaskChangesPanel(ID_DELTAS_TO_BE_APPROVED, new PropertyModel<>(getModel(), WorkItemDto.F_CHANGES)));
primaryInfoColumn.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return additionalInfoColumnVisible.isVisible() ? "col-md-5" : "col-md-12";
}
}));
add(primaryInfoColumn);
add(new AjaxFallbackLink(ID_SHOW_REQUEST) {
public void onClick(AjaxRequestTarget target) {
String oid = WorkItemPanel.this.getModelObject().getTaskOid();
if (oid != null) {
PageParameters parameters = new PageParameters();
parameters.add(OnePageParameterEncoder.PARAMETER, oid);
getPageBase().navigateToNext(PageTaskEdit.class, parameters);
}
}
});
add(WebComponentUtil.createHelp(ID_SHOW_REQUEST_HELP));
WebMarkupContainer additionalInformation = new InformationListPanel(ID_ADDITIONAL_INFORMATION, new PropertyModel<>(getModel(), WorkItemDto.F_ADDITIONAL_INFORMATION));
add(additionalInformation);
WorkItemDto dto = getModelObject();
ApprovalStageDefinitionType level = WfContextUtil.getCurrentStageDefinition(dto.getWorkflowContext());
WebMarkupContainer additionalAttribues = new WebMarkupContainer(ID_ADDITIONAL_ATTRIBUTES);
add(additionalAttribues);
additionalAttribues.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
public boolean isVisible() {
return (level != null && level.getFormRef() != null && level.getFormRef().getOid() != null);
}
;
});
if (level != null && level.getFormRef() != null && level.getFormRef().getOid() != null) {
String formOid = level.getFormRef().getOid();
ObjectType focus = dto.getFocus(pageBase);
if (focus == null) {
// TODO FIXME (this should not occur anyway)
focus = new UserType(pageBase.getPrismContext());
}
Task task = pageBase.createSimpleTask(OPERATION_LOAD_CUSTOM_FORM);
DynamicFormPanel<?> customForm = new DynamicFormPanel<>(ID_CUSTOM_FORM, focus.asPrismObject(), formOid, mainForm, task, pageBase);
additionalAttribues.add(customForm);
} else {
additionalAttribues.add(new Label(ID_CUSTOM_FORM));
}
add(new TextArea<>(ID_APPROVER_COMMENT, new PropertyModel<String>(getModel(), WorkItemDto.F_APPROVER_COMMENT)));
}
use of com.evolveum.prism.xml.ns._public.types_3.ObjectType in project midpoint by Evolveum.
the class OrgUnitAddDeletePopup method initLayout.
public void initLayout(WebMarkupContainer content) {
List<IColumn<SelectableBean<ObjectType>, String>> columns = initColumns();
ObjectDataProvider provider = new ObjectDataProvider(getPageBase(), OrgType.class);
provider.setQuery(getDataProviderQuery());
TablePanel table = new TablePanel<SelectableBean<ObjectType>>(ID_TABLE, provider, columns);
table.setOutputMarkupId(true);
content.add(table);
AjaxButton cancelButton = new AjaxButton(ID_BUTTON_CANCEL, createStringResource("orgUnitAddDeletePopup.button.cancel")) {
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
cancelPerformed(ajaxRequestTarget);
}
};
content.add(cancelButton);
AjaxButton actionButton = new AjaxButton(ID_BUTTON_ACTION, createActionButtonStringResource()) {
@Override
public void onClick(AjaxRequestTarget target) {
actionPerformed(target);
}
};
actionButton.add(new AttributeAppender("class", getActionButtonClass()));
content.add(actionButton);
}
use of com.evolveum.prism.xml.ns._public.types_3.ObjectType in project midpoint by Evolveum.
the class DeleteTaskHandler method runInternal.
public <O extends ObjectType> TaskRunResult runInternal(Task task) {
LOGGER.trace("Delete task run starting ({})", task);
long startTimestamp = System.currentTimeMillis();
OperationResult opResult = new OperationResult("DeleteTask.run");
opResult.setStatus(OperationResultStatus.IN_PROGRESS);
TaskRunResult runResult = new TaskRunResult();
runResult.setOperationResult(opResult);
opResult.setSummarizeErrors(true);
opResult.setSummarizePartialErrors(true);
opResult.setSummarizeSuccesses(true);
QueryType queryType;
PrismProperty<QueryType> objectQueryPrismProperty = task.getExtensionProperty(SchemaConstants.MODEL_EXTENSION_OBJECT_QUERY);
if (objectQueryPrismProperty != null && objectQueryPrismProperty.getRealValue() != null) {
queryType = objectQueryPrismProperty.getRealValue();
} else {
// For "foolproofness" reasons we really require a query. Even if it is "ALL" query.
LOGGER.error("No query parameter in {}", task);
opResult.recordFatalError("No query parameter in " + task);
runResult.setRunResultStatus(TaskRunResultStatus.PERMANENT_ERROR);
return runResult;
}
Class<O> objectType;
QName objectTypeName;
PrismProperty<QName> objectTypePrismProperty = task.getExtensionProperty(SchemaConstants.MODEL_EXTENSION_OBJECT_TYPE);
if (objectTypePrismProperty != null && objectTypePrismProperty.getRealValue() != null) {
objectTypeName = objectTypePrismProperty.getRealValue();
objectType = (Class<O>) ObjectTypes.getObjectTypeFromTypeQName(objectTypeName).getClassDefinition();
} else {
LOGGER.error("No object type parameter in {}", task);
opResult.recordFatalError("No object type parameter in " + task);
runResult.setRunResultStatus(TaskRunResultStatus.PERMANENT_ERROR);
return runResult;
}
ObjectQuery query;
try {
query = QueryJaxbConvertor.createObjectQuery(objectType, queryType, prismContext);
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Using object query from the task: {}", query.debugDump());
}
} catch (SchemaException ex) {
LOGGER.error("Schema error while creating a search filter: {}", new Object[] { ex.getMessage(), ex });
opResult.recordFatalError("Schema error while creating a search filter: " + ex.getMessage(), ex);
runResult.setRunResultStatus(TaskRunResultStatus.PERMANENT_ERROR);
return runResult;
}
boolean optionRaw = true;
PrismProperty<Boolean> optionRawPrismProperty = task.getExtensionProperty(SchemaConstants.MODEL_EXTENSION_OPTION_RAW);
if (optionRawPrismProperty != null && optionRawPrismProperty.getRealValue() != null && !optionRawPrismProperty.getRealValue()) {
optionRaw = false;
}
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Deleting {}, raw={} using query:\n{}", new Object[] { objectType.getSimpleName(), optionRaw, query.debugDump() });
}
// TODO
boolean countObjectsOnStart = true;
long progress = 0;
Integer maxSize = 100;
ObjectPaging paging = ObjectPaging.createPaging(0, maxSize);
query.setPaging(paging);
query.setAllowPartialResults(true);
Collection<SelectorOptions<GetOperationOptions>> searchOptions = null;
ModelExecuteOptions execOptions = null;
if (optionRaw) {
searchOptions = SelectorOptions.createCollection(GetOperationOptions.createRaw());
execOptions = ModelExecuteOptions.createRaw();
}
try {
// counting objects can be within try-catch block, because the handling is similar to handling errors within searchIterative
Long expectedTotal = null;
if (countObjectsOnStart) {
Integer expectedTotalInt = modelService.countObjects(objectType, query, searchOptions, task, opResult);
LOGGER.trace("Expecting {} objects to be deleted", expectedTotal);
if (expectedTotalInt != null) {
// conversion would fail on null
expectedTotal = (long) expectedTotalInt;
}
}
runResult.setProgress(progress);
task.setProgress(progress);
if (expectedTotal != null) {
task.setExpectedTotal(expectedTotal);
}
try {
task.savePendingModifications(opResult);
} catch (ObjectAlreadyExistsException e) {
// other exceptions are handled in the outer try block
throw new IllegalStateException("Unexpected ObjectAlreadyExistsException when updating task progress/expectedTotal", e);
}
long progressLastUpdated = 0;
SearchResultList<PrismObject<O>> objects;
while (true) {
objects = modelService.searchObjects(objectType, query, searchOptions, task, opResult);
if (objects.isEmpty()) {
break;
}
int skipped = 0;
for (PrismObject<O> object : objects) {
if (!optionRaw && ShadowType.class.isAssignableFrom(objectType) && Boolean.TRUE == ((ShadowType) (object.asObjectable())).isProtectedObject()) {
LOGGER.debug("Skipping delete of protected object {}", object);
skipped++;
continue;
}
ObjectDelta<?> delta = ObjectDelta.createDeleteDelta(objectType, object.getOid(), prismContext);
String objectName = PolyString.getOrig(object.getName());
String objectDisplayName = StatisticsUtil.getDisplayName(object);
String objectOid = object.getOid();
task.recordIterativeOperationStart(objectName, objectDisplayName, objectTypeName, objectOid);
long objectDeletionStarted = System.currentTimeMillis();
try {
modelService.executeChanges(MiscSchemaUtil.createCollection(delta), execOptions, task, opResult);
task.recordIterativeOperationEnd(objectName, objectDisplayName, objectTypeName, objectOid, objectDeletionStarted, null);
} catch (Throwable t) {
task.recordIterativeOperationEnd(objectName, objectDisplayName, objectTypeName, objectOid, objectDeletionStarted, t);
// TODO we don't want to continue processing if an error occurs?
throw t;
}
progress++;
task.setProgressTransient(progress);
if (System.currentTimeMillis() - progressLastUpdated > PROGRESS_UPDATE_INTERVAL) {
task.setProgress(progress);
updateState(task);
progressLastUpdated = System.currentTimeMillis();
}
}
opResult.summarize();
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Search returned {} objects, {} skipped, progress: {}, result:\n{}", new Object[] { objects.size(), skipped, progress, opResult.debugDump() });
}
if (objects.size() == skipped) {
break;
}
}
} catch (ObjectAlreadyExistsException | ObjectNotFoundException | SchemaException | ExpressionEvaluationException | ConfigurationException | PolicyViolationException | SecurityViolationException e) {
LOGGER.error("{}", new Object[] { e.getMessage(), e });
opResult.recordFatalError("Object not found " + e.getMessage(), e);
runResult.setRunResultStatus(TaskRunResultStatus.PERMANENT_ERROR);
runResult.setProgress(progress);
return runResult;
} catch (CommunicationException e) {
LOGGER.error("{}", new Object[] { e.getMessage(), e });
opResult.recordFatalError("Object not found " + e.getMessage(), e);
runResult.setRunResultStatus(TaskRunResultStatus.TEMPORARY_ERROR);
runResult.setProgress(progress);
return runResult;
}
runResult.setProgress(progress);
runResult.setRunResultStatus(TaskRunResultStatus.FINISHED);
opResult.summarize();
opResult.recordSuccess();
long wallTime = System.currentTimeMillis() - startTimestamp;
String finishMessage = "Finished delete (" + task + "). ";
String statistics = "Processed " + progress + " objects in " + wallTime / 1000 + " seconds.";
if (progress > 0) {
statistics += " Wall clock time average: " + ((float) wallTime / (float) progress) + " milliseconds";
}
opResult.createSubresult(DeleteTaskHandler.class.getName() + ".statistics").recordStatus(OperationResultStatus.SUCCESS, statistics);
LOGGER.info(finishMessage + statistics);
LOGGER.trace("Run finished (task {}, run result {})", new Object[] { task, runResult });
return runResult;
}
Aggregations