Register update.

@param _instance the _instance
@throws EFapsException the e faps exception
10119
public static void registerUpdate(final Instance _instance)
        throws EFapsException
    {
        // check if SystemConfiguration exists, necessary during install
        if (EFapsSystemConfiguration.get() != null
                        && EFapsSystemConfiguration.get().getAttributeValueAsBoolean(KernelSettings.INDEXACTIVATE)) {
            if (_instance != null && _instance.getType() != null
                            && IndexDefinition.get(_instance.getType().getUUID()) != null) {
                final AdvancedCache<String, String> cache = InfinispanCache.get()
                                .<String, String>getIgnReCache(CACHENAME);
                cache.put(RandomUtil.random(12), _instance.getOid());
            }
        }
    }
1039692
private void executeDeletes()
        throws EFapsException
    {
        final AbstractDelete delete = (AbstractDelete) runnable;
        for (final Instance instance : delete.getInstances()) {
            final Context context = Context.getThreadContext();
            final ConnectionResource con = context.getConnectionResource();
            // first remove the storeresource, because the information needed
            // from the general
            // instance to actually delete will be removed in the second step
            Resource storeRsrc = null;
            try {
                if (instance.getType().hasStore()) {
                    storeRsrc = context.getStoreResource(instance, Resource.StoreEvent.DELETE);
                    storeRsrc.delete();
                }
            } finally {
                if (storeRsrc != null && storeRsrc.isOpened()) {
                }
            }
            try {
                final List<DeleteDefintion> defs = new ArrayList<>();
                defs.addAll(GeneralInstance.getDeleteDefintion(instance, con));
                final SQLTable mainTable = instance.getType().getMainTable();
                for (final SQLTable curTable : instance.getType().getTables()) {
                    if (!curTable.equals(mainTable) && !curTable.isReadOnly()) {
                        defs.add(new DeleteDefintion(curTable.getSqlTable(), curTable.getSqlColId(), instance.getId()));
                    }
                }
                defs.add(new DeleteDefintion(mainTable.getSqlTable(), mainTable.getSqlColId(), instance.getId()));
                final SQLDelete sqlDelete = Context.getDbType().newDelete(defs.toArray(new DeleteDefintion[defs
                                .size()]));
                sqlDelete.execute(con);
                AccessCache.registerUpdate(instance);
                Queue.registerUpdate(instance);
            } catch (final SQLException e) {
                throw new EFapsException(getClass(), "executeWithoutAccessCheck.SQLException", e, instance);
            }
        }
    }
716144
public void openContext()
        throws EFapsException
    {
        if (isLogedIn()) {
            if (!Context.isTMActive()) {
                if (!this.sessionAttributes.containsKey(UserAttributesSet.CONTEXTMAPKEY)) {
                    Context.begin(null, Context.Inheritance.Local);
                    this.sessionAttributes.put(UserAttributesSet.CONTEXTMAPKEY, new UserAttributesSet(this.userName));
                    Context.rollback();
                }
                Context.begin(this.userName, null, this.sessionAttributes, null, null, Context.Inheritance.Local);
                this.timeStamp = new Date();
            }
        }
    }
246460
public void register(T instance) {
		if(!isContained(instance)) {
			registry.add(instance);
			if(current == null) {
				current = instance;
			}
		}
	}
569774
private void executeInserts() throws EFapsException
    {
        ConnectionResource con = null;
        try {
            final Insert insert = (Insert) runnable;
            con = Context.getThreadContext().getConnectionResource();
            long id = 0;
            for (final Entry<SQLTable, AbstractSQLInsertUpdate<?>> entry : updatemap.entrySet()) {
                if (id != 0) {
                    entry.getValue().column(entry.getKey().getSqlColId(), id);
                }
                if (entry.getKey().getSqlColType() != null) {
                    entry.getValue().column(entry.getKey().getSqlColType(), insert.getType().getId());
                }
                final Long created = ((SQLInsert) entry.getValue()).execute(con);
                if (created != null) {
                    id = created;
                    insert.evaluateInstance(created);
                }
            }
        } catch (final SQLException e) {
            throw new EFapsException(SQLRunner.class, "executeOneCompleteStmt", e);
        }
    }
