下面列出了javax.ws.rs.core.MediaType#APPLICATION_FORM_URLENCODED 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Path(WorkflowResourceApi.TASK_PATH)
@POST
@Consumes({MediaType.APPLICATION_FORM_URLENCODED})
@Produces({MediaType.APPLICATION_JSON})
public SmartGwtResponse<TaskView> addTask(
@FormParam(WorkflowModelConsts.TASK_JOBID) BigDecimal jobId,
@FormParam(WorkflowModelConsts.TASK_PROFILENAME) String taskName
) {
if (jobId == null || taskName == null) {
return SmartGwtResponse.asError("Invalid parameters!");
}
WorkflowDefinition workflow = workflowProfiles.getProfiles();
if (workflow == null) {
return profileError();
}
try {
Task updatedTask = workflowManager.tasks().addTask(jobId, taskName, workflow, session.getUser(), appConfig);
TaskFilter taskFilter = new TaskFilter();
taskFilter.setId(updatedTask.getId());
taskFilter.setLocale(session.getLocale(httpHeaders));
List<TaskView> result = workflowManager.tasks().findTask(taskFilter, workflow);
return new SmartGwtResponse<TaskView>(result);
} catch (WorkflowException ex) {
return toError(ex, "jobId: " + jobId + ", taskName: " + taskName);
}
}
@POST
@Path("/{id}/entries")
@ApiOperation(value = "Adds a new cart entry to an existing cart.")
@ApiResponses(value = {
@ApiResponse(code = HTTP_CREATED, message = HTTP_CREATED_MESSAGE, response = Cart.class,
responseHeaders = @ResponseHeader(name = "Location", description = "Location of the newly created cart entry.", response = String.class)),
@ApiResponse(code = HTTP_BAD_REQUEST, message = HTTP_BAD_REQUEST_MESSAGE, response = ErrorResponse.class),
@ApiResponse(code = HTTP_FORBIDDEN, message = HTTP_FORBIDDEN_MESSAGE, response = ErrorResponse.class),
@ApiResponse(code = HTTP_NOT_FOUND, message = HTTP_NOT_FOUND_MESSAGE, response = ErrorResponse.class)
})
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
Cart postCartEntry(
@ApiParam(value = "The ID of the cart for the new entry", required = true)
@PathParam("id") String id,
@ApiParam(value = "The product variant id to be added to the cart entry. If product variant exists in the" +
" cart then the cart entry quantity is increased with the provided quantity.", required = true)
@FormParam("productVariantId") String productVariantId,
@ApiParam(value = "The quantity for the new entry.", required = true)
@FormParam("quantity")
@Min(value = 0) int quantity,
@ApiParam(value = ACCEPT_LANGUAGE_DESC)
@HeaderParam(ACCEPT_LANGUAGE) String acceptLanguage);
@PUT
@Path("/{id}")
@Consumes({ MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response update(@Context HttpServletRequest request, @Context HttpHeaders header, @Context Company company,
@Context Locale locale, @Context User user, @Context ServiceContext serviceContext,
@DefaultValue("0") @PathParam("id") long id, @BeanParam EmployeeInputModel input);
@PUT
@Path("/{id}/dossierFiles")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED})
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Digital Signature")
@ApiResponses(value = {
@ApiResponse(code = HttpURLConnection.HTTP_OK, message = ""),
@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class),
@ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal error", response = ExceptionModel.class) })
public Response updateDossierFilesBySignatureDefault(@Context HttpServletRequest request, @Context HttpHeaders header,
@Context Company company, @Context Locale locale, @Context User user, @Context ServiceContext serviceContext,
@ApiParam(value = "id of dossier", required = true) @PathParam("id") long id, @BeanParam DigitalSignatureInputModel input) throws PortalException, Exception;
@PUT
@Path("/captchaSignature/{id}/dossierFile")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED})
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Digital Signature")
@ApiResponses(value = {
@ApiResponse(code = HttpURLConnection.HTTP_OK, message = ""),
@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class),
@ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal error", response = ExceptionModel.class) })
public Response updateDossierFileByCaptcha(@Context HttpServletRequest request, @Context HttpHeaders header,
@Context Company company, @Context Locale locale, @Context User user, @Context ServiceContext serviceContext,
@ApiParam(value = "id of dossier", required = true) @PathParam("id") Long id, @BeanParam DigitalSignatureInputModel input) throws PortalException;
@PUT
@Path("/digitalSignature/{id}/dossierFiles")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED})
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Digital Signature")
@ApiResponses(value = {
@ApiResponse(code = HttpURLConnection.HTTP_OK, message = ""),
@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class),
@ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal error", response = ExceptionModel.class) })
public Response updateDossierFilesBySignature(@Context HttpServletRequest request, @Context HttpHeaders header,
@Context Company company, @Context Locale locale, @Context User user, @Context ServiceContext serviceContext,
@ApiParam(value = "id of dossier", required = true) @PathParam("id") long id, @BeanParam DigitalSignatureInputModel input) throws PortalException, Exception;
@WebMethod(operationName="loginToServer")
@Produces(MediaType.TEXT_PLAIN)
//Can't get MediaType.MULTIPART_FORM_DATA to work
@Consumes({MediaType.APPLICATION_FORM_URLENCODED})
@POST
@Path("/loginToServer")
public java.lang.String loginToServerPOST(
@WebParam(partName = "id", name = "id")
@FormParam("id")
java.lang.String id,
@WebParam(partName = "pw", name = "pw")
@FormParam("pw")
java.lang.String pw) {
return login(id, pw) + "," + serverConfigurationService.getString("webservices.directurl", serverConfigurationService.getString("serverUrl"));
}
@POST
@Path("companyInfo.html")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
String companyInfo(
@QueryParam(value = "method") String method,
@QueryParam(value = "ajax") boolean ajax,
String body);
@DELETE
@Path("/{day}")
@Consumes({ MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response delete(@Context HttpServletRequest request, @Context HttpHeaders header,
@Context Company company, @Context Locale locale, @Context User user, @Context ServiceContext serviceContext,
@DefaultValue("0") @PathParam("day") String day);
@PUT
@Path("/{id}/roles/{roleid}")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Update the ServiceProcessRole of a ServiceProcess by its id", response = RoleInputModel.class)
@ApiResponses(value = {
@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a ServiceProcessRole was update", response = RoleInputModel.class),
@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })
public Response updateServiceProcessRole(@Context HttpServletRequest request, @Context HttpHeaders header,
@Context Company company, @Context Locale locale, @Context User user,
@Context ServiceContext serviceContext, @PathParam("id") long id, @PathParam("roleid") long roleid,
@BeanParam RoleInputModel input);
@GET
@Path("/deliverables/{id}/logs")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@ApiOperation(value = "Get info log for deliverable id")
@ApiResponses(value = {
@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns"),
@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not Found", response = ExceptionModel.class),
@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access defined", response = ExceptionModel.class) })
public Response getDeliverableLog(@Context HttpServletRequest request, @Context HttpHeaders header,
@Context Company company, @Context Locale locale, @Context User user, @Context ServiceContext serviceContext,
@ApiParam(value = "id for Deliverable Log", required = true) @PathParam("id") Long id);
@POST
@Path("/{id}/lock")
@Consumes({ MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response lockEmployeeAccount(@Context HttpServletRequest request, @Context HttpHeaders header,
@Context Company company, @Context Locale locale, @Context User user,
@Context ServiceContext serviceContext, @PathParam("id") long id,
@DefaultValue("false") @FormParam("locked") boolean locked);
@POST
@Path("/publish/importData")
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED})
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Add dossier publish")
@ApiResponses(value = {
@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns the DossierFileModel was updated", response = DossierFileResultsModel.class),
@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })
public Response addDossierImportData(@Context HttpServletRequest request, @Context HttpHeaders header,
@Context Company company, @Context Locale locale, @Context User user,
@Context ServiceContext serviceContext, @BeanParam DossierPublishImportModel input);
@DELETE
@Path("/{id}")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response deleteVoting(@Context HttpServletRequest request, @Context HttpHeaders header,
@Context Company company, @Context Locale locale, @Context User user,
@Context ServiceContext serviceContext, @PathParam("id") long votingId);
@PUT
@Path("/{id}/parts/{partno}")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Get update the DossierPart via partNo", response = DossierPartInputModel.class)
@ApiResponses(value = {
@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns the DossierPart was updated", response = DossierPartInputModel.class),
@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })
public Response updateDossierParts(@Context HttpServletRequest request, @Context HttpHeaders header,
@Context Company company, @Context Locale locale, @Context User user,
@Context ServiceContext serviceContext, @PathParam("id") long id, @PathParam("partno") String partNo,
@BeanParam DossierPartInputModel query);
@GET
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response getNotificationList(@Context HttpServletRequest request, @Context HttpHeaders header,
@Context Company company, @Context Locale locale, @Context User user,
@Context ServiceContext serviceContext, @BeanParam NotificationSearchModel query, @QueryParam("archived") Boolean archived);
@POST
@Path("/dossiers/export")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
public Response exportDossierStatistic(@Context HttpServletRequest request, @Context HttpHeaders header,
@Context Company company, @Context Locale locale, @Context User user,
@Context ServiceContext serviceContext, @FormParam("data") String data);
/**
* This attaches the run-time configuration onto a given test element.
*
* @response.representation.mediaType application/x-www-form-urlencoded
* @response.representation.doc The test node configuration
* @response.representation.200.qname {http://www.example.com}testConfigVO
* @response.representation.200.mediaType application/xml, application/json
* @response.representation.200.doc The test node configuration
* @response.representation.200.example {@link org.olat.connectors.rest.support.vo.Examples#SAMPLE_COURSENODEVO}
* @response.representation.401.doc The roles of the authenticated user are not sufficient
* @response.representation.404.doc The course or test node not found
* @response.representation.406.doc The call is not applicable to test course node
* @response.representation.409.doc The configuration is not valid
* @param courseId
* @param nodeId
* @param allowCancel
* @param allowNavigation
* @param allowSuspend
* @param numAttempts
* @param sequencePresentation
* @param showNavigation
* @param showQuestionTitle
* @param showResultsAfterFinish
* @param showResultsDependendOnDate
* @param showResultsOnHomepage
* @param showScoreInfo
* @param showQuestionProgress
* @param showScoreProgress
* @param showSectionsOnly
* @param summaryPresentation
* @param startDate
* @param endDate
* @param request
* @return
*/
@POST
@Path("test/{nodeId}/configuration")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response addTestConfigurationPost(@PathParam("courseId") final Long courseId, @PathParam("nodeId") final String nodeId,
@QueryParam("allowCancel") @DefaultValue("false") final Boolean allowCancel,
@QueryParam("allowNavigation") @DefaultValue("false") final Boolean allowNavigation,
@QueryParam("allowSuspend") @DefaultValue("false") final Boolean allowSuspend, @QueryParam("numAttempts") @DefaultValue("0") final int numAttempts,
@QueryParam("sequencePresentation") @DefaultValue(AssessmentInstance.QMD_ENTRY_SEQUENCE_ITEM) final String sequencePresentation,
@QueryParam("showNavigation") @DefaultValue("true") final Boolean showNavigation,
@QueryParam("showQuestionTitle") @DefaultValue("true") final Boolean showQuestionTitle,
@QueryParam("showResultsAfterFinish") @DefaultValue("true") final Boolean showResultsAfterFinish,
@QueryParam("showResultsDependendOnDate") @DefaultValue("false") final Boolean showResultsDependendOnDate,
@QueryParam("showResultsOnHomepage") @DefaultValue("false") final Boolean showResultsOnHomepage,
@QueryParam("showScoreInfo") @DefaultValue("true") final Boolean showScoreInfo,
@QueryParam("showQuestionProgress") @DefaultValue("true") final Boolean showQuestionProgress,
@QueryParam("showScoreProgress") @DefaultValue("true") final Boolean showScoreProgress,
@QueryParam("showSectionsOnly") @DefaultValue("false") final Boolean showSectionsOnly,
@QueryParam("summaryPresentation") @DefaultValue(AssessmentInstance.QMD_ENTRY_SUMMARY_COMPACT) final String summaryPresentation,
@QueryParam("startDate") final Long startDate, @QueryParam("endDate") final Long endDate, @Context final HttpServletRequest request) {
return addTestConfiguration(courseId, nodeId, allowCancel, allowNavigation, allowSuspend, numAttempts, sequencePresentation, showNavigation, showQuestionTitle,
showResultsAfterFinish, showResultsDependendOnDate, showResultsOnHomepage, showScoreInfo, showQuestionProgress, showScoreProgress, showSectionsOnly,
summaryPresentation, startDate, endDate, request);
}
@POST
@Path("/simpleFormWithFormParam")
@Consumes({ MediaType.APPLICATION_FORM_URLENCODED, MediaType.MULTIPART_FORM_DATA })
public Response simpleFormWithFormParam(@FormParam("age") Long age, @FormParam("name") String name) {
return Response.ok().entity("Name and age " + name + ", " + age).build();
}
/**
* This attaches the run-time configuration onto a given test element.
*
* @response.representation.mediaType application/x-www-form-urlencoded
* @response.representation.doc The test node configuration
* @response.representation.200.qname {http://www.example.com}testConfigVO
* @response.representation.200.mediaType application/xml, application/json
* @response.representation.200.doc The test node configuration
* @response.representation.200.example {@link org.olat.connectors.rest.support.vo.Examples#SAMPLE_COURSENODEVO}
* @response.representation.401.doc The roles of the authenticated user are not sufficient
* @response.representation.404.doc The course or test node not found
* @response.representation.406.doc The call is not applicable to test course node
* @response.representation.409.doc The configuration is not valid
* @param courseId
* @param nodeId
* @param allowCancel
* @param allowNavigation
* @param allowSuspend
* @param numAttempts
* @param sequencePresentation
* @param showNavigation
* @param showQuestionTitle
* @param showResultsAfterFinish
* @param showResultsDependendOnDate
* @param showResultsOnHomepage
* @param showScoreInfo
* @param showQuestionProgress
* @param showScoreProgress
* @param showSectionsOnly
* @param summaryPresentation
* @param startDate
* @param endDate
* @param request
* @return
*/
@PUT
@Path("test/{nodeId}/configuration")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response addTestConfiguration(@PathParam("courseId") final Long courseId, @PathParam("nodeId") final String nodeId,
@QueryParam("allowCancel") @DefaultValue("false") final Boolean allowCancel,
@QueryParam("allowNavigation") @DefaultValue("false") final Boolean allowNavigation,
@QueryParam("allowSuspend") @DefaultValue("false") final Boolean allowSuspend, @QueryParam("numAttempts") @DefaultValue("0") final int numAttempts,
@QueryParam("sequencePresentation") @DefaultValue(AssessmentInstance.QMD_ENTRY_SEQUENCE_ITEM) final String sequencePresentation,
@QueryParam("showNavigation") @DefaultValue("true") final Boolean showNavigation,
@QueryParam("showQuestionTitle") @DefaultValue("true") final Boolean showQuestionTitle,
@QueryParam("showResultsAfterFinish") @DefaultValue("true") final Boolean showResultsAfterFinish,
@QueryParam("showResultsDependendOnDate") @DefaultValue("false") final Boolean showResultsDependendOnDate,
@QueryParam("showResultsOnHomepage") @DefaultValue("false") final Boolean showResultsOnHomepage,
@QueryParam("showScoreInfo") @DefaultValue("true") final Boolean showScoreInfo,
@QueryParam("showQuestionProgress") @DefaultValue("true") final Boolean showQuestionProgress,
@QueryParam("showScoreProgress") @DefaultValue("true") final Boolean showScoreProgress,
@QueryParam("showSectionsOnly") @DefaultValue("false") final Boolean showSectionsOnly,
@QueryParam("summaryPresentation") @DefaultValue(AssessmentInstance.QMD_ENTRY_SUMMARY_COMPACT) final String summaryPresentation,
@QueryParam("startDate") final Long startDate, @QueryParam("endDate") final Long endDate, @Context final HttpServletRequest request) {
final TestFullConfig config = new TestFullConfig(allowCancel, allowNavigation, allowSuspend, numAttempts, sequencePresentation, showNavigation,
showQuestionTitle, showResultsAfterFinish, showResultsDependendOnDate, showResultsOnHomepage, showScoreInfo, showQuestionProgress, showScoreProgress,
showSectionsOnly, summaryPresentation, startDate, endDate);
return attachNodeConfig(courseId, nodeId, config, request);
}