/** * Hardify a class. * * @access public * @author Jerome Bogaerts, <*****@*****.**> * @return void */ public function actionHardify() { // Retrieve parameter values. $class = $this->options['class']; $topClass = $this->options['topClass']; $createForeigns = $this->options['createForeigns']; $recursive = $this->options['recursive']; $classUri = $class->getUri(); $additionalProperties = array(); $blackList = array('http://www.tao.lu/middleware/wfEngine.rdf#ClassProcessVariables'); if (!empty($this->options['additionalProperties'])) { $additionalProperties = $this->options['additionalProperties']; } $optionsHardify = array('recursive' => $recursive, 'append' => true, 'createForeigns' => $createForeigns, 'referencesAllTypes' => true, 'rmSources' => true, 'topClass' => $topClass, 'additionalProperties' => $additionalProperties); try { $this->outVerbose("Hardifying class '{$classUri}'..."); $switcher = new core_kernel_persistence_Switcher($blackList); $switcher->hardify($class, $optionsHardify); $hardenedClasses = $switcher->getHardenedClasses(); if (array_key_exists($classUri, $hardenedClasses)) { $count = $hardenedClasses[$classUri]; $this->outVerbose("Class '{$classUri}' successfully hardified: {$count} instance(s) compiled."); if (true == $optionsHardify['createForeigns']) { unset($hardenedClasses[$classUri]); if (true == empty($hardenedClasses)) { $this->outVerbose("No foreign classes were compiled."); } else { foreach ($hardenedClasses as $uri => $count) { $this->outVerbose("Foreign class '{$uri} successfully hardified: {$count} instance(s) compiled.'"); } } } } } catch (Exception $e) { $msg = "A fatal error occured while hardifying class '{$classUri}': " . $e->getMessage(); $this->error($msg, true); } }