This repository has been archived by the owner on Jun 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
dkan_migrate_base_group.inc
64 lines (58 loc) · 1.77 KB
/
dkan_migrate_base_group.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/**
* @file
* Migration Class for Groups
*/
/**
* Migrate CKAN group
*/
class MigrateCkanGroupBase extends MigrateCkanBase {
/**
* Here we go.
*/
public function __construct($arguments) {
parent::__construct($arguments);
$fields = $this->getCkanGroupFields();
$list_url = isset($arguments['list_url']) ? $arguments['list_url'] : 'group_list';
$list_url = $this->endpoint . $list_url;
$item_url = isset($arguments['item_url']) ? $arguments['item_url'] : 'group_show?id=:id';
$item_url = $this->endpoint . $item_url;
$this->page = isset($arguments['page']) ? $arguments['page'] : '';
$this->offset = isset($arguments['offset']) ? $arguments['offset'] : '';
$this->source = new MigrateSourceList(new CKANListJSON(
$list_url,
array('page' => $this->page,
'offset' => $this->offset,
)
),
new CKANItemJSON($item_url, $fields), $fields);
$this->map = new MigrateSQLMap(
$this->machineName,
array(
'uuid' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'description' => 'id',
),
),
MigrateDestinationNode::getKeySchema()
);
$this->destination = new MigrateDestinationNode('group');
$this->addFieldMapping('id', 'uuid');
$this->addFieldMapping('uuid', 'id');
$this->addFieldMapping('title', 'title');
$this->addFieldMapping('body', 'description');
$this->addFieldMapping('created', 'created');
}
/**
* Creates list of fields for CKAN Dataset.
*/
public function getCkanGroupFields() {
return array(
"title" => "Title",
"created" => "Created",
"description" => "Description",
);
}
}