Replace the {@link org.apache.ojb.broker.Identity}
of a registered {@link ObjectEnvelope} object.

@param newOid
@param oldOid
@return Returns <em>true</em> if successful.
508993
boolean replaceRegisteredIdentity(Identity newOid, Identity oldOid)
    {
        /*
        TODO: Find a better solution
        */
        boolean result = false;
        Object oe = mhtObjectEnvelopes.remove(oldOid);
        if(oe != null)
        {
            mhtObjectEnvelopes.put(newOid, oe);
            int index = mvOrderOfIds.indexOf(oldOid);
            mvOrderOfIds.remove(index);
            mvOrderOfIds.add(index, newOid);
            result = true;
            if(log.isDebugEnabled()) log.debug("Replace identity: " + oldOid + " --replaced-by--> " + newOid);
        }
        else
        {
            log.warn("Can't replace unregistered object identity (" + oldOid + ") with new identity (" + newOid + ")");
        }
        return result;
    }
282247
public void renamedType(String oldName, Class<?> currentValue) {
        if (oldName == null) {
            throw new IllegalArgumentException("oldName must not be null");
        }
        if (currentValue == null) {
            throw new IllegalArgumentException("currentValue must not be null");
        }
        if (oldName.startsWith("java.") || oldName.startsWith("javax.") || oldName.startsWith("org.joda.")) {
            throw new IllegalArgumentException("oldName must not be a java.*, javax.* or org.joda.* type");
        }
        checkNotLocked();
        typeRenames.put(oldName, currentValue);
    }
1269722
public boolean isIdentity(AbstractPlanNode childNode) throws PlanningErrorException {
        assert(childNode != null);
        // Find the output schema.
        // If the child node has an inline projection node,
        // then the output schema is the inline projection
        // node's output schema.  Otherwise it's the output
        // schema of the childNode itself.
        NodeSchema childSchema = childNode.getTrueOutputSchema(false);
        assert(childSchema != null);
        NodeSchema outputSchema = getOutputSchema();
        if (outputSchema.size() != childSchema.size()) {
            return false;
        }
        for (int idx = 0; idx < outputSchema.size(); idx += 1) {
            SchemaColumn col = outputSchema.getColumn(idx);
            SchemaColumn childCol = childSchema.getColumn(idx);
            if (col.getValueType() != childCol.getValueType()) {
                return false;
            }
            if ( ! (col.getExpression() instanceof TupleValueExpression)) {
                return false;
            }
            if ( ! (childCol.getExpression() instanceof TupleValueExpression)) {
                return false;
            }
            TupleValueExpression tve = (TupleValueExpression)col.getExpression();
            if (tve.getColumnIndex() != idx) {
                return false;
            }
        }
        return true;
    }
873429
def _newIdentifier(self):
        
        id = self._allocateID()
        self._idsToObjects[id] = self._NO_OBJECT_MARKER
        self._lastValues[id] = None
        return id
501300
<T> DomainObjectMatch<T> createMatchInternal(Class<T> domainObjectType) {
		DomainObjectMatch<T> ret =APIAccess.createDomainObjectMatch(domainObjectType,
				this.queryExecutor.getDomainObjectMatches().size(),
				this.queryExecutor.getMappingInfo());
		this.queryExecutor.getDomainObjectMatches().add(ret);
		return ret;
	}
787110
public static <T extends HasId> ExpandableField<T> setExpandableFieldId(String newId,
      ExpandableField<T> currentObject) {
    if (currentObject == null
        || (currentObject.isExpanded() && !Objects.equals(currentObject.getId(), newId))) {
      return new ExpandableField<>(newId, null);
    }

    return new ExpandableField<>(newId, currentObject.getExpanded());
  }
1078266
public void addObjectId( Object object, ObjectIdSerializer<?> id ) {
        if ( null == mapObjectId ) {
            if ( useEqualityForObjectId ) {
                mapObjectId = new HashMap<Object, ObjectIdSerializer<?>>();
            } else {
                mapObjectId = new IdentityHashMap<Object, ObjectIdSerializer<?>>();
            }
        }
        mapObjectId.put( object, id );
    }
1125790
@Override
    public RealJsonEngine newAnotherEngine(OptionalThing<JsonMappingOption> mappingOption) {
        assertArgumentNotNull("mappingOption", mappingOption);
        final JsonEngineResource resource = new JsonEngineResource();
        mappingOption.ifPresent(op -> {
            resource.acceptMappingOption(op);
        });
        return newRuledEngine(resource);
    }