1116977
public void updateStatistics(Instance instance) {
		super.updateStatistics(instance);
		this.perceptron.trainOnInstance(instance);
		if (this.predictionFunction != 1) { //Train target mean if prediction function is not Perceptron
			this.targetMean.trainOnInstance(instance);
		}
	}
613954
public static void update( CommandExecutionContext executionContext, Instance createdInstance ) {

		if( executionContext != null ) {
			createdInstance.data.put( executionContext.getNewVmMarkerKey(), executionContext.getNewVmMarkerValue());
			executionContext.getGlobalVmNumber().incrementAndGet();
			executionContext.getAppVmNumber().incrementAndGet();
		}
	}
402438
public function update_instance($instance, $data) {
        global $CFG;

        // NOTE: no cohort changes here!!!
        $context = context_course::instance($instance->courseid);
        if ($data->roleid != $instance->roleid) {
            // The sync script can only add roles, for perf reasons it does not modify them.
            $params = array(
                'contextid' => $context->id,
                'roleid' => $instance->roleid,
                'component' => 'enrol_cohort',
                'itemid' => $instance->id
            );
            role_unassign_all($params);
        }
        // Create a new group for the cohort if requested.
        if ($data->customint2 == COHORT_CREATE_GROUP) {
            require_capability('moodle/course:managegroups', $context);
            $groupid = enrol_cohort_create_new_group($instance->courseid, $data->customint1);
            $data->customint2 = $groupid;
        }

        $result = parent::update_instance($instance, $data);

        require_once("$CFG->dirroot/enrol/cohort/locallib.php");
        $trace = new null_progress_trace();
        enrol_cohort_sync($trace, $instance->courseid);
        $trace->finished();

        return $result;
    }
1120017
public void addObject(final Object[] _row)
        throws EFapsException
    {
        this.objects.add(this.elements.get(0).getObject(_row));
    }
1037882
public void execute(final IRunnable _runnable)
        throws EFapsException
    {
        try {
            final List<IEQLRunner> instances = new ArrayList<>();
            for (final Class<? extends IEQLRunner> clazz : EQLRUNNERS) {
                final IEQLRunner runner = clazz.newInstance();
                instances.add(runner);
                runner.prepare(_runnable);
            }
            for (final IEQLRunner runner : instances) {
                runner.execute();
            }
        } catch (InstantiationException | IllegalAccessException e) {
            LOG.error("Problems while instantiating", e);
        }
    }
550296
public void registerService(ProvidedServiceInstance serviceInstance) {
        getServiceDirectoryClient().registerServiceInstance(serviceInstance);
        getCacheServiceInstances().put(new ServiceInstanceToken(serviceInstance.getServiceName(), serviceInstance.getProviderId()), new InstanceHealthPair(null));
    }
104459
private void addCreateUpdateAttributes() throws EFapsException
    {
        final Iterator<?> iter = getType().getAttributes().entrySet().iterator();
        while (iter.hasNext()) {
            final Map.Entry<?, ?> entry = (Map.Entry<?, ?>) iter.next();
            final Attribute attr = (Attribute) entry.getValue();
            final AttributeType attrType = attr.getAttributeType();
            if (attrType.isCreateUpdate()) {
                addInternal(attr, false, (Object) null);
            }
            if (attr.getDefaultValue() != null) {
                addInternal(attr, false, attr.getDefaultValue());
            }
        }
    }
