def object_create(self, obj_type, obj_id, obj_dict, uuid_batch=None, fqname_batch=None):
    obj_class = self._get_resource_class(obj_type)
    if uuid_batch:
        bch = uuid_batch
    else:
        bch = self._cassandra_driver.get_cf_batch(datastore_api.OBJ_UUID_CF_NAME)
    obj_cols = {}
    obj_cols['fq_name'] = json.dumps(obj_dict['fq_name'])
    obj_cols['type'] = json.dumps(obj_type)
    if (obj_type not in self._obj_cache_exclude_types):
        obj_cols['META:latest_col_ts'] = JSON_NONE
    if ('parent_type' in obj_dict):
        parent_type = obj_dict['parent_type']
        if (parent_type not in obj_class.parent_types):
            msg = ('Invalid parent type: %s not in %s' % (parent_type, obj_class.parent_types))
            return (False, (400, msg))
        parent_object_type = self._get_resource_class(parent_type).object_type
        parent_fq_name = obj_dict['fq_name'][:(- 1)]
        obj_cols['parent_type'] = json.dumps(parent_type)
        parent_uuid = self.fq_name_to_uuid(parent_object_type, parent_fq_name)
        self._create_child(bch, parent_object_type, parent_uuid, obj_type, obj_id)
    for prop_field in obj_class.prop_fields:
        field = obj_dict.get(prop_field)
        if (field is None):
            continue
        if (prop_field == 'id_perms'):
            field['created'] = datetime.datetime.utcnow().isoformat()
            field['last_modified'] = field['created']
        if (prop_field in obj_class.prop_list_fields):
            if obj_class.prop_list_field_has_wrappers[prop_field]:
                wrapper_field_keys = list(field.keys())
                if wrapper_field_keys:
                    wrapper_field = wrapper_field_keys[0]
                    list_coll = field[wrapper_field]
                else:
                    list_coll = []
            else:
                list_coll = field
            for i in range(len(list_coll)):
                self._add_to_prop_list(bch, obj_id, prop_field, list_coll[i], str(i))
        elif (prop_field in obj_class.prop_map_fields):
            if obj_class.prop_map_field_has_wrappers[prop_field]:
                wrapper_field_keys = list(field.keys())
                if wrapper_field_keys:
                    wrapper_field = wrapper_field_keys[0]
                    map_coll = field[wrapper_field]
                else:
                    map_coll = []
            else:
                map_coll = field
            map_key_name = obj_class.prop_map_field_key_names[prop_field]
            for map_elem in map_coll:
                map_key = map_elem[map_key_name]
                self._set_in_prop_map(bch, obj_id, prop_field, map_elem, map_key)
        else:
            self._create_prop(bch, obj_id, prop_field, field)
    symmetric_ref_updates = []
    for ref_field in obj_class.ref_fields:
        ref_fld_types_list = list(obj_class.ref_field_types[ref_field])
        ref_res_type = ref_fld_types_list[0]
        ref_link_type = ref_fld_types_list[1]
        ref_obj_type = self._get_resource_class(ref_res_type).object_type
        refs = obj_dict.get(ref_field, [])
        for ref in refs:
            ref_uuid = self.fq_name_to_uuid(ref_obj_type, ref['to'])
            ref_attr = ref.get('attr')
            ref_data = {'attr': ref_attr, 'is_weakref': False}
            ret = self._create_ref(bch, obj_type, obj_id, ref_obj_type, ref_uuid, ref_data)
            symmetric_ref_updates.extend(ret)
    self._cassandra_driver.insert(obj_id, obj_cols, batch=bch)
    if (not uuid_batch):
        bch.send()
    fq_name_str = ':'.join(obj_dict['fq_name'])
    fq_name_cols = {((utils.encode_string(fq_name_str) + ':') + obj_id): JSON_NONE}
    if fqname_batch:
        fqname_batch.insert(obj_type, fq_name_cols)
    else:
        self._cassandra_driver.insert(cf_name=datastore_api.OBJ_FQ_NAME_CF_NAME, key=obj_type, columns=fq_name_cols)
    return (True, symmetric_ref_updates)
