Java Code Examples for javax.ws.rs.DELETE

The following are top voted examples for showing how to use javax.ws.rs.DELETE. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: Equella   File: EquellaItemResource.java   Source Code and License 7 votes vote down vote up
@DELETE
@Path("/{uuid}/{version}/comment")
@ApiOperation(value = "Delete a comment")
Response deleteComment(
	@Context 
		UriInfo info,
	@ApiParam(APIDOC_ITEMUUID) 
	@PathParam("uuid") 
		String uuid,
	@ApiParam(APIDOC_ITEMVERSION) 
	@PathParam("version") 
		int version,
	@ApiParam(APIDOC_ITEMVERSION) 
	@QueryParam("commentuuid") 
		String commentUuid
	);
 
Example 2
Project: microservices-transactions-tcc   File: CompositeTransactionParticipantController.java   Source Code and License 6 votes vote down vote up
@DELETE
@Path("/tcc/{txid}")
@Consumes("application/tcc")
   @ApiOperation(
   		code = 204,
   		response = String.class,
           value = "Rollback a given composite transaction",
           notes = "See https://www.atomikos.com/Blog/TransactionManagementAPIForRESTTCC",
           consumes = "application/tcc"
       )
public void cancel(
		@ApiParam(value = "Id of the composite transaction to rollback", required = true) @PathParam("txid") String txid
		){
	LOG.info("Trying to rollback transaction [{}]", txid);
	
	getCompositeTransactionParticipantService().cancel(txid);
	
	LOG.info("Transaction [{}] rolled back", txid);
}
 
Example 3
Project: hadoop   File: NamenodeWebHdfsMethods.java   Source Code and License 6 votes vote down vote up
/** Handle HTTP DELETE request for the root. */
@DELETE
@Path("/")
@Produces(MediaType.APPLICATION_JSON)
public Response deleteRoot(
    @Context final UserGroupInformation ugi,
    @QueryParam(DelegationParam.NAME) @DefaultValue(DelegationParam.DEFAULT)
        final DelegationParam delegation,
    @QueryParam(UserParam.NAME) @DefaultValue(UserParam.DEFAULT)
        final UserParam username,
    @QueryParam(DoAsParam.NAME) @DefaultValue(DoAsParam.DEFAULT)
        final DoAsParam doAsUser,
    @QueryParam(DeleteOpParam.NAME) @DefaultValue(DeleteOpParam.DEFAULT)
        final DeleteOpParam op,
    @QueryParam(RecursiveParam.NAME) @DefaultValue(RecursiveParam.DEFAULT)
        final RecursiveParam recursive,
    @QueryParam(SnapshotNameParam.NAME) @DefaultValue(SnapshotNameParam.DEFAULT)
        final SnapshotNameParam snapshotName
    ) throws IOException, InterruptedException {
  return delete(ugi, delegation, username, doAsUser, ROOT, op, recursive,
      snapshotName);
}
 
Example 4
Project: comms-router   File: RouterResource.java   Source Code and License 6 votes vote down vote up
@DELETE
@Path("{ref}")
@ApiOperation(value = "Deletes an existing router by ID", tags = "routers")
@ApiResponses({
    @ApiResponse(code = 200, message = "Successful operation"),
    @ApiResponse(code = 400, message = "Invalid ID supplied",
        response = ExceptionPresentation.class),
    @ApiResponse(code = 404, message = "Router not found",
        response = ExceptionPresentation.class)})
public void delete(@ApiParam(value = "The id of the router to be deleted",
    required = true) @PathParam("ref") String ref) throws CommsRouterException {

  LOGGER.debug("Deleting router: {}", ref);

  routerService.delete(ref);
}
 
Example 5
Project: osc-core   File: ManagerConnectorApis.java   Source Code and License 6 votes vote down vote up
@ApiOperation(value = "Deletes an Manager Connector",
        notes = "Deletes an Appliance Manager Connector if not referenced by any Distributed Appliances",
        response = BaseJobResponse.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Successful operation"),
        @ApiResponse(code = 400,
                message = "In case of any error or if the Manager connector is referenced by a Distributed Appliance",
                response = ErrorCodeDto.class) })
