ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\MetaData\Repository\LOMDatabaseRepository Class Reference
+ Inheritance diagram for ILIAS\MetaData\Repository\LOMDatabaseRepository:
+ Collaboration diagram for ILIAS\MetaData\Repository\LOMDatabaseRepository:

Public Member Functions

 __construct (RessourceIDFactoryInterface $ressource_factory, DatabaseManipulatorInterface $manipulator, DatabaseReaderInterface $reader, DatabaseSearcherInterface $searcher, ProcessorInterface $processor, IdentifierHandlerInterface $identifier_handler)
 
 getMD (int $obj_id, int $sub_id, string $type)
 
 getMDOnPath (PathInterface $path, int $obj_id, int $sub_id, string $type)
 Returns an MD set with only the elements specified on a path, and all nested subelements of the last elements on the path. More...
 
 searchMD (ClauseInterface $clause, ?int $limit, ?int $offset, FilterInterface ... $filters)
 
 manipulateMD (SetInterface $set)
 Follows a trail of markers from the root element, and creates, updates or deletes marked MD elements along the trail. More...
 
 transferMD (SetInterface $from_set, int $to_obj_id, int $to_sub_id, string $to_type, bool $throw_error_if_invalid)
 Transfers a metadata set to an object, regardless of its source. More...
 
 deleteAllMD (int $obj_id, int $sub_id, string $type)
 

Protected Attributes

RessourceIDFactoryInterface $ressource_factory
 
DatabaseManipulatorInterface $manipulator
 
DatabaseReaderInterface $reader
 
DatabaseSearcherInterface $searcher
 
ProcessorInterface $processor
 
IdentifierHandlerInterface $identifier_handler
 

Detailed Description

Definition at line 35 of file LOMDatabaseRepository.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\MetaData\Repository\LOMDatabaseRepository::__construct ( RessourceIDFactoryInterface  $ressource_factory,
DatabaseManipulatorInterface  $manipulator,
DatabaseReaderInterface  $reader,
DatabaseSearcherInterface  $searcher,
ProcessorInterface  $processor,
IdentifierHandlerInterface  $identifier_handler 
)

Definition at line 44 of file LOMDatabaseRepository.php.

References ILIAS\MetaData\Repository\LOMDatabaseRepository\$identifier_handler, ILIAS\MetaData\Repository\LOMDatabaseRepository\$manipulator, ILIAS\MetaData\Repository\LOMDatabaseRepository\$processor, ILIAS\MetaData\Repository\LOMDatabaseRepository\$reader, ILIAS\MetaData\Repository\LOMDatabaseRepository\$ressource_factory, and ILIAS\MetaData\Repository\LOMDatabaseRepository\$searcher.

51  {
52  $this->ressource_factory = $ressource_factory;
53  $this->manipulator = $manipulator;
54  $this->reader = $reader;
55  $this->searcher = $searcher;
56  $this->processor = $processor;
57  $this->identifier_handler = $identifier_handler;
58  }

Member Function Documentation

◆ deleteAllMD()

ILIAS\MetaData\Repository\LOMDatabaseRepository::deleteAllMD ( int  $obj_id,
int  $sub_id,
string  $type 
)

Implements ILIAS\MetaData\Repository\RepositoryInterface.

Definition at line 123 of file LOMDatabaseRepository.php.

127  : void {
128  $this->manipulator->deleteAllMD(
129  $this->ressource_factory->ressourceID($obj_id, $sub_id, $type)
130  );
131  }

◆ getMD()

ILIAS\MetaData\Repository\LOMDatabaseRepository::getMD ( int  $obj_id,
int  $sub_id,
string  $type 
)
  • obj_id: Object ID (NOT ref_id!) of the parent repository object (e.g for page objects the obj_id of the content object; for media objects this is set to 0, because their object id are not assigned to ref ids). NOTE: In the metadata tables, this corresponds to the field rbac_id.
  • sub_id: ID of the object carrying the metadata, which might be a subobject of an enclosing repository object (e.g for structure objects the obj_id of the structure object). Might be the same as the objID. NOTE: In the metadata tables, this corresponds to the field obj_id.
  • type: (Sub-)Type of the object (e.g st,pg,crs ...). NOTE: In the metadata tables, this corresponds to the field obj_type.

Implements ILIAS\MetaData\Repository\RepositoryInterface.

Definition at line 60 of file LOMDatabaseRepository.php.

64  : SetInterface {
65  return $this->processor->finishAndCleanData(
66  $this->reader->getMD(
67  $this->ressource_factory->ressourceID($obj_id, $sub_id, $type)
68  )
69  );
70  }

