Author: jbernhardt Date: Thu Jan 31 15:39:15 2013 New Revision: 1441023 URL: http://svn.apache.org/viewvc?rev=1441023&view=rev Log: [SYNCOPE-231] * adding JAVA DOC for Service Interfaces * Code cleanup
Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/services/SchemaService.java syncope/trunk/common/src/main/java/org/apache/syncope/common/services/UserRequestService.java syncope/trunk/common/src/main/java/org/apache/syncope/common/services/WorkflowService.java syncope/trunk/common/src/main/java/org/apache/syncope/common/to/WorkflowDefinitionTO.java 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=1441023&r1=1441022&r2=1441023&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 Thu Jan 31 15:39:15 2013 @@ -36,45 +36,85 @@ public interface SchemaService { @XmlEnum enum SchemaType { - NORMAL("schema"), + /** + * Derived schema calculated based on other attributes. + */ DERIVED("derivedSchema"), + + /** + * Standard schema for normal attributes to be stored within syncope. + */ + NORMAL("schema"), + + /** + * Virtual schema for attributes fetched from remote resources only. + */ VIRTUAL("virtualSchema"); + public static SchemaType fromString(String value) { + return SchemaType.valueOf(value.toUpperCase()); + } + + // TODO remove name once CXF migration is complete private final String name; private SchemaType(String name) { this.name = name; } - // TODO remove once CXF migration is complete public String toSpringURL() { return name; } - - public static SchemaType fromString(String value) { - return SchemaType.valueOf(value.toUpperCase()); - } } + /** + * @param kind Kind for schema to be created + * @param type Type for schema to be created + * @param schemaTO Schema to be created + * @return Response containing URI location for created resource. + */ @POST <T extends AbstractSchemaTO> Response create(@PathParam("kind") AttributableType kind, @PathParam("type") SchemaType type, T schemaTO); + /** + * @param kind Kind for schema to be deleted + * @param type Type for schema to be deleted + * @param schemaName Name of schema to be deleted + */ @DELETE @Path("{name}") void delete(@PathParam("kind") AttributableType kind, @PathParam("type") SchemaType type, @PathParam("name") String schemaName); + /** + * @param kind Kind for schemas to be listed + * @param type Type for schemas to be listed + * @return List of schemas with matching kind and type + */ @GET List<? extends AbstractSchemaTO> list(@PathParam("kind") AttributableType kind, @PathParam("type") SchemaType type); + /** + * @param kind Kind for schemas to be read + * @param type Type for schemas to be read + * @param schemaName Name of schema to be read + * @return Returns schema with matching name, kind and type + */ @GET @Path("{name}") <T extends AbstractSchemaTO> T read(@PathParam("kind") AttributableType kind, @PathParam("type") SchemaType type, @PathParam("name") String schemaName); + /** + * @param kind Kind for schemas to be updated + * @param type Type for schemas to be updated + * @param schemaName Name of schema to be updated + * @param schemaTO New schema to be stored + */ @PUT @Path("{name}") <T extends AbstractSchemaTO> void update(@PathParam("kind") AttributableType kind, @PathParam("type") SchemaType type, @PathParam("name") String schemaName, T schemaTO); + } Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/services/UserRequestService.java URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/services/UserRequestService.java?rev=1441023&r1=1441022&r2=1441023&view=diff ============================================================================== --- syncope/trunk/common/src/main/java/org/apache/syncope/common/services/UserRequestService.java (original) +++ syncope/trunk/common/src/main/java/org/apache/syncope/common/services/UserRequestService.java Thu Jan 31 15:39:15 2013 @@ -32,26 +32,53 @@ import org.apache.syncope.common.to.User @Path("requests/user") public interface UserRequestService { + public static final String SYNCOPE_CREATE_ALLOWED = "Syncope-Create-Allowed"; + /** + * This method is similar to {@link #isCreateAllowed()}, but follows RESTful best practices. + * + * @return Response contains special syncope HTTP header (SYNCOPE_CREATE_ALLOWED), indicating if user is allowed to + * make a create UserRequest + */ @OPTIONS Response getOptions(); + /** + * This method is similar to {@link #getOptions()}, but without following RESTful best practices. + * + * @return Returns true, if user is allowed to make user create requests + */ @GET @Path("create/allowed") boolean isCreateAllowed(); + /** + * @param userRequestTO Request for user to be created + * @return Response containing URI location for created resource + */ @POST Response create(UserRequestTO userRequestTO); + /** + * @return Returns list of all UserRequests. + */ @GET List<UserRequestTO> list(); + /** + * @param requestId ID of UserRequest to be read + * @return Returns UserRequest with matching requestId. + */ @GET @Path("{requestId}") UserRequestTO read(@PathParam("requestId") Long requestId); + /** + * @param requestId ID of UserRequest to be deleted. + */ @DELETE @Path("{requestId}") void delete(@PathParam("requestId") Long requestId); + } 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=1441023&r1=1441022&r2=1441023&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 Thu Jan 31 15:39:15 2013 @@ -27,18 +27,29 @@ import javax.ws.rs.PathParam; import org.apache.syncope.common.to.WorkflowDefinitionTO; import org.apache.syncope.common.types.AttributableType; -@Path("workflows") +@Path("workflows/{kind}") public interface WorkflowService { + /** + * @param kind Kind can be USER or ROLE only! + * @return Returns workflow definition for matching kind. + */ @GET - @Path("{kind}") WorkflowDefinitionTO getDefinition(@PathParam("kind") AttributableType kind); + /** + * @param kind Kind can be USER or ROLE only! + * @param definition New workflow definition to be stored for matching kind. + */ @PUT - @Path("{kind}") void updateDefinition(@PathParam("kind") AttributableType kind, WorkflowDefinitionTO definition); + /** + * @param kind Kind can be USER or ROLE only! + * @return Returns existing tasks for matching kind. + */ @GET - @Path("{kind}/tasks") + @Path("tasks") List<String> getDefinedTasks(@PathParam("kind") AttributableType kind); + } Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/to/WorkflowDefinitionTO.java URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/to/WorkflowDefinitionTO.java?rev=1441023&r1=1441022&r2=1441023&view=diff ============================================================================== --- syncope/trunk/common/src/main/java/org/apache/syncope/common/to/WorkflowDefinitionTO.java (original) +++ syncope/trunk/common/src/main/java/org/apache/syncope/common/to/WorkflowDefinitionTO.java Thu Jan 31 15:39:15 2013 @@ -48,4 +48,5 @@ public class WorkflowDefinitionTO extend public void setXmlDefinition(String xmlDefinition) { this.xmlDefinition = xmlDefinition; } + }