Add sharded link values, if any, to the given DBObject.
484758
private void addShardedLinkValues(TableDefinition tableDef, DBObject dbObj) {
        for (FieldDefinition fieldDef : tableDef.getFieldDefinitions()) {
            if (fieldDef.isLinkField() && fieldDef.isSharded()) {
                TableDefinition extentTableDef = tableDef.getLinkExtentTableDef(fieldDef);
                Set<Integer> shardNums = getShards(extentTableDef).keySet();
                Set<String> values = getShardedLinkValues(dbObj.getObjectID(), fieldDef, shardNums);
                dbObj.addFieldValues(fieldDef.getName(), values);
            }
        }
    }
781738
def put(self, key, value):
    ''''''
    self.shardDatastore(key).put(key, value)
307051
def add(self,attrlist,attrvalues):
        '''
        
        '''
        for i,d in enumerate(attrlist):
            self[d] = attrvalues[i]
809711
private void addToWrapper(EntityMetadata entityMetadata, AttributeWrapper wrapper, Object embeddedObject,
            Attribute attrib, Attribute embeddedAttrib)
    {
        if (embeddedObject == null)
        {
            return;
        }
        
        byte[] value = PropertyAccessorHelper.get(embeddedObject, (Field) attrib.getJavaMember());
        byte[] name;
        if (value != null)
        {
            if (embeddedAttrib == null)
            {
                name = getEncodedBytes(((AbstractAttribute) attrib).getJPAColumnName());
            }
            else
            {
                name = getEncodedBytes(getHashKey(embeddedAttrib.getName(),
                        ((AbstractAttribute) attrib).getJPAColumnName()));
            }
            // add column name as key and value as value
            wrapper.addColumn(name, value);
            // // {tablename:columnname,hashcode} for value

            // selective indexing.
            if (entityMetadata.getIndexProperties().containsKey(((AbstractAttribute) attrib).getJPAColumnName()))
            {
                String valueAsStr = PropertyAccessorHelper.getString(embeddedObject, (Field) attrib.getJavaMember());
                wrapper.addIndex(
                        getHashKey(entityMetadata.getTableName(), ((AbstractAttribute) attrib).getJPAColumnName()),
                        getDouble(valueAsStr));

                wrapper.addIndex(
                        getHashKey(entityMetadata.getTableName(),
                                getHashKey(((AbstractAttribute) attrib).getJPAColumnName(), valueAsStr)),
                        getDouble(valueAsStr));
            }
        }
    }
403611
private boolean updateShardedObjectMove(DBObject dbObj) {
        DBObject currDBObj = SpiderService.instance().getObject(m_tableDef, dbObj.getObjectID());
        m_logger.debug("Update forcing move of object {} from shard {} to shard {}",
                       new Object[]{dbObj.getObjectID(),
                                    m_tableDef.getShardNumber(currDBObj),
                                    m_tableDef.getShardNumber(dbObj)});
        
        deleteObject(currDBObj);
        mergeAllFieldValues(dbObj, currDBObj);
        addBrandNewObject(currDBObj);
        return true;
    }
902563
def member_add(self, cluster_id, params):
        """"""
        cluster = self._storage[cluster_id]
        result = cluster.member_add(params.get('id', None), params.get('shardParams', {}))
        self._storage[cluster_id] = cluster
        return result
865829
def _link_for_value(self, value):
    ''''''
    try:
      key = Key(value)
      if key.name == self.sentinel:
        return key.parent
    except:
      pass
    return None
942475
def _add_to_index(index, obj):
    """"""
    id_set = index.value_map.setdefault(indexed_value(index, obj), set())
    if index.unique:
        if len(id_set) > 0:
            raise UniqueConstraintError()
    id_set.add(obj.id)
762361
private void cacheShardValue(TableDefinition tableDef,
                                 Integer         shardNumber,
                                 Date            shardStart) {
        // Get or create the app name -> table map
        String appName = tableDef.getAppDef().getAppName();
        Map<String, Map<Integer, Date>> tableShardNumberMap = m_appShardMap.get(appName);
        if (tableShardNumberMap == null) {
            tableShardNumberMap = new HashMap<String, Map<Integer,Date>>();
            m_appShardMap.put(appName, tableShardNumberMap);
        }
        
        // Get or create the table name -> shard number map
        String tableName = tableDef.getTableName();
        Map<Integer, Date> shardNumberMap = tableShardNumberMap.get(tableName);
        if (shardNumberMap == null) {
            shardNumberMap = new HashMap<Integer, Date>();
            tableShardNumberMap.put(tableName, shardNumberMap);
        }
        
        // Add the shard number -> start date
        shardNumberMap.put(shardNumber, shardStart);
        m_logger.debug("Sharding date for {}.{} shard #{} set to: {} ({})",
                       new Object[]{appName, tableName, shardNumber, shardStart.getTime(), Utils.formatDateUTC(shardStart)});
    }