@Path("/{applianceManagerConnectorId}")
@DELETE
public Response deleteApplianceManagerConnector(@Context HttpHeaders headers,
                                                @ApiParam(value = "Id of the Appliance Manager Connector",
                                                        required = true) @PathParam("applianceManagerConnectorId") Long amcId) {

    logger.info("Deleting Appliance Manager Connector " + amcId);
    this.userContext.setUser(OscAuthFilter.getUsername(headers));

    return this.apiUtil.getResponseForBaseRequest(this.deleteApplianceManagerConnectorService,
            new BaseIdRequest(amcId));
}
 
Example 6
Project: MaximoForgeViewerPlugin   File: ForgeRS.java   Source Code and License 6 votes vote down vote up
@DELETE
   @Produces(MediaType.APPLICATION_JSON)
   @Path("bucket/{bucketKey}")
   public Response bucketDelete(
    	@Context HttpServletRequest request,
    	@PathParam("bucketKey") String bucketKey
) 
	throws IOException, 
	       URISyntaxException 
   {
   	APIImpl impl = getAPIImpl( request );
   	if( impl == null )
   	{
           return Response.status( Response.Status.UNAUTHORIZED ).build();     
   	}
   	Result result = impl.bucketDelete( bucketKey );
   	return formatReturn( result );
   }
 
Example 7
Project: MaximoForgeViewerPlugin   File: ForgeRS.java   Source Code and License 6 votes vote down vote up
@DELETE
   @Produces(MediaType.APPLICATION_JSON)
   @Path("model/{bucketKey}/{objectKey}")
   public Response modelDelete(
    	@Context HttpServletRequest request,
   	@PathParam("bucketKey") String bucketKey,
   	@PathParam("objectKey") String objectKey
) 
	throws IOException, 
	       URISyntaxException,
	       GeneralSecurityException 
   {
   	APIImpl impl = getAPIImpl( request );
   	if( impl == null )
   	{
           return Response.status( Response.Status.UNAUTHORIZED ).build();     
   	}
   	Result result = impl.objectDelete( bucketKey, objectKey );
   	return formatReturn( result );
   }
 
Example 8
Project: security-mgr-sample-plugin   File: DomainApis.java   Source Code and License 6 votes vote down vote up
/**
 * Deletes the Domain for a given domain Id
 *
 * @return - deleted Domain
 */
@Path("/{domainId}")
@DELETE
public void deleteDomain(@PathParam("domainId") Long domainId) {

    LOG.info("Deleting Domain Entity ID...:" + domainId);

    this.txControl.required(new Callable<Void>() {

        @Override
        public Void call() throws Exception {

            DomainEntity result = DomainApis.this.em.find(DomainEntity.class, domainId);
            if (result == null) {
                return null;
            }
            DomainApis.this.em.remove(result);
            return null;
        }
    });
}
 
Example 9
Project: athena   File: RegionsWebResource.java   Source Code and License 6 votes vote down vote up
/**
 * Removes the specified collection of devices from the region.
 *
 * @param regionId region identifier
 * @param stream deviceIds JSON stream
 * @return 204 NO CONTENT
 * @onos.rsModel RegionDeviceIds
 */
@DELETE
@Path("{regionId}/devices")
@Consumes(MediaType.APPLICATION_JSON)
public Response removeDevices(@PathParam("regionId") String regionId,
                              InputStream stream) {
    final RegionId rid = RegionId.regionId(regionId);

    try {
        regionAdminService.removeDevices(rid, extractDeviceIds(stream));
    } catch (IOException e) {
        throw new IllegalArgumentException(e);
    }

    return Response.noContent().build();
}
 
Example 10
Project: athena   File: VirtualPortWebResource.java   Source Code and License 6 votes vote down vote up
@DELETE
@Path("{portUUID}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response deletePorts(@PathParam("portUUID") String id) {
    Set<VirtualPortId> vPortIds = new HashSet<>();
    try {
        if (id != null) {
            vPortIds.add(VirtualPortId.portId(id));
        }
        Boolean issuccess = nullIsNotFound(get(VirtualPortService.class)
                .removePorts(vPortIds), VPORT_NOT_FOUND);
        if (!issuccess) {
            return Response.status(INTERNAL_SERVER_ERROR)
                    .entity(VPORT_ID_NOT_EXIST).build();
        }
        return ok(issuccess.toString()).build();
    } catch (Exception e) {
        log.error("Deletes VirtualPort failed because of exception {}",
                  e.toString());
        return Response.status(INTERNAL_SERVER_ERROR).entity(e.toString())
                .build();
    }
}
 
