if not context.getReference():
  return context.Base_redirect('view',keep_items={'portal_status_message': 'Reference is not defined'})

reference = context.getReference()

data_supply = context.portal_catalog.getResultValue(
  portal_type='Data Supply',
  reference=reference,
  validation_state='validated'
)

if data_supply:
  if batch:
    return data_supply
  return data_supply.Base_redirect('view',keep_items={'portal_status_message': 'Data Supply already created'})

data_supply = context.data_supply_module.newContent(
  portal_type='Data Supply',
  reference=reference,
  source='organisation_module/open_radio_station',
  source_section='organisation_module/open_radio_station',
  destination='organisation_module/rapid_space_data_center',
  destination_project=destination_project
)

data_supply.newContent(
  portal_type='Data Supply Line',
  title='Data Stream',
  reference='out_stream',
  quantity=1,
  int_index=2,
  use='big_data/ingestion/stream',
  resource="data_product_module/ors_enb_log_data"
).validate()

data_supply.newContent(
  portal_type='Data Supply Line',
  title='Ingest ORS eNB Log Data',
  reference='ingestion_operation',
  quantity=1,
  int_index=1,
  aggregate_value=context,
  resource='data_operation_module/ingest_ors_enb_log_data'
).validate()

data_supply.validate()

if batch:
  return data_supply
return data_supply.Base_redirect('view', keep_items={'portal_status_message': 'Data Supply is created'})
