Batch update response as JSON.
@param app the current App object
@param oldObjects a list of old objects read from DB
@param newProperties a list of new object properties to be updated
@return a status code 200 or 400
179340
public static Response getBatchUpdateResponse(App app, Map<String, ParaObject> oldObjects,
			List<Map<String, Object>> newProperties) {
		try (final Metrics.Context context = Metrics.time(app == null ? null : app.getAppid(),
				RestUtils.class, "batch", "update")) {
			if (app != null && oldObjects != null && newProperties != null) {
				LinkedList<ParaObject> updatedObjects = new LinkedList<>();
				boolean hasPositiveVersions = false;
				for (Map<String, Object> newProps : newProperties) {
					if (newProps != null && newProps.containsKey(Config._ID)) {
						ParaObject oldObject = oldObjects.get((String) newProps.get(Config._ID));
						// updating apps in batch is not allowed
						if (oldObject != null && checkImplicitAppPermissions(app, oldObject)) {
							ParaObject updatedObject = ParaObjectUtils.setAnnotatedFields(oldObject, newProps, Locked.class);
							if (isValidObject(app, updatedObject) && checkIfUserCanModifyObject(app, updatedObject)) {
								updatedObject.setAppid(app.getAppIdentifier());
								updatedObjects.add(updatedObject);
								if (updatedObject.getVersion() != null && updatedObject.getVersion() > 0) {
									hasPositiveVersions = true;
								}
							}
						}
					}
				}
				Para.getDAO().updateAll(app.getAppIdentifier(), updatedObjects);
				// check if any or all updates failed due to optimistic locking
				return handleFailedUpdates(hasPositiveVersions, updatedObjects);
			} else {
				return getStatusResponse(Response.Status.BAD_REQUEST);
			}
		}
	}
1273303
@GET
    @Produces(MediaType.APPLICATION_JSON)
    public Response getBatches(@Context HttpServletRequest req) {
        PrincipalUser owner = validateAndGetOwner(req, null);
        SystemAssert.requireArgument(owner != null, "Owner cannot be null");

        Map<String,String> batches = batchService.findBatchesByOwnerName(owner.getUserName());
        return Response.ok(batches, MediaType.APPLICATION_JSON).build();
    }
1159470
public static Map<String, Object> copyAppProperties(Map<String, Object> properties, Map<String, Object> appProperties)
    {
        if (appProperties != null)
        {
            appProperties = Utility.putAllIfNew(new HashMap<String, Object>(), appProperties);
            if (appProperties.get(Params.APP_NAME) != null)
                appProperties.remove(Params.APP_NAME);
            //if (appProperties.get(Params.MESSAGE_SERVER) != null)
            //    appProperties.remove(Params.MESSAGE_SERVER);
            if (appProperties.get(DBParams.FREEIFDONE) != null)
                appProperties.remove(DBParams.FREEIFDONE);
            if (appProperties.get(MessageConstants.MESSAGE_FILTER) != null)
                appProperties.remove(MessageConstants.MESSAGE_FILTER);
        }
        return Utility.putAllIfNew(properties, appProperties);
    }
1176801
void updateRequestWithV2Params(Context context, PrefHelper prefHelper, JSONObject requestObj) {
        try {
            SystemObserver.UniqueId hardwareID = getHardwareID();
            if (!isNullOrEmptyOrBlank(hardwareID.getId()) && hardwareID.isReal()) {
                requestObj.put(Defines.Jsonkey.AndroidID.getKey(), hardwareID.getId());
            } else {
                requestObj.put(Defines.Jsonkey.UnidentifiedDevice.getKey(), true);
            }

            String brandName = SystemObserver.getPhoneBrand();
            if (!isNullOrEmptyOrBlank(brandName)) {
                requestObj.put(Defines.Jsonkey.Brand.getKey(), brandName);
            }

            String modelName = SystemObserver.getPhoneModel();
            if (!isNullOrEmptyOrBlank(modelName)) {
                requestObj.put(Defines.Jsonkey.Model.getKey(), modelName);
            }

            DisplayMetrics displayMetrics = SystemObserver.getScreenDisplay(context_);
            requestObj.put(Defines.Jsonkey.ScreenDpi.getKey(), displayMetrics.densityDpi);
            requestObj.put(Defines.Jsonkey.ScreenHeight.getKey(), displayMetrics.heightPixels);
            requestObj.put(Defines.Jsonkey.ScreenWidth.getKey(), displayMetrics.widthPixels);

            String osName = SystemObserver.getOS();
            if (!isNullOrEmptyOrBlank(osName)) {
                requestObj.put(Defines.Jsonkey.OS.getKey(), osName);
            }

            requestObj.put(Defines.Jsonkey.OSVersion.getKey(), SystemObserver.getOSVersion());

            String countryCode = SystemObserver.getISO2CountryCode();
            if (!TextUtils.isEmpty(countryCode)) {
                requestObj.put(Defines.Jsonkey.Country.getKey(), countryCode);
            }

            String languageCode = SystemObserver.getISO2LanguageCode();
            if (!TextUtils.isEmpty(languageCode)) {
                requestObj.put(Defines.Jsonkey.Language.getKey(), languageCode);
            }

            String localIpAddr = SystemObserver.getLocalIPAddress();
            if ((!TextUtils.isEmpty(localIpAddr))) {
                requestObj.put(Defines.Jsonkey.LocalIP.getKey(), localIpAddr);
            }

            if (prefHelper != null) {
                if (!isNullOrEmptyOrBlank(prefHelper.getDeviceFingerPrintID())) {
                    requestObj.put(Defines.Jsonkey.DeviceFingerprintID.getKey(), prefHelper.getDeviceFingerPrintID());
                }
                String devId = prefHelper.getIdentity();
                if (!isNullOrEmptyOrBlank(devId)) {
                    requestObj.put(Defines.Jsonkey.DeveloperIdentity.getKey(), devId);
                }
            }

            requestObj.put(Defines.Jsonkey.AppVersion.getKey(), getAppVersion());
            requestObj.put(Defines.Jsonkey.SDK.getKey(), "android");
            requestObj.put(Defines.Jsonkey.SdkVersion.getKey(), BuildConfig.VERSION_NAME);
            requestObj.put(Defines.Jsonkey.UserAgent.getKey(), getDefaultBrowserAgent(context));
        } catch (JSONException ignore) {
        }
    }
