Java Code Examples for org.springframework.web.bind.annotation.RequestMethod#DELETE

The following examples show how to use org.springframework.web.bind.annotation.RequestMethod#DELETE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SysDictItemController.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
/**
 * @功能:删除字典数据
 * @param id
 * @return
 */
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
@CacheEvict(value=CacheConstant.SYS_DICT_CACHE, allEntries=true)
public Result<SysDictItem> delete(@RequestParam(name="id",required=true) String id) {
	Result<SysDictItem> result = new Result<SysDictItem>();
	SysDictItem joinSystem = sysDictItemService.getById(id);
	if(joinSystem==null) {
		result.error500("未找到对应实体");
	}else {
		boolean ok = sysDictItemService.removeById(id);
		if(ok) {
			result.success("删除成功!");
		}
	}
	return result;
}
 
Example 2
Source File: BusinessObjectDataRestController.java    From herd with Apache License 2.0 6 votes vote down vote up
/**
 * Deletes an existing business object data with 1 subpartition value with namespace. <p> Requires WRITE permission on namespace </p>
 *
 * @param namespace the namespace.
 * @param businessObjectDefinitionName the business object definition name
 * @param businessObjectFormatUsage the business object format usage
 * @param businessObjectFormatFileType the business object format file type
 * @param businessObjectFormatVersion the business object format version
 * @param partitionValue the partition value
 * @param subPartition1Value sub-partition value 1
 * @param businessObjectDataVersion the business object data version
 * @param deleteFiles whether files should be deleted
 *
 * @return the deleted business object data information
 */
@RequestMapping(
    value = "/businessObjectData/namespaces/{namespace}" +
        "/businessObjectDefinitionNames/{businessObjectDefinitionName}/businessObjectFormatUsages/{businessObjectFormatUsage}" +
        "/businessObjectFormatFileTypes/{businessObjectFormatFileType}/businessObjectFormatVersions/{businessObjectFormatVersion}" +
        "/partitionValues/{partitionValue}/subPartition1Values/{subPartition1Value}/businessObjectDataVersions/{businessObjectDataVersion}",
    method = RequestMethod.DELETE)
@Secured(SecurityFunctions.FN_BUSINESS_OBJECT_DATA_DELETE)
public BusinessObjectData deleteBusinessObjectData(@PathVariable("namespace") String namespace,
    @PathVariable("businessObjectDefinitionName") String businessObjectDefinitionName,
    @PathVariable("businessObjectFormatUsage") String businessObjectFormatUsage,
    @PathVariable("businessObjectFormatFileType") String businessObjectFormatFileType,
    @PathVariable("businessObjectFormatVersion") Integer businessObjectFormatVersion, @PathVariable("partitionValue") String partitionValue,
    @PathVariable("subPartition1Value") String subPartition1Value, @PathVariable("businessObjectDataVersion") Integer businessObjectDataVersion,
    @RequestParam("deleteFiles") Boolean deleteFiles)
{
    return businessObjectDataService.deleteBusinessObjectData(
        new BusinessObjectDataKey(namespace, businessObjectDefinitionName, businessObjectFormatUsage, businessObjectFormatFileType,
            businessObjectFormatVersion, partitionValue, Arrays.asList(subPartition1Value), businessObjectDataVersion), deleteFiles);
}
 
Example 3
Source File: AuthorityController.java    From JDeSurvey with GNU Affero General Public License v3.0 6 votes vote down vote up
@Secured({"ROLE_ADMIN"})
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE, produces = "text/html")
public String delete(@PathVariable("id") Long id, 
					Principal principal,			 
					Model uiModel,
					HttpServletRequest httpServletRequest) {
	log.info("delete(): id=" + id);
	try {
		SecurityObject authority = userService.authority_findById(id);
		userService.authority_remove(authority);
		uiModel.asMap().clear();
		return "redirect:/security/authorities/" ;
	} catch (Exception e) {
		log.error(e.getMessage(),e);
		throw (new RuntimeException(e));
	}
}
 
