Insert service data.
772394
protected function _process()
	{
		$this->_msg( 'Processing service demo data', 0 );

		$context =  $this->_getContext();
		$manager = MShop_Factory::createManager( $context, 'service' );

		$search = $manager->createSearch();
		$search->setConditions( $search->compare( '=~', 'service.code', 'demo-' ) );
		$services = $manager->searchItems( $search );


		foreach( $services as $item )
		{
			$this->_removeItems( $item->getId(), 'service/list', 'service', 'media' );
			$this->_removeItems( $item->getId(), 'service/list', 'service', 'price' );
			$this->_removeItems( $item->getId(), 'service/list', 'service', 'text' );
		}

		$manager->deleteItems( array_keys( $services ) );


		if( $context->getConfig()->get( 'setup/default/demo', false ) == true )
		{
			$ds = DIRECTORY_SEPARATOR;
			$path = __DIR__ . $ds . 'data' . $ds . 'demo-service.php';

			if( ( $data = include( $path ) ) == false ) {
				throw new MShop_Exception( sprintf( 'No file "%1$s" found for service domain', $path ) );
			}


			foreach( $data as $entry )
			{
				$item = $manager->createItem();
				$item->setTypeId( $this->_getTypeId( 'service/type', 'service', $entry['type'] ) );
				$item->setCode( $entry['code'] );
				$item->setLabel( $entry['label'] );
				$item->setProvider( $entry['provider'] );
				$item->setPosition( $entry['position'] );
				$item->setConfig( $entry['config'] );
				$item->setStatus( $entry['status'] );

				$manager->saveItem( $item );


				if( isset( $entry['media'] ) ) {
					$this->_addMedia( $item->getId(), $entry['media'], 'service' );
				}

				if( isset( $entry['price'] ) ) {
					$this->_addPrices( $item->getId(), $entry['price'], 'service' );
				}

				if( isset( $entry['text'] ) ) {
					$this->_addTexts( $item->getId(), $entry['text'], 'service' );
				}
			}

			$this->_status( 'added' );
		}
		else
		{
			$this->_status( 'removed' );
		}
	}
1245031
def save(self, *args, **kwargs):
        """"""
        data = kwargs.pop('data', {})
        sync = kwargs.pop('sync', True)
        if not self.id and sync:
            self.push_to_server(data)
        super(CustomerProfile, self).save(*args, **kwargs)
911258
def insert(self, context):
	
		
		
		status_code, msg = self.__endpoint.post(
			"/resources/connector-connection-pool",
			data={
				"id": self.__name,
				"resourceAdapterName": self.__res_adapter_name,
				"connectiondefinitionname": self.__conn_def_name,
				"property": props_value(self.__props)
			}
		)
		self.__available = True
359034
def _upsert(context, params, data):
    """"""
    table = params.get("table")
    table = datastore.get_table(table, primary_id=False)
    unique_keys = ensure_list(params.get("unique"))
    data["__last_seen"] = datetime.datetime.utcnow()
    if len(unique_keys):
        updated = table.update(data, unique_keys, return_count=True)
        if updated:
            return
    data["__first_seen"] = data["__last_seen"]
    table.insert(data)
249303
def install(self):
        """"""
        super(Upstart, self).install()

        self.deploy_service_file(self.svc_file_path, self.svc_file_dest)
288347
public void insertFromScript(PersistentStore store, Object[] data) {
        systemUpdateIdentityValue(data);
        insertData(store, data);
    }
57107
def insert(self, index, item):
        """"""
        super(ObservableList, self).insert(index, item)
        length = len(self)
        if index >= length:
            index = length - 1
        elif index < 0:
            index += length - 1
            if index < 0:
                index = 0
        self._notify_add_at(index)
1275185
def insert(self, key, value):
    """"""
    self._values.insert(key, self._type_checker.CheckValue(value))
    if not self._message_listener.dirty:
      self._message_listener.Modified()
