atlas git commit: ATLAS-2838: Replace GraphHelper.encodeProperty() with AtlasGraphUtilsV2.encodeProperty()

2018-08-25 Thread sarath
Repository: atlas
Updated Branches:
  refs/heads/branch-1.0 0e632a4ed -> 905cdc226


ATLAS-2838: Replace GraphHelper.encodeProperty() with 
AtlasGraphUtilsV2.encodeProperty()

(cherry picked from commit 0ed9f0e25d2b064bb7728b2d8481968ba4375ba2)


Project: http://git-wip-us.apache.org/repos/asf/atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/905cdc22
Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/905cdc22
Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/905cdc22

Branch: refs/heads/branch-1.0
Commit: 905cdc2264f08f5085b40b8c9b9b805484bcb36e
Parents: 0e632a4
Author: Sarath Subramanian 
Authored: Sat Aug 25 12:06:50 2018 -0700
Committer: Sarath Subramanian 
Committed: Sat Aug 25 12:08:03 2018 -0700

--
 .../org/apache/atlas/type/AtlasStructType.java  | 11 ---
 .../graph/GraphBackedSearchIndexer.java |  5 +--
 .../atlas/repository/graph/GraphHelper.java | 31 ++
 .../store/graph/v2/AtlasGraphUtilsV2.java   |  8 ++---
 .../store/graph/v2/AtlasStructDefStoreV2.java   | 33 +---
 5 files changed, 43 insertions(+), 45 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/atlas/blob/905cdc22/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 b6b4ccd..0c5c91b 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java