Example 4
Source File: TaskCommentResource.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
@ApiOperation(value = "Delete a comment on a task", tags = {"Tasks"}, nickname = "deleteTaskComment")
@ApiResponses(value = {
    @ApiResponse(code = 204, message = "Indicates the task and comment were found and the comment is deleted. Response body is left empty intentionally."),
    @ApiResponse(code = 404, message = "Indicates the requested task was not found or the tasks doesn’t have a comment with the given ID.")
})
@RequestMapping(value = "/runtime/tasks/{taskId}/comments/{commentId}", method = RequestMethod.DELETE)
public void deleteComment(@ApiParam(name = "taskId", value="The id of the task to delete the comment for.") @PathVariable("taskId") String taskId,@ApiParam(name = "commentId", value="The id of the comment.") @PathVariable("commentId") String commentId, HttpServletResponse response) {

  // Check if task exists
  Task task = getTaskFromRequest(taskId);

  Comment comment = taskService.getComment(commentId);
  if (comment == null || comment.getTaskId() == null || !comment.getTaskId().equals(task.getId())) {
    throw new ActivitiObjectNotFoundException("Task '" + task.getId() + "' doesn't have a comment with id '" + commentId + "'.", Comment.class);
  }

  taskService.deleteComment(commentId);
  response.setStatus(HttpStatus.NO_CONTENT.value());
}
 
Example 5
Source File: UserController.java    From database-rider with Apache License 2.0 5 votes vote down vote up
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
@ResponseBody
public String delete(long id) {
    try {
        User user = new User(id);
        userRepository.delete(user);
    } catch (Exception ex) {
        return "Error deleting the user: " + ex.toString();
    }
    return "User succesfully deleted!";
}
 
Example 6
Source File: ChannelMgrController.java    From web-flash with MIT License 5 votes vote down vote up
@RequestMapping(method = RequestMethod.DELETE)
@BussinessLog(value = "删除栏目", key = "id")
@RequiresPermissions(value = {Permission.CHANNEL_DEL})
public Object remove(Long id) {
    channelService.delete(id);
    return Rets.success();
}
 
Example 7
Source File: CustomerController.java    From iotplatform with Apache License 2.0 5 votes vote down vote up
@PreAuthorize("hasAuthority('TENANT_ADMIN')")
@RequestMapping(value = "/customer/{customerId}", method = RequestMethod.DELETE)
@ResponseStatus(value = HttpStatus.OK)
public void deleteCustomer(@PathVariable("customerId") String strCustomerId) throws IoTPException {
    checkParameter("customerId", strCustomerId);
    try {
        CustomerId customerId = new CustomerId(toUUID(strCustomerId));
        checkCustomerId(customerId);
        customerService.deleteCustomer(customerId);
    } catch (Exception e) {
        throw handleException(e);
    }
}
 
Example 8
Source File: ModuleController.java    From restfiddle with Apache License 2.0 5 votes vote down vote up
@RequestMapping(value = "/api/modules/{id}", method = RequestMethod.DELETE, headers = "Accept=application/json")
   public @ResponseBody
   Module delete(@PathVariable("id") String id) {
logger.debug("Deleting module with id: " + id);

Module deleted = moduleRepository.findOne(id);

moduleRepository.delete(deleted);

return deleted;
   }
 
Example 9
Source File: RestNetworkServiceRecord.java    From NFVO with Apache License 2.0 5 votes vote down vote up
@ApiOperation(
    value = "Remove a VNF Dependency from a NSR",
    notes = "Removes a VNF Dependency based on a VNFR it concerns")
@RequestMapping(value = "{idNsr}/vnfdependencies/{idVnfd}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteVNFDependency(
    @PathVariable("idNsr") String idNsr,
    @PathVariable("idVnfd") String idVnfd,
    @RequestHeader(value = "project-id") String projectId)
    throws NotFoundException {
  networkServiceRecordManagement.deleteVNFDependency(idNsr, idVnfd, projectId);
}
 
Example 10
Source File: RestProject.java    From NFVO with Apache License 2.0 5 votes vote down vote up
/**
 * Removes the Project from the Projects repository
 *
 * @param id : the id of project to be removed
 */
@ApiOperation(
    value = "Remove a Project",
    notes = "Specify the id of the project that will be deleted in the URL")
