Skip to content

Commit

Permalink
fixing MID-8288 and MID-8187
Browse files Browse the repository at this point in the history
  • Loading branch information
katkav committed Oct 10, 2022
1 parent 7fa915b commit 4707eaf
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ public CompiledObjectCollectionView getObjectCollectionView() {
return super.getObjectCollectionView();
}

protected ModelExecuteOptions createModelExecuteOptions() {
return createModelOptions();
}

};
shadowListPanel.setOutputMarkupId(true);
shadowListPanel.add(new VisibleEnableBehaviour() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import java.util.*;

import com.evolveum.midpoint.model.api.ModelExecuteOptions;

import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.wicket.ajax.AjaxRequestTarget;
Expand Down Expand Up @@ -330,7 +332,7 @@ public void populateItem(Item<ICellPopulator<SelectableBean<ShadowType>>> cellIt

private void shadowDetailsPerformed(AjaxRequestTarget target, String accountName, String accountOid) {
if (StringUtils.isEmpty(accountOid)) {
error(getPageBase().getString("pageContentAccounts.message.cantShowAccountDetails", accountName,
error(getString("pageContentAccounts.message.cantShowAccountDetails", accountName,
accountOid));
target.add(getPageBase().getFeedbackPanel());
return;
Expand Down Expand Up @@ -365,10 +367,10 @@ private <F extends FocusType> F loadShadowOwner(String shadowOid) {
return (F) prismOwner.asObjectable();
}
} catch (ObjectNotFoundException exception) {
// owner was not found, it's possible and it's ok on unlinked
// owner was not found, it's possible, and it's ok on unlinked
// accounts
} catch (Exception ex) {
result.recordFatalError(getPageBase().getString("PageAccounts.message.ownerNotFound", shadowOid), ex);
result.recordFatalError(getString("PageAccounts.message.ownerNotFound", shadowOid), ex);
LoggingUtils.logUnexpectedException(LOGGER,
"Could not load owner of account with oid: " + shadowOid, ex);
} finally {
Expand Down Expand Up @@ -413,7 +415,7 @@ protected void importResourceObject(ShadowType selected, AjaxRequestTarget targe
try {
getPageBase().getModelService().importFromResource(shadow.getOid(), task, result);
} catch (Exception e) {
result.recordPartialError(getPageBase().createStringResource("ResourceContentPanel.message.importResourceObject.partialError", shadow).getString(), e);
result.recordPartialError(createStringResource("ResourceContentPanel.message.importResourceObject.partialError", shadow).getString(), e);
LOGGER.error("Could not import account {} ", shadow, e);
}
}
Expand Down Expand Up @@ -453,7 +455,7 @@ protected void updateResourceObjectStatusPerformed(IModel<SelectableBean<ShadowT
| ExpressionEvaluationException | CommunicationException | ConfigurationException
| PolicyViolationException | SecurityViolationException e) {
result.recordPartialError(
getPageBase().createStringResource(
createStringResource(
"ResourceContentPanel.message.updateResourceObjectStatusPerformed.partialError", status, shadow)
.getString(),
e);
Expand Down Expand Up @@ -481,15 +483,13 @@ protected void deleteResourceObjectPerformed(IModel<SelectableBean<ShadowType>>
return;
}

ConfirmationPanel dialog = new DeleteConfirmationPanel(((PageBase) getPage()).getMainPopupBodyId(),
createDeleteConfirmString(selectedShadows
)) {
ConfirmationPanel dialog = new DeleteConfirmationPanel(((PageBase) getPage()).getMainPopupBodyId(), createDeleteConfirmString(selectedShadows)) {
@Override
public void yesPerformed(AjaxRequestTarget target) {
deleteAccountConfirmedPerformed(target, result, selectedShadows);
}
};
((PageBase) getPage()).showMainPopup(dialog, target);
getPageBase().showMainPopup(dialog, target);

}

Expand All @@ -501,8 +501,9 @@ private void deleteAccountConfirmedPerformed(AjaxRequestTarget target, Operation
try {
ObjectDelta<ShadowType> deleteDelta = PrismContext.get().deltaFactory().object().createDeleteDelta(ShadowType.class,
shadow.getValue().getOid());

getPageBase().getModelService().executeChanges(
MiscUtil.createCollection(deleteDelta), null, task, result);
MiscUtil.createCollection(deleteDelta), createModelExecuteOptions(), task, result);
} catch (Throwable e) {
result.recordPartialError("Could not delete " + shadow + ", reason: " + e.getMessage(), e);
LOGGER.error("Could not delete {}, using option {}", shadow, null, e);
Expand All @@ -527,9 +528,9 @@ private IModel<String> createDeleteConfirmString(List<SelectableBean<ShadowType>
if (selectedShadow.size() == 1) {
ShadowType first = selectedShadow.get(0).getValue();
String name = WebComponentUtil.getName(first);
return getPageBase().createStringResource("pageContentAccounts.message.deleteConfirmationSingle" + deleteIndication, name).getString();
return createStringResource("pageContentAccounts.message.deleteConfirmationSingle" + deleteIndication, name).getString();
}
return getPageBase().createStringResource("pageContentAccounts.message.deleteConfirmation" + deleteIndication, selectedShadow.size())
return createStringResource("pageContentAccounts.message.deleteConfirmation" + deleteIndication, selectedShadow.size())
.getString();
};
}
Expand Down Expand Up @@ -627,4 +628,8 @@ private PrismObjectDefinition<FocusType> getFocusDefinition() {
.findObjectDefinitionByCompileTimeClass(FocusType.class);
}

protected ModelExecuteOptions createModelExecuteOptions() {
return null;
}

}

0 comments on commit 4707eaf

Please sign in to comment.