You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/03/15 14:45:41 UTC

[jira] [Commented] (TINKERPOP-1504) MutationListener doesn't provide property key on property additions

    [ https://issues.apache.org/jira/browse/TINKERPOP-1504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15926283#comment-15926283 ] 

ASF GitHub Bot commented on TINKERPOP-1504:
-------------------------------------------

GitHub user spmallette opened a pull request:

    https://github.com/apache/tinkerpop/pull/571

    TINKERPOP-1504 Added the property key to events for new properties.

    https://issues.apache.org/jira/browse/TINKERPOP-1504
    
    Newly added properties triggered "changed" events when using `EventStrategy` but the specific key that was newly added was not available in the mutation listener. The listener would simply report the new value only. After this change the listener now gets a `DetachedVertexProperty` / `DetachedProperty` with the newly added key and a null value set.
    
    Builds with `mvn clean install` - VOTE +1

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/apache/tinkerpop TINKERPOP-1504

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/tinkerpop/pull/571.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #571
    
----

----


> MutationListener doesn't provide property key on property additions
> -------------------------------------------------------------------
>
>                 Key: TINKERPOP-1504
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1504
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: process
>    Affects Versions: 3.1.4, 3.2.2
>            Reporter: Jason Plurad
>
> The signatures for [MutationListener|https://github.com/apache/tinkerpop/blob/3.1.4/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/event/MutationListener.java#L58] property changes look like this:
> * {{public void vertexPropertyChanged(final Vertex element, final Property oldValue, final Object setValue, final Object... vertexPropertyKeyValues);}}
> * {{public void edgePropertyChanged(final Edge element, final Property oldValue, final Object setValue);}}
> * {{public void vertexPropertyPropertyChanged(final VertexProperty element, final Property oldValue, final Object setValue);}}
> These methods are used when a property is *added* and when a property is *changed*. See usage in [AddPropertyStep|https://github.com/apache/tinkerpop/blob/3.1.4/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AddPropertyStep.java#L93-L98]. When a vertex property is added, the {{oldValue}} is {{null}}, so there is no way for the listener to get the {{String key}} of the added property.
> I can think of a few options here, all of which would be breaking changes:
> # Pass a non-null {{Property}} as the {{oldValue}} that has the property {{key}} but a {{null}} property value. The listener would get the property value from {{setValue}}.
> # Add a {{final String key}} to the signatures above.
> # Change the {{setValue}} to be {{final Property setValue}} so that the key can be gathered from the new value.
> # Add new methods on {{MutationListener}} for {{vertexPropertyAdded()}}, {{edgePropertyAdded()}}, and {{vertexPropertyPropertyAdded()}}.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)