Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/services/ResourceService.java URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/services/ResourceService.java?rev=1615910&r1=1615909&r2=1615910&view=diff ============================================================================== --- syncope/trunk/common/src/main/java/org/apache/syncope/common/services/ResourceService.java (original) +++ syncope/trunk/common/src/main/java/org/apache/syncope/common/services/ResourceService.java Tue Aug 5 11:20:00 2014 @@ -1,184 +1,184 @@ -/* - * 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.services; - -import java.util.List; -import javax.validation.constraints.NotNull; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.MatrixParam; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import org.apache.cxf.jaxrs.model.wadl.Description; -import org.apache.cxf.jaxrs.model.wadl.Descriptions; -import org.apache.cxf.jaxrs.model.wadl.DocTarget; -import org.apache.syncope.common.reqres.BulkAction; -import org.apache.syncope.common.reqres.BulkActionResult; -import org.apache.syncope.common.to.ConnObjectTO; -import org.apache.syncope.common.to.ResourceTO; -import org.apache.syncope.common.types.ResourceDeassociationActionType; -import org.apache.syncope.common.types.SubjectType; -import org.apache.syncope.common.wrap.PropagationActionClass; -import org.apache.syncope.common.wrap.SubjectId; - -/** - * REST operations for external resources. - */ -@Path("resources") -public interface ResourceService extends JAXRSService { - - /** - * Returns connector object from the external resource, for the given type and id. - * - * @param resourceName Name of resource to read connector object from - * @param type user / role - * @param id user id / role id - * @return connector object from the external resource, for the given type and id - */ - @GET - @Path("{resourceName}/{type}/{id}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - ConnObjectTO getConnectorObject(@NotNull @PathParam("resourceName") String resourceName, - @NotNull @PathParam("type") SubjectType type, @NotNull @PathParam("id") Long id); - - /** - * Returns a list of classes that can be used to customize the propagation process. - * - * @return list of classes that can be used to customize the propagation process - */ - @GET - @Path("propagationActionsClasses") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - List<PropagationActionClass> getPropagationActionsClasses(); - - /** - * Returns the resource with matching name. - * - * @param resourceName Name of resource to be read - * @return resource with matching name - */ - @GET - @Path("{resourceName}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - ResourceTO read(@NotNull @PathParam("resourceName") String resourceName); - - /** - * Returns a list of all resources. - * - * @return list of all resources - */ - @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - List<ResourceTO> list(); - - /** - * Returns a list of resources using matching connector instance id. - * - * @param connInstanceId Connector id to filter for resources - * @return resources using matching connector instance id - */ - @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - List<ResourceTO> list(@NotNull @MatrixParam("connectorId") Long connInstanceId); - - /** - * Creates a new resource. - * - * @param resourceTO Resource to be created - * @return <tt>Response</tt> object featuring <tt>Location</tt> header of created resource - */ - @Descriptions({ - @Description(target = DocTarget.RESPONSE, - value = "Featuring <tt>Location</tt> header of created resource") - }) - @POST - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - Response create(@NotNull ResourceTO resourceTO); - - /** - * Updates the resource matching the given name. - * - * @param resourceName name of resource to be updated - * @param resourceTO resource to be stored - */ - @PUT - @Path("{resourceName}") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - void update(@NotNull @PathParam("resourceName") String resourceName, @NotNull ResourceTO resourceTO); - - /** - * Deletes the resource matching the given name. - * - * @param resourceName name of resource to be deleted - */ - @DELETE - @Path("{resourceName}") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - void delete(@NotNull @PathParam("resourceName") String resourceName); - - /** - * Checks wether the connection to resource could be established. - * - * @param resourceTO resource to be checked - * @return true if connection to resource could be established - */ - @POST - @Path("check") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - boolean check(@NotNull ResourceTO resourceTO); - - /** - * De-associate users or roles (depending on the provided subject type) from the given resource. - * - * @param resourceName name of resource - * @param subjectType subject type (user or role) - * @param type resource de-association action type - * @param subjectIds users or roles against which the bulk action will be performed - * @return <tt>Response</tt> object featuring {@link BulkActionResult} as <tt>Entity</tt> - */ - @Descriptions({ - @Description(target = DocTarget.RESPONSE, - value = "Featuring <tt>BulkActionResult</tt> as <tt>Entity</tt>") - }) - @POST - @Path("{resourceName}/bulkDeassociation/{subjType}/{type}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - BulkActionResult bulkDeassociation(@NotNull @PathParam("resourceName") String resourceName, - @NotNull @PathParam("subjType") SubjectType subjectType, - @NotNull @PathParam("type") ResourceDeassociationActionType type, @NotNull List<SubjectId> subjectIds); - - /** - * Executes the provided bulk action. - * - * @param bulkAction list of resource names against which the bulk action will be performed - * @return Bulk action result - */ - @POST - @Path("bulk") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - BulkActionResult bulk(@NotNull BulkAction bulkAction); -} +/* + * 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.services; + +import java.util.List; +import javax.validation.constraints.NotNull; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.MatrixParam; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import org.apache.cxf.jaxrs.model.wadl.Description; +import org.apache.cxf.jaxrs.model.wadl.Descriptions; +import org.apache.cxf.jaxrs.model.wadl.DocTarget; +import org.apache.syncope.common.reqres.BulkAction; +import org.apache.syncope.common.reqres.BulkActionResult; +import org.apache.syncope.common.to.ConnObjectTO; +import org.apache.syncope.common.to.ResourceTO; +import org.apache.syncope.common.types.ResourceDeassociationActionType; +import org.apache.syncope.common.types.SubjectType; +import org.apache.syncope.common.wrap.PropagationActionClass; +import org.apache.syncope.common.wrap.SubjectId; + +/** + * REST operations for external resources. + */ +@Path("resources") +public interface ResourceService extends JAXRSService { + + /** + * Returns connector object from the external resource, for the given type and id. + * + * @param resourceName Name of resource to read connector object from + * @param type user / role + * @param id user id / role id + * @return connector object from the external resource, for the given type and id + */ + @GET + @Path("{resourceName}/{type}/{id}") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + ConnObjectTO getConnectorObject(@NotNull @PathParam("resourceName") String resourceName, + @NotNull @PathParam("type") SubjectType type, @NotNull @PathParam("id") Long id); + + /** + * Returns a list of classes that can be used to customize the propagation process. + * + * @return list of classes that can be used to customize the propagation process + */ + @GET + @Path("propagationActionsClasses") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + List<PropagationActionClass> getPropagationActionsClasses(); + + /** + * Returns the resource with matching name. + * + * @param resourceName Name of resource to be read + * @return resource with matching name + */ + @GET + @Path("{resourceName}") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + ResourceTO read(@NotNull @PathParam("resourceName") String resourceName); + + /** + * Returns a list of all resources. + * + * @return list of all resources + */ + @GET + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + List<ResourceTO> list(); + + /** + * Returns a list of resources using matching connector instance id. + * + * @param connInstanceId Connector id to filter for resources + * @return resources using matching connector instance id + */ + @GET + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + List<ResourceTO> list(@NotNull @MatrixParam("connectorId") Long connInstanceId); + + /** + * Creates a new resource. + * + * @param resourceTO Resource to be created + * @return <tt>Response</tt> object featuring <tt>Location</tt> header of created resource + */ + @Descriptions({ + @Description(target = DocTarget.RESPONSE, + value = "Featuring <tt>Location</tt> header of created resource") + }) + @POST + @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + Response create(@NotNull ResourceTO resourceTO); + + /** + * Updates the resource matching the given name. + * + * @param resourceName name of resource to be updated + * @param resourceTO resource to be stored + */ + @PUT + @Path("{resourceName}") + @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + void update(@NotNull @PathParam("resourceName") String resourceName, @NotNull ResourceTO resourceTO); + + /** + * Deletes the resource matching the given name. + * + * @param resourceName name of resource to be deleted + */ + @DELETE + @Path("{resourceName}") + @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + void delete(@NotNull @PathParam("resourceName") String resourceName); + + /** + * Checks wether the connection to resource could be established. + * + * @param resourceTO resource to be checked + * @return true if connection to resource could be established + */ + @POST + @Path("check") + @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + boolean check(@NotNull ResourceTO resourceTO); + + /** + * De-associate users or roles (depending on the provided subject type) from the given resource. + * + * @param resourceName name of resource + * @param subjectType subject type (user or role) + * @param type resource de-association action type + * @param subjectIds users or roles against which the bulk action will be performed + * @return <tt>Response</tt> object featuring {@link BulkActionResult} as <tt>Entity</tt> + */ + @Descriptions({ + @Description(target = DocTarget.RESPONSE, + value = "Featuring <tt>BulkActionResult</tt> as <tt>Entity</tt>") + }) + @POST + @Path("{resourceName}/bulkDeassociation/{subjType}/{type}") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + BulkActionResult bulkDeassociation(@NotNull @PathParam("resourceName") String resourceName, + @NotNull @PathParam("subjType") SubjectType subjectType, + @NotNull @PathParam("type") ResourceDeassociationActionType type, @NotNull List<SubjectId> subjectIds); + + /** + * Executes the provided bulk action. + * + * @param bulkAction list of resource names against which the bulk action will be performed + * @return Bulk action result + */ + @POST + @Path("bulk") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + BulkActionResult bulk(@NotNull BulkAction bulkAction); +}
Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/services/RoleService.java URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/services/RoleService.java?rev=1615910&r1=1615909&r2=1615910&view=diff ============================================================================== --- syncope/trunk/common/src/main/java/org/apache/syncope/common/services/RoleService.java (original) +++ syncope/trunk/common/src/main/java/org/apache/syncope/common/services/RoleService.java Tue Aug 5 11:20:00 2014 @@ -1,299 +1,299 @@ -/* - * 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.services; - -import java.util.List; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import org.apache.cxf.jaxrs.model.wadl.Description; -import org.apache.cxf.jaxrs.model.wadl.Descriptions; -import org.apache.cxf.jaxrs.model.wadl.DocTarget; -import org.apache.syncope.common.reqres.PagedResult; -import org.apache.syncope.common.mod.RoleMod; -import org.apache.syncope.common.to.RoleTO; -import org.apache.syncope.common.types.ResourceAssociationActionType; -import org.apache.syncope.common.types.ResourceDeassociationActionType; -import org.apache.syncope.common.wrap.ResourceName; - -/** - * REST operations for roles. - */ -@Path("roles") -public interface RoleService extends JAXRSService { - - /** - * Returns children roles of given role. - * - * @param roleId id of role to get children from - * @return children roles of given role - */ - @GET - @Path("{roleId}/children") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - List<RoleTO> children(@NotNull @PathParam("roleId") Long roleId); - - /** - * Returns parent role of the given role (or null if no parent exists). - * - * @param roleId id of role to get parent role from - * @return parent role of the given role (or null if no parent exists) - */ - @GET - @Path("{roleId}/parent") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - RoleTO parent(@NotNull @PathParam("roleId") Long roleId); - - /** - * Reads the role matching the provided roleId. - * - * @param roleId id of role to be read - * @return role with matching id - */ - @GET - @Path("{roleId}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - RoleTO read(@NotNull @PathParam("roleId") Long roleId); - - /** - * This method is similar to {@link #read(Long)}, but uses different authentication handling to ensure that a user - * can read his own roles. - * - * @param roleId id of role to be read - * @return role with matching id - */ - @Descriptions({ - @Description(target = DocTarget.METHOD, - value = "This method is similar to <tt>read()</tt>, but uses different authentication handling to " - + "ensure that a user can read his own roles.") - }) - @GET - @Path("{roleId}/own") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - RoleTO readSelf(@NotNull @PathParam("roleId") Long roleId); - - /** - * Returns a paged list of existing roles. - * - * @return paged list of all existing roles - */ - @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - PagedResult<RoleTO> list(); - - /** - * Returns a paged list of existing roles. - * - * @param orderBy list of ordering clauses, separated by comma - * @return paged list of all existing roles - */ - @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - PagedResult<RoleTO> list(@QueryParam(PARAM_ORDERBY) String orderBy); - - /** - * Returns a paged list of existing roles matching page/size conditions. - * - * @param page result page number - * @param size number of entries per page - * @return paged list of existing roles matching page/size conditions - */ - @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - PagedResult<RoleTO> list( - @NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page, - @NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size); - - /** - * Returns a paged list of existing roles matching page/size conditions. - * - * @param page result page number - * @param size number of entries per page - * @param orderBy list of ordering clauses, separated by comma - * @return paged list of existing roles matching page/size conditions - */ - @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - PagedResult<RoleTO> list( - @NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page, - @NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size, - @QueryParam(PARAM_ORDERBY) String orderBy); - - /** - * Returns a paged list of roles matching the provided FIQL search condition. - * - * @param fiql FIQL search expression - * @return paged list of roles matching the provided FIQL search condition - */ - @GET - @Path("search") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - PagedResult<RoleTO> search(@NotNull @QueryParam(PARAM_FIQL) String fiql); - - /** - * Returns a paged list of roles matching the provided FIQL search condition. - * - * @param fiql FIQL search expression - * @param orderBy list of ordering clauses, separated by comma - * @return paged list of roles matching the provided FIQL search condition - */ - @GET - @Path("search") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - PagedResult<RoleTO> search( - @NotNull @QueryParam(PARAM_FIQL) String fiql, @QueryParam(PARAM_ORDERBY) String orderBy); - - /** - * Returns a paged list of roles matching the provided FIQL search condition. - * - * @param fiql FIQL search expression - * @param page result page number - * @param size number of entries per page - * @return paged list of roles matching the provided FIQL search condition - */ - @GET - @Path("search") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - PagedResult<RoleTO> search(@QueryParam(PARAM_FIQL) String fiql, - @NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page, - @NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size); - - /** - * Returns a paged list of roles matching the provided FIQL search condition. - * - * @param fiql FIQL search expression - * @param page result page number - * @param size number of entries per page - * @param orderBy list of ordering clauses, separated by comma - * @return paged list of roles matching the provided FIQL search condition - */ - @GET - @Path("search") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - PagedResult<RoleTO> search(@QueryParam(PARAM_FIQL) String fiql, - @NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page, - @NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size, - @QueryParam(PARAM_ORDERBY) String orderBy); - - /** - * Creates a new role. - * - * @param roleTO role to be created - * @return <tt>Response</tt> object featuring <tt>Location</tt> header of created role as well as the role itself - * enriched with propagation status information - {@link RoleTO} as <tt>Entity</tt> - */ - @Descriptions({ - @Description(target = DocTarget.RESPONSE, - value = "Featuring <tt>Location</tt> header of created role as well as the " - + "role itself enriched with propagation status information - <tt>RoleTO</tt> as <tt>Entity</tt>") - }) - @POST - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - Response create(@NotNull RoleTO roleTO); - - /** - * Updates role matching the provided roleId. - * - * @param roleId id of role to be updated - * @param roleMod modification to be applied to role matching the provided roleId - * @return <tt>Response</tt> object featuring the updated role enriched with propagation status information - * - {@link RoleTO} as <tt>Entity</tt> - */ - @Descriptions({ - @Description(target = DocTarget.RESPONSE, - value = "Featuring the updated role enriched with propagation status information - " - + "<tt>RoleTO</tt> as <tt>Entity</tt>") - }) - @POST - @Path("{roleId}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - Response update(@NotNull @PathParam("roleId") Long roleId, @NotNull RoleMod roleMod); - - /** - * Deletes role matching provided roleId. - * - * @param roleId id of role to be deleted - * @return <tt>Response</tt> object featuring the deleted role enriched with propagation status information - * - {@link RoleTO} as <tt>Entity</tt> - */ - @Descriptions({ - @Description(target = DocTarget.RESPONSE, - value = "Featuring the deleted role enriched with propagation status information - " - + "<tt>RoleTO</tt> as <tt>Entity</tt>") - }) - @DELETE - @Path("{roleId}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - Response delete(@NotNull @PathParam("roleId") Long roleId); - - /** - * Executes resource-related operations on given role. - * - * @param roleId role id. - * @param type resource association action type - * @param resourceNames external resources to be used for propagation-related operations - * @return <tt>Response</tt> object featuring - * {@link org.apache.syncope.common.reqres.BulkActionResult} as <tt>Entity</tt> - */ - @Descriptions({ - @Description(target = DocTarget.RESPONSE, - value = "Featuring <tt>BulkActionResult</tt> as <tt>Entity</tt>") - }) - @POST - @Path("{roleId}/deassociate/{type}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - Response bulkDeassociation(@NotNull @PathParam("roleId") Long roleId, - @NotNull @PathParam("type") ResourceDeassociationActionType type, - @NotNull List<ResourceName> resourceNames); - - /** - * Executes resource-related operations on given role. - * - * @param roleId role id. - * @param type resource association action type - * @param resourceNames external resources to be used for propagation-related operations - * @return <tt>Response</tt> object featuring {@link org.apache.syncope.common.reqres.BulkActionResult} - * as <tt>Entity</tt> - */ - @Descriptions({ - @Description(target = DocTarget.RESPONSE, - value = "Featuring <tt>BulkActionResult</tt> as <tt>Entity</tt>") - }) - @POST - @Path("{roleId}/associate/{type}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - Response bulkAssociation(@NotNull @PathParam("roleId") Long roleId, - @NotNull @PathParam("type") ResourceAssociationActionType type, - @NotNull List<ResourceName> resourceNames); -} +/* + * 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.services; + +import java.util.List; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import org.apache.cxf.jaxrs.model.wadl.Description; +import org.apache.cxf.jaxrs.model.wadl.Descriptions; +import org.apache.cxf.jaxrs.model.wadl.DocTarget; +import org.apache.syncope.common.reqres.PagedResult; +import org.apache.syncope.common.mod.RoleMod; +import org.apache.syncope.common.to.RoleTO; +import org.apache.syncope.common.types.ResourceAssociationActionType; +import org.apache.syncope.common.types.ResourceDeassociationActionType; +import org.apache.syncope.common.wrap.ResourceName; + +/** + * REST operations for roles. + */ +@Path("roles") +public interface RoleService extends JAXRSService { + + /** + * Returns children roles of given role. + * + * @param roleId id of role to get children from + * @return children roles of given role + */ + @GET + @Path("{roleId}/children") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + List<RoleTO> children(@NotNull @PathParam("roleId") Long roleId); + + /** + * Returns parent role of the given role (or null if no parent exists). + * + * @param roleId id of role to get parent role from + * @return parent role of the given role (or null if no parent exists) + */ + @GET + @Path("{roleId}/parent") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + RoleTO parent(@NotNull @PathParam("roleId") Long roleId); + + /** + * Reads the role matching the provided roleId. + * + * @param roleId id of role to be read + * @return role with matching id + */ + @GET + @Path("{roleId}") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + RoleTO read(@NotNull @PathParam("roleId") Long roleId); + + /** + * This method is similar to {@link #read(Long)}, but uses different authentication handling to ensure that a user + * can read his own roles. + * + * @param roleId id of role to be read + * @return role with matching id + */ + @Descriptions({ + @Description(target = DocTarget.METHOD, + value = "This method is similar to <tt>read()</tt>, but uses different authentication handling to " + + "ensure that a user can read his own roles.") + }) + @GET + @Path("{roleId}/own") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + RoleTO readSelf(@NotNull @PathParam("roleId") Long roleId); + + /** + * Returns a paged list of existing roles. + * + * @return paged list of all existing roles + */ + @GET + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + PagedResult<RoleTO> list(); + + /** + * Returns a paged list of existing roles. + * + * @param orderBy list of ordering clauses, separated by comma + * @return paged list of all existing roles + */ + @GET + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + PagedResult<RoleTO> list(@QueryParam(PARAM_ORDERBY) String orderBy); + + /** + * Returns a paged list of existing roles matching page/size conditions. + * + * @param page result page number + * @param size number of entries per page + * @return paged list of existing roles matching page/size conditions + */ + @GET + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + PagedResult<RoleTO> list( + @NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page, + @NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size); + + /** + * Returns a paged list of existing roles matching page/size conditions. + * + * @param page result page number + * @param size number of entries per page + * @param orderBy list of ordering clauses, separated by comma + * @return paged list of existing roles matching page/size conditions + */ + @GET + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + PagedResult<RoleTO> list( + @NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page, + @NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size, + @QueryParam(PARAM_ORDERBY) String orderBy); + + /** + * Returns a paged list of roles matching the provided FIQL search condition. + * + * @param fiql FIQL search expression + * @return paged list of roles matching the provided FIQL search condition + */ + @GET + @Path("search") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + PagedResult<RoleTO> search(@NotNull @QueryParam(PARAM_FIQL) String fiql); + + /** + * Returns a paged list of roles matching the provided FIQL search condition. + * + * @param fiql FIQL search expression + * @param orderBy list of ordering clauses, separated by comma + * @return paged list of roles matching the provided FIQL search condition + */ + @GET + @Path("search") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + PagedResult<RoleTO> search( + @NotNull @QueryParam(PARAM_FIQL) String fiql, @QueryParam(PARAM_ORDERBY) String orderBy); + + /** + * Returns a paged list of roles matching the provided FIQL search condition. + * + * @param fiql FIQL search expression + * @param page result page number + * @param size number of entries per page + * @return paged list of roles matching the provided FIQL search condition + */ + @GET + @Path("search") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + PagedResult<RoleTO> search(@QueryParam(PARAM_FIQL) String fiql, + @NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page, + @NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size); + + /** + * Returns a paged list of roles matching the provided FIQL search condition. + * + * @param fiql FIQL search expression + * @param page result page number + * @param size number of entries per page + * @param orderBy list of ordering clauses, separated by comma + * @return paged list of roles matching the provided FIQL search condition + */ + @GET + @Path("search") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + PagedResult<RoleTO> search(@QueryParam(PARAM_FIQL) String fiql, + @NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page, + @NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size, + @QueryParam(PARAM_ORDERBY) String orderBy); + + /** + * Creates a new role. + * + * @param roleTO role to be created + * @return <tt>Response</tt> object featuring <tt>Location</tt> header of created role as well as the role itself + * enriched with propagation status information - {@link RoleTO} as <tt>Entity</tt> + */ + @Descriptions({ + @Description(target = DocTarget.RESPONSE, + value = "Featuring <tt>Location</tt> header of created role as well as the " + + "role itself enriched with propagation status information - <tt>RoleTO</tt> as <tt>Entity</tt>") + }) + @POST + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + Response create(@NotNull RoleTO roleTO); + + /** + * Updates role matching the provided roleId. + * + * @param roleId id of role to be updated + * @param roleMod modification to be applied to role matching the provided roleId + * @return <tt>Response</tt> object featuring the updated role enriched with propagation status information + * - {@link RoleTO} as <tt>Entity</tt> + */ + @Descriptions({ + @Description(target = DocTarget.RESPONSE, + value = "Featuring the updated role enriched with propagation status information - " + + "<tt>RoleTO</tt> as <tt>Entity</tt>") + }) + @POST + @Path("{roleId}") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + Response update(@NotNull @PathParam("roleId") Long roleId, @NotNull RoleMod roleMod); + + /** + * Deletes role matching provided roleId. + * + * @param roleId id of role to be deleted + * @return <tt>Response</tt> object featuring the deleted role enriched with propagation status information + * - {@link RoleTO} as <tt>Entity</tt> + */ + @Descriptions({ + @Description(target = DocTarget.RESPONSE, + value = "Featuring the deleted role enriched with propagation status information - " + + "<tt>RoleTO</tt> as <tt>Entity</tt>") + }) + @DELETE + @Path("{roleId}") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + Response delete(@NotNull @PathParam("roleId") Long roleId); + + /** + * Executes resource-related operations on given role. + * + * @param roleId role id. + * @param type resource association action type + * @param resourceNames external resources to be used for propagation-related operations + * @return <tt>Response</tt> object featuring + * {@link org.apache.syncope.common.reqres.BulkActionResult} as <tt>Entity</tt> + */ + @Descriptions({ + @Description(target = DocTarget.RESPONSE, + value = "Featuring <tt>BulkActionResult</tt> as <tt>Entity</tt>") + }) + @POST + @Path("{roleId}/deassociate/{type}") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + Response bulkDeassociation(@NotNull @PathParam("roleId") Long roleId, + @NotNull @PathParam("type") ResourceDeassociationActionType type, + @NotNull List<ResourceName> resourceNames); + + /** + * Executes resource-related operations on given role. + * + * @param roleId role id. + * @param type resource association action type + * @param resourceNames external resources to be used for propagation-related operations + * @return <tt>Response</tt> object featuring {@link org.apache.syncope.common.reqres.BulkActionResult} + * as <tt>Entity</tt> + */ + @Descriptions({ + @Description(target = DocTarget.RESPONSE, + value = "Featuring <tt>BulkActionResult</tt> as <tt>Entity</tt>") + }) + @POST + @Path("{roleId}/associate/{type}") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + Response bulkAssociation(@NotNull @PathParam("roleId") Long roleId, + @NotNull @PathParam("type") ResourceAssociationActionType type, + @NotNull List<ResourceName> resourceNames); +} Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/services/SchemaService.java URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/services/SchemaService.java?rev=1615910&r1=1615909&r2=1615910&view=diff ============================================================================== --- syncope/trunk/common/src/main/java/org/apache/syncope/common/services/SchemaService.java (original) +++ syncope/trunk/common/src/main/java/org/apache/syncope/common/services/SchemaService.java Tue Aug 5 11:20:00 2014 @@ -1,119 +1,119 @@ -/* - * 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.services; - -import java.util.List; -import javax.validation.constraints.NotNull; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import org.apache.cxf.jaxrs.model.wadl.Description; -import org.apache.cxf.jaxrs.model.wadl.Descriptions; -import org.apache.cxf.jaxrs.model.wadl.DocTarget; -import org.apache.syncope.common.to.AbstractSchemaTO; -import org.apache.syncope.common.types.AttributableType; -import org.apache.syncope.common.types.SchemaType; - -/** - * REST operations for attribute schemas. - */ -@Path("schemas/{kind}/{type}") -public interface SchemaService extends JAXRSService { - - /** - * Returns schema matching the given kind, type and name. - * - * @param <T> actual SchemaTO - * @param attrType kind for schemas to be read - * @param schemaType type for schemas to be read - * @param schemaName name of schema to be read - * @return schema matching the given kind, type and name - */ - @GET - @Path("{name}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - <T extends AbstractSchemaTO> T read(@NotNull @PathParam("kind") AttributableType attrType, - @NotNull @PathParam("type") SchemaType schemaType, @NotNull @PathParam("name") String schemaName); - - /** - * Returns a list of schemas with matching kind and type. - * - * @param <T> actual SchemaTO - * @param attrType kind for schemas to be listed - * @param schemaType type for schemas to be listed - * @return list of schemas with matching kind and type - */ - @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - <T extends AbstractSchemaTO> List<T> list( - @NotNull @PathParam("kind") AttributableType attrType, @NotNull @PathParam("type") SchemaType schemaType); - - /** - * Creates a new schema. - * - * @param <T> actual SchemaTO - * @param attrType kind for schema to be created - * @param schemaType type for schema to be created - * @param schemaTO schema to be created - * @return <tt>Response</tt> object featuring <tt>Location</tt> header of created schema - */ - @Descriptions({ - @Description(target = DocTarget.RESPONSE, value = "Featuring <tt>Location</tt> header of created schema") - }) - @POST - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - <T extends AbstractSchemaTO> Response create(@NotNull @PathParam("kind") AttributableType attrType, - @NotNull @PathParam("type") SchemaType schemaType, @NotNull T schemaTO); - - /** - * Updates the schema matching the given kind, type and name. - * - * @param <T> actual SchemaTO - * @param attrType kind for schemas to be updated - * @param schemaType type for schemas to be updated - * @param schemaName name of schema to be updated - * @param schemaTO updated schema to be stored - */ - @PUT - @Path("{name}") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - <T extends AbstractSchemaTO> void update(@NotNull @PathParam("kind") AttributableType attrType, - @NotNull @PathParam("type") SchemaType schemaType, - @NotNull @PathParam("name") String schemaName, @NotNull T schemaTO); - - /** - * Deletes the schema matching the given kind, type and name. - * - * @param attrType kind for schema to be deleted - * @param schemaType type for schema to be deleted - * @param schemaName name of schema to be deleted - */ - @DELETE - @Path("{name}") - void delete(@NotNull @PathParam("kind") AttributableType attrType, - @NotNull @PathParam("type") SchemaType schemaType, - @NotNull @PathParam("name") String schemaName); -} +/* + * 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.services; + +import java.util.List; +import javax.validation.constraints.NotNull; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import org.apache.cxf.jaxrs.model.wadl.Description; +import org.apache.cxf.jaxrs.model.wadl.Descriptions; +import org.apache.cxf.jaxrs.model.wadl.DocTarget; +import org.apache.syncope.common.to.AbstractSchemaTO; +import org.apache.syncope.common.types.AttributableType; +import org.apache.syncope.common.types.SchemaType; + +/** + * REST operations for attribute schemas. + */ +@Path("schemas/{kind}/{type}") +public interface SchemaService extends JAXRSService { + + /** + * Returns schema matching the given kind, type and name. + * + * @param <T> actual SchemaTO + * @param attrType kind for schemas to be read + * @param schemaType type for schemas to be read + * @param schemaName name of schema to be read + * @return schema matching the given kind, type and name + */ + @GET + @Path("{name}") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + <T extends AbstractSchemaTO> T read(@NotNull @PathParam("kind") AttributableType attrType, + @NotNull @PathParam("type") SchemaType schemaType, @NotNull @PathParam("name") String schemaName); + + /** + * Returns a list of schemas with matching kind and type. + * + * @param <T> actual SchemaTO + * @param attrType kind for schemas to be listed + * @param schemaType type for schemas to be listed + * @return list of schemas with matching kind and type + */ + @GET + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + <T extends AbstractSchemaTO> List<T> list( + @NotNull @PathParam("kind") AttributableType attrType, @NotNull @PathParam("type") SchemaType schemaType); + + /** + * Creates a new schema. + * + * @param <T> actual SchemaTO + * @param attrType kind for schema to be created + * @param schemaType type for schema to be created + * @param schemaTO schema to be created + * @return <tt>Response</tt> object featuring <tt>Location</tt> header of created schema + */ + @Descriptions({ + @Description(target = DocTarget.RESPONSE, value = "Featuring <tt>Location</tt> header of created schema") + }) + @POST + @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + <T extends AbstractSchemaTO> Response create(@NotNull @PathParam("kind") AttributableType attrType, + @NotNull @PathParam("type") SchemaType schemaType, @NotNull T schemaTO); + + /** + * Updates the schema matching the given kind, type and name. + * + * @param <T> actual SchemaTO + * @param attrType kind for schemas to be updated + * @param schemaType type for schemas to be updated + * @param schemaName name of schema to be updated + * @param schemaTO updated schema to be stored + */ + @PUT + @Path("{name}") + @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + <T extends AbstractSchemaTO> void update(@NotNull @PathParam("kind") AttributableType attrType, + @NotNull @PathParam("type") SchemaType schemaType, + @NotNull @PathParam("name") String schemaName, @NotNull T schemaTO); + + /** + * Deletes the schema matching the given kind, type and name. + * + * @param attrType kind for schema to be deleted + * @param schemaType type for schema to be deleted + * @param schemaName name of schema to be deleted + */ + @DELETE + @Path("{name}") + void delete(@NotNull @PathParam("kind") AttributableType attrType, + @NotNull @PathParam("type") SchemaType schemaType, + @NotNull @PathParam("name") String schemaName); +} Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/services/TaskService.java URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/services/TaskService.java?rev=1615910&r1=1615909&r2=1615910&view=diff ============================================================================== --- syncope/trunk/common/src/main/java/org/apache/syncope/common/services/TaskService.java (original) +++ syncope/trunk/common/src/main/java/org/apache/syncope/common/services/TaskService.java Tue Aug 5 11:20:00 2014 @@ -1,245 +1,245 @@ -/* - * 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.services; - -import java.util.List; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.MatrixParam; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import org.apache.cxf.jaxrs.model.wadl.Description; -import org.apache.cxf.jaxrs.model.wadl.Descriptions; -import org.apache.cxf.jaxrs.model.wadl.DocTarget; -import org.apache.syncope.common.reqres.PagedResult; -import org.apache.syncope.common.reqres.BulkAction; -import org.apache.syncope.common.reqres.BulkActionResult; -import org.apache.syncope.common.to.ReportExecTO; -import org.apache.syncope.common.to.TaskExecTO; -import org.apache.syncope.common.to.AbstractTaskTO; -import org.apache.syncope.common.to.SchedTaskTO; -import org.apache.syncope.common.types.TaskType; -import org.apache.syncope.common.wrap.JobClass; -import org.apache.syncope.common.wrap.PushActionClass; -import org.apache.syncope.common.wrap.SyncActionClass; - -/** - * REST operations for tasks. - */ -@Path("tasks") -public interface TaskService extends JAXRSService { - - /** - * Returns a list of classes to be used for jobs. - * - * @return list of classes to be used for jobs - */ - @GET - @Path("jobClasses") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - List<JobClass> getJobClasses(); - - /** - * Returns a list of classes to be used as synchronization actions. - * - * @return list of classes to be used as synchronization actions - */ - @GET - @Path("syncActionsClasses") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - List<SyncActionClass> getSyncActionsClasses(); - - /** - * Returns a list of classes to be used as push actions. - * - * @return list of classes to be used as push actions - */ - @GET - @Path("pushActionsClasses") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - List<PushActionClass> getPushActionsClasses(); - - /** - * Returns the task matching the given id. - * - * @param taskId id of task to be read - * @param <T> type of taskTO - * @return task with matching id - */ - @GET - @Path("{taskId}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - <T extends AbstractTaskTO> T read(@NotNull @PathParam("taskId") Long taskId); - - /** - * Returns the task execution with the given id. - * - * @param executionId id of task execution to be read - * @return task execution with matching Id - */ - @GET - @Path("executions/{executionId}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - TaskExecTO readExecution(@NotNull @PathParam("executionId") Long executionId); - - /** - * Returns a list of tasks with matching type. - * - * @param taskType type of tasks to be listed - * @param <T> type of taskTO - * @return list of tasks with matching type - */ - @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - <T extends AbstractTaskTO> PagedResult<T> list(@NotNull @MatrixParam("type") TaskType taskType); - - /** - * Returns a list of tasks with matching type. - * - * @param taskType type of tasks to be listed - * @param orderBy list of ordering clauses, separated by comma - * @param <T> type of taskTO - * @return list of tasks with matching type - */ - @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - <T extends AbstractTaskTO> PagedResult<T> list(@NotNull @MatrixParam("type") TaskType taskType, - @QueryParam(PARAM_ORDERBY) String orderBy); - - /** - * Returns a paged list of existing tasks matching type and page/size conditions. - * - * @param taskType type of tasks to be listed - * @param page page number of tasks in relation to page size - * @param size number of tasks listed per page - * @param orderBy list of ordering clauses, separated by comma - * @param <T> type of taskTO - * @return paged list of existing tasks matching type and page/size conditions - */ - @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - <T extends AbstractTaskTO> PagedResult<T> list(@NotNull @MatrixParam("type") TaskType taskType, - @NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page, - @NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size, - @QueryParam(PARAM_ORDERBY) String orderBy); - - /** - * Returns a paged list of existing tasks matching type and page/size conditions. - * - * @param taskType type of tasks to be listed - * @param page page number of tasks in relation to page size - * @param size number of tasks listed per page - * @param <T> type of taskTO - * @return paged list of existing tasks matching type and page/size conditions - */ - @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - <T extends AbstractTaskTO> PagedResult<T> list(@MatrixParam("type") TaskType taskType, - @NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page, - @NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size); - - /** - * Creates a new task. - * - * @param taskTO task to be created - * @param <T> type of taskTO - * @return <tt>Response</tt> object featuring <tt>Location</tt> header of created task - */ - @Descriptions({ - @Description(target = DocTarget.RESPONSE, value = "Featuring <tt>Location</tt> header of created task") - }) - @POST - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - <T extends SchedTaskTO> Response create(@NotNull T taskTO); - - /** - * Updates the task matching the provided id. - * - * @param taskId id of task to be updated - * @param taskTO updated task to be stored - */ - @PUT - @Path("{taskId}") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - void update(@NotNull @PathParam("taskId") Long taskId, @NotNull AbstractTaskTO taskTO); - - /** - * Deletes the task matching the provided id. - * - * @param taskId id of task to be deleted - */ - @DELETE - @Path("{taskId}") - void delete(@NotNull @PathParam("taskId") Long taskId); - - /** - * Deletes the task execution matching the provided id. - * - * @param executionId id of task execution to be deleted - */ - @DELETE - @Path("executions/{executionId}") - void deleteExecution(@NotNull @PathParam("executionId") Long executionId); - - /** - * Executes the task matching the given id. - * - * @param taskId id of task to be executed - * @param dryRun if true, task will only be simulated - * @return execution report for the task matching the given id - */ - @POST - @Path("{taskId}/execute") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - TaskExecTO execute(@NotNull @PathParam("taskId") Long taskId, - @QueryParam("dryRun") @DefaultValue("false") boolean dryRun); - - /** - * Reports task execution result. - * - * @param executionId id of task execution being reported - * @param reportExec execution being reported - */ - @POST - @Path("executions/{executionId}/report") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - void report(@NotNull @PathParam("executionId") Long executionId, @NotNull ReportExecTO reportExec); - - /** - * Executes the provided bulk action. - * - * @param bulkAction list of task ids against which the bulk action will be performed. - * @return Bulk action result - */ - @POST - @Path("bulk") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - BulkActionResult bulk(@NotNull BulkAction bulkAction); -} +/* + * 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.services; + +import java.util.List; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.GET; +import javax.ws.rs.MatrixParam; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import org.apache.cxf.jaxrs.model.wadl.Description; +import org.apache.cxf.jaxrs.model.wadl.Descriptions; +import org.apache.cxf.jaxrs.model.wadl.DocTarget; +import org.apache.syncope.common.reqres.PagedResult; +import org.apache.syncope.common.reqres.BulkAction; +import org.apache.syncope.common.reqres.BulkActionResult; +import org.apache.syncope.common.to.ReportExecTO; +import org.apache.syncope.common.to.TaskExecTO; +import org.apache.syncope.common.to.AbstractTaskTO; +import org.apache.syncope.common.to.SchedTaskTO; +import org.apache.syncope.common.types.TaskType; +import org.apache.syncope.common.wrap.JobClass; +import org.apache.syncope.common.wrap.PushActionClass; +import org.apache.syncope.common.wrap.SyncActionClass; + +/** + * REST operations for tasks. + */ +@Path("tasks") +public interface TaskService extends JAXRSService { + + /** + * Returns a list of classes to be used for jobs. + * + * @return list of classes to be used for jobs + */ + @GET + @Path("jobClasses") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + List<JobClass> getJobClasses(); + + /** + * Returns a list of classes to be used as synchronization actions. + * + * @return list of classes to be used as synchronization actions + */ + @GET + @Path("syncActionsClasses") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + List<SyncActionClass> getSyncActionsClasses(); + + /** + * Returns a list of classes to be used as push actions. + * + * @return list of classes to be used as push actions + */ + @GET + @Path("pushActionsClasses") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + List<PushActionClass> getPushActionsClasses(); + + /** + * Returns the task matching the given id. + * + * @param taskId id of task to be read + * @param <T> type of taskTO + * @return task with matching id + */ + @GET + @Path("{taskId}") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + <T extends AbstractTaskTO> T read(@NotNull @PathParam("taskId") Long taskId); + + /** + * Returns the task execution with the given id. + * + * @param executionId id of task execution to be read + * @return task execution with matching Id + */ + @GET + @Path("executions/{executionId}") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + TaskExecTO readExecution(@NotNull @PathParam("executionId") Long executionId); + + /** + * Returns a list of tasks with matching type. + * + * @param taskType type of tasks to be listed + * @param <T> type of taskTO + * @return list of tasks with matching type + */ + @GET + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + <T extends AbstractTaskTO> PagedResult<T> list(@NotNull @MatrixParam("type") TaskType taskType); + + /** + * Returns a list of tasks with matching type. + * + * @param taskType type of tasks to be listed + * @param orderBy list of ordering clauses, separated by comma + * @param <T> type of taskTO + * @return list of tasks with matching type + */ + @GET + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + <T extends AbstractTaskTO> PagedResult<T> list(@NotNull @MatrixParam("type") TaskType taskType, + @QueryParam(PARAM_ORDERBY) String orderBy); + + /** + * Returns a paged list of existing tasks matching type and page/size conditions. + * + * @param taskType type of tasks to be listed + * @param page page number of tasks in relation to page size + * @param size number of tasks listed per page + * @param orderBy list of ordering clauses, separated by comma + * @param <T> type of taskTO + * @return paged list of existing tasks matching type and page/size conditions + */ + @GET + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + <T extends AbstractTaskTO> PagedResult<T> list(@NotNull @MatrixParam("type") TaskType taskType, + @NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page, + @NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size, + @QueryParam(PARAM_ORDERBY) String orderBy); + + /** + * Returns a paged list of existing tasks matching type and page/size conditions. + * + * @param taskType type of tasks to be listed + * @param page page number of tasks in relation to page size + * @param size number of tasks listed per page + * @param <T> type of taskTO + * @return paged list of existing tasks matching type and page/size conditions + */ + @GET + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + <T extends AbstractTaskTO> PagedResult<T> list(@MatrixParam("type") TaskType taskType, + @NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page, + @NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size); + + /** + * Creates a new task. + * + * @param taskTO task to be created + * @param <T> type of taskTO + * @return <tt>Response</tt> object featuring <tt>Location</tt> header of created task + */ + @Descriptions({ + @Description(target = DocTarget.RESPONSE, value = "Featuring <tt>Location</tt> header of created task") + }) + @POST + @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + <T extends SchedTaskTO> Response create(@NotNull T taskTO); + + /** + * Updates the task matching the provided id. + * + * @param taskId id of task to be updated + * @param taskTO updated task to be stored + */ + @PUT + @Path("{taskId}") + @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + void update(@NotNull @PathParam("taskId") Long taskId, @NotNull AbstractTaskTO taskTO); + + /** + * Deletes the task matching the provided id. + * + * @param taskId id of task to be deleted + */ + @DELETE + @Path("{taskId}") + void delete(@NotNull @PathParam("taskId") Long taskId); + + /** + * Deletes the task execution matching the provided id. + * + * @param executionId id of task execution to be deleted + */ + @DELETE + @Path("executions/{executionId}") + void deleteExecution(@NotNull @PathParam("executionId") Long executionId); + + /** + * Executes the task matching the given id. + * + * @param taskId id of task to be executed + * @param dryRun if true, task will only be simulated + * @return execution report for the task matching the given id + */ + @POST + @Path("{taskId}/execute") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + TaskExecTO execute(@NotNull @PathParam("taskId") Long taskId, + @QueryParam("dryRun") @DefaultValue("false") boolean dryRun); + + /** + * Reports task execution result. + * + * @param executionId id of task execution being reported + * @param reportExec execution being reported + */ + @POST + @Path("executions/{executionId}/report") + @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + void report(@NotNull @PathParam("executionId") Long executionId, @NotNull ReportExecTO reportExec); + + /** + * Executes the provided bulk action. + * + * @param bulkAction list of task ids against which the bulk action will be performed. + * @return Bulk action result + */ + @POST + @Path("bulk") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + BulkActionResult bulk(@NotNull BulkAction bulkAction); +} Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/services/WorkflowService.java URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/services/WorkflowService.java?rev=1615910&r1=1615909&r2=1615910&view=diff ============================================================================== --- syncope/trunk/common/src/main/java/org/apache/syncope/common/services/WorkflowService.java (original) +++ syncope/trunk/common/src/main/java/org/apache/syncope/common/services/WorkflowService.java Tue Aug 5 11:20:00 2014 @@ -1,89 +1,89 @@ -/* - * 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.services; - -import javax.validation.constraints.NotNull; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.OPTIONS; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import org.apache.cxf.jaxrs.model.wadl.Description; -import org.apache.cxf.jaxrs.model.wadl.Descriptions; -import org.apache.cxf.jaxrs.model.wadl.DocTarget; -import org.apache.syncope.common.types.RESTHeaders; -import org.apache.syncope.common.types.SubjectType; - -/** - * REST operations for workflow definition management. - */ -@Path("workflows/{kind}") -public interface WorkflowService extends JAXRSService { - - /** - * Checks whether Activiti is enabled (for users or roles). - * - * @param kind user or role - * @return <tt>Response</tt> contains special syncope HTTP header indicating if Activiti is enabled for - * users / roles - * @see org.apache.syncope.common.types.RESTHeaders#ACTIVITI_USER_ENABLED - * @see org.apache.syncope.common.types.RESTHeaders#ACTIVITI_ROLE_ENABLED - */ - @Descriptions({ - @Description(target = DocTarget.RESPONSE, - value = "Contains special syncope HTTP header indicating if Activiti is enabled for users / roles") - }) - @OPTIONS - Response getOptions(@NotNull @PathParam("kind") SubjectType kind); - - /** - * Exports workflow definition for matching kind. - * - * @param kind user or role - * @return workflow definition for matching kind - */ - @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - Response exportDefinition(@NotNull @PathParam("kind") SubjectType kind); - - /** - * Exports workflow diagram representation. - * - * @param kind user or role - * @return workflow diagram representation - */ - @GET - @Path("diagram.png") - @Produces({ RESTHeaders.MEDIATYPE_IMAGE_PNG }) - Response exportDiagram(@NotNull @PathParam("kind") SubjectType kind); - - /** - * Imports workflow definition for matching kind. - * - * @param kind user or role - * @param definition workflow definition for matching kind - */ - @PUT - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - void importDefinition(@NotNull @PathParam("kind") SubjectType kind, @NotNull String definition); -} +/* + * 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.services; + +import javax.validation.constraints.NotNull; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.OPTIONS; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import org.apache.cxf.jaxrs.model.wadl.Description; +import org.apache.cxf.jaxrs.model.wadl.Descriptions; +import org.apache.cxf.jaxrs.model.wadl.DocTarget; +import org.apache.syncope.common.types.RESTHeaders; +import org.apache.syncope.common.types.SubjectType; + +/** + * REST operations for workflow definition management. + */ +@Path("workflows/{kind}") +public interface WorkflowService extends JAXRSService { + + /** + * Checks whether Activiti is enabled (for users or roles). + * + * @param kind user or role + * @return <tt>Response</tt> contains special syncope HTTP header indicating if Activiti is enabled for + * users / roles + * @see org.apache.syncope.common.types.RESTHeaders#ACTIVITI_USER_ENABLED + * @see org.apache.syncope.common.types.RESTHeaders#ACTIVITI_ROLE_ENABLED + */ + @Descriptions({ + @Description(target = DocTarget.RESPONSE, + value = "Contains special syncope HTTP header indicating if Activiti is enabled for users / roles") + }) + @OPTIONS + Response getOptions(@NotNull @PathParam("kind") SubjectType kind); + + /** + * Exports workflow definition for matching kind. + * + * @param kind user or role + * @return workflow definition for matching kind + */ + @GET + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + Response exportDefinition(@NotNull @PathParam("kind") SubjectType kind); + + /** + * Exports workflow diagram representation. + * + * @param kind user or role + * @return workflow diagram representation + */ + @GET + @Path("diagram.png") + @Produces({ RESTHeaders.MEDIATYPE_IMAGE_PNG }) + Response exportDiagram(@NotNull @PathParam("kind") SubjectType kind); + + /** + * Imports workflow definition for matching kind. + * + * @param kind user or role + * @param definition workflow definition for matching kind + */ + @PUT + @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + void importDefinition(@NotNull @PathParam("kind") SubjectType kind, @NotNull String definition); +} Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/to/AbstractAttributableTO.java URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/to/AbstractAttributableTO.java?rev=1615910&r1=1615909&r2=1615910&view=diff ============================================================================== --- syncope/trunk/common/src/main/java/org/apache/syncope/common/to/AbstractAttributableTO.java (original) +++ syncope/trunk/common/src/main/java/org/apache/syncope/common/to/AbstractAttributableTO.java Tue Aug 5 11:20:00 2014 @@ -1,86 +1,86 @@ -/* - * 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.to; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementWrapper; -import javax.xml.bind.annotation.XmlType; - -@XmlType -public abstract class AbstractAttributableTO extends ConnObjectTO { - - private static final long serialVersionUID = 4083884098736820255L; - - private long id; - - private final List<AttributeTO> derAttrs = new ArrayList<AttributeTO>(); - - private final List<AttributeTO> virAttrs = new ArrayList<AttributeTO>(); - - public long getId() { - return id; - } - - public void setId(final long id) { - this.id = id; - } - - @JsonIgnore - public Map<String, AttributeTO> getDerAttrMap() { - Map<String, AttributeTO> result = new HashMap<String, AttributeTO>(derAttrs.size()); - for (AttributeTO attributeTO : derAttrs) { - result.put(attributeTO.getSchema(), attributeTO); - } - result = Collections.unmodifiableMap(result); - - return result; - } - - @JsonIgnore - public Map<String, AttributeTO> getVirAttrMap() { - Map<String, AttributeTO> result = new HashMap<String, AttributeTO>(virAttrs.size()); - for (AttributeTO attributeTO : virAttrs) { - result.put(attributeTO.getSchema(), attributeTO); - } - result = Collections.unmodifiableMap(result); - - return result; - } - - @XmlElementWrapper(name = "derivedAttributes") - @XmlElement(name = "attribute") - @JsonProperty("derivedAttributes") - public List<AttributeTO> getDerAttrs() { - return derAttrs; - } - - @XmlElementWrapper(name = "virtualAttributes") - @XmlElement(name = "attribute") - @JsonProperty("virtualAttributes") - public List<AttributeTO> getVirAttrs() { - return virAttrs; - } -} +/* + * 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.to; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlType; + +@XmlType +public abstract class AbstractAttributableTO extends ConnObjectTO { + + private static final long serialVersionUID = 4083884098736820255L; + + private long id; + + private final List<AttributeTO> derAttrs = new ArrayList<AttributeTO>(); + + private final List<AttributeTO> virAttrs = new ArrayList<AttributeTO>(); + + public long getId() { + return id; + } + + public void setId(final long id) { + this.id = id; + } + + @JsonIgnore + public Map<String, AttributeTO> getDerAttrMap() { + Map<String, AttributeTO> result = new HashMap<String, AttributeTO>(derAttrs.size()); + for (AttributeTO attributeTO : derAttrs) { + result.put(attributeTO.getSchema(), attributeTO); + } + result = Collections.unmodifiableMap(result); + + return result; + } + + @JsonIgnore + public Map<String, AttributeTO> getVirAttrMap() { + Map<String, AttributeTO> result = new HashMap<String, AttributeTO>(virAttrs.size()); + for (AttributeTO attributeTO : virAttrs) { + result.put(attributeTO.getSchema(), attributeTO); + } + result = Collections.unmodifiableMap(result); + + return result; + } + + @XmlElementWrapper(name = "derivedAttributes") + @XmlElement(name = "attribute") + @JsonProperty("derivedAttributes") + public List<AttributeTO> getDerAttrs() { + return derAttrs; + } + + @XmlElementWrapper(name = "virtualAttributes") + @XmlElement(name = "attribute") + @JsonProperty("virtualAttributes") + public List<AttributeTO> getVirAttrs() { + return virAttrs; + } +}
