Skip to content

Commit

Permalink
add hash visibility source to TM vertex id if it exists
Browse files Browse the repository at this point in the history
  • Loading branch information
sfeng88 committed Jul 13, 2016
1 parent 75f09ac commit 546625d
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.visallo.core.model.termMention;

import com.google.common.base.Charsets;
import com.google.common.hash.Hashing;
import org.vertexium.*;
import org.vertexium.mutation.EdgeMutation;
import org.visallo.core.model.properties.VisalloProperties;
Expand Down Expand Up @@ -247,6 +249,12 @@ public Vertex save(Graph graph, VisibilityTranslator visibilityTranslator, User

private String createVertexId() {
String id = TERM_MENTION_VERTEX_ID_PREFIX + this.outVertex.getId();
if (this.visibilityJson == null) {
LOGGER.warn ("Visibility Json should not be null");
} else if (this.visibilityJson.getSource() != null && this.visibilityJson.getSource().length() > 0) {
String hash = Hashing.sha1().hashString(this.visibilityJson.getSource(), Charsets.UTF_8).toString();
id += "-" + hash;
}
if (this.propertyName != null) {
id += "-" + this.propertyName;
}
Expand Down

0 comments on commit 546625d

Please sign in to comment.