Saves the model state in the session

@param 	KControllerContextInterface $context The active controller context
@return 	void
776640
protected function _afterBrowse(KControllerContextInterface $context)
    {
        $state  = $this->getModel()->getState();

        $vars = array();
        foreach($state->toArray() as $var)
        {
            if(!$var->unique && !$var->internal) {
                $vars[$var->name] = $var->value;
            }
        }

        $context->user->set($this->_getStateKey($context), $vars);
    }
383700
public function initialize(ContextInterface $context)
    {
        $context->setDatabase($this->databaseName);
        $context->setAjaxSteps($this->ajaxSteps);
        $context->setAjaxTimeout($this->ajaxTimeout);
        $context->setScreenshotPath($this->screenshotPath);
        $context->setRegionMap($this->regionMap);
        $context->setAdminUrl($this->adminUrl);
        $context->setLoginUrl($this->loginUrl);
    }
1274998
@Override
	public void bind(Object context) {
		if (m_validationEngine != null && context instanceof ValidationObject) {
	        m_validationSession = m_validationEngine.createSession();
	        m_validationSession.bind((ValidationObject) context);
		}
	}
1349055
protected function _beforeInsert(KDatabaseContext $context)
    {
        $method = 'get'.ucfirst($this->_column);
        if($context->data->$method() instanceof KObjectConfigInterface) {
            $context->data->setProperty($this->_column, $context->data->$method()->toString());
        }
    }
1094944
protected function _afterEdit(KControllerContextInterface $context)
    {
        $name   = $this->getMixer()->getIdentifier()->name;

        foreach ($context->result as $entity)
        {
            if ($entity->getStatus() !== KDatabase::STATUS_FAILED)
            {
                if ($name === $this->_category_entity)
                {
                    if (($entity->old_enabled !== $entity->enabled) || ($entity->old_access !== $entity->access))
                    {
                        $category_context = 'com_'.$this->_package.'.'.$this->_category_entity;

                        $this->_getDispatcher()->trigger('onFinderAfterSave', array($category_context, $entity, false));
                    }
                } else {
                    $this->_getDispatcher()->trigger('onFinderAfterSave', array($this->_event_context, $entity, false));
                }
            }
        }
    }
488174
public Object saveState(FacesContext context)
    {
        if (!initialStateMarked())
        {
            Object values[] = new Object[2];
            values[0] = _maximum;
            values[1] = _minimum;
            return values;
        }
        return null;
    }
1025894
public Object saveTransientState(FacesContext context)
    {
        TransientStateHelper helper = getTransientStateHelper(false);

        return (helper == null) ? null : helper.saveTransientState(context);
    }
778646
public function initializeContext(Context $context)
    {
        if (false === $context instanceof AliceContextInterface) {
            return;
        }

        /* @var AliceContextInterface $context */
        $fixturesBasePath = $this->fixturesBasePath;
        switch (true) {

            case $context instanceof AliceODMContext:
                $fixturesBasePath .= '/ODM';
                break;

            case $context instanceof AliceORMContext:
                $fixturesBasePath .= '/ORM';
                break;

            case $context instanceof AlicePHPCRContext:
                $fixturesBasePath .= '/PHPCR';
                break;
        }

        if (null === $context->getBasePath()) {
            $context->setBasePath($fixturesBasePath);
        }
    }
383572
@Override
    public void save() {
        List<Object> contextSpecificObjects = new ArrayList<Object>();

        techTreeState = getTechTree().getTechSet();

        if (!this.getBoolValue(FIELD_ADVANCED)) {
            contextSpecificObjects.add(scanPolicy);
        } else {
            contextSpecificObjects.add(policyPanel.getScanPolicy());
        	
        	if (target == null && this.customPanels != null) {
        		// One of the custom scan panels must have specified a target 
            	for (CustomScanPanel customPanel : this.customPanels) {
                    target = customPanel.getTarget();
                    if (target != null) {
                    	break;
                    }
            	}
        	}

            // Save all Variant configurations
            getVariantPanel().saveParam(scannerParam);
            
            // If all other vectors has been disabled
            // force all injectable params and rpc model to NULL
            if (getDisableNonCustomVectors().isSelected()) {
                scannerParam.setTargetParamsInjectable(0);
                scannerParam.setTargetParamsEnabledRPC(0);                
            }
            
            if (!getBoolValue(FIELD_RECURSE) && injectionPointModel.getSize() > 0) {
                int[][] injPoints = new int[injectionPointModel.getSize()][];
                for (int i = 0; i < injectionPointModel.getSize(); i++) {
                    Highlight hl = injectionPointModel.elementAt(i);
                    injPoints[i] = new int[2];
                    injPoints[i][0] = hl.getStartOffset();
                    injPoints[i][1] = hl.getEndOffset();
                }

                try {
                    if (target != null && target.getStartNode() != null) {
                        VariantUserDefined.setInjectionPoints(
                                this.target.getStartNode().getHistoryReference().getURI().toString(),
                                injPoints);

                        enableUserDefinedRPC();
                    }

                } catch (Exception e) {
                    logger.error(e.getMessage(), e);
                }
            }

            scannerParam.setHostPerScan(extension.getScannerParam().getHostPerScan());
            scannerParam.setThreadPerHost(extension.getScannerParam().getThreadPerHost());
            scannerParam.setHandleAntiCSRFTokens(extension.getScannerParam().getHandleAntiCSRFTokens());
            scannerParam.setMaxResultsToList(extension.getScannerParam().getMaxResultsToList());


            contextSpecificObjects.add(scannerParam);
            contextSpecificObjects.add(techTreeState);
            
            if (this.customPanels != null) {
            	for (CustomScanPanel customPanel : this.customPanels) {
                    Object[] objs = customPanel.getContextSpecificObjects();
                    if (objs != null) {
                    	for (Object obj : objs) {
                            contextSpecificObjects.add(obj);
                    	}
                    }
            	}
            }
        }

        target.setRecurse(this.getBoolValue(FIELD_RECURSE));

        if (target.getContext() == null && getSelectedContext() != null) {
            target.setContext(getSelectedContext());
        }

        this.extension.startScan(
                target,
                getSelectedUser(),
                contextSpecificObjects.toArray());
    }
