Skip to content

Commit

Permalink
release(1.2.6): demo media e pof demo luoghi
Browse files Browse the repository at this point in the history
  • Loading branch information
arturu committed Jan 3, 2024
1 parent 9bdef5d commit e0596ab
Show file tree
Hide file tree
Showing 3 changed files with 392 additions and 2 deletions.
210 changes: 210 additions & 0 deletions config/install/migrate_plus.migration.demo_luogo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
id: demo_luogo
label: Tipo di contenuto Luogo
migration_group: scuola_demo
migration_tags:
- json
- scuola
- demo
- demo_node
- demo_luogo

source:
plugin: url
data_fetcher_plugin: http
data_parser_plugin: json

headers:
Accept: 'application/json; charset=utf-8'
Content-Type: 'application/json'

# The data_parser normally limits the fields passed on to the source plugin
# to fields configured to be used as part of the migration. To support more
# dynamic migrations, the JSON data parser supports including the original
# data for the current row. Simply include the 'include_raw_data' flag set
# to `true` to enable this. This option is disabled by default to minimize
# memory footprint for migrations that do not need this capability.
# include_raw_data: false

# Flags whether to track changes to incoming data. If TRUE, we will maintain
# hashed source rows to determine whether incoming data has changed.
# track_changes: false

urls:
- 'https://ouitoulia.github.io/krene/demo/luogo.json'

# An xpath-like selector corresponding to the items to be imported.
item_selector: data

fields:
- name: nid
label: 'ID del nodo'
selector: id
- name: type
label: 'Il tipo di contenuto'
selector: type
- name: title
label: 'Il titolo del contenuto'
selector: attributes/title

# Scheda biografia
- name: ritratto_url
label: 'URL foto della persona'
selector: relationships/ritratto/data/url
- name: ritratto
label: 'Foto della persona'
selector: relationships/ritratto
- name: nome
label: 'Nome'
selector: attributes/nome
- name: cognome
label: 'Cognome'
selector: attributes/cognome
- name: abstract
label: 'Descrizione breve'
selector: attributes/abstract

# Scheda Contatti
- name: telefono
label: 'Telefono'
selector: attributes/telefono
- name: email
label: 'Email'
selector: attributes/email

# Scheda Contratto
- name: ruolo_persona
label: 'Il ruolo della persona'
selector: relationships/ruolo_persona/data/id
- name: tipologia_posto
label: 'Posto comune o sostegno'
selector: relationships/tipologia_posto/data/id
- name: tipologia_incarico
label: 'Determinato/Indeterminato'
selector: relationships/tipologia_incarico/data/id
- name: tipologia_supplenza
label: 'La tipologia di supplenza'
selector: relationships/tipologia_supplenza/data/id
- name: data_fine_incarico
label: 'La data di fine incarico'
selector: relationships/data_fine_incarico/data/id
- name: materie
label: 'Le materie che insegna la persona'
selector: relationships/materie/data

# Scheda Anagrafica
- name: data_nascita
label: 'Data di nascita della persona'
selector: attributes/birthdate
- name: genere
label: 'Il genere della persona'
selector: attributes/genere
- name: codice_fiscale
label: 'Il codice fiscale della persona'
selector: attributes/codice_fiscale

# Footer
- name: language
label: 'La lingua del contenuto'
selector: attributes/language
- name: published
label: 'Se il contenuto è pubblicato o meno'
selector: attributes/published

ids:
nid:
type: integer

constants:
ritratto_path: 'public://demo/luogo/'

process:
nid: nid
uid:
plugin: default_value
default_value: 1
type: type
title: title

# Scheda biografia
_file_uid:
plugin: default_value
default_value: 1
field_ritratto/target_id:
plugin: file_import
source: ritratto_url
destination: constants/ritratto_path
uid: '@_file_uid'
file_exists: 'replace'
skip_on_missing_source: true
id_only: true
field_ritratto/alt: ritratto/data/description
field_nome: nome
field_cognome: cognome
field_abstract: abstract

# Scheda Contatti
field_telefono: telefono
field_email: email

# Scheda Contratto
field_ruolo_persona: ruolo_persona
field_tipologia_posto:
plugin: skip_on_empty
source: tipologia_posto
method: process
field_tipologia_incarico: tipologia_incarico
field_tipologia_supplenza:
plugin: skip_on_empty
source: tipologia_supplenza
method: process
field_data_fine:
plugin: skip_on_empty
source: data_fine_incarico
method: process
field_materie:
- plugin: skip_on_empty
source: materie
method: process
- plugin: sub_process
source: materie
process:
target_id: id

