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,37 +1255,24 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
return null;
}
// try to deal with datatypes that have '/' chars in their name.
Category category = getLowestLevelCategory(dataTypePath);
// Use a category path to parse the datatype path because it knows how to deal with
// escaped forward slashes.
CategoryPath parsedPath = new CategoryPath(dataTypePath);
CategoryPath categoryPath = parsedPath.getParent();
String dataTypeName = parsedPath.getName();
Category category = getCategory(categoryPath);
if (category != null) {
CategoryPath categoryPath = category.getCategoryPath();
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);
}
if (category == null) {
return null;
}
return category.getDataType(dataTypeName);
}
@Override
public DataType findDataType(String 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
public void findEnumValueNames(long value, Set<String> enumValueNames) {
buildEnumValueMap();