use of org.apache.syncope.client.console.pages.BasePage in project syncope by apache.
the class ResourceHistoryConfDirectoryPanel method getActions.
@Override
public ActionsPanel<ResourceHistoryConfTO> getActions(final IModel<ResourceHistoryConfTO> model) {
final ActionsPanel<ResourceHistoryConfTO> panel = super.getActions(model);
final ResourceHistoryConfTO resHistoryConfTO = model.getObject();
// -- view
panel.add(new ActionLink<ResourceHistoryConfTO>() {
private static final long serialVersionUID = -3369924994540304232L;
@Override
public void onClick(final AjaxRequestTarget target, final ResourceHistoryConfTO modelObject) {
ResourceHistoryConfDirectoryPanel.this.getTogglePanel().close(target);
viewConfiguration(modelObject, target);
target.add(modal);
}
}, ActionLink.ActionType.VIEW, StandardEntitlement.RESOURCE_HISTORY_LIST);
// -- restore
panel.add(new ActionLink<ResourceHistoryConfTO>() {
private static final long serialVersionUID = -3369924994540304232L;
@Override
public void onClick(final AjaxRequestTarget target, final ResourceHistoryConfTO modelObject) {
try {
restClient.restore(modelObject.getKey());
ResourceHistoryConfDirectoryPanel.this.getTogglePanel().close(target);
target.add(container);
} catch (SyncopeClientException e) {
LOG.error("While restoring {}", resHistoryConfTO.getKey(), e);
SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) ? e.getClass().getName() : e.getMessage());
}
((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
}
}, ActionLink.ActionType.RESTORE, StandardEntitlement.RESOURCE_HISTORY_RESTORE);
// -- delete
panel.add(new ActionLink<ResourceHistoryConfTO>() {
private static final long serialVersionUID = -3369924994540304232L;
@Override
public void onClick(final AjaxRequestTarget target, final ResourceHistoryConfTO modelObject) {
try {
restClient.delete(modelObject.getKey());
SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
target.add(container);
ResourceHistoryConfDirectoryPanel.this.getTogglePanel().close(target);
} catch (SyncopeClientException e) {
LOG.error("While deleting {}", resHistoryConfTO.getKey(), e);
SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) ? e.getClass().getName() : e.getMessage());
}
((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
}
}, ActionLink.ActionType.DELETE, StandardEntitlement.RESOURCE_HISTORY_DELETE, true);
return panel;
}
use of org.apache.syncope.client.console.pages.BasePage in project syncope by apache.
the class WorkflowDirectoryPanel method getActions.
@Override
public ActionsPanel<WorkflowDefinitionTO> getActions(final IModel<WorkflowDefinitionTO> model) {
final ActionsPanel<WorkflowDefinitionTO> panel = super.getActions(model);
panel.add(new ActionLink<WorkflowDefinitionTO>() {
private static final long serialVersionUID = -184018732772021627L;
@Override
public void onClick(final AjaxRequestTarget target, final WorkflowDefinitionTO ignore) {
final IModel<String> wfDefinition = new Model<>();
try {
wfDefinition.setObject(IOUtils.toString(restClient.getDefinition(MediaType.APPLICATION_XML_TYPE, model.getObject().getKey())));
} catch (IOException e) {
LOG.error("Could not get workflow definition", e);
}
utility.header(Model.of(model.getObject().getKey()));
utility.setContent(new XMLEditorPanel(utility, wfDefinition, false, pageRef) {
private static final long serialVersionUID = -7688359318035249200L;
@Override
public void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
if (StringUtils.isNotBlank(wfDefinition.getObject())) {
try {
restClient.setDefinition(MediaType.APPLICATION_XML_TYPE, model.getObject().getKey(), wfDefinition.getObject());
SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
target.add(container);
utility.show(false);
utility.close(target);
} catch (SyncopeClientException e) {
SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) ? e.getClass().getName() : e.getMessage());
}
((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
}
}
});
utility.show(target);
target.add(utility);
}
}, ActionLink.ActionType.EDIT, StandardEntitlement.WORKFLOW_DEF_SET);
panel.add(new ActionLink<WorkflowDefinitionTO>() {
private static final long serialVersionUID = 3109256773218160485L;
@Override
public void onClick(final AjaxRequestTarget target, final WorkflowDefinitionTO ignore) {
modal.header(Model.of(model.getObject().getKey()));
modal.setContent(new ImageModalPanel<>(modal, restClient.getDiagram(model.getObject().getKey()), pageRef));
modal.show(target);
target.add(modal);
}
}, ActionLink.ActionType.VIEW, StandardEntitlement.WORKFLOW_DEF_GET);
panel.add(new ActionLink<WorkflowDefinitionTO>() {
private static final long serialVersionUID = -184018732772021627L;
@Override
public Class<? extends Page> getPageClass() {
return ModelerPopupPage.class;
}
@Override
public PageParameters getPageParameters() {
PageParameters parameters = new PageParameters();
if (modelerCtx != null) {
parameters.add(Constants.MODELER_CONTEXT, modelerCtx);
}
parameters.add(Constants.MODEL_ID_PARAM, model.getObject().getModelId());
return parameters;
}
@Override
protected boolean statusCondition(final WorkflowDefinitionTO modelObject) {
return modelerCtx != null;
}
@Override
public void onClick(final AjaxRequestTarget target, final WorkflowDefinitionTO ignore) {
// do nothing
}
}, ActionLink.ActionType.WORKFLOW_MODELER, StandardEntitlement.WORKFLOW_DEF_SET);
panel.add(new ActionLink<WorkflowDefinitionTO>() {
private static final long serialVersionUID = -7978723352517770644L;
@Override
protected boolean statusCondition(final WorkflowDefinitionTO modelObject) {
return !modelObject.isMain();
}
@Override
public void onClick(final AjaxRequestTarget target, final WorkflowDefinitionTO ignore) {
try {
restClient.deleteDefinition(model.getObject().getKey());
SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
target.add(container);
} catch (SyncopeClientException e) {
LOG.error("While deleting workflow definition {}", model.getObject().getName(), e);
SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) ? e.getClass().getName() : e.getMessage());
}
((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
}
}, ActionLink.ActionType.DELETE, StandardEntitlement.WORKFLOW_DEF_DELETE, true);
return panel;
}
use of org.apache.syncope.client.console.pages.BasePage in project syncope by apache.
the class GroupDirectoryPanel method getActions.
@Override
public ActionsPanel<GroupTO> getActions(final IModel<GroupTO> model) {
final ActionsPanel<GroupTO> panel = super.getActions(model);
panel.add(new ActionLink<GroupTO>() {
private static final long serialVersionUID = -7978723352517770644L;
@Override
public void onClick(final AjaxRequestTarget target, final GroupTO ignore) {
send(GroupDirectoryPanel.this, Broadcast.EXACT, new AjaxWizard.EditItemActionEvent<>(new GroupWrapper(restClient.read(model.getObject().getKey())), target));
}
}, ActionType.EDIT, StringUtils.join(new String[] { StandardEntitlement.GROUP_READ, StandardEntitlement.GROUP_UPDATE }, ",")).setRealm(realm);
panel.add(new ActionLink<GroupTO>() {
private static final long serialVersionUID = 6242834621660352855L;
@Override
public void onClick(final AjaxRequestTarget target, final GroupTO ignore) {
GroupTO clone = SerializationUtils.clone(model.getObject());
clone.setKey(null);
send(GroupDirectoryPanel.this, Broadcast.EXACT, new AjaxWizard.NewItemActionEvent<>(new GroupWrapper(clone), target));
}
@Override
protected boolean statusCondition(final GroupTO modelObject) {
return realm.startsWith(SyncopeConstants.ROOT_REALM);
}
}, ActionType.CLONE, StandardEntitlement.GROUP_CREATE).setRealm(realm);
panel.add(new ActionLink<GroupTO>() {
private static final long serialVersionUID = 6242834621660352855L;
@Override
public void onClick(final AjaxRequestTarget target, final GroupTO ignore) {
target.add(typeExtensionsModal.setContent(new TypeExtensionDirectoryPanel(typeExtensionsModal, model.getObject(), pageRef)));
typeExtensionsModal.header(new StringResourceModel("typeExtensions", model));
typeExtensionsModal.show(true);
}
}, ActionType.TYPE_EXTENSIONS, StandardEntitlement.GROUP_UPDATE).setRealm(realm);
panel.add(new ActionLink<GroupTO>() {
private static final long serialVersionUID = -7978723352517770645L;
@Override
public void onClick(final AjaxRequestTarget target, final GroupTO ignore) {
templates.setTargetObject(model.getObject());
templates.toggle(target, true);
}
@Override
public boolean isIndicatorEnabled() {
return false;
}
}, ActionType.MEMBERS, StandardEntitlement.GROUP_UPDATE).setRealm(realm);
panel.add(new ActionLink<GroupTO>() {
private static final long serialVersionUID = -7978723352517770644L;
@Override
public void onClick(final AjaxRequestTarget target, final GroupTO ignore) {
try {
restClient.bulkMembersAction(model.getObject().getKey(), BulkMembersActionType.PROVISION);
SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
target.add(container);
} catch (SyncopeClientException e) {
LOG.error("While provisioning members of group {}", model.getObject().getKey(), e);
SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) ? e.getClass().getName() : e.getMessage());
}
((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
}
}, ActionType.PROVISION_MEMBERS, String.format("%s,%s", StandardEntitlement.TASK_CREATE, StandardEntitlement.TASK_EXECUTE));
panel.add(new ActionLink<GroupTO>() {
private static final long serialVersionUID = -7978723352517770644L;
@Override
public void onClick(final AjaxRequestTarget target, final GroupTO ignore) {
try {
restClient.bulkMembersAction(model.getObject().getKey(), BulkMembersActionType.DEPROVISION);
SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
target.add(container);
} catch (SyncopeClientException e) {
LOG.error("While provisioning members of group {}", model.getObject().getKey(), e);
SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) ? e.getClass().getName() : e.getMessage());
}
((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
}
}, ActionType.DEPROVISION_MEMBERS, String.format("%s,%s", StandardEntitlement.TASK_CREATE, StandardEntitlement.TASK_EXECUTE));
panel.add(new ActionLink<GroupTO>() {
private static final long serialVersionUID = -7978723352517770645L;
@Override
public void onClick(final AjaxRequestTarget target, final GroupTO ignore) {
IModel<AnyWrapper<GroupTO>> formModel = new CompoundPropertyModel<>(new AnyWrapper<>(model.getObject()));
altDefaultModal.setFormModel(formModel);
target.add(altDefaultModal.setContent(new AnyStatusModal<>(altDefaultModal, pageRef, formModel.getObject().getInnerObject(), "resource", false)));
altDefaultModal.header(new Model<>(getString("any.edit", new Model<>(new AnyWrapper<>(model.getObject())))));
altDefaultModal.show(true);
}
}, ActionType.MANAGE_RESOURCES, StandardEntitlement.GROUP_READ).setRealm(realm);
panel.add(new ActionLink<GroupTO>() {
private static final long serialVersionUID = -7978723352517770644L;
@Override
public void onClick(final AjaxRequestTarget target, final GroupTO ignore) {
target.add(utilityModal.setContent(new AnyPropagationTasks(utilityModal, AnyTypeKind.GROUP, model.getObject().getKey(), pageRef)));
utilityModal.header(new StringResourceModel("any.propagation.tasks", model));
utilityModal.show(true);
}
}, ActionType.PROPAGATION_TASKS, StandardEntitlement.TASK_LIST);
panel.add(new ActionLink<GroupTO>() {
private static final long serialVersionUID = -7978723352517770644L;
@Override
public void onClick(final AjaxRequestTarget target, final GroupTO ignore) {
target.add(utilityModal.setContent(new NotificationTasks(AnyTypeKind.GROUP, model.getObject().getKey(), pageRef)));
utilityModal.header(new StringResourceModel("any.notification.tasks", model));
utilityModal.show(true);
}
}, ActionType.NOTIFICATION_TASKS, StandardEntitlement.TASK_LIST);
panel.add(new ActionLink<GroupTO>() {
private static final long serialVersionUID = -7978723352517770644L;
@Override
public void onClick(final AjaxRequestTarget target, final GroupTO ignore) {
try {
restClient.delete(model.getObject().getETagValue(), 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);
}
@Override
protected boolean statusCondition(final GroupTO modelObject) {
return realm.startsWith(SyncopeConstants.ROOT_REALM);
}
}, ActionType.DELETE, StandardEntitlement.GROUP_DELETE, true).setRealm(realm);
return panel;
}
use of org.apache.syncope.client.console.pages.BasePage in project syncope by apache.
the class ConnInstanceHistoryConfDirectoryPanel method getActions.
@Override
public ActionsPanel<ConnInstanceHistoryConfTO> getActions(final IModel<ConnInstanceHistoryConfTO> model) {
final ActionsPanel<ConnInstanceHistoryConfTO> panel = super.getActions(model);
final ConnInstanceHistoryConfTO connHistoryConfTO = model.getObject();
// -- view
panel.add(new ActionLink<ConnInstanceHistoryConfTO>() {
private static final long serialVersionUID = -6745431735457245600L;
@Override
public void onClick(final AjaxRequestTarget target, final ConnInstanceHistoryConfTO modelObject) {
ConnInstanceHistoryConfDirectoryPanel.this.getTogglePanel().close(target);
viewConfiguration(modelObject, target);
target.add(modal);
}
}, ActionLink.ActionType.VIEW, StandardEntitlement.CONNECTOR_HISTORY_LIST);
// -- restore
panel.add(new ActionLink<ConnInstanceHistoryConfTO>() {
private static final long serialVersionUID = -6745431735457245600L;
@Override
public void onClick(final AjaxRequestTarget target, final ConnInstanceHistoryConfTO modelObject) {
try {
restClient.restore(modelObject.getKey());
ConnInstanceHistoryConfDirectoryPanel.this.getTogglePanel().close(target);
target.add(container);
} catch (SyncopeClientException e) {
LOG.error("While restoring {}", connHistoryConfTO.getKey(), e);
SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) ? e.getClass().getName() : e.getMessage());
}
((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
}
}, ActionLink.ActionType.RESTORE, StandardEntitlement.CONNECTOR_HISTORY_RESTORE);
// -- delete
panel.add(new ActionLink<ConnInstanceHistoryConfTO>() {
private static final long serialVersionUID = -6745431735457245600L;
@Override
public void onClick(final AjaxRequestTarget target, final ConnInstanceHistoryConfTO modelObject) {
try {
restClient.delete(modelObject.getKey());
SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
target.add(container);
ConnInstanceHistoryConfDirectoryPanel.this.getTogglePanel().close(target);
} catch (SyncopeClientException e) {
LOG.error("While deleting {}", connHistoryConfTO.getKey(), e);
SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) ? e.getClass().getName() : e.getMessage());
}
((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
}
}, ActionLink.ActionType.DELETE, StandardEntitlement.CONNECTOR_HISTORY_DELETE, true);
return panel;
}
use of org.apache.syncope.client.console.pages.BasePage in project syncope by apache.
the class DynRealmDirectoryPanel method getActions.
@Override
public ActionsPanel<DynRealmTO> getActions(final IModel<DynRealmTO> model) {
final ActionsPanel<DynRealmTO> panel = super.getActions(model);
panel.add(new ActionLink<DynRealmTO>() {
private static final long serialVersionUID = -7978723352517770644L;
@Override
public void onClick(final AjaxRequestTarget target, final DynRealmTO ignore) {
modal.header(new StringResourceModel("any.edit", model));
modal.setContent(new DynRealmModalPanel(new DynRealmWrapper(model.getObject()), false, modal, pageRef));
modal.show(true);
target.add(modal);
}
}, ActionLink.ActionType.EDIT, StandardEntitlement.DYNREALM_UPDATE);
panel.add(new ActionLink<DynRealmTO>() {
private static final long serialVersionUID = 3766262567901552032L;
@Override
public void onClick(final AjaxRequestTarget target, final DynRealmTO ignore) {
try {
restClient.delete(model.getObject().getKey());
SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
target.add(container);
} catch (SyncopeClientException e) {
LOG.error("While deleting dynamic realm {}", 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, StandardEntitlement.DYNREALM_DELETE, true);
return panel;
}
Aggregations