Commit ce61caae by Shwetha G S

Merge pull request #131 from shwethags/utf8

BUG-38870 npe during loading of the data in atlas on restart
parents f0682e41 93f34483
......@@ -53,6 +53,7 @@ import org.slf4j.LoggerFactory;
import javax.inject.Inject;
import javax.inject.Singleton;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
......@@ -83,8 +84,8 @@ public class DefaultMetadataService implements MetadataService {
this.typeSystem = TypeSystem.getInstance();
this.repository = repository;
restoreTypeSystem();
registerListener(searchIndexer);
restoreTypeSystem();
}
private void restoreTypeSystem() {
......@@ -113,17 +114,18 @@ public class DefaultMetadataService implements MetadataService {
return; // this is already registered
}
Map<String, IDataType> superTypes = new HashMap();
HierarchicalTypeDefinition<ClassType> superTypeDefinition =
TypesUtil.createClassTypeDef(MetadataServiceClient.INFRASTRUCTURE_SUPER_TYPE,
ImmutableList.<String>of(),
NAME_ATTRIBUTE, DESCRIPTION_ATTRIBUTE);
typeSystem.defineClassType(superTypeDefinition);
ImmutableList.<String>of(), NAME_ATTRIBUTE, DESCRIPTION_ATTRIBUTE);
superTypes.put(MetadataServiceClient.INFRASTRUCTURE_SUPER_TYPE, typeSystem.defineClassType
(superTypeDefinition));
superTypeDefinition =
TypesUtil.createClassTypeDef(MetadataServiceClient.DATA_SET_SUPER_TYPE,
ImmutableList.<String>of(),
NAME_ATTRIBUTE, DESCRIPTION_ATTRIBUTE);
typeSystem.defineClassType(superTypeDefinition);
superTypes.put(MetadataServiceClient.DATA_SET_SUPER_TYPE, typeSystem.defineClassType(superTypeDefinition));
superTypeDefinition =
TypesUtil.createClassTypeDef(MetadataServiceClient.PROCESS_SUPER_TYPE,
......@@ -136,7 +138,8 @@ public class DefaultMetadataService implements MetadataService {
DataTypes.arrayTypeName(MetadataServiceClient.DATA_SET_SUPER_TYPE),
new Multiplicity(0, Integer.MAX_VALUE, false), false, null)
);
typeSystem.defineClassType(superTypeDefinition);
superTypes.put(MetadataServiceClient.PROCESS_SUPER_TYPE, typeSystem.defineClassType(superTypeDefinition));
onTypesAddedToRepo(superTypes);
}
/**
......
......@@ -70,7 +70,7 @@ public abstract class HierarchicalType<ST extends HierarchicalType, T> extends A
this.fieldMapping = null;
this.numFields = numFields;
this.superTypes = superTypes;
this.immediateAttrs = null;
this.immediateAttrs = ImmutableList.of();
this.attributeNameToType = null;
}
......@@ -86,7 +86,7 @@ public abstract class HierarchicalType<ST extends HierarchicalType, T> extends A
this.attributeNameToType = p.right;
this.numFields = this.fieldMapping.fields.size();
this.superTypes = superTypes == null ? ImmutableList.<String>of() : superTypes;
this.immediateAttrs = ImmutableList.<AttributeInfo>copyOf(fields);
this.immediateAttrs = ImmutableList.copyOf(fields);
}
@Override
......@@ -184,7 +184,7 @@ public abstract class HierarchicalType<ST extends HierarchicalType, T> extends A
(ST) typeSystem.getDataType(superTypeClass, currentPath.typeName);
ImmutableList<AttributeInfo> superTypeFields = superType == this ?
ImmutableList.<AttributeInfo>copyOf(fields) : superType.immediateAttrs;
ImmutableList.copyOf(fields) : superType.immediateAttrs;
Set<String> immediateFields = new HashSet<String>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment