コード例 #1
0
 public function get_current_app_version($app_alias)
 {
     $exface = $this->get_workbench();
     $ds = DataSheetFactory::create_from_object_id_or_alias($exface, 'Axenox.PackageManager.PACKAGE_INSTALLED');
     $ds->get_filters()->add_conditions_from_string($ds->get_meta_object(), 'name', $this->get_package_name_from_app_alias($app_alias));
     $ds->get_columns()->add_from_expression('version');
     $ds->data_read();
     return $ds->get_cell_value('version', 0);
 }
コード例 #2
0
 /**
  * 
  * @param AppInterface $app
  * @param Object $object
  * @param string $app_filter_attribute_alias
  * @return DataSheetInterface
  */
 protected function get_object_data_sheet(AppInterface $app, Object $object, $app_filter_attribute_alias)
 {
     $ds = DataSheetFactory::create_from_object($object);
     foreach ($object->get_attribute_group('~ALL')->get_attributes() as $attr) {
         $ds->get_columns()->add_from_expression($attr->get_alias());
     }
     $ds->add_filter_from_string($app_filter_attribute_alias, $app->get_uid());
     $ds->get_sorters()->add_from_string('CREATED_ON', 'ASC');
     $ds->get_sorters()->add_from_string($object->get_uid_alias(), 'ASC');
     $ds->data_read();
     return $ds;
 }
コード例 #3
0
ファイル: InstallApp.php プロジェクト: axenox/PackageManager
 public function install_model(NameResolverInterface $app_name_resolver)
 {
     $result = '';
     $exface = $this->get_workbench();
     $model_source = $this->get_app_absolute_path($app_name_resolver) . DIRECTORY_SEPARATOR . PackageManagerApp::FOLDER_NAME_MODEL;
     if (is_dir($model_source)) {
         $transaction = $this->get_workbench()->data()->start_transaction();
         foreach (scandir($model_source) as $file) {
             if ($file == '.' || $file == '..') {
                 continue;
             }
             $data_sheet = DataSheetFactory::create_from_uxon($exface, UxonObject::from_json(file_get_contents($model_source . DIRECTORY_SEPARATOR . $file)));
             // Remove columns, that are not attributes. This is important to be able to import changes on the meta model itself.
             // The trouble is, that after new properties of objects or attributes are added, the export will already contain them
             // as columns, which would lead to an error because the model entities for these columns are not there yet.
             foreach ($data_sheet->get_columns() as $column) {
                 if (!$column->get_attribute()) {
                     $data_sheet->get_columns()->remove($column);
                 }
             }
             if ($mod_col = $data_sheet->get_columns()->get_by_expression('MODIFIED_ON')) {
                 $mod_col->set_ignore_fixed_values(true);
             }
             if ($user_col = $data_sheet->get_columns()->get_by_expression('MODIFIED_BY_USER')) {
                 $user_col->set_ignore_fixed_values(true);
             }
             // Disable timestamping behavior because it will prevent multiple installations of the same
             // model since the first install will set the update timestamp to something later than the
             // timestamp saved in the model files
             if ($behavior = $data_sheet->get_meta_object()->get_behaviors()->get_by_alias('exface.Core.Behaviors.TimeStampingBehavior')) {
                 $behavior->disable();
             }
             $counter = $data_sheet->data_replace_by_filters($transaction);
             if ($counter > 0) {
                 $result .= ($result ? "; " : "") . $data_sheet->get_meta_object()->get_name() . " - " . $counter;
             }
         }
         // Commit the transaction
         $transaction->commit();
         if (!$result) {
             $result = 'No changes found';
         }
     } else {
         $result = 'No model files to install';
     }
     return $result;
 }