NAME
WE::Util::Support - support functions for the WE::DB framework
SYNOPSIS
use WE::Util::Support;
DESCRIPTION
METHODS in the WE::DB::Obj package
- create_folder_tree(...)
-
Create a folder tree from file or string.
Options are:
- -string => $string
-
The string with the folder information.
- -file => $file
-
A file with the folder information. Either -string or -file have to exist.
- -rootid => $rootid
-
The root object id to put the top-most folder in. If missing, then the root obejct of the database will be used.
- -standardargs => { ... }
-
Add standard arguments for each created object. The standard arguments will be overwritten by the arguments in the folder information string/file.
The file or string should contain a list of attributes, prefixed with a "-" and their values. All keys and values should be separated by spaces. To mask spaces in attribute values, just use double quotes. The folder structure is controlled by indentation, that is, top-level folder are not indented, the second-level folders have one space indentation and so on.
For the Title attribute, there is an exception to handle language dependent strings: the first two letters should form the ISO 638 code for the language, followed by a colon, followed by the language dependent string. You can specify as many language strings as you like. If you do not need language dependent Title strings, then just use this attribute as the others.
Examples for Title:
-Title "language independent string" -Name a_name -Title "en:english" "de:german" "it:italian" -Name b_name
- change_order($p_id, \@child_ids)
-
For the parent collection
$p_id
the children will be sorted according to the array reference@child_ids
. Children of$p_id
which are not in@child_ids
will be put to the back. Throws an error if one of@child_ids
is not a child of$p_id
. - get_position_array($obj_id, [%args])
-
For a given object
$obj_id
, return an array with the positions of this object in its parent, and the positions of all predecessors.The following options are recognized for
%args
:- -base =>
$base
-
The positions are by default 0-based, but can be changed with the optional argument
$base
. - -filter =>
$sub
-
Specify an optional filter for the recursion process. The filter options should be a reference to a subroutine. This subroutine is called with two arguments: the object database reference and the id of an object to test. If the object should be included into the position counting, then 1 should be returned, otherwise 0.
- -indexdoc =>
$bool
-
If true, then the IndexDoc attribute is used for determining the document position.
Note that only the first parent is used, if there are objects with multiple parents.
- -base =>
- check_integrity
-
Return a
WE::DB::Obj::Fsck
object with lists of inconsistencies in theWE::DB::Obj
database. - repair_database($errors, %args)
-
Take a
WE::DB::Obj::Fsck
object with lists of inconsistencies and tries to repair theWE::DB::Obj
database.%args
may be:
METHODS in the WE::DB::Content package
- check_integrity($objdb)
-
Return a
WE::DB::Content::Fsck
object with lists of inconsistencies in theWE::DB::Content
database. The check is done against theWE::DB::Obj
database$objdb
. - repair_database($errors, %args)
-
Take a
WE::DB::Content::Fsck
object with lists of inconsistencies and tries to repair theWE::DB::Content
database.%args
may be:
AUTHOR
Slaven Rezic - slaven@rezic.de