# Scheda Anagrafica
field_data_nascita:
plugin: skip_on_empty
source: data_nascita
method: process
field_genere:
plugin: skip_on_empty
source: genere
method: process
field_codice_fiscale: codice_fiscale

# Footer
langcode:
plugin: default_value
source: language
default_value: "und"
status:
plugin: default_value
source: published
default_value: 0

destination:
plugin: entity:node
default_bundle: persona
translations: true

migration_dependencies:
required:
- taxonomy_common
- taxonomy_materie_secondaria_primo_grado
- taxonomy_materie_secondaria_secondo_grado
- demo_media

dependencies:
enforced:
module:
- sunchronizo

176 changes: 176 additions & 0 deletions config/install/migrate_plus.migration.demo_media.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
id: demo_media
label: Media demo
migration_group: scuola_demo
migration_tags:
- json
- scuola
- demo
- demo_media

source:
plugin: url
data_fetcher_plugin: http
data_parser_plugin: json

headers:
Accept: 'application/json; charset=utf-8'
Content-Type: 'application/json'

# The data_parser normally limits the fields passed on to the source plugin
# to fields configured to be used as part of the migration. To support more
# dynamic migrations, the JSON data parser supports including the original
# data for the current row. Simply include the 'include_raw_data' flag set
# to `true` to enable this. This option is disabled by default to minimize
# memory footprint for migrations that do not need this capability.
# include_raw_data: false

# Flags whether to track changes to incoming data. If TRUE, we will maintain
# hashed source rows to determine whether incoming data has changed.
# track_changes: false

urls:
- 'https://ouitoulia.github.io/krene/demo/media.json'

# An xpath-like selector corresponding to the items to be imported.
item_selector: data

fields:
- name: mid
label: 'ID del media'
selector: id
- name: bundle
label: 'Il tipo di media'
selector: type
- name: name
label: 'Il nome del media'
selector: attributes/title

# File da importare
- name: image_url
label: "URL dell'immagine"
selector: relationships/image/data/url
- name: image
label: "I metadata dell'immagine"
selector: relationships/image
- name: document_url
label: "URL del documento"
selector: relationships/document/data/url
- name: document
label: "I metadata del documento"
selector: relationships/document
- name: audio_file_url
label: "URL del file audio"
selector: relationships/audio_file/data/url
- name: audio_file
label: "I metadata del file audio"
selector: relationships/audio_file

# Campi comuni
- name: icona
label: 'Eventuale icona del media'
selector: attributes/icon
- name: trascrizione
label: 'Eventuale trascrizione del video'
selector: attributes/transcription

# Footer
- name: language
label: 'La lingua del media'
selector: attributes/language
- name: published
label: 'Se il media è pubblicato o meno'
selector: attributes/published

ids:
mid:
type: integer

constants:
images_media_path: 'public://demo/images/'
documents_media_path: 'public://demo/documents/'
audios_media_path: 'public://demo/audios/'

process:
mid: mid
uid:
plugin: default_value
default_value: 1
bundle: bundle
name: name
_file_uid:
plugin: default_value
default_value: 1

# Bundle image
field_media_image/target_id:
plugin: file_import
source: image_url
destination: constants/images_media_path
uid: '@_file_uid'
file_exists: 'replace'
skip_on_missing_source: true
id_only: true
field_media_image/alt:
plugin: skip_on_empty
source: image/data/description
method: process

# Bundle document
field_media_document/target_id:
plugin: file_import
source: document_url
destination: constants/documents_media_path
uid: '@_file_uid'
file_exists: 'replace'
skip_on_missing_source: true
id_only: true
field_media_document/description:
plugin: skip_on_empty
source: document/data/description
method: process

# Bundle audio_file
field_audio_file/target_id:
plugin: file_import
source: audio_file_url
destination: constants/audios_media_path
uid: '@_file_uid'
file_exists: 'replace'
skip_on_missing_source: true
id_only: true
field_audio_file/description:
plugin: skip_on_empty
source: audio_file/data/description
method: process

# Campi comuni
field_icona:
plugin: skip_on_empty
source: icona
method: process
field_trascrizione:
plugin: skip_on_empty
source: trascrizione
method: process

# Footer
langcode:
plugin: default_value
source: language
default_value: "und"
status:
plugin: default_value
source: published
default_value: 0

destination:
plugin: entity:media
translations: true

migration_dependencies: { }

dependencies:
enforced:
module:
- sunchronizo

Loading

0 comments on commit e0596ab

Please sign in to comment.