111060
public String getObjectId(Object obj)
    {
        Identity oid = null;
        PersistenceBroker broker = null;

        try
        {
            if (getCurrentDatabase() != null)
            {
                /**
                 * is there an open database we are calling getObjectId against? if yes, use it
                 */
                broker = PersistenceBrokerFactory.createPersistenceBroker(getCurrentDatabase().getPBKey());
            }
            else
            {
                log.warn("Can't find open database, try to use the default configuration");
                /**
                 * otherwise, use default.
                 */
                broker = PersistenceBrokerFactory.defaultPersistenceBroker();
            }

            oid = broker.serviceIdentity().buildIdentity(obj);
        }
        finally
        {
            if(broker != null)
            {
                broker.close();
            }
        }
        return new String(SerializationUtils.serialize(oid));
    }
1215943
public String rename(Object oldkey, Object newkey) {
		Jedis jedis = getJedis();
		try {
			return jedis.rename(keyToBytes(oldkey), keyToBytes(newkey));
		}
		finally {close(jedis);}
	}
163281
public ORID getIdentity(final Object iPojo) {
		final ODocument record = getRecordByUserObject(iPojo, false);
		if (record == null)
			throw new OObjectNotManagedException("The object " + iPojo + " is not managed by current database");

		return record.getIdentity();
	}
1192312
public ObjectEnvelope get(Identity oid, Object pKey, boolean isNew)
    {
        ObjectEnvelope result = getByIdentity(oid);
        if(result == null)
        {
            result = new ObjectEnvelope(this, oid, pKey, isNew);
            mhtObjectEnvelopes.put(oid, result);
            mvOrderOfIds.add(oid);
            if(log.isDebugEnabled())
                log.debug("register: " + result);
        }
        return result;
    }
435719
public boolean replace(String key, CacheEntry oldValue, CacheEntry newValue) {
		final String sourceMethod = "replace"; //$NON-NLS-1$
		boolean replaced = false;
		SignalUtil.lock(cloneLock.readLock(), sourceClass, sourceMethod);
		try {
			replaced = map.replace(keyPrefix + key, oldValue, newValue);
			if (replaced && oldValue != newValue) {
				oldValue.delete(cacheMgr);
			}
		} finally {
			cloneLock.readLock().unlock();
		}
		return replaced;
	}
51982
private boolean setPrototypeNoCheck(ObjectType prototype, Node propertyNode) {
    ObjectType oldPrototype = prototypeSlot == null ? null : (ObjectType) prototypeSlot.getType();
    boolean replacedPrototype = oldPrototype != null;

    this.prototypeSlot =
        new Property("prototype", prototype, true, propertyNode == null ? source : propertyNode);
    prototype.setOwnerFunction(this);

    if (oldPrototype != null) {
      // Disassociating the old prototype makes this easier to debug--
      // we don't have to worry about two prototypes running around.
      oldPrototype.setOwnerFunction(null);
    }

    if (isConstructor() || isInterface()) {
      FunctionType superClass = getSuperClassConstructor();
      if (superClass != null) {
        superClass.addSubType(this);
        wasAddedToExtendedConstructorSubtypes = true;
      }

      if (isInterface()) {
        for (ObjectType interfaceType : getExtendedInterfaces()) {
          if (interfaceType.getConstructor() != null) {
            interfaceType.getConstructor().addSubType(this);
          }
        }
      }
    }

    if (replacedPrototype) {
      clearCachedValues();
    }

    return true;
  }
1316963
public void replace(BaseCell oldOne, BaseCell newOne) {
        VirtualLayoutManager layoutManager = getLayoutManager();
        if (oldOne != null && newOne != null && mGroupBasicAdapter != null && layoutManager != null) {
            int replacePosition = mGroupBasicAdapter.getPositionByItem(oldOne);
            if (replacePosition >= 0) {
                int cardIdx = mGroupBasicAdapter.findCardIdxFor(replacePosition);
                Card card = mGroupBasicAdapter.getCardRange(cardIdx).second;
                card.replaceCell(oldOne, newOne);
                mGroupBasicAdapter.replaceComponent(Arrays.asList(oldOne), Arrays.asList(newOne));
            }
        }
    }
89544
def replace(self, identifier, new_instance):
        
        try:
            # Note that `self.update()` ultimately calls merge, which will not enforce
            # a strict replacement; absent fields will default to the current values.
            return self.update(identifier, new_instance)
        except ModelNotFoundError:
            return self.create(new_instance)
72077
public boolean replace(Object oldObj, Object newObj)
    {  
        if (nest != null)
        {
            return nest.replace(oldObj, newObj);
        }
        else
        {
            int sz = elements.size();
            for (int i = 0; i < sz; i++)
            {
                if (elements.get(i) == oldObj)
                {
                    elements.set(i,newObj);
                    return true;
                }     
            }
        }
        
        return false;
    }