Saves the object given into DynamoDB using the specified saveExpression.
@param object The object to save.
@param saveExpression The save expression.
@see com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper#save
434492
public void save(T object, DynamoDBSaveExpression saveExpression) {
        mapper.<T>save(object, saveExpression);
    }
961303
public void writeObject(Object object)
        throws IOException
    {
        if (object == null)
            writeNull();
        else if (object instanceof String)
            writeString((String) object);
        else if (object instanceof Boolean)
            writeBoolean(((Boolean) object).booleanValue());
        else if (object instanceof Integer)
            writeInt(((Integer) object).intValue());
        else if (object instanceof Long)
            writeLong(((Long) object).longValue());
        else if (object instanceof Date)
            writeUTCDate(((Date) object).getTime());
        else if (object instanceof byte[]) {
            byte[] data = (byte[]) object;
            writeBytes(data, 0, data.length);
        }
        else if (object instanceof Vector) {
            Vector vector = (Vector) object;

            int size = vector.size();
            writeListBegin(size, null);
            for (int i = 0; i < size; i++)
                writeObject(vector.elementAt(i));

            writeListEnd();
        }
        else if (object instanceof Hashtable) {
            Hashtable hashtable = (Hashtable) object;

            writeMapBegin(null);
            Enumeration e = hashtable.keys();
            while (e.hasMoreElements()) {
                Object key = e.nextElement();
                Object value = hashtable.get(key);

                writeObject(key);
                writeObject(value);
            }
            writeMapEnd();
        }
        else
            writeCustomObject(object);
    }

    /**
     * Applications which override this can do custom serialization.
     *
     * @param object the object to write.
     */
    public void writeCustomObject(Object object)
        throws IOException
    {
        throw new IOException("unexpected object: " + object);
    }

    /**
     * Writes the list header to the stream.  List writers will call
     * <code>writeListBegin</code> followed by the list contents and then
     * call <code>writeListEnd</code>.
     *
     * <code><pre>
     * &lt;list>
     *   &lt;type>java.util.ArrayList&lt;/type>
     *   &lt;length>3&lt;/length>
     *   &lt;int>1&lt;/int>
     *   &lt;int>2&lt;/int>
     *   &lt;int>3&lt;/int>
     * &lt;/list>
     * </pre></code>
     */
    public void writeListBegin(int length, String type)
        throws IOException
    {
        os.write('V');
        os.write('t');
        printLenString(type);

        os.write('l');
        os.write(length >> 24);
        os.write(length >> 16);
        os.write(length >> 8);
        os.write(length);
    }

    /**
     * Writes the tail of the list to the stream.
     */
    public void writeListEnd()
        throws IOException
    {
        os.write('z');
    }

    /**
     * Writes the map header to the stream.  Map writers will call
     * <code>writeMapBegin</code> followed by the map contents and then
     * call <code>writeMapEnd</code>.
     *
     * <code><pre>
     * Mt b16 b8 type (<key> <value>)z
     * </pre></code>
     */
    public void writeMapBegin(String type)
        throws IOException
    {
        os.write('M');
        os.write('t');
        printLenString(type);
    }

    /**
     * Writes the tail of the map to the stream.
     */
    public void writeMapEnd()
        throws IOException
    {
        os.write('z');
    }

    /**
     * Writes a remote object reference to the stream.  The type is the
     * type of the remote interface.
     *
     * <code><pre>
     * 'r' 't' b16 b8 type url
     * </pre></code>
     */
    public void writeRemote(String type, String url)
        throws IOException
    {
        os.write('r');
        os.write('t');
        printLenString(type);
        os.write('S');
        printLenString(url);
    }

    /**
     * Prints a string to the stream, encoded as UTF-8 with preceeding length
     *
     * @param v the string to print.
     */
    public void printLenString(String v)
        throws IOException
    {
        if (v == null) {
            os.write(0);
            os.write(0);
        }
        else {
            int len = v.length();
            os.write(len >> 8);
            os.write(len);

            printString(v, 0, len);
        }
    }

    /**
     * Prints a string to the stream, encoded as UTF-8
     *
     * @param v the string to print.
     */
    public void printString(String v)
        throws IOException
    {
        printString(v, 0, v.length());
    }

    /**
     * Prints a string to the stream, encoded as UTF-8
     *
     * @param v the string to print.
     */
    public void printString(String v, int offset, int length)
        throws IOException
    {
        for (int i = 0; i < length; i++) {
            char ch = v.charAt(i + offset);

            if (ch < 0x80)
                os.write(ch);
            else if (ch < 0x800) {
                os.write(0xc0 + ((ch >> 6) & 0x1f));
                os.write(0x80 + (ch & 0x3f));
            }
            else {
                os.write(0xe0 + ((ch >> 12) & 0xf));
                os.write(0x80 + ((ch >> 6) & 0x3f));
                os.write(0x80 + (ch & 0x3f));
            }
        }
    }
}
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);
        }
    }
339743
public Object storeObject(Object object)
    {
        PersistenceBroker broker = getBroker();
        try
        {
            broker.store(object);
        }
        finally
        {
            if (broker != null) broker.close();
        }
        return object;
    }
273075
function(expression) {
			var pastedExpression = new Expression();
			var key = this._getKey();

			pastedExpression.fromJson(json.parse(localStorage[key]));
			var newExpression;
			if (expression) {
				var expressionClone = new Expression({
					operator : 'and',
					expressionList : [expression, pastedExpression]
				}).toJson();
				//converting the same instance
				expression.fromJson(expressionClone);
				newExpression = expression;
			} else {
				newExpression = pastedExpression;
			}

			var parentBuilder = this.get('filterBuilder');

			parentBuilder.set('expression', newExpression, true /* preventChange Undo State
			 * */);
		}
478496
public JSONObject saveSynonym(String objectID, JSONObject content) throws AlgoliaException {
    return saveSynonym(objectID, content, false);
  }
1121145
public static <T extends Saveable> void save(@Nonnull T object) throws IOException {
        if (!BulkChange.contains(object)) {
            XmlFile file = getConfigFile(object.getClass());
            file.write(object);
            SaveableListener.fireOnChange(object, file);
        }
    }
1188899
protected void writeArbitraryObject(Object object) {
        log.debug("writeObject");
        // If we need to serialize class information...
        Class<?> objectClass = object.getClass();
        if (!objectClass.isAnnotationPresent(Anonymous.class)) {
            // Write out start object marker for class name
            buf.put(AMF.TYPE_CLASS_OBJECT);
            putString(buf, Serializer.getClassName(objectClass));
        } else {
            // Write out start object marker without class name
            buf.put(AMF.TYPE_OBJECT);
        }
        // Iterate thru fields of an object to build "name-value" map from it
        for (Field field : objectClass.getFields()) {
            String fieldName = field.getName();
            log.debug("Field: {} class: {}", field, objectClass);
            // Check if the Field corresponding to the getter/setter pair is transient
            if (!serializeField(objectClass, fieldName, field, null)) {
                continue;
            }
            Object value;
            try {
                // Get field value
                value = field.get(object);
            } catch (IllegalAccessException err) {
                // Swallow on private and protected properties access exception
                continue;
            }
            // Write out prop name
            putString(buf, fieldName);
            // Write out
            Serializer.serialize(this, field, null, object, value);
        }
        // write out end of object marker
        buf.put(AMF.END_OF_OBJECT_SEQUENCE);
    }
