diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/CountToolbar.html b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/CountToolbar.html index cf36aac77d7..1de7a3bb10f 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/CountToolbar.html +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/CountToolbar.html @@ -20,25 +20,8 @@ - - - - - - +
- diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/CountToolbar.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/CountToolbar.java index 72262cec300..9cdf9c6c60f 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/CountToolbar.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/CountToolbar.java @@ -1,7 +1,9 @@ package com.evolveum.midpoint.web.component.data; import com.evolveum.midpoint.web.component.util.LoadableModel; +import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour; import org.apache.wicket.AttributeModifier; +import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractToolbar; import org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable; import org.apache.wicket.markup.html.WebMarkupContainer; @@ -19,6 +21,7 @@ public class CountToolbar extends AbstractToolbar { private static final String ID_TD = "td"; private static final String ID_COUNT = "count"; + private static final String ID_PAGE_SIZE = "pageSize"; public CountToolbar(DataTable table) { super(table); @@ -41,6 +44,22 @@ public String getObject() { Label count = new Label(ID_COUNT, createModel()); count.setRenderBodyOnly(true); td.add(count); + + PageSizePopover popover = new PageSizePopover(ID_PAGE_SIZE) { + + @Override + protected void pageSizeChanged(AjaxRequestTarget target) { + CountToolbar.this.pageSizeChanged(target); + } + }; + popover.add(new VisibleEnableBehaviour() { + + @Override + public boolean isVisible() { + return CountToolbar.this.isPageSizePopupVisible(); + } + }); + td.add(popover); } private IModel createModel() { @@ -84,4 +103,11 @@ protected String load() { } }; } + + protected void pageSizeChanged(AjaxRequestTarget target) { + } + + protected boolean isPageSizePopupVisible() { + return true; + } } diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/PageSizePopover.html b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/PageSizePopover.html new file mode 100644 index 00000000000..b02eb434ff0 --- /dev/null +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/PageSizePopover.html @@ -0,0 +1,42 @@ + + + + + + + +
+
+

