Batch save model

@param models model list
@param <T>
518978
public static <T extends Model> void saveBatch(List<T> models) {
        atomic(() -> models.forEach(Anima::save))
                .catchException(e -> log.error("Batch save model error, message: {}", e));
    }
796205
public void addCache(Object key, String className, Object model) {
		if (key == null)
			return;
		if (ModelUtil.isModel(model.getClass()))
			modelCacheManager.saveCache(key, className, model);
		else
			Debug.logError("addCache error:" + model.getClass() + " not ModelIF or @Model", module);

	}
508740
public synchronized void replaceModel (MaxentModel model) {
	replacementThread = Thread.currentThread();
	while (!replacementCanProceed) Thread.yield();
	setter.setModel(model);
	replacementThread = null;
    }
689232
@Override
    public Iterable<T> save(final Iterable<T> entities) {
        return inTransaction(new Callable<Iterable<T>>() {
            @Override
            public Iterable<T> call() throws Exception {
                for (T object : entities) {
                    entityManager.persist(object);
                }
                return entities;
            }
        });
    }
174937
public void put(DajlabModelInterface model) {
		if (model != null) {
			String name = model.getClass().getName();
			dajlab.put(name, model);
		}
	}
178825
def _queue_models(self, models, context):
        
        model_queue = []
        number_remaining_models = len(models)
        # Max number of cycles allowed before we call it an infinite loop.
        MAX_CYCLES = number_remaining_models
        allowed_cycles = MAX_CYCLES

        while number_remaining_models > 0:
            previous_number_remaining_models = number_remaining_models

            model = models.pop(0)

            # If the model is ready to be processed, add it to the list
            if check_dependencies(model, model_queue, context["__avaliable_models"]):
                model_class = ModelCode(model=model, context=context, stdout=self.stdout, stderr=self.stderr, options=self.options)
                model_queue.append(model_class)

            # Otherwise put the model back at the end of the list
            else:
                models.append(model)

            # Check for infinite loops.
            # This means there is a cyclic foreign key structure
            # That cannot be resolved by re-ordering
            number_remaining_models = len(models)
            if number_remaining_models == previous_number_remaining_models:
                allowed_cycles -= 1
                if allowed_cycles <= 0:
                    # Add the remaining models, but do not remove them from the model list
                    missing_models = [ModelCode(model=m, context=context, stdout=self.stdout, stderr=self.stderr, options=self.options) for m in models]
                    model_queue += missing_models
                    # Replace the models with the model class objects
                    # (sure, this is a little bit of hackery)
                    models[:] = missing_models
                    break
            else:
                allowed_cycles = MAX_CYCLES

        return model_queue
706771
public static <T extends Serializable> ListModelUpdateBehavior<T> of(final ListModel<T> model)
	{
		return new ListModelUpdateBehavior<>(model);
	}
1323049
def batch_save(klass, account, objs):
        

        resource = klass.BATCH_RESOURCE_COLLECTION.format(account_id=account.id)

        json_body = []

        for obj in objs:
            entity_type = klass._ENTITY_MAP[klass.__name__].lower()
            obj_json = {'params': obj.to_params()}

            if obj.id is None:
                obj_json['operation_type'] = 'Create'
            elif obj.to_delete is True:
                obj_json['operation_type'] = 'Delete'
                obj_json['params'][entity_type + '_id'] = obj.id
            else:
                obj_json['operation_type'] = 'Update'
                obj_json['params'][entity_type + '_id'] = obj.id

            json_body.append(obj_json)

        resource = klass.BATCH_RESOURCE_COLLECTION.format(account_id=account.id)
        response = Request(account.client,
                           'post', resource,
                           body=json.dumps(json_body),
                           headers={'Content-Type': 'application/json'}).perform()

        # persist each entity
        for obj, res_obj in zip(objs, response.body['data']):
            obj = obj.from_response(res_obj)
575008
public void add(List<BatchCSVRecord> record) {
        if (records == null)
            records = new ArrayList<>();
        records.add(record);
    }
521849
function(model, options) {
    options = options ? extend({}, options) : {};
    if (!(model = this._prepareModel(model, options))){
      return false;
    }
    if (!options.wait){
      this.add(model, options);
    }
    var collection = this;
    options.cb = options.callback;
    options.callback = function cb(err, model, response){
      if (err){
        return callback(err, model, response, options);
      }
      if (options.wait){
        collection.add(model, options);
      }
      callback(null, model, response, options);
    };

    model.save(null, options);
    return model;
  }
137838
def _save_one(self, model, ctx):
        
        assert isinstance(ctx, ResourceQueryContext)

        self._orm.add(model)
        self._orm.flush()
593924
public static <T extends Model, S extends Serializable> void deleteBatch(Class<T> model, List<S> idList) {
        deleteBatch(model, AnimaUtils.toArray(idList));
    }
1263613
protected void save(Model model, String filename) {
        try {
            ModelSerializer.writeModel(model, filename, true);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
9903
public void setInputModel(TreeModel model)
    {
        Enumeration<TreePath> expandedDescendants = 
            this.tree.getExpandedDescendants(new TreePath(treeModel.getRoot()));
        
        this.treeModel = new FilteredTreeModel(model);
        this.tree.setModel(treeModel);
        
        if (expandedDescendants != null)
        {
            while (expandedDescendants.hasMoreElements())
            {
                TreePath expanded = expandedDescendants.nextElement();
                TreePath translatedPath = 
                    JTrees.translatePath(treeModel, expanded);
                if (translatedPath != null)
                {
                    this.tree.expandPath(translatedPath);
                }
            }
        }
    }
1077084
public ApiListingBuilder models(Map<String, Model> models) {
    this.models.putAll(nullToEmptyMap(models));
    return this;
  }
463568
public void batch(List<? extends Row> actions, @Nullable Object[] results)
      throws IOException, InterruptedException {
    if (results == null) {
      results = new Object[actions.size()];
    }
    batchCallback(actions, results, null);
  }
1348645
public static void saveRelationsFile( FileDefinition relationsFile, boolean writeComments, String lineSeparator )
	throws IOException {

		if( relationsFile.getEditedFile() == null )
			throw new IOException( "Save operation could not be performed. The model was not loaded from a local file." );

		saveRelationsFileInto( relationsFile.getEditedFile(), relationsFile, writeComments, lineSeparator );
	}