Updates an entity with the data in the request, and emits a response to
attest for that.
187784
private function getUpdatedEntityResponse()
    {
        $response = $this->getEditionResponse();
        try {
            // Try to store an entity with the data in the request.
            $this->storeEntity();
            $response->addNotice(sprintf(
                _('%s correctly stored.'),
                ucfirst($this->getItemName())
            ));
        } catch (ValidatorException $exception) {
            // The entity could not be stored because of a validation error.
            // Add the error data to the response.
            $response->addErrorMessage(array(
                'validation' => $exception->getValidationStatus(),
            ));
        } catch (\Exception $exception) {
            // An unexpected error has occurred. Display the edition
            // page again.
            $response->addErrorMessage($exception->getMessage());
        }
        // Set the entity data into the response.
        $response->setData(
            $this->getItemName(),
            $this->getEntityData()
        );

        return $response;
    }
1289709
def update(self, request, id):
        """"""
        try:
            object = self.model.objects.get(id=id)
        except self.model.DoesNotExist:
            return self._render(
                request = request,
                template = '404',
                context = {
                    'error': 'The %s could not be found.' % self.model.__name__.lower()
                },
                status = 404,
                prefix_template_path = False
            )

        fields = []
        for field in request.PATCH:

            try:
                self.model._meta.get_field_by_name(field)
            except FieldDoesNotExist:
                continue
            else:
                fields.append(field)

        Form = generate_form(
            model = self.model,
            form = self.form,
            fields = fields
        )

        form = Form(request.PATCH, instance=object)
        if form.is_valid():
            object = form.save()

            return self.show(request, id)
        else:
            return self._render(
                request = request,
                template = 'edit',
                context = {
                    'form': form
                },
                status = 400
            )
1231948
@PUT
    @Consumes({Servlets.JSON_MEDIA_TYPE, MediaType.APPLICATION_JSON})
    @Produces(Servlets.JSON_MEDIA_TYPE)
    public Response updateEntities(@Context HttpServletRequest request) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("==> EntityResource.updateEntities()");
        }

        String entityJson = null;
        AtlasPerfTracer perf = null;
        try {
            if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
                perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "EntityResource.updateEntities()");
            }

            final String entities = Servlets.getRequestPayload(request);

            entityJson = AtlasClient.toString(new JSONArray(entities));

            if (LOG.isDebugEnabled()) {
                LOG.info("updating entities {} ", entityJson);
            }

            AtlasEntitiesWithExtInfo   entitiesInfo     = restAdapters.toAtlasEntities(entities);
            EntityMutationResponse     mutationResponse = entityREST.createOrUpdate(entitiesInfo);
            CreateUpdateEntitiesResult result           = restAdapters.toCreateUpdateEntitiesResult(mutationResponse);

            if (LOG.isDebugEnabled()) {
                LOG.debug("Updated entities: {}", result.getEntityResult());
            }

            JSONObject response = getResponse(result);
            return Response.ok(response).build();
        } catch (AtlasBaseException e) {
            LOG.error("Unable to persist entity instance entityDef={}", entityJson, e);
            throw toWebApplicationException(e);
        } catch(EntityExistsException e) {
            LOG.error("Unique constraint violation for entityDef={}", entityJson, e);
            throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.CONFLICT));
        } catch (ValueConversionException ve) {
            LOG.error("Unable to persist entity instance due to a deserialization error entityDef={}", entityJson, ve);
            throw new WebApplicationException(Servlets.getErrorResponse(ve.getCause(), Response.Status.BAD_REQUEST));
        } catch (AtlasException | IllegalArgumentException e) {
            LOG.error("Unable to persist entity instance entityDef={}", entityJson, e);
            throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
        } catch (WebApplicationException e) {
            LOG.error("Unable to persist entity instance entityDef={}", entityJson, e);
            throw e;
        } catch (Throwable e) {
            LOG.error("Unable to persist entity instance entityDef={}", entityJson, e);
            throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
        } finally {
            AtlasPerfTracer.log(perf);

            if (LOG.isDebugEnabled()) {
                LOG.debug("<== EntityResource.updateEntities()");
            }
        }
    }
271627
public <T> void refresh(T entity) {
        DocumentInfo documentInfo = documentsByEntity.get(entity);
        if (documentInfo == null) {
            throw new IllegalStateException("Cannot refresh a transient instance");
        }

        incrementRequestCount();

        GetDocumentsCommand command = new GetDocumentsCommand(new String[]{documentInfo.getId()}, null, false);
        _requestExecutor.execute(command, sessionInfo);

        refreshInternal(entity, command, documentInfo);
    }
718626
@Transactional
  @PostMapping(
      value = "/{entityTypeId}/{id}",
      params = "_method=PUT",
      headers = "Content-Type=application/x-www-form-urlencoded")
  @ResponseStatus(NO_CONTENT)
  public void updateFromFormPost(
      @PathVariable("entityTypeId") String entityTypeId,
      @PathVariable("id") String untypedId,
      HttpServletRequest request) {
    Map<String, Object> paramMap = new HashMap<>();
    for (String param : request.getParameterMap().keySet()) {
      String[] values = request.getParameterValues(param);
      String value = values != null ? StringUtils.join(values, ',') : null;
      paramMap.put(param, value);
    }

    updateInternal(entityTypeId, untypedId, paramMap);
  }