+
+
+
+ + + + +
+
+
+
+
+ diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/PageSizePopover.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/PageSizePopover.java new file mode 100644 index 00000000000..11d08ce9f04 --- /dev/null +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/PageSizePopover.java @@ -0,0 +1,109 @@ +package com.evolveum.midpoint.web.component.data; + +import com.evolveum.midpoint.web.component.AjaxSubmitButton; +import com.evolveum.midpoint.web.component.util.SimplePanel; +import com.evolveum.midpoint.web.session.UserProfileStorage; +import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.markup.head.IHeaderResponse; +import org.apache.wicket.markup.head.OnDomReadyHeaderItem; +import org.apache.wicket.markup.html.WebMarkupContainer; +import org.apache.wicket.markup.html.form.Button; +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.markup.html.form.TextField; +import org.apache.wicket.model.IModel; +import org.apache.wicket.validation.validator.RangeValidator; + +/** + * @author lazyman + */ +public class PageSizePopover extends SimplePanel { + + private static final String ID_POP_BUTTON = "popButton"; + private static final String ID_POPOVER = "popover"; + private static final String ID_FORM = "form"; + private static final String ID_INPUT = "input"; + private static final String ID_BUTTON = "button"; + + public PageSizePopover(String id) { + super(id); + setRenderBodyOnly(true); + } + + @Override + public void renderHead(IHeaderResponse response) { + super.renderHead(response); + + StringBuilder sb = new StringBuilder(); + sb.append("initPageSizePopover('").append(get(ID_POP_BUTTON).getMarkupId()); + sb.append("','").append(get(ID_POPOVER).getMarkupId()); + sb.append("');"); + + response.render(OnDomReadyHeaderItem.forScript(sb.toString())); + } + + + @Override + protected void initLayout() { + Button popButton = new Button(ID_POP_BUTTON); + popButton.setOutputMarkupId(true); + add(popButton); + + WebMarkupContainer popover = new WebMarkupContainer(ID_POPOVER); + popover.setOutputMarkupId(true); + add(popover); + + Form form = new Form(ID_FORM); + popover.add(form); + + TextField input = new TextField(ID_INPUT, createInputModel()); + input.add(new RangeValidator(5, 50)); + input.setLabel(createStringResource("PageSizePopover.title")); + input.setType(Integer.class); + form.add(input); + + AjaxSubmitButton button = new AjaxSubmitButton(ID_BUTTON) { + + @Override + protected void onError(AjaxRequestTarget target, Form form) { + super.onError(target, form); + target.add(getPageBase().getFeedbackPanel()); + } + + @Override + protected void onSubmit(AjaxRequestTarget target, Form form) { + super.onSubmit(target, form); + + pageSizeChanged(target); + } + }; + form.add(button); + } + + private IModel createInputModel() { + return new IModel() { + + @Override + public Integer getObject() { + TablePanel tablePanel = findParent(TablePanel.class); + UserProfileStorage.TableId tableId = tablePanel.getTableId(); + + return getPageBase().getSessionStorage().getUserProfile().getPagingSize(tableId); + } + + @Override + public void setObject(Integer o) { + TablePanel tablePanel = findParent(TablePanel.class); + UserProfileStorage.TableId tableId = tablePanel.getTableId(); + + getPageBase().getSessionStorage().getUserProfile().setPagingSize(tableId, o); + } + + @Override + public void detach() { + } + }; + } + + protected void pageSizeChanged(AjaxRequestTarget target) { + } +} diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/PageSizePopover.properties b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/PageSizePopover.properties new file mode 100644 index 00000000000..f6613ae9b84 --- /dev/null +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/PageSizePopover.properties @@ -0,0 +1 @@ +PageSizePopover.title=Page size \ No newline at end of file diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/TablePanel.html b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/TablePanel.html index 9928735b28b..a3617206936 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/TablePanel.html +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/TablePanel.html @@ -18,9 +18,6 @@ - -
- diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/TablePanel.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/TablePanel.java index d331bf673b1..df397b9c727 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/TablePanel.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/TablePanel.java @@ -18,8 +18,6 @@ import com.evolveum.midpoint.prism.query.ObjectPaging; import com.evolveum.midpoint.web.component.data.paging.NavigatorPanel; -import com.evolveum.midpoint.web.component.data.paging.PagingSizePanel; -import com.evolveum.midpoint.web.component.util.LoadableModel; import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour; import com.evolveum.midpoint.web.page.PageBase; import com.evolveum.midpoint.web.session.UserProfileStorage; @@ -31,12 +29,9 @@ import org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable; import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn; import org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider; -import org.apache.wicket.markup.html.navigation.paging.IPageable; import org.apache.wicket.markup.html.panel.Panel; -import org.apache.wicket.markup.repeater.data.DataViewBase; import org.apache.wicket.model.IModel; import org.apache.wicket.model.Model; -import org.apache.wicket.model.StringResourceModel; import java.util.List; @@ -47,17 +42,18 @@ public class TablePanel extends Panel { private static final String ID_TABLE = "table"; private static final String ID_PAGING = "paging"; - private static final String ID_PAGING_SIZE = "pagingSize"; private IModel showPaging = new Model(true); private IModel showCount = new Model(true); private IModel showPagingSize = new Model(false); + private UserProfileStorage.TableId tableId; + public TablePanel(String id, ISortableDataProvider provider, List> columns) { - this(id, provider, columns, UserProfileStorage.DEFAULT_PAGING_SIZE, null); + this(id, provider, columns, null); } - public TablePanel(String id, ISortableDataProvider provider, List> columns, int itemsPerPage, + public TablePanel(String id, ISortableDataProvider provider, List> columns, UserProfileStorage.TableId tableId) { super(id); Validate.notNull(provider, "Object type must not be null."); @@ -65,19 +61,48 @@ public TablePanel(String id, ISortableDataProvider provider, List> columns, final int itemsPerPage, ISortableDataProvider provider, - final UserProfileStorage.TableId tableId) { - DataTable table = new SelectableDataTable(ID_TABLE, columns, provider, itemsPerPage); + @Override + protected void onInitialize() { + super.onInitialize(); + + DataTable table = (DataTable) get(ID_TABLE); + PageBase page = (PageBase) getPage(); + UserProfileStorage userProfile = page.getSessionStorage().getUserProfile(); + table.setItemsPerPage(userProfile.getPagingSize(tableId)); + } + + private void initLayout(List> columns, ISortableDataProvider provider) { + DataTable table = new SelectableDataTable(ID_TABLE, columns, provider, + UserProfileStorage.DEFAULT_PAGING_SIZE); + table.setOutputMarkupId(true); TableHeadersToolbar headers = new TableHeadersToolbar(table, provider); headers.setOutputMarkupId(true); table.addTopToolbar(headers); - CountToolbar count = new CountToolbar(table); + CountToolbar count = new CountToolbar(table) { + + @Override + protected void pageSizeChanged(AjaxRequestTarget target) { + PageBase page = (PageBase) getPage(); + Integer pageSize = page.getSessionStorage().getUserProfile().getPagingSize(tableId); + + setItemsPerPage(pageSize); + target.add(getNavigatorPanel()); + target.add(getDataTable()); + } + + @Override + protected boolean isPageSizePopupVisible() { + return showPagingSize.getObject(); + } + }; addVisibleBehaviour(count, showCount); table.addBottomToolbar(count); @@ -86,20 +111,10 @@ private void initLayout(List> columns, final int itemsPerPage NavigatorPanel nb2 = new NavigatorPanel(ID_PAGING, table, showPagedPaging(provider)); addVisibleBehaviour(nb2, showPaging); add(nb2); + } - PagingSizePanel pagingSizePanel = new PagingSizePanel(ID_PAGING_SIZE, tableId){ - - @Override - protected void pagingSizeChangePerformed(AjaxRequestTarget target){ - Integer pageSize = getPagingSize(); - getPageBase().getSessionStorage().getUserProfile().setPagingSize(tableId, pageSize); - setItemsPerPage(pageSize); - target.add(getNavigatorPanel()); - target.add(getDataTable()); - } - }; - addVisibleBehaviour(pagingSizePanel, showPagingSize); - add(pagingSizePanel); + public UserProfileStorage.TableId getTableId() { + return tableId; } private void addVisibleBehaviour(Component comp, final IModel model) { @@ -125,7 +140,7 @@ public DataTable getDataTable() { return (DataTable) get(ID_TABLE); } - public NavigatorPanel getNavigatorPanel(){ + public NavigatorPanel getNavigatorPanel() { return (NavigatorPanel) get(ID_PAGING); } @@ -148,7 +163,7 @@ public void setCurrentPage(ObjectPaging paging) { getDataTable().setCurrentPage(page); } - public void setShowPagingSize(boolean show){ + public void setShowPagingSize(boolean show) { this.showPagingSize.setObject(show); } diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/paging/PagingSizePanel.html b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/paging/PagingSizePanel.html deleted file mode 100644 index f83640efe39..00000000000 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/paging/PagingSizePanel.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - -
- -
- - -
- -
- - - - - - -
-
- \ No newline at end of file diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/paging/PagingSizePanel.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/paging/PagingSizePanel.java deleted file mode 100644 index 6d852f47c7b..00000000000 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/paging/PagingSizePanel.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2010-2013 Evolveum - * - * Licensed 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 com.evolveum.midpoint.web.component.data.paging; - -import com.evolveum.midpoint.web.component.AjaxSubmitButton; -import com.evolveum.midpoint.web.component.util.LoadableModel; -import com.evolveum.midpoint.web.component.util.SimplePanel; -import com.evolveum.midpoint.web.session.UserProfileStorage; -import com.evolveum.midpoint.web.util.SearchFormEnterBehavior; -import org.apache.wicket.AttributeModifier; -import org.apache.wicket.Component; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.markup.html.form.TextField; -import org.apache.wicket.model.IModel; -import org.apache.wicket.validation.validator.RangeValidator; - -/** - * @author shood - * */ -public class PagingSizePanel extends SimplePanel { - - private static final String ID_FORM_PAGING = "pagingForm"; - private static final String ID_PAGING_SIZE = "pagingSize"; - private static final String ID_SET_PAGING_BUTTON = "setPagingButton"; - - private IModel pagingModel; - - public PagingSizePanel(String id, final UserProfileStorage.TableId tableId){ - super(id); - - pagingModel = new LoadableModel() { - - @Override - protected Integer load() { - return getPageBase().getSessionStorage().getUserProfile().getPagingSize(tableId); - } - }; - - Form pagingForm = new Form(ID_FORM_PAGING); - pagingForm.setOutputMarkupId(true); - add(pagingForm); - - initLayout(pagingForm); - } - - public Integer getPagingSize(){ - return pagingModel.getObject(); - } - - private void initLayout(Form form){ - AjaxSubmitButton setPagingButton = new AjaxSubmitButton(ID_SET_PAGING_BUTTON, - createStringResource("PagingSizePanel.button.set")) { - - @Override - protected void onSubmit(AjaxRequestTarget target, Form form){ - pagingSizeChangePerformed(target); - } - - @Override - protected void onError(AjaxRequestTarget target, Form form){ - target.add(getFeedbackPanel()); - } - }; - form.add(setPagingButton); - - final TextField pagingText = new TextField(ID_PAGING_SIZE, pagingModel); - pagingText.setType(Integer.class); - pagingText.add(new RangeValidator(1,50)); - pagingText.add(AttributeModifier.replace("placeholder", createStringResource("PagingSizePanel.label.pagingSize"))); - pagingText.add(new SearchFormEnterBehavior(setPagingButton)); - form.add(pagingText); - } - - private Component getFeedbackPanel() { - return getPageBase().getFeedbackPanel(); - } - - protected void pagingSizeChangePerformed(AjaxRequestTarget target){} - - -} \ No newline at end of file diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/paging/PagingSizePanel.properties b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/paging/PagingSizePanel.properties deleted file mode 100644 index 2b461ba9f91..00000000000 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/paging/PagingSizePanel.properties +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright (c) 2010-2013 Evolveum -# -# Licensed 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. -# - -PagingSizePanel.button.set=Set -PagingSizePanel.label.pagingSize=Paging size \ No newline at end of file diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageAccounts.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageAccounts.java index 59f0b464787..1a3ce7995ef 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageAccounts.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageAccounts.java @@ -201,8 +201,7 @@ public void onClick(AjaxRequestTarget target) { ObjectDataProvider provider = new ObjectDataProvider(this, ShadowType.class); provider.setOptions(SelectorOptions.createCollection(GetOperationOptions.createRaw())); provider.setQuery(ObjectQuery.createObjectQuery(createResourceQueryFilter())); - TablePanel accounts = new TablePanel(ID_ACCOUNTS, provider, createAccountsColumns(), - getPagingSize(UserProfileStorage.TableId.CONF_PAGE_ACCOUNTS), UserProfileStorage.TableId.CONF_PAGE_ACCOUNTS); + TablePanel accounts = new TablePanel(ID_ACCOUNTS, provider, createAccountsColumns(), UserProfileStorage.TableId.CONF_PAGE_ACCOUNTS); accounts.setShowPagingSize(true); accounts.add(new VisibleEnableBehaviour() { diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageDebugList.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageDebugList.java index 2fb98f34cb7..0cc04526521 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageDebugList.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageDebugList.java @@ -207,8 +207,7 @@ private void addOrReplaceTable(RepositoryObjectDataProvider provider) { provider.setQuery(createQuery()); Form mainForm = (Form) get(ID_MAIN_FORM); - TablePanel table = new TablePanel(ID_TABLE, provider, initColumns(provider.getType()), - getPagingSize(UserProfileStorage.TableId.CONF_DEBUG_LIST_PANEL), UserProfileStorage.TableId.CONF_DEBUG_LIST_PANEL); + TablePanel table = new TablePanel(ID_TABLE, provider, initColumns(provider.getType()), UserProfileStorage.TableId.CONF_DEBUG_LIST_PANEL); table.setShowPagingSize(true); table.setOutputMarkupId(true); mainForm.addOrReplace(table); diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageDebugView.html b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageDebugView.html index 7ca070a0c8c..013d7ac1509 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageDebugView.html +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageDebugView.html @@ -36,6 +36,10 @@ +
diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageDebugView.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageDebugView.java index a584d490dd4..529d38a20ef 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageDebugView.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageDebugView.java @@ -79,6 +79,7 @@ public class PageDebugView extends PageAdminConfiguration { private IModel model; private AceEditor editor; private final IModel encrypt = new Model(true); + private final IModel saveAsRaw = new Model<>(true); private final IModel validateSchema = new Model(false); public PageDebugView() { @@ -169,6 +170,13 @@ protected void onUpdate(AjaxRequestTarget target) { } }); + mainForm.add(new AjaxCheckBox("saveAsRaw", saveAsRaw) { + + @Override + protected void onUpdate(AjaxRequestTarget target) { + } + }); + mainForm.add(new AjaxCheckBox("validateSchema", validateSchema) { @Override @@ -280,8 +288,10 @@ public void savePerformed(AjaxRequestTarget target) { } Collection> deltas = (Collection) MiscUtil.createCollection(delta); - ModelExecuteOptions options = ModelExecuteOptions.createRaw(); - + ModelExecuteOptions options = new ModelExecuteOptions(); + if (saveAsRaw.getObject()) { + options.setRaw(true); + } if(!encrypt.getObject()) { options.setNoCrypt(true); } diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageDebugView.properties b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageDebugView.properties index 12708214d20..f653a3fed29 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageDebugView.properties +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageDebugView.properties @@ -21,5 +21,6 @@ pageDebugView.options=Options pageDebugView.edit=Edit pageDebugView.encrypt=Protected by encryption pageDebugView.validateSchema=Validate schema +pageDebugView.saveAsRaw=Save in raw mode pageDebugView.message.cantSaveEmpty=Can't save empty xml. pageDebugView.message.oidNotDefined=Object oid is not defined. diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/reports/PageCreatedReports.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/reports/PageCreatedReports.java index a609385a89a..790c62dd12e 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/reports/PageCreatedReports.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/reports/PageCreatedReports.java @@ -183,8 +183,7 @@ protected void saveProviderPaging(ObjectQuery query, ObjectPaging paging) { provider.setQuery(query); - TablePanel table = new TablePanel(ID_CREATED_REPORTS_TABLE, provider, initColumns(ajaxDownloadBehavior), - getPagingSize(UserProfileStorage.TableId.PAGE_CREATED_REPORTS_PANEL), UserProfileStorage.TableId.PAGE_CREATED_REPORTS_PANEL); + TablePanel table = new TablePanel(ID_CREATED_REPORTS_TABLE, provider, initColumns(ajaxDownloadBehavior), UserProfileStorage.TableId.PAGE_CREATED_REPORTS_PANEL); table.setShowPagingSize(true); table.setShowPaging(true); table.setOutputMarkupId(true); diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/PageResource.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/PageResource.java index 105f45f86cd..4039487800d 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/PageResource.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/PageResource.java @@ -118,11 +118,11 @@ private void initLayout() { Form mainForm = new Form("mainForm"); add(mainForm); - SortableDataProvider provider = new ListDataProvider(this, + SortableDataProvider provider = new ListDataProvider<>(this, new PropertyModel>(model, "objectTypes")); provider.setSort("displayName", SortOrder.ASCENDING); - TablePanel objectTypes = new TablePanel("objectTypesTable", provider, - initObjectTypesColumns(), getPagingSize(UserProfileStorage.TableId.PAGE_RESOURCE_PANEL), UserProfileStorage.TableId.PAGE_RESOURCE_PANEL); + TablePanel objectTypes = new TablePanel<>("objectTypesTable", provider, + initObjectTypesColumns(), UserProfileStorage.TableId.PAGE_RESOURCE_PANEL); objectTypes.setShowPagingSize(true); objectTypes.setShowPaging(true); objectTypes.setOutputMarkupId(true); @@ -136,11 +136,11 @@ private void initLayout() { } private void initResourceColumns(Form mainForm) { - mainForm.add(new Label("resourceOid", new PropertyModel(model, "oid"))); - mainForm.add(new Label("resourceName", new PropertyModel(model, "name"))); - mainForm.add(new Label("resourceType", new PropertyModel(model, "type"))); - mainForm.add(new Label("resourceVersion", new PropertyModel(model, "version"))); - mainForm.add(new Label("resourceProgress", new PropertyModel(model, "progress"))); + mainForm.add(new Label("resourceOid", new PropertyModel<>(model, "oid"))); + mainForm.add(new Label("resourceName", new PropertyModel<>(model, "name"))); + mainForm.add(new Label("resourceType", new PropertyModel<>(model, "type"))); + mainForm.add(new Label("resourceVersion", new PropertyModel<>(model, "version"))); + mainForm.add(new Label("resourceProgress", new PropertyModel<>(model, "progress"))); } private IModel createTestConnectionStateTooltip(final String expression) { diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/PageResources.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/PageResources.java index abf6add9f06..d07f8a8649b 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/PageResources.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/PageResources.java @@ -143,7 +143,7 @@ private void initLayout() { add(mainForm); TablePanel resources = new TablePanel<>(ID_TABLE, initResourceDataProvider(), initResourceColumns(), - getPagingSize(UserProfileStorage.TableId.PAGE_RESOURCES_PANEL), UserProfileStorage.TableId.PAGE_RESOURCES_PANEL); + UserProfileStorage.TableId.PAGE_RESOURCES_PANEL); resources.setShowPagingSize(true); resources.setOutputMarkupId(true); mainForm.add(resources); diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/content/PageContentAccounts.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/content/PageContentAccounts.java index cfce8445d10..3d9df07c896 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/content/PageContentAccounts.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/content/PageContentAccounts.java @@ -237,8 +237,7 @@ protected void addInlineMenuToDto(AccountContentDto dto) { provider.setQuery(createQuery()); List columns = initColumns(); - TablePanel table = new TablePanel(ID_TABLE, provider, columns, - getPagingSize(UserProfileStorage.TableId.PAGE_RESOURCE_ACCOUNTS_PANEL), UserProfileStorage.TableId.PAGE_RESOURCE_ACCOUNTS_PANEL); + TablePanel table = new TablePanel(ID_TABLE, provider, columns, UserProfileStorage.TableId.PAGE_RESOURCE_ACCOUNTS_PANEL); table.setShowPagingSize(true); table.setOutputMarkupId(true); mainForm.add(table); diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/roles/PageRoles.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/roles/PageRoles.java index 0627ebf4252..9ad2b67e56a 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/roles/PageRoles.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/roles/PageRoles.java @@ -128,8 +128,7 @@ protected void saveProviderPaging(ObjectQuery query, ObjectPaging paging) { provider.setQuery(createQuery()); List> columns = initColumns(); - TablePanel table = new TablePanel<>(ID_TABLE, provider, columns, getPagingSize(UserProfileStorage.TableId.TABLE_ROLES), - UserProfileStorage.TableId.TABLE_ROLES); + TablePanel table = new TablePanel<>(ID_TABLE, provider, columns, UserProfileStorage.TableId.TABLE_ROLES); table.setOutputMarkupId(true); table.setShowPagingSize(true); RolesStorage storage = getSessionStorage().getRoles(); diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/server/PageTasks.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/server/PageTasks.java index 7c116a78223..afdb9bddd88 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/server/PageTasks.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/server/PageTasks.java @@ -158,7 +158,7 @@ private void initLayout() { provider.setQuery(createTaskQuery()); TablePanel taskTable = new TablePanel<>(ID_TASK_TABLE, provider, taskColumns, - getPagingSize(UserProfileStorage.TableId.PAGE_TASKS_PANEL), UserProfileStorage.TableId.PAGE_TASKS_PANEL); + UserProfileStorage.TableId.PAGE_TASKS_PANEL); taskTable.setShowPagingSize(true); taskTable.setOutputMarkupId(true); mainForm.add(taskTable); diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUsers.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUsers.java index be943beff8d..dde9558c15e 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUsers.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUsers.java @@ -307,8 +307,7 @@ public UserListItemDto createDataObjectWrapper(PrismObject obj) { GetOperationOptions.createRetrieve(RetrieveOption.INCLUDE))); provider.setOptions(options); - TablePanel table = new TablePanel(ID_TABLE, provider, columns, - getPagingSize(UserProfileStorage.TableId.PAGE_USERS_PANEL), UserProfileStorage.TableId.PAGE_USERS_PANEL); + TablePanel table = new TablePanel(ID_TABLE, provider, columns, UserProfileStorage.TableId.PAGE_USERS_PANEL); table.setShowPagingSize(true); table.setOutputMarkupId(true); diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/workflow/PageWorkItems.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/workflow/PageWorkItems.java index 5c63471a95c..acd0ea777e5 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/workflow/PageWorkItems.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/workflow/PageWorkItems.java @@ -92,7 +92,7 @@ private void initLayout() { List> workItemColumns = initWorkItemColumns(); TablePanel workItemTable = new TablePanel<>("workItemTable", new WorkItemDtoProvider(PageWorkItems.this, assigned), - workItemColumns, getPagingSize(UserProfileStorage.TableId.PAGE_WORK_ITEMS), UserProfileStorage.TableId.PAGE_WORK_ITEMS); + workItemColumns, UserProfileStorage.TableId.PAGE_WORK_ITEMS); workItemTable.setShowPagingSize(true); workItemTable.setOutputMarkupId(true); mainForm.add(workItemTable); diff --git a/gui/admin-gui/src/main/webapp/js/midpoint/midpoint.js b/gui/admin-gui/src/main/webapp/js/midpoint/midpoint.js index 56a9a292e12..4806578c99c 100755 --- a/gui/admin-gui/src/main/webapp/js/midpoint/midpoint.js +++ b/gui/admin-gui/src/main/webapp/js/midpoint/midpoint.js @@ -120,4 +120,27 @@ function updateBodyTopPadding() { function updateBodyTopPaddingReal() { var menuHeight = $(".navbar-fixed-top").outerHeight(false); $("body").css("padding-top", menuHeight + "px"); +} + +/** + * Used in PageSizePopover class, in table panel. + * + * @param buttonId + * @param popoverId + */ +function initPageSizePopover(buttonId, popoverId) { + var button = $('#' + buttonId); + button.click(function () { + var popover = $('#' + popoverId); + + var position = button.position(); + + var left = position.left - popover.outerWidth(); + var top = position.top + button.outerHeight() / 2 - popover.outerHeight() / 2; + + popover.css("top", top); + popover.css("left", left); + + popover.toggle(); + }); } \ No newline at end of file diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/PrismBeanConverter.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/PrismBeanConverter.java index d6f8e8f6aa9..bb65e2a87a3 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/PrismBeanConverter.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/PrismBeanConverter.java @@ -257,7 +257,7 @@ public T unmarshall(MapXNode xnode, Class beanClass) throws SchemaExcepti // This is the case of Collection> // we need to exctract the specific type from the factory method if (elementMethod == null){ - throw new IllegalArgumentException("Wildcard type in JAXBElement field specification and no facotry method found for field "+fieldName+" in "+beanClass+", cannot determine collection type (inner type argument)"); + throw new IllegalArgumentException("Wildcard type in JAXBElement field specification and no factory method found for field "+fieldName+" in "+beanClass+", cannot determine collection type (inner type argument)"); } Type factoryMethodGenericReturnType = elementMethod.getGenericReturnType(); Type factoryMethodTypeArgument = getTypeArgument(factoryMethodGenericReturnType, "in factory method "+elementMethod+" return type for field "+fieldName+" in "+beanClass+", cannot determine collection type"); @@ -428,7 +428,7 @@ private T unmarshalSearchFilterType(MapXNode xmap, return filterType; } - private XNode marshalSearchFilterType(SearchFilterType value) throws SchemaException { + private MapXNode marshalSearchFilterType(SearchFilterType value) throws SchemaException { if (value == null) { return null; } @@ -624,32 +624,39 @@ public XNode marshall(T bean) throws SchemaException { return xProtected; } else if (bean instanceof ItemPathType){ return marshalItemPathType((ItemPathType) bean); - } else if (bean instanceof SearchFilterType) { - return marshalSearchFilterType((SearchFilterType) bean); } else if (bean instanceof RawType) { return marshalRawValue((RawType) bean); } else if (bean instanceof XmlAsStringType) { return marshalXmlAsStringType((XmlAsStringType) bean); - } - else if (prismContext != null && prismContext.getSchemaRegistry().determineDefinitionFromClass(bean.getClass()) != null){ + } else if (prismContext != null && prismContext.getSchemaRegistry().determineDefinitionFromClass(bean.getClass()) != null){ return prismContext.getXnodeProcessor().serializeObject(((Objectable)bean).asPrismObject()).getSubnode(); } - - MapXNode xmap = new MapXNode(); - - Class beanClass = bean.getClass(); - - //check for enums - if (beanClass.isEnum()){ - String enumValue = XNodeProcessorUtil.findEnumFieldValue(beanClass, bean); - if (StringUtils.isEmpty(enumValue)){ - enumValue = bean.toString(); - } - QName fieldTypeName = inspector.findFieldTypeName(null, beanClass, DEFAULT_PLACEHOLDER); - return createPrimitiveXNode(enumValue, fieldTypeName, false); -// return marshallValue(bean, fieldTypeName, false); - } - + + // Note: SearchFilterType is treated below + + Class beanClass = bean.getClass(); + + //check for enums + if (beanClass.isEnum()){ + String enumValue = XNodeProcessorUtil.findEnumFieldValue(beanClass, bean); + if (StringUtils.isEmpty(enumValue)){ + enumValue = bean.toString(); + } + QName fieldTypeName = inspector.findFieldTypeName(null, beanClass, DEFAULT_PLACEHOLDER); + return createPrimitiveXNode(enumValue, fieldTypeName, false); + } + + MapXNode xmap; + if (bean instanceof SearchFilterType) { + // this hack is here because of c:ConditionalSearchFilterType - it is analogous to situation when unmarshalling this type (TODO: rework this in a nicer way) + xmap = marshalSearchFilterType((SearchFilterType) bean); + if (SearchFilterType.class.equals(bean.getClass())) { + return xmap; // nothing more to serialize; otherwise we continue, because in that case we deal with a subclass of SearchFilterType + } + } else { + xmap = new MapXNode(); + } + XmlType xmlType = beanClass.getAnnotation(XmlType.class); if (xmlType == null) { throw new IllegalArgumentException("Cannot marshall "+beanClass+" it does not have @XmlType annotation"); diff --git a/infra/prism/src/main/java/com/evolveum/prism/xml/ns/_public/query_3/SearchFilterType.java b/infra/prism/src/main/java/com/evolveum/prism/xml/ns/_public/query_3/SearchFilterType.java index b62a2fd59c6..7f7e33bc5bd 100644 --- a/infra/prism/src/main/java/com/evolveum/prism/xml/ns/_public/query_3/SearchFilterType.java +++ b/infra/prism/src/main/java/com/evolveum/prism/xml/ns/_public/query_3/SearchFilterType.java @@ -73,9 +73,7 @@ @XmlAccessorType(XmlAccessType.NONE) // we select getters/fields to expose via JAXB individually -@XmlType(name = "SearchFilterType", propOrder = { - "description", - "filterClause", +@XmlType(name = "SearchFilterType", propOrder = { // no prop order, because we serialize this class manually }) public class SearchFilterType implements Serializable, Cloneable, Equals, HashCode, DebugDumpable, Revivable { diff --git a/infra/schema/src/test/resources/common/resource-opendj.xml b/infra/schema/src/test/resources/common/resource-opendj.xml index fc1aa1fb3b0..9c207774057 100644 --- a/infra/schema/src/test/resources/common/resource-opendj.xml +++ b/infra/schema/src/test/resources/common/resource-opendj.xml @@ -641,6 +641,9 @@ This is now the only account type that midPoint can work with. --> + + true + + + + + + + + Active Directory Group Sync + + A sample resource that synchronizes AD groups with midPoint roles. + + + + + + c:connectorType + Org.IdentityConnectors.ActiveDirectory.ActiveDirectoryConnector + + + + + + + + + + administrator + secret + User + dc=example,dc=com + true + localhost + false + example.com + localhost + localhost + + + + true + + + + + + + + + + + + account + Default Account + true + ri:AccountObjectClass + + + ri:givenName + Given Name + + + $user/givenName + + + + + $user/givenName + + + + + ri:sn + Surname + + + $user/familyName + + + + + $user/familyName + + + + + ri:sAMAccountName + Login name + + + $user/name + + + + + $user/name + + + + + + icfs:name + Distinguished Name + + + 0 + + + + + $user/name + + + + + + + + 5 + + + cn=Administrator,ou=Users,dc=example,dc=com + + + + + + + + + + + weak + + + + + + + + + + ri:group + AD Group Membership + entitlement + group + objectToSubject + ri:member + icfs:name + + + + + + + entitlement + AD Group + group + ri:CustomGroupObjectClass + true + + icfs:name + mr:stringIgnoreCase + + + $focus/name + + + + + + + + ri:cn + mr:stringIgnoreCase + + + $focus/name + + + + + $focus/name + + + + + ri:description + + strong + + description + + + + weak + + $focus/description + + + + + + + + + + + true + ri:AccountObjectClass + + + + Correlation expression is a search query. + Following search query will look for users that have "name" + equal to the "sAMAccountName" attribute of the account. Simply speaking, + it will look for match in usernames in the IDM and the resource. + The correlation rule always looks for users, so it will not match + any other object type. + + + c:name + + $shadow/attributes/sAMAccountName + + + + + + + + + linked + + + + deleted + + + + unlinked + + + + unmatched + + + + + + + true + ri:CustomGroupObjectClass + entitlement + group + c:RoleType + + + + c:name + + $shadow/attributes/sAMAccountName + + + + + linked + true + + + deleted + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#unlink + + + + unlinked + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#link + + + + unmatched + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#addFocus + + + + + + + + + Synchronization: Active Directory (users) + 11111111-2222-3333-4444-100000000000 + + runnable + http://midpoint.evolveum.com/xml/ns/public/model/synchronization/task/live-sync/handler-3 + + recurring + tight + + 5 + + + + + Synchronization: Active Directory (groups) + + entitlement + + 11111111-2222-3333-4444-100000000001 + + runnable + http://midpoint.evolveum.com/xml/ns/public/model/synchronization/task/live-sync/handler-3 + + recurring + tight + + 5 + + + +