1000561
protected function insertRoleServiceAccess()
    {
        $rolesInZip = $this->package->getResourceFromZip('system/role.json');
        $imported = false;

        if (!empty($rolesInZip)) {
            try {
                foreach ($rolesInZip as $riz) {
                    $rsa = $riz['role_service_access_by_role_id'];
                    $role = Role::whereName($riz['name'])->first();
                    if (!empty($role) && !empty($rsa)) {
                        $newRoleId = $role->id;
                        $cleanedRsa = [];
                        foreach ($rsa as $r) {
                            $originId = $r['id'];
                            $this->fixCommonFields($r);
                            $newServiceId = $this->getNewServiceId($r['service_id']);

                            if (empty($newServiceId) && !empty($r['service_id'])) {
                                $this->log(
                                    'warning',
                                    'Skipping relation role_service_access_by_role_id with id ' .
                                    $originId .
                                    ' for Role ' .
                                    $riz['name'] .
                                    '. Service not found for ' .
                                    $r['service_id']
                                );
                                continue;
                            }

                            $r['service_id'] = $newServiceId;
                            $r['role_id'] = $newRoleId;

                            if ($this->isDuplicateRoleServiceAccess($r)) {
                                $this->log(
                                    'notice',
                                    'Skipping duplicate role_service_access relation with id ' . $originId . '.'
                                );
                                continue;
                            }

                            $cleanedRsa[] = $r;
                        }

                        if (!empty($cleanedRsa)) {
                            $roleUpdate = ['role_service_access_by_role_id' => $cleanedRsa];
                            $result =
                                ServiceManager::handleRequest(
                                    'system', Verbs::PATCH, 'role/' . $newRoleId, [], [], $roleUpdate, null, true, true
                                );
                            if ($result->getStatusCode() >= 300) {
                                throw ResponseFactory::createExceptionFromResponse($result);
                            }
                            $imported = true;
                        }
                    } elseif (!empty($rsa) && empty($role)) {
                        $this->log(
                            'warning',
                            'Skipping all Role Service Access for ' . $riz['name'] . ' No imported role found.'
                        );
                        \Log::debug('Skipped Role Service Access.', $riz);
                    } else {
                        $this->log('notice', 'No Role Service Access for role ' . $riz['name']);
                    }
                }
            } catch (\Exception $e) {
//                if ($e->getCode() === HttpStatusCodes::HTTP_FORBIDDEN) {
//                    $this->log(
//                        'error',
//                        'Failed to insert role service access records for roles. ' .
//                        $this->getErrorDetails($e)
//                    );
//                }
//                throw new InternalServerErrorException(
//                    'Failed to insert role service access records for roles. ' .
//                    $this->getErrorDetails($e)
//                );
                $this->throwExceptions($e, 'Failed to insert role service access records for roles');
            }
        }

        return $imported;
    }
347006
def insert(self, data, return_object=False):
        

        obj = self(data)  # pylint: disable=E1102
        obj.save()

        if return_object:
            return obj
        else:
            return obj["_id"]
962147
def insertFromMimeData(self, data):
        
        undoObj = UndoPaste(self, data, self.pasteCnt)
        self.pasteCnt += 1
        self.qteUndoStack.push(undoObj)
935415
def insert(self):
    """"""
    if not self.curs:
      raise LIGOLwDBError, "Database connection not initalized"
    if len(self.table) == 0:
      raise LIGOLwDBError, 'attempt to insert empty table'
    for tab in self.table.keys():
      # find and add any missing unique ids
      generate = []
      missingcols = [k for k in self.ldb.uniqueids[tab] 
        if k not in self.table[tab]['column']]
      for m in missingcols:
        generate.append(',BLOB(GENERATE_UNIQUE())')
        self.table[tab]['orderedcol'].append(m)
      # and construct the sql query
      self.table[tab]['query'] = ' '.join( 
        ['INSERT INTO', tab, '(', ','.join(self.table[tab]['orderedcol']), 
        ') VALUES (', ','.join(['?' for x in self.table[tab]['column']]) , 
        ''.join(generate), ')'])
    for tabtup in self.ldb.tables:
      tab = tabtup[0].lower()
      try:
        try: 
          self.curs.executemany(self.table[tab]['query'],
            self.table[tab]['stream'])
          rowcount = self.curs.rowcount
        except DB2.Error, e:
          self.curs.execute('rollback')
          msg = e[2] 
          msg += self.xml() + '\n' 
          msg += str(self.table[tab]['query']) + '\n' 
          msg += str(self.table[tab]['stream']) + '\n'
          raise LIGOLwDBError, msg
        except DB2.Warning, e:
          self.curs.execute('rollback')
          raise LIGOLwDBError, e[2]
        #except Exception, e:
        #  self.curs.execute('rollback')
        #  raise LIGOLwDBError, e[2]
      except KeyError:
        pass
    self.curs.execute('commit')
    return rowcount
1078420
synchronized void insert_data(Any res, TimeVal when, TimeVal needed)
	{
		ring.insert_data(res,when);
		needed_time = needed;
	}
235839
void insert_data(Any any, TimeVal t)
	{
		if (size()>=max_elt)
			remove(0);
		add(new RingElt(any, t));
	}
1041736
public void put(final RegisteredService service) {
        val values = buildTableAttributeValuesMapFromService(service);
        val putItemRequest = new PutItemRequest(dynamoDbProperties.getTableName(), values);
        LOGGER.debug("Submitting put request [{}] for service id [{}]", putItemRequest, service.getServiceId());
        val putItemResult = amazonDynamoDBClient.putItem(putItemRequest);
        LOGGER.debug("Service added with result [{}]", putItemResult);
    }
933191
def insert_data(self, node, data, start, end):
        """"""
        for item in data:
            self.recursive_insert(node, [item[0], item[1]], item[-1], start, end)
809822
private <T extends OrchidService> void initializeService(Class<T> serviceClass, T service) {
        services.put(serviceClass, service);
    }