GT-2961 - Adjust DataTypeManagerDB

This commit is contained in:
ghizard 2019-07-10 11:40:29 -04:00
parent 860fe5a2d7
commit f53e6ce60d

View file

@ -1255,17 +1255,17 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
return null; return null;
} }
// try to deal with datatypes that have '/' chars in their name. // Use a category path to parse the datatype path because it knows how to deal with
Category category = getLowestLevelCategory(dataTypePath); // escaped forward slashes.
CategoryPath parsedPath = new CategoryPath(dataTypePath);
CategoryPath categoryPath = parsedPath.getParent();
String dataTypeName = parsedPath.getName();
Category category = getCategory(categoryPath);
if (category != null) { if (category == null) {
CategoryPath categoryPath = category.getCategoryPath(); return null;
String path = categoryPath.getPath();
int dataTypeNameStartIndex = path.endsWith("/") ? path.length() : path.length() + 1; // +1 to get past the last '/'
String dataTypeName = dataTypePath.substring(dataTypeNameStartIndex);
return category.getDataType(dataTypeName);
} }
return null; return category.getDataType(dataTypeName);
} }
@Override @Override
@ -1273,19 +1273,6 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
return getDataType(dataTypePath); return getDataType(dataTypePath);
} }
private Category getLowestLevelCategory(String dataTypePath) {
CategoryPath pathParser = new CategoryPath(dataTypePath); // Use a category path to parse the path.
while (pathParser != null) {
CategoryPath path = pathParser.getParent();
Category category = getCategory(path);
if (category != null) {
return category;
}
pathParser = path;
}
return null;
}
@Override @Override
public void findEnumValueNames(long value, Set<String> enumValueNames) { public void findEnumValueNames(long value, Set<String> enumValueNames) {
buildEnumValueMap(); buildEnumValueMap();