# HG changeset patch # User Robert Casties # Date 1566922006 -7200 # Node ID 2db6271a06630ded4689d4db27de3b3913c78caf # Parent 8acfd380fffe6f4cfd9f568a77f795b420beda0d MigrateWitnessNotes now also migrates notes of CODEX and TEXT. diff -r 8acfd380fffe -r 2db6271a0663 src/main/java/org/mpi/openmind/scripts/MigrateWitnessNotes.java --- a/src/main/java/org/mpi/openmind/scripts/MigrateWitnessNotes.java Tue Aug 27 12:37:36 2019 +0200 +++ b/src/main/java/org/mpi/openmind/scripts/MigrateWitnessNotes.java Tue Aug 27 18:06:46 2019 +0200 @@ -23,15 +23,16 @@ private static final String migrateUser = "migrate-notes user"; protected static final Set attsToMigrate = new HashSet<>(Arrays.asList( "notes_on_collation_and_corrections", "notes_on_ownership", "notes_on_title_author", - "other_features", "page_layout", "diagrams_and_illustrations")); + "other_features", "page_layout", "diagrams_and_illustrations", "text_arrangement", + "distinguishing_features")); private static Logger logger = Logger.getLogger(MigrateWitnessNotes.class); - protected static void migrate(WrapperService wrapper) { + protected static void migrate(String objectClass, WrapperService wrapper) { List saveList = new ArrayList(); int cnt = 0; - List witnessList = wrapper.getEntitiesByDef("WITNESS"); + List witnessList = wrapper.getEntitiesByDef(objectClass); for (Entity witness : witnessList) { if (witness.isLightweight()) { witness = wrapper.getEntityContent(witness); @@ -65,19 +66,19 @@ saveList.add(witness); } if (++cnt % 100 == 0) { - logger.debug(cnt+" witnesses"); + logger.debug(cnt+" "+objectClass); } } // save changed entities for (Entity entity: saveList) { try { - logger.debug("Saving changed witness: "+entity); + logger.debug("Saving changed "+objectClass+": "+entity); wrapper.saveEntity(entity, migrateUser, null); } catch (Exception e) { - logger.error("Error saving changed witnesses!", e); + logger.error("Error saving changed "+objectClass+"!", e); } } - logger.info("Changed "+saveList.size()+" witnesses."); + logger.info("Changed "+saveList.size()+" "+objectClass+"s."); } /** @@ -88,7 +89,13 @@ services.getWrapper(); logger.info("Migrating WITNESS attributes"); - migrate(services.getWrapper()); + migrate("WITNESS", services.getWrapper()); + + logger.info("Migrating CODEX attributes"); + migrate("CODEX", services.getWrapper()); + + logger.info("Migrating TEXT attributes"); + migrate("TEXT", services.getWrapper()); System.exit(0); }