Fixed migration of tba:sources and tba:destinations nodes.
@@ -26,6 +26,7 @@ import com.thinkbiganalytics.metadata.modeshape.support.JcrUtil;
import com.thinkbiganalytics.metadata.upgrade.UpgradeException;
import com.thinkbiganalytics.metadata.upgrade.UpgradeState;
+import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -63,7 +64,6 @@ public class UpgradeAction implements UpgradeState {
*/
@Override
public void upgradeFrom(KyloVersion startingVersion) {
- // if (getStartingVersion().equals(startingVersion)) {
log.info("Upgrading from version: " + startingVersion);
Session session = JcrMetadataAccess.getActiveSession();
@@ -146,7 +146,6 @@ public class UpgradeAction implements UpgradeState {
}
log.info("Upgrade complete for {} categories and {} feeds", categoryCount, totalFeedCount);
- // }
}
/**
@@ -166,7 +165,7 @@ public class UpgradeAction implements UpgradeState {
private void moveNode(Session session, Node node, Node parentNode) {
try {
if ((node != null) && (parentNode != null)) {
- final String srcPath = node.getParent().getPath() + "/" + node.getName(); // Path may not be accurate if parent node moved recently
+ final String srcPath = node.getParent().getPath() + "/" + StringUtils.substringAfterLast(node.getPath(), "/"); // Path may not be accurate if parent node moved recently
session.move(srcPath, parentNode.getPath() + "/" + node.getName());
}
} catch (RepositoryException e) {
