atlas git commit: ATLAS-2836: Remove redundant encoding of vertex property keys - #2
Repository: atlas Updated Branches: refs/heads/branch-1.0 905cdc226 -> 3483b71c7 ATLAS-2836: Remove redundant encoding of vertex property keys - #2 (cherry picked from commit 9c45d2e8e88b8845330632ad2a164448c13840fd) Project: http://git-wip-us.apache.org/repos/asf/atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/3483b71c Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/3483b71c Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/3483b71c Branch: refs/heads/branch-1.0 Commit: 3483b71c7f13164ea8fbaf7e16050f503f2e460e Parents: 905cdc2 Author: Madhan Neethiraj Authored: Sun Aug 26 14:43:11 2018 -0700 Committer: Madhan Neethiraj Committed: Sun Aug 26 19:10:45 2018 -0700 -- .../atlas/repository/graph/GraphHelper.java | 108 --- .../store/graph/v2/EntityGraphMapper.java | 2 +- .../store/graph/v2/EntityGraphRetriever.java| 41 --- .../migration/MigrationBaseAsserts.java | 16 +-- .../atlas/repository/migration/PathTest.java| 5 +- 5 files changed, 33 insertions(+), 139 deletions(-) -- http://git-wip-us.apache.org/repos/asf/atlas/blob/3483b71c/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 19069ba..7885da3 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 @@ -646,83 +646,6 @@ public final class GraphHelper { + edge.getInVertex() + "]"; } -public static void setProperty(T element, String propertyName, Object value) { -String actualPropertyName = AtlasGraphUtilsV2.encodePropertyKey(propertyName); - -String elementStr = null; - -if (LOG.isDebugEnabled()) { -elementStr = string(element); - -LOG.debug("Setting property {} = \"{}\" to {}", actualPropertyName, value, elementStr); -} - -Object existValue = element.getProperty(actualPropertyName, Object.class); -if(value == null || (value instanceof Collection && ((Collection) value).isEmpty())) { -if(existValue != null) { -if (LOG.isDebugEnabled()) { -LOG.debug("Removing property - {} value from {}", actualPropertyName, elementStr); -} - -element.removeProperty(actualPropertyName); -} -} else { -if (!value.equals(existValue)) { -element.setProperty(actualPropertyName, value); - -if (LOG.isDebugEnabled()) { -LOG.debug("Set property {} = \"{}\" to {}", actualPropertyName, value, elementStr); -} -} -} -} - -/** - * Gets the value of a property that is stored in the graph as a single property value. If - * a multi-property such as {@link Constants#TRAIT_NAMES_PROPERTY_KEY} or {@link Constants#SUPER_TYPES_PROPERTY_KEY} - * is used, an exception will be thrown. - * - * @param element - * @param propertyName - * @param clazz - * @return - */ -public static T getSingleValuedProperty(AtlasElement element, String propertyName, Class clazz) { -String actualPropertyName = AtlasGraphUtilsV2.encodePropertyKey(propertyName); - -if (LOG.isTraceEnabled()) { -LOG.trace("Reading property {} from {}", actualPropertyName, string(element)); -} - -return element.getProperty(actualPropertyName, clazz); -} - - -public static Object getProperty(AtlasVertex vertex, String propertyName) { -String actualPropertyName = AtlasGraphUtilsV2.encodePropertyKey(propertyName); - -if (LOG.isTraceEnabled()) { -LOG.trace("Reading property {} from {}", actualPropertyName, string(vertex)); -} - - if(AtlasGraphProvider.getGraphInstance().isMultiProperty(actualPropertyName)) { -return vertex.getPropertyValues(actualPropertyName, String.class); -} -else { -return vertex.getProperty(actualPropertyName, Object.class); -} -} - -public static Object getProperty(AtlasEdge edge, String propertyName) { -String actualPropertyName = AtlasGraphUtilsV2.encodePropertyKey(propertyName); - -if (LOG.isTraceEnabled()) { -LOG.trace("Reading property {} from {}", actualPropertyName, string(edge)); -} - -return edge.getProperty(actualPropertyName, Object.class); -} - private static String string(T element) { if (element instanceof
atlas git commit: ATLAS-2836: Remove redundant encoding of vertex property keys - #2
Repository: atlas Updated Branches: refs/heads/master 0ed9f0e25 -> 9c45d2e8e 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/9c45d2e8 Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/9c45d2e8 Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/9c45d2e8 Branch: refs/heads/master Commit: 9c45d2e8e88b8845330632ad2a164448c13840fd Parents: 0ed9f0e Author: Madhan Neethiraj Authored: Sun Aug 26 14:43:11 2018 -0700 Committer: Madhan Neethiraj Committed: Sun Aug 26 16:20:06 2018 -0700 -- .../atlas/repository/graph/GraphHelper.java | 108 --- .../store/graph/v2/EntityGraphMapper.java | 2 +- .../store/graph/v2/EntityGraphRetriever.java| 41 --- .../migration/MigrationBaseAsserts.java | 16 +-- .../atlas/repository/migration/PathTest.java| 5 +- 5 files changed, 33 insertions(+), 139 deletions(-) -- http://git-wip-us.apache.org/repos/asf/atlas/blob/9c45d2e8/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 19069ba..7885da3 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 @@ -646,83 +646,6 @@ public final class GraphHelper { + edge.getInVertex() + "]"; } -public static void setProperty(T element, String propertyName, Object value) { -String actualPropertyName = AtlasGraphUtilsV2.encodePropertyKey(propertyName); - -String elementStr = null; - -if (LOG.isDebugEnabled()) { -elementStr = string(element); - -LOG.debug("Setting property {} = \"{}\" to {}", actualPropertyName, value, elementStr); -} - -Object existValue = element.getProperty(actualPropertyName, Object.class); -if(value == null || (value instanceof Collection && ((Collection) value).isEmpty())) { -if(existValue != null) { -if (LOG.isDebugEnabled()) { -LOG.debug("Removing property - {} value from {}", actualPropertyName, elementStr); -} - -element.removeProperty(actualPropertyName); -} -} else { -if (!value.equals(existValue)) { -element.setProperty(actualPropertyName, value); - -if (LOG.isDebugEnabled()) { -LOG.debug("Set property {} = \"{}\" to {}", actualPropertyName, value, elementStr); -} -} -} -} - -/** - * Gets the value of a property that is stored in the graph as a single property value. If - * a multi-property such as {@link Constants#TRAIT_NAMES_PROPERTY_KEY} or {@link Constants#SUPER_TYPES_PROPERTY_KEY} - * is used, an exception will be thrown. - * - * @param element - * @param propertyName - * @param clazz - * @return - */ -public static T getSingleValuedProperty(AtlasElement element, String propertyName, Class clazz) { -String actualPropertyName = AtlasGraphUtilsV2.encodePropertyKey(propertyName); - -if (LOG.isTraceEnabled()) { -LOG.trace("Reading property {} from {}", actualPropertyName, string(element)); -} - -return element.getProperty(actualPropertyName, clazz); -} - - -public static Object getProperty(AtlasVertex vertex, String propertyName) { -String actualPropertyName = AtlasGraphUtilsV2.encodePropertyKey(propertyName); - -if (LOG.isTraceEnabled()) { -LOG.trace("Reading property {} from {}", actualPropertyName, string(vertex)); -} - - if(AtlasGraphProvider.getGraphInstance().isMultiProperty(actualPropertyName)) { -return vertex.getPropertyValues(actualPropertyName, String.class); -} -else { -return vertex.getProperty(actualPropertyName, Object.class); -} -} - -public static Object getProperty(AtlasEdge edge, String propertyName) { -String actualPropertyName = AtlasGraphUtilsV2.encodePropertyKey(propertyName); - -if (LOG.isTraceEnabled()) { -LOG.trace("Reading property {} from {}", actualPropertyName, string(edge)); -} - -return edge.getProperty(actualPropertyName, Object.class); -} - private static String string(T element) { if (element instanceof AtlasVertex) { return string((AtlasVertex) element); @@ -732,23 +655,6 @@
atlas git commit: ATLAS-2836: Remove redundant encoding of vertex property keys - #2
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