def __add_delete_action(self,context):

        data = ecportal_logic.transform_to_data_dict(request.POST)
        tmp_list = data.get('delete', [])
        tmp_list.append({'name': 'new_delete_action'})
        data['delete'] = tmp_list

        ds_list = data.get('dataset', [])
        result_list = []
        for ds in ds_list:
            uri = ds.get('uri')
            dataset = DatasetDcatApOp(uri)
            try:
                dataset.create_dataset_schema_for_package_dict(ds, {}, context)
            except Exception as e:
                import traceback
                log.error(traceback.print_exc())
            split_id = dataset.get_owner_org().split('/')[-1]
            if not data.get('organization'):
                 org = get_action('organization_show')(context, {'id': split_id.lower(),
                                                    'include_datasets': 'false'})
                 data['organization'] = org
            ui_ds = ui_util.transform_dcat_schema_to_form_schema()
            result_list.append(ui_ds)

        data['dataset'] = result_list

        data['manifest'][0]['publisher_uri'] = 'http://publications.europa.eu/resource/authority/corporate-body/{0}'.format(
            data.get('organization', {}).get('name', '').upper())

        return data
    def __start_ingestion(self, context):
        data = ecportal_logic.transform_to_data_dict(request.POST)

        result_dict = get_action('ingest_package')(context, data)

        if result_dict:
            #success, redirect to result page
            redirect_targets = result_dict.get('updated', []) + result_dict.get('created', [])
            id_list = [ ('name',value.get('name')) for value in redirect_targets]
            #id_list.append([ value.get('name') for value in result_dict.get('created', [])])
            table = {'header': ['rdftool.ingestion.table.title', 'rdftool.ingestion.table.name', 'rdftool.ingestion.table.url', 'rdftool.ingestion.table.state']}
            rows = [{'rdftool.ingestion.table.title': value.get('title',''),
                     'rdftool.ingestion.table.name': value.get('name', ''),
                     'rdftool.ingestion.table.url': value.get('url', ''),
                     'rdftool.ingestion.table.state': value.get('private', ''),} for value in result_dict.get('updated', [])]
            table['data'] = copy.deepcopy(rows)
            c.datasets = {'updates': table.copy()}

            rows = [{'rdftool.ingestion.table.title': value.get('title', ''),
                     'rdftool.ingestion.table.name': value.get('name', ''),
                     'rdftool.ingestion.table.url': value.get('url', ''),
                     'rdftool.ingestion.table.state': value.get('private', ''), } for value in result_dict.get('created', [])]
            table['data'] = copy.deepcopy(rows)
            c.datasets['created'] = table.copy()

            table = {'header': ['rdftool.ingestion.table.title', 'rdftool.ingestion.table.name', 'rdftool.ingestion.table.url']}
            rows = [{'rdftool.ingestion.table.title': value.get('title', ''),
                     'rdftool.ingestion.table.name': value.get('name', ''),
                     'rdftool.ingestion.table.url': value.get('url', ''), } for value in result_dict.get('deleted', [])]
            table['data'] = copy.deepcopy(rows)
            c.datasets['deleted'] = table.copy()

            table = {'header': ['rdftool.ingestion.table.name', 'rdftool.ingestion.table.url']}
            rows = [{'rdftool.ingestion.table.name': value.get('name', ''),
                     'rdftool.ingestion.table.url': value.get('url', ''), } for value in result_dict.get('file_uploads', [])]
            table['data'] = copy.deepcopy(rows)
            c.datasets['file_uploads'] = table.copy()



            url = core_helpers.url_for(controller='ckanext.ecportal.controllers.user:ECPortalUserController',
                                action='dashboard')
            test = ''
            for field, name in id_list:
                test += '{0}:{1} '.format(field, name)

            url = ckanext_helpers.url_with_params(url, [('q', test), ('ext_boolean', 'any')])

            c.id_list = url
            self._setup_template_variables(context, {},
                                           package_type='dataset')
            return base.render('user/ingestion_report.html')


        else:
            data['errors'] = True
            tmp_list = data.get('dataset', [])
            result_list = []
            for ds in tmp_list:
                uri = ds.get('uri')
                dataset = DatasetDcatApOp(uri)
                try:
                    dataset.create_dataset_schema_for_package_dict(ds, {}, context)
                except Exception as e:
                    import traceback
                    log.error(traceback.print_exc())

                split_id = dataset.get_owner_org().split('/')[-1]
                if not data.get('organization'):
                     org = get_action('organization_show')(context, {'id': split_id.lower(),
                                                        'include_datasets': 'false'})
                     data['organization'] = org
                ui_ds = ui_util.transform_dcat_schema_to_form_schema(dataset)
                ui_ds['errors'] = ds.get('errors', {})
                result_list.append(ui_ds)

            #result_list.append({'id': 'new_dataset'})

            data['dataset'] = result_list



        return data