991224
public function save(entity $object = null)
    {

        $data = null;
        $primaryValue = array();
        if (null !== $object) {
            $primaryValue = array_filter(array_values($object->getPrimaryValue()), 'strlen');
        }

        if (null === $object || empty($primaryValue)) {
            $entity = $object;
            if (null === $object) {
                if ( null === $this->oosql_entity_obj) {
                    $msg = 'Nothing to save! ' . $this->sql();
                    throw new \Exception($msg, 9806, null);
                }
                // This is a brand new record let's insert;
                $entity = $this->getEntityObject();
            }

            $fields = (array)$entity;

            if ($identity = $entity->identity()) {
                unset($fields[$identity]);
            }
            $populated = array_filter($fields, 'strlen');

            $fieldnames = array_keys($populated);
            $fvalues = array_values($populated);

            call_user_func_array(array($this, 'insert'), $fieldnames);

            $lastID = call_user_func_array(array($this, 'values'), $fvalues)->exe();
            $entity->{$identity} = $lastID;

            return $entity;
        }

        if (isset(self::$oosql_result)) {
            // Updating after a select

            $primaryField = $object->getPrimary();

            $old = self::$oosql_result->objectWhere($primaryField[0], $object->{$primaryField[0]});

            // Is it really a modification of a selected row?
            if ($old) {

                $identity = $this->getEntityObject()->identity();
                foreach (array_diff_assoc((array)$object, (array)$old) as $key => $value) {
                    if ($key == $identity) {
                        continue;
                    }
                    $data[$key] = $value;
                }


                if (null === $data) {
                    $msg = 'Nothing to save! ' . $this->sql();
                    throw new \Exception($msg, 9807, null);
                }
                $this->update()->set($data)->createWhere($object->getPrimaryValue())->exe();

                return $object;

            }

        }
        // update a row just after inserting it
        // Or
        // update a related table (no select on it)
        $identity = $object->identity();

        foreach ((array)$object as $k => $v) {
            if ($v === null || $k == $identity) {
                continue;
            }
            $data[$k] = $v;
        }

        if (count($data) !== 0) {

            $this->update()->set($data)->createWhere($object->getPrimaryValue())->exe();

            return $object;
        }
        $msg = 'Nothing to save! ' . $this->sql();
        throw new \Exception($msg, 9808, null);
    }
639761
public Object saveState(FacesContext context) {
        if (context == null) {
            throw new NullPointerException();
        }
        Object values[] = new Object[1];
        values[0] = methodExpression;
        return (values);

    }
1348075
public synchronized void save(String key, String value) throws UpdateException {
        properties.put(key, value);
        cveDB.saveProperty(key, value);
    }
1075920
protected void handleUpdatedObject(final Object object) {
		runWithWriteLock(new Runnable() {
			public void run() {
				int index = getFinalEventList().indexOf(object);
				if (index >= 0) {
					getFinalEventList().set(index, object);
				}
			}
		});
	}
492841
void save( AbstractJcrNode node ) throws RepositoryException {
        // first check the node is valid from a cache perspective
        Set<NodeKey> keysToBeSaved = null;
        try {
            if (node.isNew()) {
                // expected by TCK
                throw new RepositoryException(JcrI18n.unableToSaveNodeThatWasCreatedSincePreviousSave.text(node.getPath(),
                                                                                                           workspaceName()));
            }

            AtomicReference<Set<NodeKey>> refToKeys = new AtomicReference<Set<NodeKey>>();
            if (node.containsChangesWithExternalDependencies(refToKeys)) {
                // expected by TCK
                I18n msg = JcrI18n.unableToSaveBranchBecauseChangesDependOnChangesToNodesOutsideOfBranch;
                throw new ConstraintViolationException(msg.text(node.path(), workspaceName()));
            }
            keysToBeSaved = refToKeys.get();
        } catch (ItemNotFoundException e) {
            throw new InvalidItemStateException(e);
        } catch (NodeNotFoundException e) {
            throw new InvalidItemStateException(e);
        }
        assert keysToBeSaved != null;

        SessionCache sessionCache = cache();
        if (sessionCache.getChangedNodeKeys().size() == keysToBeSaved.size()) {
            // The node is above all the other changes, so go ahead and save the whole session ...
            save();
            return;
        }

        // Perform the save, using 'JcrPreSave' operations ...
        SessionCache systemCache = createSystemCache(false);
        SystemContent systemContent = new SystemContent(systemCache);
        Map<NodeKey, NodeKey> baseVersionKeys = this.baseVersionKeys.get();
        Map<NodeKey, NodeKey> originalVersionKeys = this.originalVersionKeys.get();
        try {
            sessionCache.save(keysToBeSaved, systemContent.cache(), new JcrPreSave(systemContent, baseVersionKeys,
                                                                                   originalVersionKeys, aclChangesCount()));
        } catch (WrappedException e) {
            Throwable cause = e.getCause();
            throw (cause instanceof RepositoryException) ? (RepositoryException)cause : new RepositoryException(e.getCause());
        } catch (DocumentNotFoundException e) {
            throw new InvalidItemStateException(JcrI18n.nodeModifiedBySessionWasRemovedByAnotherSession.text(e.getKey()), e);
        } catch (DocumentAlreadyExistsException e) {
            // Try to figure out which node in this transient state was the problem ...
            NodeKey key = new NodeKey(e.getKey());
            AbstractJcrNode problemNode = node(key, null);
            String path = problemNode.getPath();
            throw new InvalidItemStateException(JcrI18n.nodeCreatedBySessionUsedExistingKey.text(path, key), e);
        } catch (org.modeshape.jcr.cache.ReferentialIntegrityException e) {
            throw new ReferentialIntegrityException(e);
        } catch (Throwable t) {
            throw new RepositoryException(t);
        }

        try {
            // Record the save operation ...
            repository().statistics().increment(ValueMetric.SESSION_SAVES);
        } catch (IllegalStateException e) {
            // The repository has been shutdown ...
        }
    }