Example 11
Project: fuck_zookeeper   File: ZNodeResource.java   Source Code and License 6 votes vote down vote up
@DELETE
@Produces( { MediaType.APPLICATION_JSON, "application/javascript",
        MediaType.APPLICATION_XML, MediaType.APPLICATION_OCTET_STREAM })
public void deleteZNode(@PathParam("path") String path,
        @DefaultValue("-1") @QueryParam("version") String versionParam,
        @Context UriInfo ui) throws InterruptedException, KeeperException {
    ensurePathNotNull(path);

    int version;
    try {
        version = Integer.parseInt(versionParam);
    } catch (NumberFormatException e) {
        throw new WebApplicationException(Response.status(
                Response.Status.BAD_REQUEST).entity(
                new ZError(ui.getRequestUri().toString(), path
                        + " bad version " + versionParam)).build());
    }

    zk.delete(path, version);
}
 
Example 12
Project: hadoop   File: KMS.java   Source Code and License 6 votes vote down vote up
@DELETE
@Path(KMSRESTConstants.KEY_RESOURCE + "/{name:.*}")
public Response deleteKey(@PathParam("name") final String name)
    throws Exception {
  KMSWebApp.getAdminCallsMeter().mark();
  UserGroupInformation user = HttpUserGroupInformation.get();
  assertAccess(KMSACLs.Type.DELETE, user, KMSOp.DELETE_KEY, name);
  KMSClientProvider.checkNotEmpty(name, "name");

  user.doAs(new PrivilegedExceptionAction<Void>() {
    @Override
    public Void run() throws Exception {
      provider.deleteKey(name);
      provider.flush();
      return null;
    }
  });

  kmsAudit.ok(user, KMSOp.DELETE_KEY, name, "");

  return Response.ok().build();
}
 
Example 13
Project: athena   File: VirtualNetworkWebResource.java   Source Code and License 6 votes vote down vote up
/**
 * Removes the virtual network link from the JSON input stream.
 *
 * @param networkId network identifier
 * @param stream    virtual link JSON stream
 * @return 204 NO CONTENT
 * @onos.rsModel VirtualLink
 */
@DELETE
@Path("{networkId}/links")
@Consumes(MediaType.APPLICATION_JSON)
public Response removeVirtualLink(@PathParam("networkId") long networkId,
                                  InputStream stream) {
    try {
        ObjectNode jsonTree = (ObjectNode) mapper().readTree(stream);
        JsonNode specifiedNetworkId = jsonTree.get("networkId");
        if (specifiedNetworkId != null &&
                specifiedNetworkId.asLong() != (networkId)) {
            throw new IllegalArgumentException(INVALID_FIELD + "networkId");
        }
        final VirtualLink vlinkReq = codec(VirtualLink.class).decode(jsonTree, this);
        vnetAdminService.removeVirtualLink(vlinkReq.networkId(),
                                           vlinkReq.src(), vlinkReq.dst());
    } catch (IOException e) {
        throw new IllegalArgumentException(e);
    }

    return Response.noContent().build();
}
 
Example 14
Project: ditb   File: ScannerInstanceResource.java   Source Code and License 6 votes vote down vote up
@DELETE
public Response delete(final @Context UriInfo uriInfo) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("DELETE " + uriInfo.getAbsolutePath());
  }
  servlet.getMetrics().incrementRequests(1);
  if (servlet.isReadOnly()) {
    return Response.status(Response.Status.FORBIDDEN)
      .type(MIMETYPE_TEXT).entity("Forbidden" + CRLF)
      .build();
  }
  if (ScannerResource.delete(id)) {
    servlet.getMetrics().incrementSucessfulDeleteRequests(1);
  } else {
    servlet.getMetrics().incrementFailedDeleteRequests(1);
  }
  return Response.ok().build();
}
 