@@ -863,10 +863,13 @@ public class AtlasStructType extends AtlasType {
 
 // Keys copied from 
org.janusgraph.graphdb.types.system.SystemTypeManager.RESERVED_CHARS
 // JanusGraph checks that these chars are not part of any keys hence 
encoding
-private static String[][] RESERVED_CHAR_ENCODE_MAP = new String[][] {
-new String[] { "{",  "_o" },
-new String[] { "}",  "_c" },
-new String[] { "\"", "_q" },
+// also including Titan reserved characters to support migrated 
property keys
+private static String[][] RESERVED_CHAR_ENCODE_MAP = new String[][]{
+new String[] {"{", "_o"},
+new String[] {"}", "_c"},
+new String[] {"\"", "_q"},
+new String[] {"$", "_d"}, //titan reserved character
+new String[] {"%", "_p"}, //titan reserved characters
 };
 
 private static final char[] IDX_QRY_OFFENDING_CHARS = { '@', '/', ' ', 
'-' };

http://git-wip-us.apache.org/repos/asf/atlas/blob/905cdc22/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 cb0cbf3..bae2c3f 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
@@ -42,6 +42,7 @@ import org.apache.atlas.repository.graphdb.AtlasGraph;
 import org.apache.atlas.repository.graphdb.AtlasGraphIndex;
 import org.apache.atlas.repository.graphdb.AtlasGraphManagement;
 import org.apache.atlas.repository.graphdb.AtlasPropertyKey;
+import org.apache.atlas.repository.store.graph.v2.AtlasGraphUtilsV2;
 import org.apache.atlas.type.AtlasArrayType;
 import org.apache.atlas.type.AtlasClassificationType;
 import org.apache.atlas.type.AtlasEntityType;
@@ -315,7 +316,7 @@ public class GraphBackedSearchIndexer implements 
SearchIndexer, ActiveStateChang
 }
 
 private void createIndexForAttribute(AtlasGraphManagement management, 
String typeName, AtlasAttributeDef attributeDef) {
-final String propertyName   = 
GraphHelper.encodePropertyKey(typeName + "." + attributeDef.getName());
+final String propertyName   = 
AtlasGraphUtilsV2.encodePropertyKey(typeName + "." + attributeDef.getName());
 AtlasCardinality cardinality= 
toAtlasCardinality(attributeDef.getCardinality());
 boolean  isUnique   = attributeDef.getIsUnique();
 boolean  isIndexable= attributeDef.getIsIndexable();
@@ -729,7 +730,7 @@ public class GraphBackedSearchIndexer implements 
SearchIndexer, ActiveStateChang
 }
 
 private void cleanupIndexForAttribute(AtlasGraphManagement management, 
String typeName, AtlasAttributeDef attributeDef) {
-final String propertyName = GraphHelper.encodePropertyKey(typeName + 
"." + attributeDef.getName());
+final String 

atlas git commit: ATLAS-2838: Replace GraphHelper.encodeProperty() with AtlasGraphUtilsV2.encodeProperty()

2018-08-25 Thread sarath
Repository: atlas
Updated Branches:
  refs/heads/master b6a664df3 -> 0ed9f0e25


ATLAS-2838: Replace GraphHelper.encodeProperty() with 
AtlasGraphUtilsV2.encodeProperty()


Project: http://git-wip-us.apache.org/repos/asf/atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/0ed9f0e2
Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/0ed9f0e2
Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/0ed9f0e2

Branch: refs/heads/master
Commit: 0ed9f0e25d2b064bb7728b2d8481968ba4375ba2
Parents: b6a664d
Author: Sarath Subramanian 
Authored: Sat Aug 25 12:06:50 2018 -0700
Committer: Sarath Subramanian 
Committed: Sat Aug 25 12:06:50 2018 -0700

--
 .../org/apache/atlas/type/AtlasStructType.java  | 11 ---
 .../graph/GraphBackedSearchIndexer.java |  5 +--
 .../atlas/repository/graph/GraphHelper.java | 31 ++
 .../store/graph/v2/AtlasGraphUtilsV2.java   |  8 ++---
 .../store/graph/v2/AtlasStructDefStoreV2.java   | 33 +---
 5 files changed, 43 insertions(+), 45 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/atlas/blob/0ed9f0e2/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 b6b4ccd..0c5c91b 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java
@@ -863,10 +863,13 @@ public class AtlasStructType extends AtlasType {
 
 // Keys copied from 
org.janusgraph.graphdb.types.system.SystemTypeManager.RESERVED_CHARS
 // JanusGraph checks that these chars are not part of any keys hence 
encoding
-private static String[][] RESERVED_CHAR_ENCODE_MAP = new String[][] {
-new String[] { "{",  "_o" },
-new String[] { "}",  "_c" },
-new String[] { "\"", "_q" },
+// also including Titan reserved characters to support migrated 
property keys
+private static String[][] RESERVED_CHAR_ENCODE_MAP = new String[][]{
+new String[] {"{", "_o"},
+new String[] {"}", "_c"},
+new String[] {"\"", "_q"},
+new String[] {"$", "_d"}, //titan reserved character
+new String[] {"%", "_p"}, //titan reserved characters
 };
 
 private static final char[] IDX_QRY_OFFENDING_CHARS = { '@', '/', ' ', 
'-' };

http://git-wip-us.apache.org/repos/asf/atlas/blob/0ed9f0e2/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 cb0cbf3..bae2c3f 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
@@ -42,6 +42,7 @@ import org.apache.atlas.repository.graphdb.AtlasGraph;
 import org.apache.atlas.repository.graphdb.AtlasGraphIndex;
 import org.apache.atlas.repository.graphdb.AtlasGraphManagement;
 import org.apache.atlas.repository.graphdb.AtlasPropertyKey;
+import org.apache.atlas.repository.store.graph.v2.AtlasGraphUtilsV2;
 import org.apache.atlas.type.AtlasArrayType;
 import org.apache.atlas.type.AtlasClassificationType;
 import org.apache.atlas.type.AtlasEntityType;
@@ -315,7 +316,7 @@ public class GraphBackedSearchIndexer implements 
SearchIndexer, ActiveStateChang
 }
 
 private void createIndexForAttribute(AtlasGraphManagement management, 
String typeName, AtlasAttributeDef attributeDef) {
-final String propertyName   = 
GraphHelper.encodePropertyKey(typeName + "." + attributeDef.getName());
+final String propertyName   = 
AtlasGraphUtilsV2.encodePropertyKey(typeName + "." + attributeDef.getName());
 AtlasCardinality cardinality= 
toAtlasCardinality(attributeDef.getCardinality());
 boolean  isUnique   = attributeDef.getIsUnique();
 boolean  isIndexable= attributeDef.getIsIndexable();
@@ -729,7 +730,7 @@ public class GraphBackedSearchIndexer implements 
SearchIndexer, ActiveStateChang
 }
 
 private void cleanupIndexForAttribute(AtlasGraphManagement management, 
String typeName, AtlasAttributeDef attributeDef) {
-final String propertyName = GraphHelper.encodePropertyKey(typeName + 
"." + attributeDef.getName());
+final String propertyName = 
AtlasGraphUtilsV2.encodePropertyKey(typeName + "." + 

atlas git commit: ATLAS-2836: Remove redundant encoding of vertex property keys - #2

2018-08-25 Thread madhan
Repository: atlas
Updated Branches:
  refs/heads/branch-1.0 bcf904d8d -> 0e632a4ed


ATLAS-2836: Remove redundant encoding of vertex property keys - #2


Project: http://git-wip-us.apache.org/repos/asf/atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/0e632a4e
Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/0e632a4e
Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/0e632a4e

Branch: refs/heads/branch-1.0
Commit: 0e632a4ed01da9a22137cab0c63bf2c714e4ea0f
Parents: bcf904d
Author: Madhan Neethiraj 
Authored: Sat Aug 25 10:00:39 2018 -0700
Committer: Madhan Neethiraj 
Committed: Sat Aug 25 10:00:39 2018 -0700

--
 .../store/graph/v2/EntityGraphMapper.java| 19 ---
 1 file changed, 16 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/atlas/blob/0e632a4e/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java
--
diff --git 
a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java
 
b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java
index 52e992c..9496946 100644
--- 
a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java
+++ 
b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java
@@ -35,7 +35,6 @@ import org.apache.atlas.model.instance.EntityMutationResponse;
 import org.apache.atlas.model.instance.EntityMutations.EntityOperation;
 import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
 import 
org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef.Cardinality;
-import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.RepositoryException;
 import org.apache.atlas.repository.converters.AtlasInstanceConverter;
 import org.apache.atlas.repository.graph.GraphHelper;
@@ -77,18 +76,32 @@ import static 
org.apache.atlas.model.instance.EntityMutations.EntityOperation.DE
 import static 
org.apache.atlas.model.instance.EntityMutations.EntityOperation.PARTIAL_UPDATE;
 import static 
org.apache.atlas.model.instance.EntityMutations.EntityOperation.UPDATE;
 import static 
org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef.Cardinality.SET;
+import static 
org.apache.atlas.repository.Constants.ATTRIBUTE_INDEX_PROPERTY_KEY;
 import static org.apache.atlas.repository.Constants.ATTRIBUTE_KEY_PROPERTY_KEY;
+import static org.apache.atlas.repository.Constants.CLASSIFICATION_ENTITY_GUID;
+import static 
org.apache.atlas.repository.Constants.CLASSIFICATION_ENTITY_STATUS;
 import static org.apache.atlas.repository.Constants.CLASSIFICATION_LABEL;
+import static 
org.apache.atlas.repository.Constants.CLASSIFICATION_VALIDITY_PERIODS_KEY;
+import static 
org.apache.atlas.repository.Constants.CLASSIFICATION_VERTEX_PROPAGATE_KEY;
 import static 
org.apache.atlas.repository.Constants.CLASSIFICATION_VERTEX_REMOVE_PROPAGATIONS_KEY;
+import static org.apache.atlas.repository.Constants.CREATED_BY_KEY;
+import static org.apache.atlas.repository.Constants.ENTITY_TYPE_PROPERTY_KEY;
+import static org.apache.atlas.repository.Constants.GUID_PROPERTY_KEY;
+import static org.apache.atlas.repository.Constants.HOME_ID_KEY;
+import static org.apache.atlas.repository.Constants.IS_PROXY_KEY;
+import static 
org.apache.atlas.repository.Constants.MODIFICATION_TIMESTAMP_PROPERTY_KEY;
+import static org.apache.atlas.repository.Constants.MODIFIED_BY_KEY;
+import static 
org.apache.atlas.repository.Constants.RELATIONSHIP_GUID_PROPERTY_KEY;
 import static org.apache.atlas.repository.Constants.STATE_PROPERTY_KEY;
+import static org.apache.atlas.repository.Constants.SUPER_TYPES_PROPERTY_KEY;
+import static org.apache.atlas.repository.Constants.TIMESTAMP_PROPERTY_KEY;
 import static org.apache.atlas.repository.Constants.TRAIT_NAMES_PROPERTY_KEY;
-import static 
org.apache.atlas.repository.Constants.ATTRIBUTE_INDEX_PROPERTY_KEY;
+import static org.apache.atlas.repository.Constants.VERSION_PROPERTY_KEY;
 import static 
org.apache.atlas.repository.graph.GraphHelper.getCollectionElementsUsingRelationship;
 import static 
org.apache.atlas.repository.graph.GraphHelper.getClassificationEdge;
 import static 
org.apache.atlas.repository.graph.GraphHelper.getClassificationVertex;
 import static 
org.apache.atlas.repository.graph.GraphHelper.getDefaultRemovePropagations;
 import static 
org.apache.atlas.repository.graph.GraphHelper.getMapElementsProperty;
-import static 
org.apache.atlas.repository.graph.GraphHelper.getPropagatedTraitNames;
 import static org.apache.atlas.repository.graph.GraphHelper.getStatus;
 import static org.apache.atlas.repository.graph.GraphHelper.getTraitLabel;
 import static