@PUT @Consumes(MediaType.TEXT_PLAIN) @Produces(MediaType.TEXT_PLAIN) @ApiOperation(value = "Install Presto using rpm or tarball") @ApiResponses(value = { @ApiResponse(code = 207, message = "Multiple responses available"), @ApiResponse(code = 400, message = "Request contains invalid parameters")}) public Response install(String urlToFetchPackage, @QueryParam("checkDependencies") @DefaultValue("true") boolean checkDependencies, @QueryParam("scope") String scope, @QueryParam("nodeId") List<String> nodeId) { ApiRequester.Builder apiRequester = requesterBuilder(ControllerPackageAPI.class) .httpMethod(PUT) .accept(MediaType.TEXT_PLAIN) .entity(Entity.entity(urlToFetchPackage, MediaType.TEXT_PLAIN)); optionalQueryParam(apiRequester, "checkDependencies", checkDependencies); return forwardRequest(scope, apiRequester.build(), nodeId); }
@ApiOperation(value = "Updates a Distributed Appliance", notes = "Updates a Distributed Appliance and sync's it immediately.", response = BaseJobResponse.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful operation"), @ApiResponse(code = 400, message = "In case of any error", response = ErrorCodeDto.class) }) @Path("/{distributedApplianceId}") @PUT public Response updateDistributedAppliance(@Context HttpHeaders headers, @ApiParam(value = "The Id of the Distributed Appliance", required = true) @PathParam("distributedApplianceId") Long distributedApplianceId, @ApiParam(required = true) DistributedApplianceDto daDto) { logger.info("Updating Distributed Appliance " + distributedApplianceId); this.userContext.setUser(OscAuthFilter.getUsername(headers)); this.apiUtil.setIdOrThrow(daDto, distributedApplianceId, "DistributedAppliance"); return this.apiUtil.getResponseForBaseRequest(this.updateDistributedApplianceService, new BaseRequest<DistributedApplianceDto>(daDto)); }
@PUT @Path("/{id:[0-9][0-9]*}") @Consumes("application/json") public Response update(@PathParam("id") Long id, Person entity) { if (entity == null) { return Response.status(Status.BAD_REQUEST).build(); } if (id == null) { return Response.status(Status.BAD_REQUEST).build(); } if (!id.equals(entity.getId())) { return Response.status(Status.CONFLICT).entity(entity).build(); } if (em.find(Person.class, id) == null) { return Response.status(Status.NOT_FOUND).build(); } try { entity = em.merge(entity); } catch (OptimisticLockException e) { return Response.status(Response.Status.CONFLICT) .entity(e.getEntity()).build(); } return Response.noContent().build(); }
@PUT @Path("/{connector}/config") public Response putConnectorConfig(final @PathParam("connector") String connector, final @QueryParam("forward") Boolean forward, final Map<String, String> connectorConfig) throws Throwable { FutureCallback<Herder.Created<ConnectorInfo>> cb = new FutureCallback<>(); String includedName = connectorConfig.get(ConnectorConfig.NAME_CONFIG); if (includedName != null) { if (!includedName.equals(connector)) throw new BadRequestException("Connector name configuration (" + includedName + ") doesn't match connector name in the URL (" + connector + ")"); } else { connectorConfig.put(ConnectorConfig.NAME_CONFIG, connector); } herder.putConnectorConfig(connector, connectorConfig, true, cb); Herder.Created<ConnectorInfo> createdInfo = completeOrForwardRequest(cb, "/connectors/" + connector + "/config", "PUT", connectorConfig, new TypeReference<ConnectorInfo>() { }, new CreatedConnectorInfoTranslator(), forward); Response.ResponseBuilder response; if (createdInfo.created()) response = Response.created(URI.create("/connectors/" + connector)); else response = Response.ok(); return response.entity(createdInfo.result()).build(); }
@ApiOperation("Update a product") @ApiResponses({ @ApiResponse(code = 204, message = "Product updated"), @ApiResponse(code = 404, message = "Product not found") }) @PUT @Path("/{id}") @Consumes(MediaType.APPLICATION_JSON) public Response updateProduct(@ProductModel PropertyBox product) { if (product == null) { return Response.status(Status.BAD_REQUEST).entity("Missing product").build(); } if (!product.getValueIfPresent(MProduct.ID).isPresent()) { return Response.status(Status.BAD_REQUEST).entity("Missing product id").build(); } return getProductStore().get(product.getValue(MProduct.ID)).map(p -> { getProductStore().put(product); return Response.noContent().build(); }).orElse(Response.status(Status.NOT_FOUND).build()); }
@PUT @Path("/{id}/payments/{referenceUid}/approval/noattachment") @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED}) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED}) @ApiOperation(value = "Update PaymentFile") @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 denied", response = ExceptionModel.class) }) public Response updatePaymentFileApprovalNoAttachment(@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") String id, @ApiParam(value = "reference of paymentFile", required = true) @PathParam("referenceUid") String referenceUid, @BeanParam PaymentFileInputModel input);
@PUT @Path("{routerUUID}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public Response updateRouter(@PathParam("routerUUID") String id, final InputStream input) { try { ObjectMapper mapper = new ObjectMapper(); JsonNode subnode = mapper.readTree(input); Collection<Router> routers = changeUpdateJsonToSub(subnode, id); Boolean result = nullIsNotFound(get(RouterService.class) .updateRouters(routers), UPDATE_FAIL); if (!result) { return Response.status(CONFLICT).entity(UPDATE_FAIL).build(); } return ok(result.toString()).build(); } catch (Exception e) { return Response.status(BAD_REQUEST).entity(e.getMessage()).build(); } }
@PUT @Path("logEvent/{fn_event}") public void logEvent(@HeaderParam("uid") String uid, String message, @PathParam("fn_event") String event) throws Exception { File dir = new File(Storage_Controller.getBaseFolder()); File log = new File(dir, "log.txt"); if(!log.exists()){ log.createNewFile(); } SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); String time = dateFormat.format(new Date()); BufferedWriter output = new BufferedWriter(new FileWriter(log, true)); // System.out.println("["+time+"]\t["+uid+"]\t["+event+"]\t"+message+"\n"); output.write("["+time+"]\t["+uid+"]\t["+event+"]\t"+message+"\n"); output.flush(); }
/** * Create a setting for current user, and assign as a cookie the hash value. * * @param newPreferred * The new preferred URL. * @return The response containing the cookie. */ @POST @PUT public Response saveOrUpdate(final String newPreferred) { // Save the new URL userSettingResource.saveOrUpdate(PREFERRED_URL, newPreferred); // Check the current hash SystemUserSetting setting = repository.findByLoginAndName(securityHelper.getLogin(), PREFERRED_HASH); if (setting == null) { // No hash generated for this user, create a new one setting = new SystemUserSetting(); setting.setLogin(SecurityContextHolder.getContext().getAuthentication().getName()); setting.setName(PREFERRED_HASH); setting.setValue(GENERATOR.generate(100)); repository.saveAndFlush(setting); } // Send back to the user the cookie return addCookie(Response.noContent(), securityHelper.getLogin(), setting.getValue()).build(); }
/** * Updates the Domain for a given domain Id * * @return - updated Domain */ @Path("/{domainId}") @PUT public DomainEntity updateDomain(@PathParam("domainId") Long domainId, DomainEntity entity) { LOG.info("Updating Domain Entity ID...:" + domainId); return this.txControl.required(new Callable<DomainEntity>() { @Override public DomainEntity call() throws Exception { DomainEntity result = DomainApis.this.em.find(DomainEntity.class, domainId); if (result == null) { throw new Exception("Domain Entity does not exists..."); //TODO - to add RETURN 404 error:Sudhir } result.setName(entity.getName()); DomainApis.this.em.persist(result); return result; } }); }
@Path("/{sgiId}") @PUT public SecurityGroupInterfaceEntity updateSecurityGroupInterface(@PathParam("sgiId") Long sgiId, @PathParam("deviceId") Long deviceId, SecurityGroupInterfaceEntity entity) throws Exception { LOG.info(String.format("Updating the security group interface with sginterfaceid %s", Long.toString(sgiId))); DeviceEntity device = this.validationUtil.getDeviceOrThrow(Long.toString(deviceId)); this.validationUtil.validateIdMatches(device, Long.parseLong(entity.getDevice().getId()), "SecurityGroupInterface"); VirtualSystemElementImpl vs = new VirtualSystemElementImpl(deviceId, null); this.sgiApi = new IsmSecurityGroupInterfaceApi(vs, null, this.txControl, this.em); entity.setId(sgiId); this.sgiApi.updateSecurityGroupInterface(new SecurityGroupInterfaceElementImpl(entity)); return entity; }
@PUT @Path(value = "/{id}") @Consumes("application/json") public void update(@NotNull @PathParam("id") String id, @NotNull @Valid OAuthApp app) { final Connector connector = dataMgr.fetch(Connector.class, id); if (connector == null) { throw new WebApplicationException(Response.Status.NOT_FOUND); } final Connector updated = new Connector.Builder().createFrom(connector) .putOrRemoveConfiguredPropertyTaggedWith(Credentials.CLIENT_ID_TAG, app.clientId) .putOrRemoveConfiguredPropertyTaggedWith(Credentials.CLIENT_SECRET_TAG, app.clientSecret) .build(); dataMgr.update(updated); }
@ApiOperation(value = "Retrieves the Distributed Appliance Instances status", notes = "Retrieves the Distributed Appliance Instances statuses specified by the Ids", response = GetAgentStatusResponse.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful operation"), @ApiResponse(code = 400, message = "In case of any error", response = ErrorCodeDto.class) }) @Path("/status") @PUT public GetAgentStatusResponse getDistributedApplianceInstanceStatus(@Context HttpHeaders headers, @ApiParam(value = "The Ids of the Distributed Appliance Instances to get status for", required = true) DistributedApplianceInstancesRequest req) { logger.info("Getting Distributed Appliance Instance Status " + req); this.userContext.setUser(OscAuthFilter.getUsername(headers)); return this.apiUtil.submitRequestToService(this.getAgentStatusService, req); }
/** * Update a named token with a new generated one. * * @param name * Token to update. * @return the new generated token. */ @PUT @Consumes(MediaType.APPLICATION_JSON) @Path("{name:[\\w\\-\\.]+}") public String update(@PathParam("name") final String name) throws GeneralSecurityException { final SystemApiToken entity = repository.findByUserAndName(securityHelper.getLogin(), name); if (entity == null) { // No token with given name throw new EntityNotFoundException(); } // Token has been found, update it final String token = newToken(entity); repository.saveAndFlush(entity); return token; }
@PermitAll @PUT @Path("/") @Produces("application/json") @Consumes("application/json") public Response update(AirConditioning air) { ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST); builder.expires(new Date()); try { AirConditioningDao.getInstance().update(air); builder.status(Response.Status.OK).entity(air); } catch (SQLException exception) { builder.status(Response.Status.INTERNAL_SERVER_ERROR); } return builder.build(); }
@PUT @Path("update") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public Response update(@Valid Personarchive value) throws Throwable { try { personArchiveService.update(value); } catch (Exception ex) { return Response.ok().header("Exception", ex.getMessage()).build(); } return Response.ok().entity("Date is updated").build(); }
@PUT @Consumes("application/json") @Path("/{oid}") public Response updateBook(@PathParam("oid") String oid, Book book) { bookService.updateBook(oid, book); return Response.noContent().build(); }
@PUT @Path("{id}") @ApiOperation(value="Update a booking with ID") @Consumes("application/json") @Produces("text/plain") @ApiResponses({ @ApiResponse(code = 200, message= "Booking updated"), @ApiResponse(code = 404, message = "Booking not found")}) public Response updateBooking(@PathParam("id") String id, Booking booking){ return Controller.updateBooking(id, booking); }
@PUT @Path("/{id}/preferences/{key}") @Consumes({ MediaType.APPLICATION_FORM_URLENCODED }) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) public Response updateOfficeSitePreferencesByKey(@Context HttpServletRequest request, @Context HttpHeaders header, @Context Company company, @Context Locale locale, @Context User user, @Context ServiceContext serviceContext, @PathParam("id") long id, @PathParam("key") String key, @FormParam("value") String value);
@PUT @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public Operation_type updateOperation_type(Operation_type Loc) { Operation_type Operation_typeResponse = Operation_type_Service.updateOperation_type(Loc); return Operation_typeResponse; }
@PUT @Path("{id: \\d+}") public OfertaDetailDTO updateOferta(@PathParam("id") Long id, OfertaDetailDTO dto) throws BusinessLogicException { OfertaEntity entity = dto.toEntity(); entity.setId(id); return new OfertaDetailDTO(ofertaLogic.updateOferta(entity)); }
@PUT @Path("updateName") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public Response updateName(Clinicmanager value) throws Throwable { try { /* TODO doctorService.updateName(value); */ } catch (Exception ex) { return Response.ok().header("Exception", ex.getMessage()).build(); } return Response.ok().entity("Date is updated").build(); }
@PUT @Path("update") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public Response update(@Valid Pharmacist value) throws Throwable { try { pharmacistService.update(value); } catch (Exception ex) { return Response.ok().header("Exception", ex.getMessage()).build(); } return Response.ok().entity("Date is updated").build(); }
@PUT @Path("/addUser") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public Response addUser(User userData){ //Add New Use To database... System.out.println(userData); //Create response object JSONObject resp = new JSONObject(); resp.put("success", "true"); //Return response return Response.ok(resp.toJSONString()).build(); }
@PUT @Path("/{id}/photo") @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.APPLICATION_OCTET_STREAM) public Response uploadEmployeePhoto(@Context HttpServletRequest request, @Context HttpHeaders header, @Context Company company, @Context Locale locale, @Context User user, @Context ServiceContext serviceContext, @PathParam("id") long id, @Multipart("file") Attachment attachment, @Multipart("fileName") String fileName, @Multipart("fileType") String fileType, @Multipart("fileSize") long fileSize);
/** * Update the given SLA. * * @param vo * The SLA to update. */ @PUT @Path("sla") @Consumes(MediaType.APPLICATION_JSON) public void updateSla(final SlaEditionVo vo) { save(vo, findConfigured(slaRepository, vo.getId())); }
@PUT @Path("/{code}/dictgroups/{groupCode}") @Consumes({ MediaType.APPLICATION_FORM_URLENCODED }) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) public Response updateDictgroups(@Context HttpServletRequest request, @Context HttpHeaders header, @Context Company company, @Context Locale locale, @Context User user, @Context ServiceContext serviceContext, @PathParam("code") String code, @PathParam("groupCode") String groupCode, @BeanParam DictGroupInputModel input);
@PUT @Consumes({MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF, MIMETYPE_PROTOBUF_IETF}) public Response put(final CellSetModel model, final @Context UriInfo uriInfo) { if (LOG.isDebugEnabled()) { LOG.debug("PUT " + uriInfo.getAbsolutePath() + " " + uriInfo.getQueryParameters()); } return update(model, true); }
@PUT @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public Location updateLocation(Location Loc) { Location LocationResponse = Location_Service.updateLocation(Loc); return LocationResponse; }
@PUT @Produces( { MediaType.APPLICATION_JSON, "application/javascript", MediaType.APPLICATION_XML }) @Consumes(MediaType.APPLICATION_OCTET_STREAM) public Response setZNode( @PathParam("path") String path, @QueryParam("callback") String callback, @DefaultValue("-1") @QueryParam("version") String versionParam, @DefaultValue("base64") @QueryParam("dataformat") String dataformat, @DefaultValue("false") @QueryParam("null") String setNull, @Context UriInfo ui, byte[] data) 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()); } if (setNull.equals("true")) { data = null; } Stat stat = zk.setData(path, data, version); ZStat zstat = new ZStat(path, ui.getAbsolutePath().toString(), null, null, stat.getCzxid(), stat.getMzxid(), stat.getCtime(), stat .getMtime(), stat.getVersion(), stat.getCversion(), stat.getAversion(), stat.getEphemeralOwner(), stat .getDataLength(), stat.getNumChildren(), stat .getPzxid()); return Response.status(Response.Status.OK).entity( new JSONWithPadding(zstat, callback)).build(); }
@PUT @Consumes(MediaType.APPLICATION_JSON) public void setCustomers(Flow.Publisher<Customer> customers, @Suspended AsyncResponse response) throws IOException { repository .save(customers) .subscribe(new Flow.Subscriber<>() { @Override public void onSubscribe(Flow.Subscription subscription) { subscription.request(Long.MAX_VALUE); } @Override public void onNext(Integer item) { System.out.println("===== Customer Count: " + item); } @Override public void onError(Throwable throwable) { } @Override public void onComplete() { System.out.println("===== Completed "); response.resume(Response.noContent().build()); } }); }
@PUT @Path("/{id}/preferences/{key}") @Consumes({ MediaType.APPLICATION_FORM_URLENCODED }) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) public Response updatePreferences(@Context HttpServletRequest request, @Context HttpHeaders header, @Context Company company, @Context Locale locale, @Context User user, @Context ServiceContext serviceContext, @PathParam("id") long id, @PathParam("key") String key, @FormParam("value") String value);
/** * Applies the current mastership role for the specified device. * * @param stream JSON representation of device, node, mastership info * @return status of the request - CREATED if the JSON is correct, * BAD_REQUEST if the JSON is invalid * @onos.rsModel MastershipPut */ @PUT @Consumes(MediaType.APPLICATION_JSON) public Response setRole(InputStream stream) { try { ObjectNode jsonTree = (ObjectNode) mapper().readTree(stream); JsonNode deviceIdJson = jsonTree.get(DEVICE_ID); JsonNode nodeIdJson = jsonTree.get(NODE_ID); MastershipRole role = codec(MastershipRole.class).decode(jsonTree, this); if (deviceIdJson == null) { throw new IllegalArgumentException(DEVICE_ID_INVALID); } if (nodeIdJson == null) { throw new IllegalArgumentException(NODE_ID_INVALID); } mastershipAdminService.setRoleSync(NodeId.nodeId(nodeIdJson.asText()), DeviceId.deviceId(deviceIdJson.asText()), role); return Response.ok().build(); } catch (IOException e) { throw new IllegalArgumentException(e); } }
@PUT @Secured @Path("/joinqueueracenow") @Produces(MediaType.APPLICATION_XML) public String joinQueueRaceNow(@HeaderParam("securityToken") String securityToken) { Long activePersonaId = tokenSessionBO.getActivePersonaId(securityToken); lobbyBO.joinFastLobby(activePersonaId); return ""; }
@ApiOperation("Update a sample") @PUT @Consumes(MediaType.APPLICATION_JSON) @Path("{id}") @Timed public Sample update(@PathParam("id") Long id, Sample sample) { return sampleDao.updateSample(sample); }
@PUT @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) public ProbandOutVO updateProband(ProbandInVO in) throws AuthenticationException, AuthorisationException, ServiceException { return WebUtil.getServiceLocator().getProbandService().updateProband(auth, in, Settings.getIntNullable(SettingCodes.API_GRAPH_MAX_PROBAND_INSTANCES, Bundle.SETTINGS, DefaultSettings.API_GRAPH_MAX_PROBAND_INSTANCES), Settings.getIntNullable(SettingCodes.API_GRAPH_MAX_PROBAND_PARENTS_DEPTH, Bundle.SETTINGS, DefaultSettings.API_GRAPH_MAX_PROBAND_PARENTS_DEPTH), Settings.getIntNullable(SettingCodes.API_GRAPH_MAX_PROBAND_CHILDREN_DEPTH, Bundle.SETTINGS, DefaultSettings.API_GRAPH_MAX_PROBAND_CHILDREN_DEPTH)); }
@PUT @Path("/{id}/formscript") @Consumes({ MediaType.APPLICATION_FORM_URLENCODED }) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @ApiOperation(value = "update FormScript") @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 denied", response = ExceptionModel.class) }) public Response updateRegistrationTemplateFormScript(@Context HttpServletRequest request, @Context HttpHeaders header, @Context Company company, @Context Locale locale, @Context User user, @Context ServiceContext serviceContext, @ApiParam(value = "id of registrationTemplate", required = true) @PathParam("id") long registrationTemplateId, @ApiParam(value = "FormScript of registrationTemplate", required = true) @FormParam("formScript") String formScript);
@Path("/regeneratetoken") @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.TEXT_PLAIN) public String regenerateToken(String JSONRequest, @Context ServletContext context) { JSONObject json = new JSONObject(JSONRequest); DatabaseOperations databaseOps = (DatabaseOperations) context.getAttribute("databaseOps"); String out = databaseOps.resetToken(json.getString("github_id")); return out; }
@Path("/{Matricule}") @PUT @Consumes (MediaType.APPLICATION_JSON) public void modifyOne (@PathParam("Matricule") String mat, Collaborateur coll){ try { colSer.modifyColl(coll, mat); } catch (ParamException e) { } }
@Path("/{Matricule}/banque") @PUT @Consumes (MediaType.APPLICATION_JSON) public void modify (@PathParam("Matricule") String mat, CordBanc banc){ colSer.modifyCordBanc(banc, mat); }