Example 15
Project: app-ms   File: SampleResource.java   Source Code and License 5 votes vote down vote up
@DELETE
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Path("/delete")
public Response delete(final String hello) {

    return null;
}
 
Example 16
Project: opencps-v2   File: NotificationTemplateManagement.java   Source Code and License 5 votes vote down vote up
@DELETE
@Path("/{type}")
@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("type") String type);
 
Example 17
Project: Equella   File: ItemRelationResourceImpl.java   Source Code and License 5 votes vote down vote up
@DELETE
@Path(PATH_RELATION_ID)
@ApiOperation(value = "Delete a relation for an item")
public Response delete(@PathParam("uuid") String uuid, @PathParam("version") int version,
	@PathParam("relationId") long relationId)
{
	ItemId itemId = new ItemId(uuid, version);
	relationService.delete(itemId, relationId);
	return Response.ok().build();
}
 
Example 18
Project: osc-core   File: DistributedApplianceApis.java   Source Code and License 5 votes vote down vote up
@ApiOperation(value = "Force Delete a Distributed Appliance",
        notes = "This will not trigger a Job and will not attempt to clean up any artifacts.")
@ApiResponses(value = { @ApiResponse(code = 200, message = "Successful operation"),
        @ApiResponse(code = 400, message = "In case of any error", response = ErrorCodeDto.class) })
@Path("/{distributedApplianceId}/force")
@DELETE
public Response forceDeleteDistributedAppliance(@Context HttpHeaders headers,
                                                @ApiParam(value = "The Id of the Distributed Appliance",
                                                        required = true) @PathParam("distributedApplianceId") Long distributedApplianceId) {
    logger.info("Deleting Distributed Appliance " + distributedApplianceId);
    this.userContext.setUser(OscAuthFilter.getUsername(headers));
    return this.apiUtil.getResponseForBaseRequest(this.deleteDistributedApplianceService,
            new BaseDeleteRequest(distributedApplianceId, true));
}
 
Example 19
Project: plugin-prov   File: ImportCatalogResource.java   Source Code and License 5 votes vote down vote up
@Override
@DELETE
@Path("catalog/{node:service:prov:.+}")
@OnNullReturn404
public ImportCatalogStatus cancel(@PathParam("node") final String node) {
	return LongTaskRunnerNode.super.cancel(nodeResource.checkWritableNode(node).getTool().getId());
}
 
Example 20
Project: incubator-servicecomb-java-chassis   File: ComputeImpl.java   Source Code and License 5 votes vote down vote up
@Path("/addstring")
@DELETE
@Produces(MediaType.TEXT_PLAIN)
public String addString(@QueryParam("s") String[] s) {
  String result = "";
  for (String x : s) {
    result += x;
  }
  return result;
}
 
Example 21
Project: opencps-v2   File: ServiceInfoManagement.java   Source Code and License 5 votes vote down vote up
@DELETE
@Path("/{id}")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Delete ServiceInfo by Id)")
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns the detail of ServiceInfo"),
		@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 deleteServiceInfo(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext,
		@ApiParam(value = "id (or code) of ServiceInfo that need to be delete", required = true) @PathParam("id") String id);
 
Example 22
Project: bootstrap   File: ExceptionMapperResource.java   Source Code and License 5 votes vote down vote up
/**
 * JPA validation exception with parameters.
 */
@DELETE
@Path("jsr-303-jpa")
public void throwJsr303FromJpa() {
	final SystemRole entity = new SystemRole();

	// Name over 200 char --> BVAL exception
	entity.setName(org.apache.commons.lang3.StringUtils.repeat("-", 210));
	repository.save(entity);
}
 
Example 23
Project: demo-ang2   File: PersonEndpoint.java   Source Code and License 5 votes vote down vote up
@DELETE
@Path("/{id:[0-9][0-9]*}")
public Response deleteById(@PathParam("id") Long id) {
	Person entity = em.find(Person.class, id);
	if (entity == null) {
		return Response.status(Status.NOT_FOUND).build();
	}
	em.remove(entity);
	return Response.noContent().build();
}
 
Example 24
Project: opencps-v2   File: DataManagement.java   Source Code and License 5 votes vote down vote up
@DELETE
@Path("/{code}/dictgroups/{groupCode}")
@Consumes({ MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response deleteDictgroups(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user, @Context ServiceContext serviceContext,
		@PathParam("groupCode") String groupCode);
 
Example 25
Project: ThermalComfortBack   File: SensorService.java   Source Code and License 5 votes vote down vote up
@DELETE
@Path("/{id}")
public Response delete(@PathParam("id") String id) {
    try {
        sensorLogic.delete(id);
        return Response.status(200).header("Access-Control-Allow-Origin", "*").entity("Sucessful: Sensor was deleted").build();
    } catch (Exception e) {
        Logger.getLogger(SensorService.class.getName()).log(Level.WARNING, e.getMessage());
        return Response.status(500).header("Access-Control-Allow-Origin", "*").entity("We found errors in your query, please contact the Web Admin.").build();
    }
}
 
Example 26
Project: dust-api   File: UserResource.java   Source Code and License 5 votes vote down vote up
@DELETE
@Path("/{userId}/watches/{deviceId}")
public void unwatch(
        @PathParam("userId") final long userId,
        @PathParam("deviceId") final long deviceId
) {
    userRepo.removeWatch(deviceId, userId);
}
 
Example 27
Project: Equella   File: FileResource.java   Source Code and License 5 votes vote down vote up
@DELETE
@Path("/{uuid}/content/{filepath:(.*)}")
@ApiOperation(value = "Delete a file")
public Response deleteFile(// @formatter:off
	@PathParam("uuid") String stagingUuid,
	@PathParam("filepath") String filepath
	// @formatter:on
) throws IOException;
 
Example 28
Project: holon-examples   File: ProductEndpoint.java   Source Code and License 5 votes vote down vote up
@ApiOperation("Delete a product")
@ApiResponses({ @ApiResponse(code = 204, message = "Product deleted") })
@DELETE
@Path("/{id}")
@Consumes(MediaType.APPLICATION_JSON)
public Response deleteProduct(@ApiParam("The product id to delete") @PathParam("id") Long id) {
	getProductStore().remove(id);
	return Response.noContent().build();
}
 
Example 29
Project: athena   File: AclWebResource.java   Source Code and License 5 votes vote down vote up
/**
 * Remove ACL rule.
 *
 * @param id ACL rule id (in hex string format)
 * @return 204 NO CONTENT
 */
@DELETE
@Path("{id}")
public Response removeAclRule(@PathParam("id") String id) {
    RuleId ruleId = new RuleId(Long.parseLong(id.substring(2), 16));
    get(AclService.class).removeAclRule(ruleId);
    return Response.noContent().build();
}
 
Example 30
Project: InComb   File: FlyWithService.java   Source Code and License 5 votes vote down vote up
/**
 * Deletes a FlyWith from a given user
 * @param userId of the user to remove the flywith from
 * @param flyWithId to remove
 * @param con Connection to use - is injected automatically
 * @return
 */
@DELETE
public Response deleteFlyWith(@PathParam ("userId") final long userId, @PathParam ("flyWithId") final long flyWithId, @Context final Connection con ) {
	getAccessChecker().checkLoggedInUser(userId);
	final FlyWithDao dao = new FlyWithDao(con);
	dao.deleteFlyWith(userId, flyWithId);
	return ok(null);
}
 
Example 31
Project: opencps-v2   File: DeliverableTypesManagement.java   Source Code and License 5 votes vote down vote up
@DELETE
@Path("/{id}")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Remove a Deliverabletypes by its id", response = DeliverableTypesModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a Dossier was removed", response = DeliverableTypesModel.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 removeDeliverabletypes(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("id") String id);
 
Example 32
Project: opencps-v2   File: DossierManagement.java   Source Code and License 5 votes vote down vote up
@DELETE
@Path("/{id}")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Remove a Dossier by its id", response = DossierDetailModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a Dossier was removed", response = DossierDetailModel.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 removeDossier(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("id") String id);
 
Example 33
Project: opencps-v2   File: DossierTemplateManagement.java   Source Code and License 5 votes vote down vote up
@DELETE
@Path("/{id}")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Get a DossierTemplate", response = DossierTemplateInputModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns detail of DossierTemplate", response = DossierTemplateInputModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal error", response = ExceptionModel.class) })

public Response removeDossierTemplate(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("id") long id);
 
Example 34
Project: plugin-bt   File: BugTrackerResource.java   Source Code and License 5 votes vote down vote up
/**
 * Update the business hours : only one range.
 * 
 * @param id
 *            The business hours identifier.
 */
@DELETE
@Path("business-hours/{id:\\d+}")
public void deleteBusinessHours(@PathParam("id") final int id) {
	final BusinessHours businessHours = findConfigured(businessHoursRepository, id);

	// Check there is at least one business range
	if (businessHours.getConfiguration().getBusinessHours().size() == 1) {
		throw new BusinessException("service:bt:no-business-hours");
	}
	businessHoursRepository.delete(businessHours);
}
 
Example 35
Project: trellis   File: MultipartUploader.java   Source Code and License 5 votes vote down vote up
/**
 * Abort an upload process.
 *
 * @param id the upload identifier
 */
@DELETE
@Timed
public void abortUpload(@PathParam("id") final String id) {

    if (!binaryService.uploadSessionExists(id)) {
        throw new NotFoundException();
    }

    binaryService.abortUpload(id);
}
 
Example 36
Project: opencps-v2   File: RegistrationTemplatesManagement.java   Source Code and License 5 votes vote down vote up
@DELETE
@Path("/{id}")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Remove a  registrationTemplate by its id", response = RegistrationTemplatesModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a Dossier was removed", response = RegistrationTemplatesModel.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 removeRegistrationTemplate(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("id") long id);
 
Example 37
Project: flightmanager   File: TemplateResource.java   Source Code and License 5 votes vote down vote up
@DELETE
@Path("{id}")
public void deleteFlightTemplate(@PathParam("id") long id) {
    FlightTemplateInterface temp = DAOFactory.INSTANCE.getFlightTemplateDAO().findId(id);
    temp.setIsActive(false);
    DAOFactory.INSTANCE.getFlightTemplateDAO().update(temp);
}
 
Example 38
Project: https-github.com-apache-zookeeper   File: SessionsResource.java   Source Code and License 5 votes vote down vote up
@DELETE
@Produces( { MediaType.APPLICATION_JSON, "application/javascript",
        MediaType.APPLICATION_XML, MediaType.APPLICATION_OCTET_STREAM })
public void deleteSession(@PathParam("session") String session,
        @Context UriInfo ui) {
    ZooKeeperService.close(contextPath, session);
}
 
Example 39
Project: nifi-registry   File: AccessPolicyResource.java   Source Code and License 5 votes vote down vote up
/**
 * Remove a specified access policy.
 *
 * @param httpServletRequest request
 * @param identifier         The id of the access policy to remove.
 * @return The deleted access policy
 */
@DELETE
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@Path("{id}")
@ApiOperation(
        value = "Deletes an access policy",
        response = AccessPolicy.class
)
@ApiResponses({
        @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401),
        @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403),
        @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404),
        @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry might not be configured to use a ConfigurableAccessPolicyProvider.") })
public Response removeAccessPolicy(
        @Context final HttpServletRequest httpServletRequest,
        @ApiParam(value = "The access policy id.", required = true)
        @PathParam("id")
        final String identifier) {

    verifyAuthorizerSupportsConfigurablePolicies();
    authorizeAccess(RequestAction.DELETE);
    AccessPolicy deletedPolicy = authorizationService.deleteAccessPolicy(identifier);
    if (deletedPolicy == null) {
        throw new ResourceNotFoundException("No access policy found with ID + " + identifier);
    }
    return generateOkResponse(deletedPolicy).build();
}
 
Example 40
Project: javaee8-jaxrs-sample   File: CommentsResource.java   Source Code and License 5 votes vote down vote up
@Path("{commentId}")
@DELETE
public Response deleteComment(@PathParam("commentId") Long commentId) {
    return comments.findOptionalById(commentId)
        .map(c -> comments.delete(c))
        .map(c -> Response.noContent().build())
        .orElseThrow(() -> new CommentNotFoundException(commentId));

}