1148774
def update(response, url)
      @log.puts "Scanning: #{url}"
      if response.kind_of?(Net::HTTPClientError) or response.kind_of?(Net::HTTPServerError)
        @log.puts "#{response.code} encountered for #{url}"
      end
    end
1290550
public static Response getUpdateResponse(App app, ParaObject object, InputStream is) {
		try (final Metrics.Context context = Metrics.time(app == null ? null : app.getAppid(),
				RestUtils.class, "crud", "update")) {
			if (app != null && object != null) {
				Map<String, Object> newContent;
				Response entityRes = getEntity(is, Map.class);
				String[] errors = {};
				if (entityRes.getStatusInfo() == Response.Status.OK) {
					newContent = (Map<String, Object>) entityRes.getEntity();
				} else {
					return entityRes;
				}
				object.setAppid(isNotAnApp(object.getType()) ? app.getAppIdentifier() : app.getAppid());
				if (newContent.containsKey("_voteup") || newContent.containsKey("_votedown")) {
					return getVotingResponse(object, newContent);
				} else {
					ParaObjectUtils.setAnnotatedFields(object, newContent, Locked.class);
					// app can't modify other apps except itself
					if (checkImplicitAppPermissions(app, object)) {
						// This is the primary validation pass (validates not only core POJOS but also user defined objects).
						errors = validateObject(app, object);
						if (errors.length == 0 && checkIfUserCanModifyObject(app, object)) {
							// Secondary validation pass: object is validated again before being updated
							object.update();
							// check if update failed due to optimistic locking
							if (object.getVersion() == -1) {
								return getStatusResponse(Response.Status.PRECONDITION_FAILED,
										"Update failed due to 'version' mismatch.");
							}
							return Response.ok(object).build();
						}
					}
				}
				return getStatusResponse(Response.Status.BAD_REQUEST, errors);
			}
			return getStatusResponse(Response.Status.NOT_FOUND);
		}
	}
203121
def update(self, typ, id, **kwargs):
        
        return self._load(self._request(typ, id=id, method='PUT', data=kwargs))
244854
def update_check(self, entity, check, label=None, name=None, disabled=None,
            metadata=None, monitoring_zones_poll=None, timeout=None,
            period=None, target_alias=None, target_hostname=None,
            target_receiver=None):
        
        entity.update_check(check, label=label, name=name, disabled=disabled,
                metadata=metadata, monitoring_zones_poll=monitoring_zones_poll,
                timeout=timeout, period=period, target_alias=target_alias,
                target_hostname=target_hostname,
                target_receiver=target_receiver)
148281
void updateEntity(String repoFullName, Entity entity) {
    lock.readLock().lock();
    try {
      verifyRepoRegistered(repoFullName);
      SetMultimap<Object, EntityListener> entityListeners =
          this.entityListenersByRepo.get(repoFullName);
      Set<EntityListener> entityEntityListeners = entityListeners.get(entity.getIdValue());
      entityEntityListeners.forEach(entityListener -> entityListener.postUpdate(entity));
    } finally {
      lock.readLock().unlock();
    }
  }
753509
def _update_response_body(self, resource):
        
        rpr = self._get_response_representer(resource)
        # Set content type and body of the response.
        self.request.response.content_type = \
                                rpr.content_type.mime_type_string
        rpr_body = rpr.to_bytes(resource)
        self.request.response.body = rpr_body
78186
def add_data(self, request, pk=None):
        """"""
        # add data to entity
        resp = super().add_data(request, pk)

        # add data to collections in which entity is
        entity = self.get_object()
        for collection in entity.collections.all():
            collection.data.add(*request.data['ids'])

        return resp
1233145
def execute
      response = entity_set.service.execute(self.to_s)
      OData::Query::Result.new(self, response)
    end
1045436
def update(self, request, *args, **kwargs):
        """"""
        # NOTE: Use the original method instead when support for locking is added:
        #       https://github.com/encode/django-rest-framework/issues/4675
        # return super().update(request, *args, **kwargs)
        with transaction.atomic():
            return self._update(request, *args, **kwargs)
32198
def _send_update(self, data):
        """"""
        if isinstance(data, dict):
            data = json.dumps(data)
        self.update_callback(data)
290841
public function addOrUpdate()
    {
        $this->request->allowMethod(['post']);
        if (!$this->request->is('ajax')) {
            throw new \RuntimeException('Wrong type of request!');
        }
        $params = is_array($this->request->getData()) ? $this->request->getData() : [];
        /**
         * @var \Cake\Datasource\EntityInterface $translation
         */
        $translation = $this->Translations->getTranslations(
            $params['object_model'],
            $params['object_foreign_key'],
            [
                'language' => $params['language_id'],
                'toEntity' => true,
                'field' => $params['object_field'],
            ]
        );
        if (empty($translation)) {
            /**
             * @var \Cake\Datasource\EntityInterface $translation
             */
            $translation = $this->Translations->newEntity();
        }

        $translation = $this->Translations->patchEntity($translation, $params);
        $result = $this->Translations->save($translation);
        $body = (string)json_encode(!empty($result) ? true : false);
        $this->response = $this->response->withType('application/json')->withStringBody($body);
        $this->autoRender = false;
    }
171066
def update(self):
        """"""
        response = self.jss.session.post(self.url, data=self.auth)
        response_xml = ElementTree.fromstring(response.text.encode("utf_8"))

        # Remove previous data, if any, and then add in response's XML.
        self.clear()
        for child in response_xml.getchildren():
            self.append(child)