1077996
public void write(Object object, Object value) {
        if(object instanceof Map)
            mapUpdate((Map)object, _identifier, value);
        else beanUpdate(object, _identifier, value);
    }
435465
@Override
    public void store(T key, INDArray object) {
        INDArray toStore;
        if (useInplaceCompression) {
            compressor.compressi(object);
            toStore = object;
        } else {
            toStore = compressor.compress(object);
        }

        if (emulateIsAbsent)
            lock.writeLock().lock();

        compressedEntries.put(key, toStore);

        if (emulateIsAbsent)
            lock.writeLock().unlock();
    }
689471
public final <T> T saveObject(final T obj) throws Exception {
        return executeInTransaction(new Runnable<T>() {
            @Override
            public T run(final EntityManager entityManager) {
                return persist(obj, entityManager);
            }
        });
    }
37515
public void delete(Object object, DynamoDBMapperConfig config) {
        config = mergeConfig(config);

        Class<?> clazz = object.getClass();

        String tableName = getTableName(clazz, config);

        Method hashKeyGetter = reflector.getHashKeyGetter(clazz);
        AttributeValue hashKeyElement = getHashKeyElement(safeInvoke(hashKeyGetter, object), hashKeyGetter);

        AttributeValue rangeKeyElement = null;
        Method rangeKeyGetter = reflector.getRangeKeyGetter(clazz);
        if ( rangeKeyGetter != null ) {
            rangeKeyElement = getRangeKeyElement(safeInvoke(rangeKeyGetter, object), rangeKeyGetter);
        }

        Key objectKey = new Key().withHashKeyElement(hashKeyElement).withRangeKeyElement(rangeKeyElement);

        /*
         * If there is a version field, make sure we assert its value. If the
         * version field is null (only should happen in unusual circumstances),
         * pretend it doesn't have a version field after all.
         */
        Map<String, ExpectedAttributeValue> expectedValues = new HashMap<String, ExpectedAttributeValue>();
        if ( config.getSaveBehavior() != SaveBehavior.CLOBBER ) {
            for ( Method method : reflector.getRelevantGetters(clazz) ) {

                if ( reflector.isVersionAttributeGetter(method) ) {
                    Object getterResult = safeInvoke(method, object);
                    String attributeName = reflector.getAttributeName(method);

                    ExpectedAttributeValue expected = new ExpectedAttributeValue();
                    AttributeValue currentValue = getSimpleAttributeValue(method, getterResult);
                    expected.setExists(currentValue != null);
                    if ( currentValue != null )
                        expected.setValue(currentValue);
                    expectedValues.put(attributeName, expected);
                    break;
                }
            }
        }

        db.deleteItem(applyUserAgent(new DeleteItemRequest().withKey(objectKey).withTableName(tableName).withExpected(expectedValues)));
    }