[SYNCOPE-1020] Implementation completed: now several sub-processes can be managed besides the main workflow definition; for both Activiti and Flowable
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/7a440618 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/7a440618 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/7a440618 Branch: refs/heads/SYNCOPE-808 Commit: 7a4406185310898b95bd6c6af2ae6e20e28392d3 Parents: 0897249 Author: Francesco Chicchiriccò <ilgro...@apache.org> Authored: Fri Apr 7 08:52:49 2017 +0200 Committer: Francesco Chicchiriccò <ilgro...@apache.org> Committed: Tue Apr 11 14:14:21 2017 +0200 ---------------------------------------------------------------------- .../archetype-resources/console/pom.xml | 6 +- .../self/WorkflowSyncopeOperations.java | 11 +- .../client/console/commons/Constants.java | 4 + .../syncope/client/console/pages/BasePage.java | 2 +- .../syncope/client/console/pages/LogViewer.java | 2 - .../client/console/pages/ModelerPopupPage.java | 6 +- .../syncope/client/console/pages/Workflow.java | 60 +--- .../console/panels/NewWorkflowProcess.java | 87 +++++ .../console/panels/WorkflowDirectoryPanel.java | 353 +++++++++++++++++++ .../console/panels/WorkflowTogglePanel.java | 162 --------- .../resources/AbstractWorkflowResource.java | 54 +++ .../resources/WorkflowDefGETResource.java | 8 +- .../resources/WorkflowDefPUTResource.java | 20 +- .../client/console/rest/WorkflowRestClient.java | 22 +- .../wicket/markup/html/form/ActionLink.java | 13 +- .../markup/html/form/ActionLinksPanel.java | 38 +- .../markup/html/form/ImageModalPanel.java | 58 +++ .../syncope/client/console/pages/Workflow.html | 17 +- .../client/console/pages/Workflow.properties | 1 + .../client/console/pages/Workflow_it.properties | 1 + .../console/pages/Workflow_pt_BR.properties | 1 + .../client/console/pages/Workflow_ru.properties | 1 + .../console/panels/ConnObjectListViewPanel.html | 2 +- .../console/panels/NewWorkflowProcess.html | 32 ++ .../console/panels/WorkflowDirectoryPanel.html | 23 ++ .../console/panels/WorkflowTogglePanel.html | 50 --- .../client/console/panels/empty.bpmn20.xml | 49 +++ .../markup/html/form/ActionLinksPanel.html | 5 + .../markup/html/form/ImageModalPanel.html | 23 ++ .../client/console/wizards/WizardMgtPanel.html | 4 +- .../common/lib/to/WorkflowDefinitionTO.java | 71 ++++ .../common/lib/types/StandardEntitlement.java | 8 +- .../rest/api/service/WorkflowService.java | 62 +++- .../syncope/core/logic/WorkflowLogic.java | 120 +++---- .../rest/cxf/service/WorkflowServiceImpl.java | 59 ++-- .../activiti/ActivitiDefinitionLoader.java | 18 +- .../workflow/activiti/ActivitiDeployUtils.java | 97 +++++ .../workflow/activiti/ActivitiImportUtils.java | 93 ----- .../activiti/ActivitiUserWorkflowAdapter.java | 286 +++++++++------ .../api/AnyObjectWorkflowDefinitionAdapter.java | 22 ++ .../api/GroupWorkflowDefinitionAdapter.java | 22 ++ .../api/UserWorkflowDefinitionAdapter.java | 22 ++ .../core/workflow/api/WorkflowAdapter.java | 24 -- .../workflow/api/WorkflowDefinitionAdapter.java | 64 ++++ .../core/workflow/api/WorkflowException.java | 7 +- .../flowable/FlowableDefinitionLoader.java | 22 +- .../workflow/flowable/FlowableDeployUtils.java | 97 +++++ .../workflow/flowable/FlowableImportUtils.java | 93 ----- .../flowable/FlowableUserWorkflowAdapter.java | 310 +++++++++------- .../java/AbstractAnyObjectWorkflowAdapter.java | 4 +- .../java/AbstractGroupWorkflowAdapter.java | 3 +- .../java/AbstractUserWorkflowAdapter.java | 3 +- .../java/DefaultAnyObjectWorkflowAdapter.java | 29 +- .../java/DefaultGroupWorkflowAdapter.java | 30 +- .../java/DefaultUserWorkflowAdapter.java | 34 +- fit/console-reference/pom.xml | 4 +- .../src/main/resources/url-config.js | 4 +- .../apache/syncope/fit/core/WorkflowITCase.java | 57 +-- 58 files changed, 1810 insertions(+), 970 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/syncope/blob/7a440618/archetype/src/main/resources/archetype-resources/console/pom.xml ---------------------------------------------------------------------- diff --git a/archetype/src/main/resources/archetype-resources/console/pom.xml b/archetype/src/main/resources/archetype-resources/console/pom.xml index de7130e..81fc817 100644 --- a/archetype/src/main/resources/archetype-resources/console/pom.xml +++ b/archetype/src/main/resources/archetype-resources/console/pom.xml @@ -186,12 +186,10 @@ ORYX.CONFIG.ROOT_PATH = BASE_PATH + "/activiti-modeler/editor-app/editor/&q value="new Ajax.Request(window.location.toString().substr(0, window.location.toString().indexOf('/activiti-modeler')) + "/activiti-modeler/stencilset.json", {"/> <replace file="${activiti-modeler.directory}/editor-app/editor/oryx.debug.js" token="ORYX.Editor.createByUrl(modelUrl);" - value="modelUrl = BASE_PATH + "/workflowDefGET"; -ORYX.Editor.createByUrl(modelUrl);"/> + value="modelUrl = BASE_PATH + "/workflowDefGET?modelId=" + modelId; ORYX.Editor.createByUrl(modelUrl);" /> <replace file="${activiti-modeler.directory}/editor-app/editor/oryx.debug.js" token="ORYX.Editor.createByUrl = function(modelUrl){" - value="modelUrl = BASE_PATH + "/workflowDefGET"; -ORYX.Editor.createByUrl = function(modelUrl){"/> + value="modelUrl = BASE_PATH + "/workflowDefGET?modelId=" + modelId; ORYX.Editor.createByUrl = function(modelUrl){" /> <replace file="${activiti-modeler.directory}/editor-app/configuration/toolbar-default-actions.js" token="window.location.href = "./";" value="window.close();"/> http://git-wip-us.apache.org/repos/asf/syncope/blob/7a440618/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowSyncopeOperations.java ---------------------------------------------------------------------- diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowSyncopeOperations.java index 6d0f3b2..45025d4 100644 --- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowSyncopeOperations.java +++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowSyncopeOperations.java @@ -21,20 +21,21 @@ package org.apache.syncope.client.cli.commands.self; import javax.ws.rs.core.Response; import org.apache.cxf.jaxrs.client.WebClient; import org.apache.syncope.client.cli.SyncopeServices; -import org.apache.syncope.common.lib.types.AnyTypeKind; import org.apache.syncope.common.rest.api.RESTHeaders; import org.apache.syncope.common.rest.api.service.WorkflowService; public class WorkflowSyncopeOperations { + private static final String DEFAULT = "userWorkflow"; + private final WorkflowService workflowService = SyncopeServices.get(WorkflowService.class); - public Response exportDiagram(final String anyTypeKindString) { + public Response exportDiagram(final String anyType) { WebClient.client(workflowService).accept(RESTHeaders.MEDIATYPE_IMAGE_PNG); - return workflowService.exportDiagram(AnyTypeKind.valueOf(anyTypeKindString)); + return workflowService.exportDiagram(anyType, DEFAULT); } - public Response exportDefinition(final String anyTypeKindString) { - return workflowService.exportDefinition(AnyTypeKind.valueOf(anyTypeKindString)); + public Response exportDefinition(final String anyType) { + return workflowService.get(anyType, DEFAULT); } } http://git-wip-us.apache.org/repos/asf/syncope/blob/7a440618/client/console/src/main/java/org/apache/syncope/client/console/commons/Constants.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/commons/Constants.java b/client/console/src/main/java/org/apache/syncope/client/console/commons/Constants.java index 8b47bed..affe16e 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/commons/Constants.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/commons/Constants.java @@ -35,6 +35,8 @@ public final class Constants { public static final String MODELER_CONTEXT = "modelerContext"; + public static final String MODEL_ID_PARAM = "modelId"; + public static final String ON_CLICK = "click"; public static final String ON_CHANGE = "change"; @@ -145,6 +147,8 @@ public final class Constants { public static final String PREF_REPORT_PAGINATOR_ROWS = "report.paginator.rows"; + public static final String PREF_WORKFLOW_PAGINATOR_ROWS = "workflow.paginator.rows"; + public static final String PAGEPARAM_CREATE = "CREATE"; public static final String PAGEPARAM_CURRENT_PAGE = "_current_page"; http://git-wip-us.apache.org/repos/asf/syncope/blob/7a440618/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java index 3b6737d..d4bdfd2 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java @@ -172,7 +172,7 @@ public class BasePage extends WebPage implements IAjaxIndicatorAware { liContainer.setVisible(SyncopeConsoleSession.get().getPlatformInfo().isUserWorkflowAdapterSupportEdit()); confULContainer.add(liContainer); link = BookmarkablePageLinkBuilder.build("workflow", Workflow.class); - MetaDataRoleAuthorizationStrategy.authorize(link, WebPage.ENABLE, StandardEntitlement.WORKFLOW_DEF_READ); + MetaDataRoleAuthorizationStrategy.authorize(link, WebPage.ENABLE, StandardEntitlement.WORKFLOW_DEF_GET); liContainer.add(link); liContainer = new WebMarkupContainer(getLIContainerId("audit")); http://git-wip-us.apache.org/repos/asf/syncope/blob/7a440618/client/console/src/main/java/org/apache/syncope/client/console/pages/LogViewer.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/LogViewer.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/LogViewer.java index 820c6f9..22f2fc5 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/pages/LogViewer.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/LogViewer.java @@ -18,8 +18,6 @@ */ package org.apache.syncope.client.console.pages; -import static org.apache.wicket.Component.ENABLE; - import java.util.ArrayList; import java.util.List; import org.apache.commons.collections4.list.SetUniqueList; http://git-wip-us.apache.org/repos/asf/syncope/blob/7a440618/client/console/src/main/java/org/apache/syncope/client/console/pages/ModelerPopupPage.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/ModelerPopupPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/ModelerPopupPage.java index 275c311..3b3ed84 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/pages/ModelerPopupPage.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/ModelerPopupPage.java @@ -23,6 +23,7 @@ import org.apache.wicket.AttributeModifier; import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.request.mapper.parameter.PageParameters; +import org.apache.wicket.util.string.StringValue; public class ModelerPopupPage extends WebPage { @@ -31,10 +32,13 @@ public class ModelerPopupPage extends WebPage { public ModelerPopupPage(final PageParameters parameters) { super(parameters); + StringValue modelId = parameters.get(Constants.MODEL_ID_PARAM); + WebMarkupContainer refresh = new WebMarkupContainer("refresh"); // properly parameterize ?modelId=5 with SYNCOPE-1020 refresh.add(new AttributeModifier( - "content", "0; url=../../" + parameters.get(Constants.MODELER_CONTEXT) + "/modeler.html?modelId=5")); + "content", "0; url=../../" + parameters.get(Constants.MODELER_CONTEXT) + + "/modeler.html?modelId=" + modelId.toString())); add(refresh); } http://git-wip-us.apache.org/repos/asf/syncope/blob/7a440618/client/console/src/main/java/org/apache/syncope/client/console/pages/Workflow.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/Workflow.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/Workflow.java index 456e845..65aade5 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/pages/Workflow.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/Workflow.java @@ -18,71 +18,47 @@ */ package org.apache.syncope.client.console.pages; +import org.apache.syncope.client.console.BookmarkablePageLinkBuilder; import org.apache.syncope.client.console.SyncopeConsoleSession; -import org.apache.syncope.client.console.panels.WorkflowTogglePanel; -import org.apache.syncope.client.console.rest.WorkflowRestClient; +import org.apache.syncope.client.console.panels.WorkflowDirectoryPanel; +import org.apache.syncope.client.console.wizards.WizardMgtPanel; +import org.apache.syncope.common.lib.to.WorkflowDefinitionTO; import org.apache.syncope.common.lib.types.StandardEntitlement; import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy; import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.wicket.markup.html.image.Image; -import org.apache.wicket.model.Model; import org.apache.wicket.request.mapper.parameter.PageParameters; -import org.apache.wicket.request.resource.DynamicImageResource; -import org.apache.wicket.request.resource.IResource; public class Workflow extends BasePage { private static final long serialVersionUID = -8781434495150074529L; - private final WorkflowRestClient wfRestClient = new WorkflowRestClient(); - public Workflow(final PageParameters parameters) { super(parameters); - final boolean userWFASupportsEdit = - SyncopeConsoleSession.get().getPlatformInfo().isUserWorkflowAdapterSupportEdit(); + body.add(BookmarkablePageLinkBuilder.build("dashboard", "dashboardBr", Dashboard.class)); + + WebMarkupContainer content = new WebMarkupContainer("content"); + content.setOutputMarkupId(true); + body.add(content); WebMarkupContainer disabled = new WebMarkupContainer("disabled"); disabled.setOutputMarkupPlaceholderTag(true); - body.add(disabled); - - WebMarkupContainer workflowDef = new WebMarkupContainer("workflowDefContainer"); - workflowDef.setOutputMarkupPlaceholderTag(true); + content.add(disabled); - Image workflowDefDiagram = new Image("workflowDefDiagram", new Model<IResource>()) { + WizardMgtPanel<WorkflowDefinitionTO> workflowsPanel = new WorkflowDirectoryPanel.Builder(getPageReference()) { - private static final long serialVersionUID = -8457850449086490660L; + private static final long serialVersionUID = -5960765294082359003L; - @Override - protected IResource getImageResource() { - return new DynamicImageResource() { + }.disableCheckBoxes().build("workflowsPanel"); + workflowsPanel.setOutputMarkupPlaceholderTag(true); + MetaDataRoleAuthorizationStrategy.authorize(workflowsPanel, ENABLE, StandardEntitlement.WORKFLOW_DEF_LIST); - private static final long serialVersionUID = 923201517955737928L; + content.add(workflowsPanel); - @Override - protected byte[] getImageData(final IResource.Attributes attributes) { - return userWFASupportsEdit - ? wfRestClient.getDiagram() - : new byte[0]; - } - }; - } - }; - workflowDefDiagram.setOutputMarkupId(true); - workflowDef.add(workflowDefDiagram); - - WorkflowTogglePanel togglePanel = - new WorkflowTogglePanel("togglePanel", getPageReference(), workflowDefDiagram); - togglePanel.setOutputMarkupId(true); - workflowDef.add(togglePanel); - - if (userWFASupportsEdit) { + if (SyncopeConsoleSession.get().getPlatformInfo().isUserWorkflowAdapterSupportEdit()) { disabled.setVisible(false); } else { - workflowDef.setVisible(false); + workflowsPanel.setVisible(false); } - - MetaDataRoleAuthorizationStrategy.authorize(workflowDef, ENABLE, StandardEntitlement.WORKFLOW_DEF_READ); - body.add(workflowDef); } } http://git-wip-us.apache.org/repos/asf/syncope/blob/7a440618/client/console/src/main/java/org/apache/syncope/client/console/panels/NewWorkflowProcess.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/NewWorkflowProcess.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/NewWorkflowProcess.java new file mode 100644 index 0000000..ab4bda3 --- /dev/null +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/NewWorkflowProcess.java @@ -0,0 +1,87 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.client.console.panels; + +import java.io.Serializable; +import javax.ws.rs.core.MediaType; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.pdfbox.util.Charsets; +import org.apache.syncope.client.console.SyncopeConsoleSession; +import org.apache.syncope.client.console.commons.Constants; +import org.apache.syncope.client.console.pages.BasePage; +import org.apache.syncope.client.console.rest.WorkflowRestClient; +import org.apache.wicket.PageReference; +import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink; +import org.apache.wicket.markup.html.WebMarkupContainer; +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.markup.html.form.TextField; +import org.apache.wicket.model.Model; + +public class NewWorkflowProcess extends TogglePanel<Serializable> { + + private static final long serialVersionUID = -4886361549305302161L; + + private final WorkflowRestClient restClient = new WorkflowRestClient(); + + private final Form<?> form; + + public NewWorkflowProcess(final String id, final WebMarkupContainer container, final PageReference pageRef) { + super(id, pageRef); + + form = new Form<>("form"); + addInnerObject(form); + + final TextField<String> key = new TextField<>("key", new Model<String>()); + key.setRequired(true); + form.add(key); + + form.add(new AjaxSubmitLink("submit", form) { + + private static final long serialVersionUID = 4947613489823025052L; + + @Override + protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) { + try { + restClient.setDefinition(MediaType.APPLICATION_XML_TYPE, key.getModelObject(), + IOUtils.toString( + getClass().getResourceAsStream("empty.bpmn20.xml"), + Charsets.UTF_8.name()).replaceAll("%KEY%", key.getModelObject())); + + key.getModel().setObject(null); + SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED)); + toggle(target, false); + target.add(container); + } catch (Exception e) { + LOG.error("While creating new workflow process", e); + SyncopeConsoleSession.get().error( + StringUtils.isBlank(e.getMessage()) + ? e.getClass().getName() : e.getMessage()); + } + ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target); + } + + @Override + protected void onError(final AjaxRequestTarget target, final Form<?> form) { + ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target); + } + }); + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/7a440618/client/console/src/main/java/org/apache/syncope/client/console/panels/WorkflowDirectoryPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/WorkflowDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/WorkflowDirectoryPanel.java new file mode 100644 index 0000000..a6b5798 --- /dev/null +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/WorkflowDirectoryPanel.java @@ -0,0 +1,353 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.client.console.panels; + +import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import javax.ws.rs.core.MediaType; +import org.apache.commons.lang3.StringUtils; +import org.apache.syncope.client.console.SyncopeConsoleApplication; +import org.apache.syncope.client.console.SyncopeConsoleSession; +import org.apache.syncope.client.console.commons.Constants; +import org.apache.syncope.client.console.commons.DirectoryDataProvider; +import org.apache.syncope.client.console.commons.SortableDataProviderComparator; +import org.apache.syncope.client.console.pages.BasePage; +import org.apache.syncope.client.console.pages.ModelerPopupPage; +import org.apache.syncope.client.console.panels.WorkflowDirectoryPanel.WorkflowDefinitionDataProvider; +import org.apache.syncope.client.console.rest.WorkflowRestClient; +import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.ActionColumn; +import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.BooleanPropertyColumn; +import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.KeyPropertyColumn; +import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal; +import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink; +import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel; +import org.apache.syncope.client.console.wicket.markup.html.form.ImageModalPanel; +import org.apache.syncope.client.console.wicket.markup.html.form.XMLEditorPanel; +import org.apache.syncope.client.console.wizards.AjaxWizardBuilder; +import org.apache.syncope.client.console.wizards.WizardMgtPanel; +import org.apache.syncope.common.lib.SyncopeClientException; +import org.apache.syncope.common.lib.to.WorkflowDefinitionTO; +import org.apache.syncope.common.lib.types.StandardEntitlement; +import org.apache.wicket.Page; +import org.apache.wicket.PageReference; +import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.ajax.markup.html.AjaxLink; +import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink; +import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy; +import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; +import org.apache.wicket.extensions.markup.html.repeater.data.sort.SortOrder; +import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn; +import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn; +import org.apache.wicket.extensions.wizard.WizardModel; +import org.apache.wicket.markup.html.WebMarkupContainer; +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.model.CompoundPropertyModel; +import org.apache.wicket.model.IModel; +import org.apache.wicket.model.Model; +import org.apache.wicket.model.ResourceModel; +import org.apache.wicket.request.mapper.parameter.PageParameters; +import org.apache.wicket.util.io.IOUtils; + +public class WorkflowDirectoryPanel extends DirectoryPanel< + WorkflowDefinitionTO, WorkflowDefinitionTO, WorkflowDefinitionDataProvider, WorkflowRestClient> { + + private static final long serialVersionUID = 2705668831139984998L; + + private final BaseModal<String> utility; + + private String modelerCtx; + + protected WorkflowDirectoryPanel(final String id, final Builder builder) { + super(id, builder); + + this.addNewItemPanelBuilder(new AjaxWizardBuilder<WorkflowDefinitionTO>(new WorkflowDefinitionTO(), pageRef) { + + private static final long serialVersionUID = 1633859795677053912L; + + @Override + protected WizardModel buildModelSteps( + final WorkflowDefinitionTO modelObject, final WizardModel wizardModel) { + + return wizardModel; + } + }, false); + final NewWorkflowProcess newWorkflowProcess = new NewWorkflowProcess("newWorkflowProcess", container, pageRef); + addInnerObject(newWorkflowProcess); + AjaxLink<Void> newWorkflowProcessLink = new AjaxLink<Void>("add") { + + private static final long serialVersionUID = -7978723352517770644L; + + @Override + public void onClick(final AjaxRequestTarget target) { + newWorkflowProcess.toggle(target, true); + } + }; + ((WebMarkupContainer) get("container:content")).addOrReplace(newWorkflowProcessLink); + + setShowResultPage(true); + + modal.size(Modal.Size.Large); + + utility = new BaseModal<>("outer"); + addOuterObject(utility); + utility.size(Modal.Size.Large); + AjaxSubmitLink xmlEditorSubmit = utility.addSubmitButton(); + MetaDataRoleAuthorizationStrategy.authorize(xmlEditorSubmit, RENDER, StandardEntitlement.WORKFLOW_DEF_SET); + utility.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { + + private static final long serialVersionUID = 8804221891699487139L; + + @Override + public void onClose(final AjaxRequestTarget target) { + utility.show(false); + utility.close(target); + } + }); + initResultTable(); + + // Check if Activiti or Flowable Modeler directory is found + modelerCtx = null; + try { + if (SyncopeConsoleApplication.get().getActivitiModelerDirectory() != null) { + File baseDir = new File(SyncopeConsoleApplication.get().getActivitiModelerDirectory()); + if (baseDir.exists() && baseDir.canRead() && baseDir.isDirectory()) { + modelerCtx = Constants.ACTIVITI_MODELER_CONTEXT; + } + } + + if (SyncopeConsoleApplication.get().getFlowableModelerDirectory() != null) { + File baseDir = new File(SyncopeConsoleApplication.get().getFlowableModelerDirectory()); + if (baseDir.exists() && baseDir.canRead() && baseDir.isDirectory()) { + modelerCtx = Constants.FLOWABLE_MODELER_CONTEXT; + } + } + } catch (Exception e) { + LOG.error("Could not check for Modeler directory", e); + } + } + + @Override + protected WorkflowDefinitionDataProvider dataProvider() { + return new WorkflowDefinitionDataProvider(rows); + } + + @Override + protected String paginatorRowsKey() { + return Constants.PREF_WORKFLOW_PAGINATOR_ROWS; + } + + @Override + protected List<IColumn<WorkflowDefinitionTO, String>> getColumns() { + List<IColumn<WorkflowDefinitionTO, String>> columns = new ArrayList<>(); + + columns.add(new KeyPropertyColumn<WorkflowDefinitionTO>(new ResourceModel("key"), "key", "key")); + columns.add(new PropertyColumn<WorkflowDefinitionTO, String>(new ResourceModel("name"), "name", "name")); + columns.add(new BooleanPropertyColumn<WorkflowDefinitionTO>(new ResourceModel("main"), null, "main")); + + columns.add(new ActionColumn<WorkflowDefinitionTO, String>(new ResourceModel("actions")) { + + private static final long serialVersionUID = 906457126287899096L; + + @Override + public ActionLinksPanel<?> getActions(final String componentId, final IModel<WorkflowDefinitionTO> model) { + final ActionLinksPanel.Builder<WorkflowDefinitionTO> panel = ActionLinksPanel.builder(); + + 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 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)); + + 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 = -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 + public void onClick(final AjaxRequestTarget target, final WorkflowDefinitionTO ignore) { + // do nothing + } + }, ActionLink.ActionType.WORKFLOW_MODELER, StandardEntitlement.WORKFLOW_DEF_SET, modelerCtx != null); + + panel.add(new ActionLink<WorkflowDefinitionTO>() { + + private static final long serialVersionUID = -7978723352517770644L; + + @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, !model.getObject().isMain()); + + return panel.build(componentId); + } + + @Override + public ActionLinksPanel<WorkflowDefinitionTO> getHeader(final String componentId) { + final ActionLinksPanel.Builder<WorkflowDefinitionTO> panel = ActionLinksPanel.builder(); + + return panel.add(new ActionLink<WorkflowDefinitionTO>() { + + private static final long serialVersionUID = -184018732772021627L; + + @Override + public void onClick(final AjaxRequestTarget target, final WorkflowDefinitionTO ignore) { + if (target != null) { + target.add(container); + } + } + }, ActionLink.ActionType.RELOAD, StandardEntitlement.WORKFLOW_DEF_LIST).build(componentId); + } + }); + + return columns; + } + + @Override + protected Collection<ActionLink.ActionType> getBulkActions() { + return Collections.emptyList(); + } + + public abstract static class Builder + extends DirectoryPanel.Builder<WorkflowDefinitionTO, WorkflowDefinitionTO, WorkflowRestClient> { + + private static final long serialVersionUID = 5088962796986706805L; + + public Builder(final PageReference pageRef) { + super(new WorkflowRestClient(), pageRef); + } + + @Override + protected WizardMgtPanel<WorkflowDefinitionTO> newInstance(final String id, final boolean wizardInModal) { + return new WorkflowDirectoryPanel(id, this); + } + } + + protected class WorkflowDefinitionDataProvider extends DirectoryDataProvider<WorkflowDefinitionTO> { + + private static final long serialVersionUID = 1764153405387687592L; + + private final SortableDataProviderComparator<WorkflowDefinitionTO> comparator; + + private final WorkflowRestClient restClient = new WorkflowRestClient(); + + public WorkflowDefinitionDataProvider(final int paginatorRows) { + super(paginatorRows); + this.comparator = new SortableDataProviderComparator<>(this); + setSort("main", SortOrder.DESCENDING); + } + + @Override + public Iterator<WorkflowDefinitionTO> iterator(final long first, final long count) { + List<WorkflowDefinitionTO> result = restClient.getDefinitions(); + Collections.sort(result, comparator); + return result.subList((int) first, (int) first + (int) count).iterator(); + } + + @Override + public long size() { + return restClient.getDefinitions().size(); + } + + @Override + public IModel<WorkflowDefinitionTO> model(final WorkflowDefinitionTO object) { + return new CompoundPropertyModel<>(object); + } + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/7a440618/client/console/src/main/java/org/apache/syncope/client/console/panels/WorkflowTogglePanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/WorkflowTogglePanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/WorkflowTogglePanel.java deleted file mode 100644 index 4b6fcbb..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/WorkflowTogglePanel.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.syncope.client.console.panels; - -import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal; -import java.io.File; -import java.io.IOException; -import javax.ws.rs.core.MediaType; -import org.apache.commons.lang3.StringUtils; -import org.apache.syncope.client.console.SyncopeConsoleApplication; -import org.apache.syncope.client.console.SyncopeConsoleSession; -import org.apache.syncope.client.console.commons.Constants; -import org.apache.syncope.client.console.pages.ModelerPopupPage; -import org.apache.syncope.client.console.pages.BasePage; -import org.apache.syncope.client.console.rest.WorkflowRestClient; -import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal; -import org.apache.syncope.client.console.wicket.markup.html.form.XMLEditorPanel; -import org.apache.syncope.client.console.wicket.markup.html.link.VeilPopupSettings; -import org.apache.syncope.common.lib.SyncopeClientException; -import org.apache.syncope.common.lib.types.StandardEntitlement; -import org.apache.wicket.PageReference; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.ajax.markup.html.AjaxLink; -import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink; -import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy; -import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; -import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.markup.html.image.Image; -import org.apache.wicket.markup.html.link.BookmarkablePageLink; -import org.apache.wicket.model.IModel; -import org.apache.wicket.model.Model; -import org.apache.wicket.model.ResourceModel; -import org.apache.wicket.request.mapper.parameter.PageParameters; -import org.apache.wicket.util.io.IOUtils; - -public class WorkflowTogglePanel extends TogglePanel<String> { - - private static final long serialVersionUID = -2025535531121434056L; - - private final WebMarkupContainer container; - - protected final BaseModal<String> modal; - - public WorkflowTogglePanel(final String id, final PageReference pageRef, final Image workflowDefDiagram) { - super(id, pageRef); - modal = new BaseModal<>("outer"); - addOuterObject(modal); - modal.size(Modal.Size.Large); - - container = new WebMarkupContainer("container"); - container.setOutputMarkupPlaceholderTag(true); - addInnerObject(container); - - // Check if Activiti or Flowable Modeler directory is found - String modelerContext = null; - try { - if (SyncopeConsoleApplication.get().getActivitiModelerDirectory() != null) { - File baseDir = new File(SyncopeConsoleApplication.get().getActivitiModelerDirectory()); - if (baseDir.exists() && baseDir.canRead() && baseDir.isDirectory()) { - modelerContext = Constants.ACTIVITI_MODELER_CONTEXT; - } - } - - if (SyncopeConsoleApplication.get().getFlowableModelerDirectory() != null) { - File baseDir = new File(SyncopeConsoleApplication.get().getFlowableModelerDirectory()); - if (baseDir.exists() && baseDir.canRead() && baseDir.isDirectory()) { - modelerContext = Constants.FLOWABLE_MODELER_CONTEXT; - } - } - } catch (Exception e) { - LOG.error("Could not check for Modeler directory", e); - } - - PageParameters parameters = new PageParameters(); - if (modelerContext != null) { - parameters.add(Constants.MODELER_CONTEXT, modelerContext); - } - BookmarkablePageLink<Void> workflowModeler = - new BookmarkablePageLink<>("workflowModeler", ModelerPopupPage.class, parameters); - workflowModeler.setPopupSettings(new VeilPopupSettings().setHeight(600).setWidth(800)); - MetaDataRoleAuthorizationStrategy.authorize(workflowModeler, ENABLE, StandardEntitlement.WORKFLOW_DEF_READ); - container.add(workflowModeler); - workflowModeler.setEnabled(modelerContext != null); - - AjaxSubmitLink xmlEditorSubmit = modal.addSubmitButton(); - MetaDataRoleAuthorizationStrategy.authorize(xmlEditorSubmit, RENDER, StandardEntitlement.WORKFLOW_DEF_UPDATE); - modal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { - - private static final long serialVersionUID = 8804221891699487139L; - - @Override - public void onClose(final AjaxRequestTarget target) { - modal.show(false); - modal.close(target); - target.add(workflowDefDiagram); - } - }); - - AjaxLink<Void> xmlEditor = new AjaxLink<Void>("xmlEditor") { - - private static final long serialVersionUID = -1964967067512351526L; - - private final WorkflowRestClient restClient = new WorkflowRestClient(); - - @Override - public void onClick(final AjaxRequestTarget target) { - final IModel<String> wfDefinition = new Model<>(); - try { - wfDefinition.setObject(IOUtils.toString(restClient.getDefinition(MediaType.APPLICATION_XML_TYPE))); - } catch (IOException e) { - LOG.error("Could not get workflow definition", e); - } - - target.add(modal.setContent(new XMLEditorPanel(modal, wfDefinition, false, pageRef) { - - private static final long serialVersionUID = 5488080606102212554L; - - @Override - public void onSubmit(final AjaxRequestTarget target, final Form<?> form) { - if (StringUtils.isNotBlank(wfDefinition.getObject())) { - try { - restClient.updateDefinition(MediaType.APPLICATION_XML_TYPE, wfDefinition.getObject()); - SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED)); - - modal.show(false); - modal.close(target); - } catch (SyncopeClientException e) { - SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) ? e.getClass(). - getName() : e. - getMessage()); - } - ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target); - } - } - })); - - modal.header(new ResourceModel("xmlEditorTitle")); - modal.show(true); - } - }; - MetaDataRoleAuthorizationStrategy.authorize(xmlEditor, RENDER, StandardEntitlement.WORKFLOW_DEF_READ); - container.add(xmlEditor); - } - -} http://git-wip-us.apache.org/repos/asf/syncope/blob/7a440618/client/console/src/main/java/org/apache/syncope/client/console/resources/AbstractWorkflowResource.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/resources/AbstractWorkflowResource.java b/client/console/src/main/java/org/apache/syncope/client/console/resources/AbstractWorkflowResource.java new file mode 100644 index 0000000..53bc669 --- /dev/null +++ b/client/console/src/main/java/org/apache/syncope/client/console/resources/AbstractWorkflowResource.java @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.client.console.resources; + +import org.apache.commons.collections4.IterableUtils; +import org.apache.commons.collections4.Predicate; +import org.apache.syncope.client.console.commons.Constants; +import org.apache.syncope.client.console.rest.WorkflowRestClient; +import org.apache.syncope.common.lib.to.WorkflowDefinitionTO; +import org.apache.wicket.request.resource.AbstractResource; +import org.apache.wicket.util.string.StringValue; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +abstract class AbstractWorkflowResource extends AbstractResource { + + private static final long serialVersionUID = 5163553843196539019L; + + protected static final Logger LOG = LoggerFactory.getLogger(AbstractWorkflowResource.class); + + protected final WorkflowRestClient restClient = new WorkflowRestClient(); + + protected WorkflowDefinitionTO getWorkflowDefinition(final Attributes attributes) { + final StringValue modelId = + attributes.getRequest().getQueryParameters().getParameterValue(Constants.MODEL_ID_PARAM); + + WorkflowDefinitionTO workflowDefinition = modelId == null ? null + : IterableUtils.find(restClient.getDefinitions(), new Predicate<WorkflowDefinitionTO>() { + + @Override + public boolean evaluate(final WorkflowDefinitionTO object) { + return modelId.toString().equals(object.getModelId()); + } + }); + + return workflowDefinition; + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/7a440618/client/console/src/main/java/org/apache/syncope/client/console/resources/WorkflowDefGETResource.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/resources/WorkflowDefGETResource.java b/client/console/src/main/java/org/apache/syncope/client/console/resources/WorkflowDefGETResource.java index ab89c0a..2c14d35 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/resources/WorkflowDefGETResource.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/resources/WorkflowDefGETResource.java @@ -22,7 +22,7 @@ import java.io.IOException; import java.nio.charset.StandardCharsets; import javax.ws.rs.core.MediaType; import org.apache.syncope.client.console.rest.WorkflowRestClient; -import org.apache.wicket.request.resource.AbstractResource; +import org.apache.syncope.common.lib.to.WorkflowDefinitionTO; import org.apache.wicket.util.io.IOUtils; /** @@ -30,12 +30,14 @@ import org.apache.wicket.util.io.IOUtils; * * @see org.apache.syncope.common.rest.api.service.WorkflowService#exportDefinition */ -public class WorkflowDefGETResource extends AbstractResource { +public class WorkflowDefGETResource extends AbstractWorkflowResource { private static final long serialVersionUID = 4637304868056148970L; @Override protected ResourceResponse newResourceResponse(final Attributes attributes) { + final WorkflowDefinitionTO toGet = getWorkflowDefinition(attributes); + ResourceResponse response = new ResourceResponse(); response.disableCaching(); response.setContentType(MediaType.APPLICATION_JSON); @@ -45,7 +47,7 @@ public class WorkflowDefGETResource extends AbstractResource { @Override public void writeData(final Attributes attributes) throws IOException { IOUtils.copy( - new WorkflowRestClient().getDefinition(MediaType.APPLICATION_JSON_TYPE), + new WorkflowRestClient().getDefinition(MediaType.APPLICATION_JSON_TYPE, toGet.getKey()), attributes.getResponse().getOutputStream()); } }); http://git-wip-us.apache.org/repos/asf/syncope/blob/7a440618/client/console/src/main/java/org/apache/syncope/client/console/resources/WorkflowDefPUTResource.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/resources/WorkflowDefPUTResource.java b/client/console/src/main/java/org/apache/syncope/client/console/resources/WorkflowDefPUTResource.java index eb6b982..bd34711 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/resources/WorkflowDefPUTResource.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/resources/WorkflowDefPUTResource.java @@ -23,25 +23,18 @@ import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.apache.cxf.common.util.UrlUtils; -import org.apache.syncope.client.console.rest.WorkflowRestClient; -import org.apache.wicket.request.resource.AbstractResource; +import org.apache.syncope.common.lib.to.WorkflowDefinitionTO; import org.apache.wicket.util.io.IOUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * Mirror REST resource for putting user workflow definition in JSON (used by Activiti / Flowable Modeler). * * @see org.apache.syncope.common.rest.api.service.WorkflowService#importDefinition */ -public class WorkflowDefPUTResource extends AbstractResource { +public class WorkflowDefPUTResource extends AbstractWorkflowResource { private static final long serialVersionUID = 2964542005207297944L; - private static final Logger LOG = LoggerFactory.getLogger(WorkflowDefPUTResource.class); - - private final WorkflowRestClient restClient = new WorkflowRestClient(); - @Override protected ResourceResponse newResourceResponse(final Attributes attributes) { String definition = null; @@ -58,14 +51,17 @@ public class WorkflowDefPUTResource extends AbstractResource { } catch (IOException e) { LOG.error("Could not extract workflow definition", e); } - if (definition == null) { + + WorkflowDefinitionTO toSet = getWorkflowDefinition(attributes); + + if (definition == null || toSet == null) { return new ResourceResponse().setStatusCode(Response.Status.BAD_REQUEST.getStatusCode()). setError(Response.Status.BAD_REQUEST.getStatusCode(), - "Could not extract workflow definition"); + "Could not extract workflow model id and / or definition"); } try { - restClient.updateDefinition(MediaType.APPLICATION_JSON_TYPE, definition); + restClient.setDefinition(MediaType.APPLICATION_JSON_TYPE, toSet.getKey(), definition); return new ResourceResponse().setStatusCode(Response.Status.NO_CONTENT.getStatusCode()); } catch (Exception e) { LOG.error("While updating workflow definition", e); http://git-wip-us.apache.org/repos/asf/syncope/blob/7a440618/client/console/src/main/java/org/apache/syncope/client/console/rest/WorkflowRestClient.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/WorkflowRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/WorkflowRestClient.java index 8d9c424..14711a4 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/rest/WorkflowRestClient.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/WorkflowRestClient.java @@ -19,11 +19,13 @@ package org.apache.syncope.client.console.rest; import java.io.InputStream; +import java.util.List; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.apache.cxf.helpers.IOUtils; import org.apache.cxf.jaxrs.client.WebClient; import org.apache.syncope.client.console.SyncopeConsoleSession; +import org.apache.syncope.common.lib.to.WorkflowDefinitionTO; import org.apache.syncope.common.lib.types.AnyTypeKind; import org.apache.syncope.common.rest.api.RESTHeaders; import org.apache.syncope.common.rest.api.service.WorkflowService; @@ -36,16 +38,20 @@ public class WorkflowRestClient extends BaseRestClient { return SyncopeConsoleSession.get().getService(mediaType, WorkflowService.class); } - public InputStream getDefinition(final MediaType mediaType) { - Response response = getService(mediaType).exportDefinition(AnyTypeKind.USER); + public List<WorkflowDefinitionTO> getDefinitions() { + return getService(WorkflowService.class).list(AnyTypeKind.USER.name()); + } + + public InputStream getDefinition(final MediaType mediaType, final String key) { + Response response = getService(mediaType).get(AnyTypeKind.USER.name(), key); return (InputStream) response.getEntity(); } - public byte[] getDiagram() { + public byte[] getDiagram(final String key) { WorkflowService service = getService(WorkflowService.class); WebClient.client(service).accept(RESTHeaders.MEDIATYPE_IMAGE_PNG); - Response response = service.exportDiagram(AnyTypeKind.USER); + Response response = service.exportDiagram(AnyTypeKind.USER.name(), key); byte[] diagram; try { @@ -57,7 +63,11 @@ public class WorkflowRestClient extends BaseRestClient { return diagram; } - public void updateDefinition(final MediaType mediaType, final String definition) { - getService(mediaType).importDefinition(AnyTypeKind.USER, definition); + public void setDefinition(final MediaType mediaType, final String key, final String definition) { + getService(mediaType).set(AnyTypeKind.USER.name(), key, definition); + } + + public void deleteDefinition(final String key) { + getService(WorkflowService.class).delete(AnyTypeKind.USER.name(), key); } } http://git-wip-us.apache.org/repos/asf/syncope/blob/7a440618/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLink.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLink.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLink.java index 2fef62f..c4c5bf7 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLink.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLink.java @@ -19,7 +19,9 @@ package org.apache.syncope.client.console.wicket.markup.html.form; import java.io.Serializable; +import org.apache.wicket.Page; import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.request.mapper.parameter.PageParameters; public abstract class ActionLink<T extends Serializable> implements Serializable { @@ -91,7 +93,8 @@ public abstract class ActionLink<T extends Serializable> implements Serializable PROPAGATION_TASKS("read"), NOTIFICATION_TASKS("read"), ZOOM_IN("zoomin"), - ZOOM_OUT("zoomout"); + ZOOM_OUT("zoomout"), + WORKFLOW_MODELER("workflowModeler"); private final String actionId; @@ -126,6 +129,14 @@ public abstract class ActionLink<T extends Serializable> implements Serializable return true; } + public Class<? extends Page> getPageClass() { + return null; + } + + public PageParameters getPageParameters() { + return null; + } + public final ActionLink<T> disable() { this.enabled = false; return this; http://git-wip-us.apache.org/repos/asf/syncope/blob/7a440618/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksPanel.java index 9e2bd0c..c9a632d 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksPanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksPanel.java @@ -24,9 +24,11 @@ import java.util.Map; import java.util.Map.Entry; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Triple; +import org.apache.syncope.client.console.wicket.markup.html.link.VeilPopupSettings; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy; import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxLink; +import org.apache.wicket.markup.html.link.BookmarkablePageLink; import org.apache.wicket.markup.html.panel.Fragment; import org.apache.wicket.markup.html.panel.Panel; import org.apache.wicket.model.IModel; @@ -103,6 +105,7 @@ public final class ActionLinksPanel<T extends Serializable> extends Panel { super.add(new Fragment("panelNotificationTasks", "emptyFragment", this)); super.add(new Fragment("panelZoomIn", "emptyFragment", this)); super.add(new Fragment("panelZoomOut", "emptyFragment", this)); + super.add(new Fragment("panelWorkflowModeler", "emptyFragment", this)); } public ActionLinksPanel<T> add( @@ -945,19 +948,19 @@ public final class ActionLinksPanel<T extends Serializable> extends Panel { fragment.addOrReplace( new IndicatingOnConfirmAjaxLink<Void>("unassignLink", "confirmUnassign", enabled) { - private static final long serialVersionUID = -6957616042924610294L; + private static final long serialVersionUID = -6957616042924610294L; - @Override - public void onClick(final AjaxRequestTarget target) { - link.onClick(target, model.getObject()); - } + @Override + public void onClick(final AjaxRequestTarget target) { + link.onClick(target, model.getObject()); + } - @Override - public String getAjaxIndicatorMarkupId() { - return disableIndicator || !link.isIndicatorEnabled() - ? StringUtils.EMPTY : super.getAjaxIndicatorMarkupId(); - } - }.setVisible(link.isEnabled(model.getObject()))); + @Override + public String getAjaxIndicatorMarkupId() { + return disableIndicator || !link.isIndicatorEnabled() + ? StringUtils.EMPTY : super.getAjaxIndicatorMarkupId(); + } + }.setVisible(link.isEnabled(model.getObject()))); break; case ASSIGN: @@ -1140,6 +1143,15 @@ public final class ActionLinksPanel<T extends Serializable> extends Panel { }.setVisible(link.isEnabled(model.getObject()))); break; + case WORKFLOW_MODELER: + fragment = new Fragment("panelWorkflowModeler", "fragmentWorkflowModeler", this); + + fragment.addOrReplace(new BookmarkablePageLink<>( + "workflowModelerLink", link.getPageClass(), link.getPageParameters()). + setPopupSettings(new VeilPopupSettings().setHeight(600).setWidth(800)). + setVisible(link.isEnabled(model.getObject()))); + break; + default: // do nothing } @@ -1336,6 +1348,10 @@ public final class ActionLinksPanel<T extends Serializable> extends Panel { super.addOrReplace(new Fragment("panelZoomOut", "emptyFragment", this)); break; + case WORKFLOW_MODELER: + super.addOrReplace(new Fragment("panelWorkflowModelert", "emptyFragment", this)); + break; + default: // do nothing } http://git-wip-us.apache.org/repos/asf/syncope/blob/7a440618/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ImageModalPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ImageModalPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ImageModalPanel.java new file mode 100644 index 0000000..cf9c108 --- /dev/null +++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ImageModalPanel.java @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.client.console.wicket.markup.html.form; + +import java.io.Serializable; +import org.apache.syncope.client.console.panels.AbstractModalPanel; +import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal; +import org.apache.wicket.PageReference; +import org.apache.wicket.markup.html.image.Image; +import org.apache.wicket.model.Model; +import org.apache.wicket.request.resource.DynamicImageResource; +import org.apache.wicket.request.resource.IResource; + +public class ImageModalPanel<T extends Serializable> extends AbstractModalPanel<T> { + + private static final long serialVersionUID = 5044632306261219075L; + + public ImageModalPanel(final BaseModal<T> modal, final byte[] content, final PageReference pageRef) { + super(modal, pageRef); + + Image image = new Image("image", new Model<IResource>()) { + + private static final long serialVersionUID = -8457850449086490660L; + + @Override + protected IResource getImageResource() { + return new DynamicImageResource() { + + private static final long serialVersionUID = 923201517955737928L; + + @Override + protected byte[] getImageData(final IResource.Attributes attributes) { + return content; + } + }; + } + }; + image.setOutputMarkupId(true); + add(image); + } + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/7a440618/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow.html ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow.html b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow.html index 656bb9a..723c46a 100644 --- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow.html +++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow.html @@ -20,17 +20,18 @@ under the License. <wicket:extend> <section class="content-header"> <h1> </h1> + <ol class="breadcrumb"> + <li><a wicket:id="dashboardBr"><i class="fa fa-dashboard"></i> <wicket:message key="dashboard"/></a></li> + <li class="active"><wicket:message key="configuration"/></li> + <li class="active"><wicket:message key="workflow"/></li> + </ol> </section> - <section class="content"> - <div> - <span wicket:id="disabled"><i><wicket:message key="disabled"/></i></span> - <span wicket:id="workflowDefContainer"> - <img wicket:id="workflowDefDiagram" style="width: 100%;"/> - <span wicket:id="togglePanel"/> - </span> + <section class="content" wicket:id="content"> + <span wicket:id="disabled"><i><wicket:message key="disabled"/></i></span> + <div class="box"> + <div class="box-body" wicket:id="workflowsPanel"/> </div> </section> - </wicket:extend> </html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/syncope/blob/7a440618/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow.properties ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow.properties index 9ad5cd1..da1e1ce 100644 --- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow.properties +++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow.properties @@ -16,3 +16,4 @@ # under the License. disabled=Edit the workflow definition is not supported by the configured Workflow Adapter. xmlEditorTitle=Workflow XML Editor +main=Main http://git-wip-us.apache.org/repos/asf/syncope/blob/7a440618/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow_it.properties ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow_it.properties index c4e373b..d3faf2b 100644 --- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow_it.properties +++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow_it.properties @@ -16,3 +16,4 @@ # under the License. disabled=Il Workflow Adapter corrent non consente la modifica della definizione del workflow. xmlEditorTitle=Workflow XML Editor +main=Principale http://git-wip-us.apache.org/repos/asf/syncope/blob/7a440618/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow_pt_BR.properties ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow_pt_BR.properties index 9ad5cd1..da1e1ce 100644 --- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow_pt_BR.properties +++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow_pt_BR.properties @@ -16,3 +16,4 @@ # under the License. disabled=Edit the workflow definition is not supported by the configured Workflow Adapter. xmlEditorTitle=Workflow XML Editor +main=Main http://git-wip-us.apache.org/repos/asf/syncope/blob/7a440618/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow_ru.properties ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow_ru.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow_ru.properties index 2994bef..5b53981 100644 --- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow_ru.properties +++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow_ru.properties @@ -19,3 +19,4 @@ disabled=Edit the workflow definition is not supported by the configured Workflow Adapter. # xmlEditorTitle=XML \u00d1\u0080\u00d0\u00b5\u00d0\u00b4\u00d0\u00b0\u00d0\u00ba\u00d1\u0082\u00d0\u00be\u00d1\u0080 \u00d0\u00bf\u00d1\u0080\u00d0\u00be\u00d1\u0086\u00d0\u00b5\u00d1\u0081\u00d1\u0081\u00d0\u00b0 \u00d1\u0081\u00d0\u00be\u00d0\u00b3\u00d0\u00bb\u00d0\u00b0\u00d1\u0081\u00d0\u00be\u00d0\u00b2\u00d0\u00b0\u00d0\u00bd\u00d0\u00b8\u00d1\u008f xmlEditorTitle=XML \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u0438\u044f +main=Main http://git-wip-us.apache.org/repos/asf/syncope/blob/7a440618/client/console/src/main/resources/org/apache/syncope/client/console/panels/ConnObjectListViewPanel.html ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ConnObjectListViewPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ConnObjectListViewPanel.html index d700143..d0dad1e 100644 --- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ConnObjectListViewPanel.html +++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ConnObjectListViewPanel.html @@ -20,7 +20,7 @@ under the License. <wicket:panel> <span wicket:id="objs"/> <div wicket:id="arrows"> - <a haref="#" class="btn btn-primary btn-circle btn-lg pull-right" wicket:id="next"><i class="fa fa-chevron-right"></i></a> + <a href="#" class="btn btn-primary btn-circle btn-lg pull-right" wicket:id="next"><i class="fa fa-chevron-right"></i></a> </div> </wicket:panel> </html> http://git-wip-us.apache.org/repos/asf/syncope/blob/7a440618/client/console/src/main/resources/org/apache/syncope/client/console/panels/NewWorkflowProcess.html ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/NewWorkflowProcess.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/NewWorkflowProcess.html new file mode 100644 index 0000000..6197d5a --- /dev/null +++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/NewWorkflowProcess.html @@ -0,0 +1,32 @@ +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> +<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org"> + <wicket:extend> + <div id="startAtContainer"> + <form wicket:id="form"> + <div class="input-group"> + <input wicket:id="key"/> + <div class="input-group-addon"> + <a wicket:id="submit"><i class="fa fa-file-o" alt="new" title="new"></i></a> + </div> + </div> + </form> + </div> + </wicket:extend> +</html> http://git-wip-us.apache.org/repos/asf/syncope/blob/7a440618/client/console/src/main/resources/org/apache/syncope/client/console/panels/WorkflowDirectoryPanel.html ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/WorkflowDirectoryPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/WorkflowDirectoryPanel.html new file mode 100644 index 0000000..d170041 --- /dev/null +++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/WorkflowDirectoryPanel.html @@ -0,0 +1,23 @@ +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> +<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org"> + <wicket:extend> + <span wicket:id="newWorkflowProcess"/> + </wicket:extend> +</html> http://git-wip-us.apache.org/repos/asf/syncope/blob/7a440618/client/console/src/main/resources/org/apache/syncope/client/console/panels/WorkflowTogglePanel.html ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/WorkflowTogglePanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/WorkflowTogglePanel.html deleted file mode 100644 index 0ca7f70..0000000 --- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/WorkflowTogglePanel.html +++ /dev/null @@ -1,50 +0,0 @@ -<!-- -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, -software distributed under the License is distributed on an -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied. See the License for the -specific language governing permissions and limitations -under the License. ---> -<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org"> - <wicket:head> - <script type="text/javascript"> - $(document).ready(function () { - $("div.inactive-topology-menu").toggle("slow"); - $("div.inactive-topology-menu").attr("class", "topology-menu active-topology-menu"); - }); - </script> - - <style type="text/css"> - div.topology-menu { - top: 65px !important; - } - - div.topology-menu div.header { - display: none !important; - } - </style> - </wicket:head> - <wicket:extend> - <div wicket:id="container"> - <ul class="menu"> - <wicket:enclosure child="workflowModeler"> - <li><a href="#" wicket:id="workflowModeler"><i class="fa fa-file-image-o"></i>Workflow Modeler</a></li> - </wicket:enclosure> - <wicket:enclosure child="xmlEditor"> - <li><a href="#" wicket:id="xmlEditor"><i class="fa fa-file-text-o"></i>XML editor</a></li> - </wicket:enclosure> - </ul> - </div> - </wicket:extend> -</html> http://git-wip-us.apache.org/repos/asf/syncope/blob/7a440618/client/console/src/main/resources/org/apache/syncope/client/console/panels/empty.bpmn20.xml ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/empty.bpmn20.xml b/client/console/src/main/resources/org/apache/syncope/client/console/panels/empty.bpmn20.xml new file mode 100644 index 0000000..7e9e7ea --- /dev/null +++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/empty.bpmn20.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> +<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:activiti="http://activiti.org/bpmn" + xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" + xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" + xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" + typeLanguage="http://www.w3.org/2001/XMLSchema" + expressionLanguage="http://www.w3.org/1999/XPath" + targetNamespace="http://activiti.org/bpmn20"> + + <process id="%KEY%" name="%KEY%" isExecutable="true"> + <startEvent id="startevent1" name="Start"></startEvent> + <endEvent id="endevent1" name="End"></endEvent> + <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="endevent1"></sequenceFlow> + </process> + <bpmndi:BPMNDiagram id="BPMNDiagram_myProcess"> + <bpmndi:BPMNPlane bpmnElement="myProcess" id="BPMNPlane_myProcess"> + <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1"> + <omgdc:Bounds height="35.0" width="35.0" x="180.0" y="110.0"></omgdc:Bounds> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1"> + <omgdc:Bounds height="35.0" width="35.0" x="460.0" y="110.0"></omgdc:Bounds> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1"> + <omgdi:waypoint x="215.0" y="127.0"></omgdi:waypoint> + <omgdi:waypoint x="460.0" y="127.0"></omgdi:waypoint> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</definitions> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/syncope/blob/7a440618/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksPanel.html ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksPanel.html index c4ab06e..65a7eb7 100644 --- a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksPanel.html +++ b/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksPanel.html @@ -63,6 +63,7 @@ under the License. <span wicket:id="panelNotificationTasks">[plus]</span> <span wicket:id="panelDeprovisionMembers">[plus]</span> <span wicket:id="panelProvisionMembers">[plus]</span> + <span wicket:id="panelWorkflowModeler">[plus]</span> <span wicket:id="panelDelete">[plus]</span> <span wicket:id="panelSelect">[select]</span> <span wicket:id="panelClose">[close]</span> @@ -287,6 +288,10 @@ under the License. <a href="#" wicket:id="zoomOutLink" class="btn"><i class="fa fa-search-minus" alt="zoom out icon" title="Zoom Out"></i></a> </wicket:fragment> + <wicket:fragment wicket:id="fragmentWorkflowModeler"> + <a wicket:id="workflowModelerLink" class="btn"><i class="fa fa-picture-o" alt="picture icon" title="Workflow Modeler"></i></a> + </wicket:fragment> + <wicket:fragment wicket:id="emptyFragment"> </wicket:fragment> </wicket:panel> http://git-wip-us.apache.org/repos/asf/syncope/blob/7a440618/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/ImageModalPanel.html ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/ImageModalPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/ImageModalPanel.html new file mode 100644 index 0000000..eca8d93 --- /dev/null +++ b/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/ImageModalPanel.html @@ -0,0 +1,23 @@ +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> +<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org"> + <wicket:panel> + <img wicket:id="image" style="width: 100%;"/> + </wicket:panel> +</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/syncope/blob/7a440618/client/console/src/main/resources/org/apache/syncope/client/console/wizards/WizardMgtPanel.html ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/WizardMgtPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/WizardMgtPanel.html index 0a0d409..80736d2 100644 --- a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/WizardMgtPanel.html +++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/WizardMgtPanel.html @@ -43,10 +43,10 @@ under the License. <wicket:enclosure child="add"> <div class="modal-footer" style="text-align: right"> - <a haref="#" class="btn btn-default btn-circle btn-lg pull-left" wicket:id="exit"> + <a href="#" class="btn btn-default btn-circle btn-lg pull-left" wicket:id="exit"> <i class="fa fa-sign-out"></i> </a> - <a haref="#" class="btn btn-primary btn-circle btn-lg" wicket:id="add"> + <a href="#" class="btn btn-primary btn-circle btn-lg" wicket:id="add"> <i class="glyphicon glyphicon-plus"></i> </a> </div>