You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ma...@apache.org on 2016/12/16 03:31:05 UTC
[2/4] incubator-atlas git commit: ATLAS-1304: Redundant code removal
and code simplification
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/main/java/org/apache/atlas/type/AtlasEnumType.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasEnumType.java b/intg/src/main/java/org/apache/atlas/type/AtlasEnumType.java
index eba87a7..db169d0 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasEnumType.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasEnumType.java
@@ -23,7 +23,6 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.atlas.exception.AtlasBaseException;
-import org.apache.atlas.model.TypeCategory;
import org.apache.atlas.model.typedef.AtlasEnumDef;
import org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumElementDef;
@@ -39,7 +38,7 @@ public class AtlasEnumType extends AtlasType {
public AtlasEnumType(AtlasEnumDef enumDef) {
super(enumDef);
- Map<String, AtlasEnumElementDef> e = new HashMap<String, AtlasEnumElementDef>();
+ Map<String, AtlasEnumElementDef> e = new HashMap<>();
for (AtlasEnumElementDef elementDef : enumDef.getElementDefs()) {
e.put(elementDef.getValue().toLowerCase(), elementDef);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/main/java/org/apache/atlas/type/AtlasMapType.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasMapType.java b/intg/src/main/java/org/apache/atlas/type/AtlasMapType.java
index 60899fd..6e6c522 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasMapType.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasMapType.java
@@ -93,7 +93,7 @@ public class AtlasMapType extends AtlasType {
@Override
public Map<Object, Object> createDefaultValue() {
- Map<Object, Object> ret = new HashMap<Object, Object>();
+ Map<Object, Object> ret = new HashMap<>();
ret.put(keyType.createDefaultValue(), valueType.createDefaultValue());
@@ -126,7 +126,7 @@ public class AtlasMapType extends AtlasType {
}
if (obj instanceof Map) {
- Map<Object, Object> ret = new HashMap<Object, Object>();
+ Map<Object, Object> ret = new HashMap<>();
Map<Object, Objects> map = (Map<Object, Objects>) obj;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java b/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java
index ef5f736..e20af76 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java
@@ -51,7 +51,7 @@ public class AtlasStructType extends AtlasType {
private Map<String, AtlasType> attrTypes = Collections.emptyMap();
private Set<String> foreignKeyAttributes = new HashSet<>();
- private Map<String, TypeAttributePair> mappedFromRefAttributes = new HashMap<String, TypeAttributePair>();
+ private Map<String, TypeAttributePair> mappedFromRefAttributes = new HashMap<>();
public AtlasStructType(AtlasStructDef structDef) {
@@ -101,7 +101,7 @@ public class AtlasStructType extends AtlasType {
@Override
public void resolveReferences(AtlasTypeRegistry typeRegistry) throws AtlasBaseException {
- Map<String, AtlasType> a = new HashMap<String, AtlasType>();
+ Map<String, AtlasType> a = new HashMap<>();
for (AtlasAttributeDef attributeDef : structDef.getAttributeDefs()) {
AtlasType attrType = typeRegistry.getType(attributeDef.getTypeName());
@@ -275,7 +275,7 @@ public class AtlasStructType extends AtlasType {
Map<String, Object> attributes = obj.getAttributes();
if (attributes == null) {
- attributes = new HashMap<String, Object>();
+ attributes = new HashMap<>();
}
for (AtlasAttributeDef attributeDef : structDef.getAttributeDefs()) {
@@ -348,13 +348,16 @@ public class AtlasStructType extends AtlasType {
continue;
}
- if (constraintType.equals(AtlasConstraintDef.CONSTRAINT_TYPE_FOREIGN_KEY)) {
- resolveForeignKeyConstraint(attribDef, constraintDef, attribType);
- } else if (constraintType.equals(CONSTRAINT_TYPE_MAPPED_FROM_REF)) {
- resolveMappedFromRefConstraint(attribDef, constraintDef, attribType);
- } else {
- throw new AtlasBaseException(AtlasErrorCode.UNKNOWN_CONSTRAINT, constraintType,
- getTypeName(), attribDef.getName());
+ switch (constraintType) {
+ case AtlasConstraintDef.CONSTRAINT_TYPE_FOREIGN_KEY:
+ resolveForeignKeyConstraint(attribDef, constraintDef, attribType);
+ break;
+ case CONSTRAINT_TYPE_MAPPED_FROM_REF:
+ resolveMappedFromRefConstraint(attribDef, constraintDef, attribType);
+ break;
+ default:
+ throw new AtlasBaseException(AtlasErrorCode.UNKNOWN_CONSTRAINT, constraintType,
+ getTypeName(), attribDef.getName());
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java b/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java
index 0c118f0..7aa4f29 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java
@@ -539,12 +539,12 @@ public class AtlasTypeRegistry {
LOG.debug("==> AtlasTypeRegistry.updateType({})", typeDef);
}
- if (typeDef == null) {
- // ignore
- } else if (StringUtils.isNotBlank(typeDef.getGuid())) {
- updateTypeByGuidWithNoRefResolve(typeDef.getGuid(), typeDef);
- } else if (StringUtils.isNotBlank(typeDef.getName())) {
- updateTypeByNameWithNoRefResolve(typeDef.getName(), typeDef);
+ if (typeDef != null) {
+ if (StringUtils.isNotBlank(typeDef.getGuid())) {
+ updateTypeByGuidWithNoRefResolve(typeDef.getGuid(), typeDef);
+ } else if (StringUtils.isNotBlank(typeDef.getName())) {
+ updateTypeByNameWithNoRefResolve(typeDef.getName(), typeDef);
+ }
}
if (LOG.isDebugEnabled()) {
@@ -694,15 +694,13 @@ class TypeCache {
}
public AtlasType getTypeByGuid(String guid) {
- AtlasType ret = guid != null ? typeGuidMap.get(guid) : null;
- return ret;
+ return guid != null ? typeGuidMap.get(guid) : null;
}
public AtlasType getTypeByName(String name) {
- AtlasType ret = name != null ? typeNameMap.get(name) : null;
- return ret;
+ return name != null ? typeNameMap.get(name) : null;
}
public void updateGuid(String typeName, String currGuid, String newGuid) {
@@ -768,15 +766,13 @@ class TypeDefCache<T extends AtlasBaseTypeDef> {
}
public T getTypeDefByGuid(String guid) {
- T ret = guid != null ? typeDefGuidMap.get(guid) : null;
- return ret;
+ return guid != null ? typeDefGuidMap.get(guid) : null;
}
public T getTypeDefByName(String name) {
- T ret = name != null ? typeDefNameMap.get(name) : null;
- return ret;
+ return name != null ? typeDefNameMap.get(name) : null;
}
public void updateGuid(String typeName, String newGuid) {
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java b/intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java
index 6eed60f..b0a4e07 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java
@@ -51,14 +51,14 @@ import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_MAP_SUF
* Utility methods for AtlasType/AtlasTypeDef.
*/
public class AtlasTypeUtil {
- private static final Set<String> ATLAS_BUILTIN_TYPENAMES = new HashSet<String>();
+ private static final Set<String> ATLAS_BUILTIN_TYPENAMES = new HashSet<>();
static {
Collections.addAll(ATLAS_BUILTIN_TYPENAMES, AtlasBaseTypeDef.ATLAS_BUILTIN_TYPES);
}
public static Set<String> getReferencedTypeNames(String typeName) {
- Set<String> ret = new HashSet<String>();
+ Set<String> ret = new HashSet<>();
getReferencedTypeNames(typeName, ret);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/TestUtilsV2.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/TestUtilsV2.java b/intg/src/test/java/org/apache/atlas/TestUtilsV2.java
index 249af6e..53b109c 100755
--- a/intg/src/test/java/org/apache/atlas/TestUtilsV2.java
+++ b/intg/src/test/java/org/apache/atlas/TestUtilsV2.java
@@ -656,7 +656,7 @@ public final class TestUtilsV2 {
AtlasTypeUtil.createRequiredAttrDef("level", "int"));
AtlasClassificationDef janitorSecurityClearanceTypeDef =
- AtlasTypeUtil.createTraitTypeDef("JanitorClearance", "JanitorClearance_description", ImmutableSet.<String>of("SecurityClearance1"),
+ AtlasTypeUtil.createTraitTypeDef("JanitorClearance", "JanitorClearance_description", ImmutableSet.of("SecurityClearance1"),
AtlasTypeUtil.createRequiredAttrDef("level", "int"));
return Arrays.asList(securityClearanceTypeDef, janitorSecurityClearanceTypeDef);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/model/ModelTestUtil.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/model/ModelTestUtil.java b/intg/src/test/java/org/apache/atlas/model/ModelTestUtil.java
index c0bb1f2..ee78350 100644
--- a/intg/src/test/java/org/apache/atlas/model/ModelTestUtil.java
+++ b/intg/src/test/java/org/apache/atlas/model/ModelTestUtil.java
@@ -357,28 +357,28 @@ public final class ModelTestUtil {
}
public static List<AtlasAttributeDef> newAttributeDefsWithAllBuiltInTypes(String attrNamePrefix) {
- List<AtlasAttributeDef> ret = new ArrayList<AtlasAttributeDef>();
+ List<AtlasAttributeDef> ret = new ArrayList<>();
// add all built-in types
- for (int i = 0; i < ATLAS_BUILTIN_TYPES.length; i++) {
- ret.add(getAttributeDef(attrNamePrefix, ATLAS_BUILTIN_TYPES[i]));
+ for (String ATLAS_BUILTIN_TYPE2 : ATLAS_BUILTIN_TYPES) {
+ ret.add(getAttributeDef(attrNamePrefix, ATLAS_BUILTIN_TYPE2));
}
// add enum types
ret.add(getAttributeDef(attrNamePrefix, ENUM_DEF.getName()));
ret.add(getAttributeDef(attrNamePrefix, ENUM_DEF_WITH_NO_DEFAULT.getName()));
// add array of built-in types
- for (int i = 0; i < ATLAS_BUILTIN_TYPES.length; i++) {
- ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getArrayTypeName(ATLAS_BUILTIN_TYPES[i])));
+ for (String ATLAS_BUILTIN_TYPE1 : ATLAS_BUILTIN_TYPES) {
+ ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getArrayTypeName(ATLAS_BUILTIN_TYPE1)));
}
// add array of enum types
ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getArrayTypeName(ENUM_DEF.getName())));
ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getArrayTypeName(ENUM_DEF_WITH_NO_DEFAULT.getName())));
// add few map types
- for (int i = 0; i < ATLAS_PRIMITIVE_TYPES.length; i++) {
+ for (String ATLAS_PRIMITIVE_TYPE3 : ATLAS_PRIMITIVE_TYPES) {
ret.add(getAttributeDef(attrNamePrefix,
- AtlasBaseTypeDef.getMapTypeName(ATLAS_PRIMITIVE_TYPES[i], getRandomBuiltInType())));
+ AtlasBaseTypeDef.getMapTypeName(ATLAS_PRIMITIVE_TYPE3, getRandomBuiltInType())));
}
// add map types with enum as key
ret.add(getAttributeDef(attrNamePrefix,
@@ -392,7 +392,7 @@ public final class ModelTestUtil {
AtlasBaseTypeDef.getMapTypeName(getRandomPrimitiveType(), ENUM_DEF_WITH_NO_DEFAULT.getName())));
// add few array of arrays
- for (int i = 0; i < ATLAS_BUILTIN_TYPES.length; i++) {
+ for (String ATLAS_BUILTIN_TYPE : ATLAS_BUILTIN_TYPES) {
ret.add(getAttributeDef(attrNamePrefix,
AtlasBaseTypeDef.getArrayTypeName(AtlasBaseTypeDef.getArrayTypeName(getRandomBuiltInType()))));
}
@@ -400,9 +400,9 @@ public final class ModelTestUtil {
ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getArrayTypeName(ENUM_DEF_WITH_NO_DEFAULT.getName())));
// add few array of maps
- for (int i = 0; i < ATLAS_PRIMITIVE_TYPES.length; i++) {
+ for (String ATLAS_PRIMITIVE_TYPE2 : ATLAS_PRIMITIVE_TYPES) {
ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getArrayTypeName(
- AtlasBaseTypeDef.getMapTypeName(ATLAS_PRIMITIVE_TYPES[i], getRandomBuiltInType()))));
+ AtlasBaseTypeDef.getMapTypeName(ATLAS_PRIMITIVE_TYPE2, getRandomBuiltInType()))));
}
ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getArrayTypeName(
AtlasBaseTypeDef.getMapTypeName(ENUM_DEF.getName(), getRandomBuiltInType()))));
@@ -414,15 +414,15 @@ public final class ModelTestUtil {
AtlasBaseTypeDef.getMapTypeName(getRandomPrimitiveType(), ENUM_DEF_WITH_NO_DEFAULT.getName()))));
// add few map of arrays
- for (int i = 0; i < ATLAS_PRIMITIVE_TYPES.length; i++) {
- ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getMapTypeName(ATLAS_PRIMITIVE_TYPES[i],
- AtlasBaseTypeDef.getArrayTypeName(getRandomBuiltInType()))));
+ for (String ATLAS_PRIMITIVE_TYPE1 : ATLAS_PRIMITIVE_TYPES) {
+ ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getMapTypeName(ATLAS_PRIMITIVE_TYPE1,
+ AtlasBaseTypeDef.getArrayTypeName(getRandomBuiltInType()))));
}
// add few map of maps
- for (int i = 0; i < ATLAS_PRIMITIVE_TYPES.length; i++) {
- ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getMapTypeName(ATLAS_PRIMITIVE_TYPES[i],
- AtlasBaseTypeDef.getMapTypeName(ATLAS_PRIMITIVE_TYPES[i], getRandomBuiltInType()))));
+ for (String ATLAS_PRIMITIVE_TYPE : ATLAS_PRIMITIVE_TYPES) {
+ ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getMapTypeName(ATLAS_PRIMITIVE_TYPE,
+ AtlasBaseTypeDef.getMapTypeName(ATLAS_PRIMITIVE_TYPE, getRandomBuiltInType()))));
}
return ret;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasEntityDef.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasEntityDef.java b/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasEntityDef.java
index b8cc77c..46d4d06 100644
--- a/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasEntityDef.java
+++ b/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasEntityDef.java
@@ -103,7 +103,7 @@ public class TestAtlasEntityDef {
AtlasEntityDef entityDef = ModelTestUtil.newEntityDefWithSuperTypes();
Set<String> oldSuperTypes = entityDef.getSuperTypes();
- Set<String> newSuperTypes = new HashSet<String>();
+ Set<String> newSuperTypes = new HashSet<>();
newSuperTypes.add("newType-abcd-1234");
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasEnumDef.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasEnumDef.java b/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasEnumDef.java
index 61e102e..e0a6a00 100644
--- a/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasEnumDef.java
+++ b/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasEnumDef.java
@@ -93,7 +93,7 @@ public class TestAtlasEnumDef {
AtlasEnumDef enumDef = ModelTestUtil.newEnumDef();
List<AtlasEnumElementDef> oldElements = enumDef.getElementDefs();
- List<AtlasEnumElementDef> newElements = new ArrayList<AtlasEnumElementDef>();
+ List<AtlasEnumElementDef> newElements = new ArrayList<>();
newElements.add(new AtlasEnumElementDef("newElement", "new Element", 100));
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasArrayType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasArrayType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasArrayType.java
index e1a9658..e882473 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasArrayType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasArrayType.java
@@ -33,14 +33,14 @@ public class TestAtlasArrayType {
private final Object[] invalidValues;
{
- List<Integer> intList = new ArrayList<Integer>();
- Set<Integer> intSet = new HashSet<Integer>();
+ List<Integer> intList = new ArrayList<>();
+ Set<Integer> intSet = new HashSet<>();
Integer[] intArray = new Integer[] { 1, 2, 3 };
- List<Object> objList = new ArrayList<Object>();
- Set<Object> objSet = new HashSet<Object>();
+ List<Object> objList = new ArrayList<>();
+ Set<Object> objSet = new HashSet<>();
Object[] objArray = new Object[] { 1, 2, 3 };
- List<String> strList = new ArrayList<String>();
- Set<String> strSet = new HashSet<String>();
+ List<String> strList = new ArrayList<>();
+ Set<String> strSet = new HashSet<>();
String[] strArray = new String[] { "1", "2", "3" };
for (int i = 0; i < 10; i++) {
@@ -105,7 +105,7 @@ public class TestAtlasArrayType {
@Test
public void testArrayTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(intArrayType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasBigDecimalType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasBigDecimalType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasBigDecimalType.java
index 0d8c65f..8538b80 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasBigDecimalType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasBigDecimalType.java
@@ -94,7 +94,7 @@ public class TestAtlasBigDecimalType {
@Test
public void testBigDecimalTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(bigDecimalType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasBigIntegerType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasBigIntegerType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasBigIntegerType.java
index f234bb8..f94fec4 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasBigIntegerType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasBigIntegerType.java
@@ -95,7 +95,7 @@ public class TestAtlasBigIntegerType {
@Test
public void testBigIntegerTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(bigIntegerType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasBooleanType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasBooleanType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasBooleanType.java
index 4373a38..ec5f75a 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasBooleanType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasBooleanType.java
@@ -73,7 +73,7 @@ public class TestAtlasBooleanType {
@Test
public void testBooleanTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(booleanType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasByteType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasByteType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasByteType.java
index 338ceda..a7ada38 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasByteType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasByteType.java
@@ -95,7 +95,7 @@ public class TestAtlasByteType {
@Test
public void testByteTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(byteType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasClassificationType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasClassificationType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasClassificationType.java
index fc2de25..aaf4a6a 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasClassificationType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasClassificationType.java
@@ -31,8 +31,8 @@ import static org.testng.Assert.*;
public class TestAtlasClassificationType {
private final AtlasClassificationType classificationType;
- private final List<Object> validValues = new ArrayList<Object>();
- private final List<Object> invalidValues = new ArrayList<Object>();
+ private final List<Object> validValues = new ArrayList<>();
+ private final List<Object> invalidValues = new ArrayList<>();
{
classificationType = getClassificationType(ModelTestUtil.getClassificationDefWithSuperTypes());
@@ -55,7 +55,7 @@ public class TestAtlasClassificationType {
invalidValues.add(invalidValue2);
invalidValues.add(invalidValue3);
invalidValues.add(new AtlasClassification()); // no values for mandatory attributes
- invalidValues.add(new HashMap<Object, Object>()); // no values for mandatory attributes
+ invalidValues.add(new HashMap<>()); // no values for mandatory attributes
invalidValues.add(1); // incorrect datatype
invalidValues.add(new HashSet()); // incorrect datatype
invalidValues.add(new ArrayList()); // incorrect datatype
@@ -102,7 +102,7 @@ public class TestAtlasClassificationType {
@Test
public void testClassificationTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(classificationType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasDateType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasDateType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasDateType.java
index a28840a..1b3bbc7 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasDateType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasDateType.java
@@ -107,7 +107,7 @@ public class TestAtlasDateType {
@Test
public void testDateTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(dateType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasDoubleType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasDoubleType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasDoubleType.java
index 1b1e013..b3cbe72 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasDoubleType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasDoubleType.java
@@ -95,7 +95,7 @@ public class TestAtlasDoubleType {
@Test
public void testDoubleTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(doubleType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasEntityType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasEntityType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasEntityType.java
index 90fea9f..710840f 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasEntityType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasEntityType.java
@@ -38,8 +38,8 @@ import static org.testng.Assert.*;
public class TestAtlasEntityType {
private final AtlasEntityType entityType;
- private final List<Object> validValues = new ArrayList<Object>();
- private final List<Object> invalidValues = new ArrayList<Object>();
+ private final List<Object> validValues = new ArrayList<>();
+ private final List<Object> invalidValues = new ArrayList<>();
{
entityType = getEntityType(ModelTestUtil.getEntityDefWithSuperTypes());
@@ -62,7 +62,7 @@ public class TestAtlasEntityType {
invalidValues.add(invalidValue2);
invalidValues.add(invalidValue3);
invalidValues.add(new AtlasEntity()); // no values for mandatory attributes
- invalidValues.add(new HashMap<Object, Object>()); // no values for mandatory attributes
+ invalidValues.add(new HashMap<>()); // no values for mandatory attributes
invalidValues.add(1); // incorrect datatype
invalidValues.add(new HashSet()); // incorrect datatype
invalidValues.add(new ArrayList()); // incorrect datatype
@@ -109,7 +109,7 @@ public class TestAtlasEntityType {
@Test
public void testEntityTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(entityType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasFloatType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasFloatType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasFloatType.java
index dbfcf1d..64fc3e3 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasFloatType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasFloatType.java
@@ -95,7 +95,7 @@ public class TestAtlasFloatType {
@Test
public void testFloatTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(floatType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasIntType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasIntType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasIntType.java
index f6f6041..c2b5eb4 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasIntType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasIntType.java
@@ -95,7 +95,7 @@ public class TestAtlasIntType {
@Test
public void testIntTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(intType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasLongType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasLongType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasLongType.java
index b9fb089..7eefcc2 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasLongType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasLongType.java
@@ -95,7 +95,7 @@ public class TestAtlasLongType {
@Test
public void testLongTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(longType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasMapType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasMapType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasMapType.java
index 6f75d54..dcee3fe 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasMapType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasMapType.java
@@ -34,13 +34,13 @@ public class TestAtlasMapType {
private final Object[] invalidValues;
{
- Map<String, Integer> strIntMap = new HashMap<String, Integer>();
- Map<String, Double> strDoubleMap = new HashMap<String, Double>();
- Map<String, String> strStringMap = new HashMap<String, String>();
- Map<Integer, Integer> intIntMap = new HashMap<Integer, Integer>();
- Map<Object, Object> objObjMap = new HashMap<Object, Object>();
- Map<Object, Object> invObjObjMap1 = new HashMap<Object, Object>();
- Map<Object, Object> invObjObjMap2 = new HashMap<Object, Object>();
+ Map<String, Integer> strIntMap = new HashMap<>();
+ Map<String, Double> strDoubleMap = new HashMap<>();
+ Map<String, String> strStringMap = new HashMap<>();
+ Map<Integer, Integer> intIntMap = new HashMap<>();
+ Map<Object, Object> objObjMap = new HashMap<>();
+ Map<Object, Object> invObjObjMap1 = new HashMap<>();
+ Map<Object, Object> invObjObjMap2 = new HashMap<>();
for (int i = 0; i < 10; i++) {
strIntMap.put(Integer.toString(i), i);
@@ -54,7 +54,7 @@ public class TestAtlasMapType {
invObjObjMap2.put("123", "xyz"); // invalid value
validValues = new Object[] {
- null, new HashMap<String, Integer>(), new HashMap<Object, Object>(), strIntMap, strDoubleMap, strStringMap,
+ null, new HashMap<String, Integer>(), new HashMap<>(), strIntMap, strDoubleMap, strStringMap,
intIntMap, objObjMap,
};
@@ -101,7 +101,7 @@ public class TestAtlasMapType {
@Test
public void testMapTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(intIntMapType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasObjectIdType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasObjectIdType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasObjectIdType.java
index 61f9146..7d55233 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasObjectIdType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasObjectIdType.java
@@ -37,11 +37,11 @@ public class TestAtlasObjectIdType {
private final Object[] invalidValues;
{
- Map<String, String> objectId1 = new HashMap<String, String>();
- Map<Object, Object> objectId2 = new HashMap<Object, Object>();
- Map<Object, Object> objectId3 = new HashMap<Object, Object>();
- Map<Object, Object> objectId4 = new HashMap<Object, Object>();
- Map<Object, Object> objectId5 = new HashMap<Object, Object>();
+ Map<String, String> objectId1 = new HashMap<>();
+ Map<Object, Object> objectId2 = new HashMap<>();
+ Map<Object, Object> objectId3 = new HashMap<>();
+ Map<Object, Object> objectId4 = new HashMap<>();
+ Map<Object, Object> objectId5 = new HashMap<>();
objectId1.put(AtlasObjectId.KEY_TYPENAME, "testType");
objectId1.put(AtlasObjectId.KEY_GUID, "guid-1234");
@@ -107,7 +107,7 @@ public class TestAtlasObjectIdType {
@Test
public void testObjectIdTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(objectIdType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasShortType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasShortType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasShortType.java
index a266305..2b15ba0 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasShortType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasShortType.java
@@ -95,7 +95,7 @@ public class TestAtlasShortType {
@Test
public void testShortTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(shortType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasStringType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasStringType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasStringType.java
index c171d98..c4c7611 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasStringType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasStringType.java
@@ -75,7 +75,7 @@ public class TestAtlasStringType {
@Test
public void testStringTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(stringType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasStructType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasStructType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasStructType.java
index ee05ba3..7fe4c70 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasStructType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasStructType.java
@@ -78,8 +78,8 @@ public class TestAtlasStructType {
structDef.addAttribute(multiValuedAttribMax);
structType = getStructType(structDef);
- validValues = new ArrayList<Object>();
- invalidValues = new ArrayList<Object>();
+ validValues = new ArrayList<>();
+ invalidValues = new ArrayList<>();
AtlasStruct invalidValue1 = structType.createDefaultValue();
AtlasStruct invalidValue2 = structType.createDefaultValue();
@@ -121,7 +121,7 @@ public class TestAtlasStructType {
invalidValues.add(invalidValue6);
invalidValues.add(invalidValue7);
invalidValues.add(new AtlasStruct()); // no values for mandatory attributes
- invalidValues.add(new HashMap<Object, Object>()); // no values for mandatory attributes
+ invalidValues.add(new HashMap<>()); // no values for mandatory attributes
invalidValues.add(1); // incorrect datatype
invalidValues.add(new HashSet()); // incorrect datatype
invalidValues.add(new ArrayList()); // incorrect datatype
@@ -168,7 +168,7 @@ public class TestAtlasStructType {
@Test
public void testStructTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(structType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/notification/src/main/java/org/apache/atlas/kafka/KafkaNotification.java
----------------------------------------------------------------------
diff --git a/notification/src/main/java/org/apache/atlas/kafka/KafkaNotification.java b/notification/src/main/java/org/apache/atlas/kafka/KafkaNotification.java
index 2309ede..0ebfd47 100644
--- a/notification/src/main/java/org/apache/atlas/kafka/KafkaNotification.java
+++ b/notification/src/main/java/org/apache/atlas/kafka/KafkaNotification.java
@@ -277,7 +277,7 @@ public class KafkaNotification extends AbstractNotification implements Service {
protected <T> org.apache.atlas.kafka.KafkaConsumer<T>
createKafkaConsumer(Class<T> type, MessageDeserializer<T> deserializer, KafkaStream stream,
int consumerId, ConsumerConnector consumerConnector, boolean autoCommitEnabled) {
- return new org.apache.atlas.kafka.KafkaConsumer<T>(deserializer, stream,
+ return new org.apache.atlas.kafka.KafkaConsumer<>(deserializer, stream,
consumerId, consumerConnector, autoCommitEnabled);
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/plugin-classloader/src/main/java/org/apache/atlas/plugin/classloader/AtlasPluginClassLoaderUtil.java
----------------------------------------------------------------------
diff --git a/plugin-classloader/src/main/java/org/apache/atlas/plugin/classloader/AtlasPluginClassLoaderUtil.java b/plugin-classloader/src/main/java/org/apache/atlas/plugin/classloader/AtlasPluginClassLoaderUtil.java
index c3ec5e2..69b61d6 100644
--- a/plugin-classloader/src/main/java/org/apache/atlas/plugin/classloader/AtlasPluginClassLoaderUtil.java
+++ b/plugin-classloader/src/main/java/org/apache/atlas/plugin/classloader/AtlasPluginClassLoaderUtil.java
@@ -45,7 +45,7 @@ final class AtlasPluginClassLoaderUtil {
LOG.debug("==> AtlasPluginClassLoaderUtil.getFilesInDirectories()");
}
- List<URL> ret = new ArrayList<URL>();
+ List<URL> ret = new ArrayList<>();
for (String libDir : libDirs) {
getFilesInDirectory(libDir, ret);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index b3640d0..792b333 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -9,6 +9,7 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al
ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)
ALL CHANGES:
+ATLAS-1304 Redundant code removal and code simplification (apoorvnaik via mneethiraj)
ATLAS-1345 Enhance search APIs to resolve hierarchical references (apoorvnaik via sumasai)
ATLAS-1287 Subtasks: ATLAS-1288/ATLAS-1289 Integrated V2 API for Lineage,Entity Details,Tag assign to entity,Tags listing,tag create (kevalbhatt)
ATLAS-1303 Update hashCode and equals method to use standard JDK libraries (apoorvnaik via svimal2106)
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/RepositoryMetadataModule.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/RepositoryMetadataModule.java b/repository/src/main/java/org/apache/atlas/RepositoryMetadataModule.java
index d3903fb..8e086c9 100755
--- a/repository/src/main/java/org/apache/atlas/RepositoryMetadataModule.java
+++ b/repository/src/main/java/org/apache/atlas/RepositoryMetadataModule.java
@@ -101,9 +101,9 @@ public class RepositoryMetadataModule extends com.google.inject.AbstractModule {
Configuration configuration = getConfiguration();
bindAuditRepository(binder(), configuration);
- bind(DeleteHandler.class).to((Class<? extends DeleteHandler>) AtlasRepositoryConfiguration.getDeleteHandlerImpl()).asEagerSingleton();
+ bind(DeleteHandler.class).to(AtlasRepositoryConfiguration.getDeleteHandlerImpl()).asEagerSingleton();
- bind(TypeCache.class).to((Class<? extends TypeCache>) AtlasRepositoryConfiguration.getTypeCache()).asEagerSingleton();
+ bind(TypeCache.class).to(AtlasRepositoryConfiguration.getTypeCache()).asEagerSingleton();
//Add EntityAuditListener as EntityChangeListener
Multibinder<EntityChangeListener> entityChangeListenerBinder =
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/discovery/DataSetLineageService.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/discovery/DataSetLineageService.java b/repository/src/main/java/org/apache/atlas/discovery/DataSetLineageService.java
index fcf120a..fb027ef 100644
--- a/repository/src/main/java/org/apache/atlas/discovery/DataSetLineageService.java
+++ b/repository/src/main/java/org/apache/atlas/discovery/DataSetLineageService.java
@@ -218,11 +218,9 @@ public class DataSetLineageService implements LineageService {
* @param guid entity id
*/
private String validateDatasetExists(String guid) throws AtlasException {
- Iterator<AtlasVertex> results = graph.query().has(Constants.GUID_PROPERTY_KEY, guid)
- .has(Constants.SUPER_TYPES_PROPERTY_KEY, AtlasClient.DATA_SET_SUPER_TYPE)
- .vertices().iterator();
- while (results.hasNext()) {
- AtlasVertex vertex = results.next();
+ for (AtlasVertex vertex : (Iterable<AtlasVertex>) graph.query().has(Constants.GUID_PROPERTY_KEY, guid)
+ .has(Constants.SUPER_TYPES_PROPERTY_KEY, AtlasClient.DATA_SET_SUPER_TYPE)
+ .vertices()) {
return GraphHelper.getTypeName(vertex);
}
throw new EntityNotFoundException("Dataset with guid = " + guid + " does not exist");
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/discovery/graph/GraphBackedDiscoveryService.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/discovery/graph/GraphBackedDiscoveryService.java b/repository/src/main/java/org/apache/atlas/discovery/graph/GraphBackedDiscoveryService.java
index c0cc25c..f2a1fe9 100755
--- a/repository/src/main/java/org/apache/atlas/discovery/graph/GraphBackedDiscoveryService.java
+++ b/repository/src/main/java/org/apache/atlas/discovery/graph/GraphBackedDiscoveryService.java
@@ -19,7 +19,6 @@
package org.apache.atlas.discovery.graph;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/gremlin/Gremlin2ExpressionFactory.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/gremlin/Gremlin2ExpressionFactory.java b/repository/src/main/java/org/apache/atlas/gremlin/Gremlin2ExpressionFactory.java
index 6b68961..41dc65f 100644
--- a/repository/src/main/java/org/apache/atlas/gremlin/Gremlin2ExpressionFactory.java
+++ b/repository/src/main/java/org/apache/atlas/gremlin/Gremlin2ExpressionFactory.java
@@ -115,8 +115,7 @@ public class Gremlin2ExpressionFactory extends GremlinExpressionFactory {
GroovyExpression typeMatchesExpr = new ComparisonExpression(typeAttrExpr, ComparisonOperator.EQUALS, typeNameExpr);
GroovyExpression isSuperTypeExpr = new FunctionCallExpression(superTypeAttrExpr, CONTAINS, typeNameExpr);
- GroovyExpression hasSuperTypeAttrExpr = superTypeAttrExpr;
- GroovyExpression superTypeMatchesExpr = new TernaryOperatorExpression(hasSuperTypeAttrExpr, isSuperTypeExpr, LiteralExpression.FALSE);
+ GroovyExpression superTypeMatchesExpr = new TernaryOperatorExpression(superTypeAttrExpr, isSuperTypeExpr, LiteralExpression.FALSE);
return new LogicalExpression(typeMatchesExpr, LogicalOperator.OR, superTypeMatchesExpr);
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/gremlin/Gremlin3ExpressionFactory.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/gremlin/Gremlin3ExpressionFactory.java b/repository/src/main/java/org/apache/atlas/gremlin/Gremlin3ExpressionFactory.java
index ca1ad5d..e862769 100644
--- a/repository/src/main/java/org/apache/atlas/gremlin/Gremlin3ExpressionFactory.java
+++ b/repository/src/main/java/org/apache/atlas/gremlin/Gremlin3ExpressionFactory.java
@@ -130,8 +130,7 @@ public class Gremlin3ExpressionFactory extends GremlinExpressionFactory {
@Override
public GroovyExpression getLoopExpressionParent(GroovyExpression inputQry) {
- GroovyExpression curTraversal = new IdentifierExpression("__");
- return curTraversal;
+ return new IdentifierExpression("__");
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/graph/AtlasGraphProvider.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/AtlasGraphProvider.java b/repository/src/main/java/org/apache/atlas/repository/graph/AtlasGraphProvider.java
index f2bfc6d..0c5cac6 100755
--- a/repository/src/main/java/org/apache/atlas/repository/graph/AtlasGraphProvider.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/AtlasGraphProvider.java
@@ -53,9 +53,7 @@ public class AtlasGraphProvider implements IAtlasGraphProvider {
}
return graphDb_;
}
- catch (IllegalAccessException e) {
- throw new RuntimeException("Error initializing graph database", e);
- } catch (InstantiationException e) {
+ catch (IllegalAccessException | InstantiationException e) {
throw new RuntimeException("Error initializing graph database", e);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/graph/DeleteHandler.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/DeleteHandler.java b/repository/src/main/java/org/apache/atlas/repository/graph/DeleteHandler.java
index ae1ec45..51e9ab1 100644
--- a/repository/src/main/java/org/apache/atlas/repository/graph/DeleteHandler.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/DeleteHandler.java
@@ -202,8 +202,7 @@ public abstract class DeleteHandler {
boolean forceDeleteStructTrait) throws AtlasException {
LOG.debug("Deleting {}", string(edge));
boolean forceDelete =
- (typeCategory == DataTypes.TypeCategory.STRUCT || typeCategory == DataTypes.TypeCategory.TRAIT)
- ? forceDeleteStructTrait : false;
+ (typeCategory == DataTypes.TypeCategory.STRUCT || typeCategory == DataTypes.TypeCategory.TRAIT) && forceDeleteStructTrait;
if (typeCategory == DataTypes.TypeCategory.STRUCT || typeCategory == DataTypes.TypeCategory.TRAIT
|| (typeCategory == DataTypes.TypeCategory.CLASS && isComposite)) {
//If the vertex is of type struct/trait, delete the edge and then the reference vertex as the vertex is not shared by any other entities.
@@ -249,10 +248,8 @@ public abstract class DeleteHandler {
protected void deleteVertex(AtlasVertex instanceVertex, boolean force) throws AtlasException {
//Update external references(incoming edges) to this vertex
LOG.debug("Setting the external references to {} to null(removing edges)", string(instanceVertex));
- Iterator<AtlasEdge> edges = instanceVertex.getEdges(AtlasEdgeDirection.IN).iterator();
- while(edges.hasNext()) {
- AtlasEdge edge = edges.next();
+ for (AtlasEdge edge : (Iterable<AtlasEdge>) instanceVertex.getEdges(AtlasEdgeDirection.IN)) {
Id.EntityState edgeState = GraphHelper.getState(edge);
if (edgeState == Id.EntityState.ACTIVE) {
//Delete only the active edge references
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/graph/EntityProcessor.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/EntityProcessor.java b/repository/src/main/java/org/apache/atlas/repository/graph/EntityProcessor.java
index 59472e4..6eb2e8a 100644
--- a/repository/src/main/java/org/apache/atlas/repository/graph/EntityProcessor.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/EntityProcessor.java
@@ -40,7 +40,7 @@ public final class EntityProcessor implements ObjectGraphWalker.NodeProcessor {
}
public Collection<IReferenceableInstance> getInstances() {
- ArrayList<IReferenceableInstance> instances = new ArrayList<IReferenceableInstance>(idToInstanceMap.values());
+ ArrayList<IReferenceableInstance> instances = new ArrayList<>(idToInstanceMap.values());
Collections.reverse(instances);
return instances;
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java b/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java
index 1a3faf7..f0647a4 100755
--- a/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java
@@ -19,7 +19,6 @@
package org.apache.atlas.repository.graph;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@@ -349,7 +348,6 @@ public class GraphBackedMetadataRepository implements MetadataRepository {
// Entity does not exist - treat as non-error, since the caller
// wanted to delete the entity and it's already gone.
LOG.info("Deletion request ignored for non-existent entity with guid " + guid);
- continue;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java b/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java
index 9ef3160..42a22a8 100755
--- a/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java
@@ -549,7 +549,7 @@ public class GraphBackedSearchIndexer implements SearchIndexer, ActiveStateCh
if (existingIndex == null) {
- List<AtlasPropertyKey> keys = new ArrayList<AtlasPropertyKey>(2);
+ List<AtlasPropertyKey> keys = new ArrayList<>(2);
keys.add(propertyKey);
keys.add(typePropertyKey);
management.createExactMatchIndex(indexName, false, keys);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java b/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
index cb54c3e..6eeddae 100755
--- a/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
@@ -388,7 +388,7 @@ public final class GraphHelper {
String actualPropertyName = GraphHelper.encodePropertyKey(propertyName);
LOG.debug("Reading property {} from {}", actualPropertyName, elementStr);
- return (T)element.getProperty(actualPropertyName, clazz);
+ return element.getProperty(actualPropertyName, clazz);
}
@@ -510,7 +510,7 @@ public final class GraphHelper {
}
public static String getIdFromVertex(AtlasVertex vertex) {
- return vertex.<String>getProperty(Constants.GUID_PROPERTY_KEY, String.class);
+ return vertex.getProperty(Constants.GUID_PROPERTY_KEY, String.class);
}
public static String getTypeName(AtlasVertex instanceVertex) {
@@ -687,7 +687,6 @@ public final class GraphHelper {
}
break;
default:
- continue;
}
}
}
@@ -797,7 +796,7 @@ public final class GraphHelper {
}
public static String string(ITypedReferenceableInstance instance) {
- return String.format("entity[type=%s guid=%]", instance.getTypeName(), instance.getId()._getId());
+ return String.format("entity[type=%s guid=%s]", instance.getTypeName(), instance.getId()._getId());
}
public static String string(AtlasVertex<?,?> vertex) {
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/graph/GraphSchemaInitializer.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/GraphSchemaInitializer.java b/repository/src/main/java/org/apache/atlas/repository/graph/GraphSchemaInitializer.java
index 51d5928..8b03b6a 100644
--- a/repository/src/main/java/org/apache/atlas/repository/graph/GraphSchemaInitializer.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/GraphSchemaInitializer.java
@@ -18,11 +18,8 @@
package org.apache.atlas.repository.graph;
-import org.apache.atlas.repository.graphdb.AtlasGraph;
-import org.apache.atlas.ApplicationProperties;
import org.apache.atlas.setup.SetupException;
import org.apache.atlas.setup.SetupStep;
-import org.apache.commons.configuration.Configuration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/graph/GraphToTypedInstanceMapper.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/GraphToTypedInstanceMapper.java b/repository/src/main/java/org/apache/atlas/repository/graph/GraphToTypedInstanceMapper.java
index 84608d9..1a3c31c 100644
--- a/repository/src/main/java/org/apache/atlas/repository/graph/GraphToTypedInstanceMapper.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/GraphToTypedInstanceMapper.java
@@ -218,8 +218,8 @@ public final class GraphToTypedInstanceMapper {
String edgeLabel = GraphHelper.EDGE_LABEL_PREFIX + propertyName;
ArrayList values = new ArrayList();
- for (int index = 0; index < list.size(); index++) {
- values.add(mapVertexToCollectionEntry(instanceVertex, attributeInfo, elementType, list.get(index),
+ for (Object aList : list) {
+ values.add(mapVertexToCollectionEntry(instanceVertex, attributeInfo, elementType, aList,
edgeLabel));
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/memory/AttributeStores.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/memory/AttributeStores.java b/repository/src/main/java/org/apache/atlas/repository/memory/AttributeStores.java
index a0cbb62..952f73a 100755
--- a/repository/src/main/java/org/apache/atlas/repository/memory/AttributeStores.java
+++ b/repository/src/main/java/org/apache/atlas/repository/memory/AttributeStores.java
@@ -100,7 +100,7 @@ public class AttributeStores {
AbstractAttributeStore(AttributeInfo attrInfo) {
this.attrInfo = attrInfo;
this.nullList = new BooleanArrayList();
- hiddenVals = new HashMap<Integer, Map<String, Object>>();
+ hiddenVals = new HashMap<>();
}
final void setNull(int pos, boolean flag) {
@@ -115,7 +115,7 @@ public class AttributeStores {
List<String> attrNames = type.getNames(attrInfo);
Map<String, Object> m = hiddenVals.get(pos);
if (m == null) {
- m = new HashMap<String, Object>();
+ m = new HashMap<>();
hiddenVals.put(pos, m);
}
for (int i = 2; i < attrNames.size(); i++) {
@@ -455,7 +455,7 @@ public class AttributeStores {
@Override
public void ensureCapacity(int pos) throws RepositoryException {
while (list.size() < pos + 1) {
- list.add((T) null);
+ list.add(null);
}
nullList.size(pos + 1);
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/memory/ClassStore.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/memory/ClassStore.java b/repository/src/main/java/org/apache/atlas/repository/memory/ClassStore.java
index 7fcfffe..4196768 100755
--- a/repository/src/main/java/org/apache/atlas/repository/memory/ClassStore.java
+++ b/repository/src/main/java/org/apache/atlas/repository/memory/ClassStore.java
@@ -26,6 +26,7 @@ import org.apache.atlas.typesystem.persistence.ReferenceableInstance;
import org.apache.atlas.typesystem.types.ClassType;
import java.util.ArrayList;
+import java.util.Objects;
public class ClassStore extends HierarchicalTypeStore {
@@ -35,7 +36,7 @@ public class ClassStore extends HierarchicalTypeStore {
public ClassStore(MemRepository repository, ClassType hierarchicalType) throws RepositoryException {
super(repository, hierarchicalType);
classType = hierarchicalType;
- traitNamesStore = new ArrayList<ImmutableList<String>>();
+ traitNamesStore = new ArrayList<>();
}
void store(ReferenceableInstance i) throws RepositoryException {
@@ -61,7 +62,7 @@ public class ClassStore extends HierarchicalTypeStore {
}
String typeName = typeNameList.get(pos);
- if (typeName != hierarchicalType.getName()) {
+ if (!Objects.equals(typeName, hierarchicalType.getName())) {
throw new RepositoryException(
String.format("Invalid Id (incorrect typeName, type is %s) : %s", typeName, id));
}
@@ -75,7 +76,7 @@ public class ClassStore extends HierarchicalTypeStore {
ReferenceableInstance createInstance(MemRepository repo, Id id) throws RepositoryException {
Integer pos = idPosMap.get(id);
String typeName = typeNameList.get(pos);
- if (typeName != hierarchicalType.getName()) {
+ if (!Objects.equals(typeName, hierarchicalType.getName())) {
return repo.getClassStore(typeName).createInstance(repo, id);
}
@@ -83,8 +84,7 @@ public class ClassStore extends HierarchicalTypeStore {
String[] tNs = traitNames.toArray(new String[]{});
try {
- ReferenceableInstance r = (ReferenceableInstance) classType.createInstance(id, tNs);
- return r;
+ return (ReferenceableInstance) classType.createInstance(id, tNs);
} catch (AtlasException me) {
throw new RepositoryException(me);
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/memory/HierarchicalTypeStore.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/memory/HierarchicalTypeStore.java b/repository/src/main/java/org/apache/atlas/repository/memory/HierarchicalTypeStore.java
index d7acf97..33d78d3 100755
--- a/repository/src/main/java/org/apache/atlas/repository/memory/HierarchicalTypeStore.java
+++ b/repository/src/main/java/org/apache/atlas/repository/memory/HierarchicalTypeStore.java
@@ -64,7 +64,7 @@ public abstract class HierarchicalTypeStore {
this.hierarchicalType = (IConstructableType) hierarchicalType;
this.repository = repository;
ImmutableMap.Builder<AttributeInfo, IAttributeStore> b =
- new ImmutableBiMap.Builder<AttributeInfo, IAttributeStore>();
+ new ImmutableBiMap.Builder<>();
typeNameList = Lists.newArrayList((String) null);
ImmutableList<AttributeInfo> l = hierarchicalType.immediateAttrs;
for (AttributeInfo i : l) {
@@ -72,7 +72,7 @@ public abstract class HierarchicalTypeStore {
}
attrStores = b.build();
- ImmutableList.Builder<HierarchicalTypeStore> b1 = new ImmutableList.Builder<HierarchicalTypeStore>();
+ ImmutableList.Builder<HierarchicalTypeStore> b1 = new ImmutableList.Builder<>();
Set<String> allSuperTypeNames = hierarchicalType.getAllSuperTypeNames();
for (String s : allSuperTypeNames) {
b1.add(repository.getStore(s));
@@ -80,8 +80,8 @@ public abstract class HierarchicalTypeStore {
superTypeStores = b1.build();
nextPos = 0;
- idPosMap = new HashMap<Id, Integer>();
- freePositions = new ArrayList<Integer>();
+ idPosMap = new HashMap<>();
+ freePositions = new ArrayList<>();
lock = new ReentrantReadWriteLock();
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/memory/MemRepository.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/memory/MemRepository.java b/repository/src/main/java/org/apache/atlas/repository/memory/MemRepository.java
index 75b4979..51f50ac 100755
--- a/repository/src/main/java/org/apache/atlas/repository/memory/MemRepository.java
+++ b/repository/src/main/java/org/apache/atlas/repository/memory/MemRepository.java
@@ -117,10 +117,10 @@ public class MemRepository implements IRepository {
* - create a ITypedReferenceableInstance.
* replace any old References ( ids or object references) with new Ids.
*/
- List<ITypedReferenceableInstance> newInstances = new ArrayList<ITypedReferenceableInstance>();
+ List<ITypedReferenceableInstance> newInstances = new ArrayList<>();
ITypedReferenceableInstance retInstance = null;
- Set<ClassType> classTypes = new TreeSet<ClassType>();
- Set<TraitType> traitTypes = new TreeSet<TraitType>();
+ Set<ClassType> classTypes = new TreeSet<>();
+ Set<TraitType> traitTypes = new TreeSet<>();
for (IReferenceableInstance transientInstance : discoverInstances.idToInstanceMap.values()) {
try {
ClassType cT = typeSystem.getDataType(ClassType.class, transientInstance.getTypeName());
@@ -274,8 +274,8 @@ public class MemRepository implements IRepository {
}
public void defineTypes(List<HierarchicalType> types) throws RepositoryException {
- List<TraitType> tTypes = new ArrayList<TraitType>();
- List<ClassType> cTypes = new ArrayList<ClassType>();
+ List<TraitType> tTypes = new ArrayList<>();
+ List<ClassType> cTypes = new ArrayList<>();
for (HierarchicalType h : types) {
if (h.getTypeCategory() == DataTypes.TypeCategory.TRAIT) {
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/memory/ReplaceIdWithInstance.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/memory/ReplaceIdWithInstance.java b/repository/src/main/java/org/apache/atlas/repository/memory/ReplaceIdWithInstance.java
index 9351be9..6741eb8 100755
--- a/repository/src/main/java/org/apache/atlas/repository/memory/ReplaceIdWithInstance.java
+++ b/repository/src/main/java/org/apache/atlas/repository/memory/ReplaceIdWithInstance.java
@@ -50,23 +50,23 @@ public class ReplaceIdWithInstance implements ObjectGraphWalker.NodeProcessor {
@Override
public void processNode(ObjectGraphWalker.Node nd) throws AtlasException {
- if (nd.attributeName == null) {
- // do nothing
- } else if (!nd.aInfo.isComposite || nd.value == null) {
- // do nothing
- } else if (nd.aInfo.dataType().getTypeCategory() == DataTypes.TypeCategory.CLASS) {
- if (nd.value != null && nd.value instanceof Id) {
- Id id = (Id) nd.value;
- ITypedReferenceableInstance r = getInstance(id);
- nd.instance.set(nd.attributeName, r);
+ if (nd.attributeName != null) {
+ if (nd.aInfo.isComposite && nd.value != null) {
+ if (nd.aInfo.dataType().getTypeCategory() == DataTypes.TypeCategory.CLASS) {
+ if (nd.value instanceof Id) {
+ Id id = (Id) nd.value;
+ ITypedReferenceableInstance r = getInstance(id);
+ nd.instance.set(nd.attributeName, r);
+ }
+ } else if (nd.aInfo.dataType().getTypeCategory() == DataTypes.TypeCategory.ARRAY) {
+ DataTypes.ArrayType aT = (DataTypes.ArrayType) nd.aInfo.dataType();
+ nd.instance.set(nd.attributeName,
+ convertToInstances((ImmutableCollection) nd.value, nd.aInfo.multiplicity, aT));
+ } else if (nd.aInfo.dataType().getTypeCategory() == DataTypes.TypeCategory.MAP) {
+ DataTypes.MapType mT = (DataTypes.MapType) nd.aInfo.dataType();
+ nd.instance.set(nd.attributeName, convertToInstances((ImmutableMap) nd.value, nd.aInfo.multiplicity, mT));
+ }
}
- } else if (nd.aInfo.dataType().getTypeCategory() == DataTypes.TypeCategory.ARRAY) {
- DataTypes.ArrayType aT = (DataTypes.ArrayType) nd.aInfo.dataType();
- nd.instance.set(nd.attributeName,
- convertToInstances((ImmutableCollection) nd.value, nd.aInfo.multiplicity, aT));
- } else if (nd.aInfo.dataType().getTypeCategory() == DataTypes.TypeCategory.MAP) {
- DataTypes.MapType mT = (DataTypes.MapType) nd.aInfo.dataType();
- nd.instance.set(nd.attributeName, convertToInstances((ImmutableMap) nd.value, nd.aInfo.multiplicity, mT));
}
}
@@ -78,9 +78,7 @@ public class ReplaceIdWithInstance implements ObjectGraphWalker.NodeProcessor {
}
ImmutableCollection.Builder b = m.isUnique ? ImmutableSet.builder() : ImmutableList.builder();
- Iterator it = val.iterator();
- while (it.hasNext()) {
- Object elem = it.next();
+ for (Object elem : val) {
if (elem instanceof Id) {
Id id = (Id) elem;
elem = getInstance(id);
@@ -100,9 +98,7 @@ public class ReplaceIdWithInstance implements ObjectGraphWalker.NodeProcessor {
return val;
}
ImmutableMap.Builder b = ImmutableMap.builder();
- Iterator<Map.Entry> it = val.entrySet().iterator();
- while (it.hasNext()) {
- Map.Entry elem = it.next();
+ for (Map.Entry elem : (Iterable<Map.Entry>) val.entrySet()) {
Object oldKey = elem.getKey();
Object oldValue = elem.getValue();
Object newKey = oldKey;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStore.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStore.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStore.java
index 1ad04b3..48f8bce 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStore.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStore.java
@@ -19,7 +19,6 @@ package org.apache.atlas.repository.store.graph;
import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.SearchFilter;
-import org.apache.atlas.model.typedef.AtlasClassificationDef;
import org.apache.atlas.model.typedef.AtlasEntityDef;
import org.apache.atlas.model.typedef.AtlasEntityDef.AtlasEntityDefs;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEnumDefStoreV1.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEnumDefStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEnumDefStoreV1.java
index 19c8701..97542d5 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEnumDefStoreV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEnumDefStoreV1.java
@@ -27,7 +27,6 @@ import org.apache.atlas.repository.Constants;
import org.apache.atlas.repository.graphdb.AtlasVertex;
import org.apache.atlas.repository.store.graph.AtlasEnumDefStore;
import org.apache.atlas.repository.util.FilterUtil;
-import org.apache.atlas.type.AtlasType;
import org.apache.atlas.type.AtlasTypeRegistry;
import org.apache.atlas.typesystem.types.DataTypes.TypeCategory;
import org.apache.commons.collections.CollectionUtils;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasGraphUtilsV1.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasGraphUtilsV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasGraphUtilsV1.java
index bef6d18..18b3b85 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasGraphUtilsV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasGraphUtilsV1.java
@@ -69,7 +69,7 @@ public class AtlasGraphUtilsV1 {
}
public static String getIdFromVertex(AtlasVertex vertex) {
- return vertex.<String>getProperty(Constants.GUID_PROPERTY_KEY, String.class);
+ return vertex.getProperty(Constants.GUID_PROPERTY_KEY, String.class);
}
public static String getTypeName(AtlasVertex instanceVertex) {
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java
index ab3b3d9..287ef09 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java
@@ -24,10 +24,6 @@ import org.apache.atlas.AtlasErrorCode;
import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.listener.TypeDefChangeListener;
import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
-import org.apache.atlas.model.typedef.AtlasClassificationDef;
-import org.apache.atlas.model.typedef.AtlasEntityDef;
-import org.apache.atlas.model.typedef.AtlasEnumDef;
-import org.apache.atlas.model.typedef.AtlasStructDef;
import org.apache.atlas.repository.Constants;
import org.apache.atlas.repository.graph.AtlasGraphProvider;
import org.apache.atlas.repository.graphdb.AtlasEdge;
@@ -119,9 +115,7 @@ public class AtlasTypeDefGraphStoreV1 extends AtlasTypeDefGraphStore {
.has(Constants.TYPENAME_PROPERTY_KEY, typeName)
.vertices().iterator();
- AtlasVertex ret = (results != null && results.hasNext()) ? (AtlasVertex) results.next() : null;
-
- return ret;
+ return (results != null && results.hasNext()) ? (AtlasVertex) results.next() : null;
}
AtlasVertex findTypeVertexByNameAndCategory(String typeName, TypeCategory category) {
@@ -130,9 +124,7 @@ public class AtlasTypeDefGraphStoreV1 extends AtlasTypeDefGraphStore {
.has(TYPE_CATEGORY_PROPERTY_KEY, category)
.vertices().iterator();
- AtlasVertex ret = (results != null && results.hasNext()) ? (AtlasVertex) results.next() : null;
-
- return ret;
+ return (results != null && results.hasNext()) ? (AtlasVertex) results.next() : null;
}
AtlasVertex findTypeVertexByGuid(String typeGuid) {
@@ -140,9 +132,7 @@ public class AtlasTypeDefGraphStoreV1 extends AtlasTypeDefGraphStore {
.has(Constants.GUID_PROPERTY_KEY, typeGuid)
.vertices().iterator();
- AtlasVertex ret = (vertices != null && vertices.hasNext()) ? vertices.next() : null;
-
- return ret;
+ return (vertices != null && vertices.hasNext()) ? vertices.next() : null;
}
AtlasVertex findTypeVertexByGuidAndCategory(String typeGuid, TypeCategory category) {
@@ -151,17 +141,14 @@ public class AtlasTypeDefGraphStoreV1 extends AtlasTypeDefGraphStore {
.has(TYPE_CATEGORY_PROPERTY_KEY, category)
.vertices().iterator();
- AtlasVertex ret = (vertices != null && vertices.hasNext()) ? vertices.next() : null;
-
- return ret;
+ return (vertices != null && vertices.hasNext()) ? vertices.next() : null;
}
Iterator<AtlasVertex> findTypeVerticesByCategory(TypeCategory category) {
- Iterator<AtlasVertex> ret = atlasGraph.query().has(VERTEX_TYPE_PROPERTY_KEY, VERTEX_TYPE)
+
+ return (Iterator<AtlasVertex>) atlasGraph.query().has(VERTEX_TYPE_PROPERTY_KEY, VERTEX_TYPE)
.has(TYPE_CATEGORY_PROPERTY_KEY, category)
.vertices().iterator();
-
- return ret;
}
AtlasVertex createTypeVertex(AtlasBaseTypeDef typeDef) {
@@ -175,7 +162,7 @@ public class AtlasTypeDefGraphStoreV1 extends AtlasTypeDefGraphStore {
}
if (typeDef.getVersion() == null) {
- typeDef.setVersion(Long.valueOf(1l));
+ typeDef.setVersion(1L);
}
if (StringUtils.isBlank(typeDef.getGuid())) {
@@ -286,9 +273,7 @@ public class AtlasTypeDefGraphStoreV1 extends AtlasTypeDefGraphStore {
boolean isTypeVertex(AtlasVertex vertex) {
String vertexType = vertex.getProperty(Constants.VERTEX_TYPE_PROPERTY_KEY, String.class);
- boolean ret = VERTEX_TYPE.equals(vertexType);
-
- return ret;
+ return VERTEX_TYPE.equals(vertexType);
}
boolean isTypeVertex(AtlasVertex vertex, TypeCategory category) {
@@ -340,9 +325,8 @@ public class AtlasTypeDefGraphStoreV1 extends AtlasTypeDefGraphStore {
}
AtlasEdge addEdge(AtlasVertex outVertex, AtlasVertex inVertex, String edgeLabel) {
- AtlasEdge ret = atlasGraph.addEdge(outVertex, inVertex, edgeLabel);
- return ret;
+ return atlasGraph.addEdge(outVertex, inVertex, edgeLabel);
}
void createSuperTypeEdges(AtlasVertex vertex, Set<String> superTypes, TypeCategory typeCategory)
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/typestore/GraphBackedTypeStore.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/typestore/GraphBackedTypeStore.java b/repository/src/main/java/org/apache/atlas/repository/typestore/GraphBackedTypeStore.java
index ee63061..c1c2a94 100755
--- a/repository/src/main/java/org/apache/atlas/repository/typestore/GraphBackedTypeStore.java
+++ b/repository/src/main/java/org/apache/atlas/repository/typestore/GraphBackedTypeStore.java
@@ -284,9 +284,7 @@ public class GraphBackedTypeStore implements ITypeStore {
private ImmutableSet<String> getSuperTypes(AtlasVertex vertex) {
Set<String> superTypes = new HashSet<>();
- Iterator<AtlasEdge> edges = vertex.getEdges(AtlasEdgeDirection.OUT, SUPERTYPE_EDGE_LABEL).iterator();
- while (edges.hasNext()) {
- AtlasEdge edge = edges.next();
+ for (AtlasEdge edge : (Iterable<AtlasEdge>) vertex.getEdges(AtlasEdgeDirection.OUT, SUPERTYPE_EDGE_LABEL)) {
superTypes.add(edge.getInVertex().getProperty(Constants.TYPENAME_PROPERTY_KEY, String.class));
}
return ImmutableSet.copyOf(superTypes);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java b/repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java
index d2793d2..c2f8b3f 100755
--- a/repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java
+++ b/repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java
@@ -55,15 +55,11 @@ import org.apache.atlas.typesystem.persistence.ReferenceableInstance;
import org.apache.atlas.typesystem.types.AttributeInfo;
import org.apache.atlas.typesystem.types.ClassType;
import org.apache.atlas.typesystem.types.DataTypes;
-import org.apache.atlas.typesystem.types.EnumTypeDefinition;
-import org.apache.atlas.typesystem.types.HierarchicalTypeDefinition;
import org.apache.atlas.typesystem.types.IDataType;
import org.apache.atlas.typesystem.types.Multiplicity;
-import org.apache.atlas.typesystem.types.StructTypeDefinition;
import org.apache.atlas.typesystem.types.TraitType;
import org.apache.atlas.typesystem.types.TypeSystem;
import org.apache.atlas.typesystem.types.cache.TypeCache;
-import org.apache.atlas.typesystem.types.utils.TypesUtil;
import org.apache.atlas.utils.ParamChecker;
import org.apache.commons.configuration.Configuration;
import org.codehaus.jettison.json.JSONException;
@@ -595,8 +591,7 @@ public class DefaultMetadataService implements MetadataService, ActiveStateChang
guid = ParamChecker.notEmpty(guid, "entity id");
final ITypedReferenceableInstance instance = repository.getEntityDefinition(guid);
- IStruct struct = instance.getTrait(traitName);
- return struct;
+ return instance.getTrait(traitName);
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/util/AtlasRepositoryConfiguration.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/util/AtlasRepositoryConfiguration.java b/repository/src/main/java/org/apache/atlas/util/AtlasRepositoryConfiguration.java
index a270b97..4b6f88f 100644
--- a/repository/src/main/java/org/apache/atlas/util/AtlasRepositoryConfiguration.java
+++ b/repository/src/main/java/org/apache/atlas/util/AtlasRepositoryConfiguration.java
@@ -24,7 +24,6 @@ import org.apache.atlas.repository.audit.HBaseBasedAuditRepository;
import org.apache.atlas.repository.graph.DeleteHandler;
import org.apache.atlas.repository.graph.SoftDeleteHandler;
import org.apache.atlas.repository.graphdb.GraphDatabase;
-import org.apache.atlas.repository.typestore.GraphBackedTypeStore;
import org.apache.atlas.typesystem.types.cache.DefaultTypeCache;
import org.apache.atlas.typesystem.types.cache.TypeCache;
import org.apache.commons.configuration.Configuration;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/util/TypeDefSorter.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/util/TypeDefSorter.java b/repository/src/main/java/org/apache/atlas/util/TypeDefSorter.java
index 0ed370c..733aefd 100644
--- a/repository/src/main/java/org/apache/atlas/util/TypeDefSorter.java
+++ b/repository/src/main/java/org/apache/atlas/util/TypeDefSorter.java
@@ -17,12 +17,9 @@
*/
package org.apache.atlas.util;
-import com.google.common.collect.ImmutableSet;
-
import org.apache.atlas.model.typedef.AtlasClassificationDef;
import org.apache.atlas.model.typedef.AtlasEntityDef;
import org.apache.atlas.model.typedef.AtlasStructDef;
-import org.apache.atlas.typesystem.types.HierarchicalType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;