Changes the ownership of objects
181078
def change_owner(ctx, owner, uuid):
    """"""

    objects = ctx.obj['objects']
    database = ctx.obj['db']

    if uuid is True:
        owner_filter = {'uuid': owner}
    else:
        owner_filter = {'name': owner}

    owner = database.objectmodels['user'].find_one(owner_filter)
    if owner is None:
        log('User unknown.', lvl=error)
        return

    for item in objects:
        item.owner = owner.uuid
        item.save()

    log('Done')
979604
def remove_property(self, prop):
        """"""
        self._properties.remove(prop)
        self._pairs.difference_update((o, prop) for o in self._objects)
341417
def remove(self, obj):
        
        activity = {
            "verb": "remove",
            "object": {
                "objectType": obj.object_type,
                "id": obj.id
            },
            "target": {
                "objectType": self.object_type,
                "id": self.id
            }
        }

        self._post_activity(activity)

        # Remove the cash so it's re-generated next time it's needed
        self._members = None
382392
function() { 
                obj.mesh[ propertyName ].set( propertyObject.x, propertyObject.y, propertyObject.z )
              }
546420
protected void setOwnerId(Integer id){
        if(getOwnerId() != null){
            logger.warn("Attempting to set owner id for an object where it as previously been set. Ignoring new id");
            return;
        }
        meta_put(OWNER_ID_KEY, id); // dont allow null
    }
386871
def override(self, obj):
        """"""
        for field in obj.__class__.export_fields:
            setattr(self, field, getattr(obj, field))
89905
function setProto (oldObj, newObj) {
  Object.keys(newObj).forEach(key => {
    if (!oldObj[key]) {
      oldObj[key] = JSON.parse(JSON.stringify(newObj[key]))
    }
  })
}
532603
def setPrivates(self, fieldDict) :
        """"""
        
        for priv in self.privates :
            if priv in fieldDict :
                setattr(self, priv, fieldDict[priv])
            else :
                setattr(self, priv, None)
        
        if self._id is not None :
            self.URL = "%s/%s" % (self.documentsURL, self._id)
969430
def change(self, event):
        """"""

        try:
            data, schema, user, client = self._get_args(event)
        except AttributeError:
            return

        try:
            uuid = data['uuid']
            change = data['change']
            field = change['field']
            new_data = change['value']
        except KeyError as e:
            self.log("Update request with missing arguments!", data, e,
                     lvl=critical)
            self._cancel_by_error(event, 'missing_args')
            return

        storage_object = None

        try:
            storage_object = objectmodels[schema].find_one({'uuid': uuid})
        except Exception as e:
            self.log('Change for unknown object requested:', schema, data, lvl=warn)

        if storage_object is None:
            self._cancel_by_error(event, 'not_found')
            return

        if not self._check_permissions(user, 'write', storage_object):
            self._cancel_by_permission(schema, data, event)
            return

        self.log("Changing object:", storage_object._fields, lvl=debug)
        storage_object._fields[field] = new_data

        self.log("Storing object:", storage_object._fields, lvl=debug)
        try:
            storage_object.validate()
        except ValidationError:
            self.log("Validation of changed object failed!",
                     storage_object, lvl=warn)
            self._cancel_by_error(event, 'invalid_object')
            return

        storage_object.save()

        self.log("Object stored.")

        result = {
            'component': 'hfos.events.objectmanager',
            'action': 'change',
            'data': {
                'schema': schema,
                'uuid': uuid
            }
        }

        self._respond(None, result, event)
865129
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (this.getOwner() == null)
            return;
        if (m_recordSub != null)    // If field is not in this file, remember to remove it
            m_recordSub.addListener(new FileRemoveBOnCloseHandler(this));
    }
665453
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (owner != null)
            if (m_converter != null) if (m_converter.getField() != null)
                if (((BaseField)m_converter.getField()).getRecord() != owner)
                    {   // Points to different file... make sure this is removed if the other file is closed
                        ((BaseField)m_converter.getField()).addListener(new FieldRemoveBOnCloseHandler(this));
                    }
    }
949936
public void removeLockedObjectOwner(String owner) {

        try {
            if (_owner != null) {
                int size = _owner.length;
                for (int i = 0; i < size; i++) {
                    // check every owner if it is the requested one
                    if (_owner[i].equals(owner)) {
                        // remove the owner
                        String[] newLockedObjectOwner = new String[size - 1];
                        for (int j = 0; j < (size - 1); j++) {
                            if (j < i) {
                                newLockedObjectOwner[j] = _owner[j];
                            } else {
                                newLockedObjectOwner[j] = _owner[j + 1];
                            }
                        }
                        _owner = newLockedObjectOwner;

                    }
                }
                if (_owner.length == 0) {
                    _owner = null;
                }
            }
        } catch (ArrayIndexOutOfBoundsException e) {
            System.out.println("LockedObject.removeLockedObjectOwner()");
            System.out.println(e.toString());
        }
    }
660746
function(obj1, obj2) {
        for (attr in obj2) {
          if (obj1.hasOwnProperty(attr) || obj2.hasOwnProperty(attr)) {
            obj1[attr] = obj2[attr];
          }
        }
      }
288814
def set_object(self, start, obj, object_size):
        

        self._store(start, obj, object_size, overwrite=True)
191424
void retain(Object owner, Field field) {
        retain();
        Map<String, Integer> fields = owners.get(owner);
        if (fields == null) {
            fields = new HashMap<>();
            owners.put(owner, fields);
        }

        Integer count = fields.get(field.toGenericString());
        if (count == null) {
            fields.put(field.toGenericString(), 1);
        } else {
            count++;
            fields.put(field.toGenericString(), count);
        }
    }
1164125
function copyOwnProperties(dst, src) {
  for (var prop in src) {
    if (src.hasOwnProperty(prop)) {
      dst[prop] = src[prop];
    }
  }
}
428863
function clearOwnProperties(obj) {
  _.forOwn(obj, function (value, key) {
    delete obj[key];
  });

  return obj;
}