You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by sk...@apache.org on 2019/10/31 11:49:52 UTC
[syncope] branch 2_1_X updated: [SYNCOPE-957] Very small fixes to
new Admin Console code
This is an automated email from the ASF dual-hosted git repository.
skylark17 pushed a commit to branch 2_1_X
in repository https://gitbox.apache.org/repos/asf/syncope.git
The following commit(s) were added to refs/heads/2_1_X by this push:
new a04ceea [SYNCOPE-957] Very small fixes to new Admin Console code
a04ceea is described below
commit a04ceea78a448e8d85531fb7e6821ec53be5a09d
Author: Matteo Alessandroni <ma...@tirasa.net>
AuthorDate: Thu Oct 31 12:47:19 2019 +0100
[SYNCOPE-957] Very small fixes to new Admin Console code
---
.../commons}/LinkedAccountPlainAttrProperty.java | 2 +-
.../console/panels/ConnObjectListViewPanel.java | 28 +++++-----------------
.../client/console/rest/BaseRestClient.java | 2 +-
.../client/console/rest/ResourceRestClient.java | 7 ++++--
.../client/console/wizards/any/EntityWrapper.java | 7 ++----
.../wizards/any/LinkedAccountCredentialsPanel.java | 2 +-
.../wizards/any/LinkedAccountDetailsPanel.java | 10 ++++----
.../wizards/any/LinkedAccountPlainAttrsPanel.java | 2 +-
.../any/LinkedAccountPlainAttrsPanel.properties | 17 -------------
.../any/LinkedAccountPlainAttrsPanel_it.properties | 17 -------------
.../any/LinkedAccountPlainAttrsPanel_ja.properties | 16 -------------
.../LinkedAccountPlainAttrsPanel_pt_BR.properties | 16 -------------
.../any/LinkedAccountPlainAttrsPanel_ru.properties | 16 -------------
.../syncope/common/lib/to/LinkedAccountTO.java | 3 +--
14 files changed, 23 insertions(+), 122 deletions(-)
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/LinkedAccountPlainAttrProperty.java b/client/console/src/main/java/org/apache/syncope/client/console/commons/LinkedAccountPlainAttrProperty.java
similarity index 98%
rename from common/lib/src/main/java/org/apache/syncope/common/lib/types/LinkedAccountPlainAttrProperty.java
rename to client/console/src/main/java/org/apache/syncope/client/console/commons/LinkedAccountPlainAttrProperty.java
index 2d6f1df..3f0468a 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/LinkedAccountPlainAttrProperty.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/commons/LinkedAccountPlainAttrProperty.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.syncope.common.lib.types;
+package org.apache.syncope.client.console.commons;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjectListViewPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjectListViewPanel.java
index afafa69..3fca624 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjectListViewPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjectListViewPanel.java
@@ -30,17 +30,13 @@ import org.apache.syncope.client.console.panels.ListViewPanel.ListViewReload;
import org.apache.syncope.client.console.panels.search.AbstractSearchPanel;
import org.apache.syncope.client.console.panels.search.ConnObjectSearchPanel;
import org.apache.syncope.client.console.panels.search.SearchClause;
-import org.apache.syncope.client.console.panels.search.SearchClausePanel;
-import org.apache.syncope.client.console.panels.search.SearchUtils;
import org.apache.syncope.client.console.rest.AnyTypeRestClient;
-import org.apache.syncope.client.console.rest.BaseRestClient;
import org.apache.syncope.client.console.rest.ResourceRestClient;
import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.CollectionPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
import org.apache.syncope.common.lib.to.AttrTO;
import org.apache.syncope.common.lib.to.ConnObjectTO;
import org.apache.syncope.client.console.wicket.markup.html.bootstrap.tabs.Accordion;
-import org.apache.syncope.client.lib.SyncopeClient;
import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.to.ResourceTO;
import org.apache.syncope.common.lib.types.AnyTypeKind;
@@ -132,7 +128,7 @@ public abstract class ConnObjectListViewPanel extends Panel {
accordion.setOutputMarkupId(true);
add(accordion.setEnabled(true).setVisible(true));
- final List<ConnObjectTO> listOfItems = reloadItems(resource.getKey(), anyType, null, null);
+ final List<ConnObjectTO> listOfItems = reloadItems(resource.getKey(), anyType, null);
final ListViewPanel.Builder<ConnObjectTO> builder = new ListViewPanel.Builder<ConnObjectTO>(
ConnObjectTO.class, pageRef) {
@@ -179,7 +175,7 @@ public abstract class ConnObjectListViewPanel extends Panel {
@Override
public void onClick(final AjaxRequestTarget target) {
- final List<ConnObjectTO> listOfItems = reloadItems(resource.getKey(), anyType, nextPageCookie, null);
+ final List<ConnObjectTO> listOfItems = reloadItems(resource.getKey(), anyType, nextPageCookie);
target.add(arrows);
send(ConnObjectListViewPanel.this, Broadcast.DEPTH, new ListViewReload<>(listOfItems, target));
}
@@ -193,18 +189,7 @@ public abstract class ConnObjectListViewPanel extends Panel {
@Override
public void onEvent(final IEvent<?> event) {
- if (event.getPayload() instanceof SearchClausePanel.SearchEvent) {
- this.nextPageCookie = null;
- final AjaxRequestTarget target = SearchClausePanel.SearchEvent.class.cast(event.getPayload()).getTarget();
- List<ConnObjectTO> listOfItems = reloadItems(resource.getKey(), anyType, null, SearchUtils.buildFIQL(
- ConnObjectListViewPanel.this.searchPanel.getModel().getObject(),
- SyncopeClient.getConnObjectTOFiqlSearchConditionBuilder(),
- ConnObjectListViewPanel.this.searchPanel.getAvailableSchemaTypes()));
- target.add(arrows);
- send(ConnObjectListViewPanel.this, Broadcast.DEPTH, new ListViewReload<>(listOfItems, target));
- } else {
- super.onEvent(event);
- }
+ super.onEvent(event);
}
protected abstract void viewConnObject(ConnObjectTO connObjectTO, AjaxRequestTarget target);
@@ -212,15 +197,14 @@ public abstract class ConnObjectListViewPanel extends Panel {
private List<ConnObjectTO> reloadItems(
final String resource,
final String anyType,
- final String cookie,
- final String fiql) {
+ final String cookie) {
Pair<String, List<ConnObjectTO>> items = new ResourceRestClient().searchConnObjects(resource,
anyType,
new ConnObjectTOQuery.Builder().
size(SIZE).
- pagedResultsCookie(cookie).
- orderBy(BaseRestClient.toOrderBy(new SortParam<>(ConnIdSpecialName.UID, true))).build());
+ pagedResultsCookie(cookie),
+ new SortParam<>(ConnIdSpecialName.UID, true));
nextPageCookie = items.getLeft();
return items.getRight();
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/BaseRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/BaseRestClient.java
index 1d259c0..ecea2ae 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/BaseRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/BaseRestClient.java
@@ -55,7 +55,7 @@ public abstract class BaseRestClient implements RestClient {
SyncopeConsoleSession.get().resetClient(serviceClass);
}
- public static String toOrderBy(final SortParam<String> sort) {
+ protected static String toOrderBy(final SortParam<String> sort) {
OrderByClauseBuilder builder = SyncopeClient.getOrderByClauseBuilder();
String property = sort.getProperty();
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java
index d2ba042..22d073b 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java
@@ -29,6 +29,7 @@ import org.apache.syncope.common.lib.to.PagedConnObjectTOResult;
import org.apache.syncope.common.lib.to.ResourceTO;
import org.apache.syncope.common.rest.api.beans.ConnObjectTOQuery;
import org.apache.syncope.common.rest.api.service.ResourceService;
+import org.apache.wicket.extensions.markup.html.repeater.util.SortParam;
/**
* Console client for invoking Rest Resources services.
@@ -58,14 +59,16 @@ public class ResourceRestClient extends BaseRestClient {
public Pair<String, List<ConnObjectTO>> searchConnObjects(
final String resource,
final String anyTypeKey,
- final ConnObjectTOQuery query) {
+ final ConnObjectTOQuery.Builder queryBuilder,
+ final SortParam<String> sortParam) {
final List<ConnObjectTO> result = new ArrayList<>();
String nextPageResultCookie = null;
PagedConnObjectTOResult list;
try {
- list = getService(ResourceService.class).searchConnObjects(resource, anyTypeKey, query);
+ queryBuilder.orderBy(toOrderBy(sortParam));
+ list = getService(ResourceService.class).searchConnObjects(resource, anyTypeKey, queryBuilder.build());
result.addAll(list.getResult());
nextPageResultCookie = list.getPagedResultsCookie();
} catch (Exception e) {
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/EntityWrapper.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/EntityWrapper.java
index 4200b35..faeb867 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/EntityWrapper.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/EntityWrapper.java
@@ -18,12 +18,9 @@
*/
package org.apache.syncope.client.console.wizards.any;
-import java.io.Serializable;
-import org.apache.syncope.common.lib.BaseBean;
+import org.apache.syncope.common.lib.to.EntityTO;
-public class EntityWrapper<T extends BaseBean> implements Serializable {
-
- private static final long serialVersionUID = -187286422128231810L;
+public class EntityWrapper<T extends EntityTO> {
protected final T entityTO;
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/LinkedAccountCredentialsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/LinkedAccountCredentialsPanel.java
index 959fb38..4ad319a 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/LinkedAccountCredentialsPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/LinkedAccountCredentialsPanel.java
@@ -26,7 +26,7 @@ import org.apache.syncope.client.console.wicket.markup.html.form.AjaxPasswordFie
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.FieldPanel;
import org.apache.syncope.common.lib.to.LinkedAccountTO;
-import org.apache.syncope.common.lib.types.LinkedAccountPlainAttrProperty;
+import org.apache.syncope.client.console.commons.LinkedAccountPlainAttrProperty;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.wizard.WizardStep;
import org.apache.wicket.markup.ComponentTag;
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/LinkedAccountDetailsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/LinkedAccountDetailsPanel.java
index e9fc994..ca8be3e 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/LinkedAccountDetailsPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/LinkedAccountDetailsPanel.java
@@ -28,7 +28,6 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.client.console.commons.ConnIdSpecialName;
import org.apache.syncope.client.console.commons.Constants;
-import org.apache.syncope.client.console.rest.BaseRestClient;
import org.apache.syncope.client.console.rest.ResourceRestClient;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
@@ -57,6 +56,8 @@ public class LinkedAccountDetailsPanel extends WizardStep {
private static final Logger LOG = LoggerFactory.getLogger(LinkedAccountDetailsPanel.class);
+ private static final int SEARCH_SIZE = 20;
+
private final ResourceRestClient resourceRestClient = new ResourceRestClient();
private ArrayList<String> connObjectKeyFieldValues;
@@ -165,16 +166,15 @@ public class LinkedAccountDetailsPanel extends WizardStep {
LOG.error("While reading mapping for resource {}", resource, ex);
}
- ConnObjectTOQuery.Builder builder = new ConnObjectTOQuery.Builder().
- size(2).
- orderBy(BaseRestClient.toOrderBy(new SortParam<>(resourceRemoteKey, true)));
+ ConnObjectTOQuery.Builder builder = new ConnObjectTOQuery.Builder().size(SEARCH_SIZE);
if (StringUtils.isNotBlank(searchTerm)) {
builder.fiql(SyncopeClient.getConnObjectTOFiqlSearchConditionBuilder().
is(resourceRemoteKey).equalTo(searchTerm + "*").query()).build();
}
Pair<String, List<ConnObjectTO>> items = resourceRestClient.searchConnObjects(resource,
AnyTypeKind.USER.name(),
- builder.build());
+ builder,
+ new SortParam<>(resourceRemoteKey, true));
choices.addAll(items.getRight().stream().map(item -> {
return item.getAttr(ConnIdSpecialName.UID).get().getValues().get(0);
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/LinkedAccountPlainAttrsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/LinkedAccountPlainAttrsPanel.java
index 40a7f1d..de699ad 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/LinkedAccountPlainAttrsPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/LinkedAccountPlainAttrsPanel.java
@@ -44,7 +44,7 @@ import org.apache.syncope.common.lib.to.AttrTO;
import org.apache.syncope.common.lib.to.LinkedAccountTO;
import org.apache.syncope.common.lib.to.PlainSchemaTO;
import org.apache.syncope.common.lib.to.UserTO;
-import org.apache.syncope.common.lib.types.LinkedAccountPlainAttrProperty;
+import org.apache.syncope.client.console.commons.LinkedAccountPlainAttrProperty;
import org.apache.syncope.common.lib.types.SchemaType;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/LinkedAccountPlainAttrsPanel.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/LinkedAccountPlainAttrsPanel.properties
deleted file mode 100644
index 2456923..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/LinkedAccountPlainAttrsPanel.properties
+++ /dev/null
@@ -1,17 +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.
-
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/LinkedAccountPlainAttrsPanel_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/LinkedAccountPlainAttrsPanel_it.properties
deleted file mode 100644
index 2456923..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/LinkedAccountPlainAttrsPanel_it.properties
+++ /dev/null
@@ -1,17 +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.
-
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/LinkedAccountPlainAttrsPanel_ja.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/LinkedAccountPlainAttrsPanel_ja.properties
deleted file mode 100644
index 13a8339..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/LinkedAccountPlainAttrsPanel_ja.properties
+++ /dev/null
@@ -1,16 +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.
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/LinkedAccountPlainAttrsPanel_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/LinkedAccountPlainAttrsPanel_pt_BR.properties
deleted file mode 100644
index 13a8339..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/LinkedAccountPlainAttrsPanel_pt_BR.properties
+++ /dev/null
@@ -1,16 +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.
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/LinkedAccountPlainAttrsPanel_ru.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/LinkedAccountPlainAttrsPanel_ru.properties
deleted file mode 100644
index 13a8339..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/LinkedAccountPlainAttrsPanel_ru.properties
+++ /dev/null
@@ -1,16 +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.
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/LinkedAccountTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/LinkedAccountTO.java
index d091c10..f2f0387 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/LinkedAccountTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/LinkedAccountTO.java
@@ -29,11 +29,10 @@ import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.syncope.common.lib.BaseBean;
@XmlRootElement(name = "linkedAccount")
@XmlType
-public class LinkedAccountTO extends BaseBean implements EntityTO {
+public class LinkedAccountTO implements EntityTO {
private static final long serialVersionUID = 7396929732310559535L;