◆ getMDOnPath()

ILIAS\MetaData\Repository\LOMDatabaseRepository::getMDOnPath ( PathInterface  $path,
int  $obj_id,
int  $sub_id,
string  $type 
)

Returns an MD set with only the elements specified on a path, and all nested subelements of the last elements on the path.

The path must start from the root element. Note that path filters are ignored, and if the path contains steps to super elements, it is only followed down to the first element that the path returns to. Note that resulting partial MD sets might not be completely valid, due to conditions between elements. Be careful when dealing with vocabularies, or Technical > Requirement > OrComposite.

Implements ILIAS\MetaData\Repository\RepositoryInterface.

Definition at line 72 of file LOMDatabaseRepository.php.

77  : SetInterface {
78  return $this->processor->finishAndCleanData(
79  $this->reader->getMDOnPath(
80  $path,
81  $this->ressource_factory->ressourceID($obj_id, $sub_id, $type)
82  )
83  );
84  }
$path
Definition: ltiservices.php:29

◆ manipulateMD()

ILIAS\MetaData\Repository\LOMDatabaseRepository::manipulateMD ( SetInterface  $set)

Follows a trail of markers from the root element, and creates, updates or deletes marked MD elements along the trail.

Non-scaffold elements with 'create or update' markers are updated, and scaffold elements with 'create or update' markers are created with the data value on the marker. Stops when encountering a neutral marker on a scaffold.

Implements ILIAS\MetaData\Repository\RepositoryInterface.

Definition at line 98 of file LOMDatabaseRepository.php.

98  : void
99  {
100  $this->processor->checkMarkers($set);
101  $this->manipulator->manipulateMD($set);
102  }

◆ searchMD()

ILIAS\MetaData\Repository\LOMDatabaseRepository::searchMD ( ClauseInterface  $clause,
?int  $limit,
?int  $offset,
FilterInterface ...  $filters 
)
Returns
RessourceIDInterface[]

Implements ILIAS\MetaData\Repository\RepositoryInterface.

Definition at line 89 of file LOMDatabaseRepository.php.

References ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\from().

94  : \Generator {
95  yield from $this->searcher->search($clause, $limit, $offset, ...$filters);
96  }
+ Here is the call graph for this function:

◆ transferMD()

ILIAS\MetaData\Repository\LOMDatabaseRepository::transferMD ( SetInterface  $from_set,
int  $to_obj_id,
int  $to_sub_id,
string  $to_type,
bool  $throw_error_if_invalid 
)

Transfers a metadata set to an object, regardless of its source.

Takes The data from 'create or update' markers takes priority over the data carried by marked elements, but 'delete' markers and unmarked or neutrally marked scaffolds are ignored. Always deletes whatever metadata already exist at the target.

If $throw_error_if_invalid is set true, an error is thrown if the markers on the $from_set are invalid, otherwise the invalid markers are replaced by neutral markers.

Implements ILIAS\MetaData\Repository\RepositoryInterface.

Definition at line 104 of file LOMDatabaseRepository.php.

110  : void {
111  $to_ressource_id = $this->ressource_factory->ressourceID($to_obj_id, $to_sub_id, $to_type);
112 
113  if ($throw_error_if_invalid) {
114  $this->processor->checkMarkers($from_set);
115  } else {
116  $this->processor->cleanMarkers($from_set);
117  }
118  $from_set = $this->identifier_handler->prepareUpdateOfIdentifier($from_set, $to_ressource_id);
119  $this->manipulator->deleteAllMD($to_ressource_id);
120  $this->manipulator->transferMD($from_set, $to_ressource_id);
121  }

Field Documentation

◆ $identifier_handler

IdentifierHandlerInterface ILIAS\MetaData\Repository\LOMDatabaseRepository::$identifier_handler
protected

◆ $manipulator

DatabaseManipulatorInterface ILIAS\MetaData\Repository\LOMDatabaseRepository::$manipulator
protected

◆ $processor

ProcessorInterface ILIAS\MetaData\Repository\LOMDatabaseRepository::$processor
protected

◆ $reader

DatabaseReaderInterface ILIAS\MetaData\Repository\LOMDatabaseRepository::$reader
protected

◆ $ressource_factory

RessourceIDFactoryInterface ILIAS\MetaData\Repository\LOMDatabaseRepository::$ressource_factory
protected

◆ $searcher

DatabaseSearcherInterface ILIAS\MetaData\Repository\LOMDatabaseRepository::$searcher
protected

The documentation for this class was generated from the following file: