Save {@link Attack} to DB

@param attack {@link Attack} to save
439382
@Transactional
	public void save(Attack attack) {
		Attack merged = em.merge(attack);
		em.flush();
		attack.setId(merged.getId());
	}
489698
@Override
    public void save(T object, AccessControlContext accessControlContext)
            throws OptimisticLockException, AccessControlException, JeppettoException {
        ensureAccessControlEnabled();

        T enhancedEntity = dirtyableDBObjectEnhancer.enhance(object);
        DirtyableDBObject dbo = (DirtyableDBObject) enhancedEntity;

        if (dbo.isPersisted(dbCollection)) {
            verifyWriteAllowed(dbo, accessControlContext);
        } else {
            if (dbo.get(ID_FIELD) == null) {
                dbo.put(ID_FIELD, new ObjectId());  // If the id isn't explicitly set, assume intent is for mongo ids
            }

            assessAndAssignAccessControl(dbo, accessControlContext);
        }

        DBObject identifyingQuery = buildIdentifyingQuery(dbo);

        if (MongoDBSession.isActive()) {
            MongoDBSession.trackForSave(this, identifyingQuery, enhancedEntity, createIdentifyingQueries(dbo));
        } else {
            trueSave(identifyingQuery, dbo);
        }
    }
376503
@Override
    public void saveOrUpdate() {
        if (checkBox.getValue() && dsCombo.getValue() != null) {
            final ActionType autoAssignActionType = ((ActionTypeOption) actionTypeOptionGroupLayout
                    .getActionTypeOptionGroup().getValue()).getActionType();
            updateTargetFilterQueryDS(tfqId, (Long) dsCombo.getValue(), autoAssignActionType);
        } else if (!checkBox.getValue()) {
            updateTargetFilterQueryDS(tfqId, null, null);
        }
    }
512020
protected void save() {

        boolean newUser = false;
        try {
            if (m_user == null) {
                createNewUser();
                newUser = true;
            } else {

                saveUser();
            }
            saveUserSettings();
            if (m_sendEmail.getValue().booleanValue() & m_sendEmail.isEnabled()) {
                sendMail(m_cms, m_pw.getPassword1(), m_user, newUser, m_forceResetPassword.getValue().booleanValue());
            }
        } catch (CmsException e) {
            LOG.error("Unable to save user", e);
        }
    }
42062
@GetMapping(value = "/v1/dbs/{db}/save",
            produces = MediaType.TEXT_PLAIN_VALUE)
    @ResponseBody
    public final ResponseEntity<String> save(@PathVariable final String db,
            final HttpServletResponse response) {
        logger.info("Starting save");
        // check here whether authorized.
        try {
            final Root root = fetchRoot(db);

            final String contents = new GedWriter(root).writeString();
            final String filename = db + ".ged";
            logger.info("filename: " + filename);
            final HttpHeaders headers = new HttpHeaders();
            headers.setAccessControlExposeHeaders(
                    Collections.singletonList("Content-Disposition"));
            headers.set(
                    "Content-Disposition", "attachment; filename=" + filename);
            headers.setContentType(MediaType.TEXT_PLAIN);
            logger.info("Exiting save");
            return new ResponseEntity<>(contents, headers, HttpStatus.OK);
        } catch (DataSetNotFoundException e) {
            final HttpHeaders headers = new HttpHeaders();
            headers.setContentType(MediaType.TEXT_PLAIN);
            logger.info("Exiting save");
            return new ResponseEntity<>(
                    e.getMessage(), headers, HttpStatus.NOT_FOUND);
        }
    }
21455
private void setStrategy(final ClassRealm realm, final Strategy strategy) {
        assert realm != null;
        assert strategy != null;

        try {
            Field field = realm.getClass().getDeclaredField("strategy");

            try {
                field.set(realm, strategy);
            }
            catch (IllegalAccessException ignore) {
                // try again
                field.setAccessible(true);

                try {
                    field.set(realm, strategy);
                }
                catch (IllegalAccessException e) {
                    throw new IllegalAccessError(e.getMessage());
                }
            }
        }
        catch (NoSuchFieldException e) {
            throw new Error(e);
        }
    }
295289
public <S extends Model> ResultKey save(S model) {
        List<Object> columnValues = AnimaUtils.toColumnValues(model, true);
        String       sql          = this.buildInsertSQL(model, columnValues);
        Connection   conn         = getConn();
        try {

            List<Object> params = columnValues.stream()
                    .filter(Objects::nonNull)
                    .collect(toList());

            return new ResultKey(conn.createQuery(sql)
                    .withParams(params)
                    .executeUpdate()
                    .getKey());
        } finally {
            this.closeConn(conn);
            this.clean(conn);
        }
    }