1205983
public UpdateResponse upsertDataWithObjectMapper(Object sourceObject,
            String index, String type, String id) {
        return upsertData(
                JMElasticsearchUtil.buildSourceByJsonMapper(sourceObject),
                index, type, id);
    }
443407
public void saveOldProperty(Map<String,String> oldProperties, String param)
    {
        oldProperties.put(param, this.getTask().getProperty(param));
    }
945803
protected void notifyPropertiesChanged(Properties oldProperties) {
        PropertiesReloadedEvent event = new PropertiesReloadedEvent(this, oldProperties);
        for (IReloadablePropertiesListener listener : listeners) {
            listener.propertiesReloaded(event);
        }
    }
1102035
public void update( JSONObject json )
    {
        accessToken = json.getString( ACCESS_TOKEN );
        tokenType = json.getString( TOKEN_TYPE );
        expiresAt = calculateExpiresAt( json );
        if ( json.has( OAuth2.REFRESH_TOKEN ) ) {
            refreshToken = json.getString( OAuth2.REFRESH_TOKEN );
        }
    }
810656
private void setUpdateProperties(final String id, final JSONObject needUpdateJsonObject,
                                     final List<Object> paramList, final StringBuilder sql) throws JSONException {
        final Iterator<String> keys = needUpdateJsonObject.keys();
        String key;

        boolean isFirst = true;
        final StringBuilder wildcardString = new StringBuilder();

        while (keys.hasNext()) {
            key = keys.next();

            if (isFirst) {
                wildcardString.append(" SET ").append(key).append(" = ?");
                isFirst = false;
            } else {
                wildcardString.append(", ").append(key).append(" = ?");
            }

            paramList.add(needUpdateJsonObject.get(key));
        }

        sql.append("UPDATE ").append(getName()).append(wildcardString).append(" WHERE ").append(JdbcRepositories.getDefaultKeyName()).append(" = ?");
        paramList.add(id);
    }
1027925
public static Result newBatchedExecuteResponse(int[] updateCounts,
            Result generatedResult, Result e) {

        Result result = newResult(ResultConstants.BATCHEXECRESPONSE);

        result.addChainedResult(generatedResult);
        result.addChainedResult(e);

        Type[] types = new Type[]{ Type.SQL_INTEGER };

        result.metaData = ResultMetaData.newSimpleResultMetaData(types);

        Object[][] table = new Object[updateCounts.length][];

        for (int i = 0; i < updateCounts.length; i++) {
            table[i] = new Object[]{ ValuePool.getInt(updateCounts[i]) };
        }

        ((RowSetNavigatorClient) result.navigator).setData(table);

        return result;
    }
540638
public ActionFuture<UpdateResponse> upsertDataAsync(
            String jsonSource, String index, String type, String id) {
        return upsertQueryAsync(
                buildPrepareUpsert(index, type, id, jsonSource));
    }
253018
def node_properties_update(new_node_properties)
      collection = connection[node_properties_collection]
      old_names = collection.find.batch_size(999).projection(_id: 1).map { |k| k[:_id] }
      delete = old_names - new_node_properties.keys
      data = new_node_properties.map do |k, v|
        {
          replace_one:
          {
            filter: { _id: k },
            replacement: v,
            upsert: true
          }
        }
      end
      collection.bulk_write(data)
      collection.delete_many(_id: { '$in' => delete })
    end
979090
public static base_responses update(nitro_service client, Interface resources[]) throws Exception {
		base_responses result = null;
		if (resources != null && resources.length > 0) {
			Interface updateresources[] = new Interface[resources.length];
			for (int i=0;i<resources.length;i++){
				updateresources[i] = new Interface();
				updateresources[i].id = resources[i].id;
				updateresources[i].speed = resources[i].speed;
				updateresources[i].duplex = resources[i].duplex;
				updateresources[i].flowctl = resources[i].flowctl;
				updateresources[i].autoneg = resources[i].autoneg;
				updateresources[i].hamonitor = resources[i].hamonitor;
				updateresources[i].tagall = resources[i].tagall;
				updateresources[i].trunk = resources[i].trunk;
				updateresources[i].lacpmode = resources[i].lacpmode;
				updateresources[i].lacpkey = resources[i].lacpkey;
				updateresources[i].lagtype = resources[i].lagtype;
				updateresources[i].lacppriority = resources[i].lacppriority;
				updateresources[i].lacptimeout = resources[i].lacptimeout;
				updateresources[i].ifalias = resources[i].ifalias;
				updateresources[i].throughput = resources[i].throughput;
				updateresources[i].bandwidthhigh = resources[i].bandwidthhigh;
				updateresources[i].bandwidthnormal = resources[i].bandwidthnormal;
			}
			result = update_bulk_request(client, updateresources);
		}
		return result;
	}
51969
@Override
  public void add(ApiType obj) {
    String key = keyFunc.apply(obj);
    lock.lock();
    try {
      ApiType oldObj = this.items.get(key);
      this.items.put(key, obj);
      this.updateIndices(oldObj, obj, key);
    } finally {
      lock.unlock();
    }
  }
1311076
private static void copyProperties(Schema oldSchema, Schema newSchema) {
    Preconditions.checkNotNull(oldSchema);
    Preconditions.checkNotNull(newSchema);

    Map<String, JsonNode> props = oldSchema.getJsonProps();
    copyProperties(props, newSchema);
  }
1158012
public void populateClientProperties(Client client, Map<String, Object> properties)
    {
        this.mongoDBClient = (MongoDBClient) client;

        if (properties != null)
        {
            for (String key : properties.keySet())
            {
                Object value = properties.get(key);
                if (checkNull(key, value))
                {
                    if (key.equals(WRITE_CONCERN) && value instanceof WriteConcern)
                    {
                        this.mongoDBClient.setWriteConcern((WriteConcern) value);
                    }
                    else if (key.equals(DB_ENCODER) && value instanceof DBEncoder)
                    {
                        this.mongoDBClient.setEncoder((DBEncoder) value);
                    }
                    else if (key.equals(BATCH_SIZE))
                    {
                        setBatchSize(value);
                    }
                    else if (key.equals(ORDERED_BULK_OPERATION))
                    {
                        try
                        {
                            this.mongoDBClient.setOrderedBulkOperation((boolean) value);
                        }
                        catch (ClassCastException ex)
                        {
                            log.error(
                                    "only boolean value is supported for ORDERED_BULK_OPERATION property. Caused By: ",
                                    ex);
                            throw new KunderaException(
                                    "only boolean value is supported for ORDERED_BULK_OPERATION property. Caused By: ",
                                    ex);

                        }
                    }
                }
                // Add more properties as needed
            }
        }
    }
516106
public int update(DatabaseConnection databaseConnection, T data, ObjectCache objectCache) throws SQLException {
		try {
			// there is always and id field as an argument so just return 0 lines updated
			if (argFieldTypes.length <= 1) {
				return 0;
			}
			Object[] args = getFieldObjects(data);
			Object newVersion = null;
			if (versionFieldType != null) {
				newVersion = versionFieldType.extractJavaFieldValue(data);
				newVersion = versionFieldType.moveToNextValue(newVersion);
				args[versionFieldTypeIndex] = versionFieldType.convertJavaFieldToSqlArgValue(newVersion);
			}
			int rowC = databaseConnection.update(statement, args, argFieldTypes);
			if (rowC > 0) {
				if (newVersion != null) {
					// if we have updated a row then update the version field in our object to the new value
					versionFieldType.assignField(connectionSource, data, newVersion, false, null);
				}
				if (objectCache != null) {
					// if we've changed something then see if we need to update our cache
					Object id = idField.extractJavaFieldValue(data);
					T cachedData = objectCache.get(clazz, id);
					if (cachedData != null && cachedData != data) {
						// copy each field from the updated data into the cached object
						for (FieldType fieldType : tableInfo.getFieldTypes()) {
							if (fieldType != idField) {
								fieldType.assignField(connectionSource, cachedData,
										fieldType.extractJavaFieldValue(data), false, objectCache);
							}
						}
					}
				}
			}
			logger.debug("update data with statement '{}' and {} args, changed {} rows", statement, args.length, rowC);
			if (args.length > 0) {
				// need to do the (Object) cast to force args to be a single object
				logger.trace("update arguments: {}", (Object) args);
			}
			return rowC;
		} catch (SQLException e) {
			throw SqlExceptionUtil.create("Unable to run update stmt on object " + data + ": " + statement, e);
		}
	}