@RequestMapping(value = "{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void delete(@PathVariable("id") String id)
    throws NotAllowedException, NotFoundException, EntityInUseException, BadRequestException {
  log.info("Removing Project with id " + id);
  if (utils.isAdmin()) {
    projectManagement.delete(projectManagement.query(id));
  } else {
    throw new NotAllowedException("Forbidden to delete project " + id);
  }
}
 
Example 11
Source File: DriverInfoController.java    From logistics-back with MIT License 5 votes vote down vote up
@ApiOperation(value = "删除一个司机信息", notes = "通过 id 删除司机信息")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.DELETE)
public String delete(@PathVariable("id") String id) {
	boolean flag = false;
	flag = driverInfoService.deleteById(id);
	if (!flag) {
		return ERROR;
	}
	return SUCCESS;
}
 
Example 12
Source File: TagController.java    From metacat with Apache License 2.0 5 votes vote down vote up
/**
 * Remove the tags from the given resource.
 *
 * @param tagRemoveRequestDto remove tag request dto
 */
@RequestMapping(
    method = RequestMethod.DELETE,
    consumes = MediaType.APPLICATION_JSON_VALUE
)
@ResponseStatus(HttpStatus.NO_CONTENT)
@ApiOperation(
    value = "Remove the tags from the given resource",
    notes = "Remove the tags from the given resource"
)
@ApiResponses(
    {
        @ApiResponse(
            code = HttpURLConnection.HTTP_NO_CONTENT,
            message = "The tags were successfully deleted from the table"
        ),
        @ApiResponse(
            code = HttpURLConnection.HTTP_NOT_FOUND,
            message = "The requested catalog or database or table cannot be located"
        )
    }
)
public void removeTags(
    @ApiParam(value = "Request containing the set of tags and qualifiedName", required = true)
    @RequestBody final TagRemoveRequestDto tagRemoveRequestDto
) {


    this.requestWrapper.processRequest(
        tagRemoveRequestDto.getName(),
        "TagV1Resource.removeTableTags",
        () -> {
            this.removeResourceTags(tagRemoveRequestDto);
            return null;
        }
    );
}
 
Example 13
Source File: LoginLogController.java    From flash-waimai with MIT License 5 votes vote down vote up
/**
 * 清空日志
 */
@RequestMapping(method = RequestMethod.DELETE)
@RequiresPermissions(value = {Permission.LOGIN_LOG_CLEAR})
public Object clear() {
    loginlogService.clear();
    return Rets.success();
}
 
Example 14
Source File: RestEvent.java    From NFVO with Apache License 2.0 4 votes vote down vote up
/**
 * Removes the EventEndpoint from the EventEndpoint repository
 *
 * @param id : The Event's id to be deleted
 */
@RequestMapping(value = "{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void unregister(@PathVariable("id") String id) throws NotFoundException {
  eventDispatcher.unregister(id);
}
 
Example 15
Source File: PortalAction.java    From boubei-tss with Apache License 2.0 4 votes vote down vote up
/**
 * 删除门户结构
 */
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
public void delete(HttpServletResponse response, @PathVariable("id") Long id) {
    service.deleteStructure(id);
    printSuccessMessage();
}
 
Example 16
Source File: StatusRestController.java    From bluemix-cloud-connectors with Apache License 2.0 4 votes vote down vote up
@RequestMapping(method = RequestMethod.DELETE, value = "{id}")
public void delete(@PathVariable String id) {
    repo.remove(repo.get(id));
}
 
Example 17
Source File: SolaceController.java    From solace-samples-cloudfoundry-java with Apache License 2.0 4 votes vote down vote up
@Deprecated
   @RequestMapping(value = "/subscription", method = RequestMethod.DELETE)
   public ResponseEntity<String> deleteSubscription(@RequestBody SimpleSubscription subscription) {
	return deleteSubscription(subscription.getSubscription());
}
 
Example 18
Source File: OrderController.java    From microservice-atom with Apache License 2.0 4 votes vote down vote up
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
public ModelAndView post(@PathVariable("id") long id) {
	orderRepository.deleteById(id);

	return new ModelAndView("success");
}
 
Example 19
Source File: OrderController.java    From microservice with Apache License 2.0 4 votes vote down vote up
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
public ModelAndView post(@PathVariable("id") long id) {
	orderRepository.deleteById(id);

	return new ModelAndView("success");
}
 
Example 20
Source File: SubAuthorizeAction.java    From boubei-tss with Apache License 2.0 4 votes vote down vote up
/**
 * 删除策略
 */
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
public void delete(HttpServletResponse response, @PathVariable("id") Long id) {
	service.deleteSubauth(id);
       printSuccessMessage();
}