Skip to content

Commit

Permalink
[MODFQMMGR-619] Handle hidden POL fields (#568)
Browse files Browse the repository at this point in the history
  • Loading branch information
ncovercash authored Dec 26, 2024
1 parent 83f641b commit 9ee9b73
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class MigrationConfiguration {
public static final String VERSION_KEY = "_version";
public static final UUID REMOVED_ENTITY_TYPE_ID = UUID.fromString("deadbeef-dead-dead-dead-deaddeadbeef");

private static final String CURRENT_VERSION = "12";
private static final String CURRENT_VERSION = "13";
// TODO: replace this with current version in the future?
private static final String DEFAULT_VERSION = "0";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.folio.fqm.migration.strategies.V0POCMigration;
import org.folio.fqm.migration.strategies.V10OrganizationStatusValueChange;
import org.folio.fqm.migration.strategies.V11OrganizationCodeOperatorChange;
import org.folio.fqm.migration.strategies.V12PurchaseOrderIdFieldRemoval;
import org.folio.fqm.migration.strategies.V1ModeOfIssuanceConsolidation;
import org.folio.fqm.migration.strategies.V2ResourceTypeConsolidation;
import org.folio.fqm.migration.strategies.V3RamsonsFieldCleanup;
Expand Down Expand Up @@ -47,7 +48,8 @@ public MigrationStrategyRepository(
new V8LocationValueChange(locationsClient),
new V9LocLibraryValueChange(locationUnitsClient),
new V10OrganizationStatusValueChange(),
new V11OrganizationCodeOperatorChange(organizationsClient)
new V11OrganizationCodeOperatorChange(organizationsClient),
new V12PurchaseOrderIdFieldRemoval()
// adding a strategy? be sure to update the `CURRENT_VERSION` in MigrationConfiguration!
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package org.folio.fqm.migration.strategies;

import java.util.Map;
import java.util.UUID;
import java.util.function.BiFunction;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.folio.fqm.migration.AbstractSimpleMigrationStrategy;
import org.folio.fqm.migration.warnings.FieldWarning;
import org.folio.fqm.migration.warnings.RemovedFieldWarning;

/**
* Version 12 -> 13, handles a change in available fields for the POL entity type.
*
* The "PO ID", "PO created by ID", and "POL created by ID" fields were made API-only in Ramsons.
*
* @see https://folio-org.atlassian.net/browse/MODFQMMGR-619 for the addition of this migration
*/
@Log4j2
@RequiredArgsConstructor
public class V12PurchaseOrderIdFieldRemoval extends AbstractSimpleMigrationStrategy {

private static final UUID COMPOSITE_PURCHASE_ORDER_LINES_ENTITY_TYPE_ID = UUID.fromString(
"abc777d3-2a45-43e6-82cb-71e8c96d13d2"
);

@Override
public String getLabel() {
return "V12 -> V13 POL ID field removal (MODFQMMGR-619)";
}

@Override
public String getSourceVersion() {
return "12";
}

@Override
public String getTargetVersion() {
return "13";
}

@Override
public Map<UUID, Map<String, BiFunction<String, String, FieldWarning>>> getFieldWarnings() {
return Map.ofEntries(
Map.entry(
COMPOSITE_PURCHASE_ORDER_LINES_ENTITY_TYPE_ID,
Map.ofEntries(
Map.entry("po.id", RemovedFieldWarning.withAlternative("po.po_number")),
Map.entry("po_created_by_user.id", RemovedFieldWarning.withAlternative("po_created_by_user.username")),
Map.entry("pol_created_by_user.id", RemovedFieldWarning.withAlternative("pol_created_by_user.username"))
)
)
);
}
}

0 comments on commit 9ee9b73

Please sign in to comment.