Skip to content

Commit

Permalink
error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Oct 30, 2017
1 parent 384e3b4 commit d61396a
Showing 1 changed file with 14 additions and 2 deletions.
Expand Up @@ -16,6 +16,7 @@

package com.evolveum.midpoint.web.page.admin.workflow.dto;

import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.model.api.ModelAuthorizationAction;
import com.evolveum.midpoint.model.api.ModelInteractionService;
import com.evolveum.midpoint.prism.PrismObject;
Expand All @@ -35,13 +36,15 @@
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.component.data.BaseSortableDataProvider;
import com.evolveum.midpoint.web.page.admin.workflow.WorkItemsPageType;
import com.evolveum.midpoint.web.page.error.PageError;
import com.evolveum.midpoint.web.security.SecurityUtils;
import com.evolveum.midpoint.wf.util.QueryUtils;
import com.evolveum.midpoint.xml.ns._public.common.common_3.OtherPrivilegesLimitationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.WfContextType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.WorkItemType;
import org.apache.wicket.Component;
import org.apache.wicket.RestartResponseException;
import org.apache.wicket.model.IModel;

import java.util.Collection;
Expand Down Expand Up @@ -181,9 +184,18 @@ public Iterator<? extends WorkItemDto> internalIterator(long first, long count)
result.computeStatus();
}

if (!WebComponentUtil.isSuccessOrHandledError(result)) {
handleError(result);
}

return getAvailableData().iterator();
}

private void handleError(OperationResult result) {
getPage().showResult(result);
throw new RestartResponseException(PageError.class);
}

private ObjectQuery createQuery(long first, long count, OperationResult result) throws SchemaException {
ObjectQuery query = createQuery(result);
query.setPaging(ObjectPaging.createPaging(safeLongToInteger(first), safeLongToInteger(count), F_CREATE_TIMESTAMP, DESCENDING));
Expand Down Expand Up @@ -220,8 +232,8 @@ protected int internalSize() {
result.computeStatus();
}

if (!result.isSuccess()) {
getPage().showResult(result);
if (!WebComponentUtil.isSuccessOrHandledError(result)) {
handleError(result);
}

return count;
Expand Down

0 comments on commit d61396a

Please sign in to comment.