use of org.apache.syncope.client.console.wizards.any.UserTemplateWizardBuilder in project syncope by apache.
the class SAML2IdPsDirectoryPanel method getActions.
@Override
public ActionsPanel<SAML2IdPTO> getActions(final IModel<SAML2IdPTO> model) {
final ActionsPanel<SAML2IdPTO> panel = super.getActions(model);
panel.add(new ActionLink<SAML2IdPTO>() {
private static final long serialVersionUID = -7978723352517770645L;
@Override
public void onClick(final AjaxRequestTarget target, final SAML2IdPTO ignore) {
SAML2IdPTO object = restClient.read(model.getObject().getKey());
metadataModal.header(Model.of(object.getName() + " - Metadata"));
metadataModal.setContent(new XMLEditorPanel(metadataModal, Model.of(new String(Base64.decodeBase64(object.getMetadata()))), true, pageRef));
metadataModal.show(true);
target.add(metadataModal);
}
}, ActionLink.ActionType.HTML, SAML2SPEntitlement.IDP_READ);
panel.add(new ActionLink<SAML2IdPTO>() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target, final SAML2IdPTO ignore) {
SAML2IdPTO object = restClient.read(model.getObject().getKey());
send(SAML2IdPsDirectoryPanel.this, Broadcast.EXACT, new AjaxWizard.EditItemActionEvent<>(object, target));
}
}, ActionLink.ActionType.EDIT, SAML2SPEntitlement.IDP_UPDATE);
panel.add(new ActionLink<SAML2IdPTO>() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target, final SAML2IdPTO ignore) {
final SAML2IdPTO object = restClient.read(model.getObject().getKey());
UserTemplateWizardBuilder builder = new UserTemplateWizardBuilder(object.getUserTemplate(), new AnyTypeRestClient().read(AnyTypeKind.USER.name()).getClasses(), new UserFormLayoutInfo(), pageRef) {
private static final long serialVersionUID = -7978723352517770634L;
@Override
protected Serializable onApplyInternal(final AnyWrapper<UserTO> modelObject) {
object.setUserTemplate(modelObject.getInnerObject());
restClient.update(object);
return modelObject;
}
};
templateModal.header(Model.of(StringUtils.capitalize(new StringResourceModel("template.title", SAML2IdPsDirectoryPanel.this).getString())));
templateModal.setContent(builder.build(BaseModal.CONTENT_ID));
templateModal.show(true);
target.add(templateModal);
}
}, ActionLink.ActionType.TEMPLATE, SAML2SPEntitlement.IDP_UPDATE);
panel.add(new ActionLink<SAML2IdPTO>() {
private static final long serialVersionUID = -5467832321897812767L;
@Override
public void onClick(final AjaxRequestTarget target, final SAML2IdPTO ignore) {
try {
restClient.delete(model.getObject().getKey());
SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
target.add(container);
} catch (SyncopeClientException e) {
LOG.error("While deleting object {}", model.getObject().getKey(), e);
SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) ? e.getClass().getName() : e.getMessage());
}
((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
}
}, ActionLink.ActionType.DELETE, SAML2SPEntitlement.IDP_DELETE, true);
return panel;
}
Aggregations