Public Member Functions | Public Attributes | Protected Attributes

DataTransfer Class Reference

Inheritance diagram for DataTransfer:
BEAppModel AppModel

List of all members.

Public Member Functions

 import (&$data, $options=array())
 Import data (json string or array) to BEdita.
 export (array &$objects, $options=array())
 Export BEdita objects data to JSON, XML or other format.
 getResult ()
 Get last import/export operation result.
 validate (&$data, $options=array())
 Validation of data and related objects and semantics.

Public Attributes

 $useTable = false

Protected Attributes

 $objDefaults
 $objMinimalSet
 $relMinimalSet
 $import
 $export
 $streamModels
 $result
 $logLevels
 $saveModes
 $customPropertyDataTypes

Detailed Description

Definition at line 22 of file data_transfer.php.


Member Function Documentation

DataTransfer::export ( array &$  objects,
options = array() 
)

Export BEdita objects data to JSON, XML or other format.

Parameters:
array &$objects ids of root elements (publication|section) or ids of objects (document|event|...)
array $options export parameters
Returns:
mixed object json|array|xml|other (file?)
See also:
XmlJsonConverter::toXmlString()

$options = array( 'logDebug' => true, // can be true|false 'destMediaRoot' => '/media/dest/path', // default TMP/media-export 'returnType' => 'JSON' // default 'JSON' - can be 'ARRAY' )

Definition at line 373 of file data_transfer.php.

References BEAppModel::findObjects(), and BeLib::getObject().

DataTransfer::getResult (  ) 

Get last import/export operation result.

Returns:
array, with result info (errors, warnings, stats...)

Definition at line 708 of file data_transfer.php.

DataTransfer::import ( &$  data,
options = array() 
)
DataTransfer::validate ( &$  data,
options = array() 
)

Validation of data and related objects and semantics.

1 if data is a string 1.1 if data is a string: not empty 1.2a if data is a JSON string: valid (json_decode / json_last_error) 1.2b if data is an XML string: valid

2 config 2.1 custom properties 2.1.1 fields not empty: name, objectType, dataType 2.1.2 valid objectType 2.1.3 dataType can be 'number', 'date', 'text', 'options' 2.1.4 existence 2.1.5 conflict 2.1.6 objects.customProperty consistence (objects.customProperty.name and objects.customProperty.value not empty / objects.customProperty.name must be declared in config.customProperties) [...]

3 objects 3.1 not empty 3.2 necessary fields (defined in $this->objMinimalSet) 3.3 objectType existence 3.4 specific validation by objectType [TODO] 3.5 categories 3.6 tags [TODO]

4 trees 4.1 not empty 4.2 roots not empty 4.3 valid root ids => if more than one, all must be all of the same type (area or section) / if type is section => options[root_section_id] 4.4 valid parent ids => parents elements must be a subcollection of tree elements 4.5 id referenced in tree must be referenced in objects too

5 relations 5.1 necessary fields (defined in $this->relMinimalSet) relation structure 1: flat array / i.e. array(<relation item>="">, <relation item>="">, ...) relation structure 2: group by switch / i.e. array(<relation switch>=""> => array(<relation item>="">, <relation item>="">, ...), <relation switch>=""> => array(<relation item>="">, <relation item>="">, ...), ...) 5.2 id referenced in relations must be referenced in objects too 5.3 switch must be a valid relation name + valid relation objects (existence of objects and right connection) 5.4 objectType(s) must be valid for specified relation switch

6 media 6.1 source folder (sourceMediaRoot) 6.1.1 existence 6.1.2 permits [TODO] 6.2 destination folder 6.2.1 existence 6.2.2 space available 6.3 files 6.3.1 existence (base folder + objects[i].uri) [TODO] 6.3.2 extension allowed [TODO] 6.3.3 dimension allowed [TODO] 6.3.4 all files dimension < space available ... 7 [...] [TODO]

Parameters:
$data string|array
$options array
See also:
XmlJsonConverter::toArray()

Definition at line 772 of file data_transfer.php.

References BeLib::getObject().

Referenced by import().


Member Data Documentation

DataTransfer::$customPropertyDataTypes [protected]
Initial value:
 array(
        'number',
        'date',
        'text',
        'options'
    )

Definition at line 166 of file data_transfer.php.

DataTransfer::$import [protected]
Initial value:
 array(
        'source' => array(
            'string' => null, 
            'data' => array() 
        ),
        'objects' => array(
            'ids' => array(),
            'types' => array()
        ),
        'tree' => array(
            'ids' => array(),
            'parents' => array()
        ),
        'relations' => array(
            'ids' => array(),
            'switches' => array()
        ),
        'saveMap' => array(
            
        ),
        'saveMode' => 1, 
        'logLevel' => 2 
    )

Definition at line 49 of file data_transfer.php.

DataTransfer::$logLevels [protected]
Initial value:
 array(
        'ERROR' => 0,
        'WARN' => 1,
        'INFO' => 2,
        'DEBUG' => 3
    )

Definition at line 151 of file data_transfer.php.

DataTransfer::$objDefaults [protected]
Initial value:
 array(
        'status' => 'on',
        'user_created' => '1',
        'user_modified' => '1',
        'lang' => 'ita',
        'ip_created' => '127.0.0.1',
        'syndicate' => 'off',
    )

Definition at line 28 of file data_transfer.php.

DataTransfer::$objMinimalSet [protected]
Initial value:
 array(
        'id',
        'objectType'
    )

Definition at line 37 of file data_transfer.php.

DataTransfer::$relMinimalSet [protected]
Initial value:
 array(
        'idLeft',
        'idRight',
        'switch'
    )

Definition at line 42 of file data_transfer.php.

DataTransfer::$result [protected]
Initial value:
 array(
    )

Definition at line 145 of file data_transfer.php.

DataTransfer::$saveModes [protected]
Initial value:
 array(
        'MERGE' => 0, 
        'NEW' => 1, 
        'OVERRIDE' => 2, 
        'IGNORE' => 3, 
        'UPDATE' => 4 
    )

Definition at line 158 of file data_transfer.php.

DataTransfer::$streamModels [protected]
Initial value:
 array(
        'Image',
        'Video',
        'Application',
    )

Definition at line 139 of file data_transfer.php.


The documentation for this class was generated from the following file:
Generated on Fri Dec 11 2015 15:29:46 by Doxygen 1.7.1  BEditaBEdita 3.7 Corylus