http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/rest/BaseRestClient.java ---------------------------------------------------------------------- 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 ddab7af..17b2d4f 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 @@ -19,7 +19,7 @@ package org.apache.syncope.client.console.rest; import java.io.Serializable; -import org.apache.syncope.client.console.SyncopeSession; +import org.apache.syncope.client.console.SyncopeConsoleSession; import org.apache.syncope.client.lib.SyncopeClient; import org.apache.syncope.common.lib.search.OrderByClauseBuilder; import org.apache.wicket.extensions.markup.html.repeater.util.SortParam; @@ -35,20 +35,16 @@ public abstract class BaseRestClient implements Serializable { private static final long serialVersionUID = 1523999867826481989L; - protected <T> T getAnonymousService(final Class<T> serviceClass) { - return SyncopeSession.get().getAnonymousService(serviceClass); - } - protected <T> T getService(final Class<T> serviceClass) { - return SyncopeSession.get().getService(serviceClass); + return SyncopeConsoleSession.get().getService(serviceClass); } protected <T> T getService(final String etag, final Class<T> serviceClass) { - return SyncopeSession.get().getService(etag, serviceClass); + return SyncopeConsoleSession.get().getService(etag, serviceClass); } protected <T> void resetClient(final Class<T> serviceClass) { - SyncopeSession.get().resetClient(serviceClass); + SyncopeConsoleSession.get().resetClient(serviceClass); } protected String toOrderBy(final SortParam<String> sort) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/rest/ConfigurationRestClient.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/ConfigurationRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/ConfigurationRestClient.java index ca00ea8..cc1501c 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/rest/ConfigurationRestClient.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/ConfigurationRestClient.java @@ -21,7 +21,7 @@ package org.apache.syncope.client.console.rest; import java.util.Iterator; import java.util.List; import javax.ws.rs.core.Response; -import org.apache.syncope.client.console.SyncopeSession; +import org.apache.syncope.client.console.SyncopeConsoleSession; import org.apache.syncope.client.console.commons.AttrLayoutType; import org.apache.syncope.common.lib.SyncopeClientException; import org.apache.syncope.common.lib.to.AttrTO; @@ -88,7 +88,7 @@ public class ConfigurationRestClient extends BaseRestClient { } public List<String> getMailTemplates() { - return SyncopeSession.get().getSyncopeTO().getMailTemplates(); + return SyncopeConsoleSession.get().getSyncopeTO().getMailTemplates(); } public Response dbExport() { http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java index d9a729d..a093dbd 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java @@ -23,7 +23,7 @@ import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; -import org.apache.syncope.client.console.SyncopeSession; +import org.apache.syncope.client.console.SyncopeConsoleSession; import org.apache.syncope.common.lib.SyncopeClientException; import org.apache.syncope.common.lib.to.BulkAction; import org.apache.syncope.common.lib.to.BulkActionResult; @@ -49,7 +49,7 @@ public class ConnectorRestClient extends BaseRestClient { public List<ConnInstanceTO> getAllConnectors() { List<ConnInstanceTO> connectors = Collections.<ConnInstanceTO>emptyList(); try { - connectors = getService(ConnectorService.class).list(SyncopeSession.get().getLocale().toString()); + connectors = getService(ConnectorService.class).list(SyncopeConsoleSession.get().getLocale().toString()); } catch (Exception e) { LOG.error("While reading connectors", e); } @@ -98,7 +98,7 @@ public class ConnectorRestClient extends BaseRestClient { List<ConnBundleTO> bundles = Collections.<ConnBundleTO>emptyList(); try { - bundles = getService(ConnectorService.class).getBundles(SyncopeSession.get().getLocale().toString()); + bundles = getService(ConnectorService.class).getBundles(SyncopeConsoleSession.get().getLocale().toString()); } catch (SyncopeClientException e) { LOG.error("While getting connector bundles", e); } http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/rest/GroupRestClient.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/GroupRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/GroupRestClient.java index 91634f2..89d016c 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/rest/GroupRestClient.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/GroupRestClient.java @@ -18,6 +18,7 @@ */ package org.apache.syncope.client.console.rest; +import java.util.Collections; import java.util.List; import javax.ws.rs.core.Response; @@ -47,27 +48,31 @@ public class GroupRestClient extends AbstractSubjectRestClient { private static final long serialVersionUID = -8549081557283519638L; @Override - public int count() { - return getService(GroupService.class).list(1, 1).getTotalCount(); + public int count(final String realm) { + return getService(GroupService.class).list(Collections.singletonList(realm), 1, 1).getTotalCount(); } - public List<GroupTO> list() { - return getService(GroupService.class).list(1, 1000).getResult(); + public List<GroupTO> list(final String realm) { + return getService(GroupService.class).list(Collections.singletonList(realm), 1, 1000).getResult(); } @Override - public List<GroupTO> list(final int page, final int size, final SortParam<String> sort) { - return getService(GroupService.class).list(page, size, toOrderBy(sort)).getResult(); + public List<GroupTO> list(final String realm, final int page, final int size, final SortParam<String> sort) { + return getService(GroupService.class). + list(Collections.singletonList(realm), page, size, toOrderBy(sort)).getResult(); } @Override - public int searchCount(final String fiql) { - return getService(GroupService.class).search(fiql, 1, 1).getTotalCount(); + public int searchCount(final String realm, final String fiql) { + return getService(GroupService.class).search(Collections.singletonList(realm), fiql, 1, 1).getTotalCount(); } @Override - public List<GroupTO> search(final String fiql, final int page, final int size, final SortParam<String> sort) { - return getService(GroupService.class).search(fiql, page, size, toOrderBy(sort)).getResult(); + public List<GroupTO> search( + final String realm, final String fiql, final int page, final int size, final SortParam<String> sort) { + + return getService(GroupService.class). + search(Collections.singletonList(realm), fiql, page, size, toOrderBy(sort)).getResult(); } @Override @@ -80,8 +85,8 @@ public class GroupRestClient extends AbstractSubjectRestClient { return response.readEntity(GroupTO.class); } - public GroupTO read(final Long id) { - return getAnonymousService(GroupService.class).read(id); + public GroupTO read(final Long key) { + return getService(GroupService.class).read(key); } public GroupTO update(final String etag, final GroupMod groupMod) { @@ -95,11 +100,11 @@ public class GroupRestClient extends AbstractSubjectRestClient { } @Override - public GroupTO delete(final String etag, final Long id) { + public GroupTO delete(final String etag, final Long key) { GroupTO result; synchronized (this) { GroupService service = getService(etag, GroupService.class); - result = service.delete(id).readEntity(GroupTO.class); + result = service.delete(key).readEntity(GroupTO.class); resetClient(GroupService.class); } return result; http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/rest/InvalidPolicyType.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/InvalidPolicyType.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/InvalidPolicyType.java deleted file mode 100644 index 6c7959c..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/rest/InvalidPolicyType.java +++ /dev/null @@ -1,31 +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.rest; - -public class InvalidPolicyType extends RuntimeException { - - private static final long serialVersionUID = -1230154509336169378L; - - public InvalidPolicyType() { - } - - public InvalidPolicyType(final String msg) { - super(msg); - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/rest/LoggerRestClient.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/LoggerRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/LoggerRestClient.java index a8b40ac..318edcb 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/rest/LoggerRestClient.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/LoggerRestClient.java @@ -47,7 +47,7 @@ public class LoggerRestClient extends BaseRestClient { } public Map<String, Set<AuditLoggerName>> listAuditsByCategory() { - Map<String, Set<AuditLoggerName>> result = new HashMap<String, Set<AuditLoggerName>>(); + Map<String, Set<AuditLoggerName>> result = new HashMap<>(); for (AuditLoggerName auditLoggerName : listAudits()) { if (!result.containsKey(auditLoggerName.getCategory())) { result.put(auditLoggerName.getCategory(), new HashSet<AuditLoggerName>()); http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/rest/NotificationRestClient.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/NotificationRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/NotificationRestClient.java index 687ade0..b33e4dc 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/rest/NotificationRestClient.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/NotificationRestClient.java @@ -32,8 +32,8 @@ public class NotificationRestClient extends BaseRestClient { return getService(NotificationService.class).list(); } - public NotificationTO read(final Long id) { - return getService(NotificationService.class).read(id); + public NotificationTO read(final Long key) { + return getService(NotificationService.class).read(key); } public void create(final NotificationTO notificationTO) { @@ -44,7 +44,7 @@ public class NotificationRestClient extends BaseRestClient { getService(NotificationService.class).update(notificationTO.getKey(), notificationTO); } - public void delete(final Long id) { - getService(NotificationService.class).delete(id); + public void delete(final Long key) { + getService(NotificationService.class).delete(key); } } http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/rest/PolicyRestClient.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/PolicyRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/PolicyRestClient.java index 4409f7c..c1f019f 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/rest/PolicyRestClient.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/PolicyRestClient.java @@ -20,7 +20,7 @@ package org.apache.syncope.client.console.rest; import java.util.ArrayList; import java.util.List; -import org.apache.syncope.client.console.SyncopeSession; +import org.apache.syncope.client.console.SyncopeConsoleSession; import org.apache.syncope.common.lib.to.AbstractPolicyTO; import org.apache.syncope.common.lib.types.PolicyType; import org.apache.syncope.common.rest.api.service.PolicyService; @@ -34,28 +34,18 @@ public class PolicyRestClient extends BaseRestClient { private static final long serialVersionUID = -1392090291817187902L; - public <T extends AbstractPolicyTO<?>> T getGlobalPolicy(final PolicyType type) { + public <T extends AbstractPolicyTO> T getPolicy(final Long key) { T policy = null; try { - policy = getService(PolicyService.class).readGlobal(type); + policy = getService(PolicyService.class).read(key); } catch (Exception e) { - LOG.warn("No global " + type + " policy found", e); - } - return policy; - } - - public <T extends AbstractPolicyTO<?>> T getPolicy(final Long id) { - T policy = null; - try { - policy = getService(PolicyService.class).read(id); - } catch (Exception e) { - LOG.warn("No policy found for id {}", id, e); + LOG.warn("No policy found for id {}", key, e); } return policy; } @SuppressWarnings("unchecked") - public <T extends AbstractPolicyTO<?>> List<T> getPolicies(final PolicyType type, final boolean includeGlobal) { + public <T extends AbstractPolicyTO> List<T> getPolicies(final PolicyType type) { final List<T> res = new ArrayList<>(); try { @@ -64,29 +54,18 @@ public class PolicyRestClient extends BaseRestClient { LOG.debug("No policy found", ignore); } - if (includeGlobal) { - try { - T globalPolicy = getGlobalPolicy(type); - if (globalPolicy != null) { - res.add(0, globalPolicy); - } - } catch (Exception ignore) { - LOG.warn("No global policy found", ignore); - } - } - return res; } - public <T extends AbstractPolicyTO<?>> void createPolicy(final T policy) { + public <T extends AbstractPolicyTO> void createPolicy(final T policy) { getService(PolicyService.class).create(policy); } - public <T extends AbstractPolicyTO<?>> void updatePolicy(final T policy) { + public <T extends AbstractPolicyTO> void updatePolicy(final T policy) { getService(PolicyService.class).update(policy.getKey(), policy); } - public void delete(final Long id, final Class<? extends AbstractPolicyTO<?>> policyClass) { + public void delete(final Long id, final Class<? extends AbstractPolicyTO> policyClass) { getService(PolicyService.class).delete(id); } @@ -94,7 +73,7 @@ public class PolicyRestClient extends BaseRestClient { List<String> rules = null; try { - rules = SyncopeSession.get().getSyncopeTO().getSyncCorrelationRules(); + rules = SyncopeConsoleSession.get().getSyncopeTO().getSyncCorrelationRules(); } catch (Exception e) { LOG.error("While getting all correlation rule classes", e); } http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/rest/ReportRestClient.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/ReportRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/ReportRestClient.java index 81b58ac..ffce9c7 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/rest/ReportRestClient.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/ReportRestClient.java @@ -35,7 +35,7 @@ public class ReportRestClient extends BaseRestClient implements ExecutionRestCli private static final long serialVersionUID = 1644689667998953604L; public List<String> getReportletConfClasses() { - List<String> result = new ArrayList<String>(); + List<String> result = new ArrayList<>(); try { List<ReportletConfClass> reportletConfClasses = getService(ReportService.class).getReportletConfClasses(); http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java ---------------------------------------------------------------------- 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 2c44211..87c9a3a 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 @@ -19,7 +19,7 @@ package org.apache.syncope.client.console.rest; import java.util.List; -import org.apache.syncope.client.console.SyncopeSession; +import org.apache.syncope.client.console.SyncopeConsoleSession; import org.apache.syncope.common.lib.SyncopeClientException; import org.apache.syncope.common.lib.to.AbstractAttributableTO; import org.apache.syncope.common.lib.to.BulkAction; @@ -41,7 +41,7 @@ public class ResourceRestClient extends BaseRestClient { private static final long serialVersionUID = -6898907679835668987L; public List<String> getPropagationActionsClasses() { - return SyncopeSession.get().getSyncopeTO().getPropagationActions(); + return SyncopeConsoleSession.get().getSyncopeTO().getPropagationActions(); } public List<ResourceTO> getAll() { http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/rest/SchemaRestClient.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/SchemaRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/SchemaRestClient.java index 378f98d..6934ef6 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/rest/SchemaRestClient.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/SchemaRestClient.java @@ -23,7 +23,9 @@ import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.ListIterator; -import org.apache.syncope.client.console.SyncopeSession; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.Transformer; +import org.apache.syncope.client.console.SyncopeConsoleSession; import org.apache.syncope.client.console.commons.AttrLayoutType; import org.apache.syncope.common.lib.SyncopeClientException; import org.apache.syncope.common.lib.to.AbstractSchemaTO; @@ -89,13 +91,16 @@ public class SchemaRestClient extends BaseRestClient { } public List<String> getSchemaNames(final AttributableType attrType, final SchemaType schemaType) { - final List<String> schemaNames = new ArrayList<>(); + List<String> schemaNames = new ArrayList<>(); try { - final List<? extends AbstractSchemaTO> schemas = getSchemas(attrType, schemaType); - for (AbstractSchemaTO schemaTO : schemas) { - schemaNames.add(schemaTO.getKey()); - } + CollectionUtils.collect(getSchemas(attrType, schemaType), new Transformer<AbstractSchemaTO, String>() { + + @Override + public String transform(final AbstractSchemaTO schemaTO) { + return schemaTO.getKey(); + } + }, schemaNames); } catch (SyncopeClientException e) { LOG.error("While getting all user schema names", e); } @@ -104,18 +109,7 @@ public class SchemaRestClient extends BaseRestClient { } public List<String> getPlainSchemaNames(final AttributableType type) { - final List<String> schemaNames = new ArrayList<>(); - - try { - final List<PlainSchemaTO> schemas = getSchemas(type); - for (PlainSchemaTO schemaTO : schemas) { - schemaNames.add(schemaTO.getKey()); - } - } catch (SyncopeClientException e) { - LOG.error("While getting all user schema names", e); - } - - return schemaNames; + return getSchemaNames(type, SchemaType.PLAIN); } public List<DerSchemaTO> getDerSchemas(final AttributableType type) { @@ -131,19 +125,7 @@ public class SchemaRestClient extends BaseRestClient { } public List<String> getDerSchemaNames(final AttributableType type) { - final List<String> userDerSchemasNames = new ArrayList<>(); - - try { - final List<DerSchemaTO> userDerSchemas = getService(SchemaService.class).list(type, SchemaType.DERIVED); - - for (DerSchemaTO schemaTO : userDerSchemas) { - userDerSchemasNames.add(schemaTO.getKey()); - } - } catch (SyncopeClientException e) { - LOG.error("While getting all {} derived schema names", type, e); - } - - return userDerSchemasNames; + return getSchemaNames(type, SchemaType.DERIVED); } public List<VirSchemaTO> getVirSchemas(final AttributableType type) { @@ -159,19 +141,7 @@ public class SchemaRestClient extends BaseRestClient { } public List<String> getVirSchemaNames(final AttributableType type) { - final List<String> userVirSchemasNames = new ArrayList<String>(); - - try { - @SuppressWarnings("unchecked") - final List<VirSchemaTO> userVirSchemas = getService(SchemaService.class).list(type, SchemaType.VIRTUAL); - for (VirSchemaTO schemaTO : userVirSchemas) { - userVirSchemasNames.add(schemaTO.getKey()); - } - } catch (SyncopeClientException e) { - LOG.error("While getting all user derived schema names", e); - } - - return userVirSchemasNames; + return getSchemaNames(type, SchemaType.VIRTUAL); } public void createPlainSchema(final AttributableType type, final PlainSchemaTO schemaTO) { @@ -241,7 +211,7 @@ public class SchemaRestClient extends BaseRestClient { List<String> response = null; try { - response = SyncopeSession.get().getSyncopeTO().getValidators(); + response = SyncopeConsoleSession.get().getSyncopeTO().getValidators(); } catch (SyncopeClientException e) { LOG.error("While getting all validators", e); } http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/rest/TaskRestClient.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/TaskRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/TaskRestClient.java index 541b5cd..be4976e 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/rest/TaskRestClient.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/TaskRestClient.java @@ -19,7 +19,7 @@ package org.apache.syncope.client.console.rest; import java.util.List; -import org.apache.syncope.client.console.SyncopeSession; +import org.apache.syncope.client.console.SyncopeConsoleSession; import org.apache.syncope.common.lib.to.AbstractTaskTO; import org.apache.syncope.common.lib.to.BulkAction; import org.apache.syncope.common.lib.to.BulkActionResult; @@ -42,15 +42,15 @@ public class TaskRestClient extends BaseRestClient implements ExecutionRestClien private static final long serialVersionUID = 6284485820911028843L; public List<String> getJobClasses() { - return SyncopeSession.get().getSyncopeTO().getTaskJobs(); + return SyncopeConsoleSession.get().getSyncopeTO().getTaskJobs(); } public List<String> getSyncActionsClasses() { - return SyncopeSession.get().getSyncopeTO().getSyncActions(); + return SyncopeConsoleSession.get().getSyncopeTO().getSyncActions(); } public List<String> getPushActionsClasses() { - return SyncopeSession.get().getSyncopeTO().getPushActions(); + return SyncopeConsoleSession.get().getSyncopeTO().getPushActions(); } /** http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/rest/UserRestClient.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/UserRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/UserRestClient.java index bca0e28..cb30536 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/rest/UserRestClient.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/UserRestClient.java @@ -18,6 +18,7 @@ */ package org.apache.syncope.client.console.rest; +import java.util.Collections; import java.util.List; import javax.ws.rs.core.Response; import org.apache.syncope.client.console.commons.status.StatusBean; @@ -49,13 +50,14 @@ public class UserRestClient extends AbstractSubjectRestClient { private static final long serialVersionUID = -1575748964398293968L; @Override - public int count() { - return getService(UserService.class).list(1, 1).getTotalCount(); + public int count(final String realm) { + return getService(UserService.class).list(Collections.singletonList(realm), 1, 1).getTotalCount(); } @Override - public List<UserTO> list(final int page, final int size, final SortParam<String> sort) { - return getService(UserService.class).list(page, size, toOrderBy(sort)).getResult(); + public List<UserTO> list(final String realm, final int page, final int size, final SortParam<String> sort) { + return getService(UserService.class). + list(Collections.singletonList(realm), page, size, toOrderBy(sort)).getResult(); } public UserTO create(final UserTO userTO, final boolean storePassword) { @@ -95,13 +97,16 @@ public class UserRestClient extends AbstractSubjectRestClient { } @Override - public int searchCount(final String fiql) { - return getService(UserService.class).search(fiql, 1, 1).getTotalCount(); + public int searchCount(final String realm, final String fiql) { + return getService(UserService.class).search(Collections.singletonList(realm), fiql, 1, 1).getTotalCount(); } @Override - public List<UserTO> search(final String fiql, final int page, final int size, final SortParam<String> sort) { - return getService(UserService.class).search(fiql, page, size, toOrderBy(sort)).getResult(); + public List<UserTO> search( + final String realm, final String fiql, final int page, final int size, final SortParam<String> sort) { + + return getService(UserService.class). + search(Collections.singletonList(realm), fiql, page, size, toOrderBy(sort)).getResult(); } @Override http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/rest/UserSelfRestClient.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/UserSelfRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/UserSelfRestClient.java index 1bb1079..13e1555 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/rest/UserSelfRestClient.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/UserSelfRestClient.java @@ -18,7 +18,7 @@ */ package org.apache.syncope.client.console.rest; -import org.apache.syncope.client.console.SyncopeSession; +import org.apache.syncope.client.console.SyncopeConsoleSession; import org.apache.syncope.common.lib.SyncopeClientException; import org.apache.syncope.common.lib.mod.UserMod; import org.apache.syncope.common.lib.to.UserTO; @@ -33,7 +33,7 @@ public class UserSelfRestClient extends BaseRestClient { public boolean isSelfRegistrationAllowed() { Boolean result = null; try { - result = SyncopeSession.get().getSyncopeTO().isSelfRegAllowed(); + result = SyncopeConsoleSession.get().getSyncopeTO().isSelfRegAllowed(); } catch (SyncopeClientException e) { LOG.error("While seeking if self registration is allowed", e); } @@ -44,7 +44,7 @@ public class UserSelfRestClient extends BaseRestClient { } public UserTO read() { - return getService(UserSelfService.class).read(); + return SyncopeConsoleSession.get().getSelfTO(); } public void create(final UserTO userTO, final boolean storePassword) { @@ -62,7 +62,7 @@ public class UserSelfRestClient extends BaseRestClient { public boolean isPasswordResetAllowed() { Boolean result = null; try { - result = SyncopeSession.get().getSyncopeTO().isPwdResetAllowed(); + result = SyncopeConsoleSession.get().getSyncopeTO().isPwdResetAllowed(); } catch (SyncopeClientException e) { LOG.error("While seeking if password reset is allowed", e); } @@ -75,7 +75,7 @@ public class UserSelfRestClient extends BaseRestClient { public boolean isPwdResetRequiringSecurityQuestions() { Boolean result = null; try { - result = SyncopeSession.get().getSyncopeTO().isPwdResetRequiringSecurityQuestions(); + result = SyncopeConsoleSession.get().getSyncopeTO().isPwdResetRequiringSecurityQuestions(); } catch (SyncopeClientException e) { LOG.error("While seeking if password reset requires security question", e); } http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/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 f3bf60c..eb0527e 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 @@ -23,7 +23,7 @@ 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.SyncopeSession; +import org.apache.syncope.client.console.SyncopeConsoleSession; import org.apache.syncope.common.lib.types.SubjectType; import org.apache.syncope.common.rest.api.RESTHeaders; import org.apache.syncope.common.rest.api.service.WorkflowService; @@ -35,7 +35,7 @@ public class WorkflowRestClient extends BaseRestClient { private static final long serialVersionUID = 5049285686167071017L; private WorkflowService getService(final MediaType mediaType) { - return SyncopeSession.get().getService(mediaType, WorkflowService.class); + return SyncopeConsoleSession.get().getService(mediaType, WorkflowService.class); } public InputStream getDefinition(final MediaType mediaType) { @@ -60,7 +60,7 @@ public class WorkflowRestClient extends BaseRestClient { } public boolean isActivitiEnabledForUsers() { - return SyncopeSession.get().getSyncopeTO().getUserWorkflowAdapter().indexOf("Activiti") != -1; + return SyncopeConsoleSession.get().getSyncopeTO().getUserWorkflowAdapter().contains("Activiti"); } public void updateDefinition(final MediaType mediaType, final String definition) { http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/wicket/ajax/form/AbstractAjaxDownloadBehavior.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/ajax/form/AbstractAjaxDownloadBehavior.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/ajax/form/AbstractAjaxDownloadBehavior.java deleted file mode 100644 index 8074d37..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/ajax/form/AbstractAjaxDownloadBehavior.java +++ /dev/null @@ -1,48 +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.wicket.ajax.form; - -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.behavior.AbstractAjaxBehavior; -import org.apache.wicket.request.handler.resource.ResourceStreamRequestHandler; -import org.apache.wicket.util.resource.IResourceStream; - -public abstract class AbstractAjaxDownloadBehavior extends AbstractAjaxBehavior { - - private static final long serialVersionUID = 6833760760338614245L; - - /** - * Call this method to initiate the download. - */ - public void initiate(final AjaxRequestTarget target) { - CharSequence url = getCallbackUrl(); - - target.appendJavaScript("window.location.href='" + url + "'"); - } - - @Override - public void onRequest() { - getComponent().getRequestCycle().scheduleRequestHandlerAfterCurrent( - new ResourceStreamRequestHandler(getResourceStream(), getFileName())); - } - - protected abstract String getFileName(); - - protected abstract IResourceStream getResourceStream(); -} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/wicket/ajax/markup/html/ClearIndicatingAjaxButton.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/ajax/markup/html/ClearIndicatingAjaxButton.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/ajax/markup/html/ClearIndicatingAjaxButton.java deleted file mode 100644 index 314f66c..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/ajax/markup/html/ClearIndicatingAjaxButton.java +++ /dev/null @@ -1,76 +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.wicket.ajax.markup.html; - -import org.apache.syncope.client.console.pages.BasePage; -import org.apache.wicket.Page; -import org.apache.wicket.PageReference; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxButton; -import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.model.IModel; - -public abstract class ClearIndicatingAjaxButton extends IndicatingAjaxButton { - - private static final long serialVersionUID = 7206379812788748287L; - - private final PageReference pageRef; - - private boolean reloadFeebackPanel = true; - - public ClearIndicatingAjaxButton(final String id, final PageReference pageRef) { - super(id); - this.pageRef = pageRef; - } - - public ClearIndicatingAjaxButton(final String id, Form<?> form, final PageReference pageRef) { - super(id, form); - this.pageRef = pageRef; - } - - public ClearIndicatingAjaxButton(final String id, IModel<String> model, final PageReference pageRef) { - super(id, model); - this.pageRef = pageRef; - } - - public ClearIndicatingAjaxButton(final String id, final IModel<String> model, final Form<?> form, - final PageReference pageRef) { - - super(id, model, form); - this.pageRef = pageRef; - } - - protected abstract void onSubmitInternal(AjaxRequestTarget target, Form<?> form); - - public ClearIndicatingAjaxButton feedbackPanelAutomaticReload(boolean reloadFeedbackPanel) { - this.reloadFeebackPanel = reloadFeedbackPanel; - return this; - } - - @Override - protected final void onSubmit(final AjaxRequestTarget target, final Form<?> form) { - super.onSubmit(target, form); - - Page page = pageRef.getPage(); - if (reloadFeebackPanel && page instanceof BasePage) { - target.add(((BasePage) page).getFeedbackPanel()); - } - onSubmitInternal(target, form); - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/wicket/ajax/markup/html/ClearIndicatingAjaxLink.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/ajax/markup/html/ClearIndicatingAjaxLink.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/ajax/markup/html/ClearIndicatingAjaxLink.java deleted file mode 100644 index 5bb5642..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/ajax/markup/html/ClearIndicatingAjaxLink.java +++ /dev/null @@ -1,61 +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.wicket.ajax.markup.html; - -import org.apache.syncope.client.console.pages.BasePage; -import org.apache.wicket.Page; -import org.apache.wicket.PageReference; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxLink; -import org.apache.wicket.model.IModel; - -public abstract class ClearIndicatingAjaxLink<T> extends IndicatingAjaxLink<T> { - - private static final long serialVersionUID = 7913625094362339643L; - - private final PageReference pageRef; - - private boolean reloadFeedbackPanel = true; - - public ClearIndicatingAjaxLink(final String id, final PageReference pageRef) { - super(id); - this.pageRef = pageRef; - } - - public ClearIndicatingAjaxLink(final String id, final IModel<T> model, final PageReference pageRef) { - super(id, model); - this.pageRef = pageRef; - } - - public ClearIndicatingAjaxLink<T> feedbackPanelAutomaticReload(boolean reloadFeedbackPanel) { - this.reloadFeedbackPanel = reloadFeedbackPanel; - return this; - } - - protected abstract void onClickInternal(AjaxRequestTarget target); - - @Override - public final void onClick(final AjaxRequestTarget target) { - Page page = pageRef.getPage(); - if (reloadFeedbackPanel && page instanceof BasePage) { - target.add(((BasePage) page).getFeedbackPanel()); - } - onClickInternal(target); - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/wicket/ajax/markup/html/IndicatingOnConfirmAjaxLink.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/ajax/markup/html/IndicatingOnConfirmAjaxLink.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/ajax/markup/html/IndicatingOnConfirmAjaxLink.java deleted file mode 100644 index 86db915..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/ajax/markup/html/IndicatingOnConfirmAjaxLink.java +++ /dev/null @@ -1,58 +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.wicket.ajax.markup.html; - -import org.apache.wicket.Component; -import org.apache.wicket.PageReference; -import org.apache.wicket.ajax.attributes.AjaxCallListener; -import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; - -public abstract class IndicatingOnConfirmAjaxLink<T> extends ClearIndicatingAjaxLink<T> { - - private static final long serialVersionUID = 2228670850922265663L; - - private final String msg; - - public IndicatingOnConfirmAjaxLink(final String id, final PageReference pageRef) { - this(id, pageRef, "confirmDelete"); - } - - public IndicatingOnConfirmAjaxLink(final String id, final PageReference pageRef, final String msg) { - super(id, pageRef); - this.msg = msg; - } - - @Override - protected void updateAjaxAttributes(final AjaxRequestAttributes attributes) { - super.updateAjaxAttributes(attributes); - - final AjaxCallListener ajaxCallListener = new AjaxCallListener() { - - private static final long serialVersionUID = 7160235486520935153L; - - @Override - public CharSequence getPrecondition(final Component component) { - return "if (!confirm('" - + getString(IndicatingOnConfirmAjaxLink.this.msg) - + "')) {return false;} else {return true;}"; - } - }; - attributes.getAjaxCallListeners().add(ajaxCallListener); - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/ActionColumn.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/ActionColumn.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/ActionColumn.java deleted file mode 100644 index b9dfa62..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/ActionColumn.java +++ /dev/null @@ -1,59 +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.wicket.extensions.markup.html.repeater.data.table; - -import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel; -import org.apache.wicket.Component; -import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator; -import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn; -import org.apache.wicket.markup.repeater.Item; -import org.apache.wicket.model.IModel; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public abstract class ActionColumn<T, S> extends AbstractColumn<T, S> { - - private static final long serialVersionUID = 7955560320949560725L; - - /** - * Logger. - */ - protected static final Logger LOG = LoggerFactory.getLogger(ActionColumn.class); - - public ActionColumn(final IModel<String> displayModel) { - super(displayModel); - } - - @Override - public String getCssClass() { - return "action"; - } - - @Override - public Component getHeader(final String componentId) { - return super.getHeader(componentId); - } - - @Override - public void populateItem(final Item<ICellPopulator<T>> item, final String componentId, final IModel<T> rowModel) { - item.add(getActions(componentId, rowModel)); - } - - public abstract ActionLinksPanel getActions(final String componentId, final IModel<T> rowModel); -} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/ActionResultColumn.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/ActionResultColumn.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/ActionResultColumn.java deleted file mode 100644 index a2c40ff..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/ActionResultColumn.java +++ /dev/null @@ -1,77 +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.wicket.extensions.markup.html.repeater.data.table; - -import java.beans.PropertyDescriptor; -import org.apache.syncope.common.lib.to.BulkActionResult; -import org.apache.syncope.common.lib.to.BulkActionResult.Status; -import org.apache.wicket.Component; -import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator; -import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn; -import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.markup.repeater.Item; -import org.apache.wicket.model.IModel; -import org.apache.wicket.model.Model; -import org.apache.wicket.model.ResourceModel; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.BeanUtils; - -public class ActionResultColumn<T, S> extends AbstractColumn<T, S> { - - private static final long serialVersionUID = 7955560320949560716L; - - /** - * Logger. - */ - private static final Logger LOG = LoggerFactory.getLogger(ActionResultColumn.class); - - private final BulkActionResult results; - - private final String idFieldName; - - public ActionResultColumn(final BulkActionResult results, final String idFieldName) { - super(new Model<String>()); - this.results = results; - this.idFieldName = idFieldName; - } - - @Override - public String getCssClass() { - return "bulkResultColumn"; - } - - @Override - public Component getHeader(final String componentId) { - return new Label(componentId, new ResourceModel("bulkActionResultLabel", "Result")); - } - - @Override - public void populateItem(final Item<ICellPopulator<T>> item, final String componentId, final IModel<T> rowModel) { - try { - final PropertyDescriptor propDesc = - BeanUtils.getPropertyDescriptor(rowModel.getObject().getClass(), idFieldName); - final Object id = propDesc.getReadMethod().invoke(rowModel.getObject(), new Object[0]); - final Status status = id == null ? null : results.getResultMap().get(id.toString()); - item.add(new Label(componentId, status == null ? Status.SUCCESS : status.toString())); - } catch (Exception e) { - LOG.error("Errore retrieving target id value", e); - } - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/AttrColumn.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/AttrColumn.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/AttrColumn.java deleted file mode 100644 index b40d7c8..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/AttrColumn.java +++ /dev/null @@ -1,85 +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.wicket.extensions.markup.html.repeater.data.table; - -import java.util.List; -import org.apache.syncope.common.lib.to.AbstractAttributableTO; -import org.apache.syncope.common.lib.types.SchemaType; -import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator; -import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn; -import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.markup.repeater.Item; -import org.apache.wicket.model.IModel; -import org.apache.wicket.model.ResourceModel; - -public class AttrColumn extends AbstractColumn<AbstractAttributableTO, String> { - - private static final long serialVersionUID = 2624734332447371372L; - - private final String name; - - private final SchemaType schemaType; - - public AttrColumn(final String name, final SchemaType schemaType) { - // set sortProperty to schematype#name (e.g. derivedSchema#cn, - // for use with SortableUserProviderComparator.AttrModel#getObject) - super(new ResourceModel(name, name), schemaType.name() + "#" + name); - this.name = name; - this.schemaType = schemaType; - } - - @Override - public void populateItem(final Item<ICellPopulator<AbstractAttributableTO>> cellItem, final String componentId, - final IModel<AbstractAttributableTO> rowModel) { - - List<String> values = null; - - switch (schemaType) { - case PLAIN: - if (rowModel.getObject().getPlainAttrMap().containsKey(name)) { - values = rowModel.getObject().getPlainAttrMap().get(name).getValues(); - } - break; - - case VIRTUAL: - if (rowModel.getObject().getVirAttrMap().containsKey(name)) { - values = rowModel.getObject().getVirAttrMap().get(name).getValues(); - } - break; - - case DERIVED: - if (rowModel.getObject().getDerAttrMap().containsKey(name)) { - values = rowModel.getObject().getDerAttrMap().get(name).getValues(); - } - break; - - default: - } - - if (values == null || values.isEmpty()) { - cellItem.add(new Label(componentId, "")); - } else { - if (values.size() == 1) { - cellItem.add(new Label(componentId, values.get(0))); - } else { - cellItem.add(new Label(componentId, values.toString())); - } - } - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/CheckBoxGroupSelectorPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/CheckBoxGroupSelectorPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/CheckBoxGroupSelectorPanel.java deleted file mode 100644 index 8f880b7..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/CheckBoxGroupSelectorPanel.java +++ /dev/null @@ -1,34 +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.wicket.extensions.markup.html.repeater.data.table; - -import org.apache.wicket.markup.html.form.CheckGroup; -import org.apache.wicket.markup.html.form.CheckGroupSelector; -import org.apache.wicket.markup.html.panel.Panel; - -public class CheckBoxGroupSelectorPanel<T> extends Panel { - - private static final long serialVersionUID = 4062106303929176865L; - - public CheckBoxGroupSelectorPanel(final String componentId, final CheckGroup<T> group) { - - super(componentId); - add(new CheckGroupSelector("groupselector", group)); - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/CheckBoxPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/CheckBoxPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/CheckBoxPanel.java deleted file mode 100644 index db87192..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/CheckBoxPanel.java +++ /dev/null @@ -1,43 +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.wicket.extensions.markup.html.repeater.data.table; - -import org.apache.syncope.client.console.commons.ActionTableCheckGroup; -import org.apache.wicket.markup.html.form.Check; -import org.apache.wicket.markup.html.form.CheckGroup; -import org.apache.wicket.markup.html.panel.Panel; -import org.apache.wicket.model.IModel; - -public class CheckBoxPanel<T> extends Panel { - - private static final long serialVersionUID = 4062106303929176865L; - - private final Check<T> check; - - public CheckBoxPanel(final String componentId, final IModel<T> model, final CheckGroup<T> checkGroup) { - super(componentId, model); - this.check = new Check<T>("check", model, checkGroup); - if (checkGroup instanceof ActionTableCheckGroup) { - boolean checkable = ((ActionTableCheckGroup<T>) checkGroup).isCheckable(model.getObject()); - this.check.setEnabled(checkable); - this.check.setVisible(checkable); - } - add(this.check); - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/CheckGroupColumn.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/CheckGroupColumn.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/CheckGroupColumn.java deleted file mode 100644 index cf13f3c..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/CheckGroupColumn.java +++ /dev/null @@ -1,54 +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.wicket.extensions.markup.html.repeater.data.table; - -import org.apache.wicket.Component; -import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator; -import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn; -import org.apache.wicket.markup.html.form.CheckGroup; -import org.apache.wicket.markup.repeater.Item; -import org.apache.wicket.model.IModel; -import org.apache.wicket.model.Model; - -public class CheckGroupColumn<T, S> extends AbstractColumn<T, S> { - - private static final long serialVersionUID = 7955560320949560715L; - - private final CheckGroup<T> group; - - public CheckGroupColumn(final CheckGroup<T> checkGroup) { - super(new Model<String>()); - this.group = checkGroup; - } - - @Override - public String getCssClass() { - return "checkGroupColumn"; - } - - @Override - public Component getHeader(final String componentId) { - return new CheckBoxGroupSelectorPanel<T>(componentId, group); - } - - @Override - public void populateItem(final Item<ICellPopulator<T>> item, final String componentId, final IModel<T> rowModel) { - item.add(new CheckBoxPanel<T>(componentId, rowModel, group)); - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/CollectionPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/CollectionPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/CollectionPanel.java deleted file mode 100644 index f04fa5a..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/CollectionPanel.java +++ /dev/null @@ -1,47 +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.wicket.extensions.markup.html.repeater.data.table; - -import java.util.List; -import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.markup.html.list.ListItem; -import org.apache.wicket.markup.html.list.ListView; -import org.apache.wicket.markup.html.panel.Panel; -import org.apache.wicket.model.ResourceModel; - -public class CollectionPanel extends Panel { - - private static final long serialVersionUID = -4042497356836230377L; - - @SuppressWarnings("unchecked") - public CollectionPanel(final String id, final List values) { - super(id); - - add(new ListView("collection", values) { - - private static final long serialVersionUID = 4949588177564901031L; - - @Override - protected void populateItem(final ListItem item) { - final String value = item.getModelObject() == null ? null : item.getModelObject().toString(); - item.add(new Label("item", new ResourceModel(value, value))); - } - }); - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/CollectionPropertyColumn.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/CollectionPropertyColumn.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/CollectionPropertyColumn.java deleted file mode 100644 index a5fd774..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/CollectionPropertyColumn.java +++ /dev/null @@ -1,54 +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.wicket.extensions.markup.html.repeater.data.table; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator; -import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn; -import org.apache.wicket.markup.repeater.Item; -import org.apache.wicket.model.IModel; - -public class CollectionPropertyColumn<T> extends PropertyColumn<T, String> { - - private static final long serialVersionUID = 8077865338230121496L; - - public CollectionPropertyColumn( - final IModel<String> displayModel, - final String sortProperty, - final String propertyExpression) { - super(displayModel, sortProperty, propertyExpression); - } - - @Override - @SuppressWarnings("unchecked") - public void populateItem( - final Item<ICellPopulator<T>> cellItem, final String componentId, final IModel<T> rowModel) { - - final Object value = getDataModel(rowModel).getObject(); - - if (value instanceof Collection) { - final List values = new ArrayList((Collection) value); - Collections.sort(values); - cellItem.add(new CollectionPanel(componentId, values)); - } - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/DatePropertyColumn.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/DatePropertyColumn.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/DatePropertyColumn.java deleted file mode 100644 index f767aa2..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/DatePropertyColumn.java +++ /dev/null @@ -1,53 +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.wicket.extensions.markup.html.repeater.data.table; - -import java.util.Date; -import org.apache.syncope.client.console.SyncopeSession; -import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator; -import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn; -import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.markup.repeater.Item; -import org.apache.wicket.model.IModel; - -/** - * Format column's value as date string. - */ -public class DatePropertyColumn<T> extends PropertyColumn<T, String> { - - private static final long serialVersionUID = 3527840552172947705L; - - public DatePropertyColumn(final IModel<String> displayModel, final String sortProperty, - final String propertyExpression) { - - super(displayModel, sortProperty, propertyExpression); - } - - @Override - public void populateItem(final Item<ICellPopulator<T>> item, final String componentId, final IModel<T> rowModel) { - - IModel<Object> date = getDataModel(rowModel); - - String convertedDate = ""; - if (date.getObject() instanceof Date) { - convertedDate = SyncopeSession.get().getDateFormat().format(date.getObject()); - } - item.add(new Label(componentId, convertedDate)); - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/TokenColumn.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/TokenColumn.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/TokenColumn.java deleted file mode 100644 index 094e450..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/TokenColumn.java +++ /dev/null @@ -1,51 +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.wicket.extensions.markup.html.repeater.data.table; - -import org.apache.syncope.common.lib.to.AbstractAttributableTO; -import org.apache.syncope.common.lib.to.UserTO; -import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator; -import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn; -import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.markup.repeater.Item; -import org.apache.wicket.model.IModel; -import org.apache.wicket.model.ResourceModel; -import org.springframework.util.StringUtils; - -public class TokenColumn extends AbstractColumn<AbstractAttributableTO, String> { - - private static final long serialVersionUID = 8077865338230121496L; - - public TokenColumn(final String name) { - super(new ResourceModel(name, name), name); - } - - @Override - public void populateItem(final Item<ICellPopulator<AbstractAttributableTO>> cellItem, final String componentId, - final IModel<AbstractAttributableTO> rowModel) { - - if (rowModel.getObject() instanceof UserTO) { - if (StringUtils.hasText(((UserTO) rowModel.getObject()).getToken())) { - cellItem.add(new Label(componentId, new ResourceModel("tokenValued", "tokenValued"))); - } else { - cellItem.add(new Label(componentId, new ResourceModel("tokenNotValued", "tokenNotValued"))); - } - } - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/CrontabContainer.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/CrontabContainer.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/CrontabContainer.java deleted file mode 100644 index 5555616..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/CrontabContainer.java +++ /dev/null @@ -1,184 +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.wicket.markup.html; - -import java.util.Arrays; -import org.apache.syncope.client.console.commons.Constants; -import org.apache.syncope.client.console.commons.SelectChoiceRenderer; -import org.apache.syncope.client.console.commons.SelectOption; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior; -import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.wicket.markup.html.form.DropDownChoice; -import org.apache.wicket.markup.html.form.FormComponent; -import org.apache.wicket.markup.html.form.TextField; -import org.apache.wicket.model.IModel; -import org.apache.wicket.model.Model; -import org.apache.wicket.model.PropertyModel; - -public class CrontabContainer extends WebMarkupContainer { - - private static final long serialVersionUID = 7879593326085337650L; - - private final TextField seconds; - - private final TextField minutes; - - private final TextField hours; - - private final TextField daysOfMonth; - - private final TextField months; - - private final TextField daysOfWeek; - - @SuppressWarnings({ "unchecked", "rawtypes" }) - public CrontabContainer(final String id, final PropertyModel<String> cronExpressionModel, - final String cronExpression) { - - super(id); - setOutputMarkupId(true); - - final SelectOption[] CRON_TEMPLATES = { - new SelectOption(getString("selOpt1"), "UNSCHEDULE"), - new SelectOption(getString("selOpt2"), "0 0/5 * * * ?"), - new SelectOption(getString("selOpt3"), "0 0 12 * * ?"), - new SelectOption(getString("selOpt4"), "0 0 0 1 * ?"), - new SelectOption(getString("selOpt5"), "0 0 0 L * ?"), - new SelectOption(getString("selOpt6"), "0 0 0 ? * 2") - }; - - final DropDownChoice<SelectOption> cronTemplateChooser = - new DropDownChoice<SelectOption>("cronTemplateChooser") { - - private static final long serialVersionUID = -5843424545478691442L; - - @Override - protected CharSequence getDefaultChoice(final String selected) { - return "<option value=\"\">" + getString("chooseForTemplate") + "</option>"; - } - }; - - cronTemplateChooser.setModel(new IModel<SelectOption>() { - - private static final long serialVersionUID = 6762568283146531315L; - - @Override - public SelectOption getObject() { - SelectOption result = null; - for (SelectOption so : CRON_TEMPLATES) { - if (so.getKeyValue().equals(cronExpressionModel.getObject())) { - - result = so; - } - } - - return result; - } - - @Override - public void setObject(final SelectOption object) { - cronExpressionModel.setObject(object == null || object.equals(CRON_TEMPLATES[0]) - ? null - : object.toString()); - } - - @Override - public void detach() { - // no detach - } - }); - cronTemplateChooser.setChoices(Arrays.asList(CRON_TEMPLATES)); - cronTemplateChooser.setChoiceRenderer(new SelectChoiceRenderer()); - add(cronTemplateChooser); - - seconds = new TextField("seconds", new Model(getCronField(cronExpression, 0))); - add(seconds); - - minutes = new TextField("minutes", new Model(getCronField(cronExpression, 1))); - add(minutes); - - hours = new TextField("hours", new Model(getCronField(cronExpression, 2))); - add(hours); - - daysOfMonth = new TextField("daysOfMonth", new Model(getCronField(cronExpression, 3))); - add(daysOfMonth); - - months = new TextField("months", new Model(getCronField(cronExpression, 4))); - add(months); - - daysOfWeek = new TextField("daysOfWeek", new Model(getCronField(cronExpression, 5))); - add(daysOfWeek); - - cronTemplateChooser.add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { - - private static final long serialVersionUID = -1107858522700306810L; - - @Override - protected void onUpdate(final AjaxRequestTarget target) { - seconds.setModelObject(getCronField(cronTemplateChooser, 0)); - minutes.setModelObject(getCronField(cronTemplateChooser, 1)); - hours.setModelObject(getCronField(cronTemplateChooser, 2)); - daysOfMonth.setModelObject(getCronField(cronTemplateChooser, 3)); - months.setModelObject(getCronField(cronTemplateChooser, 4)); - daysOfWeek.setModelObject(getCronField(cronTemplateChooser, 5)); - target.add(CrontabContainer.this); - } - }); - } - - private String getCronField(final FormComponent formComponent, final int field) { - String cronField = null; - - if (formComponent != null) { - cronField = getCronField(formComponent.getInput(), field); - } - - return cronField; - } - - private String getCronField(final String cron, final int field) { - String cronField = null; - - if (cron != null && !cron.isEmpty() && !"UNSCHEDULE".equals(cron)) { - cronField = cron.split(" ")[field].trim(); - } - - return cronField; - } - - public String getCronExpression() { - String cronExpression = null; - - if (seconds != null && seconds.getInput() != null && minutes != null && minutes.getInput() != null - && hours != null && hours.getInput() != null && daysOfMonth != null && daysOfMonth.getInput() != null - && months != null && months.getInput() != null && daysOfWeek != null && daysOfWeek.getInput() != null) { - - cronExpression = new StringBuilder(). - append(seconds.getInput().trim()).append(" "). - append(minutes.getInput().trim()).append(" "). - append(hours.getInput().trim()).append(" "). - append(daysOfMonth.getInput().trim()).append(" "). - append(months.getInput().trim()).append(" "). - append(daysOfWeek.getInput().trim()).toString(); - } - - return cronExpression; - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/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 deleted file mode 100644 index 3e7cc44..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLink.java +++ /dev/null @@ -1,83 +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.wicket.markup.html.form; - -import java.io.Serializable; -import org.apache.wicket.ajax.AjaxRequestTarget; - -public abstract class ActionLink implements Serializable { - - private static final long serialVersionUID = 7031329706998320639L; - - private boolean reloadFeedbackPanel = true; - - public enum ActionType { - - CREATE("create"), - EDIT("read"), - USER_TEMPLATE("read"), - GROUP_TEMPLATE("read"), - RESET("update"), - ENABLE("update"), - SEARCH("read"), - DELETE("delete"), - EXECUTE("execute"), - DRYRUN("execute"), - CLAIM("claim"), - SELECT("read"), - EXPORT("read"), - SUSPEND("update"), - REACTIVATE("update"), - RELOAD("reload"), - CHANGE_VIEW("changeView"), - UNLINK("update"), - LINK("update"), - UNASSIGN("update"), - ASSIGN("update"), - DEPROVISION("update"), - PROVISION("update"), - MANAGE_RESOURCES("update"), - MANAGE_USERS("update"), - MANAGE_GROUPS("update"); - - private final String actionId; - - private ActionType(final String actionId) { - this.actionId = actionId; - } - - public String getActionId() { - return actionId; - } - } - - public abstract void onClick(final AjaxRequestTarget target); - - public void postClick() { - } - - public boolean feedbackPanelAutomaticReload() { - return reloadFeedbackPanel; - } - - public ActionLink feedbackPanelAutomaticReload(final boolean reloadFeedbackPanel) { - this.reloadFeedbackPanel = reloadFeedbackPanel; - return this; - } -}
