@Override public OIndexTxAware<T> put(Object iKey, final OIdentifiable iValue) { checkForKeyType(iKey); final ORID rid = iValue.getIdentity(); if (!rid.isValid()) if (iValue instanceof ORecord) // EARLY SAVE IT ((ORecord) iValue).save(); else throw new IllegalArgumentException("Cannot store non persistent RID as index value for key '" + iKey + "'"); iKey = getCollatingValue(iKey); database.getMicroOrRegularTransaction().addIndexEntry(delegate, super.getName(), OPERATION.PUT, iKey, iValue); return this; }
public OIndexRemote<T> put(final Object iKey, final OIdentifiable iValue) { if (iValue instanceof ORecord && !iValue.getIdentity().isValid()) // SAVE IT BEFORE TO PUT ((ORecord) iValue).save(); if (iValue.getIdentity().isNew()) throw new OIndexException( "Cannot insert values in manual indexes against remote protocol during a transaction. Temporary RID cannot be managed at server side"); getDatabase().command(String.format(QUERY_PUT, name), iKey, iValue.getIdentity()).close(); return this; }
public OIndexMultiValues put(Object key, final OIdentifiable singleValue) { key = getCollatingValue(key); acquireSharedLock(); try { if (!singleValue.getIdentity().isValid()) { (singleValue.getRecord()).save(); } final ORID identity = singleValue.getIdentity(); if (apiVersion == 0) { doPutV0(key, identity); } else if (apiVersion == 1) { doPutV1(key, identity); } else { throw new IllegalStateException("Invalid API version, " + apiVersion); } return this; } finally { releaseSharedLock(); } }
e.value = saved; else ((ORecord) e.value).save();