replace office-data-import by db-restore #154
@ -1,7 +1,7 @@
|
|||||||
--liquibase formatted sql
|
--liquibase formatted sql
|
||||||
|
|
||||||
-- ============================================================================
|
-- ============================================================================
|
||||||
--changeset michael.hoennig:hs-global-ddl-cleanup context:hosting-asset-import endDelimiter:--//
|
--changeset michael.hoennig:hs-global-office-test-ddl-cleanup context:hosting-asset-import endDelimiter:--//
|
||||||
-- ----------------------------------------------------------------------------
|
-- ----------------------------------------------------------------------------
|
||||||
|
|
||||||
DROP PROCEDURE IF EXISTS hs_office.bankaccount_create_test_data(IN givenholder character varying, IN giveniban character varying, IN givenbic character varying);
|
DROP PROCEDURE IF EXISTS hs_office.bankaccount_create_test_data(IN givenholder character varying, IN giveniban character varying, IN givenbic character varying);
|
||||||
@ -16,13 +16,19 @@ DROP PROCEDURE IF EXISTS hs_office.person_create_test_data(IN newpersontype hs_o
|
|||||||
DROP PROCEDURE IF EXISTS hs_office.relation_create_test_data(IN startcount integer, IN endcount integer);
|
DROP PROCEDURE IF EXISTS hs_office.relation_create_test_data(IN startcount integer, IN endcount integer);
|
||||||
DROP PROCEDURE IF EXISTS hs_office.relation_create_test_data(IN holderpersonname character varying, IN relationtype hs_office.relationtype, IN anchorpersonname character varying, IN contactcaption character varying, IN mark character varying);
|
DROP PROCEDURE IF EXISTS hs_office.relation_create_test_data(IN holderpersonname character varying, IN relationtype hs_office.relationtype, IN anchorpersonname character varying, IN contactcaption character varying, IN mark character varying);
|
||||||
DROP PROCEDURE IF EXISTS hs_office.sepamandate_create_test_data(IN forpartnernumber numeric, IN fordebitorsuffix character, IN foriban character varying, IN withreference character varying);
|
DROP PROCEDURE IF EXISTS hs_office.sepamandate_create_test_data(IN forpartnernumber numeric, IN fordebitorsuffix character, IN foriban character varying, IN withreference character varying);
|
||||||
|
--//
|
||||||
|
|
||||||
|
|
||||||
|
-- ============================================================================
|
||||||
|
--changeset michael.hoennig:hs-global-rbac-test-ddl-cleanup context:hosting-asset-import endDelimiter:--//
|
||||||
|
-- ----------------------------------------------------------------------------
|
||||||
|
|
||||||
DROP SCHEMA IF EXISTS rbactest CASCADE;
|
DROP SCHEMA IF EXISTS rbactest CASCADE;
|
||||||
--//
|
--//
|
||||||
|
|
||||||
|
|
||||||
-- ============================================================================
|
-- ============================================================================
|
||||||
--changeset michael.hoennig:hs-global-dml-cleanup context:hosting-asset-import endDelimiter:--//
|
--changeset michael.hoennig:hs-global-rbac-test-dml-cleanup context:hosting-asset-import endDelimiter:--//
|
||||||
-- ----------------------------------------------------------------------------
|
-- ----------------------------------------------------------------------------
|
||||||
|
|
||||||
call base.defineContext('9800-cleanup', null, '${HSADMINNG_SUPERUSER}', null);
|
call base.defineContext('9800-cleanup', null, '${HSADMINNG_SUPERUSER}', null);
|
||||||
|
@ -149,7 +149,7 @@ public class ImportHostingAssets extends CsvDataImport {
|
|||||||
@Order(11010)
|
@Order(11010)
|
||||||
void createBookingProjects() {
|
void createBookingProjects() {
|
||||||
|
|
||||||
final var resultList = em.createNativeQuery(
|
final var partnerLegacyIdMappings = em.createNativeQuery(
|
||||||
"""
|
"""
|
||||||
select debitor.uuid, pid.bp_id
|
select debitor.uuid, pid.bp_id
|
||||||
from hs_office.debitor debitor
|
from hs_office.debitor debitor
|
||||||
@ -159,13 +159,13 @@ public class ImportHostingAssets extends CsvDataImport {
|
|||||||
join hs_office.partner_legacy_id pid on partner.uuid=pid.uuid
|
join hs_office.partner_legacy_id pid on partner.uuid=pid.uuid
|
||||||
""", PartnerLegacyIdMapping.class).getResultList();
|
""", PartnerLegacyIdMapping.class).getResultList();
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
final var debitorUuidTopLegacyBpId = ((List<PartnerLegacyIdMapping>) resultList).stream()
|
final var debitorUuidToLegacyBpIdMap = ((List<PartnerLegacyIdMapping>) partnerLegacyIdMappings).stream()
|
||||||
.collect(toMap(row -> row.uuid, row -> row.bp_id));
|
.collect(toMap(row -> row.uuid, row -> row.bp_id));
|
||||||
final var debitors = em.createNativeQuery("SELECT debitor.uuid, debitor.version, debitor.defaultPrefix FROM hs_office.debitor debitor", DebitorRecord.class).getResultList();
|
final var debitors = em.createNativeQuery("SELECT debitor.uuid, debitor.version, debitor.defaultPrefix FROM hs_office.debitor debitor", DebitorRecord.class).getResultList();
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
((List<DebitorRecord>)debitors).forEach(debitor -> {
|
((List<DebitorRecord>)debitors).forEach(debitor -> {
|
||||||
bookingProjects.put(
|
bookingProjects.put(
|
||||||
debitorUuidTopLegacyBpId.get(debitor.uuid), HsBookingProjectRealEntity.builder()
|
debitorUuidToLegacyBpIdMap.get(debitor.uuid), HsBookingProjectRealEntity.builder()
|
||||||
.version(debitor.version)
|
.version(debitor.version)
|
||||||
.caption(debitor.defaultPrefix + " default project")
|
.caption(debitor.defaultPrefix + " default project")
|
||||||
.debitor(em.find(HsBookingDebitorEntity.class, debitor.uuid))
|
.debitor(em.find(HsBookingDebitorEntity.class, debitor.uuid))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user