def object_create(self, obj_type, obj_id, obj_dict, uuid_batch=None, fqname_batch=None):
    obj_class = self._get_resource_class(obj_type)
    if uuid_batch:
        bch = uuid_batch
    else:
        bch = self._cassandra_driver.get_cf_batch(datastore_api.OBJ_UUID_CF_NAME)
    obj_cols = {}
    obj_cols['fq_name'] = json.dumps(obj_dict['fq_name'])
    obj_cols['type'] = json.dumps(obj_type)
    if (obj_type not in self._obj_cache_exclude_types):
        obj_cols['META:latest_col_ts'] = JSON_NONE
    if ('parent_type' in obj_dict):
        parent_type = obj_dict['parent_type']
        if (parent_type not in obj_class.parent_types):
            msg = ('Invalid parent type: %s not in %s' % (parent_type, obj_class.parent_types))
            return (False, (400, msg))
        parent_object_type = self._get_resource_class(parent_type).object_type
        parent_fq_name = obj_dict['fq_name'][:(- 1)]
        obj_cols['parent_type'] = json.dumps(parent_type)
        parent_uuid = self.fq_name_to_uuid(parent_object_type, parent_fq_name)
        self._create_child(bch, parent_object_type, parent_uuid, obj_type, obj_id)
    for prop_field in obj_class.prop_fields:
        field = obj_dict.get(prop_field)
        if (field is None):
            continue
        if (prop_field == 'id_perms'):
            field['created'] = datetime.datetime.utcnow().isoformat()
            field['last_modified'] = field['created']
        if (prop_field in obj_class.prop_list_fields):
            if obj_class.prop_list_field_has_wrappers[prop_field]:
                wrapper_field_keys = list(field.keys())
                if wrapper_field_keys:
                    wrapper_field = wrapper_field_keys[0]
                    list_coll = field[wrapper_field]
                else:
                    list_coll = []
            else:
                list_coll = field
            for i in range(len(list_coll)):
                self._add_to_prop_list(bch, obj_id, prop_field, list_coll[i], str(i))
        elif (prop_field in obj_class.prop_map_fields):
            if obj_class.prop_map_field_has_wrappers[prop_field]:
                wrapper_field_keys = list(field.keys())
                if wrapper_field_keys:
                    wrapper_field = wrapper_field_keys[0]
                    map_coll = field[wrapper_field]
                else:
                    map_coll = []
            else:
                map_coll = field
            map_key_name = obj_class.prop_map_field_key_names[prop_field]
            for map_elem in map_coll:
                map_key = map_elem[map_key_name]
                self._set_in_prop_map(bch, obj_id, prop_field, map_elem, map_key)
        else:
            self._create_prop(bch, obj_id, prop_field, field)
    symmetric_ref_updates = []
    for ref_field in obj_class.ref_fields:
        ref_fld_types_list = list(obj_class.ref_field_types[ref_field])
        ref_res_type = ref_fld_types_list[0]
        ref_link_type = ref_fld_types_list[1]
        ref_obj_type = self._get_resource_class(ref_res_type).object_type
        refs = obj_dict.get(ref_field, [])
        for ref in refs:
            ref_uuid = self.fq_name_to_uuid(ref_obj_type, ref['to'])
            ref_attr = ref.get('attr')
            ref_data = {'attr': ref_attr, 'is_weakref': False}
            ret = self._create_ref(bch, obj_type, obj_id, ref_obj_type, ref_uuid, ref_data)
            symmetric_ref_updates.extend(ret)
    self._cassandra_driver.insert(obj_id, obj_cols, batch=bch)
    if (not uuid_batch):
        bch.send()
    fq_name_str = ':'.join(obj_dict['fq_name'])
    fq_name_cols = {((utils.encode_string(fq_name_str) + ':') + obj_id): JSON_NONE}
    if fqname_batch:
        fqname_batch.insert(obj_type, fq_name_cols)
    else:
        self._cassandra_driver.insert(cf_name=datastore_api.OBJ_FQ_NAME_CF_NAME, key=obj_type, columns=fq_name_cols)
    return (True, symmetric_ref_updates)