895055
private void updateAttacking()
    {
        if (tick.elapsed(attackPause))
        {
            updateAttackHit();
        }
        else if (attacked)
        {
            if (AnimState.FINISHED == animator.getAnimState())
            {
                for (final AttackerListener listener : listeners)
                {
                    listener.notifyAttackAnimEnded();
                }
                attacked = false;
                state = AttackState.CHECK;
            }
        }
        else
        {
            for (final AttackerListener listener : listeners)
            {
                listener.notifyPreparingAttack();
            }
        }
    }
303488
@Override
    public void save(T object, AccessControlContext accessControlContext)
            throws OptimisticLockException, AccessControlException, JeppettoException {
        ensureAccessControlEnabled();

        try {
            AccessControlContextOverride.set(accessControlContext);

            getCurrentSession().saveOrUpdate(object);

            // flush() here because we want the AccessControlInterceptor to perform its onSave()/onFlushDirty()
            // checks while the override is in place.
            flush();
        } catch (org.hibernate.OptimisticLockException e) {
            throw new OptimisticLockException(e);
        } catch (HibernateException e) {
            throw new JeppettoException(e);
        } finally {
            AccessControlContextOverride.clear();
        }
    }
149228
public static void save() {
        H.Response resp = H.Response.current();

        H.Session session = H.Session.current();
        serialize(session);

        H.Flash flash = H.Flash.current();
        serialize(flash);
    }
103442
public void setAttackSummaries(java.util.Collection<AttackSummary> attackSummaries) {
        if (attackSummaries == null) {
            this.attackSummaries = null;
            return;
        }

        this.attackSummaries = new java.util.ArrayList<AttackSummary>(attackSummaries);
    }
1051673
@Override
  public final synchronized void saveSettingsAdd(
    final Map<String, Object> pAddParam,
      final SettingsAdd pEntity) throws Exception {
    if (pEntity.getIsNew()) {
      throw new ExceptionWithCode(ExceptionWithCode.FORBIDDEN,
        "insert_not_allowed::" + pAddParam.get("user"));
    } else if (pEntity.getItsId() != 1L) {
      throw new ExceptionWithCode(ExceptionWithCode.FORBIDDEN,
        "id_not_allowed::" + pAddParam.get("user"));
    } else {
      getSrvOrm().updateEntity(pAddParam, pEntity);
      this.settingsAdd = null;
      lazyGetSettingsAdd(pAddParam);
    }
  }
947297
def save_db(self):
        
        with self.db_mutex:
            if not isinstance(self.db, dict) and not isinstance(self.db, list):
                return False
            try:
                with open(self.json_db_path, "w") as fp:
                    json.dump(self.db, fp, indent=4)
            except Exception as e:
                # disk full or something.
                _logger.debug("*** Write JSON DB to file error.")
                raise e

            else:
                self.sync()
                return True
729245
def save(self, force=False):
        
        from time import time

        # Since the DBs can get rather large, we don't want to save them every
        # single time a method is called. Instead, we only save them at the
        # frequency specified in the global settings file.
        from datetime import datetime
        savefreq = TaskDB.get_option("savefreq", 2, int)
        
        if self.lastsave is not None:
            delta = (datetime.fromtimestamp(time()) -
                     datetime.fromtimestamp(self.lastsave)) 
            elapsed = int(delta.total_seconds()/60)
        else:
            elapsed = savefreq + 1

        if elapsed > savefreq or force:
            if not writeable:
                #We still overwrite the lastsave value so that this message doesn't
                #keep getting output for every :meth:`record` call.
                self.lastsave = time()
                msg.std("Skipping database write to disk by setting.", 2)
                return

            import json
            try:
                entities, compkeys = _json_clean(self.entities)
                jdb = {"entities": entities,
                       "compkeys": compkeys,
                       "uuids": self.uuids}
                with open(self.dbpath, 'w') as f:
                    json.dump(jdb, f)
            except: # pragma: no cover
                from acorn.msg import err
                import sys
                raise
                err("{}: {}".format(*sys.exc_info()[0:2]))

            self.lastsave = time()
1249473
@Override
  public V putIfAbsentFailure(K key, V value, StoreAccessException e) {
    cleanup(key, e);
    return null;
  }
113410
async def save(self, db):
        
        kwargs = {}
        for col in self._auto_columns:
            if not self.has_real_data(col.name):
                kwargs[col.name] = await col.auto_generate(db, self)
        self.__dict__.update(kwargs)

        # we have to delete the old index key
        stale_object = await self.__class__.load(db, identifier=self.identifier())
        d = {
            k: (v.strftime(DATETIME_FORMAT) if isinstance(v, datetime) else v)
            for k, v in self.__dict__.items()
        }
        success = await db.hmset_dict(self.redis_key(), d)
        await self.save_index(db, stale_object=stale_object)
        return success
28553
@SubscribeEvent
	public void onDataSave(ChunkDataEvent.Save event)
	{
		Set<BlockPos> coords = chunks(event.getChunk()).get(event.getChunk());
		if (!coords.isEmpty())
			writeLongArray(event.getData(), coords);
	}