From 608af3b0119a38ef28cd6093cc620f87355bab8f Mon Sep 17 00:00:00 2001 From: Mark Prins <1165786+mprins@users.noreply.github.com> Date: Tue, 26 Nov 2024 11:54:25 +0100 Subject: [PATCH 1/8] BRMO-374: Verwijder `BRKDirectoryScanner` en `BRKScannerProces` automatisch proces uit code --- .../persistence/staging/BRKScannerProces.java | 14 - .../main/resources/META-INF/persistence.xml | 2 - .../staging/BRK2ScannerProcesTest.java | 4 +- .../test/resources/META-INF/persistence.xml | 3 - .../scanner/AbstractExecutableProces.java | 49 +-- .../service/scanner/BRKDirectoryScanner.java | 348 ------------------ .../service/scanner/ProcesExecutable.java | 1 - .../stripes/OphaalConfigActionBean.java | 49 +-- .../WEB-INF/jsp/beheer/processenophalen.jsp | 7 - 9 files changed, 35 insertions(+), 442 deletions(-) delete mode 100644 brmo-persistence/src/main/java/nl/b3p/brmo/persistence/staging/BRKScannerProces.java delete mode 100644 brmo-service/src/main/java/nl/b3p/brmo/service/scanner/BRKDirectoryScanner.java diff --git a/brmo-persistence/src/main/java/nl/b3p/brmo/persistence/staging/BRKScannerProces.java b/brmo-persistence/src/main/java/nl/b3p/brmo/persistence/staging/BRKScannerProces.java deleted file mode 100644 index a94b1770fe..0000000000 --- a/brmo-persistence/src/main/java/nl/b3p/brmo/persistence/staging/BRKScannerProces.java +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (C) 2015 B3Partners B.V. - */ -package nl.b3p.brmo.persistence.staging; - -import javax.persistence.Entity; - -/** - * Proces configuratie voor de BRK directory scanner. - * - * @author mprins - */ -@Entity -public class BRKScannerProces extends DirectoryScannerProces {} diff --git a/brmo-persistence/src/main/resources/META-INF/persistence.xml b/brmo-persistence/src/main/resources/META-INF/persistence.xml index d2e1365b25..d65ca56c36 100644 --- a/brmo-persistence/src/main/resources/META-INF/persistence.xml +++ b/brmo-persistence/src/main/resources/META-INF/persistence.xml @@ -9,7 +9,6 @@ META-INF/orm-postgresql.xml nl.b3p.brmo.persistence.staging.Bericht nl.b3p.brmo.persistence.staging.LaadProces - nl.b3p.brmo.persistence.staging.BRKScannerProces nl.b3p.brmo.persistence.staging.BRK2ScannerProces nl.b3p.brmo.persistence.staging.AutomatischProces nl.b3p.brmo.persistence.staging.NHRInschrijving @@ -31,7 +30,6 @@ META-INF/orm-oracle.xml nl.b3p.brmo.persistence.staging.Bericht nl.b3p.brmo.persistence.staging.LaadProces - nl.b3p.brmo.persistence.staging.BRKScannerProces nl.b3p.brmo.persistence.staging.BRK2ScannerProces nl.b3p.brmo.persistence.staging.AutomatischProces nl.b3p.brmo.persistence.staging.NHRInschrijving diff --git a/brmo-persistence/src/test/java/nl/b3p/brmo/persistence/staging/BRK2ScannerProcesTest.java b/brmo-persistence/src/test/java/nl/b3p/brmo/persistence/staging/BRK2ScannerProcesTest.java index cbcd8c9668..27d45de6e8 100644 --- a/brmo-persistence/src/test/java/nl/b3p/brmo/persistence/staging/BRK2ScannerProcesTest.java +++ b/brmo-persistence/src/test/java/nl/b3p/brmo/persistence/staging/BRK2ScannerProcesTest.java @@ -10,13 +10,13 @@ import org.junit.jupiter.api.Test; /** - * Testcase voor {@link nl.b3p.brmo.persistence.staging.BRKScannerProces}. + * Testcase voor {@link nl.b3p.brmo.persistence.staging.BRK2ScannerProces}. * * @author mprins */ public class BRK2ScannerProcesTest extends TestUtil { - /** round trip test van maken, opslaan en uitlezen van een BRKScannerProces. */ + /** round trip test van maken, opslaan en uitlezen van een BRK2ScannerProces. */ @Test public void roundtrip() { BRK2ScannerProces p = new BRK2ScannerProces(); diff --git a/brmo-persistence/src/test/resources/META-INF/persistence.xml b/brmo-persistence/src/test/resources/META-INF/persistence.xml index 0a0a3ec786..73bdd64a8a 100644 --- a/brmo-persistence/src/test/resources/META-INF/persistence.xml +++ b/brmo-persistence/src/test/resources/META-INF/persistence.xml @@ -9,7 +9,6 @@ META-INF/orm-postgresql.xml nl.b3p.brmo.persistence.staging.Bericht nl.b3p.brmo.persistence.staging.LaadProces - nl.b3p.brmo.persistence.staging.BRKScannerProces nl.b3p.brmo.persistence.staging.BRK2ScannerProces nl.b3p.brmo.persistence.staging.AutomatischProces nl.b3p.brmo.persistence.staging.MailRapportageProces @@ -38,7 +37,6 @@ META-INF/orm-oracle.xml nl.b3p.brmo.persistence.staging.Bericht nl.b3p.brmo.persistence.staging.LaadProces - nl.b3p.brmo.persistence.staging.BRKScannerProces nl.b3p.brmo.persistence.staging.BRK2ScannerProces nl.b3p.brmo.persistence.staging.AutomatischProces nl.b3p.brmo.persistence.staging.MailRapportageProces @@ -76,7 +74,6 @@ META-INF/orm-hsqldb.xml nl.b3p.brmo.persistence.staging.Bericht nl.b3p.brmo.persistence.staging.LaadProces - nl.b3p.brmo.persistence.staging.BRKScannerProces nl.b3p.brmo.persistence.staging.BRK2ScannerProces nl.b3p.brmo.persistence.staging.AutomatischProces nl.b3p.brmo.persistence.staging.MailRapportageProces diff --git a/brmo-service/src/main/java/nl/b3p/brmo/service/scanner/AbstractExecutableProces.java b/brmo-service/src/main/java/nl/b3p/brmo/service/scanner/AbstractExecutableProces.java index b57457784d..400e3cd508 100644 --- a/brmo-service/src/main/java/nl/b3p/brmo/service/scanner/AbstractExecutableProces.java +++ b/brmo-service/src/main/java/nl/b3p/brmo/service/scanner/AbstractExecutableProces.java @@ -39,38 +39,23 @@ public abstract class AbstractExecutableProces implements ProcesExecutable { */ public static ProcesExecutable getProces(AutomatischProces config) { ProcessingImple imple = ProcessingImple.valueOf(config.getClass().getSimpleName()); - switch (imple) { - case BAG2MutatieProces: - return new BAG2MutatieProcesRunner((BAG2MutatieProces) config); - case BRK2ScannerProces: - return new BRK2DirectoryScanner((BRK2ScannerProces) config); - case BRKScannerProces: - return new BRKDirectoryScanner((BRKScannerProces) config); - case MailRapportageProces: - return new MailRapportage((MailRapportageProces) config); - case GDS2OphaalProces: - return new GDS2OphalenProces((GDS2OphaalProces) config); - case BerichtTransformatieProces: - return new BerichtTransformatieUitvoeren((BerichtTransformatieProces) config); - case BerichtDoorstuurProces: - return new BerichtDoorsturenProces((BerichtDoorstuurProces) config); - case LaadprocesTransformatieProces: - return new LaadprocesTransformatieUitvoeren((LaadprocesTransformatieProces) config); - case MaterializedViewRefresh: - return new MaterializedViewRefreshUitvoeren((MaterializedViewRefresh) config); - case BerichtstatusRapportProces: - return new BerichtstatusRapport((BerichtstatusRapportProces) config); - case LaadprocesStatusRapportProces: - return new LaadprocesStatusRapport((LaadprocesStatusRapportProces) config); - case TopNLScannerProces: - return new TopNLDirectoryScanner((TopNLScannerProces) config); - case AfgifteNummerScannerProces: - return new AfgifteNummerScanner((AfgifteNummerScannerProces) config); - case BGTLoaderProces: - return new BGTLoader((BGTLoaderProces) config); - default: - throw new IllegalArgumentException(imple.name() + " is is geen ondersteund proces..."); - } + return switch (imple) { + case BAG2MutatieProces -> new BAG2MutatieProcesRunner((BAG2MutatieProces) config); + case BRK2ScannerProces -> new BRK2DirectoryScanner((BRK2ScannerProces) config); + case MailRapportageProces -> new MailRapportage((MailRapportageProces) config); + case GDS2OphaalProces -> new GDS2OphalenProces((GDS2OphaalProces) config); + case BerichtTransformatieProces -> new BerichtTransformatieUitvoeren((BerichtTransformatieProces) config); + case BerichtDoorstuurProces -> new BerichtDoorsturenProces((BerichtDoorstuurProces) config); + case LaadprocesTransformatieProces -> + new LaadprocesTransformatieUitvoeren((LaadprocesTransformatieProces) config); + case MaterializedViewRefresh -> new MaterializedViewRefreshUitvoeren((MaterializedViewRefresh) config); + case BerichtstatusRapportProces -> new BerichtstatusRapport((BerichtstatusRapportProces) config); + case LaadprocesStatusRapportProces -> new LaadprocesStatusRapport((LaadprocesStatusRapportProces) config); + case TopNLScannerProces -> new TopNLDirectoryScanner((TopNLScannerProces) config); + case AfgifteNummerScannerProces -> new AfgifteNummerScanner((AfgifteNummerScannerProces) config); + case BGTLoaderProces -> new BGTLoader((BGTLoaderProces) config); + default -> throw new IllegalArgumentException(imple.name() + " is is geen ondersteund proces..."); + }; } @Override diff --git a/brmo-service/src/main/java/nl/b3p/brmo/service/scanner/BRKDirectoryScanner.java b/brmo-service/src/main/java/nl/b3p/brmo/service/scanner/BRKDirectoryScanner.java deleted file mode 100644 index 00895f6c08..0000000000 --- a/brmo-service/src/main/java/nl/b3p/brmo/service/scanner/BRKDirectoryScanner.java +++ /dev/null @@ -1,348 +0,0 @@ -/* - * Copyright (C) 2015 B3Partners B.V. - */ -package nl.b3p.brmo.service.scanner; - -import static nl.b3p.brmo.persistence.staging.AutomatischProces.ProcessingStatus.ERROR; -import static nl.b3p.brmo.persistence.staging.AutomatischProces.ProcessingStatus.PROCESSING; -import static nl.b3p.brmo.persistence.staging.AutomatischProces.ProcessingStatus.WAITING; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.nio.charset.StandardCharsets; -import java.text.SimpleDateFormat; -import java.util.Arrays; -import java.util.Calendar; -import java.util.Date; -import javax.persistence.EntityManager; -import javax.persistence.PersistenceException; -import javax.persistence.Transient; -import javax.xml.stream.XMLStreamException; -import javax.xml.transform.TransformerException; -import nl.b3p.brmo.loader.BrmoFramework; -import nl.b3p.brmo.loader.entity.BrkBericht; -import nl.b3p.brmo.loader.util.BrmoException; -import nl.b3p.brmo.loader.xml.BrkSnapshotXMLReader; -import nl.b3p.brmo.persistence.staging.AutomatischProces; -import nl.b3p.brmo.persistence.staging.BRKScannerProces; -import nl.b3p.brmo.persistence.staging.Bericht; -import nl.b3p.brmo.persistence.staging.LaadProces; -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.comparator.NameFileComparator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.stripesstuff.stripersist.Stripersist; - -/** - * Directory scanner for BRK berichten in xml formaat. - * - * @author Mark Prins - */ -public class BRKDirectoryScanner extends AbstractExecutableProces { - - private static final Log log = LogFactory.getLog(BRKDirectoryScanner.class); - - private final BRKScannerProces config; - - @Transient private ProgressUpdateListener listener; - - public BRKDirectoryScanner(BRKScannerProces config) { - this.config = config; - } - - /** - * Leest de xml berichten uit de directory in in de database, indien geconfigureerd worden - * bestanden gearchiveerd. - * - * @throws BrmoException als de directory niet lees/blader/schrijfbaar is - */ - @Override - public void execute() throws BrmoException { - this.execute( - new ProgressUpdateListener() { - @Override - public void total(long total) {} - - @Override - public void progress(long progress) {} - - @Override - public void exception(Throwable t) { - log.error(t); - } - - @Override - public void updateStatus(String status) {} - - @Override - public void addLog(String log) {} - }); - } - - @Override - public void execute(ProgressUpdateListener listener) { - final EntityManager em = Stripersist.getEntityManager(); - this.listener = listener; - config.setStatus(PROCESSING); - StringBuilder sb = new StringBuilder(AutomatischProces.LOG_NEWLINE); - String oldLog = config.getLogfile(); - if (oldLog != null) { - if (oldLog.length() > OLD_LOG_LENGTH) { - sb.append(oldLog.substring(oldLog.length() - OLD_LOG_LENGTH / 10)); - } else { - sb.append(oldLog); - } - } - - String msg = - String.format( - "De BRK scanner met ID %d is gestart op %tc.", config.getId(), Calendar.getInstance()); - log.info(msg); - listener.addLog(msg); - sb.append(msg); - - // validatie van de directories, kunnen we lezen/bladeren en evt. schrijven? - final File scanDirectory = new File(this.config.getScanDirectory()); - if (!scanDirectory.isDirectory() || !scanDirectory.canExecute()) { - config.setStatus(ERROR); - msg = String.format("De scan directory '%s' is geen executable directory", scanDirectory); - config.setLogfile(msg); - config.setSamenvatting("Er is een fout opgetreden, details staan in de logs"); - this.listener.exception(new BrmoException(msg)); - return; - } - // validatie archief directory - final String aDir = this.config.getArchiefDirectory(); - File archiefDirectory = null; - if (aDir != null) { - archiefDirectory = new File(aDir); - archiefDirectory.mkdirs(); - if (!archiefDirectory.isDirectory() || !archiefDirectory.canWrite()) { - config.setStatus(ERROR); - msg = - String.format( - "De archief directory '%s' is geen beschrijfbare directory, er worden geen bestanden gearchiveerd.", - archiefDirectory); - sb.append(msg); - config.setSamenvatting("Er is een fout opgetreden, details staan in de logs"); - log.error(msg); - archiefDirectory = null; - this.listener.exception(new BrmoException(msg)); - } - if (!scanDirectory.canWrite()) { - config.setStatus(ERROR); - msg = - String.format( - "De scan directory '%s' is geen beschrijfbare directory, er worden geen bestanden gearchiveerd.", - scanDirectory); - sb.append(msg); - config.setSamenvatting("Er is een fout opgetreden, details staan in de logs"); - log.error(msg); - archiefDirectory = null; - this.listener.exception(new BrmoException(msg)); - } - } - config.setLogfile(sb.toString()); - - File files[] = - scanDirectory.listFiles((File dir, String name) -> name.toLowerCase().endsWith(".xml")); - Arrays.sort(files, NameFileComparator.NAME_COMPARATOR); - - processXMLFiles(files, scanDirectory, archiefDirectory, em); - } - - /** - * verwerk een bestandenlijst. - * - * @param files array met xml bestanden - * @param scanDirectory te scannen directory - * @param archiefDirectory waar de gescande files worden neergezet als de archief optie actief is - * @param em de te gebruiken EntityManager - */ - private void processXMLFiles( - File[] files, File scanDirectory, File archiefDirectory, EntityManager em) { - StringBuilder sb = new StringBuilder(AutomatischProces.LOG_NEWLINE + config.getLogfile()); - String msg; - int filterAlVerwerkt = 0; - int aantalGeladen = 0; - int progress = 0; - SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); - - listener.total(files.length); - for (File f : files) { - if (f.isDirectory()) { - continue; - } - msg = String.format("Bestand %s is gevonden in %s.", f, scanDirectory); - log.info(msg); - listener.addLog(msg); - sb.append(AutomatischProces.LOG_NEWLINE).append(msg).append(AutomatischProces.LOG_NEWLINE); - if (this.isDuplicaatLaadProces(f, BrmoFramework.BR_BRK)) { - msg = String.format(" Bestand %s is een duplicaat en wordt overgeslagen.", f); - listener.addLog(msg); - log.info(msg); - sb.append(msg).append(AutomatischProces.LOG_NEWLINE); - filterAlVerwerkt++; - } else { - try { - LaadProces lp = new LaadProces(); - lp.setBestand_naam(getBestandsNaam(f)); - lp.setBestand_datum(getBestandsDatum(f)); - lp.setSoort(BrmoFramework.BR_BRK); - lp.setStatus(LaadProces.STATUS.STAGING_OK); - lp.setOpmerking( - String.format( - "Bestand geladen van %s op %s", f.getAbsolutePath(), sdf.format(new Date()))); - lp.setAutomatischProces( - Stripersist.getEntityManager().find(AutomatischProces.class, config.getId())); - - Bericht b = new Bericht(); - b.setLaadprocesid(lp); - b.setDatum(lp.getBestand_datum()); - b.setSoort(BrmoFramework.BR_BRK); - b.setStatus_datum(new Date()); - String fileContent = FileUtils.readFileToString(f, StandardCharsets.UTF_8); - fileContent = fileContent.replaceAll("\u0000.*", ""); - b.setBr_orgineel_xml(fileContent); - - try { - BrkSnapshotXMLReader reader = - new BrkSnapshotXMLReader( - new ByteArrayInputStream( - b.getBr_orgineel_xml().getBytes(StandardCharsets.UTF_8))); - BrkBericht bericht = reader.next(); - - if (bericht.getDatum() != null) { - b.setDatum(bericht.getDatum()); - } - b.setBr_xml(bericht.getBrXml()); - b.setVolgordenummer(bericht.getVolgordeNummer()); - lp.setBestand_naam_hersteld( - bericht.getRestoredFileName(lp.getBestand_datum(), bericht.getVolgordeNummer())); - - // Als objectRef niet opgehaald kan worden,dan kan het - // bericht niet verwerkt worden. - String objectRef = bericht.getObjectRef(); - if (objectRef != null && !objectRef.isEmpty()) { - b.setObject_ref(bericht.getObjectRef()); - b.setStatus(Bericht.STATUS.STAGING_OK); - b.setOpmerking("Klaar voor verwerking."); - } else { - b.setStatus(Bericht.STATUS.STAGING_NOK); - b.setOpmerking( - "Object Ref niet gevonden in bericht-xml, neem contact op met leverancier."); - } - } catch (XMLStreamException | TransformerException e) { - b.setStatus(Bericht.STATUS.STAGING_NOK); - StringWriter sw = new StringWriter(); - e.printStackTrace(new PrintWriter(sw)); - msg = String.format("Fout bij parsen BRK bericht (bestand %s): %s ", f, sw.toString()); - b.setOpmerking(msg); - log.warn(msg); - } - try { - em.persist(lp); - em.persist(b); - em.merge(this.config); - em.flush(); - em.getTransaction().commit(); - em.clear(); - aantalGeladen++; - msg = - String.format( - " Bestand %s is geladen en heeft status: %s. (Leverde bericht id: %s, met status: %s.)", - f, lp.getStatus(), b.getId(), b.getStatus()); - } catch (PersistenceException pe) { - // insert van bericht of lp is mislukt, waarschijnlijk duplicaat bericht - // een laadproces maken met duplicaat status en de xml van het bericht in de - // opmerking stoppen - if (!em.getTransaction().isActive()) { - em.getTransaction().begin(); - } - em.getTransaction().rollback(); - em.getTransaction().begin(); - lp.setId(null); - log.warn( - "Opslaan van bericht uit laadproces " - + lp.getBestand_naam() - + " is mislukt. Object referentie is: " - + b.getObject_ref(), - pe); - log.warn("Duplicaat bericht: " + b.getObject_ref() + ":" + b.getBr_orgineel_xml()); - lp.setOpmerking( - lp.getOpmerking() - + ": Fout, duplicaat bericht. Berichtinhoud: \n\n" - + b.getBr_xml()); - b = null; - lp.setStatus(LaadProces.STATUS.STAGING_DUPLICAAT); - lp.setAutomatischProces(em.find(AutomatischProces.class, this.config.getId())); - em.merge(this.config); - em.persist(lp); - em.flush(); - em.getTransaction().commit(); - em.clear(); - } - log.info(msg); - this.listener.addLog(msg); - sb.append(msg).append(AutomatischProces.LOG_NEWLINE); - - } catch (IOException io) { - // mogelijk bij openen en lezen xml bestand - log.error(io.getLocalizedMessage()); - sb.append(io.getLocalizedMessage()).append(AutomatischProces.LOG_NEWLINE); - listener.exception(io); - } - } - listener.progress(++progress); - - if (archiefDirectory != null) { - // verplaats naar archief - try { - FileUtils.copyFileToDirectory(f, archiefDirectory); - boolean succes = FileUtils.deleteQuietly(f); - if (succes) { - msg = String.format(" Bestand %s is naar archief %s verplaatst.", f, archiefDirectory); - } else { - msg = - String.format( - " Bestand %s is naar archief %s verplaatst, maar origineel kon niet verwijderd worden.", - f, archiefDirectory); - } - } catch (IOException e) { - msg = - String.format( - " Bestand %s is NIET naar archief %s verplaatst, oorzaak: (%s).", - f, archiefDirectory, e.getLocalizedMessage()); - log.error(msg); - } - } - log.info(msg); - this.listener.addLog(msg); - sb.append(msg).append(AutomatischProces.LOG_NEWLINE); - } - msg = String.format("Klaar met run op %tc", Calendar.getInstance()); - log.info(msg); - listener.updateStatus(msg); - listener.addLog(msg); - sb.append(msg); - - listener.addLog("\n\n**** resultaat ****"); - listener.addLog("\nAantal bestanden die al waren geladen: " + filterAlVerwerkt); - listener.addLog("\nAantal bestanden geladen: " + aantalGeladen + "\n"); - - config.setStatus(WAITING); - config.setLogfile(sb.toString()); - config.setLastrun(new Date()); - config.updateSamenvattingEnLogfile( - "Aantal bestanden die al waren verwerkt: " - + filterAlVerwerkt - + AutomatischProces.LOG_NEWLINE - + "Aantal bestanden geladen: " - + aantalGeladen - + AutomatischProces.LOG_NEWLINE); - em.merge(config); - } -} diff --git a/brmo-service/src/main/java/nl/b3p/brmo/service/scanner/ProcesExecutable.java b/brmo-service/src/main/java/nl/b3p/brmo/service/scanner/ProcesExecutable.java index 6a51edd0e6..f1c8561345 100644 --- a/brmo-service/src/main/java/nl/b3p/brmo/service/scanner/ProcesExecutable.java +++ b/brmo-service/src/main/java/nl/b3p/brmo/service/scanner/ProcesExecutable.java @@ -17,7 +17,6 @@ enum ProcessingImple { // klassen uit nl.b3p.brmo.persistence.staging package BAG2MutatieProces, BRK2ScannerProces, - BRKScannerProces, MailRapportageProces, GDS2OphaalProces, BerichtTransformatieProces, diff --git a/brmo-service/src/main/java/nl/b3p/brmo/service/stripes/OphaalConfigActionBean.java b/brmo-service/src/main/java/nl/b3p/brmo/service/stripes/OphaalConfigActionBean.java index 6b6cf600cf..236c86e501 100644 --- a/brmo-service/src/main/java/nl/b3p/brmo/service/stripes/OphaalConfigActionBean.java +++ b/brmo-service/src/main/java/nl/b3p/brmo/service/stripes/OphaalConfigActionBean.java @@ -31,7 +31,6 @@ import nl.b3p.brmo.persistence.staging.BAG2MutatieProces; import nl.b3p.brmo.persistence.staging.BGTLoaderProces; import nl.b3p.brmo.persistence.staging.BRK2ScannerProces; -import nl.b3p.brmo.persistence.staging.BRKScannerProces; import nl.b3p.brmo.persistence.staging.BerichtDoorstuurProces; import nl.b3p.brmo.persistence.staging.BerichtTransformatieProces; import nl.b3p.brmo.persistence.staging.BerichtstatusRapportProces; @@ -178,38 +177,22 @@ public Resolution save() { * @return an instance of the specified type */ private AutomatischProces getProces(ProcesExecutable.ProcessingImple type) { - switch (type) { - case BAG2MutatieProces: - return new BAG2MutatieProces(); - case BRK2ScannerProces: - return new BRK2ScannerProces(); - case BRKScannerProces: - return new BRKScannerProces(); - case MailRapportageProces: - return new MailRapportageProces(); - case GDS2OphaalProces: - return new GDS2OphaalProces(); - case BerichtTransformatieProces: - return new BerichtTransformatieProces(); - case BerichtDoorstuurProces: - return new BerichtDoorstuurProces(); - case LaadprocesTransformatieProces: - return new LaadprocesTransformatieProces(); - case MaterializedViewRefresh: - return new MaterializedViewRefresh(); - case BerichtstatusRapportProces: - return new BerichtstatusRapportProces(); - case LaadprocesStatusRapportProces: - return new LaadprocesStatusRapportProces(); - case TopNLScannerProces: - return new TopNLScannerProces(); - case AfgifteNummerScannerProces: - return new AfgifteNummerScannerProces(); - case BGTLoaderProces: - return new BGTLoaderProces(); - default: - throw new IllegalArgumentException(type.name() + " is geen ondersteund proces type..."); - } + return switch (type) { + case BAG2MutatieProces -> new BAG2MutatieProces(); + case BRK2ScannerProces -> new BRK2ScannerProces(); + case MailRapportageProces -> new MailRapportageProces(); + case GDS2OphaalProces -> new GDS2OphaalProces(); + case BerichtTransformatieProces -> new BerichtTransformatieProces(); + case BerichtDoorstuurProces -> new BerichtDoorstuurProces(); + case LaadprocesTransformatieProces -> new LaadprocesTransformatieProces(); + case MaterializedViewRefresh -> new MaterializedViewRefresh(); + case BerichtstatusRapportProces -> new BerichtstatusRapportProces(); + case LaadprocesStatusRapportProces -> new LaadprocesStatusRapportProces(); + case TopNLScannerProces -> new TopNLScannerProces(); + case AfgifteNummerScannerProces -> new AfgifteNummerScannerProces(); + case BGTLoaderProces -> new BGTLoaderProces(); + default -> throw new IllegalArgumentException(type.name() + " is geen ondersteund proces type..."); + }; } private ProcesExecutable.ProcessingImple getType(AutomatischProces p) { diff --git a/brmo-service/src/main/webapp/WEB-INF/jsp/beheer/processenophalen.jsp b/brmo-service/src/main/webapp/WEB-INF/jsp/beheer/processenophalen.jsp index b346959cbb..9b680f89d2 100644 --- a/brmo-service/src/main/webapp/WEB-INF/jsp/beheer/processenophalen.jsp +++ b/brmo-service/src/main/webapp/WEB-INF/jsp/beheer/processenophalen.jsp @@ -104,13 +104,6 @@ - - - - ${actionBean.proces.id} - - - From 4754613f379277dfab5a0ebbbdce7d2c70757727 Mon Sep 17 00:00:00 2001 From: Mark Prins <1165786+mprins@users.noreply.github.com> Date: Tue, 26 Nov 2024 11:59:10 +0100 Subject: [PATCH 2/8] BRMO-374: Verwijder code voor BRK 1 functies uit geavanceerde functies Verwijder "Repareren BRK mutaties met status STAGING_NOK", "Exporteren BRK mutaties", "Herhaal transformatie BRK verwijderberichten, oplossen achtergebleven 'kad_onrrnd_zk' records", "Vul de 'herstelde bestandsnaam' van BRK laadprocessen", "Verwijderen van BRK berichten met status ARCHIVE" uit `AdvancedFunctionsActionBean` --- .../stripes/AdvancedFunctionsActionBean.java | 395 ------------------ 1 file changed, 395 deletions(-) diff --git a/brmo-service/src/main/java/nl/b3p/brmo/service/stripes/AdvancedFunctionsActionBean.java b/brmo-service/src/main/java/nl/b3p/brmo/service/stripes/AdvancedFunctionsActionBean.java index 36ef30f9df..76b68b4492 100644 --- a/brmo-service/src/main/java/nl/b3p/brmo/service/stripes/AdvancedFunctionsActionBean.java +++ b/brmo-service/src/main/java/nl/b3p/brmo/service/stripes/AdvancedFunctionsActionBean.java @@ -3,8 +3,6 @@ import static org.apache.commons.dbutils.DbUtils.closeQuietly; import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; import java.io.InputStream; import java.io.PrintWriter; import java.io.StringWriter; @@ -15,7 +13,6 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Timestamp; -import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.Calendar; import java.util.Date; @@ -45,7 +42,6 @@ import nl.b3p.brmo.loader.entity.BrkBericht; import nl.b3p.brmo.loader.util.BrmoException; import nl.b3p.brmo.loader.util.StagingRowHandler; -import nl.b3p.brmo.loader.xml.BrkSnapshotXMLReader; import nl.b3p.brmo.loader.xml.WozXMLReader; import nl.b3p.brmo.service.util.ConfigUtil; import nl.b3p.jdbc.util.converter.GeometryJdbcConverter; @@ -54,7 +50,6 @@ import org.apache.commons.dbutils.ResultSetHandler; import org.apache.commons.dbutils.RowProcessor; import org.apache.commons.dbutils.handlers.ScalarHandler; -import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.commons.lang3.mutable.MutableInt; import org.apache.commons.logging.Log; @@ -73,19 +68,6 @@ public class AdvancedFunctionsActionBean implements ActionBean, ProgressUpdateLi private static final String JSP = "/WEB-INF/jsp/transform/advancedfunctions.jsp"; private static final String JSP_PROGRESS = "/WEB-INF/jsp/transform/advancedfunctionsprogress.jsp"; - private static final String MUTOPEN = - "" - + "%s" - + "%s" - + "" - + "" - + "" - + ""; - private static final String MUTCLOSE = ""; - private ActionBeanContext context; private List advancedFunctionProcesses; @@ -101,15 +83,11 @@ public class AdvancedFunctionsActionBean implements ActionBean, ProgressUpdateLi private Date update; private String exceptionStacktrace; - private final String BRK_VERWIJDEREN_NOGMAALS_UITVOEREN = - "Herhaal transformatie BRK verwijderberichten, oplossen achtergebleven 'kad_onrrnd_zk' records"; private final String NHR_FIX_TYPERING = "Fix 'typering' en 'clazz' van nHR persoon"; private final String NHR_ARCHIVING = "Opschonen en archiveren van nHR berichten met status RSGB_OK, ouder dan 3 maanden"; private final String NHR_REMOVAL = "Verwijderen van nHR berichten met status ARCHIVE"; private final String NHR_OPNIEUW_VERWERKEN = "Opnieuw verwerken van nHR berichten"; - private final String BRK_HERSTEL_BESTANDSNAAM = - "Vul de 'herstelde bestandsnaam' van BRK laadprocessen"; private final String WOZ_OPNIEUW_VERWERKING = "Originele WOZ berichten opnieuw verwerken"; // @@ -224,37 +202,19 @@ public void populateAdvancedFunctionProcesses() { String brkExportDir = this.getContext().getServletContext().getInitParameter("exportDir.brk"); LOG.warn("Instellen BRK export directory op niet-default waarde: " + brkExportDir); - // XXX move to configuration file // bij een nieuw proces ook de wiki bijwerken: // https://github.com/B3Partners/brmo/wiki/Geavanceerde-functies advancedFunctionProcesses = Arrays.asList( - new AdvancedFunctionProcess( - "Exporteren BRK mutaties", - BrmoFramework.BR_BRK, - brkExportDir == null ? "/tmp/brkmutaties" : brkExportDir), - new AdvancedFunctionProcess( - "Repareren BRK mutaties met status STAGING_NOK", - BrmoFramework.BR_BRK, - Bericht.STATUS.STAGING_NOK.toString()), new AdvancedFunctionProcess( "Opschonen en archiveren van BRK berichten met status RSGB_OK, ouder dan 3 maanden", BrmoFramework.BR_BRK, Bericht.STATUS.RSGB_OK.toString()), new AdvancedFunctionProcess( NHR_ARCHIVING, BrmoFramework.BR_NHR, Bericht.STATUS.RSGB_OK.toString()), - new AdvancedFunctionProcess( - "Verwijderen van BRK berichten met status ARCHIVE", - BrmoFramework.BR_BRK, - Bericht.STATUS.ARCHIVE.toString()), new AdvancedFunctionProcess( NHR_REMOVAL, BrmoFramework.BR_NHR, Bericht.STATUS.ARCHIVE.toString()), - new AdvancedFunctionProcess( - BRK_VERWIJDEREN_NOGMAALS_UITVOEREN, - BrmoFramework.BR_BRK, - Bericht.STATUS.RSGB_OK.toString()), new AdvancedFunctionProcess(NHR_FIX_TYPERING, BrmoFramework.BR_NHR, null), - new AdvancedFunctionProcess(BRK_HERSTEL_BESTANDSNAAM, BrmoFramework.BR_BRK, "0"), new AdvancedFunctionProcess(NHR_OPNIEUW_VERWERKEN, BrmoFramework.BR_NHR, null), new AdvancedFunctionProcess(WOZ_OPNIEUW_VERWERKING, BrmoFramework.BR_WOZ, null)); } @@ -286,36 +246,21 @@ public Resolution perform() { // Get berichten try { switch (process.getName()) { - case "Exporteren BRK mutaties": - exportBRKMutatieBerichten(process.getConfig()); - break; - case "Repareren BRK mutaties met status STAGING_NOK": - repairBRKMutatieBerichten(process.getConfig()); - break; case "Opschonen en archiveren van BRK berichten met status RSGB_OK, ouder dan 3 maanden": cleanupBerichten(process.getConfig(), "brk"); break; case NHR_ARCHIVING: cleanupBerichten(process.getConfig(), BrmoFramework.BR_NHR); break; - case "Verwijderen van BRK berichten met status ARCHIVE": - deleteBerichten(process.getConfig(), "brk"); - break; case NHR_REMOVAL: deleteBerichten(process.getConfig(), BrmoFramework.BR_NHR); break; - case BRK_VERWIJDEREN_NOGMAALS_UITVOEREN: - replayBRKVerwijderBerichten(process.getSoort(), process.getConfig()); - break; case NHR_OPNIEUW_VERWERKEN: replayNHRVerwerking(process.getSoort(), process.getConfig()); break; case NHR_FIX_TYPERING: fixNHRTypering(process.getSoort(), process.getConfig()); break; - case BRK_HERSTEL_BESTANDSNAAM: - fillbestandsNaamHersteld(process.getSoort(), process.getConfig()); - break; case WOZ_OPNIEUW_VERWERKING: replayWOZVerwerking(); break; @@ -420,251 +365,6 @@ private void replayWOZVerwerking() throws Exception { } } - public void repairBRKMutatieBerichten(String config) throws Exception { - int offset = 0; - int batch = 1000; - final MutableInt processed = new MutableInt(0); - final DataSource dataSourceStaging = ConfigUtil.getDataSourceStaging(); - final Connection conn = dataSourceStaging.getConnection(); - final GeometryJdbcConverter geomToJdbc = - GeometryJdbcConverterFactory.getGeometryJdbcConverter(conn); - final RowProcessor processor = new StagingRowHandler(); - - do { - LOG.debug( - String.format("Ophalen mutatieberichten batch met offset %d, limit %d", offset, batch)); - String sql = - "select * from " - + BrmoFramework.BERICHT_TABLE - + " where volgordenummer >= 0 " - + " and soort='brk' " - + " and status='" - + config - + "'" - + " order by id "; - sql = geomToJdbc.buildPaginationSql(sql, offset, batch); - LOG.debug("SQL voor ophalen berichten batch: " + sql); - - processed.setValue(0); - Exception e = - new QueryRunner(geomToJdbc.isPmdKnownBroken()) - .query( - conn, - sql, - rs -> { - while (rs.next()) { - try { - Bericht bericht = processor.toBean(rs, Bericht.class); - StringBuilder message = new StringBuilder(); - if (bericht.getBrOrgineelXml() != null - && !bericht.getBrOrgineelXml().isEmpty()) { - message.append(bericht.getBrOrgineelXml()); - } else { - SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); - message.append( - String.format( - MUTOPEN, - dateFormat.format(bericht.getDatum()), - bericht.getVolgordeNummer(), - bericht.getObjectRef())); - if (bericht.getBrXml().startsWith(" - message.append(bericht.getBrXml().substring(21)); - } else { - message.append(bericht.getBrXml()); - } - message.append(MUTCLOSE); - } - - BrkSnapshotXMLReader reader = - new BrkSnapshotXMLReader( - new ByteArrayInputStream( - message.toString().getBytes(StandardCharsets.UTF_8))); - Bericht brk = reader.next(); - if (brk != null - && brk.getDatum() != null - && brk.getObjectRef() != null - && brk.getVolgordeNummer() != null) { - bericht.setDatum(brk.getDatum()); - bericht.setObjectRef(brk.getObjectRef()); - bericht.setVolgordeNummer(brk.getVolgordeNummer()); - } - if (brk != null - && brk.getDatum() != null - && brk.getObjectRef() != null - && brk.getVolgordeNummer() != null) { - if (bericht.getBrOrgineelXml() != null - && !bericht.getBrOrgineelXml().isEmpty()) { - new QueryRunner(geomToJdbc.isPmdKnownBroken()) - .update( - conn, - "update " - + BrmoFramework.BERICHT_TABLE - + " set object_ref = ?, datum = ?, volgordenummer = ? where id = ?", - bericht.getObjectRef(), - new Timestamp(bericht.getDatum().getTime()), - bericht.getVolgordeNummer(), - bericht.getId()); - } else { - new QueryRunner(geomToJdbc.isPmdKnownBroken()) - .update( - conn, - "update " - + BrmoFramework.BERICHT_TABLE - + " set object_ref = ?, datum = ?, volgordenummer = ?, br_orgineel_xml = ? where id = ?", - bericht.getObjectRef(), - new Timestamp(bericht.getDatum().getTime()), - bericht.getVolgordeNummer(), - message.toString(), - bericht.getId()); - } - } - - } catch (Exception e1) { - return e1; - } - processed.increment(); - } - return null; - }); - offset += processed.intValue(); - - progress(offset); - - // If handler threw exception processing row, rethrow it - if (e != null) { - closeQuietly(conn); - throw e; - } - } while (processed.intValue() > 0); - closeQuietly(conn); - } - - public void exportBRKMutatieBerichten(String locatie) throws Exception { - - boolean repairFirst = false; - if (repairFirst) { - repairBRKMutatieBerichten(null); - } - - int offset = 0; - int batch = 5000; - final MutableInt processed = new MutableInt(0); - final DataSource dataSourceStaging = ConfigUtil.getDataSourceStaging(); - final Connection conn = dataSourceStaging.getConnection(); - final GeometryJdbcConverter geomToJdbc = - GeometryJdbcConverterFactory.getGeometryJdbcConverter(conn); - final RowProcessor processor = new StagingRowHandler(); - - final File exportDir = new File(locatie); - FileUtils.forceMkdir(exportDir); - - do { - LOG.info( - String.format( - "Ophalen mutatieberichten export batch met offset %d, limit %d", offset, batch)); - String sql = - "select * from " - + BrmoFramework.BERICHT_TABLE - + " where volgordenummer >= 0 " - + " and soort='brk' " - + " order by object_ref, datum, volgordenummer "; - sql = geomToJdbc.buildPaginationSql(sql, offset, batch); - LOG.debug("SQL voor ophalen berichten batch: " + sql); - - final File f = new File(exportDir, "batch" + offset + ".zip"); - final ZipOutputStream out = new ZipOutputStream(new FileOutputStream(f)); - - processed.setValue(0); - Exception e = - new QueryRunner(geomToJdbc.isPmdKnownBroken()) - .query( - conn, - sql, - rs -> { - while (rs.next()) { - try { - Bericht bericht = processor.toBean(rs, Bericht.class); - - boolean infoOK = true; - if (bericht.getBrOrgineelXml() != null) { - BrkSnapshotXMLReader reader = - new BrkSnapshotXMLReader( - new ByteArrayInputStream( - bericht.getBrOrgineelXml().getBytes(StandardCharsets.UTF_8))); - Bericht brk = reader.next(); - if (brk.getDatum() != null - && brk.getObjectRef() != null - && brk.getVolgordeNummer() != null) { - bericht.setDatum(brk.getDatum()); - bericht.setObjectRef(brk.getObjectRef()); - bericht.setVolgordeNummer(brk.getVolgordeNummer()); - } else { - infoOK = false; - } - } else { - infoOK = false; - } - StringBuilder sb = new StringBuilder(); - if (!infoOK) { - sb.append("I"); - } - if (bericht.getObjectRef() != null) { - // substring om NL.KAD.OnroerendeZaak: eraf te - // strippen - sb.append(bericht.getObjectRef().substring(22)); - } else { - sb.append((new Date()).getTime()); - } - sb.append("_"); - if (bericht.getDatum() != null) { - sb.append(bericht.getDatum().getTime()); - } else { - sb.append("O"); - sb.append((new Date()).getTime()); - } - sb.append("_"); - sb.append(bericht.getVolgordeNummer()); - sb.append(".xml"); - - ZipEntry e1 = new ZipEntry(sb.toString()); - try { - out.putNextEntry(e1); - byte[] data; - if (infoOK) { - data = bericht.getBrOrgineelXml().getBytes(StandardCharsets.UTF_8); - } else { - data = "ERROR".getBytes(StandardCharsets.UTF_8); - } - out.write(data, 0, data.length); - } catch (ZipException ze) { - LOG.info(ze.getLocalizedMessage()); - } finally { - out.closeEntry(); - } - } catch (Exception e1) { - return e1; - } - processed.increment(); - } - return null; - }); - if (out != null) { - out.close(); - } - LOG.info("Klaar met schrijven naar export bestand " + f); - offset += processed.intValue(); - - progress(offset); - - // If handler threw exception processing row, rethrow it - if (e != null) { - closeQuietly(conn); - throw e; - } - } while (processed.intValue() > 0); - closeQuietly(conn); - } public void cleanupBerichten(String config, String soort) throws Exception { final int offset = 0; @@ -1209,99 +909,4 @@ public void fixNHRTypering(String soort, String status) closeQuietly(conn); } - public void fillbestandsNaamHersteld(String soort, String config) throws Exception { - int offset = 0; - int batch = 100; - final MutableInt _processed = new MutableInt(0); - final DataSource dataSourceRsgb = ConfigUtil.getDataSourceStaging(); - final Connection conn = dataSourceRsgb.getConnection(); - final GeometryJdbcConverter geomToJdbc = - GeometryJdbcConverterFactory.getGeometryJdbcConverter(conn); - final RowProcessor processor = new StagingRowHandler(); - - String countsql = - "select count(*) from " - + BrmoFramework.BERICHT_TABLE - + " where soort='" - + soort - + "' " - + " and volgordenummer > " - + config; - - Number o = - new QueryRunner(geomToJdbc.isPmdKnownBroken()).query(conn, countsql, new ScalarHandler<>()); - if (o instanceof BigDecimal) { - total(o.longValue()); - } else if (o instanceof Integer) { - total(o.longValue()); - } else { - total((Long) o); - } - - do { - LOG.debug( - String.format( - "Ophalen berichten batch met offset %d, limit %d, voortgang %f", - offset, batch, progress)); - String sql = - "select * from " - + BrmoFramework.BERICHT_TABLE - + " where soort='" - + soort - + "' " - + " and volgordenummer > " - + config - + " order by id "; - sql = geomToJdbc.buildPaginationSql(sql, offset, batch); - LOG.debug("SQL voor ophalen berichten batch: " + sql); - - _processed.setValue(0); - Exception e = - new QueryRunner(geomToJdbc.isPmdKnownBroken()) - .query( - conn, - sql, - (ResultSetHandler) - rs -> { - while (rs.next()) { - try { - final Bericht bericht = processor.toBean(rs, Bericht.class); - final BrkBericht brkBericht = new BrkBericht(bericht.getBrXml()); - brkBericht.setBrOrgineelXml(bericht.getBrOrgineelXml()); - final String bestandsnaamHersteld = - brkBericht.getRestoredFileName( - bericht.getDatum(), bericht.getVolgordeNummer()); - LOG.debug( - String.format( - "Bijwerken bestand_naam_hersteld voor laadproces %d met waarde '%s' op basis van bericht %d", - bericht.getLaadProcesId(), - bestandsnaamHersteld, - bericht.getId())); - new QueryRunner(geomToJdbc.isPmdKnownBroken()) - .update( - conn, - "update " - + BrmoFramework.LAADPROCES_TABEL - + " set bestand_naam_hersteld = ? where id = ?", - bestandsnaamHersteld, - bericht.getLaadProcesId()); - } catch (SQLException e1) { - return e1; - } - _processed.increment(); - } - return null; - }); - offset += _processed.intValue(); - - progress(this.processed + _processed.intValue()); - - // If handler threw exception processing row, rethrow it - if (e != null) { - closeQuietly(conn); - throw e; - } - } while (_processed.intValue() > 0); - closeQuietly(conn); - } } From c7b0425e4709ee8adf32c0743f8aa8fdf3393ba0 Mon Sep 17 00:00:00 2001 From: Mark Prins <1165786+mprins@users.noreply.github.com> Date: Tue, 26 Nov 2024 13:18:30 +0100 Subject: [PATCH 3/8] BRMO-374: Verwijder de BRK 1 xslt stylesheet en `BrkSnapshotXMLReader` --- .../nl/b3p/brmo/loader/BrmoFramework.java | 1 - .../java/nl/b3p/brmo/loader/RsgbProxy.java | 69 +- .../java/nl/b3p/brmo/loader/StagingProxy.java | 5 +- .../brmo/loader/xml/BrkSnapshotXMLReader.java | 207 ---- .../xsl/brk-snapshot-to-rsgb-xml.xsl | 921 ------------------ .../resources/xsl/update-incompleetadres.xsl | 5 +- .../xsl/update-niet_ingezetene-clazz.xsl | 1 - .../scanner/AbstractExecutableProces.java | 42 +- .../service/scanner/GDS2OphalenProces.java | 30 +- .../stripes/AdvancedFunctionsActionBean.java | 7 - .../stripes/OphaalConfigActionBean.java | 33 +- 11 files changed, 62 insertions(+), 1259 deletions(-) delete mode 100644 brmo-loader/src/main/java/nl/b3p/brmo/loader/xml/BrkSnapshotXMLReader.java delete mode 100644 brmo-loader/src/main/resources/xsl/brk-snapshot-to-rsgb-xml.xsl diff --git a/brmo-loader/src/main/java/nl/b3p/brmo/loader/BrmoFramework.java b/brmo-loader/src/main/java/nl/b3p/brmo/loader/BrmoFramework.java index 2d7bbb8d68..1b6a128bee 100644 --- a/brmo-loader/src/main/java/nl/b3p/brmo/loader/BrmoFramework.java +++ b/brmo-loader/src/main/java/nl/b3p/brmo/loader/BrmoFramework.java @@ -49,7 +49,6 @@ public class BrmoFramework { public static final String BR_GBAV = "gbav"; public static final String BR_WOZ = "woz"; - public static final String XSL_BRK = "/xsl/brk-snapshot-to-rsgb-xml.xsl"; public static final String XSL_BRK2 = "/xsl/brk2-snapshot-to-rsgb-xml.xsl"; public static final String XSL_NHR = "/xsl/nhr-to-rsgb-xml-3.0.xsl"; public static final String XSL_BRP = "/xsl/brp-to-rsgb-xml.xsl"; diff --git a/brmo-loader/src/main/java/nl/b3p/brmo/loader/RsgbProxy.java b/brmo-loader/src/main/java/nl/b3p/brmo/loader/RsgbProxy.java index 91a15568e1..ea69390372 100644 --- a/brmo-loader/src/main/java/nl/b3p/brmo/loader/RsgbProxy.java +++ b/brmo-loader/src/main/java/nl/b3p/brmo/loader/RsgbProxy.java @@ -1,6 +1,5 @@ package nl.b3p.brmo.loader; -import java.io.IOException; import java.io.PrintWriter; import java.io.StringReader; import java.io.StringWriter; @@ -26,7 +25,6 @@ import javax.sql.DataSource; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerException; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamSource; import nl.b3p.brmo.loader.entity.Bericht; @@ -49,7 +47,6 @@ import org.javasimon.Split; import org.locationtech.jts.io.ParseException; import org.w3c.dom.Node; -import org.xml.sax.SAXException; /** * @author Boy de Wit @@ -646,39 +643,6 @@ public void update(Bericht jobBericht, List pretransformedTableData) metaData = this.dbMetadataBrk; } - // TODO BRK2 bepalen of dit nog nodig is voor BRK2 - if (updateProcess.isUpdateDbXml() && jobBericht.getSoort().equals(BrmoFramework.BR_BRK)) { - try { - // maak nieuwe DbXml voor het bericht op basis van de br xml en gebruik die in - // verdere verwerking - Bericht berichtBericht = stagingProxy.getBerichtById(jobBericht.getId()); - log.trace("job bericht: " + jobBericht); - log.trace("origineel bericht: " + berichtBericht); - RsgbTransformer t = new RsgbTransformer(BrmoFramework.XSL_BRK); - final String newDbXml = t.transformToDbXml(berichtBericht); - berichtBericht.setDbXml(newDbXml); - jobBericht.setDbXml(newDbXml); - berichtBericht.setStatus(Bericht.STATUS.RSGB_OK); - berichtBericht.setStatusDatum(new Date()); - SimpleDateFormat dateTimeFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); - berichtBericht.setOpmerking( - String.format( - "%s: Middels update proces '%s' her-verwerkt.\nDe eerdere db_xml van dit bericht is vervangen door nieuwe.\n\nOude verwerkingslog\n\n%s", - dateTimeFormat.format(new Date()), - updateProcess.getName(), - berichtBericht.getOpmerking())); - log.trace("updated bericht: " + jobBericht); - log.trace("job bericht: " + jobBericht); - stagingProxy.updateBerichtProcessing(berichtBericht); - } catch (SAXException - | IOException - | TransformerException - | ParserConfigurationException - | SQLException e) { - log.error("Bijwerken van db_xml is mislukt voor bericht " + jobBericht.getId(), e); - } - } - try { if (conn.getAutoCommit()) { conn.setAutoCommit(false); @@ -727,28 +691,17 @@ private RsgbTransformer getTransformer(String brType) throws TransformerConfigurationException, ParserConfigurationException { RsgbTransformer t = rsgbTransformers.get(brType); if (t == null) { - switch (brType) { - case BrmoFramework.BR_BRK: - t = new RsgbTransformer(BrmoFramework.XSL_BRK); - break; - case BrmoFramework.BR_BRK2: - t = new RsgbTransformer(BrmoFramework.XSL_BRK2); - break; - case BrmoFramework.BR_BRP: - t = new RsgbBRPTransformer(BrmoFramework.XSL_BRP, this.stagingProxy); - break; - case BrmoFramework.BR_NHR: - t = new RsgbTransformer(BrmoFramework.XSL_NHR); - break; - case BrmoFramework.BR_GBAV: - t = new RsgbTransformer(BrmoFramework.XSL_GBAV); - break; - case BrmoFramework.BR_WOZ: - t = new RsgbWOZTransformer(BrmoFramework.XSL_WOZ, this.stagingProxy); - break; - default: - throw new IllegalArgumentException("Onbekende basisregistratie: " + brType); - } + t = + switch (brType) { + case BrmoFramework.BR_BRK2 -> new RsgbTransformer(BrmoFramework.XSL_BRK2); + case BrmoFramework.BR_BRP -> + new RsgbBRPTransformer(BrmoFramework.XSL_BRP, this.stagingProxy); + case BrmoFramework.BR_NHR -> new RsgbTransformer(BrmoFramework.XSL_NHR); + case BrmoFramework.BR_GBAV -> new RsgbTransformer(BrmoFramework.XSL_GBAV); + case BrmoFramework.BR_WOZ -> + new RsgbWOZTransformer(BrmoFramework.XSL_WOZ, this.stagingProxy); + default -> throw new IllegalArgumentException("Onbekende basisregistratie: " + brType); + }; rsgbTransformers.put(brType, t); } return t; diff --git a/brmo-loader/src/main/java/nl/b3p/brmo/loader/StagingProxy.java b/brmo-loader/src/main/java/nl/b3p/brmo/loader/StagingProxy.java index 08c9d25b08..be06de86ea 100644 --- a/brmo-loader/src/main/java/nl/b3p/brmo/loader/StagingProxy.java +++ b/brmo-loader/src/main/java/nl/b3p/brmo/loader/StagingProxy.java @@ -28,7 +28,6 @@ import nl.b3p.brmo.loader.util.TableData; import nl.b3p.brmo.loader.xml.BRPXMLReader; import nl.b3p.brmo.loader.xml.Brk2SnapshotXMLReader; -import nl.b3p.brmo.loader.xml.BrkSnapshotXMLReader; import nl.b3p.brmo.loader.xml.BrmoXMLReader; import nl.b3p.brmo.loader.xml.GbavXMLReader; import nl.b3p.brmo.loader.xml.NhrXMLReader; @@ -851,9 +850,7 @@ public void loadBr( CountingInputStream cis = new CountingInputStream(stream); BrmoXMLReader brmoXMLReader; - if (type.equals(BrmoFramework.BR_BRK)) { - brmoXMLReader = new BrkSnapshotXMLReader(cis); - } else if (type.equals(BrmoFramework.BR_BRK2)) { + if (type.equals(BrmoFramework.BR_BRK2)) { brmoXMLReader = new Brk2SnapshotXMLReader(cis); } else if (type.equals(BrmoFramework.BR_NHR)) { brmoXMLReader = new NhrXMLReader(cis); diff --git a/brmo-loader/src/main/java/nl/b3p/brmo/loader/xml/BrkSnapshotXMLReader.java b/brmo-loader/src/main/java/nl/b3p/brmo/loader/xml/BrkSnapshotXMLReader.java deleted file mode 100644 index 92aed5ba6f..0000000000 --- a/brmo-loader/src/main/java/nl/b3p/brmo/loader/xml/BrkSnapshotXMLReader.java +++ /dev/null @@ -1,207 +0,0 @@ -package nl.b3p.brmo.loader.xml; - -import java.io.InputStream; -import java.io.StringWriter; -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLOutputFactory; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamWriter; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.stax.StAXResult; -import javax.xml.transform.stax.StAXSource; -import nl.b3p.brmo.loader.BrmoFramework; -import nl.b3p.brmo.loader.entity.BrkBericht; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * reader of BRK stand files - * - * @author Boy de Wit - */ -public class BrkSnapshotXMLReader extends BrmoXMLReader { - - private static final Log log = LogFactory.getLog(BrkSnapshotXMLReader.class); - - private final XMLInputFactory factory; - private final XMLStreamReader streamReader; - private final Transformer transformer; - - private static final String KAD_OBJ_SNAP = "KadastraalObjectSnapshot"; - // gebied - private static final String PRODUCTSPECIFICATIE = "productSpecificatie"; - private static final String KENMERKNAAM = "kenmerknaam"; - private static final String KENMERKWAARDE = "kenmerkwaarde"; - // burgerlijke gemeente - private static final String BRK_DATUM = "BRKDatum"; - private static final String GEMEENTE = "naamBurgerlijkeGemeente"; - private static final String MUTATIE = "Mutatie"; - private static final String NS_MUTATIE = - "http://www.kadaster.nl/schemas/brk-levering/product-mutatie/v20120901"; - private static final String NS_XLINK = "http://www.w3.org/1999/xlink"; - - private static class MutatieGegevens { - boolean inMutatieObjectRef = false; - String mutatieObjectRef = null; - boolean isMutatieZonderWordt = true; - Integer volgnummerKadastraalObjectDatum = null; - } - - private MutatieGegevens mutatieGegevens = null; - - public BrkSnapshotXMLReader(InputStream in) - throws XMLStreamException, TransformerConfigurationException { - - factory = XMLInputFactory.newInstance(); - factory.setProperty(XMLInputFactory.SUPPORT_DTD, false); - factory.setProperty("javax.xml.stream.isSupportingExternalEntities", false); - streamReader = factory.createXMLStreamReader(in); - TransformerFactory tf = TransformerFactory.newInstance(); - transformer = tf.newTransformer(); - - init(); - } - - @Override - public void init() throws XMLStreamException { - soort = BrmoFramework.BR_BRK; - positionToNext(); - } - - /** - * Positioneer de XML stream aan het start element voor een KadastraalObjectSnapshot (als child - * van een GemeenteGebaseerdeStand:stand of als child van een Mutatie:wordt) of aan het end - * element voor een Mutatie:Mutatie zonder Mutatie:wordt (vervallen perceel). - * - * @throws XMLStreamException if any - */ - private void positionToNext() throws XMLStreamException { - boolean inMutatie = false; - mutatieGegevens = null; - boolean inGemeente = false; - boolean inWas = false; - boolean inProductSpecificatie = false; - String inProductSpecificatieNaam = null; - while (streamReader.hasNext()) { - if (streamReader.isStartElement()) { - if (!inWas && streamReader.getLocalName().equals(KAD_OBJ_SNAP)) { - // KadastraalObjectSnapshot gevonden niet in "was" van mutatie, - // hou streamReader op dit start element voor next() - break; - } - if (streamReader.getLocalName().equals(BRK_DATUM)) { - // GemeenteGebaseerdeStand:BRKDatum:BRKDatum of Mutatie:BRKDatum - setDatumAsString(streamReader.getElementText()); - } else if (streamReader.getLocalName().equals(PRODUCTSPECIFICATIE)) { - inProductSpecificatie = true; - } else if (inProductSpecificatie && streamReader.getLocalName().equals(KENMERKNAAM)) { - inProductSpecificatieNaam = streamReader.getElementText(); - } else if (inProductSpecificatie && streamReader.getLocalName().equals(KENMERKWAARDE)) { - if ("Peildatum".equals(inProductSpecificatieNaam)) { - setDatumAsString(streamReader.getElementText()); - } else if ("Gebiednummer".equals(inProductSpecificatieNaam)) { - setGebied(streamReader.getElementText()); - } - } else if (streamReader.getLocalName().equals(GEMEENTE)) { - inGemeente = true; - } else if (inGemeente && streamReader.getLocalName().equals("waarde")) { - setGebied(streamReader.getElementText()); - } else if (streamReader.getLocalName().equals(MUTATIE)) { - inMutatie = true; - mutatieGegevens = new MutatieGegevens(); - } else if (inMutatie - && streamReader.getLocalName().equals("volgnummerKadastraalObjectDatum")) { - mutatieGegevens.volgnummerKadastraalObjectDatum = - Integer.parseInt(streamReader.getElementText()); - } else if (inMutatie - && streamReader.getLocalName().equals("kadastraalObject") - && streamReader.getNamespaceURI().equals(NS_MUTATIE)) { - // Mutatie:AanduidingKadastraalObject -> Mutatie:kadastraalObject -> - // (AppartementsrechtRef | PerceelRef) - mutatieGegevens.inMutatieObjectRef = true; - } else if (inMutatie && mutatieGegevens.inMutatieObjectRef) { - // Haal id op van Appartementsrecht of PerceelRef - mutatieGegevens.mutatieObjectRef = streamReader.getAttributeValue(NS_XLINK, "href"); - if (mutatieGegevens.mutatieObjectRef != null) { - int i = mutatieGegevens.mutatieObjectRef.lastIndexOf('.'); - if (i != -1) { - mutatieGegevens.mutatieObjectRef = - mutatieGegevens.mutatieObjectRef.substring(0, i) - + ':' - + mutatieGegevens.mutatieObjectRef.substring(i + 1); - } - } - mutatieGegevens.inMutatieObjectRef = false; - } else if (inMutatie && streamReader.getLocalName().equals("was")) { - // Bij mutatie "was" skippen - inWas = true; - } else if (inMutatie && streamReader.getLocalName().equals("wordt")) { - mutatieGegevens.isMutatieZonderWordt = false; - } - } else if (streamReader.isEndElement()) { - if (streamReader.getLocalName().equals(PRODUCTSPECIFICATIE)) { - inProductSpecificatie = false; - inProductSpecificatieNaam = null; - } - if (streamReader.getLocalName().equals(GEMEENTE)) { - inGemeente = false; - } - if (streamReader.getLocalName().equals("was")) { - inWas = false; - } - if (inMutatie && streamReader.getLocalName().equals(MUTATIE)) { - break; - } - } - - streamReader.next(); - } - } - - @Override - public boolean hasNext() { - try { - return mutatieGegevens != null && mutatieGegevens.isMutatieZonderWordt - || streamReader.hasNext(); - } catch (XMLStreamException ex) { - log.error("Error while streaming XML", ex); - } - return false; - } - - @Override - public BrkBericht next() throws TransformerException, XMLStreamException { - BrkBericht b; - - if (mutatieGegevens != null && mutatieGegevens.isMutatieZonderWordt) { - // Vervallen perceel - b = new BrkBericht(""); - - b.setVervallenInfo(mutatieGegevens.mutatieObjectRef, getBestandsDatum()); - b.setVolgordeNummer(mutatieGegevens.volgnummerKadastraalObjectDatum); - } else { - StringWriter sw = new StringWriter(); - - // Vanwege splitsing is repairen van namespaces nodig, anders ontbreekt - // de namespace prefix declaratie xmlns:xlink="http://www.w3.org/1999/xlink" - // in de output en mislukt de XSL transformatie - XMLOutputFactory of = XMLOutputFactory.newInstance(); - of.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE); - XMLStreamWriter writer = of.createXMLStreamWriter(sw); - - transformer.transform(new StAXSource(streamReader), new StAXResult(writer)); - b = new BrkBericht(sw.toString()); - // volgende gegevens komen uit de header, in bericht worden gegevens verder aangevuld. - b.setVolgordeNummer( - mutatieGegevens != null ? mutatieGegevens.volgnummerKadastraalObjectDatum : -1); - b.setDatum(getBestandsDatum()); - b.setObjectRef(mutatieGegevens != null ? mutatieGegevens.mutatieObjectRef : null); - } - positionToNext(); - return b; - } -} diff --git a/brmo-loader/src/main/resources/xsl/brk-snapshot-to-rsgb-xml.xsl b/brmo-loader/src/main/resources/xsl/brk-snapshot-to-rsgb-xml.xsl deleted file mode 100644 index 4155767064..0000000000 --- a/brmo-loader/src/main/resources/xsl/brk-snapshot-to-rsgb-xml.xsl +++ /dev/null @@ -1,921 +0,0 @@ - - - - - - - - - - - - - - objectRef: - - , datum: - - , volgordeNummer: - - , soort: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ZAK_RECHT - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - KADASTRAAL PERCEEL - APPARTEMENTSRECHT - - - - - - - - - - - - - - - J - N - - - - - - - - - - - - - - - - - - - ( - - meer adressen) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Ja - Nee - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ZAK_RECHT - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - KAD_ONRRND_ZAAK_AANTEK - - - - - - - - - - - - - - - - - - - - - - - - - - - - KAD_ONRRND_ZAAK_AANTEK - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ANDER NATUURLIJK PERSOON - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - INGESCHREVEN NATUURLIJK PERSOON - - - - - - - - - - - - - - - - - - - - - - - - - - - INGESCHREVEN NATUURLIJK PERSOON - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - INGESCHREVEN NIET-NATUURLIJK PERSOON - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - P - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - deel: - - , nummer: - - , registercode: - - , soortregister: - - - - - - - - AKR Portefeuille Nr: - - - - - - - - KAD_PERCEEL - - - - - - - - - APP_RE - - - - - - - - - - - - - - - - - - - BRONDOCUMENT - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - . - - - - - - Postbus , - - - , - - - BAG ID: - - - , , , - - - , , , - - - - - - - - - diff --git a/brmo-loader/src/main/resources/xsl/update-incompleetadres.xsl b/brmo-loader/src/main/resources/xsl/update-incompleetadres.xsl index 18f1f405cd..a74a471f6c 100644 --- a/brmo-loader/src/main/resources/xsl/update-incompleetadres.xsl +++ b/brmo-loader/src/main/resources/xsl/update-incompleetadres.xsl @@ -93,10 +93,7 @@ - - + Postbus , diff --git a/brmo-loader/src/main/resources/xsl/update-niet_ingezetene-clazz.xsl b/brmo-loader/src/main/resources/xsl/update-niet_ingezetene-clazz.xsl index 75b7ee9fce..ab8455af46 100644 --- a/brmo-loader/src/main/resources/xsl/update-niet_ingezetene-clazz.xsl +++ b/brmo-loader/src/main/resources/xsl/update-niet_ingezetene-clazz.xsl @@ -61,7 +61,6 @@ - . diff --git a/brmo-service/src/main/java/nl/b3p/brmo/service/scanner/AbstractExecutableProces.java b/brmo-service/src/main/java/nl/b3p/brmo/service/scanner/AbstractExecutableProces.java index 400e3cd508..bd4de863fa 100644 --- a/brmo-service/src/main/java/nl/b3p/brmo/service/scanner/AbstractExecutableProces.java +++ b/brmo-service/src/main/java/nl/b3p/brmo/service/scanner/AbstractExecutableProces.java @@ -39,23 +39,29 @@ public abstract class AbstractExecutableProces implements ProcesExecutable { */ public static ProcesExecutable getProces(AutomatischProces config) { ProcessingImple imple = ProcessingImple.valueOf(config.getClass().getSimpleName()); - return switch (imple) { - case BAG2MutatieProces -> new BAG2MutatieProcesRunner((BAG2MutatieProces) config); - case BRK2ScannerProces -> new BRK2DirectoryScanner((BRK2ScannerProces) config); - case MailRapportageProces -> new MailRapportage((MailRapportageProces) config); - case GDS2OphaalProces -> new GDS2OphalenProces((GDS2OphaalProces) config); - case BerichtTransformatieProces -> new BerichtTransformatieUitvoeren((BerichtTransformatieProces) config); - case BerichtDoorstuurProces -> new BerichtDoorsturenProces((BerichtDoorstuurProces) config); - case LaadprocesTransformatieProces -> - new LaadprocesTransformatieUitvoeren((LaadprocesTransformatieProces) config); - case MaterializedViewRefresh -> new MaterializedViewRefreshUitvoeren((MaterializedViewRefresh) config); - case BerichtstatusRapportProces -> new BerichtstatusRapport((BerichtstatusRapportProces) config); - case LaadprocesStatusRapportProces -> new LaadprocesStatusRapport((LaadprocesStatusRapportProces) config); - case TopNLScannerProces -> new TopNLDirectoryScanner((TopNLScannerProces) config); - case AfgifteNummerScannerProces -> new AfgifteNummerScanner((AfgifteNummerScannerProces) config); - case BGTLoaderProces -> new BGTLoader((BGTLoaderProces) config); - default -> throw new IllegalArgumentException(imple.name() + " is is geen ondersteund proces..."); - }; + return switch (imple) { + case BAG2MutatieProces -> new BAG2MutatieProcesRunner((BAG2MutatieProces) config); + case BRK2ScannerProces -> new BRK2DirectoryScanner((BRK2ScannerProces) config); + case MailRapportageProces -> new MailRapportage((MailRapportageProces) config); + case GDS2OphaalProces -> new GDS2OphalenProces((GDS2OphaalProces) config); + case BerichtTransformatieProces -> + new BerichtTransformatieUitvoeren((BerichtTransformatieProces) config); + case BerichtDoorstuurProces -> new BerichtDoorsturenProces((BerichtDoorstuurProces) config); + case LaadprocesTransformatieProces -> + new LaadprocesTransformatieUitvoeren((LaadprocesTransformatieProces) config); + case MaterializedViewRefresh -> + new MaterializedViewRefreshUitvoeren((MaterializedViewRefresh) config); + case BerichtstatusRapportProces -> + new BerichtstatusRapport((BerichtstatusRapportProces) config); + case LaadprocesStatusRapportProces -> + new LaadprocesStatusRapport((LaadprocesStatusRapportProces) config); + case TopNLScannerProces -> new TopNLDirectoryScanner((TopNLScannerProces) config); + case AfgifteNummerScannerProces -> + new AfgifteNummerScanner((AfgifteNummerScannerProces) config); + case BGTLoaderProces -> new BGTLoader((BGTLoaderProces) config); + default -> + throw new IllegalArgumentException(imple.name() + " is is geen ondersteund proces..."); + }; } @Override @@ -89,7 +95,7 @@ public void run() { *
    * loadFromFile(bericht)
    * 	→ stagingProxy.loadBr(InputStream stream, String type, String fileName,...)
-   * 	→ snapshot reader van de input stream parsed het bericht in een BrkSnapshotXMLReader of Brk2SnapshotXMLReader die bericht voor bericht uitgelezen kunnen worden
+   * 	→ snapshot reader van de input stream parsed het bericht in een Brk2SnapshotXMLReader die bericht voor bericht uitgelezen kunnen worden
    * 	→ bepaal of laadproces bestaat stagingProxy.laadProcesExists(filenaam/datum)
    * 	→ laadproces in database maken stagingProxy.writeLaadProces(bestand_naam/bestand_datum/soort/gebied/opmerking/status/status_datum/contact_email)
    * 	→ uitlezen xml bericht als
diff --git a/brmo-service/src/main/java/nl/b3p/brmo/service/scanner/GDS2OphalenProces.java b/brmo-service/src/main/java/nl/b3p/brmo/service/scanner/GDS2OphalenProces.java
index 8a336c6b78..f2cba0afbc 100644
--- a/brmo-service/src/main/java/nl/b3p/brmo/service/scanner/GDS2OphalenProces.java
+++ b/brmo-service/src/main/java/nl/b3p/brmo/service/scanner/GDS2OphalenProces.java
@@ -45,12 +45,9 @@
 import javax.persistence.*;
 import javax.xml.ws.BindingProvider;
 import javax.xml.ws.handler.Handler;
-import nl.b3p.brmo.loader.BrmoFramework;
 import nl.b3p.brmo.loader.entity.Brk2Bericht;
-import nl.b3p.brmo.loader.entity.BrkBericht;
 import nl.b3p.brmo.loader.util.BrmoException;
 import nl.b3p.brmo.loader.xml.Brk2SnapshotXMLReader;
-import nl.b3p.brmo.loader.xml.BrkSnapshotXMLReader;
 import nl.b3p.brmo.persistence.staging.AutomatischProces;
 import nl.b3p.brmo.persistence.staging.Bericht;
 import nl.b3p.brmo.persistence.staging.ClobElement;
@@ -613,25 +610,14 @@ private Bericht laadAfgifte(AfgifteType a, String url, String brkSoort) throws E
       Date brDatum;
       Integer brVolgordeNummer;
       String brObjectRef;
-      if (BrmoFramework.BR_BRK.equals(brkSoort)) {
-        BrkSnapshotXMLReader reader =
-            new BrkSnapshotXMLReader(
-                new ByteArrayInputStream(b.getBr_orgineel_xml().getBytes(StandardCharsets.UTF_8)));
-        BrkBericht parsedBericht = reader.next();
-        brXML = parsedBericht.getBrXml();
-        brDatum = parsedBericht.getDatum();
-        brVolgordeNummer = parsedBericht.getVolgordeNummer();
-        brObjectRef = parsedBericht.getObjectRef();
-      } else {
-        Brk2SnapshotXMLReader reader2 =
-            new Brk2SnapshotXMLReader(
-                new ByteArrayInputStream(b.getBr_orgineel_xml().getBytes(StandardCharsets.UTF_8)));
-        Brk2Bericht parsedBericht = reader2.next();
-        brXML = parsedBericht.getBrXml();
-        brDatum = parsedBericht.getDatum();
-        brVolgordeNummer = parsedBericht.getVolgordeNummer();
-        brObjectRef = parsedBericht.getObjectRef();
-      }
+      Brk2SnapshotXMLReader reader2 =
+          new Brk2SnapshotXMLReader(
+              new ByteArrayInputStream(b.getBr_orgineel_xml().getBytes(StandardCharsets.UTF_8)));
+      Brk2Bericht parsedBericht = reader2.next();
+      brXML = parsedBericht.getBrXml();
+      brDatum = parsedBericht.getDatum();
+      brVolgordeNummer = parsedBericht.getVolgordeNummer();
+      brObjectRef = parsedBericht.getObjectRef();
 
       if (null != brDatum) {
         b.setDatum(brDatum);
diff --git a/brmo-service/src/main/java/nl/b3p/brmo/service/stripes/AdvancedFunctionsActionBean.java b/brmo-service/src/main/java/nl/b3p/brmo/service/stripes/AdvancedFunctionsActionBean.java
index 76b68b4492..1f68ec58df 100644
--- a/brmo-service/src/main/java/nl/b3p/brmo/service/stripes/AdvancedFunctionsActionBean.java
+++ b/brmo-service/src/main/java/nl/b3p/brmo/service/stripes/AdvancedFunctionsActionBean.java
@@ -19,9 +19,6 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipException;
-import java.util.zip.ZipOutputStream;
 import javax.sql.DataSource;
 import net.sourceforge.stripes.action.ActionBean;
 import net.sourceforge.stripes.action.ActionBeanContext;
@@ -39,7 +36,6 @@
 import nl.b3p.brmo.loader.StagingProxy;
 import nl.b3p.brmo.loader.advancedfunctions.AdvancedFunctionProcess;
 import nl.b3p.brmo.loader.entity.Bericht;
-import nl.b3p.brmo.loader.entity.BrkBericht;
 import nl.b3p.brmo.loader.util.BrmoException;
 import nl.b3p.brmo.loader.util.StagingRowHandler;
 import nl.b3p.brmo.loader.xml.WozXMLReader;
@@ -47,7 +43,6 @@
 import nl.b3p.jdbc.util.converter.GeometryJdbcConverter;
 import nl.b3p.jdbc.util.converter.GeometryJdbcConverterFactory;
 import org.apache.commons.dbutils.QueryRunner;
-import org.apache.commons.dbutils.ResultSetHandler;
 import org.apache.commons.dbutils.RowProcessor;
 import org.apache.commons.dbutils.handlers.ScalarHandler;
 import org.apache.commons.lang3.exception.ExceptionUtils;
@@ -365,7 +360,6 @@ private void replayWOZVerwerking() throws Exception {
     }
   }
 
-
   public void cleanupBerichten(String config, String soort) throws Exception {
     final int offset = 0;
     int progress = 0;
@@ -908,5 +902,4 @@ public void fixNHRTypering(String soort, String status)
     }
     closeQuietly(conn);
   }
-
 }
diff --git a/brmo-service/src/main/java/nl/b3p/brmo/service/stripes/OphaalConfigActionBean.java b/brmo-service/src/main/java/nl/b3p/brmo/service/stripes/OphaalConfigActionBean.java
index 236c86e501..d13a41ee05 100644
--- a/brmo-service/src/main/java/nl/b3p/brmo/service/stripes/OphaalConfigActionBean.java
+++ b/brmo-service/src/main/java/nl/b3p/brmo/service/stripes/OphaalConfigActionBean.java
@@ -177,22 +177,23 @@ public Resolution save() {
    * @return an instance of the specified type
    */
   private AutomatischProces getProces(ProcesExecutable.ProcessingImple type) {
-      return switch (type) {
-          case BAG2MutatieProces -> new BAG2MutatieProces();
-          case BRK2ScannerProces -> new BRK2ScannerProces();
-          case MailRapportageProces -> new MailRapportageProces();
-          case GDS2OphaalProces -> new GDS2OphaalProces();
-          case BerichtTransformatieProces -> new BerichtTransformatieProces();
-          case BerichtDoorstuurProces -> new BerichtDoorstuurProces();
-          case LaadprocesTransformatieProces -> new LaadprocesTransformatieProces();
-          case MaterializedViewRefresh -> new MaterializedViewRefresh();
-          case BerichtstatusRapportProces -> new BerichtstatusRapportProces();
-          case LaadprocesStatusRapportProces -> new LaadprocesStatusRapportProces();
-          case TopNLScannerProces -> new TopNLScannerProces();
-          case AfgifteNummerScannerProces -> new AfgifteNummerScannerProces();
-          case BGTLoaderProces -> new BGTLoaderProces();
-          default -> throw new IllegalArgumentException(type.name() + " is geen ondersteund proces type...");
-      };
+    return switch (type) {
+      case BAG2MutatieProces -> new BAG2MutatieProces();
+      case BRK2ScannerProces -> new BRK2ScannerProces();
+      case MailRapportageProces -> new MailRapportageProces();
+      case GDS2OphaalProces -> new GDS2OphaalProces();
+      case BerichtTransformatieProces -> new BerichtTransformatieProces();
+      case BerichtDoorstuurProces -> new BerichtDoorstuurProces();
+      case LaadprocesTransformatieProces -> new LaadprocesTransformatieProces();
+      case MaterializedViewRefresh -> new MaterializedViewRefresh();
+      case BerichtstatusRapportProces -> new BerichtstatusRapportProces();
+      case LaadprocesStatusRapportProces -> new LaadprocesStatusRapportProces();
+      case TopNLScannerProces -> new TopNLScannerProces();
+      case AfgifteNummerScannerProces -> new AfgifteNummerScannerProces();
+      case BGTLoaderProces -> new BGTLoaderProces();
+      default ->
+          throw new IllegalArgumentException(type.name() + " is geen ondersteund proces type...");
+    };
   }
 
   private ProcesExecutable.ProcessingImple getType(AutomatischProces p) {

From 87a3488beaf2d38c2304263ce6566511997e01fc Mon Sep 17 00:00:00 2001
From: Mark Prins <1165786+mprins@users.noreply.github.com>
Date: Tue, 26 Nov 2024 13:38:14 +0100
Subject: [PATCH 4/8] BRMO-374: Verwijder BR_BRK bericht soort

- Verwijder geavanceerde functie "Opschonen en archiveren van BRK berichten met status RSGB_OK, ouder dan 3 maanden"
- Verwijder snelle updates: "Toevoegen BSN aan ingeschreven natuurlijk persoon", "Toevoegen RSIN aan ingeschreven niet-natuurlijk persoon", "Bijwerken van omschrijving, datum en ref_id in brondocument", "Bijwerken van onvolledig adres", "Bijwerken van rechthebbende VVE op zakelijk recht", "Bijwerken van GBA Niet Ingezetene 'clazz' in personen tabellen", "Bijwerken subject adres comfort data", "Bijwerken ingangsdatum_recht zakelijk recht"
---
 .../nl/b3p/brmo/loader/BrmoFramework.java     |  11 +-
 .../java/nl/b3p/brmo/loader/StagingProxy.java |  13 +-
 .../nl/b3p/brmo/loader/entity/BrkBericht.java | 169 ------------------
 .../service/scanner/GDS2OphalenProces.java    |  11 +-
 .../stripes/AdvancedFunctionsActionBean.java  |   7 -
 .../service/stripes/UpdatesActionBean.java    |  33 ----
 .../WEB-INF/jsp/beheer/editgds2proces.jsp     |   1 -
 .../main/webapp/WEB-INF/jsp/bestand/form.jsp  |   2 -
 8 files changed, 11 insertions(+), 236 deletions(-)
 delete mode 100644 brmo-loader/src/main/java/nl/b3p/brmo/loader/entity/BrkBericht.java

diff --git a/brmo-loader/src/main/java/nl/b3p/brmo/loader/BrmoFramework.java b/brmo-loader/src/main/java/nl/b3p/brmo/loader/BrmoFramework.java
index 1b6a128bee..3b70136ab9 100644
--- a/brmo-loader/src/main/java/nl/b3p/brmo/loader/BrmoFramework.java
+++ b/brmo-loader/src/main/java/nl/b3p/brmo/loader/BrmoFramework.java
@@ -41,7 +41,6 @@ public class BrmoFramework {
 
   private static final Log log = LogFactory.getLog(BrmoFramework.class);
 
-  public static final String BR_BRK = "brk";
   public static final String BR_BRK2 = "brk2";
   public static final String BR_NHR = "nhr";
   public static final String BR_TOPNL = "topnl";
@@ -427,7 +426,7 @@ protected synchronized void afterRead(int n) throws IOException {
   /**
    * laden van BR data uit een stream.
    *
-   * @param type type registratie, bijv. {@value BrmoFramework#BR_BRK}
+   * @param type type registratie, bijv. {@value BrmoFramework#BR_BRK2}
    * @param stream datastream
    * @param fileName te gebruiken bestandsnaam om laadproces te identificeren
    * @throws BrmoException als er een algemene fout optreed
@@ -445,7 +444,7 @@ public void loadFromStream(String type, InputStream stream, String fileName)
   /**
    * laden van BR data uit een stream.
    *
-   * @param type type registratie, bijv. {@value BrmoFramework#BR_BRK}
+   * @param type type registratie, bijv. {@value BrmoFramework#BR_BRK2}
    * @param stream datastream
    * @param fileName te gebruiken bestandsnaam om laadproces te identificeren
    * @param automatischProces id van automatisch proces dat deze functie aanroept
@@ -472,7 +471,7 @@ public void loadFromStream(
   /**
    * laden van BR data uit een stream.
    *
-   * @param type type registratie, bijv. {@value BrmoFramework#BR_BRK}
+   * @param type type registratie, bijv. {@value BrmoFramework#BR_BRK2}
    * @param stream datastream
    * @param fileName te gebruiken bestandsnaam om laadproces te identificeren
    * @param d bestandsdatum
@@ -490,7 +489,7 @@ public void loadFromStream(String type, InputStream stream, String fileName, Dat
   /**
    * laden van BR data uit een stream.
    *
-   * @param type type registratie, bijv. {@value BrmoFramework#BR_BRK}
+   * @param type type registratie, bijv. {@value BrmoFramework#BR_BRK2}
    * @param stream datastream
    * @param fileName te gebruiken bestandsnaam om laadproces te identificeren
    * @param d bestandsdatum
@@ -518,7 +517,7 @@ public void loadFromStream(
   /**
    * laden van BR data uit een stream.
    *
-   * @param type type registratie, bijv. {@value BrmoFramework#BR_BRK}
+   * @param type type registratie, bijv. {@value BrmoFramework#BR_BRK2}
    * @param stream datastream
    * @param fileName te gebruiken bestandsnaam om laadproces te identificeren
    * @param listener mag {@code null} zijn
diff --git a/brmo-loader/src/main/java/nl/b3p/brmo/loader/StagingProxy.java b/brmo-loader/src/main/java/nl/b3p/brmo/loader/StagingProxy.java
index be06de86ea..dedff9be16 100644
--- a/brmo-loader/src/main/java/nl/b3p/brmo/loader/StagingProxy.java
+++ b/brmo-loader/src/main/java/nl/b3p/brmo/loader/StagingProxy.java
@@ -15,7 +15,6 @@
 import nl.b3p.brmo.loader.entity.Bericht;
 import nl.b3p.brmo.loader.entity.BerichtenSorter;
 import nl.b3p.brmo.loader.entity.Brk2Bericht;
-import nl.b3p.brmo.loader.entity.BrkBericht;
 import nl.b3p.brmo.loader.entity.LaadProces;
 import nl.b3p.brmo.loader.pipeline.BerichtTypeOfWork;
 import nl.b3p.brmo.loader.pipeline.BerichtWorkUnit;
@@ -812,7 +811,7 @@ public List getBerichten() throws SQLException {
    * Laadt het bestand uit de stream in de database.
    *
    * @param stream input
-   * @param type type registratie, bijv. {@value BrmoFramework#BR_BRK}
+   * @param type type registratie, bijv. {@value BrmoFramework#BR_BRK2}
    * @param fileName naam van het bestand (ter identificatie)
    * @param d bestandsdatum
    * @param listener progress listener
@@ -831,7 +830,7 @@ public void loadBr(
    * Laadt het bestand uit de stream in de database.
    *
    * @param stream input
-   * @param type type registratie, bijv. {@value BrmoFramework#BR_BRK}
+   * @param type type registratie, bijv. {@value BrmoFramework#BR_BRK2}
    * @param fileName naam van het bestand (ter identificatie)
    * @param d bestandsdatum
    * @param automatischProces id van het automatisch proces
@@ -928,14 +927,6 @@ public void loadBr(
           log.debug(b);
 
           Bericht existingBericht = getExistingBericht(b);
-          if (type.equals(BrmoFramework.BR_BRK) && !isBerichtGeschreven) {
-            // haal alleen voor eerste
-            BrkBericht brkBericht = (BrkBericht) b;
-            lp.setBestandNaamHersteld(
-                brkBericht.getRestoredFileName(lp.getBestandDatum(), b.getVolgordeNummer()));
-            updateLaadProcesBestandNaamHersteld(lp);
-          }
-
           // TODO BRK2 bepalen of dit nog nodig is voor BRK2
           if (type.equals(BrmoFramework.BR_BRK2) && !isBerichtGeschreven) {
             // haal alleen voor eerste
diff --git a/brmo-loader/src/main/java/nl/b3p/brmo/loader/entity/BrkBericht.java b/brmo-loader/src/main/java/nl/b3p/brmo/loader/entity/BrkBericht.java
deleted file mode 100644
index 45a2970bc0..0000000000
--- a/brmo-loader/src/main/java/nl/b3p/brmo/loader/entity/BrkBericht.java
+++ /dev/null
@@ -1,169 +0,0 @@
-package nl.b3p.brmo.loader.entity;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathExpression;
-import javax.xml.xpath.XPathExpressionException;
-import javax.xml.xpath.XPathFactory;
-import nl.b3p.brmo.loader.BrmoFramework;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.w3c.dom.Document;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-/**
- * @author Boy de Wit
- */
-public class BrkBericht extends Bericht {
-
-  private final String soort = BrmoFramework.BR_BRK;
-  private boolean xpathEvaluated = false;
-
-  private static final Log log = LogFactory.getLog(BrkBericht.class);
-
-  public BrkBericht(String brXml) {
-    super(brXml);
-  }
-
-  public void setVervallenInfo(String objectRef, Date datum) {
-    this.objectRef = objectRef;
-    this.datum = datum;
-
-    xpathEvaluated = true;
-  }
-
-  private void evaluateXPath() {
-    if (xpathEvaluated) {
-      return;
-    }
-
-    xpathEvaluated = true;
-
-    if (objectRef != null && datum != null) {
-      // al uit de header gehaald
-      return;
-    }
-
-    // dit moet dus een standberciht zijn
-    try {
-
-      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-      DocumentBuilder builder = factory.newDocumentBuilder();
-      Document doc = builder.parse(new InputSource(new StringReader(getBrXml())));
-
-      XPathFactory xPathfactory = XPathFactory.newInstance();
-      XPath xpath = xPathfactory.newXPath();
-
-      XPathExpression expr =
-          xpath.compile(
-              "/KadastraalObjectSnapshot/*[local-name()= 'Perceel' or local-name()='Appartementsrecht']/identificatie/namespace/text()");
-      objectRef = expr.evaluate(doc);
-
-      expr =
-          xpath.compile(
-              "/KadastraalObjectSnapshot/*[local-name()= 'Perceel' or local-name()='Appartementsrecht']/identificatie/lokaalId/text()");
-      objectRef += ":" + expr.evaluate(doc);
-
-      expr =
-          xpath.compile(
-              "/KadastraalObjectSnapshot/*[local-name()= 'toestandsdatum' or local-name()='toestandsdatum']/text()");
-      setDatumAsString(expr.evaluate(doc));
-    } catch (Exception e) {
-      log.error("Error while getting brk referentie", e);
-    }
-  }
-
-  public void setDatumAsString(String d) {
-    if (d == null || d.isEmpty()) {
-      return;
-    }
-
-    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
-    try {
-      datum = sdf.parse(d);
-    } catch (ParseException pe) {
-      log.error("Error while parsing date: " + datum, pe);
-    }
-  }
-
-  @Override
-  public String getObjectRef() {
-    evaluateXPath();
-
-    return objectRef;
-  }
-
-  @Override
-  public Date getDatum() {
-    evaluateXPath();
-
-    return datum;
-  }
-
-  public String getRestoredFileName(Date bestanddatum, Integer volgordenummer) {
-    try {
-      final SimpleDateFormat output = new SimpleDateFormat("yyyyMMdd");
-
-      String prefix = "BKE-MUTBX01";
-      String kadGemCode;
-      String perceelnummer;
-      String brkdatum = output.format(bestanddatum);
-      String sectie;
-      String appartementsrechtVolgnummer;
-
-      String basePath =
-          "/KadastraalObjectSnapshot/*[local-name()= 'Perceel' or local-name()='Appartementsrecht']/kadastraleAanduiding/";
-      XPathFactory xPathfactory = XPathFactory.newInstance();
-      XPath xpath = xPathfactory.newXPath();
-      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-      DocumentBuilder builder = factory.newDocumentBuilder();
-      Document doc = builder.parse(new InputSource(new StringReader(this.getBrXml())));
-
-      // in geval van een verwijderbericht is de "wordt" leeg, db_xml 
-      if (this.getBrXml().contains("") && StringUtils.isNotBlank(this.getBrOrgineelXml())) {
-        // dan proberen om de db_origineel_xml te gebruiken.
-        basePath = "/Mutatie/kadastraalObject/AanduidingKadastraalObject/kadastraleAanduiding/";
-        doc = builder.parse(new InputSource(new StringReader(this.getBrOrgineelXml())));
-      }
-
-      XPathExpression expr = xpath.compile(basePath + "AKRKadastraleGemeenteCode/waarde/text()");
-      kadGemCode = expr.evaluate(doc);
-
-      expr = xpath.compile(basePath + "sectie/text()");
-      sectie = expr.evaluate(doc);
-
-      expr = xpath.compile(basePath + "perceelnummer/text()");
-      perceelnummer = expr.evaluate(doc);
-
-      expr = xpath.compile(basePath + "appartementsrechtVolgnummer/text()");
-      appartementsrechtVolgnummer = expr.evaluate(doc);
-      if (StringUtils.isNotBlank(appartementsrechtVolgnummer)) {
-        appartementsrechtVolgnummer = "A" + appartementsrechtVolgnummer;
-      }
-
-      String aanduiding = kadGemCode + sectie + perceelnummer + appartementsrechtVolgnummer;
-      log.debug("gevonden aanduiding voor herstelde bestandsnaam: " + aanduiding);
-      String filename = "bestandsnaam kon niet worden hersteld";
-      if (StringUtils.isNotBlank(aanduiding)) {
-        filename =
-            prefix + "-" + aanduiding + "-" + brkdatum + "-" + volgordenummer.toString() + ".zip";
-      }
-      return filename;
-    } catch (ParserConfigurationException
-        | XPathExpressionException
-        | SAXException
-        | IOException ex) {
-      log.error("Cannot create filename from xml: ", ex);
-      return "";
-    }
-  }
-}
diff --git a/brmo-service/src/main/java/nl/b3p/brmo/service/scanner/GDS2OphalenProces.java b/brmo-service/src/main/java/nl/b3p/brmo/service/scanner/GDS2OphalenProces.java
index f2cba0afbc..f9f572b11b 100644
--- a/brmo-service/src/main/java/nl/b3p/brmo/service/scanner/GDS2OphalenProces.java
+++ b/brmo-service/src/main/java/nl/b3p/brmo/service/scanner/GDS2OphalenProces.java
@@ -461,13 +461,10 @@ public void execute(ProgressUpdateListener listener) {
 
       final String soort =
           this.config.getConfig().getOrDefault("gds2_br_soort", new ClobElement("brk")).getValue();
-      switch (soort) {
-        case "brk2":
-        case "brk":
-          verwerkAfgiftes(afgiftes, getCertificaatBaseURL(response.getAntwoord()), soort);
-          break;
-        default:
-          throw new BrmoException("Onbekende basisregistratie soort: " + soort);
+      if (soort.equals("brk2")) {
+        verwerkAfgiftes(afgiftes, getCertificaatBaseURL(response.getAntwoord()), soort);
+      } else {
+        throw new BrmoException("Onbekende basisregistratie soort: " + soort);
       }
 
     } catch (Exception e) {
diff --git a/brmo-service/src/main/java/nl/b3p/brmo/service/stripes/AdvancedFunctionsActionBean.java b/brmo-service/src/main/java/nl/b3p/brmo/service/stripes/AdvancedFunctionsActionBean.java
index 1f68ec58df..4eb1bddda2 100644
--- a/brmo-service/src/main/java/nl/b3p/brmo/service/stripes/AdvancedFunctionsActionBean.java
+++ b/brmo-service/src/main/java/nl/b3p/brmo/service/stripes/AdvancedFunctionsActionBean.java
@@ -201,10 +201,6 @@ public void populateAdvancedFunctionProcesses() {
     // https://github.com/B3Partners/brmo/wiki/Geavanceerde-functies
     advancedFunctionProcesses =
         Arrays.asList(
-            new AdvancedFunctionProcess(
-                "Opschonen en archiveren van BRK berichten met status RSGB_OK, ouder dan 3 maanden",
-                BrmoFramework.BR_BRK,
-                Bericht.STATUS.RSGB_OK.toString()),
             new AdvancedFunctionProcess(
                 NHR_ARCHIVING, BrmoFramework.BR_NHR, Bericht.STATUS.RSGB_OK.toString()),
             new AdvancedFunctionProcess(
@@ -241,9 +237,6 @@ public Resolution perform() {
     // Get berichten
     try {
       switch (process.getName()) {
-        case "Opschonen en archiveren van BRK berichten met status RSGB_OK, ouder dan 3 maanden":
-          cleanupBerichten(process.getConfig(), "brk");
-          break;
         case NHR_ARCHIVING:
           cleanupBerichten(process.getConfig(), BrmoFramework.BR_NHR);
           break;
diff --git a/brmo-service/src/main/java/nl/b3p/brmo/service/stripes/UpdatesActionBean.java b/brmo-service/src/main/java/nl/b3p/brmo/service/stripes/UpdatesActionBean.java
index f0830f7022..cff5acfcad 100644
--- a/brmo-service/src/main/java/nl/b3p/brmo/service/stripes/UpdatesActionBean.java
+++ b/brmo-service/src/main/java/nl/b3p/brmo/service/stripes/UpdatesActionBean.java
@@ -159,39 +159,6 @@ public void populateUpdateProcesses() {
             new UpdateProcess[] {
               // bij een nieuw proces ook de wiki bijwerken:
               // https://github.com/B3Partners/brmo/wiki/Snelle-updates
-              new UpdateProcess(
-                  "Toevoegen BSN aan ingeschreven natuurlijk persoon",
-                  BrmoFramework.BR_BRK,
-                  "/xsl/update-bsn.xsl"),
-              new UpdateProcess(
-                  "Toevoegen RSIN aan ingeschreven niet-natuurlijk persoon",
-                  BrmoFramework.BR_BRK,
-                  "/xsl/update-rsin.xsl"),
-              new UpdateProcess(
-                  "Bijwerken van omschrijving, datum en ref_id in brondocument",
-                  BrmoFramework.BR_BRK,
-                  "/xsl/update-brondocument.xsl"),
-              new UpdateProcess(
-                  "Bijwerken van onvolledig adres",
-                  BrmoFramework.BR_BRK,
-                  "/xsl/update-incompleetadres.xsl"),
-              new UpdateProcess(
-                  "Bijwerken van rechthebbende VVE op zakelijk recht",
-                  BrmoFramework.BR_BRK,
-                  "/xsl/update-zak_recht-vve.xsl"),
-              new UpdateProcess(
-                  "Bijwerken van GBA Niet Ingezetene 'clazz' in personen tabellen",
-                  BrmoFramework.BR_BRK,
-                  "/xsl/update-niet_ingezetene-clazz.xsl"),
-              new UpdateProcess(
-                  "Bijwerken subject adres comfort data",
-                  BrmoFramework.BR_BRK,
-                  "/xsl/update-comfort-adres.xsl"),
-              new UpdateProcess(
-                  "Bijwerken ingangsdatum_recht zakelijk recht",
-                  BrmoFramework.BR_BRK,
-                  "/xsl/update-zak_recht-begindatum.xsl",
-                  true),
               new UpdateProcess(
                   "Bijwerken vestiging activiteit",
                   BrmoFramework.BR_NHR,
diff --git a/brmo-service/src/main/webapp/WEB-INF/jsp/beheer/editgds2proces.jsp b/brmo-service/src/main/webapp/WEB-INF/jsp/beheer/editgds2proces.jsp
index 4207e50251..cf33416e5b 100644
--- a/brmo-service/src/main/webapp/WEB-INF/jsp/beheer/editgds2proces.jsp
+++ b/brmo-service/src/main/webapp/WEB-INF/jsp/beheer/editgds2proces.jsp
@@ -27,7 +27,6 @@
     Bericht soort:
     
             BRK 2
-            BRK
         
     
 
diff --git a/brmo-service/src/main/webapp/WEB-INF/jsp/bestand/form.jsp b/brmo-service/src/main/webapp/WEB-INF/jsp/bestand/form.jsp
index 6d4c5731bc..07417bccdd 100644
--- a/brmo-service/src/main/webapp/WEB-INF/jsp/bestand/form.jsp
+++ b/brmo-service/src/main/webapp/WEB-INF/jsp/bestand/form.jsp
@@ -15,7 +15,6 @@
                         
                             
                             BRK 2
-                            BRK
                             nHR
                             GBAV
                             WOZ
@@ -39,7 +38,6 @@
                         
                             
                             BRK 2
-                            BRK
                             nHR
                             GBAV
                             WOZ

From f420a26c1149c76d22cc07771d9256eb8c533e46 Mon Sep 17 00:00:00 2001
From: Mark Prins <1165786+mprins@users.noreply.github.com>
Date: Tue, 26 Nov 2024 13:49:37 +0100
Subject: [PATCH 5/8] BRMO-374: Verwijder niet langer gebruikte XSLT
 stylesheets

Opruimen van:

- update-brondocument.xsl
- update-bsn.xsl
- update-comfort-adres.xsl
- update-incompleetadres.xsl
- update-niet_ingezetene-clazz.xsl
- update-rsin.xsl
- update-zak_recht-begindatum.xsl
- update-zak_recht-vve.xsl
---
 .../resources/xsl/update-brondocument.xsl     | 234 -----------
 .../src/main/resources/xsl/update-bsn.xsl     |  66 ---
 .../resources/xsl/update-comfort-adres.xsl    | 389 ------------------
 .../resources/xsl/update-incompleetadres.xsl  | 130 ------
 .../xsl/update-niet_ingezetene-clazz.xsl      | 180 --------
 .../src/main/resources/xsl/update-rsin.xsl    |  28 --
 .../xsl/update-zak_recht-begindatum.xsl       | 168 --------
 .../resources/xsl/update-zak_recht-vve.xsl    |  75 ----
 8 files changed, 1270 deletions(-)
 delete mode 100644 brmo-loader/src/main/resources/xsl/update-brondocument.xsl
 delete mode 100644 brmo-loader/src/main/resources/xsl/update-bsn.xsl
 delete mode 100644 brmo-loader/src/main/resources/xsl/update-comfort-adres.xsl
 delete mode 100644 brmo-loader/src/main/resources/xsl/update-incompleetadres.xsl
 delete mode 100644 brmo-loader/src/main/resources/xsl/update-niet_ingezetene-clazz.xsl
 delete mode 100644 brmo-loader/src/main/resources/xsl/update-rsin.xsl
 delete mode 100644 brmo-loader/src/main/resources/xsl/update-zak_recht-begindatum.xsl
 delete mode 100644 brmo-loader/src/main/resources/xsl/update-zak_recht-vve.xsl

diff --git a/brmo-loader/src/main/resources/xsl/update-brondocument.xsl b/brmo-loader/src/main/resources/xsl/update-brondocument.xsl
deleted file mode 100644
index 8c9efa6717..0000000000
--- a/brmo-loader/src/main/resources/xsl/update-brondocument.xsl
+++ /dev/null
@@ -1,234 +0,0 @@
-
-
-
-
-
-
-    
-
-    
-        
-            
-
-                
-
-                
-                    
-                
-   
-                
-                    
-                        
-                            
-                        
-                    
-                    
-                        
-                            ZAK_RECHT
-                            
-                            
-                        
-                    
-                
-
-                
-                    
-                
-            
-        
-    
-
-    
-        
-            
-                
-            
-        
-        
-            
-                ZAK_RECHT
-                
-                
-            
-        
-    
-
-    
-        
-            
-                
-            
-        
-
-        
-            
-                
-                    KAD_ONRRND_ZAAK_AANTEK
-                    
-                    
-                
-            
-        
-        
-            
-                
-                    KAD_ONRRND_ZAAK_AANTEK
-                    
-                    
-                
-            
-        
-    
-
-    
-        
-            
-                
-            
-        
-    
-        
-            
-                
-            
-            
-                
-                    
-                        
-                            deel: 
-                            
-                            , nummer: 
-                            
-                            , registercode: 
-                            
-                            , soortregister: 
-                            
-                        
-                    
-                
-                
-                    
-                        
-                            AKR Portefeuille Nr: 
-                            
-                        
-                    
-                
-            
-
-            
-                
-                    KAD_PERCEEL
-                    
-                        
-                    
-                    
-                        
-                    
-                
-                
-                    APP_RE
-                    
-                        
-                    
-                    
-                        
-                    
-                
-            
-        
-
-        
-            
-                
-                    
-                        
-                    
-                
-                BRONDOCUMENT
-                
-                    
-                
-                
-                    
-                        
-                    
-                
-                
-                    
-                        
-                    
-                
-                
-                    
-                
-            
-        
-    
-
-    
-        
-        
-        
-        
-
-        
-            
-            
-                
-                    
-                        
-                    
-                
-                
-                    
-                
-                
-                    
-                
-                
-                    
-                        
-                    
-                
-                
-                    
-                
-                
-                    
-                        
-                    
-                
-            
-        
-    
-
-    
-        
-        .
-    
-
-
diff --git a/brmo-loader/src/main/resources/xsl/update-bsn.xsl b/brmo-loader/src/main/resources/xsl/update-bsn.xsl
deleted file mode 100644
index edfccd8b3a..0000000000
--- a/brmo-loader/src/main/resources/xsl/update-bsn.xsl
+++ /dev/null
@@ -1,66 +0,0 @@
-
-
-	
-		
-			
-				
-					
-						
-							
-						
-					
-				
-			
-		
-	
-	
-		
-		
-			
-				
-			
-		
-		
-			
-		
-                
-                    
-                
-                
-                                
-                
-                
-                    
-                
-                
-                                
-                                        
-                                
-                
-                
-	
-		
-		.
-	
-	
-	
-		
-	
-	
-		
-			Postbus ,  
-		
-		
-			   ,  
-		
-		
-			BAG ID: 
-		
-		
-			, , , 
-		
-		
-			, , , 
-		
-	        
-
diff --git a/brmo-loader/src/main/resources/xsl/update-comfort-adres.xsl b/brmo-loader/src/main/resources/xsl/update-comfort-adres.xsl
deleted file mode 100644
index 643fc7ec8e..0000000000
--- a/brmo-loader/src/main/resources/xsl/update-comfort-adres.xsl
+++ /dev/null
@@ -1,389 +0,0 @@
-
-
-    
-    
-
-    
-        
-            
-                
-                    
-                
-                
-                    
-                
-                
-                    
-                
-            
-        
-    
-
-    
-    
-
-        
-        
-            
-                
-            
-        
-        
-
-            
-                
-                
-            
-            
-                
-                    
-                        
-                    
-                
-                ANDER NATUURLIJK PERSOON
-                
-                
-                
-                
-            
-            
-                
-                    
-                        
-                    
-                
-                
-                    
-                
-                
-                    
-                
-            
-        
-    
-
-    
-        
-        
-            
-                
-            
-        
-        
-
-            
-                
-                
-            
-            
-                INGESCHREVEN NATUURLIJK PERSOON
-                
-                    
-                
-            
-            
-                
-                    
-                
-            
-        
-    
-
-    
-        
-        
-            
-                
-            
-        
-        
-
-            
-                
-                
-            
-            
-                INGESCHREVEN NATUURLIJK PERSOON
-                
-                    
-                
-            
-            
-                
-                    
-                
-                
-            
-            
-                
-                    
-                    
-                    
-                        
-                    
-                
-            
-
-        
-    
-
-    
-        
-        
-            
-                
-            
-        
-        
-
-            
-                
-                
-            
-
-            
-                
-                    
-                    
-                
-            
-            
-                
-                    
-                        
-                    
-                
-                
-                
-            
-
-        
-    
-
-    
-        
-        
-            
-                
-            
-        
-        
-
-            
-                
-                
-            
-
-            
-                
-                    
-                        
-                    
-                
-                INGESCHREVEN NIET-NATUURLIJK PERSOON
-                
-                    
-                
-            
-            
-                
-                    
-                        
-                    
-                
-                
-                
-                
-                    
-                
-            
-
-        
-    
-
-    
-    
-        
-        
-
-        
-            
-                
-                    
-                
-            
-            
-                
-            
-            
-                
-            
-            
-            
-                
-                    
-                        
-                            
-                        
-                        
-                    
-                
-            
-            
-            
-                
-            
-            
-            
-                
-                    P
-                
-            
-            
-                
-            
-
-        
-
-        
-            
-                
-                    
-                
-            
-            
-                
-            
-        
-    
-
-    
-        
-        
-            
-                
-            
-        
-        
-            
-        
-        
-            
-        
-        
-        
-            
-        
-        
-            
-        
-        
-            
-                
-            
-        
-    
-
-    
-        
-        
-            
-                
-            
-        
-        
-            
-        
-        
-            
-        
-        
-            
-        
-        
-            
-        
-        
-            
-        
-    
-
-    
-        
-        
-        
-            
-                
-            
-        
-        
-            
-        
-        
-            
-        
-    
-
-    
-        
-        .
-    
-
-    
-    
-        
-            Postbus ,  
-        
-        
-               ,  
-        
-        
-            BAG ID: 
-        
-        
-            , , , 
-        
-        
-            , , , 
-        
-    
-
-
-    
-    
-        
-    
-
-
\ No newline at end of file
diff --git a/brmo-loader/src/main/resources/xsl/update-incompleetadres.xsl b/brmo-loader/src/main/resources/xsl/update-incompleetadres.xsl
deleted file mode 100644
index a74a471f6c..0000000000
--- a/brmo-loader/src/main/resources/xsl/update-incompleetadres.xsl
+++ /dev/null
@@ -1,130 +0,0 @@
-
-
-
-    
-
-    
-        
-            
-                
-                    
-                        
-                            
-                        
-                        
-                        
-                            
-                        
-                        
-                            
-                                KADASTRAAL PERCEEL
-                                APPARTEMENTSRECHT
-                            
-                        
-                        
-                            
-                        
-                        
-                            
-                        
-                        
-                            
-                                
-                            
-                        
-                        
-                            J
-                            N
-                        
-
-                        
-                            
-                        
-                        
-                            
-                        
-
-                        
-                        
-                            
-                            
-                            
-                                
-                                
-                                    
-                                          (
-                                        
-                                         meer adressen)
-                                    
-                                    
-                                        
-                                    
-                                
-                            
-                        
-                    
-                
-            
-        
-    
-     
-        
-            Postbus , 
-             
-            
-        
-
-        
-            
-             
-            
-            
-                 
-                
-            
-            
-                 
-                
-            , 
-             
-            
-        
-        
-            BAG ID: 
-        
-        
-            , 
-            , , 
-        
-        
-            , 
-            , , 
-        
-    
-
diff --git a/brmo-loader/src/main/resources/xsl/update-niet_ingezetene-clazz.xsl b/brmo-loader/src/main/resources/xsl/update-niet_ingezetene-clazz.xsl
deleted file mode 100644
index ab8455af46..0000000000
--- a/brmo-loader/src/main/resources/xsl/update-niet_ingezetene-clazz.xsl
+++ /dev/null
@@ -1,180 +0,0 @@
-
-
-    
-    
-    
-        
-            
-                
-                    
-                        
-                            
-                        
-                    
-                    
-
-                        
-                            
-                            
-                        
-                        
-                        
-                            INGESCHREVEN NATUURLIJK PERSOON
-                            
-                                
-                            
-                        
-                        
-                        
-                            
-                                
-                            
-                        
-                        
-                        
-                            
-                                
-                                    
-                                
-                            
-                        
-                        
-                    
-                
-            
-        
-    
-
-    
-        
-        .
-    
-
-    
-        
-        
-
-        
-            
-                
-                    
-                
-            
-            
-                
-                    
-                
-            
-            
-                
-                    
-                
-            
-        
-
-        
-            
-                
-                    
-                
-            
-            
-                
-                    
-                
-            
-        
-    
-
-    
-        
-        
-            
-                
-            
-        
-        
-            
-        
-        
-            
-        
-        
-            
-                
-            
-        
-        
-            
-                
-            
-        
-        
-            
-                
-            
-        
-    
-
-    
-        
-        
-            
-                
-            
-        
-        
-            
-        
-        
-            
-        
-        
-            
-        
-        
-            
-        
-        
-            
-        
-    
-
-    
-        
-            Postbus ,  
-        
-        
-               ,  
-        
-        
-            BAG ID: 
-        
-        
-            , , , 
-        
-        
-            , , , 
-        
-    
-
-    
-        
-    
-
diff --git a/brmo-loader/src/main/resources/xsl/update-rsin.xsl b/brmo-loader/src/main/resources/xsl/update-rsin.xsl
deleted file mode 100644
index 45fce5b41b..0000000000
--- a/brmo-loader/src/main/resources/xsl/update-rsin.xsl
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-	
-		
-			
-				
-                    
-                    
-                        
-                            
-                                
-                            
-                        
-                        
-                        
-                        
-                            
-                                        
-                    
-				
-			
-		
-	
-	
-		
-		.
-	
-
diff --git a/brmo-loader/src/main/resources/xsl/update-zak_recht-begindatum.xsl b/brmo-loader/src/main/resources/xsl/update-zak_recht-begindatum.xsl
deleted file mode 100644
index 00cdedff11..0000000000
--- a/brmo-loader/src/main/resources/xsl/update-zak_recht-begindatum.xsl
+++ /dev/null
@@ -1,168 +0,0 @@
-
-
-    
-    
-    
-    
-    
-    
-    
-    
-    
-        
-            
-                objectRef: 
-                
-                , datum: 
-                
-                , volgordeNummer: 
-                
-                , soort: 
-                
-            
-            
-                
-                    
-                
-                
-                    
-                        
-                            
-                        
-                    
-                    
-                        
-                            
-                        
-                        
-                        
-                            
-                        
-                        
-                        
-                            
-                                
-                                
-                                    
-                                        
-                                    
-                                
-                            
-                        
-                        
-                            
-                        
-                    
-                
-            
-        
-    
-
-    
-        
-        
-            
-        
-        
-            
-        
-        
-            
-                Ja
-                Nee
-            
-        
-    
-
-    
-        
-
-        
-            
-                
-            
-        
-        
-            
-                
-            
-            
-            
-                
-                    
-                        
-                    
-                    
-                        
-                    
-                
-                
-                    
-                        
-                    
-                    
-                        
-                    
-                
-            
-            
-                
-            
-
-            
-                
-                    
-                    
-                        
-                            
-                        
-                    
-                
-            
-            
-                
-                    
-                    
-                        
-                            
-                                
-                            
-                        
-                        
-                            
-                                
-                            
-                        
-                    
-                
-            
-        
-    
-
-    
-        
-        .
-    
-
-
diff --git a/brmo-loader/src/main/resources/xsl/update-zak_recht-vve.xsl b/brmo-loader/src/main/resources/xsl/update-zak_recht-vve.xsl
deleted file mode 100644
index 2b15d78694..0000000000
--- a/brmo-loader/src/main/resources/xsl/update-zak_recht-vve.xsl
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-    
-    
-    
-        
-            
-                
-                    
-                    
-
-                        
-                            
-                                
-                            
-                        
-
-                        
-                            
-                                
-                            
-                            
-                                
-                            
-                            
-                                
-                                    
-                                    
-                                        
-                                            
-                                        
-                                    
-                                
-                            
-                        
-
-                    
-                
-            
-        
-    
-
-    
-        
-        
-            
-        
-        
-            
-        
-        
-            
-                Ja
-                Nee
-            
-        
-    
-
-    
-        
-        .
-    
-
\ No newline at end of file

From 81477f6d005f7ed376d09adec0b44e55d1b758ff Mon Sep 17 00:00:00 2001
From: Mark Prins <1165786+mprins@users.noreply.github.com>
Date: Tue, 26 Nov 2024 14:14:17 +0100
Subject: [PATCH 6/8] BRMO-374: opruimen van BRK 1 referenties

---
 .../java/nl/b3p/brmo/loader/RsgbProxy.java    |  4 ++--
 .../proxy/BerichtEndpointFileServlet.java     |  8 +++----
 .../proxy/BerichtEndpointProxyServlet.java    |  2 +-
 .../src/main/webapp/WEB-INF/web.xml           | 23 -------------------
 .../proxy/BerichtEndpointFileServletTest.java |  1 -
 .../stripes/AdvancedFunctionsActionBean.java  |  3 ---
 brmo-service/src/main/webapp/WEB-INF/web.xml  |  8 +------
 .../b3p/brmo/service/testutil/TestUtil.java   |  9 --------
 .../src/test/resources/web-invalid-jee6.xml   |  8 +++----
 .../src/test/resources/web-valid-jee6.xml     | 12 +++++-----
 .../src/test/resources/web-valid-jee7.xml     | 12 +++++-----
 .../src/test/resources/web-valid-jee8.xml     |  8 +++----
 docker/src/main/docker/Dockerfile             |  1 -
 .../tomcat_conf/Catalina/localhost/ROOT.xml   |  1 -
 14 files changed, 28 insertions(+), 72 deletions(-)

diff --git a/brmo-loader/src/main/java/nl/b3p/brmo/loader/RsgbProxy.java b/brmo-loader/src/main/java/nl/b3p/brmo/loader/RsgbProxy.java
index ea69390372..aa945d1994 100644
--- a/brmo-loader/src/main/java/nl/b3p/brmo/loader/RsgbProxy.java
+++ b/brmo-loader/src/main/java/nl/b3p/brmo/loader/RsgbProxy.java
@@ -986,7 +986,7 @@ private StringBuilder parseOldData(
    * formatting. De fallback optie voor formatting is {@code yyyy-MM-dd}, ondersteunde opties zijn:
    *
    * 
    - *
  • {@code yyyy-MM-dd} (BRK / BRK2) + *
  • {@code yyyy-MM-dd} (BRK2) *
  • {@code yyyyMMddHHmmssSSS0} (BAG) *
* @@ -995,7 +995,7 @@ private StringBuilder parseOldData( * @return formatted datum, indien mogelijk in de vorm van {@code otherDate} */ private String formatDateLikeOtherDate(Date newDate, String otherDate) { - // 2010-06-29 (BRK/BRK2) + // 2010-06-29 (BRK2) SimpleDateFormat dfltFmt = new SimpleDateFormat("yyyy-MM-dd"); // 201006291200000000 (BAG) SimpleDateFormat f2 = new SimpleDateFormat("yyyyMMddHHmmssSSS0"); diff --git a/brmo-proxyservice/src/main/java/nl/b3p/brmo/service/proxy/BerichtEndpointFileServlet.java b/brmo-proxyservice/src/main/java/nl/b3p/brmo/service/proxy/BerichtEndpointFileServlet.java index b88d744386..b15634d45a 100644 --- a/brmo-proxyservice/src/main/java/nl/b3p/brmo/service/proxy/BerichtEndpointFileServlet.java +++ b/brmo-proxyservice/src/main/java/nl/b3p/brmo/service/proxy/BerichtEndpointFileServlet.java @@ -21,15 +21,15 @@ * Endpoint servlet welke geposte bestanden opslaat in een directory conform de configuratie. Deze * servlet ondersteund gzip compressie. Voorbeeld:
* {@code curl -X POST -H "Content-Type: application/xml" - * http://localhost:8037/brmo-proxyservice/post/brk -d @'pom.xml'}
+ * http://localhost:8037/brmo-proxyservice/post/brk2 -d @'pom.xml'}
* of met gzip compressie:
* {@code curl -v -s --trace-ascii http_trace.log --data-binary @src/test/resources/web.xml.gz -H * "Content-Type: text/xml" -H "Content-Encoding: gzip" -X POST - * http://localhost:8037/brmo-proxyservice/post/brk}
+ * http://localhost:8037/brmo-proxyservice/post/brk2}
* of met certificaat authenticatie en wget:
* {@code wget --post-file="test.xml" --append-output=logs/wget.log --ca-cert=./ca.pem - * --certificate=./client.pem --private-key=./key.pem https://somehost.nl/brmo-proxyservice/post/brk - * -O - >> output.log} + * --certificate=./client.pem --private-key=./key.pem + * https://somehost.nl/brmo-proxyservice/post/brk2 -O - >> output.log} * * @author mprins */ diff --git a/brmo-proxyservice/src/main/java/nl/b3p/brmo/service/proxy/BerichtEndpointProxyServlet.java b/brmo-proxyservice/src/main/java/nl/b3p/brmo/service/proxy/BerichtEndpointProxyServlet.java index c1478a3337..667282ddce 100644 --- a/brmo-proxyservice/src/main/java/nl/b3p/brmo/service/proxy/BerichtEndpointProxyServlet.java +++ b/brmo-proxyservice/src/main/java/nl/b3p/brmo/service/proxy/BerichtEndpointProxyServlet.java @@ -19,7 +19,7 @@ /** * Endpoint servlet welke geposte bestanden doorstuurt naar de BRMO. Voorbeeld: {@code curl -X POST - * -H "Content-Type: application/xml" http://localhost:8084/brmo-proxyservice/post/brk + * -H "Content-Type: application/xml" http://localhost:8084/brmo-proxyservice/post/brk2 * -d @'/testbestanden/BRK_KLEIN_SNAPSHOT.xml'} * * @author mprins diff --git a/brmo-proxyservice/src/main/webapp/WEB-INF/web.xml b/brmo-proxyservice/src/main/webapp/WEB-INF/web.xml index 45a14537be..8798698d02 100644 --- a/brmo-proxyservice/src/main/webapp/WEB-INF/web.xml +++ b/brmo-proxyservice/src/main/webapp/WEB-INF/web.xml @@ -5,15 +5,6 @@ version="3.1" metadata-complete="true"> brmo-proxyservices - - BRK_file - nl.b3p.brmo.service.proxy.BerichtEndpointFileServlet - - directory waar bestanden terecht komen - save_dir - /var/opt/brmo/brk/ - - BRK2_file nl.b3p.brmo.service.proxy.BerichtEndpointFileServlet @@ -32,15 +23,6 @@ /var/opt/brmo/woz - - BRK_proxy - nl.b3p.brmo.service.proxy.BerichtEndpointProxyServlet - - BRMO endpoint waarnaartoe door-gepost wordt - proxy_for_url - http://localhost:8037/brmo-service/post/brk - - BRK2_proxy nl.b3p.brmo.service.proxy.BerichtEndpointProxyServlet @@ -59,11 +41,6 @@ http://localhost:8037/brmo-service/post/woz - - BRK_file - - /post/brk - BRK2_file diff --git a/brmo-proxyservice/src/test/java/nl/b3p/brmo/service/proxy/BerichtEndpointFileServletTest.java b/brmo-proxyservice/src/test/java/nl/b3p/brmo/service/proxy/BerichtEndpointFileServletTest.java index f6dfcdccf4..5aba43c300 100644 --- a/brmo-proxyservice/src/test/java/nl/b3p/brmo/service/proxy/BerichtEndpointFileServletTest.java +++ b/brmo-proxyservice/src/test/java/nl/b3p/brmo/service/proxy/BerichtEndpointFileServletTest.java @@ -78,7 +78,6 @@ void testPostBRK() throws Exception { new File(BerichtEndpointFileServletTest.class.getResource("/test.xml").getFile()); assertNotNull(expected, "Expected file not found"); // servlet schrijft naar saveDir, - // /tmp/brk/post-op__.xml File actual = Files.newDirectoryStream(new File(saveDir).toPath(), "*.{xml}").iterator().next().toFile(); diff --git a/brmo-service/src/main/java/nl/b3p/brmo/service/stripes/AdvancedFunctionsActionBean.java b/brmo-service/src/main/java/nl/b3p/brmo/service/stripes/AdvancedFunctionsActionBean.java index 4eb1bddda2..2516be819a 100644 --- a/brmo-service/src/main/java/nl/b3p/brmo/service/stripes/AdvancedFunctionsActionBean.java +++ b/brmo-service/src/main/java/nl/b3p/brmo/service/stripes/AdvancedFunctionsActionBean.java @@ -194,9 +194,6 @@ public void setAdvancedFunctionProcessName(String advancedFunctionProcessName) { @Before(stages = LifecycleStage.BindingAndValidation) public void populateAdvancedFunctionProcesses() { - String brkExportDir = this.getContext().getServletContext().getInitParameter("exportDir.brk"); - LOG.warn("Instellen BRK export directory op niet-default waarde: " + brkExportDir); - // bij een nieuw proces ook de wiki bijwerken: // https://github.com/B3Partners/brmo/wiki/Geavanceerde-functies advancedFunctionProcesses = diff --git a/brmo-service/src/main/webapp/WEB-INF/web.xml b/brmo-service/src/main/webapp/WEB-INF/web.xml index fbea0e5d89..70cf0ae155 100644 --- a/brmo-service/src/main/webapp/WEB-INF/web.xml +++ b/brmo-service/src/main/webapp/WEB-INF/web.xml @@ -8,7 +8,7 @@ Gebruik (true) multithreaded XSL transformatie/GML parse pipeline of niet (false). Om op correcte wijze WOZ en BRP berichten te kunnen verwerken dient deze op false te worden ingesteld - omdat deze geen was/wordt leveren, maar een (onvolledige) toestandmutatie. - Voor BRK/nHR berichten kan deze op true worden ingesteld. Eventueel kan dan ook de onderstaande pipelining.capacity worden aangepast. + Voor BRK2/nHR berichten kan deze op true worden ingesteld. Eventueel kan dan ook de onderstaande pipelining.capacity worden aangepast. pipelining.enabled false @@ -38,12 +38,6 @@ stand.transform.max 1000000 - - BRK export locatie, een bestaande directory waar de servlet container mag schrijven. - Default waarde is /tmp/brkmutaties - exportDir.brk - /tmp/brkmutaties - Aantal uitvoerende threads voor ingeplande taken. Default waarde is 1, bij hogere waarden dient de gebruiker er voor te zorgen dat er geen in de tijd overlappende transformatie of GDS2 processen van diff --git a/brmo-service/src/test/java/nl/b3p/brmo/service/testutil/TestUtil.java b/brmo-service/src/test/java/nl/b3p/brmo/service/testutil/TestUtil.java index 73e7e00cfa..75b515c598 100644 --- a/brmo-service/src/test/java/nl/b3p/brmo/service/testutil/TestUtil.java +++ b/brmo-service/src/test/java/nl/b3p/brmo/service/testutil/TestUtil.java @@ -151,15 +151,6 @@ public void endTest(TestInfo testInfo) { @AfterAll public static void closeConnections() throws SQLException { // JNDI connectie pools niet sluiten! - // if (dsStaging != null) { - // dsStaging.close(); - // } - // if (dsRsgb != null) { - // dsRsgb.close(); - // } - // if (dsRsgbBrk != null) { - // dsRsgbBrk.close(); - // } try { InitialContext ic = new InitialContext(); ic.unbind("java:comp/env/jdbc/brmo/rsgb"); diff --git a/brmo-test-util/src/test/resources/web-invalid-jee6.xml b/brmo-test-util/src/test/resources/web-invalid-jee6.xml index 8eaf38c73f..e777b7664f 100644 --- a/brmo-test-util/src/test/resources/web-invalid-jee6.xml +++ b/brmo-test-util/src/test/resources/web-invalid-jee6.xml @@ -6,17 +6,17 @@ metadata-complete="true"> brmo-proxyservices - BRK_file + BRK2_file nl.b3p.brmo.service.proxy.BerichtEndpointFileServlet save_dir - /var/opt/brmo/brk/ + /var/opt/brmo/brk2/ expres ongeldig - BRK_file - /post/brk + BRK2_file + /post/brk2 diff --git a/brmo-test-util/src/test/resources/web-valid-jee6.xml b/brmo-test-util/src/test/resources/web-valid-jee6.xml index 0f9d77f7dd..86755aaac6 100644 --- a/brmo-test-util/src/test/resources/web-valid-jee6.xml +++ b/brmo-test-util/src/test/resources/web-valid-jee6.xml @@ -6,12 +6,12 @@ metadata-complete="true"> brmo-proxyservices - BRK_file + BRK2_file nl.b3p.brmo.service.proxy.BerichtEndpointFileServlet directory waar bestanden terecht komen save_dir - /var/opt/brmo/brk/ + /var/opt/brmo/brk2/ @@ -24,7 +24,7 @@ - BRK_proxy + BRK2_proxy nl.b3p.brmo.service.proxy.BerichtEndpointProxyServlet BRMO endpoint waarnaartoe door-gepost wordt @@ -42,9 +42,9 @@ - BRK_file - - /post/brk + BRK2_file + + /post/brk2 BAG_file diff --git a/brmo-test-util/src/test/resources/web-valid-jee7.xml b/brmo-test-util/src/test/resources/web-valid-jee7.xml index e234116d4e..13c792b655 100644 --- a/brmo-test-util/src/test/resources/web-valid-jee7.xml +++ b/brmo-test-util/src/test/resources/web-valid-jee7.xml @@ -5,12 +5,12 @@ version="3.1"> brmo-proxyservices - BRK_file + BRK2_file nl.b3p.brmo.service.proxy.BerichtEndpointFileServlet directory waar bestanden terecht komen save_dir - /var/opt/brmo/brk/ + /var/opt/brmo/brk2/ @@ -23,12 +23,12 @@ - BRK_proxy + BRK2_proxy nl.b3p.brmo.service.proxy.BerichtEndpointProxyServlet BRMO endpoint waarnaartoe door-gepost wordt proxy_for_url - http://localhost:8037/brmo-service/post/brk + http://localhost:8037/brmo-service/post/brk2 @@ -41,9 +41,9 @@ - BRK_file + BRK2_file - /post/brk + /post/brk2 BAG_file diff --git a/brmo-test-util/src/test/resources/web-valid-jee8.xml b/brmo-test-util/src/test/resources/web-valid-jee8.xml index 659d65d955..ff27e0309a 100644 --- a/brmo-test-util/src/test/resources/web-valid-jee8.xml +++ b/brmo-test-util/src/test/resources/web-valid-jee8.xml @@ -5,12 +5,12 @@ version="4.0"> brmo-proxyservices - BRK_file + BRK2_file nl.b3p.brmo.service.proxy.BerichtEndpointFileServlet directory waar bestanden terecht komen save_dir - /var/opt/brmo/brk/ + /var/opt/brmo/brk2/ @@ -23,8 +23,8 @@ - BRK_file - /post/brk + BRK2_file + /post/brk2 BAG_file diff --git a/docker/src/main/docker/Dockerfile b/docker/src/main/docker/Dockerfile index 3ea003b6ab..eead8448a5 100644 --- a/docker/src/main/docker/Dockerfile +++ b/docker/src/main/docker/Dockerfile @@ -17,7 +17,6 @@ SHELL ["/bin/bash", "-eux", "-o", "pipefail", "-c"] RUN set -eux;ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \ && mkdir -p /opt/brmo-data/BGT/ \ && mkdir -p /opt/brmo-data/NHR/certificaten/ \ - && mkdir -p /opt/brmo-data/BRK/berichtendump \ && mkdir -p /opt/brmo-data/TOPNL/Top10NL/ \ && mkdir -p /opt/brmo-data/TOPNL/Top50NL/ \ && mkdir -p /opt/brmo-data/TOPNL/Top100NL/ \ diff --git a/docker/src/main/docker/tomcat_conf/Catalina/localhost/ROOT.xml b/docker/src/main/docker/tomcat_conf/Catalina/localhost/ROOT.xml index 158b4e32b5..5e79e2548f 100644 --- a/docker/src/main/docker/tomcat_conf/Catalina/localhost/ROOT.xml +++ b/docker/src/main/docker/tomcat_conf/Catalina/localhost/ROOT.xml @@ -35,5 +35,4 @@ - From 1578352acd6e16a8e1149a1215807fa7ae2d51e1 Mon Sep 17 00:00:00 2001 From: Mark Prins <1165786+mprins@users.noreply.github.com> Date: Tue, 26 Nov 2024 14:19:00 +0100 Subject: [PATCH 7/8] BRMO-374: opruimen ongebruikte functie om BRK verwijderberichten te herhalen --- .../stripes/AdvancedFunctionsActionBean.java | 138 +----------------- 1 file changed, 2 insertions(+), 136 deletions(-) diff --git a/brmo-service/src/main/java/nl/b3p/brmo/service/stripes/AdvancedFunctionsActionBean.java b/brmo-service/src/main/java/nl/b3p/brmo/service/stripes/AdvancedFunctionsActionBean.java index 2516be819a..d1ebfbf1e5 100644 --- a/brmo-service/src/main/java/nl/b3p/brmo/service/stripes/AdvancedFunctionsActionBean.java +++ b/brmo-service/src/main/java/nl/b3p/brmo/service/stripes/AdvancedFunctionsActionBean.java @@ -458,7 +458,6 @@ public void cleanupBerichten(String config, String soort) throws Exception { } public void deleteBerichten(String config, String soort) throws Exception { - final MutableInt processed = new MutableInt(0); final DataSource dataSourceStaging = ConfigUtil.getDataSourceStaging(); final Connection conn = dataSourceStaging.getConnection(); final GeometryJdbcConverter geomToJdbc = @@ -637,143 +636,10 @@ public void replayNHRVerwerking(String soort, String status) rsgb.close(); } - /** - * Deze actie loopt door de lijst brk verwijderberichten (={@code } br_xml) met status - * RSGB_OK om ze nogmaals naar de rsgb te transformeren. - * - * @param status bericht status - * @param soort soort bericht - * @throws SQLException if any - * @throws BrmoException if any - * @throws Exception if any - */ - public void replayBRKVerwijderBerichten(String soort, String status) - throws SQLException, BrmoException, Exception { - int offset = 0; - int batch = 1000; - final MutableInt processed = new MutableInt(0); - final DataSource dataSourceStaging = ConfigUtil.getDataSourceStaging(); - final DataSource dataSourceRsgb = ConfigUtil.getDataSourceRsgb(); - final Connection conn = dataSourceStaging.getConnection(); - final GeometryJdbcConverter geomToJdbc = - GeometryJdbcConverterFactory.getGeometryJdbcConverter(conn); - final RowProcessor processor = new StagingRowHandler(); - - LOG.debug("staging datasource: " + dataSourceStaging); - LOG.debug("rsgb datasource: " + dataSourceRsgb); - - String countsql = - "select count(id) from " - + BrmoFramework.BERICHT_TABLE - + " where soort='" - + soort - + "'" - + " and status='" - + status - + "'" - // gebruik like (en niet =) omdat anders ORA-00932 want br_xml is clob - + " and br_xml like ''"; - LOG.debug("SQL voor tellen van berichten batch: " + countsql); - Number o = - new QueryRunner(geomToJdbc.isPmdKnownBroken()).query(conn, countsql, new ScalarHandler<>()); - LOG.debug("Totaal te verwerken verwijder berichten: " + o); - - if (o instanceof BigDecimal) { - total(o.longValue()); - } else if (o instanceof Integer) { - total(o.longValue()); - } else { - total((Long) o); - } - - StagingProxy staging = new StagingProxy(dataSourceStaging); - RsgbProxy rsgb = new RsgbProxy(dataSourceRsgb, null, staging, Bericht.STATUS.RSGB_OK, this); - rsgb.setOrderBerichten(true); - rsgb.init(); - - do { - LOG.debug(String.format("Ophalen berichten batch met offset %d, limit %d", offset, batch)); - String sql = - "select * from " - + BrmoFramework.BERICHT_TABLE - + " where soort='" - + soort - + "'" - + " and status='" - + status - + "'" - + " and br_xml like ''" - + " order by id"; - sql = geomToJdbc.buildPaginationSql(sql, offset, batch); - LOG.debug("SQL voor ophalen berichten batch: " + sql); - - processed.setValue(0); - Exception e = - new QueryRunner(geomToJdbc.isPmdKnownBroken()) - .query( - conn, - sql, - rs -> { - while (rs.next()) { - try { - Bericht bericht = processor.toBean(rs, Bericht.class); - LOG.debug("Opnieuw verwerken van bericht: " + bericht); - // bewaar oude log - String oudeOpmerkingen = bericht.getOpmerking(); - // forceer verwerking door bericht op STAGING_OK te - // zetten en dan opnieuw te verwerken - bericht.setStatus(Bericht.STATUS.STAGING_OK); - new QueryRunner(geomToJdbc.isPmdKnownBroken()) - .update( - conn, - "update " - + BrmoFramework.BERICHT_TABLE - + " set status_datum = ?, status = ? where id = ?", - new Timestamp(bericht.getStatusDatum().getTime()), - bericht.getStatus().toString(), - bericht.getId()); - - rsgb.handle(bericht, rsgb.transformToTableData(bericht), true); - - bericht.setOpmerking( - "Opnieuw verwerkt met geavanceerde functies optie.\nNieuwe verwerkingslog (oude log daaronder)\n" - + bericht.getOpmerking() - + "\n\nOude verwerkingslog\n\n" - + oudeOpmerkingen); - bericht.setStatusDatum(new Date()); - new QueryRunner(geomToJdbc.isPmdKnownBroken()) - .update( - conn, - "update " - + BrmoFramework.BERICHT_TABLE - + " set opmerking = ? where id = ?", - bericht.getOpmerking(), - bericht.getId()); - } catch (Exception e1) { - return e1; - } - processed.increment(); - } - return null; - }); - offset += processed.intValue(); - - progress(offset); - - // If handler threw exception processing row, rethrow it - if (e != null) { - closeQuietly(conn); - throw e; - } - } while (processed.intValue() > 0); - closeQuietly(conn); - rsgb.close(); - } - /** * Verwijderen van enkele aanhalingstekens van typering en clazz van sommige nHR persoon records - * dmv SQL update. fix voor issue #527, {@code 'INGESCHREVEN NIET-NATUURLIJK PERSOON'} moet worden - * {@code INGESCHREVEN NIET-NATUURLIJK PERSOON} (evt. afgekort op 35 char voor de + * door middel van SQL update. Fix voor issue #527, {@code 'INGESCHREVEN NIET-NATUURLIJK PERSOON'} + * moet worden {@code INGESCHREVEN NIET-NATUURLIJK PERSOON} (evt. afgekort op 35 char voor de * 'ingeschr_niet_nat_prs' tabel/'typering' kolom) * * @param soort soort bericht From 67aaa7cfa3bd4f7f1d24e15170aa5add9df6ca81 Mon Sep 17 00:00:00 2001 From: Mark Prins <1165786+mprins@users.noreply.github.com> Date: Tue, 26 Nov 2024 16:10:53 +0100 Subject: [PATCH 8/8] BRMO-374: Staging upgrade scripts om niet langer bestaande jobs te verwijderen --- .../upgrade_scripts/4.0.0-5.0.0/oracle/staging.sql | 10 ++++++++++ .../upgrade_scripts/4.0.0-5.0.0/postgresql/staging.sql | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/datamodel/upgrade_scripts/4.0.0-5.0.0/oracle/staging.sql b/datamodel/upgrade_scripts/4.0.0-5.0.0/oracle/staging.sql index 83c53a5832..a859b78dd0 100644 --- a/datamodel/upgrade_scripts/4.0.0-5.0.0/oracle/staging.sql +++ b/datamodel/upgrade_scripts/4.0.0-5.0.0/oracle/staging.sql @@ -4,6 +4,16 @@ WHENEVER SQLERROR EXIT SQL.SQLCODE +-- opruimen van niet langer beschikbare automatische scanner processen +DELETE FROM automatisch_proces_config WHERE proces_id IN (SELECT id FROM automatisch_proces WHERE dtype IN ('BRKScannerProces')); +DELETE FROM automatisch_proces WHERE dtype IN ('BRKScannerProces'); + +-- BRK1 GDS2 processen verwijderen +CREATE TABLE tmp_pids AS (SELECT apc.proces_id FROM automatisch_proces_config apc WHERE to_char(apc.value)='brk' AND apc.config_key='gds2_br_soort'); +DELETE FROM automatisch_proces_config WHERE proces_id IN (SELECT proces_id FROM tmp_pids); +DELETE FROM automatisch_proces WHERE id IN (SELECT proces_id FROM tmp_pids); +DROP TABLE tmp_pids; + -- onderstaande dienen als laatste stappen van een upgrade uitgevoerd INSERT INTO brmo_metadata (naam,waarde) SELECT 'upgrade_4.0.0_naar_5.0.0','vorige versie was ' || waarde FROM brmo_metadata WHERE naam='brmoversie'; diff --git a/datamodel/upgrade_scripts/4.0.0-5.0.0/postgresql/staging.sql b/datamodel/upgrade_scripts/4.0.0-5.0.0/postgresql/staging.sql index a11dfcf41c..ab62244f11 100644 --- a/datamodel/upgrade_scripts/4.0.0-5.0.0/postgresql/staging.sql +++ b/datamodel/upgrade_scripts/4.0.0-5.0.0/postgresql/staging.sql @@ -1,7 +1,15 @@ -- -- upgrade PostgreSQL STAGING datamodel van 4.0.0 naar 5.0.0 -- +-- opruimen van niet langer beschikbare automatische scanner processen +DELETE FROM automatisch_proces_config WHERE proces_id IN (SELECT id FROM automatisch_proces WHERE dtype IN ('BRKScannerProces')); +DELETE FROM automatisch_proces WHERE dtype IN ('BRKScannerProces'); +-- BRK1 GDS2 processen verwijderen +CREATE TEMP TABLE pids AS SELECT apc.proces_id FROM automatisch_proces_config apc WHERE apc.value = 'brk' AND apc.config_key='gds2_br_soort'; +DELETE FROM automatisch_proces_config WHERE proces_id IN (SELECT proces_id FROM pids); +DELETE FROM automatisch_proces WHERE id IN (SELECT proces_id FROM pids); +DROP TABLE pids; -- onderstaande dienen als laatste stappen van een upgrade uitgevoerd INSERT INTO brmo_metadata (naam,waarde) SELECT 'upgrade_4.0.0_naar_5.0.0','vorige versie was ' || waarde FROM brmo_metadata WHERE naam='brmoversie';