1268852
protected function _actionSend(KDispatcherContextInterface $context)
    {
        //Send the response
        $context->response->send(false);

        //Terminate the response
        $this->terminate($context);
    }
1267401
protected function _actionEdit(ControllerContext $context)
    {
        $entities = $context->entity;

        if(count($entities))
        {
            foreach($entities as $entity) {
                $entity->setProperties($context->request->data->toArray());
            }

            //Only set the reset content status if the action explicitly succeeded
            if($entities->save() === true) {
                $context->response->setStatus(HttpResponse::RESET_CONTENT);
            }
        }
        else throw new ControllerExceptionResourceNotFound('Resource could not be found');

        return $entities;
    }
113939
protected function _afterRead(ControllerContext $context)
    {
        $controller = $this->getController();

        if($controller->isEditable() && $controller->canSave()) {
            $this->addCommand('save');
        }

        if($controller->isEditable() && $controller->canApply()) {
            $this->addCommand('apply');
        }

        if($controller->isEditable() && $controller->canCancel()) {
            $this->addCommand('cancel',  array('attribs' => array('data-novalidate' => 'novalidate')));
        }
    }
167701
protected function _beforeRender(ControllerContext $context)
    {
        $controller = $context->getSubject();

        if (!$controller->isDispatched()) {
            $controller->loadLanguage();
        }
    }
582172
protected function _actionPurge(KControllerContextInterface $context)
    {
        $model = $this->getModel();
        $state = $model->getState();
        $query = $this->getObject('lib:database.query.delete');

        $query->table(array($model->getTable()->getName()));

        if ($state->end_date && $state->end_date != '0000-00-00')
        {
            $end_date = $this->getObject('lib:date', array('date' => $state->end_date));
            $end      = $end_date->format('Y-m-d');

            $query->where('DATE(created_on) <= :end')->bind(array('end' => $end));
        }

        if (!$this->getModel()->getTable()->getAdapter()->execute($query)) {
            throw new KControllerExceptionActionFailed('Delete Action Failed');
        } else {
            $context->getResponse()->setStatus(KHttpResponse::NO_CONTENT);
        }
    }
486152
public void createUISharedContext(Context context) {
		if (session != null) {
			uiContexts.put(context.getIndex(), context.duplicate());
		}
	}
1229246
protected function _actionGet(KDispatcherContextInterface $context)
    {
        $controller = $this->getController();

        if($controller instanceof KControllerModellable)
        {
            $controller->getModel()->getState()->setProperty('limit', 'default', $this->getConfig()->limit->default);

            $limit = $this->getRequest()->query->get('limit', 'int');

            // Set to default if there is no limit. This is done for both unique and non-unique states
            // so that limit can be transparently used on unique state requests rendering lists.
            if(empty($limit)) {
                $limit = $this->getConfig()->limit->default;
            }

            if($this->getConfig()->limit->max && $limit > $this->getConfig()->limit->max) {
                $limit = $this->getConfig()->limit->max;
            }

            $this->getRequest()->query->limit = $limit;
            $controller->getModel()->getState()->limit = $limit;
        }

        return $controller->execute('render', $context);
    }
542044
public function store(WidgetContext $widgetContext)
    {
        $ajaxWidgetId = $this->nextFreeAjaxWidgetId++;
        $widgetContext->setAjaxWidgetIdentifier($ajaxWidgetId);
        $this->widgetContexts[$ajaxWidgetId] = $widgetContext;
    }