990286
public void addLinkValue(String ownerObjID, FieldDefinition linkDef, String targetObjID) {
        addColumn(SpiderService.objectsStoreName(linkDef.getTableDef()),
                  ownerObjID,
                  SpiderService.linkColumnName(linkDef, targetObjID));
    }
39514
void  addValToSets(List<RBBINode> sets, int val) {
        for (RBBINode usetNode : sets) {
            addValToSet(usetNode, val);
        }
    }
531744
@Override
    public boolean addRef(Object object)
        throws IOException
    {
        if (_isUnshared) {
            _refCount++;
            return false;
        }

        int newRef = _refCount;

        int ref = addRef(object, newRef, false);

        if (ref != newRef) {
            writeRef(ref);

            return true;
        }
        else {
            _refCount++;

            return false;
        }
    }
6502
private void updateForeignKeys(EntityMetadata metadata, Object id, List<RelationHolder> relationHolders)
    {
        for (RelationHolder rh : relationHolders)
        {
            String linkName = rh.getRelationName();
            Object linkValue = rh.getRelationValue();
            if (linkName != null && linkValue != null)
            {

                // String fieldName = metadata.getFieldName(linkName);

                String clause = getFromClause(metadata.getSchema(), metadata.getTableName());
                // String updateSql = "Update " +
                // metadata.getEntityClazz().getSimpleName() + " SET " +
                // fieldName + "= '" + linkValue + "' WHERE "
                // + ((AbstractAttribute) metadata.getIdAttribute()).getName() +
                // " = '" + id + "'";

                String updateSql = "Update " + clause + " SET " + linkName + "= '" + linkValue + "' WHERE "
                        + ((AbstractAttribute) metadata.getIdAttribute()).getJPAColumnName() + " = '" + id + "'";

                onNativeUpdate(updateSql, null);
            }
        }
    }
1314781
private ObjectResult updateObject(DBObject                          dbObj,
                                      Map<String, String>               currScalarMap,
                                      Map<String, Map<String, Integer>> targObjShardNos) {
        ObjectResult objResult = null;
        if (Utils.isEmpty(dbObj.getObjectID())) {
            objResult = ObjectResult.newErrorResult("Object ID is required", null);
        } else if (currScalarMap == null) {
            objResult = ObjectResult.newErrorResult("No object found", dbObj.getObjectID());
        } else {
            ObjectUpdater objUpdater = new ObjectUpdater(m_tableDef);
            if (targObjShardNos.size() > 0) {
                objUpdater.setTargetObjectShardNumbers(targObjShardNos);
            }
            objResult = objUpdater.updateObject(m_parentTran, dbObj, currScalarMap);
        }
        return objResult;
    }
178803
def add(self, key, value):
        '''
        
        '''
        if key in self.reserved_keys:
            raise Exception('You cannot add the key %s directly, use %s' % (key, self.reserved_keys[key]))
        if isinstance(value, Report):
            self._sub_reports[key] = value
            self._data_fields['sub_reports'].append(key)
        else:
            self._data_fields[key] = value
619491
private static Document objectForInsert(Tuple tuple, Document dbObject) {
		MongoDBTupleSnapshot snapshot = (MongoDBTupleSnapshot) tuple.getSnapshot();
		for ( TupleOperation operation : tuple.getOperations() ) {
			String column = operation.getColumn();
			if ( notInIdField( snapshot, column ) ) {
				switch ( operation.getType() ) {
					case PUT:
						MongoHelpers.setValue( dbObject, column, operation.getValue() );
						break;
					case PUT_NULL:
					case REMOVE:
						MongoHelpers.resetValue( dbObject, column );
						break;
					}
			}
		}
		return dbObject;
	}
600849
private Set<String> getShardedLinkValues(String objID, FieldDefinition linkDef, Set<Integer> shardNums) {
        Set<String> values = new HashSet<String>();
        if (shardNums.size() == 0) {
            return values;
        }
        
        // Construct row keys for the link's possible Terms records.
        Set<String> termRowKeys = new HashSet<String>();
        for (Integer shardNumber : shardNums) {
            termRowKeys.add(shardedLinkTermRowKey(linkDef, objID, shardNumber));
        }
        TableDefinition tableDef = linkDef.getTableDef();
        String termStore = termsStoreName(tableDef);
        Tenant tenant = Tenant.getTenant(tableDef);
        for(DRow row: DBService.instance(tenant).getRows(termStore, termRowKeys)) {
            for(DColumn column: row.getAllColumns(1024)) {
                values.add(column.getName());
            }
        }
        return values;
    }