553779
public void registerInstanceListener(Object instanceListener) {
        for (Method method : instanceListener.getClass().getMethods()) {
            evaluateMethod(instanceListener, PostCreate.class, method, postCreateMethods);
            evaluateMethod(instanceListener, PreUpdate.class, method, preUpdateMethods);
            evaluateMethod(instanceListener, PostUpdate.class, method, postUpdateMethods);
            evaluateMethod(instanceListener, PreDelete.class, method, preDeleteMethods);
            evaluateMethod(instanceListener, PostDelete.class, method, postDeleteMethods);
            evaluateMethod(instanceListener, PostLoad.class, method, postLoadMethods);
        }
    }
865740
public static void index(final List<Instance> _instances)
        throws EFapsException
    {
        Indexer.index(new IndexContext().setAnalyzer(Index.getAnalyzer()).setDirectory(Index.getDirectory())
                        .setLanguage(Context.getThreadContext().getLanguage())
                        .setCompanyId(Context.getThreadContext().getCompany().getId()), _instances);
    }
855909
public synchronized void add(PmiModule instance) {
        if (instance == null)
            return;

        // no need to add instance to instanceList - to be removed.
        /*
         * if(!instanceList.contains(instance)) {
         * instanceList.add(instance);
         * }
         */

        // removing add(spddata[]) - customPmi
        //add(instance.listData());

        PmiModuleConfig instanceModCfg = null;
        boolean bSameSubMod = true;
        // Check if instance and aggregate are same type
        if (!instance.getModuleID().equals(getModuleID())) {
            bSameSubMod = false;
            addModuleID(instance.getModuleID());
            instanceModCfg = PerfModules.getConfig(instance.getModuleID());
            // can't aggregate data from different modules (different xml files)
            // customPMI limitation - fixed in VELA
            //return;
        } else {
            instanceModCfg = moduleConfig;
        }

        SpdData[] dataList = instance.listData();
        if (dataList == null || instanceModCfg == null)
            return;

        for (int i = 0; i < dataList.length; i++) {
            int dataId = dataList[i].getId();

            // Always creating aggregate data in ModuleAggregate            
            // fg: check if dataId is enabled in the parent before adding           
            //if (bSameSubMod && !isEnabled (dataId))
            //    continue;

            // if different sub module then create the sub-module aggregate data
            // in parent even if its not enabled.

            PmiDataInfo info = instanceModCfg.getDataInfo(dataId);
            if (info == null) {
                // wrong data id, ignore it. - This should not happen
                continue;
            } else if (!info.isAggregatable())
                continue;

            // Check if aggregateData is already available. If not create it.
            SpdGroup aggregateData = (SpdGroup) dataTable.get(new Integer(dataId));
            if (aggregateData == null) {
                aggregateData = (SpdGroup) createAggregateData(info);
                if (aggregateData != null)
                    putToTable((SpdData) aggregateData);

                //if (!bSameSubMod)
                //{
                // enable of parent level is
                if (currentLevel == LEVEL_FINEGRAIN) {
                    //if( !isEnabledInConfig (dataId) )             
                    if (!isEnabled(dataId))
                        ((SpdData) aggregateData).disable();
                } else if (info.getLevel() > currentLevel)
                    ((SpdData) aggregateData).disable();
                //}
                // FINE GRAINED
                /*
                 * if(info.getLevel() > currentLevel)
                 * ((SpdData)aggregateData).disable();
                 */
            }
            aggregateData.add(dataList[i]);
        }
    }
980780
public function replaceInstance(string $hint, object $instance): void
	{
		$hint = $this->resolveAlias($hint);

		if(!isset($this->instances[$hint]))
		{
			throw new ContainerException(vsprintf('Unable to replace [ %s ] as it hasn\'t been registered.', [$hint]));
		}

		$this->instances[$hint] = $instance;

		$this->replaceInstances($hint);
	}
1128267
function _updateSingleton() {
    if (!options.singletons) {
      return;
    }
    if (process.rebusinstances[folder]) {
      // Somebody added instance already.
      return;
    }
    // Save this instance to return the same for the same folder.
    process.rebusinstances[folder] = instance;
  }