You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by jb...@apache.org on 2013/01/21 10:09:04 UTC
svn commit: r1436230 [2/14] - in /syncope/trunk: ./ client/
client/src/main/java/org/apache/syncope/annotation/
client/src/main/java/org/apache/syncope/client/
client/src/main/java/org/apache/syncope/client/mod/
client/src/main/java/org/apache/syncope/...
Added: syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/ResourceServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/ResourceServiceProxy.java?rev=1436230&view=auto
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/ResourceServiceProxy.java (added)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/ResourceServiceProxy.java Mon Jan 21 09:08:54 2013
@@ -0,0 +1,91 @@
+/*
+ * 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.services.proxy;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.syncope.common.services.ResourceService;
+import org.apache.syncope.common.to.ConnObjectTO;
+import org.apache.syncope.common.to.ResourceTO;
+import org.apache.syncope.common.types.AttributableType;
+import org.springframework.web.client.RestTemplate;
+
+public class ResourceServiceProxy extends SpringServiceProxy implements ResourceService {
+
+ public ResourceServiceProxy(final String baseUrl, final RestTemplate restTemplate) {
+ super(baseUrl, restTemplate);
+ }
+
+ @Override
+ public ResourceTO create(final ResourceTO resourceTO) {
+ return getRestTemplate().postForObject(baseUrl + "resource/create.json", resourceTO, ResourceTO.class);
+ }
+
+ @Override
+ public ResourceTO update(final String resourceName, final ResourceTO resourceTO) {
+ return getRestTemplate().postForObject(baseUrl + "resource/update.json", resourceTO, ResourceTO.class);
+ }
+
+ @Override
+ public ResourceTO delete(final String resourceName) {
+ return getRestTemplate().getForObject(baseUrl + "resource/delete/{resourceName}.json", ResourceTO.class,
+ resourceName);
+ }
+
+ @Override
+ public ResourceTO read(final String resourceName) {
+ return getRestTemplate().getForObject(baseUrl + "resource/read/{resourceName}.json", ResourceTO.class,
+ resourceName);
+ }
+
+ @Override
+ public Set<String> getPropagationActionsClasses() {
+ return new HashSet<String>(Arrays.asList(getRestTemplate().getForObject(baseUrl
+ + "resource/propagationActionsClasses.json", String[].class)));
+ }
+
+ @Override
+ public List<ResourceTO> list() {
+ return Arrays.asList(getRestTemplate().getForObject(baseUrl + "resource/list.json", ResourceTO[].class));
+ }
+
+ @Override
+ public List<ResourceTO> list(final Long connInstanceId) {
+ if (connInstanceId == null) {
+ return list();
+ }
+
+ return Arrays.asList(getRestTemplate().getForObject(baseUrl + "resource/list.json?connInstanceId={connId}",
+ ResourceTO[].class, connInstanceId));
+ }
+
+ @Override
+ public ConnObjectTO getConnector(final String resourceName, final AttributableType type, final String objectId) {
+ return getRestTemplate().getForObject(baseUrl + "resource/{resourceName}/read/{type}/{objectId}.json",
+ ConnObjectTO.class, resourceName, type.name(), objectId);
+ }
+
+ @Override
+ public boolean check(final ResourceTO resourceTO) {
+ return getRestTemplate().postForObject(baseUrl + "resource/check.json", resourceTO, Boolean.class).
+ booleanValue();
+ }
+}
Added: syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/RoleServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/RoleServiceProxy.java?rev=1436230&view=auto
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/RoleServiceProxy.java (added)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/RoleServiceProxy.java Mon Jan 21 09:08:54 2013
@@ -0,0 +1,103 @@
+/*
+ * 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.services.proxy;
+
+import java.util.Arrays;
+import java.util.List;
+import org.apache.syncope.common.mod.RoleMod;
+import org.apache.syncope.common.search.NodeCond;
+import org.apache.syncope.common.services.RoleService;
+import org.apache.syncope.common.to.RoleTO;
+import org.springframework.web.client.RestTemplate;
+
+public class RoleServiceProxy extends SpringServiceProxy implements RoleService {
+
+ public RoleServiceProxy(final String baseUrl, final RestTemplate restTemplate) {
+ super(baseUrl, restTemplate);
+ }
+
+ @Override
+ public List<RoleTO> children(final Long roleId) {
+ return Arrays.asList(getRestTemplate().getForObject(baseUrl + "role/children/{roleId}.json",
+ RoleTO[].class, roleId));
+ }
+
+ @Override
+ public Integer count() {
+ //return getRestTemplate().getForObject(baseUrl + "role/count.json", Integer.class);
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public RoleTO create(final RoleTO roleTO) {
+ return getRestTemplate().postForObject(baseUrl + "role/create", roleTO, RoleTO.class);
+ }
+
+ @Override
+ public RoleTO delete(final Long roleId) {
+ return getRestTemplate().getForObject(baseUrl + "role/delete/{roleId}", RoleTO.class, roleId);
+ }
+
+ @Override
+ public List<RoleTO> list() {
+ return Arrays.asList(getRestTemplate().getForObject(baseUrl + "role/list.json", RoleTO[].class));
+ }
+
+ @Override
+ public List<RoleTO> list(final int page, final int size) {
+ //return Arrays.asList(getRestTemplate().getForObject(baseURL + "role/list.json", RoleTO[].class, page, size));
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public RoleTO parent(final Long roleId) {
+ return getRestTemplate().getForObject(baseUrl + "role/parent/{roleId}.json", RoleTO.class, roleId);
+ }
+
+ @Override
+ public RoleTO read(final Long roleId) {
+ return getRestTemplate().getForObject(baseUrl + "role/read/{roleId}.json", RoleTO.class, roleId);
+ }
+
+ @Override
+ public List<RoleTO> search(final NodeCond searchCondition) {
+ return Arrays.asList(getRestTemplate().postForObject(baseUrl + "role/search", searchCondition, RoleTO[].class));
+ }
+
+ @Override
+ public List<RoleTO> search(final NodeCond searchCondition, final int page, final int size) {
+ return Arrays.asList(getRestTemplate().postForObject(baseUrl + "role/search/{page}/{size}", searchCondition,
+ RoleTO[].class, page, size));
+ }
+
+ @Override
+ public int searchCount(final NodeCond searchCondition) {
+ return getRestTemplate().postForObject(baseUrl + "role/search/count.json", searchCondition, Integer.class);
+ }
+
+ @Override
+ public RoleTO selfRead(final Long roleId) {
+ return getRestTemplate().getForObject(baseUrl + "role/selfRead/{roleId}", RoleTO.class, roleId);
+ }
+
+ @Override
+ public RoleTO update(final Long roleId, final RoleMod roleMod) {
+ return getRestTemplate().postForObject(baseUrl + "role/update", roleMod, RoleTO.class);
+ }
+}
Added: syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/SchemaServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/SchemaServiceProxy.java?rev=1436230&view=auto
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/SchemaServiceProxy.java (added)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/SchemaServiceProxy.java Mon Jan 21 09:08:54 2013
@@ -0,0 +1,102 @@
+/*
+ * 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.services.proxy;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.syncope.common.services.SchemaService;
+import org.apache.syncope.common.to.AbstractSchemaTO;
+import org.apache.syncope.common.to.DerivedSchemaTO;
+import org.apache.syncope.common.to.SchemaTO;
+import org.apache.syncope.common.to.VirtualSchemaTO;
+import org.apache.syncope.common.types.AttributableType;
+import org.springframework.web.client.RestTemplate;
+
+@SuppressWarnings("unchecked")
+public class SchemaServiceProxy extends SpringServiceProxy implements SchemaService {
+
+ public SchemaServiceProxy(final String baseUrl, final RestTemplate restTemplate) {
+ super(baseUrl, restTemplate);
+ }
+
+ @Override
+ public <T extends AbstractSchemaTO> T create(final AttributableType kind, final SchemaType type, final T schemaTO) {
+ return (T) getRestTemplate().postForObject(baseUrl + type + "/{kind}/create", schemaTO, getTOClass(type), kind);
+ }
+
+ @Override
+ public <T extends AbstractSchemaTO> T delete(final AttributableType kind, final SchemaType type,
+ final String schemaName) {
+
+ return (T) getRestTemplate().getForObject(baseUrl + type + "/{kind}/delete/{name}.json", getTOClass(type), kind,
+ schemaName);
+ }
+
+ @Override
+ public <T extends AbstractSchemaTO> List<T> list(final AttributableType kind, final SchemaType type) {
+ switch (type) {
+ case NORMAL:
+ return (List<T>) Arrays.asList(getRestTemplate().getForObject(baseUrl + type + "/{kind}/list.json",
+ SchemaTO[].class, kind));
+
+ case DERIVED:
+ return (List<T>) Arrays.asList(getRestTemplate().getForObject(baseUrl + type + "/{kind}/list.json",
+ DerivedSchemaTO[].class, kind));
+
+ case VIRTUAL:
+ return (List<T>) Arrays.asList(getRestTemplate().getForObject(baseUrl + type + "/{kind}/list.json",
+ VirtualSchemaTO[].class, kind));
+
+ default:
+ throw new IllegalArgumentException("SchemaType is not supported.");
+ }
+ }
+
+ @Override
+ public <T extends AbstractSchemaTO> T read(final AttributableType kind, final SchemaType type,
+ final String schemaName) {
+
+ return (T) getRestTemplate().getForObject(baseUrl + type + "/{kind}/read/{name}.json", getTOClass(type), kind,
+ schemaName);
+ }
+
+ @Override
+ public <T extends AbstractSchemaTO> T update(final AttributableType kind, final SchemaType type,
+ final String schemaName, final T schemaTO) {
+
+ return (T) getRestTemplate().postForObject(baseUrl + type + "/{kind}/update", schemaTO, getTOClass(type), kind);
+ }
+
+ private Class<? extends AbstractSchemaTO> getTOClass(final SchemaType type) {
+ switch (type) {
+ case NORMAL:
+ return SchemaTO.class;
+
+ case DERIVED:
+ return DerivedSchemaTO.class;
+
+ case VIRTUAL:
+ return VirtualSchemaTO.class;
+
+ default:
+ throw new IllegalArgumentException("SchemaType is not supported: " + type);
+ }
+ }
+}
Added: syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/SpringRestTemplate.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/SpringRestTemplate.java?rev=1436230&view=auto
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/SpringRestTemplate.java (added)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/SpringRestTemplate.java Mon Jan 21 09:08:54 2013
@@ -0,0 +1,26 @@
+/*
+ * 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.services.proxy;
+
+import org.springframework.web.client.RestTemplate;
+
+public interface SpringRestTemplate {
+
+ RestTemplate getRestTemplate();
+}
Added: syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/SpringServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/SpringServiceProxy.java?rev=1436230&view=auto
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/SpringServiceProxy.java (added)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/SpringServiceProxy.java Mon Jan 21 09:08:54 2013
@@ -0,0 +1,41 @@
+/*
+ * 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.services.proxy;
+
+import org.springframework.web.client.RestTemplate;
+
+public abstract class SpringServiceProxy {
+
+ protected String baseUrl;
+
+ private RestTemplate restTemplate;
+
+ public SpringServiceProxy(final String baseUrl, final RestTemplate restTemplate) {
+ this.baseUrl = baseUrl;
+ this.restTemplate = restTemplate;
+ }
+
+ public void setRestTemplate(final RestTemplate restTemplate) {
+ this.restTemplate = restTemplate;
+ }
+
+ public RestTemplate getRestTemplate() {
+ return restTemplate;
+ }
+}
Added: syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/TaskServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/TaskServiceProxy.java?rev=1436230&view=auto
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/TaskServiceProxy.java (added)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/TaskServiceProxy.java Mon Jan 21 09:08:54 2013
@@ -0,0 +1,200 @@
+/*
+ * 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.services.proxy;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.syncope.common.services.TaskService;
+import org.apache.syncope.common.to.NotificationTaskTO;
+import org.apache.syncope.common.to.PropagationTaskTO;
+import org.apache.syncope.common.to.SchedTaskTO;
+import org.apache.syncope.common.to.SyncTaskTO;
+import org.apache.syncope.common.to.TaskExecTO;
+import org.apache.syncope.common.to.TaskTO;
+import org.apache.syncope.common.types.PropagationTaskExecStatus;
+import org.apache.syncope.common.types.TaskType;
+import org.springframework.web.client.RestTemplate;
+
+@SuppressWarnings("unchecked")
+public class TaskServiceProxy extends SpringServiceProxy implements TaskService {
+
+ public TaskServiceProxy(final String baseUrl, final RestTemplate restTemplate) {
+ super(baseUrl, restTemplate);
+ }
+
+ @Override
+ public int count(final TaskType type) {
+ return getRestTemplate().getForObject(baseUrl + "task/{type}/count.json", Integer.class, type);
+ }
+
+ @Override
+ public <T extends TaskTO> T create(final T taskTO) {
+ String subTypeString = (taskTO instanceof SyncTaskTO)
+ ? "sync"
+ : (taskTO instanceof SchedTaskTO)
+ ? "sched"
+ : "";
+
+ return (T) getRestTemplate().postForObject(baseUrl + "task/create/{type}",
+ taskTO, taskTO.getClass(), subTypeString);
+ }
+
+ @Override
+ public <T extends TaskTO> T delete(final TaskType type, final Long taskId) {
+ return (T) getRestTemplate().getForObject(baseUrl + "task/delete/{taskId}", getTOClass(type), taskId);
+ }
+
+ @Override
+ public TaskExecTO deleteExecution(final Long executionId) {
+ return getRestTemplate()
+ .getForObject(baseUrl + "task/execution/delete/{executionId}", TaskExecTO.class, executionId);
+ }
+
+ @Override
+ public TaskExecTO execute(final Long taskId, final boolean dryRun) {
+ String param = (dryRun)
+ ? "?dryRun=true"
+ : "";
+ return getRestTemplate().
+ postForObject(baseUrl + "task/execute/{taskId}" + param, null, TaskExecTO.class, taskId);
+ }
+
+ @Override
+ public Set<String> getJobClasses() {
+ return new HashSet<String>(
+ Arrays.asList(getRestTemplate().getForObject(baseUrl + "task/jobClasses.json",
+ String[].class)));
+ }
+
+ @Override
+ public Set<String> getSyncActionsClasses() {
+ return new HashSet<String>(
+ Arrays.asList(getRestTemplate().getForObject(baseUrl + "task/syncActionsClasses.json",
+ String[].class)));
+ }
+
+ @Override
+ public <T extends TaskTO> List<T> list(final TaskType type) {
+ switch (type) {
+ case PROPAGATION:
+ return (List<T>) Arrays.asList(getRestTemplate().getForObject(baseUrl + "task/{type}/list",
+ PropagationTaskTO[].class, type));
+
+ case NOTIFICATION:
+ return (List<T>) Arrays.asList(getRestTemplate().getForObject(baseUrl + "task/{type}/list",
+ NotificationTaskTO[].class, type));
+
+ case SCHEDULED:
+ return (List<T>) Arrays.asList(getRestTemplate().getForObject(baseUrl + "task/{type}/list",
+ SchedTaskTO[].class, type));
+
+ case SYNCHRONIZATION:
+ return (List<T>) Arrays.asList(getRestTemplate().getForObject(baseUrl + "task/{type}/list",
+ SyncTaskTO[].class, type));
+
+ default:
+ throw new IllegalArgumentException("TaskType is not supported.");
+ }
+ }
+
+ @Override
+ public <T extends TaskTO> List<T> list(final TaskType type, final int page, final int size) {
+ switch (type) {
+ case PROPAGATION:
+ return (List<T>) Arrays.asList(getRestTemplate().getForObject(baseUrl
+ + "task/{type}/list/{page}/{size}.json",
+ PropagationTaskTO[].class, type, page, size));
+
+ case NOTIFICATION:
+ return (List<T>) Arrays.asList(getRestTemplate().getForObject(baseUrl
+ + "task/{type}/list/{page}/{size}.json",
+ NotificationTaskTO[].class, type, page, size));
+
+ case SCHEDULED:
+ return (List<T>) Arrays.asList(getRestTemplate().getForObject(baseUrl
+ + "task/{type}/list/{page}/{size}.json",
+ SchedTaskTO[].class, type, page, size));
+
+ case SYNCHRONIZATION:
+ return (List<T>) Arrays.asList(getRestTemplate().getForObject(baseUrl
+ + "task/{type}/list/{page}/{size}.json",
+ SyncTaskTO[].class, type, page, size));
+
+ default:
+ throw new IllegalArgumentException("TaskType is not supported :" + type);
+ }
+ }
+
+ @Override
+ public List<TaskExecTO> listExecutions(final TaskType type) {
+ return Arrays.asList(getRestTemplate().getForObject(
+ baseUrl + "task/{type}/execution/list", TaskExecTO[].class, type));
+ }
+
+ @Override
+ public <T extends TaskTO> T read(final TaskType type, final Long taskId) {
+ return (T) getRestTemplate().getForObject(baseUrl + "task/read/{taskId}", getTOClass(type), taskId);
+ }
+
+ @Override
+ public TaskExecTO readExecution(final Long executionId) {
+ return getRestTemplate().getForObject(baseUrl + "task/execution/read/{taskId}", TaskExecTO.class, executionId);
+ }
+
+ @Override
+ public TaskExecTO report(final Long executionId, final PropagationTaskExecStatus status, final String message) {
+ return getRestTemplate().getForObject(baseUrl + "task/execution/report/{executionId}"
+ + "?executionStatus={status}&message={message}", TaskExecTO.class, executionId, status, message);
+ }
+
+ @Override
+ public <T extends TaskTO> T update(final Long taskId, final T taskTO) {
+ String path = (taskTO instanceof SyncTaskTO)
+ ? "sync"
+ : (taskTO instanceof SchedTaskTO)
+ ? "sched"
+ : null;
+ if (path == null) {
+ throw new IllegalArgumentException("Task can only be instance of SchedTaskTO or SyncTaskTO");
+ }
+
+ return (T) getRestTemplate().postForObject(baseUrl + "task/update/" + path, taskTO, taskTO.getClass());
+ }
+
+ private Class<? extends TaskTO> getTOClass(final TaskType type) {
+ switch (type) {
+ case PROPAGATION:
+ return PropagationTaskTO.class;
+
+ case NOTIFICATION:
+ return NotificationTaskTO.class;
+
+ case SCHEDULED:
+ return SchedTaskTO.class;
+
+ case SYNCHRONIZATION:
+ return SyncTaskTO.class;
+
+ default:
+ throw new IllegalArgumentException("SchemaType is not supported: " + type);
+ }
+ }
+}
Added: syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/UserRequestServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/UserRequestServiceProxy.java?rev=1436230&view=auto
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/UserRequestServiceProxy.java (added)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/UserRequestServiceProxy.java Mon Jan 21 09:08:54 2013
@@ -0,0 +1,71 @@
+/*
+ * 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.services.proxy;
+
+import java.util.Arrays;
+import java.util.List;
+import org.apache.syncope.common.mod.UserMod;
+import org.apache.syncope.common.services.UserRequestService;
+import org.apache.syncope.common.to.UserRequestTO;
+import org.apache.syncope.common.to.UserTO;
+import org.springframework.web.client.RestTemplate;
+
+public class UserRequestServiceProxy extends SpringServiceProxy implements UserRequestService {
+
+ public UserRequestServiceProxy(final String baseUrl, final RestTemplate restTemplate) {
+ super(baseUrl, restTemplate);
+ }
+
+ @Override
+ public boolean isCreateAllowed() {
+ return getRestTemplate().getForObject(baseUrl + "user/request/create/allowed", Boolean.class);
+ }
+
+ @Override
+ public UserRequestTO create(final UserTO userTO) {
+ return getRestTemplate().postForObject(baseUrl + "user/request/create", userTO, UserRequestTO.class);
+ }
+
+ @Override
+ public UserRequestTO update(final UserMod userMod) {
+ return getRestTemplate().postForObject(baseUrl + "user/request/update", userMod, UserRequestTO.class);
+ }
+
+ @Override
+ public UserRequestTO delete(final Long userId) {
+ return getRestTemplate().getForObject(baseUrl + "user/request/delete/{userId}", UserRequestTO.class, userId);
+ }
+
+ @Override
+ public List<UserRequestTO> list() {
+ return Arrays.asList(getRestTemplate().getForObject(baseUrl + "user/request/list", UserRequestTO[].class));
+ }
+
+ @Override
+ public UserRequestTO read(final Long requestId) {
+ return getRestTemplate().getForObject(
+ baseUrl + "user/request/read/{requestId}", UserRequestTO.class, requestId);
+ }
+
+ @Override
+ public UserRequestTO deleteRequest(final Long requestId) {
+ return getRestTemplate().getForObject(
+ baseUrl + "user/request/deleteRequest/{requestId}", UserRequestTO.class, requestId);
+ }
+}
Added: syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/UserServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/UserServiceProxy.java?rev=1436230&view=auto
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/UserServiceProxy.java (added)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/UserServiceProxy.java Mon Jan 21 09:08:54 2013
@@ -0,0 +1,185 @@
+/*
+ * 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.services.proxy;
+
+import java.util.Arrays;
+import java.util.List;
+import org.apache.syncope.common.mod.StatusMod;
+import org.apache.syncope.common.mod.UserMod;
+import org.apache.syncope.common.search.NodeCond;
+import org.apache.syncope.common.services.UserService;
+import org.apache.syncope.common.to.UserTO;
+import org.apache.syncope.common.to.WorkflowFormTO;
+import org.springframework.web.client.RestTemplate;
+
+public class UserServiceProxy extends SpringServiceProxy implements UserService {
+
+ public UserServiceProxy(final String baseUrl, final RestTemplate restTemplate) {
+ super(baseUrl, restTemplate);
+ }
+
+ @Override
+ public Boolean verifyPassword(final String username, final String password) {
+ return getRestTemplate().getForObject(
+ baseUrl + "user/verifyPassword/{username}.json?password={password}", Boolean.class,
+ username, password);
+ }
+
+ @Override
+ public int count() {
+ return getRestTemplate().getForObject(baseUrl + "user/count.json", Integer.class);
+ }
+
+ @Override
+ public List<UserTO> list() {
+ return Arrays.asList(getRestTemplate().getForObject(baseUrl + "user/list.json", UserTO[].class));
+ }
+
+ @Override
+ public List<UserTO> list(final int page, final int size) {
+ return Arrays.asList(getRestTemplate().getForObject(baseUrl + "user/list/{page}/{size}.json",
+ UserTO[].class, page, size));
+ }
+
+ @Override
+ public UserTO read(final Long userId) {
+ return getRestTemplate().getForObject(baseUrl + "user/read/{userId}.json", UserTO.class, userId);
+ }
+
+ @Override
+ public UserTO read(final String username) {
+ return getRestTemplate().getForObject(baseUrl + "user/readByUsername/{username}.json", UserTO.class,
+ username);
+ }
+
+ @Override
+ public UserTO create(final UserTO userTO) {
+ return getRestTemplate().postForObject(baseUrl + "user/create", userTO, UserTO.class);
+ }
+
+ @Override
+ public UserTO update(final Long userId, final UserMod userMod) {
+ return getRestTemplate().postForObject(baseUrl + "user/update", userMod, UserTO.class);
+ }
+
+ @Override
+ public UserTO delete(final Long userId) {
+ return getRestTemplate().getForObject(baseUrl + "user/delete/{userId}", UserTO.class, userId);
+ }
+
+ @Override
+ public UserTO executeWorkflow(final String taskId, final UserTO userTO) {
+ return null;
+ }
+
+ @Override
+ public List<WorkflowFormTO> getForms() {
+ return Arrays.asList(getRestTemplate().getForObject(baseUrl + "user/workflow/form/list",
+ WorkflowFormTO[].class));
+ }
+
+ @Override
+ public WorkflowFormTO getFormForUser(final Long userId) {
+ return getRestTemplate().getForObject(baseUrl + "user/workflow/form/{userId}", WorkflowFormTO.class,
+ userId);
+ }
+
+ @Override
+ public WorkflowFormTO claimForm(final String taskId) {
+ return getRestTemplate().getForObject(baseUrl + "user/workflow/form/claim/{taskId}",
+ WorkflowFormTO.class, taskId);
+ }
+
+ @Override
+ public UserTO submitForm(final WorkflowFormTO form) {
+ return getRestTemplate().postForObject(baseUrl + "user/workflow/form/submit", form, UserTO.class);
+ }
+
+ @Override
+ public UserTO activate(final long userId, final String token) {
+ return getRestTemplate().getForObject(baseUrl + "user/activate/{userId}?token=" + token, UserTO.class,
+ userId);
+ }
+
+ @Override
+ public UserTO activateByUsername(final String username, final String token) {
+ return getRestTemplate().getForObject(baseUrl + "user/activateByUsername/{username}.json?token=" + token,
+ UserTO.class, username);
+ }
+
+ @Override
+ public UserTO suspend(final long userId) {
+ return getRestTemplate().getForObject(baseUrl + "user/suspend/{userId}", UserTO.class, userId);
+ }
+
+ @Override
+ public UserTO reactivate(final long userId) {
+ return getRestTemplate().getForObject(baseUrl + "user/reactivate/{userId}", UserTO.class, userId);
+ }
+
+ @Override
+ public UserTO reactivate(long userId, String query) {
+ return getRestTemplate().getForObject(baseUrl + "user/reactivate/" + userId + query, UserTO.class);
+ }
+
+ @Override
+ public UserTO suspendByUsername(final String username) {
+ return getRestTemplate().getForObject(baseUrl + "user/suspendByUsername/{username}.json", UserTO.class,
+ username);
+ }
+
+ @Override
+ public UserTO reactivateByUsername(final String username) {
+ return getRestTemplate().getForObject(baseUrl + "user/reactivateByUsername/{username}.json",
+ UserTO.class, username);
+ }
+
+ @Override
+ public UserTO suspend(final long userId, final String query) {
+ return getRestTemplate().getForObject(baseUrl + "user/suspend/" + userId + query, UserTO.class);
+ }
+
+ @Override
+ public UserTO readSelf() {
+ return getRestTemplate().getForObject(baseUrl + "user/read/self", UserTO.class);
+ }
+
+ @Override
+ public List<UserTO> search(final NodeCond searchCondition) {
+ return Arrays.asList(getRestTemplate().postForObject(baseUrl + "user/search", searchCondition,
+ UserTO[].class));
+ }
+
+ @Override
+ public List<UserTO> search(final NodeCond searchCondition, final int page, final int size) {
+ return Arrays.asList(getRestTemplate().postForObject(baseUrl + "user/search/{page}/{size}",
+ searchCondition, UserTO[].class, page, size));
+ }
+
+ @Override
+ public int searchCount(final NodeCond searchCondition) {
+ return getRestTemplate()
+ .postForObject(baseUrl + "user/search/count.json", searchCondition, Integer.class);
+ }
+
+ @Override
+ public UserTO setStatus(final Long userId, final StatusMod statusUpdate) {
+ return null; // Not used in old REST API
+ }
+}
Added: syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/WorkflowServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/WorkflowServiceProxy.java?rev=1436230&view=auto
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/WorkflowServiceProxy.java (added)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/WorkflowServiceProxy.java Mon Jan 21 09:08:54 2013
@@ -0,0 +1,47 @@
+/*
+ * 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.services.proxy;
+
+import java.util.Arrays;
+import java.util.List;
+import org.apache.syncope.common.services.WorkflowService;
+import org.apache.syncope.common.to.WorkflowDefinitionTO;
+import org.springframework.web.client.RestTemplate;
+
+public class WorkflowServiceProxy extends SpringServiceProxy implements WorkflowService {
+
+ public WorkflowServiceProxy(final String baseUrl, final RestTemplate restTemplate) {
+ super(baseUrl, restTemplate);
+ }
+
+ @Override
+ public WorkflowDefinitionTO getDefinition(final String type) {
+ return getRestTemplate().getForObject(baseUrl + "workflow/definition/" + type, WorkflowDefinitionTO.class);
+ }
+
+ @Override
+ public void updateDefinition(final String type, final WorkflowDefinitionTO definition) {
+ getRestTemplate().put(baseUrl + "workflow/definition/" + type, definition);
+ }
+
+ @Override
+ public List<String> getDefinedTasks(final String type) {
+ return Arrays.asList(getRestTemplate().getForObject(baseUrl + "workflow/tasks/{type}", String[].class, type));
+ }
+}
Modified: syncope/trunk/client/src/test/java/org/apache/syncope/client/test/JSONTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/test/java/org/apache/syncope/client/test/JSONTest.java?rev=1436230&r1=1436229&r2=1436230&view=diff
==============================================================================
--- syncope/trunk/client/src/test/java/org/apache/syncope/client/test/JSONTest.java (original)
+++ syncope/trunk/client/src/test/java/org/apache/syncope/client/test/JSONTest.java Mon Jan 21 09:08:54 2013
@@ -27,15 +27,15 @@ import java.util.Arrays;
import java.util.List;
import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Test;
-import org.apache.syncope.client.report.UserReportletConf;
-import org.apache.syncope.client.search.AttributeCond;
-import org.apache.syncope.client.search.MembershipCond;
-import org.apache.syncope.client.search.NodeCond;
-import org.apache.syncope.client.to.ReportTO;
-import org.apache.syncope.client.to.SchemaTO;
-import org.apache.syncope.client.to.WorkflowFormPropertyTO;
-import org.apache.syncope.types.AuditElements;
-import org.apache.syncope.types.AuditLoggerName;
+import org.apache.syncope.common.report.UserReportletConf;
+import org.apache.syncope.common.search.AttributeCond;
+import org.apache.syncope.common.search.MembershipCond;
+import org.apache.syncope.common.search.NodeCond;
+import org.apache.syncope.common.to.ReportTO;
+import org.apache.syncope.common.to.SchemaTO;
+import org.apache.syncope.common.to.WorkflowFormPropertyTO;
+import org.apache.syncope.common.types.AuditElements;
+import org.apache.syncope.common.types.AuditLoggerName;
public class JSONTest {
Propchange: syncope/trunk/common/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Jan 21 09:08:54 2013
@@ -0,0 +1,6 @@
+.classpath
+.externalToolBuilders
+.project
+.settings
+maven-eclipse.xml
+target
Added: syncope/trunk/common/pom.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/common/pom.xml?rev=1436230&view=auto
==============================================================================
--- syncope/trunk/common/pom.xml (added)
+++ syncope/trunk/common/pom.xml Mon Jan 21 09:08:54 2013
@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.syncope</groupId>
+ <artifactId>syncope</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <name>Apache Syncope Common</name>
+ <description>Apache Syncope Common</description>
+ <groupId>org.apache.syncope</groupId>
+ <artifactId>syncope-common</artifactId>
+ <packaging>bundle</packaging>
+
+ <distributionManagement>
+ <site>
+ <id>syncope.website</id>
+ <name>Apache Syncope website</name>
+ <url>${site.deploymentBaseUrl}/${project.artifactId}</url>
+ </site>
+ </distributionManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>javax.ws.rs-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-webmvc</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-mapper-asl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-Name>${project.name}</Bundle-Name>
+ <Bundle-SymbolicName>org.apache.syncope.client</Bundle-SymbolicName>
+ <Bundle-Version>${project.version}</Bundle-Version>
+ <Export-Package>
+ org.apache.syncope*;version=${project.version};-split-package:=merge-first
+ </Export-Package>
+ <Import-Package>
+ org.apache.commons.lang*;version="[2.6,3)",
+ org.apache.http*;version="[4,5)",
+ org.codehaus.jackson.annotate;version="[1.9,2)",
+ org.springframework*;version="[3,4)",
+ ch.qos.logback.classic;resolution:=optional,
+ org.slf4j;resolution:=optional,
+ *
+ </Import-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ </plugin>
+ </plugins>
+
+ <resources>
+ <resource>
+ <directory>..</directory>
+ <targetPath>META-INF</targetPath>
+ <includes>
+ <include>LICENSE</include>
+ <include>NOTICE</include>
+ </includes>
+ </resource>
+ </resources>
+ </build>
+</project>
Added: syncope/trunk/common/src/main/java/org/apache/syncope/common/AbstractBaseBean.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/AbstractBaseBean.java?rev=1436230&view=auto
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/AbstractBaseBean.java (added)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/AbstractBaseBean.java Mon Jan 21 09:08:54 2013
@@ -0,0 +1,45 @@
+/*
+ * 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.common;
+
+import java.io.Serializable;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang.builder.ToStringStyle;
+
+public abstract class AbstractBaseBean implements Serializable {
+
+ private static final long serialVersionUID = 3119542005279892164L;
+
+ @Override
+ public boolean equals(Object obj) {
+ return EqualsBuilder.reflectionEquals(this, obj);
+ }
+
+ @Override
+ public int hashCode() {
+ return HashCodeBuilder.reflectionHashCode(this);
+ }
+
+ @Override
+ public String toString() {
+ return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+ }
+}
Added: syncope/trunk/common/src/main/java/org/apache/syncope/common/SyncopeConstants.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/SyncopeConstants.java?rev=1436230&view=auto
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/SyncopeConstants.java (added)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/SyncopeConstants.java Mon Jan 21 09:08:54 2013
@@ -0,0 +1,34 @@
+/*
+ * 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.common;
+
+
+public class SyncopeConstants {
+
+ public static final String[] DATE_PATTERNS = {
+ "yyyy-MM-dd'T'HH:mm:ssZ",
+ "EEE, dd MMM yyyy HH:mm:ss z",
+ "yyyy-MM-dd'T'HH:mm:ssz",
+ "yyyy-MM-dd HH:mm:ss",
+ "yyyy-MM-dd HH:mm:ss.S", // explicitly added to import date into MySql repository
+ "yyyy-MM-dd"};
+
+ public static final String DEFAULT_DATE_PATTERN = "yyyy-MM-dd'T'HH:mm:ssZ";
+
+}
Added: syncope/trunk/common/src/main/java/org/apache/syncope/common/annotation/FormAttributeField.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/annotation/FormAttributeField.java?rev=1436230&view=auto
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/annotation/FormAttributeField.java (added)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/annotation/FormAttributeField.java Mon Jan 21 09:08:54 2013
@@ -0,0 +1,33 @@
+/*
+ * 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.common.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.syncope.common.types.IntMappingType;
+
+@Target( { ElementType.FIELD })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface FormAttributeField {
+
+ IntMappingType schema() default IntMappingType.UserSchema;
+}
Added: syncope/trunk/common/src/main/java/org/apache/syncope/common/annotation/SchemaList.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/annotation/SchemaList.java?rev=1436230&view=auto
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/annotation/SchemaList.java (added)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/annotation/SchemaList.java Mon Jan 21 09:08:54 2013
@@ -0,0 +1,28 @@
+/*
+ * 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.common.annotation;
+
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@Retention(RUNTIME)
+public @interface SchemaList {
+
+ boolean extended() default false;
+}
Added: syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/AbstractAttributableMod.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/AbstractAttributableMod.java?rev=1436230&view=auto
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/AbstractAttributableMod.java (added)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/AbstractAttributableMod.java Mon Jan 21 09:08:54 2013
@@ -0,0 +1,252 @@
+/*
+ * 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.common.mod;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.syncope.common.AbstractBaseBean;
+
+/**
+ * Abstract base class for objects that can have attributes removed, added or updated.
+ *
+ * Attributes can be regular attributes, derived attributes, virtual attributes and resources.
+ */
+public abstract class AbstractAttributableMod extends AbstractBaseBean {
+
+ private static final long serialVersionUID = 3241118574016303198L;
+ protected long id;
+ protected Set<AttributeMod> attributesToBeUpdated;
+ protected Set<String> attributesToBeRemoved;
+ protected Set<String> derivedAttributesToBeAdded;
+ protected Set<String> derivedAttributesToBeRemoved;
+ protected Set<AttributeMod> virtualAttributesToBeUpdated;
+ protected Set<String> virtualAttributesToBeRemoved;
+ protected Set<String> resourcesToBeAdded;
+ protected Set<String> resourcesToBeRemoved;
+
+ /**
+ * All attributes are initialized to empty sets.
+ */
+ public AbstractAttributableMod() {
+ super();
+
+ attributesToBeUpdated = new HashSet<AttributeMod>();
+ attributesToBeRemoved = new HashSet<String>();
+ derivedAttributesToBeAdded = new HashSet<String>();
+ derivedAttributesToBeRemoved = new HashSet<String>();
+ virtualAttributesToBeUpdated = new HashSet<AttributeMod>();
+ virtualAttributesToBeRemoved = new HashSet<String>();
+ resourcesToBeAdded = new HashSet<String>();
+ resourcesToBeRemoved = new HashSet<String>();
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ /**
+ * Convenience method for removing entire attribute instead removing each value in an AttributeMod object
+ *
+ * @param name (schema) of attribute to be removed.
+ * @return true on success.
+ */
+ public boolean addAttributeToBeRemoved(String attribute) {
+ return attributesToBeRemoved.add(attribute);
+ }
+
+ /**
+ * Convenience method for removing entire attribute instead removing each value in an AttributeMod object
+ *
+ * @param name (schema) of attribute to be removed.
+ * @return true on success.
+ */
+ public boolean removeAttributeToBeRemoved(String attribute) {
+ return attributesToBeRemoved.remove(attribute);
+ }
+
+ public Set<String> getAttributesToBeRemoved() {
+ return attributesToBeRemoved;
+ }
+
+ public void setAttributesToBeRemoved(Set<String> attributesToBeRemoved) {
+ this.attributesToBeRemoved = attributesToBeRemoved;
+ }
+
+ /**
+ * Add an attribute modification object. AttributeMod itself indicates how the attribute should be modified.
+ *
+ * @param attribute modification object
+ * @see AttributeMod
+ * @return true on success
+ */
+ public boolean addAttributeToBeUpdated(AttributeMod attribute) {
+ return attributesToBeUpdated.add(attribute);
+ }
+
+ /**
+ * Remove an attribute modification object. AttributeMod itself indicates how the attribute should be modified.
+ *
+ * @param attribute modification object
+ * @see AttributeMod
+ * @return true on success
+ */
+ public boolean removeAttributeToBeUpdated(AttributeMod attribute) {
+ return attributesToBeUpdated.remove(attribute);
+ }
+
+ public Set<AttributeMod> getAttributesToBeUpdated() {
+ return attributesToBeUpdated;
+ }
+
+ public void setAttributesToBeUpdated(Set<AttributeMod> attributesToBeUpdated) {
+ this.attributesToBeUpdated = attributesToBeUpdated;
+ }
+
+ /**
+ * Add an attribute modification object. AttributeMod itself indicates how the attribute should be modified.
+ *
+ * @param attribute modification object
+ * @see AttributeMod
+ * @return true on success
+ */
+ public boolean addDerivedAttributeToBeAdded(String derivedAttribute) {
+ return derivedAttributesToBeAdded.add(derivedAttribute);
+ }
+
+ /**
+ * Add a derivedattribute. Value is calculated by its definition.
+ *
+ * @param derivedAttribute
+ * @return true on success
+ */
+ public boolean removeDerivedAttributeToBeAdded(String derivedAttribute) {
+ return derivedAttributesToBeAdded.remove(derivedAttribute);
+ }
+
+ public Set<String> getDerivedAttributesToBeAdded() {
+ return derivedAttributesToBeAdded;
+ }
+
+ public void setDerivedAttributesToBeAdded(Set<String> derivedAttributesToBeAdded) {
+
+ this.derivedAttributesToBeAdded = derivedAttributesToBeAdded;
+ }
+
+ public boolean addDerivedAttributeToBeRemoved(String derivedAttribute) {
+ return derivedAttributesToBeRemoved.add(derivedAttribute);
+ }
+
+ public boolean removeDerivedAttributeToBeRemoved(String derivedAttribute) {
+ return derivedAttributesToBeRemoved.remove(derivedAttribute);
+ }
+
+ public Set<String> getDerivedAttributesToBeRemoved() {
+ return derivedAttributesToBeRemoved;
+ }
+
+ public void setDerivedAttributesToBeRemoved(Set<String> derivedAttributesToBeRemoved) {
+
+ this.derivedAttributesToBeRemoved = derivedAttributesToBeRemoved;
+ }
+
+ public Set<String> getVirtualAttributesToBeRemoved() {
+ return virtualAttributesToBeRemoved;
+ }
+
+ public boolean addVirtualAttributeToBeRemoved(String virtualAttributeToBeRemoved) {
+
+ return virtualAttributesToBeRemoved.add(virtualAttributeToBeRemoved);
+ }
+
+ public boolean removeVirtualAttributeToBeRemoved(String virtualAttributeToBeRemoved) {
+
+ return virtualAttributesToBeRemoved.remove(virtualAttributeToBeRemoved);
+ }
+
+ public void setVirtualAttributesToBeRemoved(Set<String> virtualAttributesToBeRemoved) {
+
+ this.virtualAttributesToBeRemoved = virtualAttributesToBeRemoved;
+ }
+
+ public boolean addVirtualAttributeToBeUpdated(AttributeMod virtualAttributeToBeUpdated) {
+
+ return virtualAttributesToBeUpdated.add(virtualAttributeToBeUpdated);
+ }
+
+ public boolean removeVirtualAttributeToBeUpdated(AttributeMod virtualAttributeToBeUpdated) {
+
+ return virtualAttributesToBeUpdated.remove(virtualAttributeToBeUpdated);
+ }
+
+ public Set<AttributeMod> getVirtualAttributesToBeUpdated() {
+ return virtualAttributesToBeUpdated;
+ }
+
+ public void setVirtualAttributesToBeUpdated(Set<AttributeMod> virtualAttributesToBeUpdated) {
+
+ this.virtualAttributesToBeUpdated = virtualAttributesToBeUpdated;
+ }
+
+ public boolean addResourceToBeAdded(String resource) {
+ return resourcesToBeAdded.add(resource);
+ }
+
+ public boolean removeResourceToBeAdded(String resource) {
+ return resourcesToBeAdded.remove(resource);
+ }
+
+ public Set<String> getResourcesToBeAdded() {
+ return resourcesToBeAdded;
+ }
+
+ public void setResourcesToBeAdded(Set<String> resourcesToBeAdded) {
+ this.resourcesToBeAdded = resourcesToBeAdded;
+ }
+
+ public boolean addResourceToBeRemoved(String resource) {
+ return resourcesToBeRemoved.add(resource);
+ }
+
+ public boolean removeResourceToBeRemoved(String resource) {
+ return resourcesToBeRemoved.remove(resource);
+ }
+
+ public Set<String> getResourcesToBeRemoved() {
+ return resourcesToBeRemoved;
+ }
+
+ public void setResourcesToBeRemoved(Set<String> resourcesToBeRemoved) {
+ this.resourcesToBeRemoved = resourcesToBeRemoved;
+ }
+
+ /**
+ * @return true is all backing Sets are empty.
+ */
+ public boolean isEmpty() {
+ return attributesToBeUpdated.isEmpty() && attributesToBeRemoved.isEmpty()
+ && derivedAttributesToBeAdded.isEmpty() && derivedAttributesToBeRemoved.isEmpty()
+ && virtualAttributesToBeUpdated.isEmpty() && virtualAttributesToBeRemoved.isEmpty()
+ && resourcesToBeAdded.isEmpty() && resourcesToBeRemoved.isEmpty();
+ }
+}
Added: syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/AttributeMod.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/AttributeMod.java?rev=1436230&view=auto
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/AttributeMod.java (added)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/AttributeMod.java Mon Jan 21 09:08:54 2013
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.common.mod;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.apache.syncope.common.AbstractBaseBean;
+
+public class AttributeMod extends AbstractBaseBean {
+
+ private static final long serialVersionUID = -913573979137431406L;
+
+ private String schema;
+
+ private List<String> valuesToBeAdded;
+
+ private List<String> valuesToBeRemoved;
+
+ public AttributeMod() {
+ super();
+
+ valuesToBeAdded = new ArrayList<String>();
+ valuesToBeRemoved = new ArrayList<String>();
+ }
+
+ public String getSchema() {
+ return schema;
+ }
+
+ public void setSchema(String schema) {
+ this.schema = schema;
+ }
+
+ public boolean addValueToBeAdded(String value) {
+ return valuesToBeAdded.add(value);
+ }
+
+ public boolean removeValueToBeAdded(String value) {
+ return valuesToBeAdded.remove(value);
+ }
+
+ public List<String> getValuesToBeAdded() {
+ return valuesToBeAdded;
+ }
+
+ public void setValuesToBeAdded(List<String> valuesToBeAdded) {
+ this.valuesToBeAdded = valuesToBeAdded;
+ }
+
+ public boolean addValueToBeRemoved(String value) {
+ return valuesToBeRemoved.add(value);
+ }
+
+ public boolean removeValueToBeRemoved(String value) {
+ return valuesToBeRemoved.remove(value);
+ }
+
+ public List<String> getValuesToBeRemoved() {
+ return valuesToBeRemoved;
+ }
+
+ public void setValuesToBeRemoved(List<String> valuesToBeRemoved) {
+ this.valuesToBeRemoved = valuesToBeRemoved;
+ }
+
+ @JsonIgnore
+ public boolean isEmpty() {
+ return valuesToBeAdded.isEmpty() && valuesToBeRemoved.isEmpty();
+ }
+}
Added: syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/MembershipMod.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/MembershipMod.java?rev=1436230&view=auto
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/MembershipMod.java (added)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/MembershipMod.java Mon Jan 21 09:08:54 2013
@@ -0,0 +1,82 @@
+/*
+ * 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.common.mod;
+
+import java.util.Collections;
+import java.util.Set;
+import org.codehaus.jackson.annotate.JsonIgnore;
+
+public class MembershipMod extends AbstractAttributableMod {
+
+ private static final long serialVersionUID = 2511869129977331525L;
+
+ private long role;
+
+ public long getRole() {
+ return role;
+ }
+
+ public void setRole(long role) {
+ this.role = role;
+ }
+
+ @Override
+ public boolean addResourceToBeAdded(String resource) {
+ return false;
+ }
+
+ @Override
+ public boolean addResourceToBeRemoved(String resource) {
+ return false;
+ }
+
+ @Override
+ public Set<String> getResourcesToBeAdded() {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public Set<String> getResourcesToBeRemoved() {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public boolean removeResourceToBeAdded(String resource) {
+ return false;
+ }
+
+ @Override
+ public boolean removeResourceToBeRemoved(String resource) {
+ return false;
+ }
+
+ @Override
+ public void setResourcesToBeAdded(Set<String> resourcesToBeAdded) {
+ }
+
+ @Override
+ public void setResourcesToBeRemoved(Set<String> resourcesToBeRemoved) {
+ }
+
+ @JsonIgnore
+ @Override
+ public boolean isEmpty() {
+ return super.isEmpty() && role == 0;
+ }
+}
Added: syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/ReferenceMod.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/ReferenceMod.java?rev=1436230&view=auto
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/ReferenceMod.java (added)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/ReferenceMod.java Mon Jan 21 09:08:54 2013
@@ -0,0 +1,49 @@
+/*
+ * 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.common.mod;
+
+import org.apache.syncope.common.AbstractBaseBean;
+
+/**
+ * This class is used to specify the willing to modify an external reference id. Use 'null' ReferenceMod to keep the
+ * current reference id; use a ReferenceMod with a null id to try to reset the reference id; use a ReferenceMod with a
+ * not null id to specify a new reference id.
+ */
+public class ReferenceMod extends AbstractBaseBean {
+
+ private static final long serialVersionUID = -4188817853738067677L;
+
+ private Long id;
+
+ public ReferenceMod() {
+ this.id = null;
+ }
+
+ public ReferenceMod(final Long id) {
+ this.id = id;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+}
Added: syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/RoleMod.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/RoleMod.java?rev=1436230&view=auto
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/RoleMod.java (added)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/RoleMod.java Mon Jan 21 09:08:54 2013
@@ -0,0 +1,156 @@
+/*
+ * 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.common.mod;
+
+import java.util.List;
+import org.codehaus.jackson.annotate.JsonIgnore;
+
+public class RoleMod extends AbstractAttributableMod {
+
+ private static final long serialVersionUID = 7455805264680210747L;
+
+ private String name;
+
+ private ReferenceMod userOwner;
+
+ private ReferenceMod roleOwner;
+
+ private Boolean inheritOwner;
+
+ private Boolean inheritAttributes;
+
+ private Boolean inheritDerivedAttributes;
+
+ private Boolean inheritVirtualAttributes;
+
+ private Boolean inheritAccountPolicy;
+
+ private Boolean inheritPasswordPolicy;
+
+ private List<String> entitlements;
+
+ private ReferenceMod passwordPolicy;
+
+ private ReferenceMod accountPolicy;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public ReferenceMod getUserOwner() {
+ return userOwner;
+ }
+
+ public void setUserOwner(ReferenceMod userOwner) {
+ this.userOwner = userOwner;
+ }
+
+ public ReferenceMod getRoleOwner() {
+ return roleOwner;
+ }
+
+ public void setRoleOwner(ReferenceMod roleOwner) {
+ this.roleOwner = roleOwner;
+ }
+
+ public Boolean getInheritOwner() {
+ return inheritOwner;
+ }
+
+ public void setInheritOwner(Boolean inheritOwner) {
+ this.inheritOwner = inheritOwner;
+ }
+
+ public Boolean getInheritAttributes() {
+ return inheritAttributes;
+ }
+
+ public void setInheritAttributes(final Boolean inheritAttributes) {
+ this.inheritAttributes = inheritAttributes;
+ }
+
+ public Boolean getInheritDerivedAttributes() {
+ return inheritDerivedAttributes;
+ }
+
+ public void setInheritDerivedAttributes(final Boolean inheritDerivedAttributes) {
+ this.inheritDerivedAttributes = inheritDerivedAttributes;
+ }
+
+ public Boolean getInheritVirtualAttributes() {
+ return inheritVirtualAttributes;
+ }
+
+ public void setInheritVirtualAttributes(final Boolean inheritVirtualAttributes) {
+ this.inheritVirtualAttributes = inheritVirtualAttributes;
+ }
+
+ public List<String> getEntitlements() {
+ return entitlements;
+ }
+
+ public void setEntitlements(final List<String> entitlements) {
+ this.entitlements = entitlements;
+ }
+
+ public ReferenceMod getPasswordPolicy() {
+ return passwordPolicy;
+ }
+
+ public void setPasswordPolicy(final ReferenceMod passwordPolicy) {
+ this.passwordPolicy = passwordPolicy;
+ }
+
+ public Boolean getInheritPasswordPolicy() {
+ return inheritPasswordPolicy;
+ }
+
+ public void setInheritPasswordPolicy(final Boolean inheritPasswordPolicy) {
+ this.inheritPasswordPolicy = inheritPasswordPolicy;
+ }
+
+ public ReferenceMod getAccountPolicy() {
+ return accountPolicy;
+ }
+
+ public void setAccountPolicy(final ReferenceMod accountPolicy) {
+ this.accountPolicy = accountPolicy;
+ }
+
+ public Boolean getInheritAccountPolicy() {
+ return inheritAccountPolicy;
+ }
+
+ public void setInheritAccountPolicy(final Boolean inheritAccountPolicy) {
+ this.inheritAccountPolicy = inheritAccountPolicy;
+ }
+
+ @JsonIgnore
+ @Override
+ public boolean isEmpty() {
+ return super.isEmpty() && name == null && userOwner == null && roleOwner == null
+ && inheritOwner == null && inheritAccountPolicy == null && inheritPasswordPolicy == null
+ && inheritAttributes == null && inheritDerivedAttributes == null && inheritVirtualAttributes == null
+ && accountPolicy == null && passwordPolicy == null && (entitlements == null || entitlements.isEmpty());
+ }
+}
Added: syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/StatusMod.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/StatusMod.java?rev=1436230&view=auto
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/StatusMod.java (added)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/StatusMod.java Mon Jan 21 09:08:54 2013
@@ -0,0 +1,121 @@
+/*
+ * 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.common.mod;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.apache.syncope.common.AbstractBaseBean;
+
+@XmlType
+@XmlRootElement
+public class StatusMod extends AbstractBaseBean {
+
+ public enum Status {
+ ACTIVATE, REACTIVATE, SUSPEND;
+ }
+
+ public StatusMod(long id, Status status) {
+ this.id = id;
+ this.status = status;
+ }
+
+ public StatusMod() {
+ }
+
+ private Status status;
+
+ private String token;
+
+ private static final long serialVersionUID = 1338094801957616986L;
+
+ private long id;
+
+ private boolean updateInternal = true;
+
+ private boolean updateRemote = true;
+
+ private final Set<String> excludeResources = new HashSet<String>();
+
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public boolean isUpdateInternal() {
+ return updateInternal;
+ }
+
+ public void setUpdateInternal(boolean updateInternal) {
+ this.updateInternal = updateInternal;
+ }
+
+ public boolean isUpdateRemote() {
+ return updateRemote;
+ }
+
+ public void setUpdateRemote(boolean updateRemote) {
+ this.updateRemote = updateRemote;
+ }
+
+ @XmlElementWrapper(name = "excludeResources")
+ @XmlElement(name = "resource")
+ public Set<String> getExcludeResources() {
+ return excludeResources;
+ }
+
+ /**
+ * @return the status
+ */
+ public Status getStatus() {
+ return status;
+ }
+
+ /**
+ * @param status
+ * the status to set
+ */
+ public void setStatus(Status status) {
+ this.status = status;
+ }
+
+ /**
+ * @return the token
+ */
+ public String getToken() {
+ return token;
+ }
+
+ /**
+ * @param token
+ * the token to set
+ */
+ public void setToken(String token) {
+ this.token = token;
+ }
+
+}
Added: syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/UserMod.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/UserMod.java?rev=1436230&view=auto
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/UserMod.java (added)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/UserMod.java Mon Jan 21 09:08:54 2013
@@ -0,0 +1,98 @@
+/*
+ * 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.common.mod;
+
+import java.util.HashSet;
+import java.util.Set;
+import org.codehaus.jackson.annotate.JsonIgnore;
+
+public class UserMod extends AbstractAttributableMod {
+
+ private static final long serialVersionUID = 3081848906558106204L;
+
+ private String password;
+
+ private String username;
+
+ private Set<MembershipMod> membershipsToBeAdded;
+
+ private Set<Long> membershipsToBeRemoved;
+
+ public UserMod() {
+ super();
+
+ membershipsToBeAdded = new HashSet<MembershipMod>();
+ membershipsToBeRemoved = new HashSet<Long>();
+ }
+
+ public boolean addMembershipToBeAdded(MembershipMod membershipMod) {
+ return membershipsToBeAdded.add(membershipMod);
+ }
+
+ public boolean removeMembershipToBeAdded(MembershipMod membershipMod) {
+ return membershipsToBeAdded.remove(membershipMod);
+ }
+
+ public Set<MembershipMod> getMembershipsToBeAdded() {
+ return membershipsToBeAdded;
+ }
+
+ public void setMembershipsToBeAdded(Set<MembershipMod> membershipMods) {
+ this.membershipsToBeAdded = membershipMods;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public boolean addMembershipToBeRemoved(Long membershipToBeRemoved) {
+ return membershipsToBeRemoved.add(membershipToBeRemoved);
+ }
+
+ public boolean removeMembershipToBeRemoved(Long membershipToBeRemoved) {
+ return membershipsToBeRemoved.remove(membershipToBeRemoved);
+ }
+
+ public Set<Long> getMembershipsToBeRemoved() {
+ return membershipsToBeRemoved;
+ }
+
+ public void setMembershipsToBeRemoved(Set<Long> membershipsToBeRemoved) {
+ this.membershipsToBeRemoved = membershipsToBeRemoved;
+ }
+
+ @JsonIgnore
+ @Override
+ public boolean isEmpty() {
+ return super.isEmpty() && password == null && username == null && membershipsToBeAdded.isEmpty()
+ && membershipsToBeRemoved.isEmpty();
+ }
+}
Added: syncope/trunk/common/src/main/java/org/apache/syncope/common/report/AbstractReportletConf.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/report/AbstractReportletConf.java?rev=1436230&view=auto
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/report/AbstractReportletConf.java (added)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/report/AbstractReportletConf.java Mon Jan 21 09:08:54 2013
@@ -0,0 +1,46 @@
+/*
+ * 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.common.report;
+
+import org.apache.syncope.common.AbstractBaseBean;
+
+public abstract class AbstractReportletConf extends AbstractBaseBean implements ReportletConf {
+
+ private static final long serialVersionUID = -6130008602014516608L;
+
+ private String name;
+
+ public AbstractReportletConf() {
+ this("");
+ setName(getClass().getName());
+ }
+
+ public AbstractReportletConf(final String name) {
+ this.name = name;
+ }
+
+ @Override
+ public final String getName() {
+ return name;
+ }
+
+ public final void setName(final String name) {
+ this.name = name;
+ }
+}
Added: syncope/trunk/common/src/main/java/org/apache/syncope/common/report/ReportletConf.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/report/ReportletConf.java?rev=1436230&view=auto
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/report/ReportletConf.java (added)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/report/ReportletConf.java Mon Jan 21 09:08:54 2013
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.common.report;
+
+import org.codehaus.jackson.annotate.JsonTypeInfo;
+
+@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class")
+public interface ReportletConf {
+
+ /**
+ * Give name of related reportlet instance.
+ *
+ * @return name of this reportlet instance
+ */
+ String getName();
+}